STK++ 0.9.13
Arrays and Expressions

The Arrays project provides two kinds of arrays for storing in a two entries arrays (matrices) numeric data. More...

Collaboration diagram for Arrays and Expressions:

Modules

 Slicing Visitors
 A slicing visitor is applied on each column/row of an Expression or Array by using global functions in the STK domain space.
 

Namespaces

namespace  STK::Arrays
 the namespace Arrays contain the enum and utilities method used by the containers classes.
 

Classes

class  STK::CAllocator< Type_, SizeRows_, SizeCols_, Orient_ >
 Allocator for dense Array classes. More...
 
class  STK::OrientedCAllocator< Derived, Arrays::by_col_ >
 Specialization for column-oriented Allocators. More...
 
class  STK::OrientedCAllocator< Derived, Arrays::by_row_ >
 Specialization for row-oriented Allocators. More...
 
class  STK::StructuredCAllocator< Derived, SizeRows_, SizeCols_ >
 Base class for the general by_col_ structured case. More...
 
class  STK::StructuredCAllocator< Derived, 1, SizeCols_ >
 specialization for the point_ case (derived class is a RowVector). More...
 
class  STK::StructuredCAllocator< Derived, SizeRows_, 1 >
 specialization for the vector_ case. More...
 
class  STK::StructuredCAllocator< Derived, 1, 1 >
 specialization for the number_ case. More...
 
struct  STK::MemAllocator< Type_, Size_ >
 template base class for all Allocator classes. More...
 
class  STK::MemSAllocator< Type_, NzMax_, Size_ >
 memory allocator for sparse Array classes. More...
 
class  STK::MemSAllocator1D< Type_, NzMax_ >
 memory allocator for sparse vectors classes. More...
 
struct  STK::BiDirectionalIterator< Array >
 BiDirectionalIterator allows to loop over the element of one dimensional list containers. More...
 
struct  STK::ConstBiDirectionalIterator< Array >
 ConstBiDirectionalIterator allows to loop over the element of one dimensional list containers. More...
 
struct  STK::hidden::IteratorTraits< Derived >
 , More...
 
struct  STK::DenseIteratorBase< Derived >
 IteratorBase is a base class for all iterators on dense arrays/matrix/vector/expressions. More...
 
struct  STK::DenseRandomIterator< Array_ >
 DenseRandomIterator allows to loop over the elements of containers Array. More...
 
struct  STK::ConstDenseRandomIterator< Array >
 ConstDenseRandomIterator allows to loop over the elements of containers Array. More...
 
class  STK::InnerIteratorBase< Array, Derived >
 InnerIteratorBase is a base class for all iterators on allocators. More...
 
struct  STK::SparseIteratorBase< Derived >
 IteratorBase is a base class for all iterators on dense arrays/matrix/vector/expressions. More...
 
class  STK::BinaryOperator< FunctorOp, Lhs, Rhs >
 Generic expression where a binary operator is applied to two expressions. More...
 
class  STK::UnaryOperator< UnaryOp, Lhs >
 Generic expression when unary operator is applied to an expression. More...
 
class  STK::DotProduct< Lhs, Rhs >
 Generic expression where a DotProduct is applied to two expressions. More...
 
class  STK::ArrayByDiagonalProduct< Lhs, Rhs >
 Generic expression where a product operator is applied to two expressions. More...
 
class  STK::DiagonalByArrayProduct< Lhs, Rhs >
 Generic expression where a product operator is applied to two expressions. More...
 
class  STK::VectorByPointProduct< Lhs, Rhs >
 Generic expression where a product operator is applied to two expressions. More...
 
class  STK::PointByArrayProduct< Lhs, Rhs >
 Generic expression where a product operator is applied to two expressions. More...
 
class  STK::ArrayByVectorProduct< Lhs, Rhs >
 Generic expression where a product operator is applied to two expressions. More...
 
class  STK::ArrayByArrayProduct< Lhs, Rhs >
 Generic expression where a product operator is applied to two expressions. More...
 
class  STK::Array1D< Type_, Size_ >
 template one dimensional Arrays. More...
 
class  STK::Array2D< Type_ >
 template two dimensional column (vertically) oriented Array. More...
 
struct  STK::Arrays::SumOp< Lhs, Rhs >
 Array sum (by coefficient) Perform the matrix sum coefficient by coefficient of the Array lhs by the Array rhs. More...
 
struct  STK::Arrays::DifferenceOp< Lhs, Rhs >
 Array difference (by coefficient) Perform the matrix difference coefficient by coefficient of the Array lhs by the Array rhs. More...
 
struct  STK::Arrays::Product< Lhs, Rhs >
 Array product (by coefficient) Perform the matrix product coefficient by coefficient of the Array lhs by the Array rhs. More...
 
struct  STK::Arrays::DivOp< Lhs, Rhs >
 Matricial Division. More...
 
struct  STK::Arrays::MultOp< Lhs, Rhs >
 Array multiplication Perform the matrix product of the Array lhs by the Array rhs. More...
 
struct  STK::Arrays::MultLeftTransposeOp< Lhs, Rhs >
 Array multiplication Perform the matrix product of the transposed Array lhs by the Array rhs. More...
 
struct  STK::Arrays::MultRightTransposeOp< Lhs, Rhs >
 Array multiplication Perform the matrix product of the Array lhs by the transposed Array rhs. More...
 
class  STK::Array2DDiagonal< Type_ >
 Derivation of the Array2DDiagonal class for square arrays of Real. More...
 
class  STK::Array2DLowerTriangular< Type_ >
 Declaration of the lower triangular matrix class. More...
 
class  STK::Array2DNumber< Type_ >
 template number Array. More...
 
class  STK::Array2DPoint< Type_ >
 template one dimensional horizontal Array. More...
 
class  STK::Array2DSquare< Type_ >
 Derivation of the Array2DSquare class for square arrays of Real. More...
 
class  STK::Array2DUpperTriangular< Type_ >
 Declaration of the upper triangular matrix class. More...
 
class  STK::Array2DVector< Type_ >
 template one dimensional horizontal Array. More...
 
class  STK::ArrayBase< Derived >
 base class for template arrays. More...
 
struct  STK::hidden::Traits< Derived >
 , More...
 
struct  STK::hidden::FunctorTraits< Derived, Functor >
 , Utility class that will select the type of operator to apply. More...
 
class  STK::CArray< Type_, SizeRows_, SizeCols_, Orient_ >
 A CArray is a two dimensional array with a continuous storage like a C-array. More...
 
class  STK::CArrayNumber< Type_, Orient_ >
 specialization for the number case. More...
 
class  STK::CArrayPoint< Type_, SizeCols_, Orient_ >
 declaration of the point case. More...
 
class  STK::CArraySquare< Type_, Size_, Orient_ >
 specialization for the square case. More...
 
class  STK::CArrayVector< Type_, SizeRows_, Orient_ >
 specialization for the vector case. More...
 
class  STK::Const::Identity< Type_, Size_ >
 Define the constant identity matrix. More...
 
class  STK::Const::Square< Type_, Size_ >
 Define the constant square matrix. More...
 
class  STK::Const::Array< Type_, SizeRows_, SizeCols_ >
 Define the constant general matrix. More...
 
class  STK::Const::UpperTriangular< Type_, SizeRows_, SizeCols_ >
 Define the constant upper triangular matrix. More...
 
class  STK::Const::LowerTriangular< Type_, SizeRows_, SizeCols_ >
 Define the constant lower triangular matrix. More...
 
class  STK::Const::Point< Type_, Size_ >
 Define the constant point. More...
 
class  STK::Const::Vector< Type_, Size_ >
 Define the constant point. More...
 
class  STK::ExprBase< Derived >
 base class for template evaluation expressions and visitors. More...
 
struct  STK::ApplyFunctorByCol< Derived, Functor >
 class allowing to apply the Functor Functor on each columns of an expression. More...
 
struct  STK::ApplyWeightedFunctorByCol< Derived, Functor >
 class allowing to apply the weighted Functor Functor on each columns of an expression. More...
 
