vmmlib  1.7.0
 All Classes Namespaces Functions Pages
vmml Namespace Reference

a wrapper for blas's daxpy routine. More...

Classes

class  AxisAlignedBoundingBox
 
struct  blas_daxpy
 
struct  blas_dgemm
 
struct  blas_dot
 
class  cp3_tensor
 
struct  enable_if
 
struct  enable_if< false, T >
 
struct  except_here
 
class  exception
 
class  frustum
 
class  frustum_culler
 Helper class for OpenGL view frustum culling. More...
 
class  intersection
 
struct  lapack_svd
 
struct  lapack_sym_eigs
 
struct  linear_least_squares
 
class  lowpass_filter
 
class  matrix
 
struct  set_to_zero_functor
 
struct  set_to_identity_functor
 
struct  matrix_equals_allow_inverted_rows
 
struct  matrix_equals_allow_inverted_columns
 
class  compute_pseudoinverse
 
class  qtucker3_tensor
 
class  quaternion
 
class  t3_converter
 
class  t3_hooi
 
class  t3_hopm
 
class  t3_hosvd
 
class  t3_ihooi
 
class  t3_ihopm
 
class  t3_ttm
 
class  t4_converter
 
class  t4_hooi
 
class  t4_hosvd
 
class  t4_ttm
 
class  tensor3
 
class  tensor3_iterator
 
class  tensor3_const_iterator
 
class  tensor4
 
class  tensor_mmapper
 
class  tensor_stats
 
class  tucker3_exporter
 
class  tucker3_importer
 
class  tucker3_tensor
 
class  tucker4_tensor
 
class  validator
 
class  vector
 

Typedefs

typedef AxisAlignedBoundingBox
< float > 
Aabbf
 
typedef frustum< float > frustumf
 
typedef frustum< double > frustumd
 
typedef frustum_culler< float > frustum_cullerf
 
typedef frustum_culler< double > frustum_cullerd
 
typedef matrix< 3, 3, float > mat3f
 
typedef matrix< 3, 3, double > mat3d
 
typedef matrix< 4, 4, float > mat4f
 
typedef matrix< 4, 4, double > mat4d
 
typedef quaternion< float > quaternionf
 
typedef quaternion< double > quaterniond
 
typedef vector< 2, float > vec2f
 
typedef vector< 2, double > vec2d
 
typedef vector< 3, float > vec3f
 
typedef vector< 3, double > vec3d
 
typedef vector< 4, float > vec4f
 
typedef vector< 4, double > vec4d
 

Enumerations

enum  Visibility { VISIBILITY_NONE = 0, VISIBILITY_PARTIAL = 1, VISIBILITY_FULL = 2 }
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &os, const AxisAlignedBoundingBox< T > &aabb)
 
void error_noexcept (const std::string &desc, const except_here &here)
 
template<typename T >
bool solve_jacobi_3x3 (matrix< 3, 3, T > &a, vector< 3, T > &d, matrix< 3, 3, T > &v, size_t &rotationCount)
 
template<size_t M, size_t N, typename T >
bool equals (const matrix< M, N, T > &m0, const matrix< M, N, T > &m1, const T tolerance=std::numeric_limits< T >::epsilon())
 
template<size_t M, size_t N, typename T >
void multiply (const matrix< M, N, T > &left, const matrix< M, N, T > &right, matrix< M, N, T > &result)
 
template<size_t M, size_t N, size_t P, typename T >
void multiply (const matrix< M, P, T > &left, const matrix< P, N, T > &right, matrix< M, N, T > &result)
 
template<size_t M, size_t N, typename T >
enable_if< M==N >::type * identity (matrix< M, N, T > &m)
 
template<typename T >
compute_determinant (const matrix< 1, 1, T > &matrix_)
 
template<typename T >
compute_determinant (const matrix< 2, 2, T > &matrix_)
 
template<typename T >
compute_determinant (const matrix< 3, 3, T > &m_)
 
template<typename T >
compute_determinant (const matrix< 4, 4, T > &m)
 
template<typename T >
bool compute_inverse (const matrix< 2, 2, T > &m_, matrix< 2, 2, T > &inverse_, T tolerance_=std::numeric_limits< T >::epsilon())
 
template<typename T >
bool compute_inverse (const matrix< 3, 3, T > &m_, matrix< 3, 3, T > &inverse_, T tolerance_=std::numeric_limits< T >::epsilon())
 
template<typename T >
bool compute_inverse (const matrix< 4, 4, T > &m_, matrix< 4, 4, T > &inv_, T tolerance_=std::numeric_limits< T >::epsilon())
 
template<size_t M, size_t N, typename T >
matrix< N, M, T > transpose (const matrix< M, N, T > &matrix_)
 
template<size_t M, size_t N, typename T >
bool is_positive_definite (const matrix< M, N, T > &matrix_, const T limit=-1e12, typename enable_if< M==N &&M<=3 >::type *=0)
 
template<size_t M, size_t N, typename T >
void qr_decompose_gram_schmidt (const matrix< M, N, T > &A_, matrix< M, M, T > &Q, matrix< N, N, T > &R)
 
template<size_t M, size_t N, typename T >
void svdecompose (matrix< M, N, T > &a, vector< N, T > &w, matrix< N, N, T > &v)
 
VMML_TEMPLATE_STRING bool equals (const tensor3< I1, I2, I3, T > &t3_0, const tensor3< I1, I2, I3, T > &t3_1, T tolerance)
 
 set_lateral_slice_bwd (i,*lateral_slice)
 
other get_core (other_core)
 
 for (size_t r3=0;r3< R3;++r3)
 
 cast_comp_members ()
 
template<typename T , typename U >
bool equals (T arg0, U arg1)
 
template<size_t M, size_t N, typename T >
matrix< M, N, T > create_translation (const vector< M-1, T > &arg)
 
template<typename T >
matrix< 4, 4, T > create_translation (const vector< 3, T > &arg)
 
template<size_t M, size_t N, typename T >
void apply_translation (matrix< M, N, T > &m, T t0, T t1, T t2)
 
template<size_t M, size_t N, typename T >
matrix< M, N, T > create_rotation (T angle, const vector< M-1, T > &axis)
 
template<typename T >
matrix< 4, 4, T > create_rotation (T angle, const vector< 3, T > &axis)
 
template<size_t M, size_t N, typename T >
void apply_rotation (matrix< M, N, T > &m, T angle, T t0, T t1, T t2)
 
template<size_t M, size_t N, typename T >
matrix< M, N, T > create_scaling (const vector< N-1, T > &arg)
 
template<typename T >
matrix< 4, 4, T > const create_scaling (const vector< 3, T > &arg)
 
template<typename T >
matrix< 4, 4, T > create_scaling (T arg)
 
template<size_t M, typename T >
void zero (vector< M, T > &arg)
 
template<size_t M, typename T >
vector< M, T > min (const vector< M, T > &arg0, const vector< M, T > &arg1)
 
template<size_t M, typename T >
vector< M, T > max (const vector< M, T > &arg0, const vector< M, T > &arg1)
 
template<size_t M, typename T >
manhattan (const vector< M, T > &arg)
 
template<size_t M, typename T >
bool equals (const vector< M, T > &a, const vector< M, T > &b)
 
template<size_t M, typename T >
dot (const vector< M, T > &first, const vector< M, T > &second)
 
template<size_t M, typename T >
vector< M, T > cross (const vector< 3, T > &a, const vector< 3, T > &b)
 
template<size_t M, typename T >
vector< M, T > normalize (const vector< M, T > &vector_)
 
template<typename T >
vector< 4, T > compute_plane (const vector< 3, T > &a, const vector< 3, T > &b, const vector< 3, T > &c)
 
std::ostream & operator<< (std::ostream &os, const Visibility &v)
 

Variables

template<size_t O, size_t P>
enable_if< O<=M &&P<=N >::type
*matrix< M, N, T >
::get_sub_matrix(matrix< O, P,
T > &result, size_t row_offset,
size_t col_offset) const {for(size_t
row=0;row< O;++row){for(size_t
col=0;col< P;++col){result.at(row,
col)=at(row_offset+row,
col_offset+col);}}return
0;}template< size_t M, size_t
N, typename T >template
< size_t O, size_t P >typename
enable_if< O<=M &&P<=N >::type
*matrix< M, N, T >
::set_sub_matrix(const matrix
< O, P, T > &sub_matrix,
size_t row_offset, size_t
col_offset){for(size_t row=0;row
< O;++row){for(size_t col=0;col
< P;++col){at(row_offset+row,
col_offset+col)=sub_matrix.at(row,
col);}}return 0;}template
< size_t M, size_t N, typename
T >inline Tmatrix< M, N, T >
::det() const {return
compute_determinant(*this);}template
< size_t M, size_t N, typename
T >template< size_t O, size_t
P, typename TT >inline bool
matrix< M, N, T >::inverse(matrix
< O, P, TT > &inverse_, T
tolerance, typename enable_if
< M==N &&O==P &&O==M &&M >
=2 &&M<=4, TT >::type *) const
{return compute_inverse(*this,
inverse_, tolerance);}template
< size_t M, size_t N, typename
T >template< size_t O, size_t
P >typename enable_if< O==P
&&M==N &&O==M &&M >=2 >::type
*matrix< M, N, T >
::get_adjugate(matrix< O, P, T >
&adjugate) const
{get_cofactors(adjugate);adjugate=transpose(adjugate);return
0;}template< size_t M, size_t
N, typename T >template
< size_t O, size_t P >typename
enable_if< O==P &&M==N &&O==M
&&M >=2 >::type *matrix< M, N,
T >::get_cofactors(matrix< O,
P, T > &cofactors) const
{matrix< M-1, N-1, T > minor_;const
size_t _negate=1u;for(size_t row_index=0;row_index< M;++row_index){for(size_t col_index=0;col_index< N;++col_index){if((row_index+col_index)&_negate) cofactors(row_index, col_index)=-get_minor(minor_, row_index, col_index);else cofactors(row_index, col_index)=get_minor(minor_, row_index, col_index);}}return 0;}template< size_t M, size_t N, typename T >template< size_t O, size_t P >Tmatrix< M, N, T >::get_minor(matrix< O, P, T > &minor_, size_t row_to_cut, size_t col_to_cut, typename enable_if< O==M-1 &&P==N-1 &&M==N &&M >=2 >::type *) const {size_t row_offset=0;size_t col_offset=0;for(size_t row_index=0;row_index< M;++row_index){if(row_index==row_to_cut) row_offset=-1;else{for(size_t col_index=0;col_index< M;++col_index){if(col_index==col_to_cut) col_offset=-1;else minor_.at(row_index+row_offset, col_index+col_offset)=at(row_index, col_index);}col_offset=0;}}return compute_determinant(minor_);}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::rotate(const TT angle_, const vector< M-1, T > &axis, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);const T _zero=0.0;const T one=1.0;const T two=2.0;array[0]=cosine+(one-cosine)*std::pow(axis.array[0], two);array[1]=(one-cosine)*axis.array[0]*axis.array[1]+sine *axis.array[2];array[2]=(one-cosine)*axis.array[0]*axis.array[2]-sine *axis.array[1];array[3]=_zero;array[4]=(one-cosine)*axis.array[0]*axis.array[1]-sine *axis.array[2];array[5]=cosine+(one-cosine)*std::pow(axis.array[1], two);array[6]=(one-cosine)*axis.array[1]*axis.array[2]+sine *axis.array[0];array[7]=_zero;array[8]=(one-cosine)*axis.array[0]*axis.array[2]+sine *axis.array[1];array[9]=(one-cosine)*axis.array[1]*axis.array[2]-sine *axis.array[0];array[10]=cosine+(one-cosine)*std::pow(axis.array[2], two);array[11]=_zero;array[12]=_zero;array[13]=_zero;array[14]=_zero;array[15]=one;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::rotate_x(const TT angle_, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);T tmp;tmp=array[4]*cosine+array[8]*sine;array[8]=-array[4]*sine+array[8]*cosine;array[4]=tmp;tmp=array[5]*cosine+array[9]*sine;array[9]=-array[5]*sine+array[9]*cosine;array[5]=tmp;tmp=array[6]*cosine+array[10]*sine;array[10]=-array[6]*sine+array[10]*cosine;array[6]=tmp;tmp=array[7]*cosine+array[11]*sine;array[11]=-array[7]*sine+array[11]*cosine;array[7]=tmp;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::rotate_y(const TT angle_, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);T tmp;tmp=array[0]*cosine-array[8]*sine;array[8]=array[0]*sine+array[8]*cosine;array[0]=tmp;tmp=array[1]*cosine-array[9]*sine;array[9]=array[1]*sine+array[9]*cosine;array[1]=tmp;tmp=array[2]*cosine-array[10]*sine;array[10]=array[2]*sine+array[10]*cosine;array[2]=tmp;tmp=array[3]*cosine-array[11]*sine;array[11]=array[3]*sine+array[11]*cosine;array[3]=tmp;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::rotate_z(const TT angle_, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);T tmp;tmp=array[0]*cosine+array[4]*sine;array[4]=-array[0]*sine+array[4]*cosine;array[0]=tmp;tmp=array[1]*cosine+array[5]*sine;array[5]=-array[1]*sine+array[5]*cosine;array[1]=tmp;tmp=array[2]*cosine+array[6]*sine;array[6]=-array[2]*sine+array[6]*cosine;array[2]=tmp;tmp=array[3]*cosine+array[7]*sine;array[7]=-array[3]*sine+array[7]*cosine;array[3]=tmp;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::pre_rotate_x(const TT angle_, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);T tmp;tmp=array[1];array[1]=array[1]*cosine+array[2]*sine;array[2]=tmp *-sine+array[2]*cosine;tmp=array[5];array[5]=array[5]*cosine+array[6]*sine;array[6]=tmp *-sine+array[6]*cosine;tmp=array[9];array[9]=array[9]*cosine+array[10]*sine;array[10]=tmp *-sine+array[10]*cosine;tmp=array[13];array[13]=array[13]*cosine+array[14]*sine;array[14]=tmp *-sine+array[14]*cosine;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::pre_rotate_y(const TT angle_, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);T tmp;tmp=array[0];array[0]=array[0]*cosine-array[2]*sine;array[2]=tmp *sine+array[2]*cosine;tmp=array[4];array[4]=array[4]*cosine-array[6]*sine;array[6]=tmp *sine+array[6]*cosine;tmp=array[8];array[8]=array[8]*cosine-array[10]*sine;array[10]=tmp *sine+array[10]*cosine;tmp=array[12];array[12]=array[12]*cosine-array[14]*sine;array[14]=tmp *sine+array[14]*cosine;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::pre_rotate_z(const TT angle_, typename enable_if< M==N &&M==4, TT >::type *){const T angle=static_cast< T > angle_);const T sine=std::sin(angle);const T cosine=std::cos(angle);T tmp;tmp=array[0];array[0]=array[0]*cosine+array[1]*sine;array[1]=tmp *-sine+array[1]*cosine;tmp=array[4];array[4]=array[4]*cosine+array[5]*sine;array[5]=tmp *-sine+array[5]*cosine;tmp=array[8];array[8]=array[8]*cosine+array[9]*sine;array[9]=tmp *-sine+array[9]*cosine;tmp=array[12];array[12]=array[12]*cosine+array[13]*sine;array[13]=tmp *-sine+array[13]*cosine;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::scale(const TT _scale[3], typename enable_if< M==N &&M==4, TT >::type *){const T scale0=static_cast< T > _scale[0]);const T scale1=static_cast< T > _scale[1]);const T scale2=static_cast< T > _scale[2]);array[0]*=scale0;array[1]*=scale0;array[2]*=scale0;array[3]*=scale0;array[4]*=scale1;array[5]*=scale1;array[6]*=scale1;array[7]*=scale1;array[8]*=scale2;array[9]*=scale2;array[10]*=scale2;array[11]*=scale2;return *this;}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::scale(const TT x_, const T y_, const T z_, typename enable_if< M==N &&M==4, TT >::type *){const T _x=static_cast< T > x_);array[0]*=_x;array[1]*=_x;array[2]*=_x;array[3]*=_x;array[4]*=y_;array[5]*=y_;array[6]*=y_;array[7]*=y_;array[8]*=z_;array[9]*=z_;array[10]*=z_;array[11]*=z_;return *this;}template< size_t M, size_t N, typename T >template< typename TT >inline matrix< M, N, T > &matrix< M, N, T >::scale(const vector< 3, TT > &scale_, typename enable_if< M==N &&M==4, TT >::type *){return scale(scale_.array);}template< size_t M, size_t N, typename T >template< typename TT >matrix< M, N, T > &matrix< M, N, T >::scale_translation(const TT scale_[3], typename enable_if< M==N &&M==4, TT >::type *){array[12]*=static_cast< T > scale_[0]);array[13]*=static_cast< T > scale_[1]);array[14]*=static_cast< T > scale_[2]);return *this;}template< size_t M, size_t N, typename T >template< typename TT >inline matrix< M, N, T > &matrix< M, N, T >::scale_translation(const vector< 3, TT > &scale_, typename enable_if< M==N &&M==4, TT >::type *){return scale_translation(scale_.array);}template< size_t M, size_t N, typename T >template< typename TT >inline matrix< M, N, T > &matrix< M, N, T >::set_translation(const TT x_, const TT y_, const TT z_, typename enable_if< M==N &&M==4, TT >::type *){array[12]=static_cast< T > x_);array[13]=static_cast< T > y_);array[14]=static_cast< T > z_);return *this;}template< size_t M, size_t N, typename T >template< typename TT >inline matrix< M, N, T > &matrix< M, N, T >::set_translation(const TT trans[3], typename enable_if< M==N &&M==4, TT >::type *){array[12]=static_cast< T > trans[0]);array[13]=static_cast< T > trans[1]);array[14]=static_cast< T > trans[2]);return *this;}template< size_t M, size_t N, typename T >template< typename TT >inline matrix< M, N, T > &matrix< M, N, T >::set_translation(const vector< 3, TT > &translation_, typename enable_if< M==N &&M==4, TT >::type *){return set_translation(translation_.array);}template< size_t M, size_t N, typename T > template< typename TT > inlinevoid matrix< M, N, T >::get_translation(vector< N-1, TT > &translation_) const {for(size_t i=0;i< N-1;++i) translation_.array[i]=array[i+M *(N-1)];}template< size_t M, size_t N, typename T >inline vector< N-1, T > matrix< M, N, T >::get_translation() const {vector< N-1, T > result;get_translation(result);return result;}template< size_t M, size_t N, typename T >size_tmatrix< M, N, T >::size() const {return M *N;}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::iteratormatrix< M, N, T >::begin(){return array;}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::iteratormatrix< M, N, T >::end(){return array+size();}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::const_iteratormatrix< M, N, T >::begin() const {return array;}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::const_iteratormatrix< M, N, T >::end() const {return array+size();}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::reverse_iteratormatrix< M, N, T >::rbegin(){return array+size()-1;}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::reverse_iteratormatrix< M, N, T >::rend(){return array-1;}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::const_reverse_iteratormatrix< M, N, T >::rbegin() const {return array+size()-1;}template< size_t M, size_t N, typename T >typename matrix< M, N, T >::const_reverse_iteratormatrix< M, N, T >::rend() const {return array-1;}template< size_t M, size_t N, typename T >template< typename init_functor_t >const matrix< M, N, T >matrix< M, N, T >::get_initialized_matrix(){matrix< M, N, T > matrix_;init_functor_t()(matrix_);return matrix_;}template< size_t M, size_t N, typename T >const matrix< M, N, T >matrix< M, N, T >::IDENTITY(matrix< M, N, T >::get_initialized_matrix< set_to_identity_functor< matrix< M, N, T > > >));template< size_t M, size_t N, typename T >const matrix< M, N, T >matrix< M, N, T >::ZERO(matrix< M, N, T >::get_initialized_matrix< set_to_zero_functor< matrix< M, N, T > > >));template< size_t M, size_t N, typename T >doublematrix< M, N, T >::frobenius_norm() const {double norm=0.0;const_iterator it=begin(), it_end=end();for(;it!=it_end;++it){norm+=*it **it;}return std::sqrt(norm);}template< size_t M, size_t N, typename T >doublematrix< M, N, T >::p_norm(double p) const {double norm=0.0;const_iterator it=begin(), it_end=end();for(;it!=it_end;++it){norm+=std::pow(*it, p);}return std::pow(norm, 1./p);}template< size_t M, size_t N, typename T >template< size_t O >voidmatrix< M, N, T >::khatri_rao_product(const matrix< O, N, T > &right_, matrix< M *O, N, T > &prod_) const {for(size_t col=0;col< N;++col){for(size_t m=0;m< M;++m){for(size_t o=0;o< O;++o){prod_.at(O *m+o, col)=at(m, col)*right_.at(o, col);}}}}template< size_t M, size_t N, typename T >template< size_t O, size_t P >voidmatrix< M, N, T >::kronecker_product(const matrix< O, P, T > &right_, matrix< M *O, N *P, T > &result_) const {for(size_t m=0;m< M;++m){for(size_t n=0;n< N;++n){for(size_t o=0;o< O;++o){for(size_t p=0;p< P;++p){result_.at(O *m+o, P *n+p)=at(m, n)*right_.at(o, p);}}}}}template< size_t M, size_t N, typename T >template< typename TT >voidmatrix< M, N, T >::cast_from(const matrix< M, N, TT > &other){typedef vmml::matrix< M, N, TT > matrix_tt_type;typedef typename matrix_tt_type::const_iterator tt_const_iterator;iterator it=begin(), it_end=end();tt_const_iterator other_it=other.begin();for(;it!=it_end;++it,++other_it){*it=static_cast< T > * 
other_it
 
template<size_t J1, size_t J2, size_t J3>
VMML_TEMPLATE_STRING enable_if
< J1<=I1 &&J2<=I2 &&J3<=I3 >
::type
*VMML_TEMPLATE_CLASSNAME::set_sub_core(const
tensor3< J1, J2, J3, T_coeff >
&sub_data_, size_t row_offset,
size_t col_offset, size_t
slice_offset){_core_comp.set_sub_tensor3(sub_data_,
row_offset, col_offset,
slice_offset);_core.cast_from(_core_comp);}VMML_TEMPLATE_STRING
void
VMML_TEMPLATE_CLASSNAME::als_rand(const
t3_type &data_){typedef
t3_hooi< R1, R2, R3, I1, I2,
I3, T_internal > hooi_type;tucker_als(data_,
typename
hooi_type::init_random());}VMML_TEMPLATE_STRING
template< typename T_init >
tensor_stats
VMML_TEMPLATE_CLASSNAME::decompose(const
t3_type &data_, T_init init,
const size_t max_iterations,
const float tolerance){return
tucker_als(data_, init,
max_iterations, tolerance);}VMML_TEMPLATE_STRING
template< typename T_init >
tensor_stats
VMML_TEMPLATE_CLASSNAME::tucker_als(const
t3_type &data_, T_init init,
const size_t max_iterations,
const float tolerance){tensor_stats
result;t3_comp_type data;data.cast_from(data_);typedef
t3_hooi< R1, R2, R3, I1, I2,
I3, T_internal > hooi_type;result+=hooi_type::als(data,*_u1_comp,*_u2_comp,*_u3_comp,
_core_comp, init,
0, max_iterations, tolerance);cast_members();return
result;}VMML_TEMPLATE_STRING
template< size_t NBLOCKS,
typename T_init > tensor_stats
VMML_TEMPLATE_CLASSNAME::i_tucker_als(const
t3_type &data_, T_init init,
const size_t max_iterations,
const float tolerance){tensor_stats
result;t3_comp_type data;data.cast_from(data_);typedef
t3_ihooi< R1, R2, R3, NBLOCKS,
I1, I2, I3, T_internal >
ihooi_type;result+=ihooi_type::i_als(data,*_u1_comp,*_u2_comp,*_u3_comp,
_core_comp, init,
0, max_iterations, tolerance);cast_members();return
result;}VMML_TEMPLATE_STRING
template< size_t R, size_t
NBLOCKS, typename T_init >
tensor_stats
VMML_TEMPLATE_CLASSNAME::i_cp_tucker_als(const
t3_type &data_, T_init init,
const size_t max_iterations,
const float tolerance){tensor_stats
result;t3_comp_type data;data.cast_from(data_);typedef
t3_ihooi< R1, R2, R3, NBLOCKS,
I1, I2, I3, T_internal >
ihooi_type;result+=ihooi_type::template
i_cp_als< R >data,*_u1_comp,*_u2_comp,*_u3_comp,
_core_comp, init,
0, max_iterations, tolerance);cast_members();return
result;}VMML_TEMPLATE_STRING
template< size_t K1, size_t K2,
size_t K3 > void
VMML_TEMPLATE_CLASSNAME::reduce_ranks(const
tucker3_tensor< K1, K2, K3, I1,
I2, I3, T_value, T_coeff >
&other){assert(R1<=K1);assert(R2
<=K2);assert(R3<=K3);matrix
< I1, K1, T_coeff > *u1=new
matrix< I1, K1, T_coeff >
);other.get_u1(*u1);for(size_t
r1=0;r1< R1;++r1){_u1->
set_column(r1, u1->get_column(r1));}matrix
< I2, K2, T_coeff > *u2=new
matrix< I2, K2, T_coeff >
);other.get_u2(*u2);for(size_t
r2=0;r2< R2;++r2){_u2->
set_column(r2, u2->get_column(r2));}matrix
< I3, K3, T_coeff > *u3=new
matrix< I3, K3, T_coeff >
);other.get_u3(*u3);for(size_t
r3=0;r3< R3;++r3){_u3-> 
set_column (r3, u3->get_column(r3))
 
template<size_t J1, size_t J2, size_t J3>
VMML_TEMPLATE_STRING enable_if
< J1<=I1 &&J2<=I2 &&J3<=I3 >
::type
*VMML_TEMPLATE_CLASSNAME::get_sub_tensor3(tensor3
< J1, J2, J3, T > &result,
size_t row_offset, size_t
col_offset, size_t
slice_offset) const {for(size_t
slice=0;slice< J3;++slice){for(size_t
row=0;row< J1;++row){for(size_t
col=0;col< J2;++col){result.at(row,
col, slice)=at(row_offset+row,
col_offset+col, slice_offset+slice);}}}return
0;}VMML_TEMPLATE_STRING void
VMML_TEMPLATE_CLASSNAME::get_sub_tensor3(char
*data_, const size_t i1_start,
const size_t i1_end, const
size_t i2_start, const size_t
i2_end, const size_t i3_start,
const size_t i3_end) const {T
*t_ptr=(T *)&(data_[0]);for(size_t
slice=i3_start;slice<=i3_end;++slice){for(size_t
col=i2_start;col<=i2_end;++col){for(size_t
row=i1_start;row<=i1_end;++row){*t_ptr=at(row,
col, slice);++t_ptr;}}}}VMML_TEMPLATE_STRING
template< size_t J1, size_t J2,
size_t J3 > typename enable_if
< J1<=I1 &&J2<=I2 &&J3<=I3 >
::type
*VMML_TEMPLATE_CLASSNAME::set_sub_tensor3(const
tensor3< J1, J2, J3, T >
&sub_data_, size_t row_offset,
size_t col_offset, size_t
slice_offset){for(size_t slice=0;slice
< J3;++slice){for(size_t row=0;row
< J1;++row){for(size_t col=0;col
< J2;++col){at(row_offset+row,
col_offset+col, slice_offset+slice)=sub_data_.at(row,
col, slice);}}}return
0;}VMML_TEMPLATE_STRING void
VMML_TEMPLATE_CLASSNAME::set_sub_tensor3(const
char *data_, const size_t
i1_start, const size_t i1_end,
const size_t i2_start, const
size_t i2_end, const size_t
i3_start, const size_t i3_end){T
*t_ptr=(T *)&(data_[0]);for(size_t
slice=i3_start;slice<=i3_end;++slice){for(size_t
col=i2_start;col<=i2_end;++col){for(size_t
row=i1_start;row<=i1_end;++row){at(row,
col, slice)=*t_ptr;++t_ptr;}}}}VMML_TEMPLATE_STRING
typename
VMML_TEMPLATE_CLASSNAME::iterator
VMML_TEMPLATE_CLASSNAME::begin(){return
iterator(*this, true);}VMML_TEMPLATE_STRING
typename
VMML_TEMPLATE_CLASSNAME::iterator
VMML_TEMPLATE_CLASSNAME::end(){return
iterator(*this, false);}VMML_TEMPLATE_STRING
typename
VMML_TEMPLATE_CLASSNAME::const_iterator
VMML_TEMPLATE_CLASSNAME::begin()
const {return const_iterator(*this,
true);}VMML_TEMPLATE_STRING
typename
VMML_TEMPLATE_CLASSNAME::const_iterator
VMML_TEMPLATE_CLASSNAME::end()
const {return const_iterator(*this,
false);}VMML_TEMPLATE_STRING
template< typename
input_iterator_t > void
VMML_TEMPLATE_CLASSNAME::set(input_iterator_t
begin_, input_iterator_t end_,
bool row_major_layout){input_iterator_t
it(begin_);if(row_major_layout){for(size_t
i3=0;i3< I3;++i3){for(size_t
i1=0;i1< I1;++i1){for(size_t
i2=0;i2< I2;++i2,++it){if(it==end_)
return;at(i1, i2, i3)=static_cast
< T > * 
it
 
delete lateral_slice
 
 else
 
tensor3< K1, K2, K3, T_coeff > other_core
 
delete u1
 
delete u2
 
delete u3
 

Detailed Description

a wrapper for blas's daxpy routine.

a wrapper for lapack's DSYEVX routine.

a wrapper for lapack's DGESVD routine.

this is a wrapper for the following lapack routines:

heavily inspired by boost::enable_if http://www.boost.org, file: boost/utility/enable_if.hpp, Copyright 2003 Jaakko Järvi, Jeremiah Willcock, Andrew Lumsdaine

a wrapper for blas's DOT routine.

a wrapper for blas's DGEMM routine.

SUBROUTINE DAXPY(N,DA,DX,INCX,DY,INCY) .. Scalar Arguments .. DOUBLE PRECISION DA INTEGER INCX,INCY,N .. .. Array Arguments .. DOUBLE PRECISION DX(*),DY(*) ..

Purpose

DAXPY constant times a vector plus a vector. uses unrolled loops for increments equal to one.

more information in: http://netlib.org/blas/daxpy.f

SUBROUTINE DGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) .. Scalar Arguments .. DOUBLE PRECISION ALPHA,BETA INTEGER K,LDA,LDB,LDC,M,N CHARACTER TRANSA,TRANSB .. .. Array Arguments .. DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*) ..

Purpose

DGEMM performs one of the matrix-matrix operations

C := alpha*op( A )*op( B ) + beta*C,

where op( X ) is one of

op( X ) = X or op( X ) = X**T,

alpha and beta are scalars, and A, B and C are matrices, with op( A ) an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.

more information in: http://www.netlib.org/blas/dgemm.f
or http://www.netlib.org/clapack/cblas/dgemm.c

REAL FUNCTION SDOT(N,SX,INCX,SY,INCY) .. Scalar Arguments .. INTEGER INCX,INCY,N

.. Array Arguments .. REAL SX(*),SY(*)

Purpose

SDOT forms the dot product of two vectors. uses unrolled loops for increments equal to one. *

more information in: http://netlib.org/blas/sdot.f

xGESV

xGELS

returns a boolean to indicate success of the operation. if the return value is false, you can get the parameters using get_params(). error states:

INFO (output) INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. > 0: if DBDSQR did not converge, INFO specifies how many superdiagonals of an intermediate bidiagonal form B did not converge to zero. See the description of WORK above for details.

more information in: http://www.netlib.org/lapack/double/dgesvd.f

DSYEVX computes selected eigenvalues and, optionally, eigenvectors of a real symmetric matrix A. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues.

returns a boolean to indicate success of the operation. if the return value is false, you can get the parameters using get_params(). error states:

INFO (output) INTEGER = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. > 0: if DBDSQR did not converge, INFO specifies how many superdiagonals of an intermediate bidiagonal form B did not converge to zero. See the description of WORK above for details.

more information in: http://www.netlib.org/lapack/double/dsyevx.f (see also: http://www.netlib.org/lapack/double/dsyev.f , but needs more space)

Variable Documentation

vmml::else
Initial value:
{
VMMLIB_ERROR( "Tensor4: set() not implemented for non-row major", VMMLIB_HERE )

Definition at line 441 of file tensor4.hpp.