49 #include "mkl_cblas.h" 144 void saveCSV(
const std::string &filename) ;
179 inline void setBounds(
unsigned int cols,
unsigned int rows,
bool holdContent=
false,
const T &initializer=0) {
186 for(
unsigned int i=0;i<min_cols;++i){
187 for(
unsigned int j=0;j<min_rows;++j){
188 M(i,j) = (*this)(i,j);
203 for(
unsigned int i=0;i<
dim();++i){
205 if((diff>0?diff:-diff) > tollerance)
return false;
213 for(
unsigned int i=0;i<
dim();++i){
222 for(
unsigned int i=0;i<
dim();++i){
238 std::transform(
begin(),
end(),dst.
begin(),std::bind2nd(std::multiplies<T>(),f));
244 std::transform(
begin(),
end(),
begin(),std::bind2nd(std::multiplies<T>(),f));
262 for(
unsigned int c=0;c<dst.
cols();++c){
263 for(
unsigned int r=0;r<dst.
rows();++r){
274 for(
unsigned int i=0;i<
dim();++i){
275 dst[i] =
m_data[i] * m[i];
290 for(
int i=0;i<
dim();++i){
291 dst[i] =
m_data[i] / m[i];
313 return *
this=((*this)*m);
329 std::transform(
begin(),
end(),d.
begin(),std::bind2nd(std::plus<T>(),t));
336 std::transform(
begin(),
end(),d.
begin(),std::bind2nd(std::minus<T>(),t));
342 std::transform(
begin(),
end(),
begin(),std::bind2nd(std::plus<T>(),t));
348 std::transform(
begin(),
end(),
begin(),std::bind2nd(std::minus<T>(),t));
384 #ifdef DYN_MATRIX_INDEX_CHECK 392 #ifdef DYN_MATRIX_INDEX_CHECK 405 inline const T &
at(
unsigned int col,
unsigned int row)
const {
406 return const_cast<DynMatrix*>(
this)->at(
col,
row);
428 inline T
norm(
double l=2)
const{
430 for(
unsigned int i=0;i<
dim();++i){
431 accu += ::pow(
double(
m_data[i]),l);
433 return ::pow(
double(accu),1.0/l);
438 static T diff_power_two(
const T&a,
const T&b){
448 return std::inner_product(
begin(),
end(),other.
begin(),T(0), std::plus<T>(), diff_power_two);
495 struct col_iterator :
public std::iterator<std::random_access_iterator_tag,T>{
645 #ifdef DYN_MATRIX_INDEX_CHECK 646 #define DYN_MATRIX_COLUMN_CHECK(C,E) if(C) ERROR_LOG(E) 648 #define DYN_MATRIX_COLUMN_CHECK(C,E) 650 DynMatrix<T> *matrix;
658 matrix(const_cast<
DynMatrix<T>*>(matrix)),column(column){
664 matrix(const_cast<
DynMatrix<T>*>(&matrix)),column(0){
669 matrix(c.matrix),column(c.column){}
684 inline unsigned int dim()
const {
return matrix->rows(); }
729 std::for_each(
begin(),
end(),std::bind2nd(std::multiplies<T>(),val));
734 std::for_each(
begin(),
end(),std::bind2nd(std::divides<T>(),val));
746 #undef DYN_MATRIX_COLUMN_CHECK 824 return DynMatrixColumn(
this,
col);
827 inline const DynMatrixColumn
col(
int col)
const{
828 return DynMatrixColumn(
this,
col);
955 DynMatrix pinv(
bool useSVD =
false, T zeroThreshold = T(1E-16))
const 969 typedef void(*
GESDD)(
const char*,
const int*,
const int*, T*,
const int*, T*, T*,
const int*, T*,
const int*, T*,
const int*,
int*,
int*);
970 typedef void(*
CBLAS_GEMM)(CBLAS_ORDER,CBLAS_TRANSPOSE,CBLAS_TRANSPOSE,int,int,int,T,
const T*,int,
const T*,int,T,T*,int);
981 for(
unsigned int x=0;x<
cols();++x){
982 for(
unsigned int y=0;y<
rows();++y){
983 d(y,x) = (*this)(x,y);
1011 if((
cols() *
rows()) != (newCols * newRows)){
1021 return std::inner_product(
begin(),
end(),other.
begin(),T(0));
1030 return this->
transp() * M;
1038 for(
int i=0;i<
rows();++i){
1039 d[i] = (*this)(i,i);
1048 for(
unsigned int i=0;i<
dim();i+=
cols()+1){
1058 r(0,0) = x(0,1)*y(0,2)-x(0,2)*y(0,1);
1059 r(0,1) = x(0,2)*y(0,0)-x(0,0)*y(0,2);
1060 r(0,2) = x(0,0)*y(0,1)-x(0,1)*y(0,0);
1072 return (*this).
norm(p) * M_inv.
norm(p);
1077 return S[0]/S[S.
rows()-1];
1094 for(
unsigned int i=0;i<
dim;++i) M(i,i) = 1;
1100 #ifdef DYN_MATRIX_INDEX_CHECK 1107 #ifdef DYN_MATRIX_INDEX_CHECK 1119 #ifdef DYN_MATRIX_INDEX_CHECK 1136 m_rows(column.dim()),m_cols(1),m_data(new T[column.dim()]),m_ownData(true){
1156 ippsNormDiff_L2_32f(begin(), other.
begin(), dim(), &
norm);
1162 ICLASSERT_THROW(dim() == other.dim(), InvalidMatrixDimensionException(
"DynMatrix::sqrDistanceTo: dimension missmatch"));
1164 ippsNormDiff_L2_64f(begin(), other.begin(), dim(), &
norm);
1170 ICLASSERT_THROW(dim() == other.dim(), InvalidMatrixDimensionException(
"DynMatrix::distanceTo: dimension missmatch"));
1172 ippsNormDiff_L2_32f(begin(), other.begin(), dim(), &
norm);
1178 ICLASSERT_THROW(dim() == other.dim(), InvalidMatrixDimensionException(
"DynMatrix::distanceTo: dimension missmatch"));
1180 ippsNormDiff_L2_64f(begin(), other.begin(), dim(), &
norm);
1184 #define DYN_MATRIX_MULT_SPECIALIZE(IPPT) \ 1186 inline DynMatrix<Ipp##IPPT> &DynMatrix<Ipp##IPPT>::mult( \ 1187 const DynMatrix<Ipp##IPPT> &m, DynMatrix<Ipp##IPPT> &dst) const \ 1189 if(cols() != m.rows() ) throw IncompatibleMatrixDimensionException("A*B : cols(A) must be row(B)"); \ 1190 dst.setBounds(m.cols(),rows()); \ 1191 ippmMul_mm_##IPPT(data(),sizeof(Ipp##IPPT)*cols(),sizeof(Ipp##IPPT),cols(),rows(), \ 1192 m.data(),sizeof(Ipp##IPPT)*m.cols(),sizeof(Ipp##IPPT),m.cols(),m.rows(), \ 1193 dst.data(),m.cols()*sizeof(Ipp##IPPT),sizeof(Ipp##IPPT)); \ 1197 DYN_MATRIX_MULT_SPECIALIZE(32f)
1198 DYN_MATRIX_MULT_SPECIALIZE(64f)
1199 #undef DYN_MATRIX_MULT_SPECIALIZE 1202 #define DYN_MATRIX_ELEMENT_WISE_DIV_SPECIALIZE(IPPT) \ 1204 inline DynMatrix<Ipp##IPPT> &DynMatrix<Ipp##IPPT>::elementwise_div( \ 1205 const DynMatrix<Ipp##IPPT> &m, DynMatrix<Ipp##IPPT> &dst) const \ 1207 if((m.cols() != cols()) || (m.rows() != rows())){ \ 1208 throw IncompatibleMatrixDimensionException("A./B dimension mismatch"); \ 1210 dst.setBounds(cols(),rows()); \ 1211 ippsDiv_##IPPT(data(),m.data(),dst.data(),dim()); \ 1215 DYN_MATRIX_ELEMENT_WISE_DIV_SPECIALIZE(32f)
1216 DYN_MATRIX_ELEMENT_WISE_DIV_SPECIALIZE(64f)
1218 #undef DYN_MATRIX_ELEMENT_WISE_DIV_SPECIALIZE 1225 #define DYN_MATRIX_MULT_BY_CONSTANT(IPPT) \ 1227 inline DynMatrix<Ipp##IPPT> &DynMatrix<Ipp##IPPT>::mult( \ 1228 Ipp##IPPT f, DynMatrix<Ipp##IPPT> &dst) const{ \ 1229 dst.setBounds(cols(),rows()); \ 1230 ippsMulC_##IPPT(data(),f, dst.data(),dim()); \ 1234 DYN_MATRIX_MULT_BY_CONSTANT(32f)
1235 DYN_MATRIX_MULT_BY_CONSTANT(64f)
1237 #undef DYN_MATRIX_MULT_BY_CONSTANT 1239 #define DYN_MATRIX_NORM_SPECIALZE(T,IPPT) \ 1241 inline T DynMatrix<T> ::norm(double l) const{ \ 1244 ippsNorm_L1_##IPPT(m_data,dim(),&val); \ 1248 ippsNorm_L2_##IPPT(m_data,dim(),&val); \ 1252 for(unsigned int i=0;i<dim();++i){ \ 1253 accu += ::pow(double(m_data[i]),l); \ 1255 return ::pow(accu,1.0/l); \ 1258 DYN_MATRIX_NORM_SPECIALZE(
float,32f)
1261 #undef DYN_MATRIX_NORM_SPECIALZE 1265 #endif // ICL_HAVE_IPP 1271 int w = left.
cols() + right.
cols();
1274 for(
unsigned int y=0;y<left.
rows();++y){
1277 for(
unsigned int y=0;y<right.
rows();++y){
1288 int h = top.
rows() + bottom.
rows();
1290 for(
unsigned int y=0;y<top.
rows();++y){
1293 for(
unsigned int y=0;y<bottom.
rows();++y){
DynMatrix pinv(bool useSVD=false, T zeroThreshold=T(1E-16)) const
calculates the Moore-Penrose pseudo-inverse (only implemented for icl32f and icl64f)
DynMatrix< T > dot(const DynMatrix< T > &M) const
returns the inner product of two matrices (i.e. dot-product)
Definition: DynMatrix.h:1029
col_iterator(T *col_begin, unsigned int stride)
Definition: DynMatrix.h:499
ICLQt_API ImgQ sqrt(const ImgQ &image)
calls sqrt( each pixel)
void idx_check(unsigned int col, unsigned int row) const
Definition: DynMatrix.h:1113
const_row_iterator row_end(unsigned int row) const
returns an iterator of a certains row's end (const)
Definition: DynMatrix.h:805
T * set_data(T *newData)
sets new data internally and returns old data pointer (for experts only!)
Definition: DynMatrix.h:1085
void(* GESDD)(const char *, const int *, const int *, T *, const int *, T *, T *, const int *, T *, const int *, T *, const int *, int *, int *)
Definition: DynMatrix.h:969
void decompose_LU(DynMatrix &L, DynMatrix &U, T zeroThreshold=T(1E-16)) const
applies LU-decomposition (without using partial pivoting) (only for icl32f and icl64f)
bool operator==(const DynMatrix &other) const
elementwise comparison (==)
Definition: DynMatrix.h:211
const col_iterator & operator-=(difference_type n) const
jump backward next n elements (inplace) (const)
Definition: DynMatrix.h:571
const col_iterator operator--(int) const
postfix decrement operator (const)
Definition: DynMatrix.h:545
undocument this line if you encounter any issues!
Definition: Any.h:37
DynMatrix elementwise_mult(const DynMatrix &m) const
Elementwise matrix multiplication (without destination matrix) [IPP-Supported].
Definition: DynMatrix.h:281
const T * data() const
internal data pointer (const)
Definition: DynMatrix.h:480
col_iterator & operator+=(difference_type n)
jump next n elements (inplace)
Definition: DynMatrix.h:552
void decompose_QR(DynMatrix &Q, DynMatrix &R) const
applies QR-decomposition using stabilized Gram-Schmidt orthonormalization (only for icl32f and icl64f...
DynMatrix & operator=(const DynMatrix &other)
Assignment operator (using deep/shallow-copy)
Definition: DynMatrix.h:159
void col_check(unsigned int col) const
Definition: DynMatrix.h:1106
ICLQt_API core::Img< T > norm(const core::Img< T > &image)
normalize an images range to [0,255]
const T & at(unsigned int col, unsigned int row) const
element access with index check (const)
Definition: DynMatrix.h:405
#define ICLMath_API
Definition: CompatMacros.h:173
DynMatrix & elementwise_div(const DynMatrix &m, DynMatrix &dst) const
Elementwise division (in source destination fashion) [IPP-Supported].
Definition: DynMatrix.h:287
DynMatrix(unsigned int cols, unsigned int rows, const T *data)
Create a matrix with given data (const version: deepCopy only)
Definition: DynMatrix.h:116
Special linear algebra exception type .
Definition: DynMatrix.h:71
const DynMatrixColumn col(int col) const
Definition: DynMatrix.h:827
DynMatrix elementwise_div(const DynMatrix &m) const
Elementwise matrix multiplication (without destination matrix) [IPP-Supported].
Definition: DynMatrix.h:297
DynMatrixColumn & operator=(const DynMatrix &src)
assigne dyn matrix to matrix columns
Definition: DynMatrix.h:694
const T * const_row_iterator
complex const_row_iterator type
Definition: DynMatrix.h:468
DynMatrix solve(const DynMatrix &b, const std::string &method="lu", T zeroThreshold=T(1E-16))
solves Mx=b for M=*this (only for icl32f and icl64f)
DynMatrixColumn & operator-=(const DynMatrix &m)
operator -= for DynMatrices
Definition: DynMatrix.h:721
T det() const
matrix determinant (only for icl32f and icl64f)
const col_iterator & operator++() const
prefix increment operator (const)
Definition: DynMatrix.h:508
DynMatrixColumn(const DynMatrix< T > &matrix)
Create from source matrix (only works if matrix has only single column = column-vector)
Definition: DynMatrix.h:663
DynMatrix & operator+=(const DynMatrix &m)
Matrix addition (inplace)
Definition: DynMatrix.h:369
void(* CBLAS_GEMM)(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, T, const T *, int, const T *, int, T, T *, int)
Definition: DynMatrix.h:970
col_iterator operator-(difference_type n)
jump backward next n elements
Definition: DynMatrix.h:592
DynMatrix operator *(T f) const
Multiply elements with scalar.
Definition: DynMatrix.h:230
Highly flexible and optimized matrix class implementation.
Definition: DynMatrix.h:81
DynMatrix operator/(T f) const
Device elements by scalar.
Definition: DynMatrix.h:249
DynMatrix inv() const
invert the matrix (only for icl32f and icl64f)
col_iterator operator+(difference_type n)
jump next n elements
Definition: DynMatrix.h:578
const DynMatrix< T > shallowTransposed()
returns a shallow transposed copy of this matrix (dimensions are swapped, data is not re-aranged)
Definition: DynMatrix.h:996
col_iterator col_begin(unsigned int col)
returns an iterator running through a certain matrix column
Definition: DynMatrix.h:763
int m_rows
Definition: DynMatrix.h:1126
const col_iterator & operator--() const
prefix decrement operator (const)
Definition: DynMatrix.h:532
difference_type operator-(const col_iterator &other) const
Definition: DynMatrix.h:605
iterator begin()
returns an iterator to the begin of internal data array
Definition: DynMatrix.h:751
T trace() const
computes the sum of all diagonal elements
Definition: DynMatrix.h:1045
DynMatrix(unsigned int cols, unsigned int rows, const T &initValue=0)
Create a dyn matrix with given dimensions (and optional initialValue)
Definition: DynMatrix.h:94
DynMatrix< T > operator,(const DynMatrix< T > &left, const DynMatrix< T > &right)
vertical concatenation of matrices
Definition: DynMatrix.h:1270
DynMatrix operator+(const T &t) const
adds a scalar to each element
Definition: DynMatrix.h:327
DynMatrix operator-(const DynMatrix &m) const
Matrix substraction.
Definition: DynMatrix.h:361
ICLMath_IMP std::ostream & operator<<(std::ostream &s, const DynMatrix< T > &m)
ostream operator implemented for uchar, short, int, float and double matrices
const col_iterator operator++(int) const
postfix increment operator (const)
Definition: DynMatrix.h:519
#define DYN_MATRIX_COLUMN_CHECK(C, E)
Definition: DynMatrix.h:648
const_col_iterator col_begin(unsigned int col) const
returns an iterator running through a certain matrix column (const)
Definition: DynMatrix.h:775
#define iclMin(A, B)
Definition: Macros.h:204
bool operator!=(const DynMatrix &other) const
elementwise comparison (!=)
Definition: DynMatrix.h:220
const col_iterator begin() const
returns column begin (const)
Definition: DynMatrix.h:678
unsigned int column
referenced column in matrix
Definition: DynMatrix.h:654
DynMatrix< T > operator%(const DynMatrix< T > &top, const DynMatrix< T > &bottom)
horizontal concatenation of matrices
Definition: DynMatrix.h:1286
unsigned int dim() const
returns column length (matrix->rows())
Definition: DynMatrix.h:684
col_iterator col_end(unsigned int col)
returns an iterator end of a certain matrix column
Definition: DynMatrix.h:769
T * iterator
default iterator type (just a data-pointer)
Definition: DynMatrix.h:459
T * row_iterator
comples row_iterator type
Definition: DynMatrix.h:465
DynMatrix()
Default empty constructor creates a null-matrix.
Definition: DynMatrix.h:91
Special linear algebra exception type .
Definition: DynMatrix.h:66
DynMatrix & operator *=(T f)
Multiply elements with scalar (inplace)
Definition: DynMatrix.h:243
T & operator()(unsigned int col, unsigned int row)
element access operator (x,y)-access index begin 0!
Definition: DynMatrix.h:383
IncompatibleMatrixDimensionException(const std::string &msg)
Definition: DynMatrix.h:62
DynMatrix(const DynMatrix &other)
Default copy constructor.
Definition: DynMatrix.h:124
DynMatrix< T > diag() const
returns diagonal-elements as column-vector
Definition: DynMatrix.h:1035
Special linear algebra exception type .
Definition: DynMatrix.h:56
DynMatrix & elementwise_mult(const DynMatrix &m, DynMatrix &dst) const
Elementwise matrix multiplication (in source destination fashion) [IPP-Supported].
Definition: DynMatrix.h:271
DynMatrix solve_lower_triangular(const DynMatrix &b) const
solves Mx=b for M=*this (only if M is a squared lower triangular matrix) (only for icl32f and icl64f)
DynMatrix & operator/=(T f)
Device elements by scalar (inplace)
Definition: DynMatrix.h:254
void svd(DynMatrix &U, DynMatrix &S, DynMatrix &V) const
Computes Singular Value Decomposition of a matrix - decomposes A into USV'.
void saveCSV(const std::string &filename)
writes the current matrix to a csv file
SingularMatrixException(const std::string &msg)
Definition: DynMatrix.h:72
Special linear algebra exception type .
Definition: DynMatrix.h:61
col_iterator operator--(int)
postfix decrement operator
Definition: DynMatrix.h:538
void decompose_RQ(DynMatrix &R, DynMatrix &Q) const
applies RQ-decomposition (by exploiting implemnetation of QR-decomposition) (only for icl32f,...
DynMatrix row(int row)
Extracts a shallow copied matrix row.
Definition: DynMatrix.h:811
DynMatrixColumn(const DynMatrixColumn &c)
Shallow copy from another matrix column reference.
Definition: DynMatrix.h:668
T & operator *()
Dereference operator.
Definition: DynMatrix.h:611
unsigned int rows() const
height of the matrix (number of rows)
Definition: DynMatrix.h:471
DynMatrix & operator=(const DynMatrixColumn &col)
Definition: DynMatrix.h:740
DynMatrix & operator-=(const T &t)
substacts a scalar from each element (inplace)
Definition: DynMatrix.h:347
#define ICLASSERT_RETURN_VAL(X, VALUE)
Definition: Macros.h:148
ICLQt_API void fill(float r, float g=-1, float b=-1, float alpha=255)
sets the current fill color to given r,g,b,alpha value
unsigned int difference_type
Definition: DynMatrix.h:496
DynMatrix & operator/=(const DynMatrix &m) const
inplace matrix devision (calling this/m.inv()) (inplace)
Definition: DynMatrix.h:322
int stride2() const
returns sizeof (T)
Definition: DynMatrix.h:492
bool operator>=(const col_iterator &i) const
comparison operator >=
Definition: DynMatrix.h:633
unsigned int cols() const
width of the matrix (number of columns)
Definition: DynMatrix.h:474
DynMatrixColumn & operator-=(const DynMatrixColumn &c)
operator += for other columns
Definition: DynMatrix.h:708
DynMatrixColumn & operator/=(const T &val)
operator /= for scalars
Definition: DynMatrix.h:733
DynMatrix & mult(const DynMatrix &m, DynMatrix &dst) const
Matrix multiplication (in source destination fashion) [IPP-Supported].
Definition: DynMatrix.h:259
DynMatrix transp() const
matrix transposed
Definition: DynMatrix.h:979
col_iterator & operator--()
prefix decrement operator
Definition: DynMatrix.h:526
T norm(double l=2) const
applies an L_l norm on the matrix elements (all elements are treated as vector)
Definition: DynMatrix.h:428
#define iclMax(A, B)
Definition: Macros.h:207
ICLMath_IMP std::istream & operator>>(std::istream &s, DynMatrix< T > &m)
istream operator implemented for uchar, short, int, float and double matrices
const_iterator end() const
returns an iterator to the end of internal data array (const)
Definition: DynMatrix.h:760
DynMatrixColumn(const DynMatrix< T > *matrix, unsigned int column)
create from source matrix and column index
Definition: DynMatrix.h:657
static DynMatrix< T > cross(const DynMatrix< T > &x, const DynMatrix< T > &y)
computes the cross product
Definition: DynMatrix.h:1055
static DynMatrix< T > loadCSV(const std::string &filename)
loads a dynmatrix from given CSV file
const col_iterator operator+(difference_type n) const
jump next n elements (const)
Definition: DynMatrix.h:585
unsigned int dim() const
matrix dimension (width*height) or (cols*rows)
Definition: DynMatrix.h:483
bool isNull() const
returns with this matrix has a valid data pointer
Definition: DynMatrix.h:147
const_row_iterator row_begin(unsigned int row) const
returns an iterator running through a certain matrix row (const)
Definition: DynMatrix.h:799
iterator end()
returns an iterator to the end of internal data array
Definition: DynMatrix.h:754
col_iterator begin()
returns column begin
Definition: DynMatrix.h:672
bool operator<=(const col_iterator &i) const
comparison operator <=
Definition: DynMatrix.h:630
DynMatrix big_matrix_pinv(T zeroThreshold=T(1E-16)) const
calculates the Moore-Penrose pseudo-inverse (specialized for big matrices)
T * m_data
Definition: DynMatrix.h:1128
void row_check(unsigned int row) const
Definition: DynMatrix.h:1099
T sqrDistanceTo(const DynMatrix &other) const
returns the squared distance of the inner data vectors (linearly interpreted) (IPP accelerated)
Definition: DynMatrix.h:446
bool operator>(const col_iterator &i) const
comparison operator >
Definition: DynMatrix.h:636
bool operator!=(const col_iterator &i) const
comparison operator !=
Definition: DynMatrix.h:624
~DynMatrix()
Destructor (deletes data if no wrapped shallowly)
Definition: DynMatrix.h:150
#define ERROR_LOG(x)
Definition: Macros.h:111
DynMatrix operator-(const T &t) const
substacts a scalar from each element
Definition: DynMatrix.h:334
const T * const_iterator
dafault const_iterator type (just a data-pointer)
Definition: DynMatrix.h:462
const col_iterator operator-(difference_type n) const
jump backward next n elements (const)
Definition: DynMatrix.h:599
bool operator<(const col_iterator &i) const
comparison operator <
Definition: DynMatrix.h:627
void idx_check(unsigned int idx) const
Definition: DynMatrix.h:1118
unsigned int stride
Definition: DynMatrix.h:498
void reshape(int newCols, int newRows)
resets the matrix dimensions without changing the content
Definition: DynMatrix.h:1010
DynMatrix & mult(T f, DynMatrix &dst) const
Multiply elements with scalar (in source destination fashion)
Definition: DynMatrix.h:236
void eigen(DynMatrix &eigenvectors, DynMatrix &eigenvalues) const
Extracts the matrix's eigenvalues and eigenvectors.
DynMatrixColumn & operator=(const DynMatrixColumn &c)
assignment by another column
Definition: DynMatrix.h:687
DynMatrix operator/(const DynMatrix &m) const
inplace matrix devision (calling this/m.inv()) [IPP-Supported]
Definition: DynMatrix.h:317
void setBounds(unsigned int cols, unsigned int rows, bool holdContent=false, const T &initializer=0)
resets matrix dimensions
Definition: DynMatrix.h:179
T cond(const double p=2) const
computes the condition of a matrix
Definition: DynMatrix.h:1069
static DynMatrix id(unsigned int dim)
creates a dim-D identity Matrix
Definition: DynMatrix.h:1092
row_iterator row_begin(unsigned int row)
returns an iterator running through a certain matrix row
Definition: DynMatrix.h:787
#define ICLMath_IMP
Definition: CompatMacros.h:172
bool m_ownData
Definition: DynMatrix.h:1129
T * p
Definition: DynMatrix.h:497
int stride0() const
returns sizeof (T)*dim()
Definition: DynMatrix.h:486
col_iterator & operator-=(difference_type n)
jump backward next n elements (inplace)
Definition: DynMatrix.h:565
Base class for Exception handling in the ICL.
Definition: Exception.h:42
DynMatrix & operator+=(const T &t)
adds a scalar to each element (inplace)
Definition: DynMatrix.h:341
DynMatrix(const std::string &filename)
creates a new DynMatrix from given csv filename
Definition: DynMatrix.h:131
DynMatrix operator+(const DynMatrix &m) const
Matrix addition.
Definition: DynMatrix.h:353
DynMatrix & operator-=(const DynMatrix &m)
Matrix substraction (inplace)
Definition: DynMatrix.h:376
int stride1() const
returns sizeof(T)*cols()
Definition: DynMatrix.h:489
const T & operator[](unsigned int idx) const
linear access to actual data array (const)
Definition: DynMatrix.h:422
const_iterator begin() const
returns an iterator to the begin of internal data array (const)
Definition: DynMatrix.h:757
InvalidMatrixDimensionException(const std::string &msg)
Definition: DynMatrix.h:57
int m_cols
Definition: DynMatrix.h:1127
const_col_iterator col_end(unsigned int col) const
returns an iterator end of a certain matrix column (const)
Definition: DynMatrix.h:781
const col_iterator & operator+=(difference_type n) const
jump next n elements (inplace) (const)
Definition: DynMatrix.h:558
DynMatrixColumn & operator+=(const DynMatrix &m)
operator += for DynMatrices
Definition: DynMatrix.h:715
void copy(const T *src, const T *srcEnd, T *dst)
moves data from source to destination array (no casting possible)
Definition: CoreFunctions.h:216
DynMatrixColumn col(int col)
Extracts a shallow copied matrix column.
Definition: DynMatrix.h:823
const DynMatrix< T > shallowTransposed() const
returns a shallow transposed copy of this matrix (dimensions are swapped, data is not re-aranged) (co...
Definition: DynMatrix.h:991
col_iterator end()
returns column end
Definition: DynMatrix.h:675
const DynMatrix row(int row) const
Extracts a shallow copied matrix row (const)
Definition: DynMatrix.h:817
DynMatrixColumn & operator+=(const DynMatrixColumn &c)
operator += for other columns
Definition: DynMatrix.h:701
T distanceTo(const DynMatrix &other) const
returns the distance of the inner data vectors (linearly interpreted) (IPP accelerated)
Definition: DynMatrix.h:452
Internal column iterator struct (using height-stride)
Definition: DynMatrix.h:495
T element_wise_inner_product(const DynMatrix< T > &other) const
inner product of data pointers (not matrix-mulitiplication)
Definition: DynMatrix.h:1020
bool operator==(const col_iterator &i) const
comparison operator ==
Definition: DynMatrix.h:621
col_iterator & operator++()
prefix increment operator
Definition: DynMatrix.h:503
#define ICLASSERT_THROW(X, OBJ)
Definition: Macros.h:155
DynMatrix solve_upper_triangular(const DynMatrix &b) const
solves Mx=b for M=*this (only if M is a squared upper triangular matrix) (only for icl32f and icl64f)
col_iterator operator++(int)
postfix increment operator
Definition: DynMatrix.h:513
const col_iterator end() const
returns column end (const)
Definition: DynMatrix.h:681
DynMatrix(unsigned int cols, unsigned int rows, T *data, bool deepCopy=true)
Create a matrix with given data.
Definition: DynMatrix.h:104
const col_iterator const_col_iterator
const column iterator typedef
Definition: DynMatrix.h:640
T & operator[](unsigned int idx)
linear access to actual data array
Definition: DynMatrix.h:412
T * data()
internal data pointer
Definition: DynMatrix.h:477
InvalidIndexException(const std::string &msg)
Definition: DynMatrix.h:67
T & at(unsigned int col, unsigned int row)
element access with index check
Definition: DynMatrix.h:399
row_iterator row_end(unsigned int row)
returns an iterator of a certains row's end
Definition: DynMatrix.h:793
Internally used Utility structure referencing a matrix column shallowly.
Definition: DynMatrix.h:643
bool isSimilar(const DynMatrix &other, T tollerance=T(0.0001)) const
tests weather a matrix is enough similar to another matrix
Definition: DynMatrix.h:201