Navigation

Operators and Keywords

Function List:

C++ API

oct-norm.cc File Reference

#include <cassert>
#include <cfloat>
#include <cmath>
#include <iostream>
#include <vector>
#include "oct-cmplx.h"
#include "lo-error.h"
#include "lo-ieee.h"
#include "Array.h"
#include "Array-util.h"
#include "CMatrix.h"
#include "dMatrix.h"
#include "fCMatrix.h"
#include "fMatrix.h"
#include "CColVector.h"
#include "dColVector.h"
#include "CRowVector.h"
#include "dRowVector.h"
#include "fCColVector.h"
#include "fColVector.h"
#include "fCRowVector.h"
#include "fRowVector.h"
#include "CSparse.h"
#include "dSparse.h"
#include "dbleSVD.h"
#include "CmplxSVD.h"
#include "floatSVD.h"
#include "fCmplxSVD.h"

Include dependency graph for oct-norm.cc:


Classes

class  norm_accumulator_p< R >
class  norm_accumulator_mp< R >
class  norm_accumulator_2< R >
class  norm_accumulator_1< R >
class  norm_accumulator_inf< R >
class  norm_accumulator_minf< R >
class  norm_accumulator_0< R >

Defines

#define DEFINE_DISPATCHER(FUNC_NAME, ARG_TYPE, RES_TYPE)
#define DEFINE_XNORM_FUNCS(PREFIX, RTYPE)
#define DEFINE_XNORM_SPARSE_FUNCS(PREFIX, RTYPE)
#define DEFINE_COLROW_NORM_FUNCS(PREFIX, RPREFIX, RTYPE)

Functions

template<class T , class R , class ACC >
void vector_norm (const Array< T > &v, R &res, ACC acc)
template<class T , class R , class ACC >
void column_norms (const MArray2< T > &m, MArray< R > &res, ACC acc)
template<class T , class R , class ACC >
void row_norms (const MArray2< T > &m, MArray< R > &res, ACC acc)
template<class T , class R , class ACC >
void column_norms (const MSparse< T > &m, MArray< R > &res, ACC acc)
template<class T , class R , class ACC >
void row_norms (const MSparse< T > &m, MArray< R > &res, ACC acc)
template<class T , class R >
T elem_dual_p (T x, R p)
template<class VectorT , class R >
VectorT dual_p (const VectorT &x, R p, R q)
template<class MatrixT , class VectorT , class R >
R higham (const MatrixT &m, R p, R tol, int maxiter, VectorT &x)
template<class MatrixT , class VectorT , class SVDT , class R >
R matrix_norm (const MatrixT &m, R p, VectorT, SVDT)
template<class MatrixT , class VectorT , class R >
R matrix_norm (const MatrixT &m, R p, VectorT)
template<class T , class R >
void array_norm_2 (const T *v, octave_idx_type n, R &res)

Define Documentation

#define DEFINE_COLROW_NORM_FUNCS ( PREFIX,
RPREFIX,
RTYPE   ) 

Value:

extern OCTAVE_API RPREFIX##RowVector xcolnorms (const PREFIX##Matrix& m, RTYPE p) \
  { return column_norms (m, p); } \
  extern OCTAVE_API RPREFIX##ColumnVector xrownorms (const PREFIX##Matrix& m, RTYPE p) \
  { return row_norms (m, p); } \

#define DEFINE_DISPATCHER ( FUNC_NAME,
ARG_TYPE,
RES_TYPE   ) 

Value:

template <class T, class R> \
RES_TYPE FUNC_NAME (const ARG_TYPE& v, R p) \
{ \
  RES_TYPE res; \
  if (p == 2) \
    FUNC_NAME (v, res, norm_accumulator_2<R> ()); \
  else if (p == 1) \
    FUNC_NAME (v, res, norm_accumulator_1<R> ()); \
  else if (lo_ieee_isinf (p)) \
    { \
      if (p > 0) \
        FUNC_NAME (v, res, norm_accumulator_inf<R> ()); \
      else \
        FUNC_NAME (v, res, norm_accumulator_minf<R> ()); \
    } \
  else if (p == 0) \
    FUNC_NAME (v, res, norm_accumulator_0<R> ()); \
  else if (p > 0) \
    FUNC_NAME (v, res, norm_accumulator_p<R> (p)); \
  else \
    FUNC_NAME (v, res, norm_accumulator_mp<R> (p)); \
  return res; \
}

#define DEFINE_XNORM_FUNCS ( PREFIX,
RTYPE   ) 

Value:

OCTAVE_API RTYPE xnorm (const PREFIX##ColumnVector& x, RTYPE p) \
  { return vector_norm (x, p); } \
  OCTAVE_API RTYPE xnorm (const PREFIX##RowVector& x, RTYPE p) \
  { return vector_norm (x, p); } \
  OCTAVE_API RTYPE xnorm (const PREFIX##Matrix& x, RTYPE p) \
  { return matrix_norm (x, p, PREFIX##Matrix (), PREFIX##SVD ()); } \
  OCTAVE_API RTYPE xfrobnorm (const PREFIX##Matrix& x) \
  { return vector_norm (x, static_cast<RTYPE> (2)); }

#define DEFINE_XNORM_SPARSE_FUNCS ( PREFIX,
RTYPE   ) 

Value:

OCTAVE_API RTYPE xnorm (const Sparse##PREFIX##Matrix& x, RTYPE p) \
  { return matrix_norm (x, p, PREFIX##Matrix ()); } \
  OCTAVE_API RTYPE xfrobnorm (const Sparse##PREFIX##Matrix& x) \
  { \
    RTYPE res; \
    array_norm_2 (x.data (), x.nnz (), res); \
    return res; \
  }


Function Documentation

template<class T , class R >
void array_norm_2 ( const T v,
octave_idx_type  n,
R res 
) [inline]

template<class T , class R , class ACC >
void column_norms ( const MSparse< T > &  m,
MArray< R > &  res,
ACC  acc 
) [inline]

template<class T , class R , class ACC >
void column_norms ( const MArray2< T > &  m,
MArray< R > &  res,
ACC  acc 
) [inline]

template<class VectorT , class R >
VectorT dual_p ( const VectorT &  x,
R  p,
R  q 
) [inline]

template<class T , class R >
T elem_dual_p ( T  x,
R  p 
) [inline]

template<class MatrixT , class VectorT , class R >
R higham ( const MatrixT &  m,
R  p,
R  tol,
int  maxiter,
VectorT &  x 
) [inline]

template<class MatrixT , class VectorT , class R >
R matrix_norm ( const MatrixT &  m,
R  p,
VectorT   
) [inline]

template<class MatrixT , class VectorT , class SVDT , class R >
R matrix_norm ( const MatrixT &  m,
R  p,
VectorT  ,
SVDT   
) [inline]

template<class T , class R , class ACC >
void row_norms ( const MSparse< T > &  m,
MArray< R > &  res,
ACC  acc 
) [inline]

template<class T , class R , class ACC >
void row_norms ( const MArray2< T > &  m,
MArray< R > &  res,
ACC  acc 
) [inline]

template<class T , class R , class ACC >
void vector_norm ( const Array< T > &  v,
R res,
ACC  acc 
) [inline]