struct  STK::ApplyFunctorByRow< Derived, Functor >
 class allowing to apply the Functor Functor on each rows of an expression. More...
 
struct  STK::ApplyWeightedFunctorByRow< Derived, Functor >
 class allowing to apply the Functor Functor on each rows of an expression. More...
 
struct  STK::ApplyFunctor< Derived, Functor >
 class allowing applying the functor Functor on a vector or row-vector More...
 
struct  STK::ApplyWeightedFunctor< Derived, Functor >
 class allowing applying the weighted functor Functor on a vector or row-vector More...
 
class  STK::IArray1D< Derived >
 template one dimensional Array. More...
 
class  STK::IArray2D< Derived >
 template interface base class for two-dimensional arrays. More...
 
class  STK::IContainer2D< SizeRows_, SizeCols_ >
 Interface base class for 2D containers. More...
 
struct  STK::TRef< ref_ >
 Base class for all referencing containers. More...
 
struct  STK::TRef< 0 >
 
struct  STK::TRef< 1 >
 
struct  STK::TRef<-1 >
 
class  STK::ITContainerBase< Derived >
 Interface base class for 2D containers. More...
 
class  STK::ITContainer< Derived, Structure_ >
 Specialized interface class for all arrays (can be either 2D arrays or 1D arrays). More...
 
class  STK::ITContainer< Derived, Arrays::array2D_ >
 Specialization for array2D_. More...
 
class  STK::ITContainer< Derived, Arrays::square_ >
 
class  STK::ITContainer< Derived, Arrays::lower_triangular_ >
 Specialization for lower_triangular_. More...
 
class  STK::ITContainer< Derived, Arrays::upper_triangular_ >
 Specialization for upper_triangular_. More...
 
class  STK::ITContainer< Derived, Arrays::symmetric_ >
 
class  STK::ITContainer< Derived, Arrays::lower_symmetric_ >
 Specialization for lower_symmetric_. More...
 
class  STK::ITContainer< Derived, Arrays::upper_symmetric_ >
 Specialization for upper_symmetric_. More...
 
class  STK::ITContainer< Derived, Arrays::diagonal_ >
 Specialization for diagonal_. More...
 
class  STK::ITContainer< Derived, Arrays::vector_ >
 Specialization for vector_. More...
 
class  STK::ITContainer< Derived, Arrays::point_ >
 Specialization for point_. More...
 
class  STK::ITContainer< Derived, Arrays::number_ >
 Specialization for number_. More...
 
class  STK::ITContainer1D< Derived >
 Interface base class for homogeneous 1D containers. More...
 
class  STK::ITContainer2D< Derived >
 Interface base class for homogeneous 2D containers like allocators. More...
 
class  STK::SArray1D< Type_, Size_, NzMax_ >
 template one dimensional Arrays. More...
 
class  STK::SArray2D< Type_ >
 template sparse two dimensional column (vertically) oriented Array. More...
 
class  STK::SArray2DDiagonal< Type_ >
 Derivation of the SArray2DDiagonal class for square arrays of Real. More...
 
class  STK::SArray2DLowerTriangular< Type_ >
 Declaration of the lower triangular matrix class. More...
 
class  STK::SArray2DNumber< Type_ >
 template number Array. More...
 
class  STK::SArray2DPoint< Type_ >
 template one dimensional horizontal Array. More...
 
class  STK::SArray2DSquare< Type_ >
 Derivation of the SArray2DSquare class for square arrays of Real. More...
 
class  STK::SArray2DUpperTriangular< Type_ >
 Declaration of the upper triangular matrix class. More...
 
class  STK::SArray2DVector< Type_ >
 template one dimensional horizontal Array. More...
 
class  STK::DiagonalizeAccessor< Lhs >
 Generic expression when a one dimensional vector/point/idagonal expression is "diagonalized". More...
 
class  STK::DiagonalGetterAccessor< Lhs >
 Generic expression when we want to get the diagonal of a two-dimensional square expression. More...
 
class  STK::UpperTriangularizeAccessor< Lhs >
 Generic expression when we want to get the upper-part of a two-dimensional expression. More...
 
class  STK::LowerTriangularizeAccessor< Lhs >
 Generic expression when we want to get the lower-part of a two-dimensional expression. More...
 
class  STK::SymmetrizeAccessor< Lhs >
 Generic expression when we want to get the upper-part of a two-dimensional symmetric expression. More...
 
class  STK::UpperSymmetrizeAccessor< Lhs >
 Generic expression when we want to get the upper-part of a two-dimensional symmetric expression. More...
 
class  STK::LowerSymmetrizeAccessor< Lhs >
 Generic expression when we want to get the lower-part of a two-dimensional symmetric expression. More...
 
class  STK::DiagonalizeOperator< Lhs >
 Generic expression when a one dimensional vector/point/idagonal expression is "diagonalized". More...
 
class  STK::DiagonalGetterOperator< Lhs >
 Generic expression when we want to get the diagonal of a two-dimensional square expression. More...
 
class  STK::UpperTriangularizeOperator< Lhs >
 Generic expression when we want to get the upper-part of a two-dimensional expression. More...
 
class  STK::LowerTriangularizeOperator< Lhs >
 Generic expression when we want to get the lower-part of a two-dimensional expression. More...
 
class  STK::SymmetrizeOperator< Lhs >
 Generic expression when we want to get the upper-part of a two-dimensional symmetric expression. More...
 
class  STK::UpperSymmetrizeOperator< Lhs >
 Generic expression when we want to get the upper-part of a two-dimensional symmetric expression. More...
 
class  STK::LowerSymmetrizeOperator< Lhs >
 Generic expression when we want to get the lower-part of a two-dimensional symmetric expression. More...
 
class  STK::RowAccessor< Lhs >
 Generic expression when the row of an expression is accessed. More...
 
class  STK::ColAccessor< Lhs >
 Generic expression when the column of an expression is accessed. More...
 
class  STK::SubVectorOperator< Lhs, Size_ >
 Generic expression when the sub-part of an expression is accessed (specialization for vectors) More...
 
class  STK::SubVectorOperatorBase< Lhs, Size_, Structure_ >
 Specialization for point_. More...
 
class  STK::SubAccessor< Lhs, SizeRows_, SizeCols_ >
 Generic expression when the sub-part of an expression is accessed. More...
 
class  STK::RowOperator< Lhs >
 Generic expression when the row of an expression is accessed. More...
 
class  STK::ColOperator< Lhs >
 Generic expression when the column of an expression is accessed. More...
 
class  STK::SubOperator< Lhs, SizeRows_, SizeCols_ >
 Generic expression when the sub-part of an expression is accessed. More...
 
class  STK::TransposeAccessor< Lhs >
 Generic expression when an expression is transposed. More...
 
class  STK::TransposeOperator< Lhs >
 Generic expression when an expression is transposed. More...
 
class  STK::ICArray< Derived >
 s More...
 
class  STK::ISparseArray1D< Derived >
 Interface class for SparseArray1D. More...
 

Typedefs

typedef Array2D< RealSTK::ArrayXX
 Specialization of the Array2D class for Real values.
 
typedef Array2DLowerTriangular< RealSTK::ArrayLowerTriangularXX
 Specialization of the Array2D class for lower triangular matrices.
 
typedef Array2DNumber< RealSTK::Number
 final class for a Real horizontal container.
 
typedef Array2DPoint< RealSTK::PointX
 final class for a Real horizontal container.
 
typedef Array2DUpperTriangular< RealSTK::ArrayUpperTriangularXX
 Specialization of the Array2D class for Type values.
 
typedef Array2DVector< RealSTK::Vector
 final class for a Real vertical container.
 
typedef TRef<-1 > STK::IContainerRef
 
typedef SArray2D< RealSTK::SArrayXX
 Specialization of the SArray2D class for Real values.
 
typedef SArray2DLowerTriangular< RealSTK::SArrayLowerTriangularXX
 Specialization of the SArray2D class for lower triangular matrices.
 
typedef SArray2DNumber< RealSTK::SNumberX
 final class for a Real horizontal container.
 
typedef SArray2DPoint< RealSTK::SPointX
 final class for a Real horizontal container.
 
typedef SArray2DUpperTriangular< RealSTK::SArrayUpperTriangularXX
 Specialization of the SArray2D class for Type values.
 
typedef SArray2DVector< RealSTK::SVectorX
 final class for a Real vertical container.
 

Enumerations

enum  STK::Arrays::Dimension {
  STK::Arrays::_0D_ = 0 , STK::Arrays::_1D_ = 1 , STK::Arrays::_2D_ = 2 , STK::Arrays::_3D_ = 3 ,
  STK::Arrays::_4D_ = 4
}
 Intrinsic dimension of the container : 0D, 1D, 2D, 3D or 4D. More...
 
enum  STK::Arrays::Orientation { STK::Arrays::by_row_ =0 , STK::Arrays::by_col_ =1 }
 Define the Storage Orientation of the container. More...
 
enum  STK::Arrays::Storage { STK::Arrays::dense_ =1 , STK::Arrays::sparse_ =0 }
 Define the different type of Array that can be handle by STK++. More...
 
enum  STK::Arrays::Structure {
  STK::Arrays::array2D_ =0 , STK::Arrays::square_ , STK::Arrays::diagonal_ , STK::Arrays::lower_triangular_ ,
  STK::Arrays::upper_triangular_ , STK::Arrays::symmetric_ , STK::Arrays::lower_symmetric_ , STK::Arrays::upper_symmetric_ ,
  STK::Arrays::vector_ , STK::Arrays::point_ , STK::Arrays::number_ , STK::Arrays::expression_
}
 structures of Arrays that can be handled by STK++ More...
 
enum  STK::Arrays::BinaryOperatorType {
  STK::Arrays::equalOp_ , STK::Arrays::notEqualOp_ , STK::Arrays::greaterThanOp_ , STK::Arrays::lessThanOp_ ,
  STK::Arrays::greaterThanOrEqualOp_ , STK::Arrays::lessThanOrEqualOp_ , STK::Arrays::sumOp_ , STK::Arrays::differenceOp_ ,
  STK::Arrays::productOp_ , STK::Arrays::divisionOp_ , STK::Arrays::moduloOp_ , STK::Arrays::minOp_ ,
  STK::Arrays::maxOp_ , STK::Arrays::logicalAndOp_ , STK::Arrays::logicalOrOp_ , STK::Arrays::bitwiseAndOp_ ,
  STK::Arrays::bitwiseOrOp_ , STK::Arrays::bitwiseXorOp_
}
 Kind of operators leading to a BinaryOperator or UnaryOperator. More...
 
enum  STK::Arrays::BinaryOpKind {
  STK::Arrays::binary_op_0D_ = 0 , STK::Arrays::binary_op_1D_ = 1 , STK::Arrays::binary_op_2D_ = 2 , STK::Arrays::binary_op_Diag_2D_ ,
  STK::Arrays::binary_op_Diag_UpTri_ , STK::Arrays::binary_op_Diag_LowTri_ , STK::Arrays::binary_op_Diag_Sym_ , STK::Arrays::binary_op_Diag_UpSym_ ,
  STK::Arrays::binary_op_Diag_LowSym_ , STK::Arrays::binary_op_2D_Diag_ , STK::Arrays::binary_op_2D_UpTri_ , STK::Arrays::binary_op_2D_LowTri_ ,
  STK::Arrays::binary_op_2D_Sym_ , STK::Arrays::binary_op_2D_UpSym_ , STK::Arrays::binary_op_2D_LowSym_ , STK::Arrays::binary_op_UpTri_2D_ ,
  STK::Arrays::binary_op_UpTri_Diag_ , STK::Arrays::binary_op_UpTri_UpTri_ , STK::Arrays::binary_op_UpTri_LowTri_ , STK::Arrays::binary_op_UpTri_Sym_ ,
  STK::Arrays::binary_op_UpTri_UpSym_ , STK::Arrays::binary_op_UpTri_LowSym_ , STK::Arrays::binary_op_LowTri_2D_ , STK::Arrays::binary_op_LowTri_Diag_ ,
  STK::Arrays::binary_op_LowTri_UpTri_ , STK::Arrays::binary_op_LowTri_LowTri_ , STK::Arrays::binary_op_LowTri_Sym_ , STK::Arrays::binary_op_LowTri_UpSym_ ,
  STK::Arrays::binary_op_LowTri_LowSym_ , STK::Arrays::binary_op_Sym_2D_ , STK::Arrays::binary_op_Sym_Diag_ , STK::Arrays::binary_op_Sym_UpTri_ ,
  STK::Arrays::binary_op_Sym_LowTri_ , STK::Arrays::binary_op_Sym_Sym_ , STK::Arrays::binary_op_Sym_UpSym_ , STK::Arrays::binary_op_Sym_LowSym_ ,
  STK::Arrays::binary_op_UpSym_2D_ , STK::Arrays::binary_op_UpSym_Diag_ , STK::Arrays::binary_op_UpSym_UpTri_ , STK::Arrays::binary_op_UpSym_LowTri_ ,
  STK::Arrays::binary_op_UpSym_Sym_ , STK::Arrays::binary_op_UpSym_UpSym_ , STK::Arrays::binary_op_UpSym_LowSym_ , STK::Arrays::binary_op_LowSym_2D_ ,
  STK::Arrays::binary_op_LowSym_Diag_ , STK::Arrays::binary_op_LowSym_UpTri_ , STK::Arrays::binary_op_LowSym_LowTri_ , STK::Arrays::binary_op_LowSym_Sym_ ,
  STK::Arrays::binary_op_LowSym_UpSym_ , STK::Arrays::binary_op_LowSym_LowSym_
}
 Kind of operands in a BinaryOperator. More...
 
enum  STK::Arrays::RangeOpUse {
  STK::Arrays::useLhsSize_ , STK::Arrays::useRhsSize_ , STK::Arrays::useLhsOtherSize_ , STK::Arrays::useRhsOtherSize_ ,
  STK::Arrays::useLhsRange_ , STK::Arrays::useRhsRange_
}
 Allow to disambiguate which rows() or cols() methods must be used which array to use when calling rows(), cols(), range() in Unary, Binary, Reshape,... operators. More...
 

Functions

template<typename Lhs , typename Rhs >
Arrays::SumOp< Lhs, Rhs >::result_type STK::sum (Lhs const &lhs, Rhs const &rhs)
 convenience function for summing two arrays
 
template<typename Lhs , typename Rhs >
Arrays::DifferenceOp< Lhs, Rhs >::result_type STK::difference (Lhs const &lhs, Rhs const &rhs)
 convenience function for differencing two arrays
 
template<typename Lhs , typename Rhs >
Arrays::Product< Lhs, Rhs >::result_type STK::product (Lhs const &lhs, Rhs const &rhs)
 convenience function for the product element by element of two arrays
 
template<typename Lhs , typename Rhs >
Arrays::DivOp< Lhs, Rhs >::result_type STK::div (Lhs const &lhs, Rhs const &rhs)
 convenience function for the division element by element of two arrays
 
template<typename Lhs , typename Rhs >
Arrays::MultOp< Lhs, Rhs >::result_type STK::mult (Lhs const &lhs, Rhs const &rhs)
 convenience function for the multiplication of two matrices
 
template<typename Lhs , typename Rhs , typename Weights >
Arrays::MultOp< Lhs, Rhs >::result_type STK::wmult (Lhs const &lhs, Rhs const &rhs, Weights const &weights)
 convenience function for the multiplication of two matrices
 
template<typename Lhs , typename Rhs >
Arrays::MultLeftTransposeOp< Lhs, Rhs >::result_type STK::multLeftTranspose (Lhs const &lhs, Rhs const &rhs)
 convenience function for the multiplication of two matrices
 
template<typename Lhs , typename Rhs , typename Weights >
Arrays::MultLeftTransposeOp< Lhs, Rhs >::result_type STK::wmultLeftTranspose (Lhs const &lhs, Rhs const &rhs, Weights const &weights)
 convenience function for the multiplication of two matrices
 
template<typename Lhs , typename Rhs >
Arrays::MultRightTransposeOp< Lhs, Rhs >::result_type STK::multRightTranspose (Lhs const &lhs, Rhs const &rhs)
 convenience function for the multiplication of two matrices
 
template<typename Lhs , typename Rhs , typename Weights >
Arrays::MultRightTransposeOp< Lhs, Rhs >::result_type STK::wmultRightTranspose (Lhs const &lhs, Rhs const &rhs, Weights const &weights)
 convenience function for the multiplication of two matrices
 
template<class Container1D1 , class Container1D2 >
Real STK::dot (ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y)
 Compute the dot product.
 
template<class Container1D1 , class Container1D2 , class Container1D3 >
Real STK::weightedDot (ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y, ExprBase< Container1D3 > const &w)
 Compute the dot product.
 
template<class Container1D1 , class Container1D2 >
Real STK::dist (ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y)
 Compute the distance between two vectors.
 
template<class Container1D1 , class Container1D2 , class Container1D3 >
Real STK::weightedDist (ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y, ExprBase< Container1D3 > const &w)
 Compute the weighted distance between two vectors.
 
template<typename Derived >
Array2DSquare< typename Derived::Type > STK::multLeftTranspose (ExprBase< Derived > const &A)
 Array multiplication by its transpose.
 
template<typename Derived >
Array2DSquare< typename Derived::Type > STK::multRightTranspose (ExprBase< Derived > const &A)
 Array multiplication by its transpose.
 
template<typename Derived , typename Weights >
Array2DSquare< typename Derived::Type > STK::weightedMultLeftTranspose (ExprBase< Derived > const &A, ExprBase< Weights > const &weights)
 Weighted matrix multiplication by its transpose.
 
template<typename Derived , typename Weights >
Array2DSquare< typename Derived::Type > STK::weightedMultRightTranspose (ExprBase< Derived > const &A, ExprBase< Weights > const &weights)
 weighted Array multiplication by its transpose
 
String STK::Arrays::structureToString (Structure const &type)
 convert an Arrays::Structure to a String.
 
template<typename Type , int SizeRows_, int SizeCols_, bool Orient_>
ostreamSTK::operator<< (ostream &s, const CAllocator< Type, SizeRows_, SizeCols_, Orient_ > &V)
 output stream for CAllocator.
 
template<class Array >
ostreamSTK::out2D (ostream &os, ITContainer< Array > const &V)
 Method for displaying any two dimensional Array or Expression.
 
template<class Array >
ostreamSTK::out1D (ostream &os, ITContainer1D< Array > const &V)
 Method for displaying any one dimensional Array.
 
template<class Array >
ostreamSTK::operator<< (ostream &s, ITContainer< Array > const &V)
 overload of the << operator for all Arrays and Expressions.
 
template<class Type >
ostreamSTK::operator<< (ostream &s, const ITContainer1D< Type > &V)
 overload of the << operator for all 1D containers.
 
int STK::Arrays::evalSizeCapacity (int m)
 
template<int Size_>
TRange< Size_STK::Arrays::evalRangeCapacity (TRange< Size_ > const &I)
 
template<>
Range STK::Arrays::evalRangeCapacity (Range const &I)
 Specialization for array with unknown size.
 

Detailed Description

The Arrays project provides two kinds of arrays for storing in a two entries arrays (matrices) numeric data.

All the containers you can used in order to stored numeric values are template by the Type of numeric value you want to use. Some predefined type have been defined for the Real and the arithmetic cases.

There is two kind of containers that have been defined and implemented in the STK++ project:

Moreover a Meta-template mechanism (lazy evaluation) for optimization of complex expressions at compile time is available. It is possible to mix any kind of array in such expressions.

Typedef Documentation

◆ ArrayLowerTriangularXX

Specialization of the Array2D class for lower triangular matrices.

An Array2DLowerTriangular is a column oriented 2D container of Real whcih is lower triangular.

Definition at line 57 of file STK_Array2DLowerTriangular.h.

◆ ArrayUpperTriangularXX

Specialization of the Array2D class for Type values.

A Array2DLowerTriangular is a column oriented 2D container of Type whcih is lower triangular.

Definition at line 55 of file STK_Array2DUpperTriangular.h.

◆ ArrayXX

Specialization of the Array2D class for Real values.

An Array is a column oriented 2D container of Real.

Definition at line 53 of file STK_Array2D.h.

◆ IContainerRef

Definition at line 102 of file STK_IContainerRef.h.

◆ Number

final class for a Real horizontal container.

A Number is a row oriented 1D container of Real.

Definition at line 52 of file STK_Array2DNumber.h.

◆ PointX

final class for a Real horizontal container.

A Point is a row oriented 1D container of Real.

Definition at line 53 of file STK_Array2DPoint.h.

◆ SArrayLowerTriangularXX

Specialization of the SArray2D class for lower triangular matrices.

An SArray2DLowerTriangular is a column oriented 2D container of Real whcih is lower triangular.

Definition at line 59 of file STK_SArray2DLowerTriangular.h.

◆ SArrayUpperTriangularXX

Specialization of the SArray2D class for Type values.

A SArray2DLowerTriangular is a column oriented 2D container of Type whcih is lower triangular.

Definition at line 57 of file STK_SArray2DUpperTriangular.h.

◆ SArrayXX

Specialization of the SArray2D class for Real values.

An Array is a column oriented 2D container of Real.

Definition at line 55 of file STK_SArray2D.h.

◆ SNumberX

final class for a Real horizontal container.

A Number is a row oriented 1D container of Real.

Definition at line 54 of file STK_SArray2DNumber.h.

◆ SPointX

final class for a Real horizontal container.

A Point is a row oriented 1D container of Real.

Definition at line 55 of file STK_SArray2DPoint.h.

◆ SVectorX

final class for a Real vertical container.

A Vector is a column oriented 1D container of Real.

Definition at line 60 of file STK_SArray2DVector.h.

◆ Vector

final class for a Real vertical container.

A Vector is a column oriented 1D container of Real.

Definition at line 58 of file STK_Array2DVector.h.

Enumeration Type Documentation

◆ BinaryOperatorType

Kind of operators leading to a BinaryOperator or UnaryOperator.

This enum list the operators leading to binary or unary operators. If both the left-hand side and the right-hand side are expressions then we get a BinaryOperator while if the left-hand side is an expression and right hand side is a number then we get an UnaryOperator. For example, the return type of matrix1+matrix2 is a BinaryOperator. The return type of number+number is an UnaryOperator.

Enumerator
equalOp_ 

operator==

notEqualOp_ 

operator!=

greaterThanOp_ 

operator>

lessThanOp_ 

operator<

greaterThanOrEqualOp_ 

operator>=

lessThanOrEqualOp_ 

operator<=

sumOp_ 

operator+

differenceOp_ 

operator-

productOp_ 

operator*

divisionOp_ 

operator/

moduloOp_ 

operator%

minOp_ 

min operator

maxOp_ 

max operator

logicalAndOp_ 

operator&&

logicalOrOp_ 

operator||

bitwiseAndOp_ 

operator&

bitwiseOrOp_ 

operator|

bitwiseXorOp_ 

operator^

Definition at line 103 of file STK_Arrays_Util.h.

104{
105 equalOp_,
111
112 sumOp_,
114 productOp_,
116 moduloOp_,
117
118 minOp_,
119 maxOp_,
120
123
127};
@ greaterThanOrEqualOp_
operator>=
@ minOp_
min operator
@ moduloOp_
operator%
@ sumOp_
operator+
@ bitwiseOrOp_
operator|
@ bitwiseXorOp_
operator^
@ logicalOrOp_
operator||
@ bitwiseAndOp_
operator&
@ maxOp_
max operator
@ lessThanOp_
operator<
@ notEqualOp_
operator!=
@ lessThanOrEqualOp_
operator<=
@ differenceOp_
operator-
@ greaterThanOp_
operator>
@ productOp_
operator*
@ logicalAndOp_
operator&&
@ divisionOp_
operator/
@ equalOp_
operator==

◆ BinaryOpKind

Kind of operands in a BinaryOperator.

Enumerator
binary_op_0D_ 

