Go to the documentation of this file.
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);
58 EIGEN_STRONG_INLINE
void unit(
const size_t nRows,
const Scalar diag_vals)
61 derived().setIdentity(nRows, nRows);
64 derived().setZero(nRows, nRows);
65 derived().diagonal().setConstant(diag_vals);
70 EIGEN_STRONG_INLINE
void unit() { derived().setIdentity(); }
72 EIGEN_STRONG_INLINE
void eye() { derived().setIdentity(); }
74 EIGEN_STRONG_INLINE
void zeros() { derived().setZero(); }
76 EIGEN_STRONG_INLINE
void zeros(
const size_t row,
const size_t col)
78 derived().setZero(
row, col);
82 EIGEN_STRONG_INLINE
void ones(
const size_t row,
const size_t col)
84 derived().setOnes(
row, col);
87 EIGEN_STRONG_INLINE
void ones() { derived().setOnes(); }
95 return &derived().coeffRef(
row, 0);
99 return &derived().coeff(
row, 0);
107 return derived()(
row, col);
109 return derived().coeff(
row, col);
117 return derived()(
row, col);
119 return derived().coeffRef(
row, col);
127 derived()(
row, col) =
val;
129 derived().coeffRef(
row, col) =
val;
136 const Index N =
size();
137 derived().conservativeResize(N + 1);
141 EIGEN_STRONG_INLINE
bool isSquare()
const {
return cols() == rows(); }
144 return std::abs(derived().determinant()) < absThreshold;
164 const std::string&
s, std::ostream* dump_errors_here =
nullptr);
191 bool appendMRPTHeader =
false,
208 derived().col(
c) *=
s;
212 derived().row(
r) *=
s;
215 EIGEN_STRONG_INLINE
void swapCols(
size_t i1,
size_t i2)
217 derived().col(i1).swap(derived().col(i2));
219 EIGEN_STRONG_INLINE
void swapRows(
size_t i1,
size_t i2)
221 derived().row(i1).swap(derived().
row(i2));
226 return ((*
static_cast<const Derived*
>(
this)) != 0).count();
234 if (
size() == 0)
throw std::runtime_error(
"maximum: container is empty");
235 return derived().maxCoeff();
243 if (
size() == 0)
throw std::runtime_error(
"minimum: container is empty");
244 return derived().minCoeff();
262 if (
size() == 0)
throw std::runtime_error(
"maximum: container is empty");
264 const Scalar m = derived().maxCoeff(&idx);
265 if (maxIndex) *maxIndex = idx;
275 if (cols() == 0 || rows() == 0)
276 throw std::runtime_error(
"find_index_max_value: container is empty");
278 valMax = derived().maxCoeff(&idx1, &idx2);
289 if (
size() == 0)
throw std::runtime_error(
"minimum: container is empty");
291 const Scalar m = derived().minCoeff(&idx);
292 if (minIndex) *minIndex = idx;
300 Scalar& out_min,
Scalar& out_max,
size_t* minIndex,
size_t* maxIndex)
const
310 return lpNorm<Eigen::Infinity>();
323 template <
typename OtherDerived>
326 if (rows() != cols())
327 throw std::runtime_error(
"laplacian: Defined for square matrixes only");
328 const Index N = rows();
330 for (Index i = 0; i < N; i++)
333 for (Index j = 0; j < N; j++) deg += derived().coeff(j, i);
334 ret.coeffRef(i, i) += deg;
346 if ((Derived::RowsAtCompileTime != Eigen::Dynamic &&
347 Derived::RowsAtCompileTime !=
int(
row)) ||
348 (Derived::ColsAtCompileTime != Eigen::Dynamic &&
349 Derived::ColsAtCompileTime !=
int(col)))
351 std::stringstream ss;
352 ss <<
"setSize: Trying to change a fixed sized matrix from " << rows()
353 <<
"x" << cols() <<
" to " <<
row <<
"x" << col;
354 throw std::runtime_error(ss.str());
357 const Index oldCols = cols();
358 const Index oldRows = rows();
359 const int nNewCols = int(col) - int(cols());
360 const int nNewRows = int(
row) - int(rows());
363 SizeAtCompileTime>::internal_resize(*
this,
row, col);
364 if (nNewCols > 0) derived().block(0, oldCols,
row, nNewCols).setZero();
365 if (nNewRows > 0) derived().block(oldRows, 0, nNewRows, col).setZero();
370 template <
class OUTVECT>
372 OUTVECT&
x,
Scalar resolution =
Scalar(0.01),
size_t maxIterations = 6,
373 int* out_Iterations =
nullptr,
374 float* out_estimatedResolution =
nullptr)
const
378 const Index
n = rows();
384 Eigen::Matrix<Scalar, Derived::RowsAtCompileTime, 1> xx = (*this) *
x;
385 xx *=
Scalar(1.0 / xx.norm());
392 }
while (iter < maxIterations && dif > resolution);
393 if (out_Iterations) *out_Iterations =
static_cast<int>(iter);
394 if (out_estimatedResolution) *out_estimatedResolution = dif;
401 derived().setIdentity();
403 for (
unsigned int i = 1; i < pow; i++) derived() *= derived();
413 for (Index
c = 0;
c < cols();
c++)
414 for (Index
r = 0;
r < rows();
r++)
415 if (
r !=
c && coeff(
r,
c) != 0)
return false;
422 return diagonal().maxCoeff();
427 EIGEN_STRONG_INLINE
double mean()
const
429 if (
size() == 0)
throw std::runtime_error(
"mean: Empty container.");
430 return derived().sum() /
static_cast<double>(
size());
442 VEC& outMeanVector, VEC& outStdVector,
443 const bool unbiased_variance =
true)
const
445 const size_t N = rows();
446 if (N == 0)
throw std::runtime_error(
"meanAndStd: Empty container.");
447 const double N_inv = 1.0 / N;
449 unbiased_variance ? (N > 1 ? 1.0 / (N - 1) : 1.0) : 1.0 / N;
450 outMeanVector.resize(cols());
451 outStdVector.resize(cols());
452 for (decltype(cols()) i = 0; i < cols(); i++)
454 outMeanVector[i] = this->col(i).array().sum() * N_inv;
455 outStdVector[i] = std::sqrt(
456 (this->col(i).array() - outMeanVector[i]).
square().
sum() * N_);
468 double& outMean,
double& outStd,
const bool unbiased_variance =
true)
const
470 const size_t N =
size();
471 if (N == 0)
throw std::runtime_error(
"meanAndStdAll: Empty container.");
473 unbiased_variance ? (N > 1 ? 1.0 / (N - 1) : 1.0) : 1.0 / N;
474 outMean = derived().array().sum() /
static_cast<double>(
size());
475 outStd = std::sqrt((this->array() - outMean).
square().
sum() * N_);
480 template <
typename MAT>
483 derived().block(
r,
c, m.rows(), m.cols()) = m;
486 template <
typename MAT>
489 derived().block(
r,
c, m.cols(), m.rows()) = m.adjoint();
492 template <
typename MAT>
493 EIGEN_STRONG_INLINE
void insertRow(
size_t nRow,
const MAT& aRow)
495 this->
row(nRow) = aRow;
497 template <
typename MAT>
498 EIGEN_STRONG_INLINE
void insertCol(
size_t nCol,
const MAT& aCol)
500 this->col(nCol) = aCol;
503 template <
typename R>
506 if (
static_cast<Index
>(aRow.size()) != cols())
507 throw std::runtime_error(
508 "insertRow: Row size doesn't fit the size of this matrix.");
509 for (decltype(cols()) j = 0; j < cols(); j++) coeffRef(nRow, j) = aRow[j];
511 template <
typename R>
514 if (
static_cast<Index
>(aCol.size()) != rows())
515 throw std::runtime_error(
516 "insertRow: Row size doesn't fit the size of this matrix.");
517 for (decltype(cols()) j = 0; j < rows(); j++) coeffRef(j, nCol) = aCol[j];
521 EIGEN_STRONG_INLINE
void removeColumns(
const std::vector<size_t>& idxsToRemove)
523 std::vector<size_t> idxs = idxsToRemove;
524 std::sort(idxs.begin(), idxs.end());
526 idxs.resize(itEnd - idxs.begin());
536 for (std::vector<size_t>::const_reverse_iterator it = idxs.rbegin();
537 it != idxs.rend(); ++it, ++k)
539 const size_t nC = cols() - *it - k;
541 derived().block(0, *it, rows(), nC) =
542 derived().block(0, *it + 1, rows(), nC).eval();
544 derived().conservativeResize(NoChange, cols() - idxs.size());
548 EIGEN_STRONG_INLINE
void removeRows(
const std::vector<size_t>& idxsToRemove)
550 std::vector<size_t> idxs = idxsToRemove;
551 std::sort(idxs.begin(), idxs.end());
553 idxs.resize(itEnd - idxs.begin());
563 for (
auto it = idxs.rbegin();
564 it != idxs.rend(); ++it, ++k)
566 const size_t nR = rows() - *it - k;
568 derived().block(*it, 0, nR, cols()) =
569 derived().block(*it + 1, 0, nR, cols()).eval();
571 derived().conservativeResize(rows() - idxs.size(), NoChange);
575 EIGEN_STRONG_INLINE
const AdjointReturnType
t()
const
577 return derived().adjoint();
580 EIGEN_STRONG_INLINE PlainObject
inv()
const
582 PlainObject outMat = derived().inverse().eval();
585 template <
class MATRIX>
586 EIGEN_STRONG_INLINE
void inv(MATRIX& outMat)
const
588 outMat = derived().inverse().eval();
590 template <
class MATRIX>
591 EIGEN_STRONG_INLINE
void inv_fast(MATRIX& outMat)
const
593 outMat = derived().inverse().eval();
595 EIGEN_STRONG_INLINE
Scalar det()
const {
return derived().determinant(); }
601 EIGEN_STRONG_INLINE
bool empty()
const
603 return this->cols() == 0 || this->rows() == 0;
607 template <
typename OTHERMATRIX>
613 template <
typename OTHERMATRIX>
620 template <
typename OTHERMATRIX>
623 (*this) -= m.adjoint();
627 template <
typename OTHERMATRIX>
630 this->noalias() -=
n * m;
634 template <
typename OTHERMATRIX>
635 EIGEN_STRONG_INLINE
void add_AAt(
const OTHERMATRIX& A)
637 this->noalias() += A;
638 this->noalias() += A.adjoint();
642 template <
typename OTHERMATRIX>
645 this->noalias() -= A;
646 this->noalias() -= A.adjoint();
649 template <
class MATRIX1,
class MATRIX2>
651 const MATRIX1& A,
const MATRIX2& B)
656 template <
class MATRIX1,
class MATRIX2>
658 const MATRIX1& A,
const MATRIX2& B)
663 template <
typename MATRIX1,
typename MATRIX2>
665 const MATRIX1& A,
const MATRIX2& B)
667 *
this = A.adjoint() * B;
672 template <
typename OTHERVECTOR1,
typename OTHERVECTOR2>
674 const OTHERVECTOR1& vIn, OTHERVECTOR2& vOut,
675 bool accumToOutput =
false)
const
678 vOut.noalias() += (*this) * vIn;
680 vOut = (*this) * vIn;
685 template <
typename OTHERVECTOR1,
typename OTHERVECTOR2>
687 const OTHERVECTOR1& vIn, OTHERVECTOR2& vOut,
688 bool accumToOutput =
false)
const
691 vOut.noalias() += this->adjoint() * vIn;
693 vOut = this->adjoint() * vIn;
696 template <
typename MAT_C,
typename MAT_R>
698 const MAT_C& C, MAT_R&
R,
bool accumResultInOutput =
false)
701 if (accumResultInOutput)
702 R.noalias() += (*this) * C * this->adjoint();
704 R.noalias() = (*this) * C * this->adjoint();
707 template <
typename MAT_C,
typename MAT_R>
709 const MAT_C& C, MAT_R&
R,
bool accumResultInOutput =
false)
712 if (accumResultInOutput)
713 R.noalias() += this->adjoint() * C * (*this);
715 R.noalias() = this->adjoint() * C * (*this);
721 template <
typename MAT_C>
724 return ((*
this) * C * this->adjoint()).eval()(0, 0);
730 template <
typename MAT_C>
733 return (this->adjoint() * C * (*
this)).eval()(0, 0);
737 template <
typename MAT_A>
741 *
this = (A * A.adjoint()) * f;
745 template <
typename MAT_A>
749 *
this = (A.adjoint() * A) * f;
754 template <
class MAT_A,
class SKEW_3VECTOR>
762 template <
class SKEW_3VECTOR,
class MAT_A>
770 template <
class MAT_A,
class MAT_OUT>
772 const MAT_A& A, MAT_OUT& outResult,
const size_t A_cols_offset,
773 const size_t A_rows_offset,
const size_t A_col_count)
const
777 A.block(A_rows_offset, A_cols_offset, derived().cols(), A_col_count);
780 template <
class MAT_A,
class MAT_B,
class MAT_C>
782 const MAT_A& A,
const MAT_B& B,
const MAT_C& C)
787 template <
class MAT_A,
class MAT_B,
class MAT_C>
789 const MAT_A& A,
const MAT_B& B,
792 *
this = A * B * C.adjoint();
795 template <
class MAT_A,
class MAT_B,
class MAT_C>
797 const MAT_A& A,
const MAT_B& B,
800 *
this = A.adjoint() * B * C;
803 template <
class MAT_A,
class MAT_B>
805 const MAT_A& A,
const MAT_B& B)
807 *
this = A * B.adjoint();
810 template <
class MAT_A>
814 *
this = A * A.adjoint();
817 template <
class MAT_A>
821 *
this = A.adjoint() * A;
824 template <
class MAT_A,
class MAT_B>
826 const MAT_A& A,
const MAT_B& B)
844 template <
class MATRIX1,
class MATRIX2>
845 EIGEN_STRONG_INLINE
bool eigenVectors(MATRIX1& eVecs, MATRIX2& eVals)
const;
857 template <
class MATRIX1,
class VECTOR1>
858 EIGEN_STRONG_INLINE
bool eigenVectorsVec(MATRIX1& eVecs, VECTOR1& eVals)
const;
867 template <
class VECTOR>
871 eVecs.resizeLike(*
this);
879 template <
class MATRIX1,
class MATRIX2>
881 MATRIX1& eVecs, MATRIX2& eVals)
const;
889 template <
class MATRIX1,
class VECTOR1>
891 MATRIX1& eVecs, VECTOR1& eVals)
const;
901 template <
class MATRIX>
902 EIGEN_STRONG_INLINE
bool chol(MATRIX& U)
const
904 Eigen::LLT<PlainObject> Chol =
905 derived().template selfadjointView<Eigen::Lower>().llt();
906 if (Chol.info() == Eigen::NoConvergence)
return false;
907 U = PlainObject(Chol.matrixU());
915 EIGEN_STRONG_INLINE
size_t rank(
double threshold = 0)
const
917 Eigen::ColPivHouseholderQR<PlainObject> QR = this->colPivHouseholderQr();
918 if (threshold > 0) QR.setThreshold(threshold);
931 if (
size() == 0)
return;
934 Scalar minMaxDelta = curMax - curMin;
935 if (minMaxDelta == 0) minMaxDelta = 1;
936 const Scalar minMaxDelta_ = (valMax - valMin) / minMaxDelta;
937 this->array() = (this->array() - curMin) * minMaxDelta_ + valMin;
948 template <
class OtherDerived>
951 size_t startingCol = 0)
const
953 v = derived().block(nRow, startingCol, 1, cols() - startingCol);
956 template <
typename T>
958 size_t nRow, std::vector<T>&
v,
size_t startingCol = 0)
const
960 const size_t N = cols() - startingCol;
962 for (
size_t i = 0; i < N; i++)
v[i] = (*
this)(nRow, startingCol + i);
965 template <
class VECTOR>
967 size_t nRow, VECTOR&
v,
size_t startingCol = 0)
const
969 v = derived().adjoint().block(startingCol, nRow, cols() - startingCol, 1);
973 template <
class VECTOR>
975 size_t nCol, VECTOR&
v,
size_t startingRow = 0)
const
977 v = derived().block(startingRow, nCol, rows() - startingRow, 1);
980 template <
typename T>
982 size_t nCol, std::vector<T>&
v,
size_t startingRow = 0)
const
984 const size_t N = rows() - startingRow;
986 for (
size_t i = 0; i < N; i++)
v[i] = (*
this)(startingRow + i, nCol);
989 template <
class MATRIX>
991 const size_t firstRow,
const size_t firstCol, MATRIX& m)
const
993 m = derived().block(firstRow, firstCol, m.rows(), m.cols());
995 template <
class MATRIX>
997 const size_t firstRow,
const size_t firstCol,
const size_t nRows,
998 const size_t nCols, MATRIX& m)
const
1000 m.resize(nRows, nCols);
1001 m = derived().block(firstRow, firstCol, nRows, nCols);
1006 template <
class MATRIX>
1008 const size_t row_first,
const size_t row_last,
const size_t col_first,
1009 const size_t col_last, MATRIX& out)
const
1011 out.resize(row_last - row_first + 1, col_last - col_first + 1);
1012 out = derived().block(
1013 row_first, col_first, row_last - row_first + 1,
1014 col_last - col_first + 1);
1025 template <
class MATRIX>
1027 const size_t block_size,
const std::vector<size_t>& block_indices,
1031 throw std::runtime_error(
1032 "extractSubmatrixSymmetricalBlocks: block_size must be >=1");
1033 if (cols() != rows())
1034 throw std::runtime_error(
1035 "extractSubmatrixSymmetricalBlocks: Matrix is not square.");
1037 const size_t N = block_indices.size();
1038 const size_t nrows_out = N * block_size;
1039 out.resize(nrows_out, nrows_out);
1041 for (
size_t dst_row_blk = 0; dst_row_blk < N; ++dst_row_blk)
1043 for (
size_t dst_col_blk = 0; dst_col_blk < N; ++dst_col_blk)
1046 if (block_indices[dst_col_blk] * block_size + block_size - 1 >=
1048 throw std::runtime_error(
1049 "extractSubmatrixSymmetricalBlocks: Indices out of range!");
1052 dst_row_blk * block_size, dst_col_blk * block_size, block_size,
1055 block_indices[dst_row_blk] * block_size,
1056 block_indices[dst_col_blk] * block_size, block_size,
1068 template <
class MATRIX>
1070 const std::vector<size_t>&
indices, MATRIX& out)
const
1072 if (cols() != rows())
1073 throw std::runtime_error(
1074 "extractSubmatrixSymmetrical: Matrix is not square.");
1076 const size_t N =
indices.size();
1077 const size_t nrows_out = N;
1078 out.resize(nrows_out, nrows_out);
1080 for (
size_t dst_row_blk = 0; dst_row_blk < N; ++dst_row_blk)
1081 for (
size_t dst_col_blk = 0; dst_col_blk < N; ++dst_col_blk)
1082 out.coeffRef(dst_row_blk, dst_col_blk) =
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
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)
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 iterator begin()
EIGEN_STRONG_INLINE Scalar minimum() const
[VECTORS OR MATRICES] Finds the minimum value
const Scalar * const_iterator
EIGEN_STRONG_INLINE void eigenVectorsSymmetricVec(MATRIX1 &eVecs, VECTOR1 &eVals) const
[For symmetric matrices only] Compute the eigenvectors and eigenvalues (in no particular order),...
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.
EIGEN_STRONG_INLINE void multiply_AtB(const MATRIX1 &A, const MATRIX2 &B)
EIGEN_STRONG_INLINE Scalar norm_inf() const
Compute the norm-infinite of a vector ($f[ ||\mathbf{v}||_\infnty $f]), ie the maximum absolute value...
EIGEN_STRONG_INLINE void multiply_AAt(const MAT_A &A)
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
EIGEN_STRONG_INLINE void insertMatrixTranspose(size_t r, size_t c, const MAT &m)
void adjustRange(Scalar valMin, Scalar valMax)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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 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...
void multiply_A_skew3(const MAT_A &A, const SKEW_3VECTOR &v)
EIGEN_STRONG_INLINE void multiply_Ab(const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput=false) 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...
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 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 size_t countNonZero() const
EIGEN_STRONG_INLINE void swapCols(size_t i1, size_t i2)
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 multiply(const MATRIX1 &A, const MATRIX2 &B)
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,...
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 bool eigenVectors(MATRIX1 &eVecs, MATRIX2 &eVals) const
[For square matrices only] Compute the eigenvectors and eigenvalues (sorted), both returned as matric...
T square(const T x)
Inline function for the square of a number.
EIGEN_STRONG_INLINE void add_AAt(const OTHERMATRIX &A)
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 insertCol(size_t nCol, const MAT &aCol)
@ MATRIX_FORMAT_ENG
engineering format 'e'
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 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)
const EIGEN_STRONG_INLINE AdjointReturnType t() const
Transpose.
EIGEN_STRONG_INLINE void removeColumns(const std::vector< size_t > &idxsToRemove)
Remove columns of the matrix.
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 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...
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 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 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)
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).
void multiply_AtBC(const MAT_A &A, const MAT_B &B, const MAT_C &C)
EIGEN_STRONG_INLINE bool eigenVectorsVec(MATRIX1 &eVecs, VECTOR1 &eVals) const
[For square matrices only] Compute the eigenvectors and eigenvalues (sorted), eigenvectors are the co...
GLdouble GLdouble GLdouble r
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
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...
GLsizei GLsizei GLenum GLenum const GLvoid * data
void normalize(Scalar valMin, Scalar valMax)
Scales all elements such as the minimum & maximum values are shifted to the given values.
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,...
EIGEN_STRONG_INLINE void multiply_AtA(const MAT_A &A)
EIGEN_STRONG_INLINE Scalar sumAll() const
EIGEN_STRONG_INLINE void laplacian(Eigen::MatrixBase< OtherDerived > &ret) const
Computes the laplacian of this square graph weight matrix.
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 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 multiply_Atb(const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput=false) 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 void zeros()
Set all elements to zero.
EIGEN_STRONG_INLINE void multiply_result_is_symmetric(const MAT_A &A, const MAT_B &B)
EIGEN_STRONG_INLINE void inv_fast(MATRIX &outMat) 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 multiplyRowByScalar(size_t r, Scalar s)
EIGEN_STRONG_INLINE void multiply_AAt_scalar(const MAT_A &A, typename MAT_A::Scalar f)
EIGEN_STRONG_INLINE void unsafeRemoveRows(const std::vector< size_t > &idxs)
Remove rows of the matrix.
EIGEN_STRONG_INLINE void eye()
Make the matrix an identity matrix
EIGEN_STRONG_INLINE void assign(const Scalar v)
EIGEN_STRONG_INLINE void multiply_AB(const MATRIX1 &A, const MATRIX2 &B)
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 unsafeRemoveColumns(const std::vector< size_t > &idxs)
Remove columns of the matrix.
Internal resize which compiles to nothing on fixed-size matrices.
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 multiplyColumnByScalar(size_t c, Scalar s)
GLenum GLenum GLvoid * row
EIGEN_STRONG_INLINE iterator end()
EIGEN_STRONG_INLINE Scalar maximum() const
[VECTORS OR MATRICES] Finds the maximum value
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
EIGEN_STRONG_INLINE void insertRow(size_t nRow, const MAT &aRow)
EIGEN_STRONG_INLINE PlainObject inv() const
EIGEN_STRONG_INLINE void multiply_ABt(const MAT_A &A, const MAT_B &B)
void loadFromTextFile(const std::string &file)
Load matrix from a text file, compatible with MATLAB text format.
EIGEN_STRONG_INLINE bool empty() const
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!)
GLsizei const GLchar ** string
EIGEN_STRONG_INLINE Scalar det() const
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 fill(const Scalar v)
EIGEN_STRONG_INLINE bool isDiagonal() const
Checks for matrix type.
EIGEN_STRONG_INLINE void extractMatrix(const size_t firstRow, const size_t firstCol, MATRIX &m) const
EIGEN_STRONG_INLINE void removeRows(const std::vector< size_t > &idxsToRemove)
Remove rows of the matrix.
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...
GLuint GLuint GLsizei GLenum const GLvoid * indices
EIGEN_STRONG_INLINE bool isSquare() const
EIGEN_STRONG_INLINE Scalar maximumDiagonal() const
Finds the maximum value in the diagonal of the matrix.
EIGEN_STRONG_INLINE void add_Ac(const OTHERMATRIX &m, const Scalar c)
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)
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |