32 return (&(derived().
data()[
size() - 1])) + 1;
37 return (&(derived().
data()[
size() - 1])) + 1;
46 EIGEN_STRONG_INLINE
void fill(
const Scalar v) { derived().setConstant(
v); }
48 EIGEN_STRONG_INLINE
void assign(
const Scalar v) { derived().setConstant(
v); }
53 derived().setConstant(
v);
57 EIGEN_STRONG_INLINE
size_t getRowCount()
const {
return rows(); }
59 EIGEN_STRONG_INLINE
size_t getColCount()
const {
return cols(); }
62 EIGEN_STRONG_INLINE
void unit(
const size_t nRows,
const Scalar diag_vals)
65 derived().setIdentity(nRows, nRows);
68 derived().setZero(nRows, nRows);
69 derived().diagonal().setConstant(diag_vals);
74 EIGEN_STRONG_INLINE
void unit() { derived().setIdentity(); }
76 EIGEN_STRONG_INLINE
void eye() { derived().setIdentity(); }
78 EIGEN_STRONG_INLINE
void zeros() { derived().setZero(); }
80 EIGEN_STRONG_INLINE
void zeros(
const size_t row,
const size_t col)
82 derived().setZero(
row, col);
86 EIGEN_STRONG_INLINE
void ones(
const size_t row,
const size_t col)
88 derived().setOnes(
row, col);
91 EIGEN_STRONG_INLINE
void ones() { derived().setOnes(); }
99 return &derived().coeffRef(
row, 0);
103 return &derived().coeff(
row, 0);
111 return derived()(
row, col);
113 return derived().coeff(
row, col);
121 return derived()(
row, col);
123 return derived().coeffRef(
row, col);
131 derived()(
row, col) =
val;
133 derived().coeffRef(
row, col) =
val;
140 const Index N =
size();
141 derived().conservativeResize(N + 1);
145 EIGEN_STRONG_INLINE
bool isSquare()
const {
return cols() == rows(); }
148 return std::abs(derived().determinant()) < absThreshold;
168 const std::string&
s, std::ostream* dump_errors_here =
nullptr);
195 bool appendMRPTHeader =
false,
212 derived().col(
c) *=
s;
216 derived().row(
r) *=
s;
219 EIGEN_STRONG_INLINE
void swapCols(
size_t i1,
size_t i2)
221 derived().col(i1).swap(derived().col(i2));
223 EIGEN_STRONG_INLINE
void swapRows(
size_t i1,
size_t i2)
225 derived().row(i1).swap(derived().
row(i2));
230 return ((*static_cast<const Derived*>(
this)) != 0).count();
238 if (
size() == 0)
throw std::runtime_error(
"maximum: container is empty");
239 return derived().maxCoeff();
247 if (
size() == 0)
throw std::runtime_error(
"minimum: container is empty");
248 return derived().minCoeff();
266 if (
size() == 0)
throw std::runtime_error(
"maximum: container is empty");
268 const Scalar m = derived().maxCoeff(&idx);
269 if (maxIndex) *maxIndex = idx;
279 if (cols() == 0 || rows() == 0)
280 throw std::runtime_error(
"find_index_max_value: container is empty");
282 valMax = derived().maxCoeff(&idx1, &idx2);
293 if (
size() == 0)
throw std::runtime_error(
"minimum: container is empty");
295 const Scalar m = derived().minCoeff(&idx);
296 if (minIndex) *minIndex = idx;
304 Scalar& out_min,
Scalar& out_max,
size_t* minIndex,
size_t* maxIndex)
const 314 return lpNorm<Eigen::Infinity>();
327 template <
typename OtherDerived>
328 EIGEN_STRONG_INLINE
void laplacian(Eigen::MatrixBase<OtherDerived>& ret)
const 330 if (rows() != cols())
331 throw std::runtime_error(
"laplacian: Defined for square matrixes only");
332 const Index N = rows();
334 for (Index i = 0; i < N; i++)
337 for (Index j = 0; j < N; j++) deg += derived().coeff(j, i);
338 ret.coeffRef(i, i) += deg;
350 if ((Derived::RowsAtCompileTime != Eigen::Dynamic &&
351 Derived::RowsAtCompileTime !=
int(
row)) ||
352 (Derived::ColsAtCompileTime != Eigen::Dynamic &&
353 Derived::ColsAtCompileTime !=
int(col)))
355 std::stringstream ss;
356 ss <<
"setSize: Trying to change a fixed sized matrix from " << rows()
357 <<
"x" << cols() <<
" to " <<
row <<
"x" << col;
358 throw std::runtime_error(ss.str());
361 const Index oldCols = cols();
362 const Index oldRows = rows();
363 const int nNewCols = int(col) - int(cols());
364 const int nNewRows = int(
row) - int(rows());
366 Eigen::MatrixBase<Derived>,
367 SizeAtCompileTime>::internal_resize(*
this,
row, col);
368 if (nNewCols > 0) derived().block(0, oldCols,
row, nNewCols).setZero();
369 if (nNewRows > 0) derived().block(oldRows, 0, nNewRows, col).setZero();
374 template <
class OUTVECT>
376 OUTVECT&
x,
Scalar resolution =
Scalar(0.01),
size_t maxIterations = 6,
377 int* out_Iterations =
nullptr,
378 float* out_estimatedResolution =
nullptr)
const 382 const Index
n = rows();
388 Eigen::Matrix<Scalar, Derived::RowsAtCompileTime, 1> xx = (*this) *
x;
389 xx *=
Scalar(1.0 / xx.norm());
396 }
while (iter < maxIterations && dif > resolution);
397 if (out_Iterations) *out_Iterations =
static_cast<int>(iter);
398 if (out_estimatedResolution) *out_estimatedResolution = dif;
405 derived().setIdentity();
407 for (
unsigned int i = 1; i < pow; i++) derived() *= derived();
417 for (Index
c = 0;
c < cols();
c++)
418 for (Index
r = 0;
r < rows();
r++)
419 if (
r !=
c && coeff(
r,
c) != 0)
return false;
426 return diagonal().maxCoeff();
431 EIGEN_STRONG_INLINE
double mean()
const 433 if (
size() == 0)
throw std::runtime_error(
"mean: Empty container.");
434 return derived().sum() /
static_cast<double>(
size());
446 VEC& outMeanVector, VEC& outStdVector,
447 const bool unbiased_variance =
true)
const 449 const size_t N = rows();
450 if (N == 0)
throw std::runtime_error(
"meanAndStd: Empty container.");
451 const double N_inv = 1.0 / N;
453 unbiased_variance ? (N > 1 ? 1.0 / (N - 1) : 1.0) : 1.0 / N;
454 outMeanVector.resize(cols());
455 outStdVector.resize(cols());
456 for (Index i = 0; i < cols(); i++)
458 outMeanVector[i] = this->col(i).array().sum() * N_inv;
459 outStdVector[i] = std::sqrt(
460 (this->col(i).array() - outMeanVector[i]).
square().
sum() * N_);
472 double& outMean,
double& outStd,
const bool unbiased_variance =
true)
const 474 const size_t N =
size();
475 if (N == 0)
throw std::runtime_error(
"meanAndStdAll: Empty container.");
477 unbiased_variance ? (N > 1 ? 1.0 / (N - 1) : 1.0) : 1.0 / N;
478 outMean = derived().array().sum() /
static_cast<double>(
size());
479 outStd = std::sqrt((this->array() - outMean).
square().
sum() * N_);
484 template <
typename MAT>
487 derived().block(
r,
c, m.rows(), m.cols()) = m;
490 template <
typename MAT>
493 derived().block(
r,
c, m.cols(), m.rows()) = m.adjoint();
496 template <
typename MAT>
497 EIGEN_STRONG_INLINE
void insertRow(
size_t nRow,
const MAT& aRow)
499 this->
row(nRow) = aRow;
501 template <
typename MAT>
502 EIGEN_STRONG_INLINE
void insertCol(
size_t nCol,
const MAT& aCol)
504 this->col(nCol) = aCol;
507 template <
typename R>
510 if (static_cast<Index>(aRow.size()) != cols())
511 throw std::runtime_error(
512 "insertRow: Row size doesn't fit the size of this matrix.");
513 for (Index j = 0; j < cols(); j++) coeffRef(nRow, j) = aRow[j];
515 template <
typename R>
518 if (static_cast<Index>(aCol.size()) != rows())
519 throw std::runtime_error(
520 "insertRow: Row size doesn't fit the size of this matrix.");
521 for (Index j = 0; j < rows(); j++) coeffRef(j, nCol) = aCol[j];
525 EIGEN_STRONG_INLINE
void removeColumns(
const std::vector<size_t>& idxsToRemove)
527 std::vector<size_t> idxs = idxsToRemove;
528 std::sort(idxs.begin(), idxs.end());
530 idxs.resize(itEnd - idxs.begin());
540 for (std::vector<size_t>::const_reverse_iterator it = idxs.rbegin();
541 it != idxs.rend(); ++it, ++k)
543 const size_t nC = cols() - *it - k;
545 derived().block(0, *it, rows(), nC) =
546 derived().block(0, *it + 1, rows(), nC).eval();
548 derived().conservativeResize(NoChange, cols() - idxs.size());
552 EIGEN_STRONG_INLINE
void removeRows(
const std::vector<size_t>& idxsToRemove)
554 std::vector<size_t> idxs = idxsToRemove;
555 std::sort(idxs.begin(), idxs.end());
557 idxs.resize(itEnd - idxs.begin());
567 for (std::vector<size_t>::reverse_iterator it = idxs.rbegin();
568 it != idxs.rend(); ++it, ++k)
570 const size_t nR = rows() - *it - k;
572 derived().block(*it, 0, nR, cols()) =
573 derived().block(*it + 1, 0, nR, cols()).eval();
575 derived().conservativeResize(rows() - idxs.size(), NoChange);
579 EIGEN_STRONG_INLINE
const AdjointReturnType
t()
const 581 return derived().adjoint();
584 EIGEN_STRONG_INLINE PlainObject
inv()
const 586 PlainObject outMat = derived().inverse().eval();
589 template <
class MATRIX>
590 EIGEN_STRONG_INLINE
void inv(MATRIX& outMat)
const 592 outMat = derived().inverse().eval();
594 template <
class MATRIX>
595 EIGEN_STRONG_INLINE
void inv_fast(MATRIX& outMat)
const 597 outMat = derived().inverse().eval();
599 EIGEN_STRONG_INLINE
Scalar det()
const {
return derived().determinant(); }
605 EIGEN_STRONG_INLINE
bool empty()
const 611 template <
typename OTHERMATRIX>
617 template <
typename OTHERMATRIX>
624 template <
typename OTHERMATRIX>
627 (*this) -= m.adjoint();
631 template <
typename OTHERMATRIX>
634 this->noalias() -=
n * m;
638 template <
typename OTHERMATRIX>
639 EIGEN_STRONG_INLINE
void add_AAt(
const OTHERMATRIX& A)
641 this->noalias() += A;
642 this->noalias() += A.adjoint();
646 template <
typename OTHERMATRIX>
649 this->noalias() -= A;
650 this->noalias() -= A.adjoint();
653 template <
class MATRIX1,
class MATRIX2>
655 const MATRIX1& A,
const MATRIX2& B)
660 template <
class MATRIX1,
class MATRIX2>
662 const MATRIX1& A,
const MATRIX2& B)
667 template <
typename MATRIX1,
typename MATRIX2>
669 const MATRIX1& A,
const MATRIX2& B)
671 *
this = A.adjoint() * B;
676 template <
typename OTHERVECTOR1,
typename OTHERVECTOR2>
678 const OTHERVECTOR1& vIn, OTHERVECTOR2& vOut,
679 bool accumToOutput =
false)
const 682 vOut.noalias() += (*this) * vIn;
684 vOut = (*this) * vIn;
689 template <
typename OTHERVECTOR1,
typename OTHERVECTOR2>
691 const OTHERVECTOR1& vIn, OTHERVECTOR2& vOut,
692 bool accumToOutput =
false)
const 695 vOut.noalias() += this->adjoint() * vIn;
697 vOut = this->adjoint() * vIn;
700 template <
typename MAT_C,
typename MAT_R>
702 const MAT_C& C, MAT_R&
R,
bool accumResultInOutput =
false)
705 if (accumResultInOutput)
706 R.noalias() += (*this) * C * this->adjoint();
708 R.noalias() = (*this) * C * this->adjoint();
711 template <
typename MAT_C,
typename MAT_R>
713 const MAT_C& C, MAT_R&
R,
bool accumResultInOutput =
false)
716 if (accumResultInOutput)
717 R.noalias() += this->adjoint() * C * (*this);
719 R.noalias() = this->adjoint() * C * (*this);
725 template <
typename MAT_C>
728 return ((*
this) * C * this->adjoint()).eval()(0, 0);
734 template <
typename MAT_C>
737 return (this->adjoint() * C * (*
this)).eval()(0, 0);
741 template <
typename MAT_A>
745 *
this = (A * A.adjoint()) * f;
749 template <
typename MAT_A>
753 *
this = (A.adjoint() * A) * f;
758 template <
class MAT_A,
class SKEW_3VECTOR>
766 template <
class SKEW_3VECTOR,
class MAT_A>
774 template <
class MAT_A,
class MAT_OUT>
776 const MAT_A& A, MAT_OUT& outResult,
const size_t A_cols_offset,
777 const size_t A_rows_offset,
const size_t A_col_count)
const 781 A.block(A_rows_offset, A_cols_offset, derived().cols(), A_col_count);
784 template <
class MAT_A,
class MAT_B,
class MAT_C>
786 const MAT_A& A,
const MAT_B& B,
const MAT_C& C)
791 template <
class MAT_A,
class MAT_B,
class MAT_C>
793 const MAT_A& A,
const MAT_B& B,
796 *
this = A * B * C.adjoint();
799 template <
class MAT_A,
class MAT_B,
class MAT_C>
801 const MAT_A& A,
const MAT_B& B,
804 *
this = A.adjoint() * B * C;
807 template <
class MAT_A,
class MAT_B>
809 const MAT_A& A,
const MAT_B& B)
811 *
this = A * B.adjoint();
814 template <
class MAT_A>
818 *
this = A * A.adjoint();
821 template <
class MAT_A>
825 *
this = A.adjoint() * A;
828 template <
class MAT_A,
class MAT_B>
830 const MAT_A& A,
const MAT_B& B)
848 template <
class MATRIX1,
class MATRIX2>
849 EIGEN_STRONG_INLINE
bool eigenVectors(MATRIX1& eVecs, MATRIX2& eVals)
const;
861 template <
class MATRIX1,
class VECTOR1>
862 EIGEN_STRONG_INLINE
bool eigenVectorsVec(MATRIX1& eVecs, VECTOR1& eVals)
const;
871 template <
class VECTOR>
875 eVecs.resizeLike(*
this);
883 template <
class MATRIX1,
class MATRIX2>
885 MATRIX1& eVecs, MATRIX2& eVals)
const;
893 template <
class MATRIX1,
class VECTOR1>
895 MATRIX1& eVecs, VECTOR1& eVals)
const;
905 template <
class MATRIX>
906 EIGEN_STRONG_INLINE
bool chol(MATRIX& U)
const 908 Eigen::LLT<PlainObject> Chol =
909 derived().template selfadjointView<Eigen::Lower>().llt();
910 if (Chol.info() == Eigen::NoConvergence)
return false;
911 U = PlainObject(Chol.matrixU());
919 EIGEN_STRONG_INLINE
size_t rank(
double threshold = 0)
const 921 Eigen::ColPivHouseholderQR<PlainObject> QR = this->colPivHouseholderQr();
922 if (threshold > 0) QR.setThreshold(threshold);
935 if (
size() == 0)
return;
938 Scalar minMaxDelta = curMax - curMin;
939 if (minMaxDelta == 0) minMaxDelta = 1;
940 const Scalar minMaxDelta_ = (valMax - valMin) / minMaxDelta;
941 this->array() = (this->array() - curMin) * minMaxDelta_ + valMin;
952 template <
class OtherDerived>
955 size_t startingCol = 0)
const 957 v = derived().block(nRow, startingCol, 1, cols() - startingCol);
960 template <
typename T>
962 size_t nRow, std::vector<T>&
v,
size_t startingCol = 0)
const 964 const size_t N = cols() - startingCol;
966 for (
size_t i = 0; i < N; i++)
v[i] = (*
this)(nRow, startingCol + i);
969 template <
class VECTOR>
971 size_t nRow, VECTOR&
v,
size_t startingCol = 0)
const 973 v = derived().adjoint().block(startingCol, nRow, cols() - startingCol, 1);
977 template <
class VECTOR>
979 size_t nCol, VECTOR&
v,
size_t startingRow = 0)
const 981 v = derived().block(startingRow, nCol, rows() - startingRow, 1);
984 template <
typename T>
986 size_t nCol, std::vector<T>&
v,
size_t startingRow = 0)
const 988 const size_t N = rows() - startingRow;
990 for (
size_t i = 0; i < N; i++)
v[i] = (*
this)(startingRow + i, nCol);
993 template <
class MATRIX>
995 const size_t firstRow,
const size_t firstCol, MATRIX& m)
const 997 m = derived().block(firstRow, firstCol, m.rows(), m.cols());
999 template <
class MATRIX>
1001 const size_t firstRow,
const size_t firstCol,
const size_t nRows,
1002 const size_t nCols, MATRIX& m)
const 1004 m.resize(nRows, nCols);
1005 m = derived().block(firstRow, firstCol, nRows, nCols);
1010 template <
class MATRIX>
1012 const size_t row_first,
const size_t row_last,
const size_t col_first,
1013 const size_t col_last, MATRIX& out)
const 1015 out.resize(row_last - row_first + 1, col_last - col_first + 1);
1016 out = derived().block(
1017 row_first, col_first, row_last - row_first + 1,
1018 col_last - col_first + 1);
1029 template <
class MATRIX>
1031 const size_t block_size,
const std::vector<size_t>& block_indices,
1035 throw std::runtime_error(
1036 "extractSubmatrixSymmetricalBlocks: block_size must be >=1");
1037 if (cols() != rows())
1038 throw std::runtime_error(
1039 "extractSubmatrixSymmetricalBlocks: Matrix is not square.");
1041 const size_t N = block_indices.size();
1042 const size_t nrows_out = N * block_size;
1043 out.resize(nrows_out, nrows_out);
1045 for (
size_t dst_row_blk = 0; dst_row_blk < N; ++dst_row_blk)
1047 for (
size_t dst_col_blk = 0; dst_col_blk < N; ++dst_col_blk)
1050 if (block_indices[dst_col_blk] * block_size + block_size - 1 >=
1052 throw std::runtime_error(
1053 "extractSubmatrixSymmetricalBlocks: Indices out of range!");
1056 dst_row_blk * block_size, dst_col_blk * block_size, block_size,
1059 block_indices[dst_row_blk] * block_size,
1060 block_indices[dst_col_blk] * block_size, block_size,
1072 template <
class MATRIX>
1074 const std::vector<size_t>&
indices, MATRIX& out)
const 1076 if (cols() != rows())
1077 throw std::runtime_error(
1078 "extractSubmatrixSymmetrical: Matrix is not square.");
1080 const size_t N =
indices.size();
1081 const size_t nrows_out = N;
1082 out.resize(nrows_out, nrows_out);
1084 for (
size_t dst_row_blk = 0; dst_row_blk < N; ++dst_row_blk)
1085 for (
size_t dst_col_blk = 0; dst_col_blk < N; ++dst_col_blk)
1086 out.coeffRef(dst_row_blk, 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
void largestEigenvector(OUTVECT &x, Scalar resolution=Scalar(0.01), size_t maxIterations=6, int *out_Iterations=nullptr, float *out_estimatedResolution=nullptr) const
Efficiently computes only the biggest eigenvector of the matrix using the Power Method, and returns it in the passed vector "x".
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)
bool fromMatlabStringFormat(const std::string &s, std::ostream *dump_errors_here=nullptr)
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 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
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.
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)