both operand are number_

binary_op_1D_ 

both operand are vector or point or diagonal

binary_op_2D_ 

both operand are array2d or square

binary_op_Diag_2D_ 

left operand is diagonal, right operand is 2D

binary_op_Diag_UpTri_ 
binary_op_Diag_LowTri_ 
binary_op_Diag_Sym_ 
binary_op_Diag_UpSym_ 
binary_op_Diag_LowSym_ 
binary_op_2D_Diag_ 

left operand is 2D, right operand is diagonal

binary_op_2D_UpTri_ 
binary_op_2D_LowTri_ 
binary_op_2D_Sym_ 
binary_op_2D_UpSym_ 
binary_op_2D_LowSym_ 
binary_op_UpTri_2D_ 

left operand is upper triangular, right operand is 2D

binary_op_UpTri_Diag_ 
binary_op_UpTri_UpTri_ 
binary_op_UpTri_LowTri_ 
binary_op_UpTri_Sym_ 
binary_op_UpTri_UpSym_ 
binary_op_UpTri_LowSym_ 
binary_op_LowTri_2D_ 

left operand is lower triangular, right operand is 2D

binary_op_LowTri_Diag_ 
binary_op_LowTri_UpTri_ 
binary_op_LowTri_LowTri_ 
binary_op_LowTri_Sym_ 
binary_op_LowTri_UpSym_ 
binary_op_LowTri_LowSym_ 
binary_op_Sym_2D_ 

left operand is symmetric, right operand is 2D

binary_op_Sym_Diag_ 
binary_op_Sym_UpTri_ 
binary_op_Sym_LowTri_ 
binary_op_Sym_Sym_ 
binary_op_Sym_UpSym_ 
binary_op_Sym_LowSym_ 
binary_op_UpSym_2D_ 

left operand is upper symmetric, right operand is 2D

binary_op_UpSym_Diag_ 
binary_op_UpSym_UpTri_ 
binary_op_UpSym_LowTri_ 
binary_op_UpSym_Sym_ 
binary_op_UpSym_UpSym_ 
binary_op_UpSym_LowSym_ 
binary_op_LowSym_2D_ 

left operand is lower symmetric, right operand is 2D

binary_op_LowSym_Diag_ 
binary_op_LowSym_UpTri_ 
binary_op_LowSym_LowTri_ 
binary_op_LowSym_Sym_ 
binary_op_LowSym_UpSym_ 
binary_op_LowSym_LowSym_ 

Definition at line 132 of file STK_Arrays_Util.h.

133{
134 binary_op_0D_ = 0,
135 binary_op_1D_ = 1,
136 binary_op_2D_ = 2,
184
185};
@ binary_op_1D_
both operand are vector or point or diagonal
@ binary_op_LowTri_2D_
left operand is lower triangular, right operand is 2D
@ binary_op_Diag_2D_
left operand is diagonal, right operand is 2D
@ binary_op_LowSym_2D_
left operand is lower symmetric, right operand is 2D
@ binary_op_2D_Diag_
left operand is 2D, right operand is diagonal
@ binary_op_Sym_2D_
left operand is symmetric, right operand is 2D
@ binary_op_UpTri_2D_
left operand is upper triangular, right operand is 2D
@ binary_op_2D_
both operand are array2d or square
@ binary_op_UpSym_2D_
left operand is upper symmetric, right operand is 2D
@ binary_op_0D_
both operand are number_

◆ Dimension

Intrinsic dimension of the container : 0D, 1D, 2D, 3D or 4D.

0D is for scalar

Enumerator
_0D_ 

a single scalar have no dimension

_1D_ 
_2D_ 
_3D_ 
_4D_ 

Definition at line 48 of file STK_Arrays_Util.h.

49{
50 _0D_ = 0,
51 _1D_ = 1,
52 _2D_ = 2,
53 _3D_ = 3,
54 _4D_ = 4
55};
@ _0D_
a single scalar have no dimension

◆ Orientation

Define the Storage Orientation of the container.

Enumerator
by_row_ 

storage by row

by_col_ 

storage by column

Definition at line 59 of file STK_Arrays_Util.h.

60{
61 by_row_ =0,
62 by_col_ =1
63};
@ by_row_
storage by row
@ by_col_
storage by column

◆ RangeOpUse

Allow to disambiguate which rows() or cols() methods must be used which array to use when calling rows(), cols(), range() in Unary, Binary, Reshape,... operators.

Enumerator
useLhsSize_ 

use lhs.rows() (resp. lhs.cols()) in order to get rows() (resp. cols())

useRhsSize_ 

use rhs.rows() (resp. rhs.cols()) in order to get rows() (resp. cols())

useLhsOtherSize_ 

if true, use lhs.cols() in order to get rows() and lhs.rows() in order to get cols()

useRhsOtherSize_ 

if true, use rhs.cols() in order to get rows() and rhs.rows() in order to get cols()

useLhsRange_ 

use lhs.range() in order to get range()

useRhsRange_ 

use rhs.range() in order to get range()

Definition at line 191 of file STK_Arrays_Util.h.

192{
199};
@ useLhsOtherSize_
if true, use lhs.cols() in order to get rows() and lhs.rows() in order to get cols()
@ useRhsOtherSize_
if true, use rhs.cols() in order to get rows() and rhs.rows() in order to get cols()
@ useLhsSize_
use lhs.rows() (resp. lhs.cols()) in order to get rows() (resp. cols())
@ useRhsSize_
use rhs.rows() (resp. rhs.cols()) in order to get rows() (resp. cols())
@ useRhsRange_
use rhs.range() in order to get range()
@ useLhsRange_
use lhs.range() in order to get range()

◆ Storage

Define the different type of Array that can be handle by STK++.

Enumerator
dense_ 

dense matrix/vector/array/expression

sparse_ 

sparse matrix/vector/array/expression

Definition at line 68 of file STK_Arrays_Util.h.

69{
70 dense_ =1,
71 sparse_=0
72};
@ sparse_
sparse matrix/vector/array/expression
@ dense_
dense matrix/vector/array/expression

◆ Structure

structures of Arrays that can be handled by STK++

Enumerator
array2D_ 

general matrix/array/expression

square_ 

square matrix/array/expression

diagonal_ 

diagonal matrix/array/expression

lower_triangular_ 

lower triangular matrix/array/expression

upper_triangular_ 

upper triangular matrix/array/expression

symmetric_ 

symmetric matrix/array/expression

lower_symmetric_ 

lower symmetric matrix/array/expression

upper_symmetric_ 

upper symmetric matrix/array/expression

vector_ 

column oriented vector/array/expression

point_ 

row oriented vector/array/expression

number_ 

(1,1) matrix/vector/array/expression (like a number)

expression_ 

An expression that will be evaluated further.

Definition at line 77 of file STK_Arrays_Util.h.

78{
79 array2D_ =0 ,
80 square_,
81 diagonal_,
87 vector_,
88 point_,
89 number_,
91};
@ array2D_
general matrix/array/expression
@ number_
(1,1) matrix/vector/array/expression (like a number)
@ point_
row oriented vector/array/expression
@ lower_symmetric_
lower symmetric matrix/array/expression
@ lower_triangular_
lower triangular matrix/array/expression
@ expression_
An expression that will be evaluated further.
@ symmetric_
symmetric matrix/array/expression
@ upper_triangular_
upper triangular matrix/array/expression
@ diagonal_
diagonal matrix/array/expression
@ upper_symmetric_
upper symmetric matrix/array/expression
@ vector_
column oriented vector/array/expression
@ square_
square matrix/array/expression

Function Documentation

◆ difference()

template<typename Lhs , typename Rhs >
Arrays::DifferenceOp< Lhs, Rhs >::result_type STK::difference ( Lhs const lhs,
Rhs const rhs 
)

convenience function for differencing two arrays

Definition at line 561 of file STK_Array2D_Functors.h.

562{ return Arrays::DifferenceOp<Lhs, Rhs>(lhs, rhs)();}

◆ dist()

Real STK::dist ( ExprBase< Container1D1 > const x,
ExprBase< Container1D2 > const y 
)

