38 EIGEN_STRONG_INLINE
void fill(
const Scalar v) { derived().setConstant(
v); }
41 EIGEN_STRONG_INLINE
void assign(
const Scalar v) { derived().setConstant(
v); }
43 EIGEN_STRONG_INLINE
void assign(
size_t N,
const Scalar v) { derived().resize(N); derived().setConstant(
v); }
46 EIGEN_STRONG_INLINE
size_t getRowCount()
const {
return rows(); }
48 EIGEN_STRONG_INLINE
size_t getColCount()
const {
return cols(); }
51 EIGEN_STRONG_INLINE
void unit(
const size_t nRows,
const Scalar diag_vals) {
53 derived().setIdentity(nRows,nRows);
55 derived().setZero(nRows,nRows);
56 derived().diagonal().setConstant(diag_vals);
61 EIGEN_STRONG_INLINE
void unit() { derived().setIdentity(); }
63 EIGEN_STRONG_INLINE
void eye() { derived().setIdentity(); }
66 EIGEN_STRONG_INLINE
void zeros() { derived().setZero(); }
68 EIGEN_STRONG_INLINE
void zeros(
const size_t row,
const size_t col) { derived().setZero(
row,col); }
71 EIGEN_STRONG_INLINE
void ones(
const size_t row,
const size_t col) { derived().setOnes(
row,col); }
73 EIGEN_STRONG_INLINE
void ones() { derived().setOnes(); }
84 return derived()(
row,col);
86 return derived().coeff(
row,col);
92 return derived()(
row,col);
94 return derived().coeffRef(
row,col);
102 derived().coeffRef(
row,col) =
val;
109 const Index N =
size();
110 derived().conservativeResize(N+1);
114 EIGEN_STRONG_INLINE
bool isSquare()
const {
return cols()==rows(); }
115 EIGEN_STRONG_INLINE
bool isSingular(
const Scalar absThreshold = 0)
const {
return std::abs(derived().determinant())<absThreshold; }
149 bool appendMRPTHeader =
false,
168 EIGEN_STRONG_INLINE
void swapCols(
size_t i1,
size_t i2) { derived().col(i1).swap( derived().col(i2) ); }
169 EIGEN_STRONG_INLINE
void swapRows(
size_t i1,
size_t i2) { derived().row(i1).swap( derived().
row(i2) ); }
171 EIGEN_STRONG_INLINE
size_t countNonZero()
const {
return ((*static_cast<const Derived*>(
this))!= 0).count(); }
178 if (
size()==0)
throw std::runtime_error(
"maximum: container is empty");
179 return derived().maxCoeff();
187 if (
size()==0)
throw std::runtime_error(
"minimum: container is empty");
188 return derived().minCoeff();
208 if (
size()==0)
throw std::runtime_error(
"maximum: container is empty");
210 const Scalar m = derived().maxCoeff(&idx);
211 if (maxIndex) *maxIndex = idx;
220 if (cols()==0 || rows()==0)
throw std::runtime_error(
"find_index_max_value: container is empty");
222 valMax = derived().maxCoeff(&idx1,&idx2);
232 if (
size()==0)
throw std::runtime_error(
"minimum: container is empty");
234 const Scalar m =derived().minCoeff(&idx);
235 if (minIndex) *minIndex = idx;
246 size_t *maxIndex)
const 253 EIGEN_STRONG_INLINE
Scalar norm_inf()
const {
return lpNorm<Eigen::Infinity>(); }
264 template<
typename OtherDerived>
265 EIGEN_STRONG_INLINE
void laplacian(Eigen::MatrixBase <OtherDerived>& ret)
const 267 if (rows()!=cols())
throw std::runtime_error(
"laplacian: Defined for square matrixes only");
268 const Index N = rows();
270 for (Index i=0;i<N;i++)
273 for (Index j=0;j<N;j++) deg+= derived().coeff(j,i);
274 ret.coeffRef(i,i)+=deg;
285 if ((Derived::RowsAtCompileTime!=Eigen::Dynamic && Derived::RowsAtCompileTime!=
int(
row)) || (Derived::ColsAtCompileTime!=Eigen::Dynamic && Derived::ColsAtCompileTime!=
int(col))) {
286 std::stringstream ss; ss <<
"setSize: Trying to change a fixed sized matrix from " << rows() <<
"x" << cols() <<
" to " <<
row <<
"x" << col;
287 throw std::runtime_error(ss.str());
290 const Index oldCols = cols();
291 const Index oldRows = rows();
292 const int nNewCols = int(col) - int(cols());
293 const int nNewRows = int(
row) - int(rows());
295 if (nNewCols>0) derived().block(0,oldCols,
row,nNewCols).setZero();
296 if (nNewRows>0) derived().block(oldRows,0,nNewRows,col).setZero();
300 template <
class OUTVECT>
304 size_t maxIterations = 6,
305 int *out_Iterations = NULL,
306 float *out_estimatedResolution = NULL )
const 310 const Index
n = rows();
316 Eigen::Matrix<Scalar,Derived::RowsAtCompileTime,1> xx = (*this) *
x;
317 xx *=
Scalar(1.0/xx.norm());
318 dif = (
x-xx).array().abs().sum();
321 }
while (iter<maxIterations && dif>resolution);
322 if (out_Iterations) *out_Iterations=
static_cast<int>(iter);
323 if (out_estimatedResolution) *out_estimatedResolution=dif;
330 derived().setIdentity();
332 for (
unsigned int i=1;i<pow;i++)
333 derived() *= derived();
343 for (Index
c=0;
c<cols();
c++)
344 for (Index
r=0;
r<rows();
r++)
345 if (
r!=
c && coeff(
r,
c)!=0)
355 EIGEN_STRONG_INLINE
double mean()
const 357 if (
size()==0)
throw std::runtime_error(
"mean: Empty container.");
358 return derived().sum()/
static_cast<double>(
size());
369 const bool unbiased_variance =
true )
const 371 const size_t N = rows();
372 if (N==0)
throw std::runtime_error(
"meanAndStd: Empty container.");
373 const double N_inv = 1.0/N;
374 const double N_ = unbiased_variance ? (N>1 ? 1.0/(N-1) : 1.0) : 1.0/N;
375 outMeanVector.resize(cols());
376 outStdVector.resize(cols());
377 for (Index i=0;i<cols();i++)
379 outMeanVector[i]= this->col(i).array().sum() * N_inv;
380 outStdVector[i] = std::sqrt( (this->col(i).array()-outMeanVector[i]).
square().
sum() * N_ );
391 const bool unbiased_variance =
true )
const 393 const size_t N =
size();
394 if (N==0)
throw std::runtime_error(
"meanAndStdAll: Empty container.");
395 const double N_ = unbiased_variance ? (N>1 ? 1.0/(N-1) : 1.0) : 1.0/N;
396 outMean = derived().array().sum()/
static_cast<double>(
size());
397 outStd = std::sqrt( (this->array() - outMean).
square().
sum()*N_);
401 template <
typename MAT>
402 EIGEN_STRONG_INLINE
void insertMatrix(
size_t r,
size_t c,
const MAT &m) { derived().block(
r,
c,m.rows(),m.cols())=m; }
404 template <
typename MAT>
407 template <
typename MAT> EIGEN_STRONG_INLINE
void insertRow(
size_t nRow,
const MAT & aRow) { this->
row(nRow) = aRow; }
408 template <
typename MAT> EIGEN_STRONG_INLINE
void insertCol(
size_t nCol,
const MAT & aCol) { this->col(nCol) = aCol; }
410 template <
typename R>
void insertRow(
size_t nRow,
const std::vector<R> & aRow)
412 if (static_cast<Index>(aRow.size())!=cols())
throw std::runtime_error(
"insertRow: Row size doesn't fit the size of this matrix.");
413 for (Index j=0;j<cols();j++)
414 coeffRef(nRow,j) = aRow[j];
416 template <
typename R>
void insertCol(
size_t nCol,
const std::vector<R> & aCol)
418 if (static_cast<Index>(aCol.size())!=rows())
throw std::runtime_error(
"insertRow: Row size doesn't fit the size of this matrix.");
419 for (Index j=0;j<rows();j++)
420 coeffRef(j,nCol) = aCol[j];
424 EIGEN_STRONG_INLINE
void removeColumns(
const std::vector<size_t> &idxsToRemove)
426 std::vector<size_t> idxs = idxsToRemove;
427 std::sort( idxs.begin(), idxs.end() );
429 idxs.resize( itEnd - idxs.begin() );
438 for (std::vector<size_t>::const_reverse_iterator it = idxs.rbegin(); it != idxs.rend(); ++it, ++k)
440 const size_t nC = cols() - *it - k;
442 derived().block(0,*it,rows(),nC) = derived().block(0,*it+1,rows(),nC).eval();
444 derived().conservativeResize(NoChange,cols()-idxs.size());
448 EIGEN_STRONG_INLINE
void removeRows(
const std::vector<size_t> &idxsToRemove)
450 std::vector<size_t> idxs = idxsToRemove;
451 std::sort( idxs.begin(), idxs.end() );
453 idxs.resize( itEnd - idxs.begin() );
462 for (std::vector<size_t>::reverse_iterator it = idxs.rbegin(); it != idxs.rend(); ++it, ++k)
464 const size_t nR = rows() - *it - k;
466 derived().block(*it,0,nR,cols()) = derived().block(*it+1,0,nR,cols()).eval();
468 derived().conservativeResize(rows()-idxs.size(),NoChange);
472 EIGEN_STRONG_INLINE
const AdjointReturnType
t()
const {
return derived().adjoint(); }
474 EIGEN_STRONG_INLINE PlainObject
inv()
const { PlainObject outMat = derived().inverse().eval();
return outMat; }
475 template <
class MATRIX> EIGEN_STRONG_INLINE
void inv(MATRIX &outMat)
const { outMat = derived().inverse().eval(); }
476 template <
class MATRIX> EIGEN_STRONG_INLINE
void inv_fast(MATRIX &outMat)
const { outMat = derived().inverse().eval(); }
477 EIGEN_STRONG_INLINE
Scalar det()
const {
return derived().determinant(); }
488 template<
typename OTHERMATRIX> EIGEN_STRONG_INLINE
void add_Ac(
const OTHERMATRIX &m,
const Scalar c) { (*this)+=
c*m; }
490 template<
typename OTHERMATRIX> EIGEN_STRONG_INLINE
void substract_Ac(
const OTHERMATRIX &m,
const Scalar c) { (*this) -=
c*m; }
493 template<
typename OTHERMATRIX> EIGEN_STRONG_INLINE
void substract_At(
const OTHERMATRIX &m) { (*this) -= m.adjoint(); }
496 template<
typename OTHERMATRIX> EIGEN_STRONG_INLINE
void substract_An(
const OTHERMATRIX& m,
const size_t n) { this->noalias() -=
n * m; }
499 template<
typename OTHERMATRIX> EIGEN_STRONG_INLINE
void add_AAt(
const OTHERMATRIX &A) { this->noalias() += A; this->noalias() += A.adjoint(); }
502 template<typename OTHERMATRIX> EIGEN_STRONG_INLINE
void substract_AAt(
const OTHERMATRIX &A) { this->noalias() -= A; this->noalias() -= A.adjoint(); }
505 template <
class MATRIX1,
class MATRIX2> EIGEN_STRONG_INLINE
void multiply(
const MATRIX1& A,
const MATRIX2 &B ) { (*this)= A*B; }
507 template <
class MATRIX1,
class MATRIX2>
508 EIGEN_STRONG_INLINE
void multiply_AB(
const MATRIX1& A,
const MATRIX2 &B ) {
512 template <
typename MATRIX1,
typename MATRIX2>
513 EIGEN_STRONG_INLINE
void multiply_AtB(
const MATRIX1 &A,
const MATRIX2 &B) {
514 *
this = A.adjoint() * B;
518 template<
typename OTHERVECTOR1,
typename OTHERVECTOR2>
519 EIGEN_STRONG_INLINE
void multiply_Ab(
const OTHERVECTOR1 &vIn,OTHERVECTOR2 &vOut,
bool accumToOutput =
false)
const {
520 if (accumToOutput) vOut.noalias() += (*this) * vIn;
521 else vOut = (*this) * vIn;
525 template<typename OTHERVECTOR1,typename OTHERVECTOR2>
526 EIGEN_STRONG_INLINE
void multiply_Atb(
const OTHERVECTOR1 &vIn,OTHERVECTOR2 &vOut,
bool accumToOutput =
false)
const {
527 if (accumToOutput) vOut.noalias() += this->adjoint() * vIn;
528 else vOut = this->adjoint() * vIn;
531 template <
typename MAT_C,
typename MAT_R>
532 EIGEN_STRONG_INLINE
void multiply_HCHt(
const MAT_C &C,MAT_R &
R,
bool accumResultInOutput=
false) const {
533 if (accumResultInOutput)
534 R.noalias() += (*this) * C * this->adjoint();
535 else R.noalias() = (*this) * C * this->adjoint();
538 template <
typename MAT_C,
typename MAT_R>
539 EIGEN_STRONG_INLINE
void multiply_HtCH(
const MAT_C &C,MAT_R &
R,
bool accumResultInOutput=
false) const {
540 if (accumResultInOutput)
541 R.noalias() += this->adjoint() * C * (*this);
542 else R.noalias() = this->adjoint() * C * (*this);
546 template <
typename MAT_C>
548 return ( (*
this) * C * this->adjoint() ).eval()(0,0);
552 template <
typename MAT_C>
554 return ( this->adjoint() * C * (*
this) ).eval()(0,0);
558 template<
typename MAT_A>
560 *
this = (A * A.adjoint()) * f;
565 *
this = (A.adjoint() * A) * f;
569 template <
class MAT_A,
class SKEW_3VECTOR>
void multiply_A_skew3(
const MAT_A &A,
const SKEW_3VECTOR &
v) {
573 template <
class SKEW_3VECTOR,
class MAT_A>
void multiply_skew3_A(
const SKEW_3VECTOR &
v,
const MAT_A &A) {
578 template <
class MAT_A,
class MAT_OUT>
579 EIGEN_STRONG_INLINE
void multiply_subMatrix(
const MAT_A &A,MAT_OUT &outResult,
const size_t A_cols_offset,
const size_t A_rows_offset,
const size_t A_col_count)
const {
580 outResult = derived() * A.block(A_rows_offset,A_cols_offset,derived().cols(),A_col_count);
583 template <
class MAT_A,
class MAT_B,
class MAT_C>
588 template <
class MAT_A,
class MAT_B,
class MAT_C>
590 *
this = A*B*C.adjoint();
593 template <
class MAT_A,
class MAT_B,
class MAT_C>
595 *
this = A.adjoint()*B*C;
598 template <
class MAT_A,
class MAT_B>
600 *
this = A*B.adjoint();
603 template <
class MAT_A>
605 *
this = A*A.adjoint();
608 template <
class MAT_A>
610 *
this = A.adjoint()*A;
613 template <
class MAT_A,
class MAT_B>
629 template <
class MATRIX1,
class MATRIX2>
630 EIGEN_STRONG_INLINE
bool eigenVectors( MATRIX1 & eVecs, MATRIX2 & eVals )
const;
638 template <
class MATRIX1,
class VECTOR1>
639 EIGEN_STRONG_INLINE
bool eigenVectorsVec( MATRIX1 & eVecs, VECTOR1 & eVals )
const;
646 template <
class VECTOR>
650 eVecs.resizeLike(*
this);
656 template <
class MATRIX1,
class MATRIX2>
662 template <
class MATRIX1,
class VECTOR1>
675 template <
class MATRIX> EIGEN_STRONG_INLINE
bool chol(MATRIX &U)
const 677 Eigen::LLT<PlainObject> Chol = derived().template selfadjointView<Eigen::Lower>().llt();
678 if (Chol.info()==Eigen::NoConvergence)
680 U = PlainObject(Chol.matrixU());
687 EIGEN_STRONG_INLINE
size_t rank(
double threshold=0)
const 689 Eigen::ColPivHouseholderQR<PlainObject> QR = this->colPivHouseholderQr();
690 if (threshold>0) QR.setThreshold(threshold);
704 if (
size()==0)
return;
707 Scalar minMaxDelta = curMax - curMin;
708 if (minMaxDelta==0) minMaxDelta = 1;
709 const Scalar minMaxDelta_ = (valMax-valMin)/minMaxDelta;
710 this->array() = (this->array()-curMin)*minMaxDelta_+valMin;
720 v = derived().block(nRow,startingCol,1,cols()-startingCol);
723 template <
typename T>
inline void extractRow(
size_t nRow, std::vector<T> &
v,
size_t startingCol = 0)
const {
724 const size_t N = cols()-startingCol;
726 for (
size_t i=0;i<N;i++)
v[i]=(*
this)(nRow,startingCol+i);
729 template <
class VECTOR> EIGEN_STRONG_INLINE
void extractRowAsCol(
size_t nRow, VECTOR &
v,
size_t startingCol = 0)
const 731 v = derived().adjoint().block(startingCol,nRow,cols()-startingCol,1);
736 template <
class VECTOR> EIGEN_STRONG_INLINE
void extractCol(
size_t nCol, VECTOR &
v,
size_t startingRow = 0)
const {
737 v = derived().block(startingRow,nCol,rows()-startingRow,1);
740 template <
typename T>
inline void extractCol(
size_t nCol, std::vector<T> &
v,
size_t startingRow = 0)
const {
741 const size_t N = rows()-startingRow;
743 for (
size_t i=0;i<N;i++)
v[i]=(*
this)(startingRow+i,nCol);
746 template <
class MATRIX> EIGEN_STRONG_INLINE
void extractMatrix(
const size_t firstRow,
const size_t firstCol, MATRIX &m)
const 748 m = derived().block(firstRow,firstCol,m.rows(),m.cols());
750 template <
class MATRIX> EIGEN_STRONG_INLINE
void extractMatrix(
const size_t firstRow,
const size_t firstCol,
const size_t nRows,
const size_t nCols, MATRIX &m)
const 752 m.resize(nRows,nCols);
753 m = derived().block(firstRow,firstCol,nRows,nCols);
757 template <
class MATRIX>
758 EIGEN_STRONG_INLINE
void extractSubmatrix(
const size_t row_first,
const size_t row_last,
const size_t col_first,
const size_t col_last,MATRIX &out)
const 760 out.resize(row_last-row_first+1,col_last-col_first+1);
761 out = derived().block(row_first,col_first,row_last-row_first+1,col_last-col_first+1);
768 template <
class MATRIX>
770 const size_t block_size,
771 const std::vector<size_t> &block_indices,
774 if (block_size<1)
throw std::runtime_error(
"extractSubmatrixSymmetricalBlocks: block_size must be >=1");
775 if (cols()!=rows())
throw std::runtime_error(
"extractSubmatrixSymmetricalBlocks: Matrix is not square.");
777 const size_t N = block_indices.size();
778 const size_t nrows_out=N*block_size;
779 out.resize(nrows_out,nrows_out);
781 for (
size_t dst_row_blk=0;dst_row_blk<N; ++dst_row_blk )
783 for (
size_t dst_col_blk=0;dst_col_blk<N; ++dst_col_blk )
786 if (block_indices[dst_col_blk]*block_size + block_size-1>=
size_t(cols()))
throw std::runtime_error(
"extractSubmatrixSymmetricalBlocks: Indices out of range!");
788 out.block(dst_row_blk * block_size,dst_col_blk * block_size, block_size,block_size)
790 derived().block(block_indices[dst_row_blk] * block_size, block_indices[dst_col_blk] * block_size, block_size,block_size);
800 template <
class MATRIX>
802 const std::vector<size_t> &
indices,
805 if (cols()!=rows())
throw std::runtime_error(
"extractSubmatrixSymmetrical: Matrix is not square.");
807 const size_t N =
indices.size();
808 const size_t nrows_out=N;
809 out.resize(nrows_out,nrows_out);
811 for (
size_t dst_row_blk=0;dst_row_blk<N; ++dst_row_blk )
812 for (
size_t dst_col_blk=0;dst_col_blk<N; ++dst_col_blk )
813 out.coeffRef(dst_row_blk,dst_col_blk) = this->coeff(
indices[dst_row_blk],
indices[dst_col_blk]);
EIGEN_STRONG_INLINE void set_unsafe(const size_t row, const size_t col, const Scalar val)
Sets an element (Use with caution, bounds are not checked!)
EIGEN_STRONG_INLINE Scalar det() const
void meanAndStd(VEC &outMeanVector, VEC &outStdVector, const bool unbiased_variance=true) const
Computes a row with the mean values of each column in the matrix and the associated vector with the s...
void adjustRange(Scalar valMin, Scalar valMax)
EIGEN_STRONG_INLINE void extractRowAsCol(size_t nRow, VECTOR &v, size_t startingCol=0) const
Extract one row from the matrix into a column vector.
EIGEN_STRONG_INLINE void scalarPow(const Scalar s)
Scalar power of all elements to a given power, this is diferent of ^ operator.
EIGEN_STRONG_INLINE void multiply_Ab(const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput=false) const
EIGEN_STRONG_INLINE bool empty() const
EIGEN_STRONG_INLINE void removeRows(const std::vector< size_t > &idxsToRemove)
Remove rows of the matrix.
EIGEN_STRONG_INLINE Scalar multiply_HCHt_scalar(const MAT_C &C) const
std::string inMatlabFormat(const size_t decimal_digits=6) const
Dump matrix in matlab format.
EIGEN_STRONG_INLINE void fill(const Scalar v)
EIGEN_STRONG_INLINE bool isSquare() const
engineering format 'e'
EIGEN_STRONG_INLINE bool eigenVectors(MATRIX1 &eVecs, MATRIX2 &eVals) const
[For square matrices only] Compute the eigenvectors and eigenvalues (sorted), both returned as matric...
EIGEN_STRONG_INLINE void add_AAt(const OTHERMATRIX &A)
EIGEN_STRONG_INLINE bool chol(MATRIX &U) const
Cholesky M=UT * U decomposition for simetric matrix (upper-half of the matrix will be actually ignore...
EIGEN_STRONG_INLINE size_t rank(double threshold=0) const
Gets the rank of the matrix via the Eigen::ColPivHouseholderQR method.
EIGEN_STRONG_INLINE void multiply(const MATRIX1 &A, const MATRIX2 &B)
void extractSubmatrixSymmetricalBlocks(const size_t block_size, const std::vector< size_t > &block_indices, MATRIX &out) const
Get a submatrix from a square matrix, by collecting the elements M(idxs,idxs), where idxs is a sequen...
void multiply_skew3_A(const SKEW_3VECTOR &v, const MAT_A &A)
EIGEN_STRONG_INLINE Scalar * get_unsafe_row(size_t row)
Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in time critical ap...
EIGEN_STRONG_INLINE Scalar maximumDiagonal() const
Finds the maximum value in the diagonal of the matrix.
EIGEN_STRONG_INLINE void substract_Ac(const OTHERMATRIX &m, const Scalar c)
void multiply_ABCt(const MAT_A &A, const MAT_B &B, const MAT_C &C)
void multiply_A_skew3(const MAT_A &A, const SKEW_3VECTOR &v, MAT_OUT &out)
Only for vectors/arrays "v" of length3, compute out = A * Skew(v), where Skew(v) is the skew symmetri...
EIGEN_STRONG_INLINE void multiply_HCHt(const MAT_C &C, MAT_R &R, bool accumResultInOutput=false) const
EIGEN_STRONG_INLINE void swapRows(size_t i1, size_t i2)
GLuint GLuint GLsizei GLenum const GLvoid * indices
EIGEN_STRONG_INLINE iterator begin()
EIGEN_STRONG_INLINE void push_back(Scalar val)
Insert an element at the end of the container (for 1D vectors/arrays)
EIGEN_STRONG_INLINE bool isSingular(const Scalar absThreshold=0) const
EIGEN_STRONG_INLINE void extractCol(size_t nCol, VECTOR &v, size_t startingRow=0) const
Extract one column from the matrix into a column vector.
void find_index_max_value(size_t &u, size_t &v, Scalar &valMax) const
[VECTORS OR MATRICES] Finds the maximum value (and the corresponding zero-based index) from a given c...
EIGEN_STRONG_INLINE const AdjointReturnType t() const
Transpose.
void saveToTextFile(const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string()) const
Save matrix to a text file, compatible with MATLAB text format (see also the methods of matrix classe...
EIGEN_STRONG_INLINE void eigenVectorsSymmetricVec(MATRIX1 &eVecs, VECTOR1 &eVals) const
[For symmetric matrices only] Compute the eigenvectors and eigenvalues (in no particular order)...
const Scalar * const_iterator
EIGEN_STRONG_INLINE void multiply_AtB(const MATRIX1 &A, const MATRIX2 &B)
EIGEN_STRONG_INLINE bool eigenVectorsVec(MATRIX1 &eVecs, VECTOR1 &eVals) const
[For square matrices only] Compute the eigenvectors and eigenvalues (sorted), eigenvectors are the co...
EIGEN_STRONG_INLINE Scalar get_unsafe(const size_t row, const size_t col) const
Read-only access to one element (Use with caution, bounds are not checked!)
EIGEN_STRONG_INLINE Scalar squareNorm() const
Compute the square norm of a vector/array/matrix (the Euclidean distance to the origin, taking all the elements as a single vector).
EIGEN_STRONG_INLINE Scalar norm_inf() const
Compute the norm-infinite of a vector ($f[ ||{v}||_ $f]), ie the maximum absolute value of the elemen...
EIGEN_STRONG_INLINE void minimum_maximum(Scalar &out_min, Scalar &out_max) const
[VECTORS OR MATRICES] Compute the minimum and maximum of a container at once
T square(const T x)
Inline function for the square of a number.
void multiply_A_skew3(const MAT_A &A, const SKEW_3VECTOR &v)
EIGEN_STRONG_INLINE void insertMatrixTranspose(size_t r, size_t c, const MAT &m)
EIGEN_STRONG_INLINE size_t getColCount() const
Get number of columns.
EIGEN_STRONG_INLINE void laplacian(Eigen::MatrixBase< OtherDerived > &ret) const
Computes the laplacian of this square graph weight matrix.
EIGEN_STRONG_INLINE void eigenVectorsSymmetric(MATRIX1 &eVecs, MATRIX2 &eVals) const
[For symmetric matrices only] Compute the eigenvectors and eigenvalues (in no particular order)...
EIGEN_STRONG_INLINE void swapCols(size_t i1, size_t i2)
EIGEN_STRONG_INLINE void multiply_Atb(const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput=false) const
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
EIGEN_STRONG_INLINE size_t countNonZero() const
EIGEN_STRONG_INLINE void insertMatrix(size_t r, size_t c, const MAT &m)
Insert matrix "m" into this matrix at indices (r,c), that is, (*this)(r,c)=m(0,0) and so on...
EIGEN_STRONG_INLINE void substract_At(const OTHERMATRIX &m)
EIGEN_STRONG_INLINE void substract_AAt(const OTHERMATRIX &A)
EIGEN_STRONG_INLINE Scalar multiply_HtCH_scalar(const MAT_C &C) const
EIGEN_STRONG_INLINE void setSize(size_t row, size_t col)
Changes the size of matrix, maintaining its previous content as possible and padding with zeros where...
MatrixBase< Derived > & operator^=(const unsigned int pow)
Combined matrix power and assignment operator.
EIGEN_STRONG_INLINE void multiply_AB(const MATRIX1 &A, const MATRIX2 &B)
EIGEN_STRONG_INLINE void insertCol(size_t nCol, const MAT &aCol)
EIGEN_STRONG_INLINE void multiply_AAt_scalar(const MAT_A &A, typename MAT_A::Scalar f)
EIGEN_STRONG_INLINE void unit(const size_t nRows, const Scalar diag_vals)
Make the matrix an identity matrix (the diagonal values can be 1.0 or any other value) ...
EIGEN_STRONG_INLINE void removeColumns(const std::vector< size_t > &idxsToRemove)
Remove columns of the matrix.
EIGEN_STRONG_INLINE void unsafeRemoveRows(const std::vector< size_t > &idxs)
Remove rows of the matrix.
EIGEN_STRONG_INLINE void assign(const Scalar v)
GLsizei const GLchar ** string
EIGEN_STRONG_INLINE void extractSubmatrix(const size_t row_first, const size_t row_last, const size_t col_first, const size_t col_last, MATRIX &out) const
Get a submatrix, given its bounds: first & last column and row (inclusive).
EIGEN_STRONG_INLINE void unsafeRemoveColumns(const std::vector< size_t > &idxs)
Remove columns of the matrix.
void multiply_AtBC(const MAT_A &A, const MAT_B &B, const MAT_C &C)
void meanAndStdAll(double &outMean, double &outStd, const bool unbiased_variance=true) const
Computes the mean and standard deviation of all the elements in the matrix as a whole.
EIGEN_STRONG_INLINE void insertRow(size_t nRow, const MAT &aRow)
EIGEN_STRONG_INLINE void substract_An(const OTHERMATRIX &m, const size_t n)
EIGEN_STRONG_INLINE iterator end()
EIGEN_STRONG_INLINE Scalar maximum() const
[VECTORS OR MATRICES] Finds the maximum value
void loadFromTextFile(const std::string &file)
Load matrix from a text file, compatible with MATLAB text format.
void normalize(Scalar valMin, Scalar valMax)
Scales all elements such as the minimum & maximum values are shifted to the given values...
Internal resize which compiles to nothing on fixed-size matrices.
EIGEN_STRONG_INLINE Scalar sumAll() const
GLdouble GLdouble GLdouble r
void largestEigenvector(OUTVECT &x, Scalar resolution=Scalar(0.01), size_t maxIterations=6, int *out_Iterations=NULL, float *out_estimatedResolution=NULL) const
Efficiently computes only the biggest eigenvector of the matrix using the Power Method, and returns it in the passed vector "x".
EIGEN_STRONG_INLINE void multiply_ABt(const MAT_A &A, const MAT_B &B)
EIGEN_STRONG_INLINE bool isDiagonal() const
Checks for matrix type.
EIGEN_STRONG_INLINE void multiply_AtA(const MAT_A &A)
GLenum GLenum GLvoid * row
void extractSubmatrixSymmetrical(const std::vector< size_t > &indices, MATRIX &out) const
Get a submatrix from a square matrix, by collecting the elements M(idxs,idxs), where idxs is the sequ...
EIGEN_STRONG_INLINE void multiply_HtCH(const MAT_C &C, MAT_R &R, bool accumResultInOutput=false) const
EIGEN_STRONG_INLINE void add_Ac(const OTHERMATRIX &m, const Scalar c)
EIGEN_STRONG_INLINE void extractMatrix(const size_t firstRow, const size_t firstCol, MATRIX &m) const
EIGEN_STRONG_INLINE void multiply_subMatrix(const MAT_A &A, MAT_OUT &outResult, const size_t A_cols_offset, const size_t A_rows_offset, const size_t A_col_count) const
outResult = this * A
EIGEN_STRONG_INLINE void zeros()
Set all elements to zero.
bool fromMatlabStringFormat(const std::string &s, std::ostream *dump_errors_here=NULL)
Read a matrix from a string in Matlab-like format, for example "[1 0 2; 0 4 -1]" The string must star...
EIGEN_STRONG_INLINE void inv_fast(MATRIX &outMat) const
EIGEN_STRONG_INLINE void eigenValues(VECTOR &eVals) const
[For square matrices only] Compute the eigenvectors and eigenvalues (sorted), and return only the eig...
EIGEN_STRONG_INLINE size_t getRowCount() const
Get number of rows.
void multiply_skew3_A(const SKEW_3VECTOR &v, const MAT_A &A, MAT_OUT &out)
Only for vectors/arrays "v" of length3, compute out = Skew(v) * A, where Skew(v) is the skew symmetri...
EIGEN_STRONG_INLINE void multiply_AtA_scalar(const MAT_A &A, typename MAT_A::Scalar f)
void multiply_ABC(const MAT_A &A, const MAT_B &B, const MAT_C &C)
EIGEN_STRONG_INLINE void multiply_result_is_symmetric(const MAT_A &A, const MAT_B &B)
EIGEN_STRONG_INLINE void eye()
Make the matrix an identity matrix.
EIGEN_STRONG_INLINE void multiplyRowByScalar(size_t r, Scalar s)
EIGEN_STRONG_INLINE void ones(const size_t row, const size_t col)
Resize matrix and set all elements to one.
EIGEN_STRONG_INLINE void extractRow(size_t nRow, Eigen::EigenBase< OtherDerived > &v, size_t startingCol=0) const
Extract one row from the matrix into a row vector.
GLsizei GLsizei GLenum GLenum const GLvoid * data
EIGEN_STRONG_INLINE Scalar minimum() const
[VECTORS OR MATRICES] Finds the minimum value
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
EIGEN_STRONG_INLINE void multiplyColumnByScalar(size_t c, Scalar s)
EIGEN_STRONG_INLINE PlainObject inv() const
EIGEN_STRONG_INLINE void multiply_AAt(const MAT_A &A)