Compute the distance between two vectors.

Compute the Euclidian distance between x and y without overflow.

\[ d(x,y) = || x - y|| = \sqrt{\sum_{i=1}^n |x_i - y_i|^2}. \]

The common range of the vectors is used. The value outside the range are thus interpreted as equal.

Parameters
[in]xfirst vector
[in]ysecond vector
Returns
the Euclidian distance between x and y

Definition at line 692 of file STK_Array2D_Functors.h.

693{
694 // compute the valid range
695 const int first = std::max(x.begin(), y.begin()) , last = std::min(x.lastIdx(), y.lastIdx());
696 // compute the std::maximal difference
697 Real scale = 0.;
698 for (int i = first; i<=last; i++)
699 scale = std::max(scale, std::abs(x[i] - y[i]));
700 // Compute the norm
701 Real norm2 = 0.;
702 if (scale)
703 { // comp the norm^2
704 for (int i = first; i<=last; i++)
705 {
706 const Real aux = (x[i]-y[i])/scale;
707 norm2 += aux * aux;
708 }
709 }
710 // rescale sum
711 return (Real(sqrt(double(norm2)))*scale);
712}
double Real
STK fundamental type of Real values.

Referenced by STK::LocalVariance< Array >::minimalDistance(), STK::LocalVariance< Array >::prim(), and STK::Law::stringToUnivariateDistribution().

◆ div()

template<typename Lhs , typename Rhs >
Arrays::DivOp< Lhs, Rhs >::result_type STK::div ( Lhs const lhs,
Rhs const rhs 
)

convenience function for the division element by element of two arrays

Definition at line 575 of file STK_Array2D_Functors.h.

576{ return Arrays::DivOp<Lhs, Rhs>(lhs, rhs)();}

◆ dot()

Real STK::dot ( ExprBase< Container1D1 > const x,
ExprBase< Container1D2 > const y 
)

Compute the dot product.

Dot product of the vector x and the vector y: d = <x, y>.

\[ <x,y> = \sum_{i=1}^n x_i y_i \]

The common range of the vectors is used. The value outside the range are thus interpreted as zero.

Parameters
[in]xfirst vector
[in]ysecond vector
Returns
the dot product of the two vectors

Definition at line 633 of file STK_Array2D_Functors.h.

634{
635 // compute the valid range
636 const int first = std::max(x.begin(), y.begin()) , end = std::min(x.end(), y.end());
637 // compute the sum product
638 Real sum=0.0;
639 for (int i = first; i<end; ++i) sum += x[i] * y[i];
640 return (sum);
641}
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays

References STK::sum().

Referenced by STK::Svd< Array >::compU(), STK::Svd< Array >::compV(), STK::gramSchmidt(), STK::Arrays::MultOp< Lhs, Rhs >::operator()(), STK::Arrays::MultLeftTransposeOp< Lhs, Rhs >::operator()(), STK::Arrays::MultRightTransposeOp< Lhs, Rhs >::operator()(), and STK::ExprBase< Derived >::wsum().

◆ evalRangeCapacity() [1/2]

template<>
Range STK::Arrays::evalRangeCapacity ( Range const I)
inline

Specialization for array with unknown size.

Parameters
Ithe range of the container

Definition at line 78 of file STK_IArray1D.h.

79{
80 int n = 0;
81 for (int k=1; k <= I.size(); k <<= 1){ n++;}
82 return Range(I.begin(),I.size() + n);
83}
TRange< UnknownSize > Range
Definition STK_Range.h:59

◆ evalRangeCapacity() [2/2]

template<int Size_>
TRange< Size_ > STK::Arrays::evalRangeCapacity ( TRange< Size_ > const I)
inline
Parameters
Irange of the container
Template Parameters
Size_The size of the array. For fixed size return the range unmodified

Definition at line 72 of file STK_IArray1D.h.

72{ return I;}

Referenced by STK::IArray1D< Derived >::allocate().

◆ evalSizeCapacity()

int STK::Arrays::evalSizeCapacity ( int  m)
inline
Returns
n+m, where n is the first number such that m < 2^n.
Parameters
mthe size of the container

Definition at line 60 of file STK_IArray1D.h.

61{
62 int n = 0;
63 for (int k=1; k <= m; k <<= 1) {n++;}
64 return(m+n);
65}

Referenced by STK::IArray2D< Derived >::mallocCols(), and STK::IArray2D< Derived >::reallocCols().

◆ mult()

◆ multLeftTranspose() [1/2]

template<typename Derived >
Array2DSquare< typename Derived::Type > STK::multLeftTranspose ( ExprBase< Derived > const A)

Array multiplication by its transpose.

Perform the matrix product $ A'A $.

Parameters
[in]Athe matrix to multiply by itself

Definition at line 766 of file STK_Array2D_Functors.h.

767{
768 typedef typename Derived::Type Type;
769 Array2DSquare<Type> res(A.cols(), Type(0));
770 for (int i=A.beginCols(); i<=A.lastIdxCols(); i++)
771 {
772 // diagonal
773 for (int k = A.beginRows(); k< A.endRows(); k++) res(i, i) += A(k, i) * A(k, i);
774 // outside diagonal
775 for (int j=A.beginCols(); j<i; j++)
776 {
777 for (int k = A.beginRows(); k< A.endRows(); k++)
778 res(i, j) += A(k, i) * A(k, j);
779 res(j, i) = res(i, j);
780 }
781 }
782 return res;
783}

◆ multLeftTranspose() [2/2]

template<typename Lhs , typename Rhs >
Arrays::MultLeftTransposeOp< Lhs, Rhs >::result_type STK::multLeftTranspose ( Lhs const lhs,
Rhs const rhs 
)

convenience function for the multiplication of two matrices

Definition at line 596 of file STK_Array2D_Functors.h.

597{ return Arrays::MultLeftTransposeOp<Lhs, Rhs>(lhs, rhs)();}

Referenced by STK::MultidimRegression< Array, Weight >::regressionStep().

◆ multRightTranspose() [1/2]

template<typename Derived >
Array2DSquare< typename Derived::Type > STK::multRightTranspose ( ExprBase< Derived > const A)

Array multiplication by its transpose.

Perform the matrix product $ AA' $.

Parameters
[in]Athe matrix to multiply by itself

Definition at line 793 of file STK_Array2D_Functors.h.

794{
795 typedef typename Derived::Type Type;
796 Array2DSquare<Type> res(A.rows(), Type(0));
797 for (int i=A.beginRows(); i<=A.lastIdxRows(); i++)
798 {
799 // compute diagonal
800 for (int k = A.beginCols(); k< A.endCols(); k++)
801 res(i, i) += A(i, k) * A(i, k);
802 // compute outside diagonal
803 for (int j=A.beginRows(); j<i; j++)
804 {
805 for (int k = A.beginCols(); k< A.endCols(); k++)
806 res(i, j) += A(i, k) * A(j, k);
807 res(j, i) = res(i, j);
808 }
809 }
810 return res;
811}

◆ multRightTranspose() [2/2]

template<typename Lhs , typename Rhs >
Arrays::MultRightTransposeOp< Lhs, Rhs >::result_type STK::multRightTranspose ( Lhs const lhs,
Rhs const rhs 
)

convenience function for the multiplication of two matrices

Definition at line 610 of file STK_Array2D_Functors.h.

611{ return Arrays::MultRightTransposeOp<Lhs, Rhs>(lhs, rhs)();}

◆ operator<<() [1/3]

template<typename Type , int SizeRows_, int SizeCols_, bool Orient_>
ostream & STK::operator<< ( ostream s,
const CAllocator< Type, SizeRows_, SizeCols_, Orient_ > &  V 
)

output stream for CAllocator.

Parameters
sthe output stream
Vthe CArray to write

Definition at line 221 of file STK_CArray.h.

222{
223 CArray<Type, SizeRows_, SizeCols_, Orient_> wrap(V);
224 return out2D(s,wrap);
225}
ostream & out2D(ostream &os, ITContainer< Array > const &V)
Method for displaying any two dimensional Array or Expression.
Definition STK_Display.h:52

References STK::out2D().

◆ operator<<() [2/3]

template<class Type >
ostream & STK::operator<< ( ostream s,
const ITContainer1D< Type > &  V 
)

overload of the << operator for all 1D containers.

Parameters
sthe output stream
Vthe Array1D to write

Definition at line 106 of file STK_Display.h.

107{ return out1D(s,V);}
ostream & out1D(ostream &os, ITContainer1D< Array > const &V)
Method for displaying any one dimensional Array.
Definition STK_Display.h:75

References STK::out1D().

◆ operator<<() [3/3]

template<class Array >
ostream & STK::operator<< ( ostream s,
ITContainer< Array > const V 
)

overload of the << operator for all Arrays and Expressions.

Parameters
sthe output stream
Vthe Array/Expression to write

Definition at line 97 of file STK_Display.h.

98{ return out2D<Array>(s,V);}

◆ out1D()

template<class Array >
ostream & STK::out1D ( ostream os,
ITContainer1D< Array > const V 
)

Method for displaying any one dimensional Array.

The Array is exported in ReadWriteCsv and the the csv is written in the output stream.

Parameters
osthe output stream
Vthe Array or Expression to write

Definition at line 75 of file STK_Display.h.

76{
77 // Export by row to csv the Array
78 ExportToCsv exportcsv(V, false);
79 // get the csv
80 ReadWriteCsv* pData = exportcsv.p_readWriteCsv();
81 // set delimiters to blank
82 pData->setDelimiters(_T(" "));
83 pData->setWithNames(false);
84 // write the csv in os
85 pData->write(os);
86 // return ostream
87 return os;
88}
#define _T(x)
Let x unmodified.
class TReadWriteCsv< String > ReadWriteCsv

References _T.

Referenced by STK::operator<<(), and STK::operator<<().

◆ out2D()

template<class Array >
ostream & STK::out2D ( ostream os,
ITContainer< Array > const V 
)

Method for displaying any two dimensional Array or Expression.

The Array/Expression is exported in a ReadWriteCsv and the the csv is written in the output stream.

Parameters
osthe output stream
Vthe Array or Expression to write

Definition at line 52 of file STK_Display.h.

53{
54 // Export to csv the Array
55 ExportToCsv exportcsv(V);
56 // get the csv
57 ReadWriteCsv* pData = exportcsv.p_readWriteCsv();
58 // set delimiters to blank
59 pData->setDelimiters(_T(" "));
60 pData->setWithNames(false);
61 // write the csv in os
62 pData->write(os);
63 // return ostream
64 return os;
65}

References _T.

Referenced by STK::operator<<().

◆ product()

template<typename Lhs , typename Rhs >
Arrays::Product< Lhs, Rhs >::result_type STK::product ( Lhs const lhs,
Rhs const rhs 
)

convenience function for the product element by element of two arrays

Definition at line 568 of file STK_Array2D_Functors.h.

569{ return Arrays::Product<Lhs, Rhs>(lhs, rhs)();}

◆ structureToString()

String STK::Arrays::structureToString ( Structure const type)
inline

convert an Arrays::Structure to a String.

Parameters
typethe type of Structure we want to convert
Returns
the string associated to this type.

Definition at line 206 of file STK_Arrays_Util.h.

207{
208 if (type == array2D_) return String(_T("array2D"));
209 if (type == square_) return String(_T("square"));
210 if (type == diagonal_) return String(_T("diagonal"));
211 if (type == lower_triangular_) return String(_T("lower_triangular"));
212 if (type == upper_triangular_) return String(_T("upper_triangular"));
213 if (type == symmetric_) return String(_T("symmetric"));
214 if (type == lower_symmetric_) return String(_T("lower_symmetric"));
215 if (type == upper_symmetric_) return String(_T("upper_symmetric"));
216 if (type == vector_) return String(_T("vector"));
217 if (type == point_) return String(_T("point"));
218 if (type == number_) return String(_T("number"));
219 if (type == expression_) return String(_T("expression"));
220 return String(_T("unknown"));
221}
std::basic_string< Char > String
STK fundamental type of a String.

References _T, STK::Arrays::array2D_, STK::Arrays::diagonal_, STK::Arrays::expression_, STK::Arrays::lower_symmetric_, STK::Arrays::lower_triangular_, STK::Arrays::number_, STK::Arrays::point_, STK::Arrays::square_, STK::Arrays::symmetric_, STK::Arrays::upper_symmetric_, STK::Arrays::upper_triangular_, and STK::Arrays::vector_.

Referenced by STK::ArrayBase< Derived >::assign().

◆ sum()

template<typename Lhs , typename Rhs >
Arrays::SumOp< Lhs, Rhs >::result_type STK::sum ( Lhs const lhs,
Rhs const rhs 
)

convenience function for summing two arrays

Definition at line 554 of file STK_Array2D_Functors.h.

555{ return Arrays::SumOp<Lhs, Rhs>(lhs, rhs)();}

Referenced by STK::Funct::betaRatio_sr(), STK::LocalVariance< Array >::computeCovarianceMatrices(), STK::LocalVariance< Array >::computeCovarianceMatrices(), STK::Law::Categorical::computeCumProb(), STK::IMixtureStatModel::computeICL(), STK::IMultiStatModel< Derived >::computeLnLikelihood(), STK::IUnivStatModel< ColVector, WColVector, UnivariateLaw >::computeLnLikelihood(), STK::IMixtureStatModel::computeLnLikelihood(), STK::JointBernoulliModel< Array, WColVector >::computeLnLikelihood(), STK::JointGammaModel< Array, WColVector >::computeLnLikelihood(), STK::JointGaussianModel< Array, WColVector >::computeLnLikelihood(), STK::ModelBernoulli_pj< Data_, WColVector_ >::computeLnLikelihood(), STK::ModelDiagGaussian_muj_sj< Data_, WColVector_ >::computeLnLikelihood(), STK::ModelGamma_aj_bj< Data_, WColVector_ >::computeLnLikelihood(), STK::Categorical_pjk< Array >::computeNbFreeParameters(), STK::HDMatrixGaussianModel< IdRow_, IdCol_, Array_ >::computeNbFreeParameters(), STK::IMixtureStatModel::computeNbFreeParameters(), STK::IMixtureStatModel::computeNbMissingValues(), STK::BernoulliModel< Array, WColVector >::computeParameters(), STK::JointBernoulliModel< Array, WColVector >::computeParameters(), STK::ModelBernoulli_pj< Data_, WColVector_ >::computeParameters(), STK::BernoulliModel< Array, WColVector >::computeParameters(), STK::JointBernoulliModel< Array, WColVector >::computeParameters(), STK::ModelBernoulli_pj< Data_, WColVector_ >::computeParameters(), STK::Funct::dev0(), STK::SymEigen< SquareArray >::diagonalize(), STK::dot(), STK::ExprBase< Derived >::dot(), STK::dotHouse(), STK::IMixtureComposer::eStep(), STK::MixtureSemiLearner::eStep(), STK::IMixtureComposer::eStep(), STK::Funct::expm1(), STK::Funct::g0(), STK::gaussianLnLikelihood(), STK::PoissonBase< Derived >::impute(), STK::DiagGaussianBase< Derived >::impute(), STK::GammaBase< Derived >::impute(), STK::HDGaussianBase< Derived >::impute(), STK::PoissonBase< Derived >::impute(), STK::hidden::InvertLowerTriangularImpl< Matrix, Size_ >::invertLowerTriangularXX(), STK::hidden::InvertUpperTriangularImpl< Matrix, Size_ >::invertUpperTriangularXX(), STK::Funct::lanczosSerie(), STK::CategoricalBase< Derived >::lnComponentProbability(), STK::DiagGaussianBase< Derived >::lnComponentProbability(), STK::GammaBase< Derived >::lnComponentProbability(), STK::HDGaussian_AjkBkQkD< Array >::lnComponentProbability(), STK::PoissonBase< Derived >::lnComponentProbability(), STK::MixtureComposer::lnComponentProbability(), STK::MixtureLearner::lnComponentProbability(), STK::MultiLaw::Normal< RowVector >::lnLikelihood(), STK::MultiLaw::JointProbability< RowVector, Law >::lpdf(), STK::IMixtureLearner::mapStep(), STK::hidden::MultPointArray< Lhs, Rhs, Result >::mult(), STK::hidden::MultImpl< Type >::PanelByVector(), STK::DiagGaussian_s< Array >::randomInit(), STK::Kmm_sk::randomInit(), STK::Categorical_pjk< Array >::run(), STK::Categorical_pk< Array >::run(), STK::DiagGaussian_s< Array >::run(), STK::Gamma_a_bk< Array >::run(), STK::Gamma_aj_bk< Array >::run(), STK::Poisson_ljlk< Array >::run(), STK::sumAlternateSerie(), STK::sumSerie(), STK::ITContainer< Derived, Arrays::square_ >::trace(), STK::ITContainer< Derived, Arrays::symmetric_ >::trace(), STK::ITContainer< Derived, Arrays::lower_symmetric_ >::trace(), STK::ITContainer< Derived, Arrays::upper_symmetric_ >::trace(), STK::hidden::MultImpl< Type >::vectorByVector(), and STK::weightedDot().

◆ weightedDist()

Compute the weighted distance between two vectors.

Compute the weighted Euclidian distance between x and y without overflow.

\[ d(x,y) = || x - y|| = \sqrt{\sum_{i=1}^n w_i |x_i - y_i|^2}. \]

The common range of the vectors is used. The value outside the range are thus interpreted as equal.

Parameters
[in]xfirst vector
[in]ysecond vector
[in]wthe weight of the data
Returns
the weighted Euclidian distance between x and y

Definition at line 729 of file STK_Array2D_Functors.h.

733{
734 // compute the valid range
735 const int first = std::max(x.begin(), y.begin()) , last = std::min(x.lastIdx(), y.lastIdx());
736#ifdef STK_DEBUG
737 if (!Range(first,last).isIn(w.range()))
738 throw runtime_error("In weightedDist(x, w) "
739 "Range(first,last) not include in w.range()");
740#endif
741 // compute the std::maximal difference
742 Real scale = 0., norm2= 0.;
743 for (int i = first; i<=last; i++)
744 scale = std::max(scale, std::abs(w[i]*(x[i] - y[i])));
745 // Compute the norm
746 if (scale)
747 { // comp the norm^2
748 for (int i = first; i<=last; i++)
749 {
750 const Real aux = (x[i]-y[i])/scale;
751 norm2 += w[i]*aux * aux;
752 }
753 }
754 // rescale sum
755 return (Real(sqrt(double(norm2)))*scale);
756}

◆ weightedDot()

Compute the dot product.

Weighted dot product of the vector x and the vector y:

\[ <x,y> = \sum_{i=1}^n w_i x_i y_i. \]

The common range of the vectors is used. The value outside the range are thus interpreted as zero.

Parameters
[in]xfirst vector
[in]ysecond vector
[in]wthe weights to apply
Returns
the weighted dot product of the two vectors

Definition at line 657 of file STK_Array2D_Functors.h.

661{
662 // compute the valid range
663 const int first = std::max(x.begin(), y.begin()) , last = std::min(x.lastIdx(), y.lastIdx());
664#ifdef STK_DEBUG
665 if (!Range(first,last,0).isIn(w.range()))
666 { STKRUNTIME_ERROR_2ARG(In weightedDot(x,y,w),Range(first,last,0),w.range(),first:last not include in w.range());}
667#endif
668 // compute the sum product
669 Real sum=0.0;
670 int i;
671 for (i = first; i<last; i+=2)
672 sum += w[i]*x[i] * y[i] + w[i+1]*x[i+1] * y[i+1];
673 // check if last is odd
674 if (i == last) sum += w[last]*x[last]*y[last];
675 return (sum);
676}
#define STKRUNTIME_ERROR_2ARG(Where, Arg1, Arg2, Error)
Definition STK_Macros.h:120
Real weightedDot(ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y, ExprBase< Container1D3 > const &w)
Compute the dot product.

References STKRUNTIME_ERROR_2ARG, STK::sum(), and STK::weightedDot().

Referenced by STK::Arrays::MultOp< Lhs, Rhs >::operator()(), STK::Arrays::MultLeftTransposeOp< Lhs, Rhs >::operator()(), STK::Arrays::MultRightTransposeOp< Lhs, Rhs >::operator()(), and STK::weightedDot().

◆ weightedMultLeftTranspose()

template<typename Derived , typename Weights >
Array2DSquare< typename Derived::Type > STK::weightedMultLeftTranspose ( ExprBase< Derived > const A,
ExprBase< Weights > const weights 
)

Weighted matrix multiplication by its transpose.

Perform the matrix product $ A'WA $.

Parameters
Athe matrix to multiply by itself
weightsthe weights of the product

Definition at line 823 of file STK_Array2D_Functors.h.

824{
825 typedef typename Derived::Type Type;
826 Array2DSquare<Type> res(A.cols(), Type(0));
827 for (int i=A.beginCols(); i<=A.lastIdxCols(); i++)
828 {
829 // diagonal
830 for (int k = A.beginRows(); k< A.endRows(); k++)
831 res(i, i) += weights[k] * A(k, i) * A(k, i);
832 // outside diagonal
833 for (int j=A.beginCols(); j<i; j++)
834 {
835 for (int k = A.beginRows(); k< A.endRows(); k++)
836 res(i, j) += weights[k] * A(k, i) * A(k, j);
837 res(j, i) = res(i, j);
838 }
839 }
840 return res;
841}

Referenced by STK::MultidimRegression< Array, Weight >::regressionStep().

◆ weightedMultRightTranspose()

template<typename Derived , typename Weights >
Array2DSquare< typename Derived::Type > STK::weightedMultRightTranspose ( ExprBase< Derived > const A,
ExprBase< Weights > const weights 
)

weighted Array multiplication by its transpose

Perform the matrix product $ AWA' $.

Parameters
Athe matrix to multiply by itself
weightsthe weights of the product

Definition at line 853 of file STK_Array2D_Functors.h.

854{
855 typedef typename Derived::Type Type;
856 Array2DSquare<Type> res(A.cols(), Type(0));
857 for (int i=A.beginRows(); i<=A.lastIdxRows(); i++)
858 {
859 // compute diagonal
860 for (int k = A.beginCols(); k< A.endCols(); k++)
861 res(i, i) += weights[k] *A(i, k) * A(i, k);
862 // compute outside diagonal
863 for (int j=A.beginRows(); j<i; j++)
864 {
865 for (int k = A.beginCols(); k< A.endCols(); k++)
866 res(i, j) += weights[k] * A(i, k) * A(j, k);
867 res(j, i) = res(i, j);
868 }
869 }
870 return res;
871}

◆ wmult()

Arrays::MultOp< Lhs, Rhs >::result_type STK::wmult ( Lhs const lhs,
Rhs const rhs,
Weights const weights 
)

convenience function for the multiplication of two matrices

Definition at line 589 of file STK_Array2D_Functors.h.

590{ return Arrays::MultOp<Lhs, Rhs>(lhs, rhs)(weights);}

◆ wmultLeftTranspose()

Arrays::MultLeftTransposeOp< Lhs, Rhs >::result_type STK::wmultLeftTranspose ( Lhs const lhs,
Rhs const rhs,
Weights const weights 
)

convenience function for the multiplication of two matrices

Definition at line 603 of file STK_Array2D_Functors.h.

604{ return Arrays::MultLeftTransposeOp<Lhs, Rhs>(lhs, rhs)(weights);}

Referenced by STK::MultidimRegression< Array, Weight >::regressionStep().

◆ wmultRightTranspose()

Arrays::MultRightTransposeOp< Lhs, Rhs >::result_type STK::wmultRightTranspose ( Lhs const lhs,
Rhs const rhs,
Weights const weights 
)

convenience function for the multiplication of two matrices

Definition at line 617 of file STK_Array2D_Functors.h.

618{ return Arrays::MultRightTransposeOp<Lhs, Rhs>(lhs, rhs)(weights);}