code
stringlengths
2.5k
150k
kind
stringclasses
1 value
eigen3 Eigen::JacobiRotation Eigen::JacobiRotation ===================== ### template<typename Scalar> class Eigen::JacobiRotation< Scalar > Rotation given by a cosine-sine pair. This is defined in the Jacobi module. ``` #include <Eigen/Jacobi> ``` This class represents a Jacobi or Givens rotation. This is a 2D rotation in the plane `J` of angle \( \theta \) defined by its cosine `c` and sine `s` as follow: \( J = \left ( \begin{array}{cc} c & \overline s \\ -s & \overline c \end{array} \right ) \) You can apply the respective counter-clockwise rotation to a column vector `v` by applying its adjoint on the left: \( v = J^\* v \) that translates to the following [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") code: ``` v.applyOnTheLeft(J.adjoint()); ``` See also [MatrixBase::applyOnTheLeft()](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765), [MatrixBase::applyOnTheRight()](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) | | | --- | | | | [JacobiRotation](classeigen_1_1jacobirotation) | [adjoint](classeigen_1_1jacobirotation#a89c8ea615f8fa77ddd5810a1e5fde4da) () const | | | | | [JacobiRotation](classeigen_1_1jacobirotation#a38fec2c4da529ef3d05ff37b848b4227) () | | | | | [JacobiRotation](classeigen_1_1jacobirotation#a3e8b5dc0a56f7a2d0f788b1ccb1547cb) (const Scalar &c, const Scalar &s) | | | | void | [makeGivens](classeigen_1_1jacobirotation#adb5bcb0d28a95e39ca31c2c17e866092) (const Scalar &p, const Scalar &q, Scalar \*r=0) | | | | template<typename Derived > | | bool | [makeJacobi](classeigen_1_1jacobirotation#a69076401f22e883dc76b6ff9074ac669) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) p, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) q) | | | | bool | [makeJacobi](classeigen_1_1jacobirotation#a6572f272cac38e070a99b466dd1fbc74) (const RealScalar &x, const Scalar &y, const RealScalar &z) | | | | [JacobiRotation](classeigen_1_1jacobirotation) | [operator\*](classeigen_1_1jacobirotation#ada8389f291839964d7b481464f0e4e94) (const [JacobiRotation](classeigen_1_1jacobirotation) &other) | | | | [JacobiRotation](classeigen_1_1jacobirotation) | [transpose](classeigen_1_1jacobirotation#ab40e9cdc4582593511e57ee896e055a2) () const | | | JacobiRotation() [1/2] ---------------------- template<typename Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::[JacobiRotation](classeigen_1_1jacobirotation) | ( | | ) | | | inline | Default constructor without any initialization. JacobiRotation() [2/2] ---------------------- template<typename Scalar > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::[JacobiRotation](classeigen_1_1jacobirotation) | ( | const Scalar & | *c*, | | | | const Scalar & | *s* | | | ) | | | | inline | Construct a planar rotation from a cosine-sine pair (*c*, `s`). adjoint() --------- template<typename Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [JacobiRotation](classeigen_1_1jacobirotation) [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::adjoint | ( | | ) | const | | inline | Returns the adjoint transformation makeGivens() ------------ template<typename Scalar > | | | | | | --- | --- | --- | --- | | void [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::makeGivens | ( | const Scalar & | *p*, | | | | const Scalar & | *q*, | | | | Scalar \* | *r* = `0` | | | ) | | | Makes `*this` as a Givens rotation `G` such that applying \( G^\* \) to the left of the vector \( V = \left ( \begin{array}{c} p \\ q \end{array} \right )\) yields: \( G^\* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )\). The value of *r* is returned if *r* is not null (the default is null). Also note that G is built such that the cosine is always real. Example: ``` Vector2f v = [Vector2f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); JacobiRotation<float> G; G.makeGivens(v.x(), v.y()); cout << "Here is the vector v:" << endl << v << endl; v.applyOnTheLeft(0, 1, G.adjoint()); cout << "Here is the vector J' \* v:" << endl << v << endl; ``` Output: ``` Here is the vector v: 0.68 -0.211 Here is the vector J' * v: 0.712 0 ``` This function implements the continuous Givens rotation generation algorithm found in Anderson (2000), Discontinuous Plane Rotations and the Symmetric Eigenvalue Problem. LAPACK Working Note 150, University of Tennessee, UT-CS-00-454, December 4, 2000. See also [MatrixBase::applyOnTheLeft()](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765), [MatrixBase::applyOnTheRight()](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) makeJacobi() [1/2] ------------------ template<typename Scalar > template<typename Derived > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::makeJacobi | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *m*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *p*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *q* | | | ) | | | | inline | Makes `*this` as a Jacobi rotation `J` such that applying *J* on both the right and left sides of the 2x2 selfadjoint matrix \( B = \left ( \begin{array}{cc} \text{this}\_{pp} & \text{this}\_{pq} \\ (\text{this}\_{pq})^\* & \text{this}\_{qq} \end{array} \right )\) yields a diagonal matrix \( A = J^\* B J \) Example: ``` Matrix2f m = [Matrix2f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); m = (m + m.adjoint()).eval(); JacobiRotation<float> J; J.makeJacobi(m, 0, 1); cout << "Here is the matrix m:" << endl << m << endl; m.applyOnTheLeft(0, 1, J.adjoint()); m.applyOnTheRight(0, 1, J); cout << "Here is the matrix J' \* m \* J:" << endl << m << endl; ``` Output: ``` Here is the matrix m: 1.36 0.355 0.355 1.19 Here is the matrix J' * m * J: 1.64 0 0 0.913 ``` See also JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), [MatrixBase::applyOnTheLeft()](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765), [MatrixBase::applyOnTheRight()](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) makeJacobi() [2/2] ------------------ template<typename Scalar > | | | | | | --- | --- | --- | --- | | bool [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::makeJacobi | ( | const RealScalar & | *x*, | | | | const Scalar & | *y*, | | | | const RealScalar & | *z* | | | ) | | | Makes `*this` as a Jacobi rotation *J* such that applying *J* on both the right and left sides of the selfadjoint 2x2 matrix \( B = \left ( \begin{array}{cc} x & y \\ \overline y & z \end{array} \right )\) yields a diagonal matrix \( A = J^\* B J \) See also MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), [MatrixBase::applyOnTheLeft()](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765), [MatrixBase::applyOnTheRight()](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) operator\*() ------------ template<typename Scalar > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [JacobiRotation](classeigen_1_1jacobirotation) [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::operator\* | ( | const [JacobiRotation](classeigen_1_1jacobirotation)< Scalar > & | *other* | ) | | | inline | Concatenates two planar rotation transpose() ----------- template<typename Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [JacobiRotation](classeigen_1_1jacobirotation) [Eigen::JacobiRotation](classeigen_1_1jacobirotation)< Scalar >::transpose | ( | | ) | const | | inline | Returns the transposed transformation --- The documentation for this class was generated from the following file:* [Jacobi.h](https://eigen.tuxfamily.org/dox/Jacobi_8h_source.html) eigen3 Sparse meta-module Sparse meta-module ================== Meta-module including all related modules: * [SparseCore module](group__sparsecore__module) * [OrderingMethods module](group__orderingmethods__module) * [SparseCholesky module](group__sparsecholesky__module) * [SparseLU module](group__sparselu__module) * [SparseQR module](group__sparseqr__module) * [IterativeLinearSolvers module](group__iterativelinearsolvers__module) ``` #include <Eigen/Sparse> ``` eigen3 Storage orders Storage orders ============== There are two different storage orders for matrices and two-dimensional arrays: column-major and row-major. This page explains these storage orders and how to specify which one should be used. Column-major and row-major storage ==================================== The entries of a matrix form a two-dimensional grid. However, when the matrix is stored in memory, the entries have to somehow be laid out linearly. There are two main ways to do this, by row and by column. We say that a matrix is stored in **row-major** order if it is stored row by row. The entire first row is stored first, followed by the entire second row, and so on. Consider for example the matrix \[ A = \begin{bmatrix} 8 & 2 & 2 & 9 \\ 9 & 1 & 4 & 4 \\ 3 & 5 & 4 & 5 \end{bmatrix}. \] If this matrix is stored in row-major order, then the entries are laid out in memory as follows: ``` 8 2 2 9 9 1 4 4 3 5 4 5 ``` On the other hand, a matrix is stored in **column-major** order if it is stored column by column, starting with the entire first column, followed by the entire second column, and so on. If the above matrix is stored in column-major order, it is laid out as follows: ``` 8 9 3 2 1 5 2 4 4 9 4 5 ``` This example is illustrated by the following [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") code. It uses the [PlainObjectBase::data()](classeigen_1_1plainobjectbase#ad12a492bcadea9b65ccd9bc8404c01f1) function, which returns a pointer to the memory location of the first entry of the matrix. | Example | Output | | --- | --- | | ``` Matrix<int, 3, 4, ColMajor> Acolmajor; Acolmajor << 8, 2, 2, 9, 9, 1, 4, 4, 3, 5, 4, 5; cout << "The matrix A:" << endl; cout << Acolmajor << endl << endl; cout << "In memory (column-major):" << endl; for (int i = 0; i < Acolmajor.size(); i++) cout << *(Acolmajor.data() + i) << " "; cout << endl << endl; Matrix<int, 3, 4, RowMajor> Arowmajor = Acolmajor; cout << "In memory (row-major):" << endl; for (int i = 0; i < Arowmajor.size(); i++) cout << *(Arowmajor.data() + i) << " "; cout << endl; ``` | ``` The matrix A: 8 2 2 9 9 1 4 4 3 5 4 5 In memory (column-major): 8 9 3 2 1 5 2 4 4 9 4 5 In memory (row-major): 8 2 2 9 9 1 4 4 3 5 4 5 ``` | Storage orders in Eigen ========================= The storage order of a matrix or a two-dimensional array can be set by specifying the `Options` template parameter for [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."). As [The Matrix class](group__tutorialmatrixclass) explains, the Matrix class template has six template parameters, of which three are compulsory (`Scalar`, `RowsAtCompileTime` and `ColsAtCompileTime`) and three are optional (`Options`, `MaxRowsAtCompileTime` and `MaxColsAtCompileTime`). If the `Options` parameter is set to `RowMajor`, then the matrix or array is stored in row-major order; if it is set to `ColMajor`, then it is stored in column-major order. This mechanism is used in the above [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") program to specify the storage order. If the storage order is not specified, then [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") defaults to storing the entry in column-major. This is also the case if one of the convenience typedefs (`Matrix3f`, `ArrayXXd`, etc.) is used. Matrices and arrays using one storage order can be assigned to matrices and arrays using the other storage order, as happens in the above program when `Arowmajor` is initialized using `Acolmajor`. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") will reorder the entries automatically. More generally, row-major and column-major matrices can be mixed in an expression as we want. Which storage order to choose? ================================ So, which storage order should you use in your program? There is no simple answer to this question; it depends on your application. Here are some points to keep in mind: * Your users may expect you to use a specific storage order. Alternatively, you may use other libraries than [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), and these other libraries may expect a certain storage order. In these cases it may be easiest and fastest to use this storage order in your whole program. * Algorithms that traverse a matrix row by row will go faster when the matrix is stored in row-major order because of better data locality. Similarly, column-by-column traversal is faster for column-major matrices. It may be worthwhile to experiment a bit to find out what is faster for your particular application. * The default in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") is column-major. Naturally, most of the development and testing of the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") library is thus done with column-major matrices. This means that, even though we aim to support column-major and row-major storage orders transparently, the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") library may well work best with column-major matrices. eigen3 Eigen::DiagonalMatrix Eigen::DiagonalMatrix ===================== ### template<typename \_Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime> class Eigen::DiagonalMatrix< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime > Represents a diagonal matrix with its storage. Parameters | | | | --- | --- | | \_Scalar | the type of coefficients | | SizeAtCompileTime | the dimension of the matrix, or Dynamic | | MaxSizeAtCompileTime | the dimension of the matrix, or Dynamic. This parameter is optional and defaults to SizeAtCompileTime. Most of the time, you do not need to specify it. | See also class [DiagonalWrapper](classeigen_1_1diagonalwrapper "Expression of a diagonal matrix.") Inherits DiagonalBase< DiagonalMatrix< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime > >. | | | --- | | | | DiagonalVectorType & | [diagonal](classeigen_1_1diagonalmatrix#a49c751bd59187979e1406b18e3b16049) () | | | | const DiagonalVectorType & | [diagonal](classeigen_1_1diagonalmatrix#a71b770614009e5af4b63d5f8005af2a5) () const | | | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#a07deda6348ef81a6a07577c40e5a8687) () | | | | template<typename OtherDerived > | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#a41b3d77b1ce65062a9ab53073083bac8) (const DiagonalBase< OtherDerived > &other) | | | | template<typename OtherDerived > | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#a09701a17fa9ead2145174b4f4db6ab67) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | template<typename... ArgTypes> | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#a7733cedccd7422367a5face3a80cf825) (const Scalar &a0, const Scalar &a1, const Scalar &a2, const ArgTypes &... args) | | | Construct a diagonal matrix with fixed size from an arbitrary number of coefficients. [c++11] [More...](classeigen_1_1diagonalmatrix#a7733cedccd7422367a5face3a80cf825) | | | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#a8d674e5eaa4c378d5a3f96a9007ca349) (const Scalar &x, const Scalar &y) | | | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#a09d6cb930dff5e147ce22e08f2bb74b5) (const Scalar &x, const Scalar &y, const Scalar &z) | | | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#ac02390a9988bc1e7e54e133ba68bacee) (const std::initializer\_list< std::initializer\_list< Scalar >> &list) | | | Constructs a [DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage.") and initializes it by elements given by an initializer list of initializer lists [c++11] | | | | | [DiagonalMatrix](classeigen_1_1diagonalmatrix#ab069e106761d66fe1c2c494e7daf2244) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) dim) | | | | template<typename OtherDerived > | | [DiagonalMatrix](classeigen_1_1diagonalmatrix) & | [operator=](classeigen_1_1diagonalmatrix#a5d362adc0550baabcff2095c92c5045d) (const DiagonalBase< OtherDerived > &other) | | | | void | [resize](classeigen_1_1diagonalmatrix#af04e2fd5733eda42f0d82bb6b7405b42) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | | void | [setIdentity](classeigen_1_1diagonalmatrix#a58fabb4849fa44233c21f088ac33aa06) () | | | | void | [setIdentity](classeigen_1_1diagonalmatrix#a0b2d7eb480c889693fb31fbdb02d9c09) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | | void | [setZero](classeigen_1_1diagonalmatrix#ad4d81f0bf2bdb022d1910a89a6f8c819) () | | | | void | [setZero](classeigen_1_1diagonalmatrix#a293457cb23a0a2c95c44a1c6101ef218) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | DiagonalMatrix() [1/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | | ) | | | inline | Default constructor without initialization DiagonalMatrix() [2/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *dim* | ) | | | inlineexplicit | Constructs a diagonal matrix with given dimension DiagonalMatrix() [3/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | const Scalar & | *x*, | | | | const Scalar & | *y* | | | ) | | | | inline | 2D constructor. DiagonalMatrix() [4/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | const Scalar & | *x*, | | | | const Scalar & | *y*, | | | | const Scalar & | *z* | | | ) | | | | inline | 3D constructor. DiagonalMatrix() [5/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> template<typename... ArgTypes> | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | const Scalar & | *a0*, | | | | const Scalar & | *a1*, | | | | const Scalar & | *a2*, | | | | const ArgTypes &... | *args* | | | ) | | | | inline | Construct a diagonal matrix with fixed size from an arbitrary number of coefficients. [c++11] There exists C++98 anologue constructors for fixed-size diagonal matrices having 2 or 3 coefficients. Warning To construct a diagonal matrix of fixed size, the number of values passed to this constructor must match the fixed dimension of `*this`. See also [DiagonalMatrix(const Scalar&, const Scalar&)](classeigen_1_1diagonalmatrix#a8d674e5eaa4c378d5a3f96a9007ca349) [DiagonalMatrix(const Scalar&, const Scalar&, const Scalar&)](classeigen_1_1diagonalmatrix#a09d6cb930dff5e147ce22e08f2bb74b5) DiagonalMatrix() [6/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | const DiagonalBase< OtherDerived > & | *other* | ) | | | inline | Copy constructor. DiagonalMatrix() [7/7] ---------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::[DiagonalMatrix](classeigen_1_1diagonalmatrix) | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | | inlineexplicit | generic constructor from expression of the diagonal coefficients diagonal() [1/2] ---------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | DiagonalVectorType& [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::diagonal | ( | | ) | | | inline | Returns a reference to the stored vector of diagonal coefficients. diagonal() [2/2] ---------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const DiagonalVectorType& [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::diagonal | ( | | ) | const | | inline | const version of [diagonal()](classeigen_1_1diagonalmatrix#a49c751bd59187979e1406b18e3b16049). operator=() ----------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [DiagonalMatrix](classeigen_1_1diagonalmatrix)& [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::operator= | ( | const DiagonalBase< OtherDerived > & | *other* | ) | | | inline | Copy operator. resize() -------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::resize | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *size* | ) | | | inline | Resizes to given size. setIdentity() [1/2] ------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity | ( | | ) | | | inline | Sets this matrix to be the identity matrix of the current size. setIdentity() [2/2] ------------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::setIdentity | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *size* | ) | | | inline | Sets this matrix to be the identity matrix of the given size. setZero() [1/2] --------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::setZero | ( | | ) | | | inline | Sets all coefficients to zero. setZero() [2/2] --------------- template<typename \_Scalar , int SizeAtCompileTime, int MaxSizeAtCompileTime> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DiagonalMatrix](classeigen_1_1diagonalmatrix)< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >::setZero | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *size* | ) | | | inline | Resizes and sets all coefficients to zero. --- The documentation for this class was generated from the following file:* [DiagonalMatrix.h](https://eigen.tuxfamily.org/dox/DiagonalMatrix_8h_source.html)
programming_docs
eigen3 Eigen::ConjugateGradient Eigen::ConjugateGradient ======================== ### template<typename \_MatrixType, int \_UpLo, typename \_Preconditioner> class Eigen::ConjugateGradient< \_MatrixType, \_UpLo, \_Preconditioner > A conjugate gradient solver for sparse (or dense) self-adjoint problems. This class allows to solve for A.x = b linear problems using an iterative conjugate gradient algorithm. The matrix A must be selfadjoint. The matrix A and the vectors x and b can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix A, can be a dense or a sparse matrix. | | \_UpLo | the triangular part that will be used for the computations. It can be Lower, `Upper`, or `Lower|Upper` in which the full matrix entries will be considered. Default is `Lower`, best performance is `Lower|Upper`. | | \_Preconditioner | the type of the preconditioner. Default is [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.") | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . The maximal number of iterations and tolerance value can be controlled via the [setMaxIterations()](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) and [setTolerance()](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance. The tolerance corresponds to the relative residual error: |Ax-b|/|b| **Performance:** Even though the default value of `_UpLo` is `Lower`, significantly higher performance is achieved when using a complete matrix and **Lower|Upper** as the *\_UpLo* template parameter. Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled. See [Eigen and multi-threading](topicmultithreading) for details. This class can be used as the direct solver classes. Here is a typical usage example: ``` int n = 10000; VectorXd x(n), b(n); SparseMatrix<double> A(n,n); // fill A and b ConjugateGradient<SparseMatrix<double>, [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)|[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)> cg; cg.compute(A); x = cg.solve(b); std::cout << "#iterations: " << cg.iterations() << std::endl; std::cout << "estimated error: " << cg.error() << std::endl; // update b, and solve again x = cg.solve(b); ``` By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the [solveWithGuess()](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) method. [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems.") can also be used in a matrix-free context, see the following [example](group__matrixfreesolverexample) . See also class [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems."), class [SimplicialCholesky](classeigen_1_1simplicialcholesky), [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries."), [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix.") | | | --- | | | | | [ConjugateGradient](classeigen_1_1conjugategradient#a92a9656ca9fa4da240194f89229255eb) () | | | | template<typename MatrixDerived > | | | [ConjugateGradient](classeigen_1_1conjugategradient#ac10f778fcd137eca1f6057c8ddd3d644) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | Public Member Functions inherited from [Eigen::IterativeSolverBase< ConjugateGradient< \_MatrixType, \_UpLo, \_Preconditioner > >](classeigen_1_1iterativesolverbase) | | [ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner > & | [analyzePattern](classeigen_1_1iterativesolverbase#a3f684fb41019ca04d97ddc08a0d8be2e) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner > & | [compute](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | RealScalar | [error](classeigen_1_1iterativesolverbase#a117c241af3fb1141ad0916a3cf3157ec) () const | | | | [ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner > & | [factorize](classeigen_1_1iterativesolverbase#a1374b141721629983cd8276b4b87fc58) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1iterativesolverbase#a0d6b459433a316b4f12d48e5c80d61fe) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [iterations](classeigen_1_1iterativesolverbase#ae778dd098bd5e6655625b20b1e9f15da) () const | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a0922f2be45082690d7734aa6732fc493) () | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a3c68fe3cd929ea1ff8a0d4cbcd65ebad) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [maxIterations](classeigen_1_1iterativesolverbase#a168a74c8dceb6233b220031fdd756ba0) () const | | | | Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a5e88f2a323a2900205cf807af94f8051) () | | | | const Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a709a056e17c49b5272e4971bc376cbe4) () const | | | | [ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner > & | [setMaxIterations](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) maxIters) | | | | [ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner > & | [setTolerance](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) (const RealScalar &[tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62)) | | | | const [SolveWithGuess](classeigen_1_1solvewithguess)< [ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner >, Rhs, Guess > | [solveWithGuess](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b, const Guess &x0) const | | | | RealScalar | [tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62) () const | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | ConjugateGradient() [1/2] ------------------------- template<typename \_MatrixType , int \_UpLo, typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner >::[ConjugateGradient](classeigen_1_1conjugategradient) | ( | | ) | | | inline | Default constructor. ConjugateGradient() [2/2] ------------------------- template<typename \_MatrixType , int \_UpLo, typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::ConjugateGradient](classeigen_1_1conjugategradient)< \_MatrixType, \_UpLo, \_Preconditioner >::[ConjugateGradient](classeigen_1_1conjugategradient) | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. --- The documentation for this class was generated from the following file:* [ConjugateGradient.h](https://eigen.tuxfamily.org/dox/ConjugateGradient_8h_source.html) eigen3 What happens inside Eigen, on a simple example What happens inside Eigen, on a simple example ============================================== --- Consider the following example program: ``` #include<Eigen/Core> int main() { int size = 50; // VectorXf is a vector of floats, with dynamic size. [Eigen::VectorXf](classeigen_1_1matrix) u(size), v(size), w(size); u = v + w; } ``` The goal of this page is to understand how [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") compiles it, assuming that SSE2 vectorization is enabled (GCC option -msse2). Why it's interesting ====================== Maybe you think, that the above example program is so simple, that compiling it shouldn't involve anything interesting. So before starting, let us explain what is nontrivial in compiling it correctly – that is, producing optimized code – so that the complexity of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), that we'll explain here, is really useful. Look at the line of code ``` u = v + w; // (\*) ``` The first important thing about compiling it, is that the arrays should be traversed only once, like ``` for(int i = 0; i < size; i++) u[i] = v[i] + w[i]; ``` The problem is that if we make a naive C++ library where the VectorXf class has an operator+ returning a VectorXf, then the line of code (\*) will amount to: ``` VectorXf tmp = v + w; VectorXf u = tmp; ``` Obviously, the introduction of the temporary *tmp* here is useless. It has a very bad effect on performance, first because the creation of *tmp* requires a dynamic memory allocation in this context, and second as there are now two for loops: ``` for(int i = 0; i < size; i++) tmp[i] = v[i] + w[i]; for(int i = 0; i < size; i++) u[i] = tmp[i]; ``` Traversing the arrays twice instead of once is terrible for performance, as it means that we do many redundant memory accesses. The second important thing about compiling the above program, is to make correct use of SSE2 instructions. Notice that [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") also supports AltiVec and that all the discussion that we make here applies also to AltiVec. SSE2, like AltiVec, is a set of instructions allowing to perform computations on packets of 128 bits at once. Since a float is 32 bits, this means that SSE2 instructions can handle 4 floats at once. This means that, if correctly used, they can make our computation go up to 4x faster. However, in the above program, we have chosen size=50, so our vectors consist of 50 float's, and 50 is not a multiple of 4. This means that we cannot hope to do all of that computation using SSE2 instructions. The second best thing, to which we should aim, is to handle the 48 first coefficients with SSE2 instructions, since 48 is the biggest multiple of 4 below 50, and then handle separately, without SSE2, the 49th and 50th coefficients. Something like this: ``` for(int i = 0; i < 4*(size/4); i+=4) u.packet(i) = v.packet(i) + w.packet(i); for(int i = 4*(size/4); i < size; i++) u[i] = v[i] + w[i]; ``` So let us look line by line at our example program, and let's follow [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") as it compiles it. Constructing vectors ====================== Let's analyze the first line: ``` [Eigen::VectorXf](classeigen_1_1matrix) u(size), v(size), w(size); ``` First of all, VectorXf is the following typedef: ``` typedef Matrix<float, Dynamic, 1> VectorXf; ``` The class template [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") is declared in src/Core/util/ForwardDeclarations.h with 6 template parameters, but the last 3 are automatically determined by the first 3. So you don't need to worry about them for now. Here, [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")<float, Dynamic, 1> means a matrix of floats, with a dynamic number of rows and 1 column. The [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class inherits a base class, [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). Don't worry about it, for now it suffices to say that [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") is what unifies matrices/vectors and all the expressions types – more on that below. When we do ``` [Eigen::VectorXf](classeigen_1_1matrix) u(size); ``` the constructor that is called is Matrix::Matrix(int), in [src/Core/Matrix.h](https://eigen.tuxfamily.org/dox/Matrix_8h_source.html). Besides some assertions, all it does is to construct the *m\_storage* member, which is of type DenseStorage<float, Dynamic, Dynamic, 1>. You may wonder, isn't it overengineering to have the storage in a separate class? The reason is that the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template covers all kinds of matrices and vector: both fixed-size and dynamic-size. The storage method is not the same in these two cases. For fixed-size, the matrix coefficients are stored as a plain member array. For dynamic-size, the coefficients will be stored as a pointer to a dynamically-allocated array. Because of this, we need to abstract storage away from the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class. That's DenseStorage. Let's look at this constructor, in [src/Core/DenseStorage.h](https://eigen.tuxfamily.org/dox/DenseStorage_8h_source.html). You can see that there are many partial template specializations of DenseStorages here, treating separately the cases where dimensions are Dynamic or fixed at compile-time. The partial specialization that we are looking at is: ``` template<typename T, int _Cols> class DenseStorage<T, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), _Cols> ``` Here, the constructor called is DenseStorage::DenseStorage(int size, int rows, int columns) with size=50, rows=50, columns=1. Here is this constructor: ``` inline DenseStorage(int size, int rows, int) : m_data(internal::aligned_new<T>(size)), m_rows(rows) {} ``` Here, the *m\_data* member is the actual array of coefficients of the matrix. As you see, it is dynamically allocated. Rather than calling new[] or malloc(), as you can see, we have our own internal::aligned\_new defined in [src/Core/util/Memory.h](https://eigen.tuxfamily.org/dox/Memory_8h_source.html). What it does is that if vectorization is enabled, then it uses a platform-specific call to allocate a 128-bit-aligned array, as that is very useful for vectorization with both SSE2 and AltiVec. If vectorization is disabled, it amounts to the standard new[]. As you can see, the constructor also sets the *m\_rows* member to *size*. Notice that there is no *m\_columns* member: indeed, in this partial specialization of DenseStorage, we know the number of columns at compile-time, since the \_Cols template parameter is different from Dynamic. Namely, in our case, \_Cols is 1, which is to say that our vector is just a matrix with 1 column. Hence, there is no need to store the number of columns as a runtime variable. When you call [VectorXf::data()](classeigen_1_1plainobjectbase#ad12a492bcadea9b65ccd9bc8404c01f1) to get the pointer to the array of coefficients, it returns DenseStorage::data() which returns the *m\_data* member. When you call [VectorXf::size()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) to get the size of the vector, this is actually a method in the base class [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). It determines that the vector is a column-vector, since ColsAtCompileTime==1 (this comes from the template parameters in the typedef VectorXf). It deduces that the size is the number of rows, so it returns [VectorXf::rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), which returns DenseStorage::rows(), which returns the *m\_rows* member, which was set to *size* by the constructor. Construction of the sum expression ==================================== Now that our vectors are constructed, let's move on to the next line: ``` u = v + w; ``` The executive summary is that operator+ returns a "sum of vectors" expression, but doesn't actually perform the computation. It is the operator=, whose call occurs thereafter, that does the computation. Let us now see what [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") does when it sees this: ``` v + w ``` Here, v and w are of type VectorXf, which is a typedef for a specialization of [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") (as we explained above), which is a subclass of [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). So what is being called is ``` MatrixBase::operator+(const MatrixBase&) ``` The return type of this operator is ``` CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> ``` The [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") class is our first encounter with an expression template. As we said, the operator+ doesn't by itself perform any computation, it just returns an abstract "sum of vectors" expression. Since there are also "difference of vectors" and "coefficient-wise product of vectors" expressions, we unify them all as "coefficient-wise binary operations", which we abbreviate as "CwiseBinaryOp". "Coefficient-wise" means that the operations is performed coefficient by coefficient. "binary" means that there are two operands – we are adding two vectors with one another. Now you might ask, what if we did something like ``` v + w + u; ``` The first v + w would return a [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") as above, so in order for this to compile, we'd need to define an operator+ also in the class [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.")... at this point it starts looking like a nightmare: are we going to have to define all operators in each of the expression classes (as you guessed, [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") is only one of many) ? This looks like a dead end! The solution is that [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") itself, as well as [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and all the other expression types, is a subclass of [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). So it is enough to define once and for all the operators in class [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). Since [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") is the common base class of different subclasses, the aspects that depend on the subclass must be abstracted from [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). This is called polymorphism. The classical approach to polymorphism in C++ is by means of virtual functions. This is dynamic polymorphism. Here we don't want dynamic polymorphism because the whole design of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") is based around the assumption that all the complexity, all the abstraction, gets resolved at compile-time. This is crucial: if the abstraction can't get resolved at compile-time, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s compile-time optimization mechanisms become useless, not to mention that if that abstraction has to be resolved at runtime it'll incur an overhead by itself. Here, what we want is to have a single class [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") as the base of many subclasses, in such a way that each [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") object (be it a matrix, or vector, or any kind of expression) knows at compile-time (as opposed to run-time) of which particular subclass it is an object (i.e. whether it is a matrix, or an expression, and what kind of expression). The solution is the [Curiously Recurring Template Pattern](http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern). Let's do the break now. Hopefully you can read this wikipedia page during the break if needed, but it won't be allowed during the exam. In short, [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") takes a template parameter *Derived*. Whenever we define a subclass Subclass, we actually make Subclass inherit [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")<Subclass>. The point is that different subclasses inherit different [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") types. Thanks to this, whenever we have an object of a subclass, and we call on it some [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") method, we still remember even from inside the [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") method which particular subclass we're talking about. This means that we can put almost all the methods and operators in the base class [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."), and have only the bare minimum in the subclasses. If you look at the subclasses in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), like for instance the [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") class, they have very few methods. There are coeff() and sometimes coeffRef() methods for access to the coefficients, there are rows() and cols() methods returning the number of rows and columns, but there isn't much more than that. All the meat is in [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."), so it only needs to be coded once for all kinds of expressions, matrices, and vectors. So let's end this digression and come back to the piece of code from our example program that we were currently analyzing, ``` v + w ``` Now that [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") is a good friend, let's write fully the prototype of the operator+ that gets called here (this code is from [src/Core/MatrixBase.h](https://eigen.tuxfamily.org/dox/MatrixBase_8h_source.html)): ``` template<typename Derived> class MatrixBase { // ... template<typename OtherDerived> const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived> operator+(const MatrixBase<OtherDerived> &other) const; // ... }; ``` Here of course, *Derived* and *OtherDerived* are VectorXf. As we said, [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") is also used for other operations such as substration, so it takes another template parameter determining the operation that will be applied to coefficients. This template parameter is a functor, that is, a class in which we have an operator() so it behaves like a function. Here, the functor used is internal::scalar\_sum\_op. It is defined in src/Core/Functors.h. Let us now explain the internal::traits here. The internal::scalar\_sum\_op class takes one template parameter: the type of the numbers to handle. Here of course we want to pass the scalar type (a.k.a. numeric type) of VectorXf, which is `float`. How do we determine which is the scalar type of *Derived* ? Throughout [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), all matrix and expression types define a typedef *Scalar* which gives its scalar type. For example, VectorXf::Scalar is a typedef for `float`. So here, if life was easy, we could find the numeric type of *Derived* as just ``` typename Derived::Scalar ``` Unfortunately, we can't do that here, as the compiler would complain that the type Derived hasn't yet been defined. So we use a workaround: in src/Core/util/ForwardDeclarations.h, we declared (not defined!) all our subclasses, like [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), and we also declared the following class template: ``` template<typename T> struct internal::traits; ``` In [src/Core/Matrix.h](https://eigen.tuxfamily.org/dox/Matrix_8h_source.html), right *before* the definition of class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), we define a partial specialization of internal::traits for T=[Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")<any template parameters>. In this specialization of internal::traits, we define the Scalar typedef. So when we actually define [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), it is legal to refer to "typename internal::traits\<Matrix\>::Scalar". Anyway, we have declared our operator+. In our case, where *Derived* and *OtherDerived* are VectorXf, the above declaration amounts to: ``` class MatrixBase<VectorXf> { // ... const CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> operator+(const MatrixBase<VectorXf> &other) const; // ... }; ``` Let's now jump to [src/Core/CwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/CwiseBinaryOp_8h_source.html) to see how it is defined. As you can see there, all it does is to return a [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") object, and this object is just storing references to the left-hand-side and right-hand-side expressions – here, these are the vectors *v* and *w*. Well, the [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") object is also storing an instance of the (empty) functor class, but you shouldn't worry about it as that is a minor implementation detail. Thus, the operator+ hasn't performed any actual computation. To summarize, the operation *v* + *w* just returned an object of type [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") which did nothing else than just storing references to *v* and *w*. The assignment ================ **PLEASE HELP US IMPROVING THIS SECTION.** This page reflects how Eigen worked until 3.2, but since Eigen 3.3 the assignment is more sophisticated as it involves an Assignment expression, and the creation of so called evaluator which are responsible for the evaluation of each kind of expressions. At this point, the expression *v* + *w* has finished evaluating, so, in the process of compiling the line of code ``` u = v + w; ``` we now enter the operator=. What operator= is being called here? The vector u is an object of class VectorXf, i.e. [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). In [src/Core/Matrix.h](https://eigen.tuxfamily.org/dox/Matrix_8h_source.html), inside the definition of class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), we see this: ``` template<typename OtherDerived> inline Matrix& operator=(const MatrixBase<OtherDerived>& other) { eigen_assert(m_storage.data()!=0 && "you cannot use operator= with a non initialized matrix (instead use set()"); return Base::operator=(other.derived()); } ``` Here, Base is a typedef for [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")<[Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")>. So, what is being called is the operator= of [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). Let's see its prototype in [src/Core/MatrixBase.h](https://eigen.tuxfamily.org/dox/MatrixBase_8h_source.html): ``` template<typename OtherDerived> Derived& operator=(const MatrixBase<OtherDerived>& other); ``` Here, *Derived* is VectorXf (since u is a VectorXf) and *OtherDerived* is [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions."). More specifically, as explained in the previous section, *OtherDerived* is: ``` CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> ``` So the full prototype of the operator= being called is: ``` VectorXf& [MatrixBase<VectorXf>::operator=](classeigen_1_1matrixbase#a373bf62ad398162df5a71963ed7cbeff)(const MatrixBase<CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> > & other); ``` This operator= literally reads "copying a sum of two VectorXf's into another VectorXf". Let's now look at the implementation of this operator=. It resides in the file [src/Core/Assign.h](https://eigen.tuxfamily.org/dox/Assign_8h_source.html). What we can see there is: ``` template<typename Derived> template<typename OtherDerived> inline Derived& [MatrixBase<Derived>](classeigen_1_1matrixbase#a373bf62ad398162df5a71963ed7cbeff) [::operator=](classeigen_1_1matrixbase#a373bf62ad398162df5a71963ed7cbeff)(const MatrixBase<OtherDerived>& other) { return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived()); } ``` OK so our next task is to understand internal::assign\_selector :) Here is its declaration (all that is still in the same file [src/Core/Assign.h](https://eigen.tuxfamily.org/dox/Assign_8h_source.html)) ``` template<typename Derived, typename OtherDerived, bool EvalBeforeAssigning = int(OtherDerived::Flags) & [EvalBeforeAssigningBit](group__flags#ga0972b20dc004d13984e642b3bd12532e), bool NeedToTranspose = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime && int(Derived::RowsAtCompileTime) == int(OtherDerived::ColsAtCompileTime) && int(Derived::ColsAtCompileTime) == int(OtherDerived::RowsAtCompileTime) && int(Derived::SizeAtCompileTime) != 1> struct internal::assign_selector; ``` So internal::assign\_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones. EvalBeforeAssigning is here to enforce the EvalBeforeAssigningBit. As explained [here](topiclazyevaluation), certain expressions have this flag which makes them automatically evaluate into temporaries before assigning them to another expression. This is the case of the [Product](classeigen_1_1product "Expression of the product of two arbitrary matrices or vectors.") expression, in order to avoid strange aliasing effects when doing "m = m \* m;" However, of course here our [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") expression doesn't have the EvalBeforeAssigningBit: we said since the beginning that we didn't want a temporary to be introduced here. So if you go to [src/Core/CwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/CwiseBinaryOp_8h_source.html), you'll see that the Flags in internal::traits<[CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.")> don't include the EvalBeforeAssigningBit. The Flags member of [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") is then imported from the internal::traits by the EIGEN\_GENERIC\_PUBLIC\_INTERFACE macro. Anyway, here the template parameter EvalBeforeAssigning has the value `false`. NeedToTranspose is here for the case where the user wants to copy a row-vector into a column-vector. We allow this as a special exception to the general rule that in assignments we require the dimesions to match. Anyway, here both the left-hand and right-hand sides are column vectors, in the sense that ColsAtCompileTime is equal to 1. So NeedToTranspose is `false` too. So, here we are in the partial specialization: ``` internal::assign_selector<Derived, OtherDerived, false, false> ``` Here's how it is defined: ``` template<typename Derived, typename OtherDerived> struct internal::assign_selector<Derived,OtherDerived,false,false> { static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); } }; ``` OK so now our next job is to understand how lazyAssign works :) ``` template<typename Derived> template<typename OtherDerived> inline Derived& [MatrixBase<Derived>](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) [::lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f)(const MatrixBase<OtherDerived>& other) { EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) eigen_assert(rows() == other.rows() && cols() == other.cols()); internal::assign_impl<Derived, OtherDerived>::run(derived(),other.derived()); return derived(); } ``` What do we see here? Some assertions, and then the only interesting line is: ``` internal::assign_impl<Derived, OtherDerived>::run(derived(),other.derived()); ``` OK so now we want to know what is inside internal::assign\_impl. Here is its declaration: ``` template<typename Derived1, typename Derived2, int Vectorization = internal::assign_traits<Derived1, Derived2>::Vectorization, int Unrolling = internal::assign_traits<Derived1, Derived2>::Unrolling> struct internal::assign_impl; ``` Again, internal::assign\_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones. These two parameters *Vectorization* and *Unrolling* are determined by a helper class internal::assign\_traits. Its job is to determine which vectorization strategy to use (that is *Vectorization*) and which unrolling strategy to use (that is *Unrolling*). We'll not enter into the details of how these strategies are chosen (this is in the implementation of internal::assign\_traits at the top of the same file). Let's just say that here *Vectorization* has the value *LinearVectorization*, and *Unrolling* has the value *NoUnrolling* (the latter is obvious since our vectors have dynamic size so there's no way to unroll the loop at compile-time). So the partial specialization of internal::assign\_impl that we're looking at is: ``` internal::assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling> ``` Here is how it's defined: ``` template<typename Derived1, typename Derived2> struct internal::assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling> { static void run(Derived1 &dst, const Derived2 &src) { const int size = dst.size(); const int packetSize = internal::packet_traits<typename Derived1::Scalar>::size; const int alignedStart = internal::assign_traits<Derived1,Derived2>::DstIsAligned ? 0 : internal::first_aligned(&dst.coeffRef(0), size); const int alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; for(int index = 0; index < alignedStart; index++) dst.copyCoeff(index, src); for(int index = alignedStart; index < alignedEnd; index += packetSize) { dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src); } for(int index = alignedEnd; index < size; index++) dst.copyCoeff(index, src); } }; ``` Here's how it works. *LinearVectorization* means that the left-hand and right-hand side expression can be accessed linearly i.e. you can refer to their coefficients by one integer *index*, as opposed to having to refer to its coefficients by two integers *row*, *column*. As we said at the beginning, vectorization works with blocks of 4 floats. Here, *PacketSize* is 4. There are two potential problems that we need to deal with: * first, vectorization works much better if the packets are 128-bit-aligned. This is especially important for write access. So when writing to the coefficients of *dst*, we want to group these coefficients by packets of 4 such that each of these packets is 128-bit-aligned. In general, this requires to skip a few coefficients at the beginning of *dst*. This is the purpose of *alignedStart*. We then copy these first few coefficients one by one, not by packets. However, in our case, the *dst* expression is a VectorXf and remember that in the construction of the vectors we allocated aligned arrays. Thanks to *DstIsAligned*, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") remembers that without having to do any runtime check, so *alignedStart* is zero and this part is avoided altogether. * second, the number of coefficients to copy is not in general a multiple of *packetSize*. Here, there are 50 coefficients to copy and *packetSize* is 4. So we'll have to copy the last 2 coefficients one by one, not by packets. Here, *alignedEnd* is 48. Now come the actual loops. First, the vectorized part: the 48 first coefficients out of 50 will be copied by packets of 4: ``` for(int index = alignedStart; index < alignedEnd; index += packetSize) { dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src); } ``` What is copyPacket? It is defined in src/Core/Coeffs.h: ``` template<typename Derived> template<typename OtherDerived, int StoreMode, int LoadMode> inline void MatrixBase<Derived>::copyPacket(int index, const MatrixBase<OtherDerived>& other) { eigen_internal_assert(index >= 0 && index < size()); derived().template writePacket<StoreMode>(index, other.derived().template packet<LoadMode>(index)); } ``` OK, what are writePacket() and packet() here? First, writePacket() here is a method on the left-hand side VectorXf. So we go to [src/Core/Matrix.h](https://eigen.tuxfamily.org/dox/Matrix_8h_source.html) to look at its definition: ``` template<int StoreMode> inline void writePacket(int index, const PacketScalar& x) { internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, x); } ``` Here, *StoreMode* is *[Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)*, indicating that we are doing a 128-bit-aligned write access, *PacketScalar* is a type representing a "SSE packet of 4 floats" and internal::pstoret is a function writing such a packet in memory. Their definitions are architecture-specific, we find them in [src/Core/arch/SSE/PacketMath.h](https://eigen.tuxfamily.org/dox/SSE_2PacketMath_8h_source.html): The line in [src/Core/arch/SSE/PacketMath.h](https://eigen.tuxfamily.org/dox/SSE_2PacketMath_8h_source.html) that determines the PacketScalar type (via a typedef in [Matrix.h](https://eigen.tuxfamily.org/dox/Matrix_8h_source.html)) is: ``` template<> struct internal::packet_traits<float> { typedef __m128 type; enum {size=4}; }; ``` Here, \_\_m128 is a SSE-specific type. Notice that the enum *size* here is what was used to define *packetSize* above. And here is the implementation of internal::pstoret: ``` template<> inline void internal::pstore(float* to, const __m128& from) { _mm_store_ps(to, from); } ``` Here, \_\_mm\_store\_ps is a SSE-specific intrinsic function, representing a single SSE instruction. The difference between internal::pstore and internal::pstoret is that internal::pstoret is a dispatcher handling both the aligned and unaligned cases, you find its definition in [src/Core/GenericPacketMath.h](https://eigen.tuxfamily.org/dox/GenericPacketMath_8h_source.html): ``` template<typename Scalar, typename Packet, int LoadMode> inline void internal::pstoret(Scalar* to, const Packet& from) { if(LoadMode == [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)) internal::pstore(to, from); else internal::pstoreu(to, from); } ``` OK, that explains how writePacket() works. Now let's look into the packet() call. Remember that we are analyzing this line of code inside copyPacket(): ``` derived().template writePacket<StoreMode>(index, other.derived().template packet<LoadMode>(index)); ``` Here, *other* is our sum expression *v* + *w*. The .derived() is just casting from [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") to the subclass which here is [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions."). So let's go to [src/Core/CwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/CwiseBinaryOp_8h_source.html): ``` class CwiseBinaryOp { // ... template<int LoadMode> inline PacketScalar packet(int index) const { return m_functor.packetOp(m_lhs.template packet<LoadMode>(index), m_rhs.template packet<LoadMode>(index)); } }; ``` Here, *m\_lhs* is the vector *v*, and *m\_rhs* is the vector *w*. So the packet() function here is Matrix::packet(). The template parameter *LoadMode* is *[Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)*. So we're looking at ``` class Matrix { // ... template<int LoadMode> inline PacketScalar packet(int index) const { return internal::ploadt<Scalar, LoadMode>(m_storage.data() + index); } }; ``` We let you look up the definition of internal::ploadt in [GenericPacketMath.h](https://eigen.tuxfamily.org/dox/GenericPacketMath_8h_source.html) and the internal::pload in [src/Core/arch/SSE/PacketMath.h](https://eigen.tuxfamily.org/dox/SSE_2PacketMath_8h_source.html). It is very similar to the above for internal::pstore. Let's go back to CwiseBinaryOp::packet(). Once the packets from the vectors *v* and *w* have been returned, what does this function do? It calls m\_functor.packetOp() on them. What is m\_functor? Here we must remember what particular template specialization of [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") we're dealing with: ``` CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> ``` So m\_functor is an object of the empty class internal::scalar\_sum\_op<float>. As we mentioned above, don't worry about why we constructed an object of this empty class at all – it's an implementation detail, the point is that some other functors need to store member data. Anyway, internal::scalar\_sum\_op is defined in src/Core/Functors.h: ``` template<typename Scalar> struct internal::scalar_sum_op EIGEN_EMPTY_STRUCT { inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } template<typename PacketScalar> inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const { return internal::padd(a,b); } }; ``` As you can see, all what packetOp() does is to call internal::padd on the two packets. Here is the definition of internal::padd from [src/Core/arch/SSE/PacketMath.h](https://eigen.tuxfamily.org/dox/SSE_2PacketMath_8h_source.html): ``` template<> inline __m128 internal::padd(const __m128& a, const __m128& b) { return _mm_add_ps(a,b); } ``` Here, \_mm\_add\_ps is a SSE-specific intrinsic function, representing a single SSE instruction. To summarize, the loop ``` for(int index = alignedStart; index < alignedEnd; index += packetSize) { dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src); } ``` has been compiled to the following code: for *index* going from 0 to the 11 ( = 48/4 - 1), read the i-th packet (of 4 floats) from the vector v and the i-th packet from the vector w using two \_\_mm\_load\_ps SSE instructions, then add them together using a \_\_mm\_add\_ps instruction, then store the result using a \_\_mm\_store\_ps instruction. There remains the second loop handling the last few (here, the last 2) coefficients: ``` for(int index = alignedEnd; index < size; index++) dst.copyCoeff(index, src); ``` However, it works just like the one we just explained, it is just simpler because there is no SSE vectorization involved here. copyPacket() becomes copyCoeff(), packet() becomes coeff(), writePacket() becomes coeffRef(). If you followed us this far, you can probably understand this part by yourself. We see that all the C++ abstraction of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") goes away during compilation and that we indeed are precisely controlling which assembly instructions we emit. Such is the beauty of C++! Since we have such precise control over the emitted assembly instructions, but such complex logic to choose the right instructions, we can say that [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") really behaves like an optimizing compiler. If you prefer, you could say that [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") behaves like a script for the compiler. In a sense, C++ template metaprogramming is scripting the compiler – and it's been shown that this scripting language is Turing-complete. See [Wikipedia](http://en.wikipedia.org/wiki/Template_metaprogramming).
programming_docs
eigen3 Advanced initialization Advanced initialization ======================= This page discusses several advanced methods for initializing matrices. It gives more details on the comma-initializer, which was introduced before. It also explains how to get special matrices such as the identity matrix and the zero matrix. The comma initializer ======================= [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") offers a comma initializer syntax which allows the user to easily set all the coefficients of a matrix, vector or array. Simply list the coefficients, starting at the top-left corner and moving from left to right and from the top to the bottom. The size of the object needs to be specified beforehand. If you list too few or too many coefficients, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") will complain. | Example: | Output: | | --- | --- | | ``` Matrix3f m; m << 1, 2, 3, 4, 5, 6, 7, 8, 9; std::cout << m; ``` | ``` 1 2 3 4 5 6 7 8 9 ``` | Moreover, the elements of the initialization list may themselves be vectors or matrices. A common use is to join vectors or matrices together. For example, here is how to join two row vectors together. Remember that you have to set the size before you can use the comma initializer. | Example: | Output: | | --- | --- | | ``` RowVectorXd vec1(3); vec1 << 1, 2, 3; std::cout << "vec1 = " << vec1 << std::endl; RowVectorXd vec2(4); vec2 << 1, 4, 9, 16; std::cout << "vec2 = " << vec2 << std::endl; RowVectorXd joined(7); joined << vec1, vec2; std::cout << "joined = " << joined << std::endl; ``` | ``` vec1 = 1 2 3 vec2 = 1 4 9 16 joined = 1 2 3 1 4 9 16 ``` | We can use the same technique to initialize matrices with a block structure. | Example: | Output: | | --- | --- | | ``` MatrixXf matA(2, 2); matA << 1, 2, 3, 4; MatrixXf matB(4, 4); matB << matA, matA/10, matA/10, matA; std::cout << matB << std::endl; ``` | ``` 1 2 0.1 0.2 3 4 0.3 0.4 0.1 0.2 1 2 0.3 0.4 3 4 ``` | The comma initializer can also be used to fill block expressions such as `m.row(i)`. Here is a more complicated way to get the same result as in the first example above: | Example: | Output: | | --- | --- | | ``` Matrix3f m; m.row(0) << 1, 2, 3; m.block(1,0,2,2) << 4, 5, 7, 8; m.col(2).tail(2) << 6, 9; std::cout << m; ``` | ``` 1 2 3 4 5 6 7 8 9 ``` | Special matrices and arrays ============================= The [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") classes have static methods like [Zero()](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761), which can be used to initialize all coefficients to zero. There are three variants. The first variant takes no arguments and can only be used for fixed-size objects. If you want to initialize a dynamic-size object to zero, you need to specify the size. Thus, the second variant requires one argument and can be used for one-dimensional dynamic-size objects, while the third variant requires two arguments and can be used for two-dimensional objects. All three variants are illustrated in the following example: | Example: | Output: | | --- | --- | | ``` std::cout << "A fixed-size array:\n"; Array33f a1 = [Array33f::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(); std::cout << a1 << "\n\n"; std::cout << "A one-dimensional dynamic-size array:\n"; ArrayXf a2 = [ArrayXf::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(3); std::cout << a2 << "\n\n"; std::cout << "A two-dimensional dynamic-size array:\n"; ArrayXXf a3 = [ArrayXXf::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(3, 4); std::cout << a3 << "\n"; ``` | ``` A fixed-size array: 0 0 0 0 0 0 0 0 0 A one-dimensional dynamic-size array: 0 0 0 A two-dimensional dynamic-size array: 0 0 0 0 0 0 0 0 0 0 0 0 ``` | Similarly, the static method [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(value) sets all coefficients to `value`. If the size of the object needs to be specified, the additional arguments go before the `value` argument, as in `MatrixXd::Constant(rows, cols, value)`. The method [Random()](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) fills the matrix or array with random coefficients. The identity matrix can be obtained by calling [Identity()](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f); this method is only available for [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), not for [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."), because "identity matrix" is a linear algebra concept. The method [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d)(size, low, high) is only available for vectors and one-dimensional arrays; it yields a vector of the specified size whose coefficients are equally spaced between `low` and `high`. The method `LinSpaced()` is illustrated in the following example, which prints a table with angles in degrees, the corresponding angle in radians, and their sine and cosine. | Example: | Output: | | --- | --- | | ``` ArrayXXf table(10, 4); table.col(0) = [ArrayXf::LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d)(10, 0, 90); table.col(1) = M_PI / 180 * table.col(0); table.col(2) = table.col(1).sin(); table.col(3) = table.col(1).cos(); std::cout << " Degrees Radians Sine Cosine\n"; std::cout << table << std::endl; ``` | ``` Degrees Radians Sine Cosine 0 0 0 1 10 0.175 0.174 0.985 20 0.349 0.342 0.94 30 0.524 0.5 0.866 40 0.698 0.643 0.766 50 0.873 0.766 0.643 60 1.05 0.866 0.5 70 1.22 0.94 0.342 80 1.4 0.985 0.174 90 1.57 1 -4.37e-08 ``` | This example shows that objects like the ones returned by LinSpaced() can be assigned to variables (and expressions). [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") defines utility functions like [setZero()](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb), [MatrixBase::setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683) and [DenseBase::setLinSpaced()](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) to do this conveniently. The following example contrasts three ways to construct the matrix \( J = \bigl[ \begin{smallmatrix} O & I \\ I & O \end{smallmatrix} \bigr] \): using static methods and assignment, using static methods and the comma-initializer, or using the setXxx() methods. | Example: | Output: | | --- | --- | | ``` const int size = 6; MatrixXd mat1(size, size); mat1.topLeftCorner(size/2, size/2) = [MatrixXd::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(size/2, size/2); mat1.topRightCorner(size/2, size/2) = [MatrixXd::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(size/2, size/2); mat1.bottomLeftCorner(size/2, size/2) = [MatrixXd::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(size/2, size/2); mat1.bottomRightCorner(size/2, size/2) = [MatrixXd::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(size/2, size/2); std::cout << mat1 << std::endl << std::endl; MatrixXd mat2(size, size); mat2.topLeftCorner(size/2, size/2).setZero(); mat2.topRightCorner(size/2, size/2).setIdentity(); mat2.bottomLeftCorner(size/2, size/2).setIdentity(); mat2.bottomRightCorner(size/2, size/2).setZero(); std::cout << mat2 << std::endl << std::endl; MatrixXd mat3(size, size); mat3 << [MatrixXd::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(size/2, size/2), [MatrixXd::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(size/2, size/2), [MatrixXd::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(size/2, size/2), [MatrixXd::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(size/2, size/2); std::cout << mat3 << std::endl; ``` | ``` 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 ``` | A summary of all pre-defined matrix, vector and array objects can be found in the [Quick reference guide](group__quickrefpage). Usage as temporary objects ============================ As shown above, static methods as Zero() and Constant() can be used to initialize variables at the time of declaration or at the right-hand side of an assignment operator. You can think of these methods as returning a matrix or array; in fact, they return so-called [expression objects](topiceigenexpressiontemplates) which evaluate to a matrix or array when needed, so that this syntax does not incur any overhead. These expressions can also be used as a temporary object. The second example in the [Getting started](gettingstarted) guide, which we reproduce here, already illustrates this. | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace [Eigen](namespaceeigen); using namespace std; int main() { MatrixXd m = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,3); m = (m + [MatrixXd::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(3,3,1.2)) * 50; cout << "m =" << endl << m << endl; VectorXd v(3); v << 1, 2, 3; cout << "m \* v =" << endl << m * v << endl; } ``` | ``` m = 94 89.8 43.5 49.4 101 86.8 88.3 29.8 37.8 m * v = 404 512 261 ``` | The expression `m + [MatrixXf::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(3,3,1.2)` constructs the 3-by-3 matrix expression with all its coefficients equal to 1.2 plus the corresponding coefficient of *m*. The comma-initializer, too, can also be used to construct temporary objects. The following example constructs a random matrix of size 2-by-3, and then multiplies this matrix on the left with \( \bigl[ \begin{smallmatrix} 0 & 1 \\ 1 & 0 \end{smallmatrix} \bigr] \). | Example: | Output: | | --- | --- | | ``` MatrixXf mat = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(2, 3); std::cout << mat << std::endl << std::endl; mat = (MatrixXf(2,2) << 0, 1, 1, 0).finished() * mat; std::cout << mat << std::endl; ``` | ``` 0.68 0.566 0.823 -0.211 0.597 -0.605 -0.211 0.597 -0.605 0.68 0.566 0.823 ``` | The [finished()](structeigen_1_1commainitializer#a3cf9e2b8a227940f50103130b2d2859a) method is necessary here to get the actual matrix object once the comma initialization of our temporary submatrix is done. eigen3 SparseLU module SparseLU module =============== This module defines a supernodal factorization of general sparse matrices. The code is fully optimized for supernode-panel updates with specialized kernels. Please, see the documentation of the [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") class for more details. | | | --- | | | | class | [Eigen::SparseLU< \_MatrixType, \_OrderingType >](classeigen_1_1sparselu) | | | [Sparse](structeigen_1_1sparse) supernodal LU factorization for general matrices. [More...](classeigen_1_1sparselu#details) | | | eigen3 Eigen::SolveWithGuess Eigen::SolveWithGuess ===================== ### template<typename Decomposition, typename RhsType, typename GuessType> class Eigen::SolveWithGuess< Decomposition, RhsType, GuessType > Pseudo expression representing a solving operation. Template Parameters | | | | --- | --- | | Decomposition | the type of the matrix or decomposion object | | Rhstype | the type of the right-hand side | This class represents an expression of A.solve(B) and most of the time this is the only way it is used. Inherits internal::generic\_xpr\_base::type. --- The documentation for this class was generated from the following file:* [SolveWithGuess.h](https://eigen.tuxfamily.org/dox/SolveWithGuess_8h_source.html) eigen3 Eigen::SVDBase Eigen::SVDBase ============== ### template<typename Derived> class Eigen::SVDBase< Derived > Base class of SVD algorithms. Template Parameters | | | | --- | --- | | Derived | the type of the actual SVD decomposition | SVD decomposition consists in decomposing any n-by-p matrix *A* as a product \[ A = U S V^\* \] where *U* is a n-by-n unitary, *V* is a p-by-p unitary, and *S* is a n-by-p real positive matrix which is zero outside of its main diagonal; the diagonal entries of S are known as the *singular* *values* of *A* and the columns of *U* and *V* are known as the left and right *singular* *vectors* of *A* respectively. Singular values are always sorted in decreasing order. You can ask for only *thin* *U* or *V* to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting *m* be the smaller value among *n* and *p*, there are only *m* singular vectors; the remaining columns of *U* and *V* do not correspond to actual singular vectors. Asking for *thin* *U* or *V* means asking for only their *m* first columns to be formed. So *U* is then a n-by-m matrix, and *V* is then a p-by-m matrix. Notice that thin *U* and *V* are all you need for (least squares) solving. The status of the computation can be retrived using the *[info()](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292 "Reports whether previous computation was successful.")* method. Unless *[info()](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292 "Reports whether previous computation was successful.")* returns *Success*, the results should be not considered well defined. If the input matrix has inf or nan coefficients, the result of the computation is undefined, and *[info()](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292 "Reports whether previous computation was successful.")* will return *InvalidInput*, but the computation is guaranteed to terminate in finite (and reasonable) time. See also class [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD"), class [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") ![Inheritance graph](https://eigen.tuxfamily.org/dox/classEigen_1_1SVDBase__inherit__graph.png) | | | --- | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1svdbase#a6229a37997eca1072b52cca5ee7a2bec) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | | | --- | | | | bool | [computeU](classeigen_1_1svdbase#a705a7c2709e1624ccc19aa748a78d473) () const | | | | bool | [computeV](classeigen_1_1svdbase#a5f12efcb791eb007d4a4890ac5255ac4) () const | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292) | | | | const [MatrixUType](classeigen_1_1matrix) & | [matrixU](classeigen_1_1svdbase#afc7fe1546b0f6e1801b86f22f5664cb8) () const | | | | const [MatrixVType](classeigen_1_1matrix) & | [matrixV](classeigen_1_1svdbase#a245a453b5e7347f737295c23133238c4) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonzeroSingularValues](classeigen_1_1svdbase#afe8a555f38393a319a71ec0f0331c9ef) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rank](classeigen_1_1svdbase#a30b89e24f42f1692079eea31b361d26a) () const | | | | Derived & | [setThreshold](classeigen_1_1svdbase#a1c95d05398fc15e410a28560ef70a5a6) (const RealScalar &[threshold](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69)) | | | | Derived & | [setThreshold](classeigen_1_1svdbase#a27586b69dbfb63f714d1d45fd6304f97) (Default\_t) | | | | const SingularValuesType & | [singularValues](classeigen_1_1svdbase#a4e7bac123570c348f7ed6be909e1e474) () const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1svdbase#ab28499936c0764fe5b56b9f4de701e26) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | RealScalar | [threshold](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69) () const | | | | Public Member Functions inherited from [Eigen::SolverBase< SVDBase< Derived > >](classeigen_1_1solverbase) | | AdjointReturnType | [adjoint](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) () const | | | | [SVDBase](classeigen_1_1svdbase)< Derived > & | [derived](classeigen_1_1solverbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [SVDBase](classeigen_1_1svdbase)< Derived > & | [derived](classeigen_1_1solverbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | const [Solve](classeigen_1_1solve)< [SVDBase](classeigen_1_1svdbase)< Derived >, Rhs > | [solve](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | | [SolverBase](classeigen_1_1solverbase#a4d5e5baddfba3790ab1a5f247dcc4dc1) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | | [SVDBase](classeigen_1_1svdbase#abed06fc6f4b743e1f76a7b317539da87) () | | | Default Constructor. [More...](classeigen_1_1svdbase#abed06fc6f4b743e1f76a7b317539da87) | | | Index ----- template<typename Derived > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::[Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | **[Deprecated:](deprecated#_deprecated000034)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 SVDBase() --------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::[SVDBase](classeigen_1_1svdbase) | ( | | ) | | | inlineprotected | Default Constructor. Default constructor of [SVDBase](classeigen_1_1svdbase "Base class of SVD algorithms.") computeU() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::computeU | ( | | ) | const | | inline | Returns true if *U* (full or thin) is asked for in this SVD decomposition computeV() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::computeV | ( | | ) | const | | inline | Returns true if *V* (full or thin) is asked for in this SVD decomposition info() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful. matrixU() --------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [MatrixUType](classeigen_1_1matrix)& [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::matrixU | ( | | ) | const | | inline | Returns the *U* matrix. For the SVD decomposition of a n-by-p matrix, letting *m* be the minimum of *n* and *p*, the U matrix is n-by-n if you asked for [ComputeFullU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9fa9302d510cee20c26311154937e23f) , and is n-by-m if you asked for [ComputeThinU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527) . The *m* first columns of *U* are the left singular vectors of the matrix being decomposed. This method asserts that you asked for *U* to be computed. matrixV() --------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [MatrixVType](classeigen_1_1matrix)& [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::matrixV | ( | | ) | const | | inline | Returns the *V* matrix. For the SVD decomposition of a n-by-p matrix, letting *m* be the minimum of *n* and *p*, the V matrix is p-by-p if you asked for [ComputeFullV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a36581f7c662f7def31efd500c284f930) , and is p-by-m if you asked for [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47) . The *m* first columns of *V* are the right singular vectors of the matrix being decomposed. This method asserts that you asked for *V* to be computed. nonzeroSingularValues() ----------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::nonzeroSingularValues | ( | | ) | const | | inline | Returns the number of singular values that are not exactly 0 rank() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::rank | ( | | ) | const | | inline | Returns the rank of the matrix of which `*this` is the SVD. Note This method has to determine which singular values should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1svdbase#a1c95d05398fc15e410a28560ef70a5a6). setThreshold() [1/2] -------------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::setThreshold | ( | const RealScalar & | *threshold* | ) | | | inline | Allows to prescribe a threshold to be used by certain methods, such as [rank()](classeigen_1_1svdbase#a30b89e24f42f1692079eea31b361d26a) and [solve()](classeigen_1_1svdbase#ab28499936c0764fe5b56b9f4de701e26), which need to determine when singular values are to be considered nonzero. This is not used for the SVD decomposition itself. When it needs to get the threshold value, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") calls [threshold()](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69). The default is `NumTraits<Scalar>::epsilon()` Parameters | | | | --- | --- | | threshold | The new value to use as the threshold. | A singular value will be considered nonzero if its value is strictly greater than \( \vert singular value \vert \leqslant threshold \times \vert max singular value \vert \). If you want to come back to the default behavior, call [setThreshold(Default\_t)](classeigen_1_1svdbase#a27586b69dbfb63f714d1d45fd6304f97) setThreshold() [2/2] -------------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::setThreshold | ( | Default\_t | | ) | | | inline | Allows to come back to the default behavior, letting [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") use its default formula for determining the threshold. You should pass the special object Eigen::Default as parameter here. ``` svd.setThreshold(Eigen::Default); ``` See the documentation of [setThreshold(const RealScalar&)](classeigen_1_1svdbase#a1c95d05398fc15e410a28560ef70a5a6). singularValues() ---------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const SingularValuesType& [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::singularValues | ( | | ) | const | | inline | Returns the vector of singular values. For the SVD decomposition of a n-by-p matrix, letting *m* be the minimum of *n* and *p*, the returned vector has size *m*. Singular values are always sorted in decreasing order. solve() ------- template<typename Derived > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<Derived, Rhs> [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *b* | ) | const | | inline | Returns a (least squares) solution of \( A x = b \) using the current SVD decomposition of A. Parameters | | | | --- | --- | | b | the right-hand-side of the equation to solve. | Note Solving requires both U and V to be computed. Thin U and V are enough, there is no need for full U or V. SVD solving is implicitly least-squares. Thus, this method serves both purposes of exact solving and least-squares solving. In other words, the returned solution is guaranteed to minimize the Euclidean norm \( \Vert A x - b \Vert \). threshold() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::SVDBase](classeigen_1_1svdbase)< Derived >::threshold | ( | | ) | const | | inline | Returns the threshold that will be used by certain methods such as [rank()](classeigen_1_1svdbase#a30b89e24f42f1692079eea31b361d26a). See the documentation of [setThreshold(const RealScalar&)](classeigen_1_1svdbase#a1c95d05398fc15e410a28560ef70a5a6). --- The documentation for this class was generated from the following file:* [SVDBase.h](https://eigen.tuxfamily.org/dox/SVDBase_8h_source.html)
programming_docs
eigen3 Eigen::CholmodSimplicialLDLT Eigen::CholmodSimplicialLDLT ============================ ### template<typename \_MatrixType, int \_UpLo = Lower> class Eigen::CholmodSimplicialLDLT< \_MatrixType, \_UpLo > A simplicial direct Cholesky ([LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.")) factorization and solver based on Cholmod. This class allows to solve for A.X = B sparse linear problems via a simplicial LDL^T Cholesky factorization using the Cholmod library. This simplicial variant is equivalent to [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s built-in [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") class. Therefore, it has little practical interest. The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices X and B can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | \_UpLo | the triangular part that will be used for the computations. It can be Lower or Upper. Default is Lower. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. Warning Only double precision real and complex scalar types are supported by Cholmod. See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [CholmodSupernodalLLT](classeigen_1_1cholmodsupernodalllt "A supernodal Cholesky (LLT) factorization and solver based on Cholmod."), class [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") | | | --- | | | | Public Member Functions inherited from [Eigen::CholmodBase< \_MatrixType, Lower, CholmodSimplicialLDLT< \_MatrixType, Lower > >](classeigen_1_1cholmodbase) | | void | [analyzePattern](classeigen_1_1cholmodbase#a5ac967e9f4ccfc43ca9e610b89232c24) (const MatrixType &matrix) | | | | cholmod\_common & | [cholmod](classeigen_1_1cholmodbase#a6a85bf52d6aa480240a64f277d7f96c6) () | | | | [CholmodSimplicialLDLT](classeigen_1_1cholmodsimplicialldlt)< \_MatrixType, Lower > & | [compute](classeigen_1_1cholmodbase#abaf5be01b1e3035a4de0b19f5b63549e) (const MatrixType &matrix) | | | | Scalar | [determinant](classeigen_1_1cholmodbase#ab4ffb4a9735ad7e81a01d5789ce96547) () const | | | | void | [factorize](classeigen_1_1cholmodbase#a5bd9c9ec4d1c15f202a6c66b5e9ef37b) (const MatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) | | | | Scalar | [logDeterminant](classeigen_1_1cholmodbase#a597f7839a39604af18a8741a0d8c46bf) () const | | | | [CholmodSimplicialLDLT](classeigen_1_1cholmodsimplicialldlt)< \_MatrixType, Lower > & | [setShift](classeigen_1_1cholmodbase#a886fc102723ca7bde4ac7162dfd72f5d) (const RealScalar &offset) | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | --- The documentation for this class was generated from the following file:* [CholmodSupport.h](https://eigen.tuxfamily.org/dox/CholmodSupport_8h_source.html) eigen3 Eigen::SparseSelfAdjointView Eigen::SparseSelfAdjointView ============================ ### template<typename MatrixType, unsigned int \_Mode> class Eigen::SparseSelfAdjointView< MatrixType, \_Mode > Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix. Parameters | | | | --- | --- | | MatrixType | the type of the dense matrix storing the coefficients | | Mode | can be either `[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)` or `[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)` | This class is an expression of a sefladjoint matrix from a triangular part of a matrix with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() and most of the time this is the only way that it is used. See also SparseMatrixBase::selfadjointView() | | | --- | | | | template<typename OtherDerived > | | [Product](classeigen_1_1product)< [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview), OtherDerived > | [operator\*](classeigen_1_1sparseselfadjointview#a887e3b5fa468af8413276141ddc8bb93) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &rhs) const | | | | template<typename OtherDerived > | | [Product](classeigen_1_1product)< [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview), OtherDerived > | [operator\*](classeigen_1_1sparseselfadjointview#a9d1e5ef26775e3b43be08fd4ae191aa8) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &rhs) const | | | | template<typename DerivedU > | | [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview) & | [rankUpdate](classeigen_1_1sparseselfadjointview#abe66734215f8d8220be0985d67901021) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< DerivedU > &u, const Scalar &alpha=Scalar(1)) | | | | SparseSymmetricPermutationProduct< \_MatrixTypeNested, Mode > | [twistedBy](classeigen_1_1sparseselfadjointview#acde15b45cf7b43520e1005ec65d55f3c) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), StorageIndex > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< SparseSelfAdjointView< MatrixType, \_Mode > >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< MatrixType, \_Mode > & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< MatrixType, \_Mode > & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< SparseSelfAdjointView< MatrixType, \_Mode > >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | operator\*() [1/2] ------------------ template<typename MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Product](classeigen_1_1product)<[SparseSelfAdjointView](classeigen_1_1sparseselfadjointview),OtherDerived> [Eigen::SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< MatrixType, \_Mode >::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *rhs* | ) | const | | inline | Efficient sparse self-adjoint matrix times dense vector/matrix product operator\*() [2/2] ------------------ template<typename MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Product](classeigen_1_1product)<[SparseSelfAdjointView](classeigen_1_1sparseselfadjointview), OtherDerived> [Eigen::SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< MatrixType, \_Mode >::operator\* | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > & | *rhs* | ) | const | | inline | Returns an expression of the matrix product between a sparse self-adjoint matrix `*this` and a sparse matrix *rhs*. Note that there is no algorithmic advantage of performing such a product compared to a general sparse-sparse matrix product. Indeed, the SparseSelfadjointView operand is first copied into a temporary [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation.") before computing the product. rankUpdate() ------------ template<typename MatrixType , unsigned int \_Mode> template<typename DerivedU > | | | | | | --- | --- | --- | --- | | [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)& [Eigen::SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< MatrixType, \_Mode >::rankUpdate | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< DerivedU > & | *u*, | | | | const Scalar & | *alpha* = `Scalar(1)` | | | ) | | | Perform a symmetric rank K update of the selfadjoint matrix `*this`: \( this = this + \alpha ( u u^\* ) \) where *u* is a vector or matrix. Returns a reference to `*this` To perform \( this = this + \alpha ( u^\* u ) \) you can simply call this function with u.adjoint(). twistedBy() ----------- template<typename MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | SparseSymmetricPermutationProduct<\_MatrixTypeNested,Mode> [Eigen::SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< MatrixType, \_Mode >::twistedBy | ( | const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), StorageIndex > & | *perm* | ) | const | | inline | Returns an expression of P H P^-1 --- The documentation for this class was generated from the following file:* [SparseSelfAdjointView.h](https://eigen.tuxfamily.org/dox/SparseSelfAdjointView_8h_source.html) eigen3 UmfPackSupport module UmfPackSupport module ===================== This module provides an interface to the UmfPack library which is part of the [suitesparse](http://www.suitesparse.com) package. It provides the following factorization class: * class UmfPackLU: a multifrontal sequential LU factorization. ``` #include <Eigen/UmfPackSupport> ``` In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. The dependencies depend on how umfpack has been compiled. For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. | | | --- | | | | class | [Eigen::UmfPackLU< \_MatrixType >](classeigen_1_1umfpacklu) | | | A sparse LU factorization and solver based on UmfPack. [More...](classeigen_1_1umfpacklu#details) | | | eigen3 Eigen::PardisoLU Eigen::PardisoLU ================ ### template<typename MatrixType> class Eigen::PardisoLU< MatrixType > A sparse direct LU factorization and solver based on the PARDISO library. This class allows to solve for A.X = B sparse linear problems via a direct LU factorization using the Intel MKL PARDISO library. The sparse matrix A must be squared and invertible. The vectors or matrices X and B can be either dense or sparse. By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set: ``` solver.pardisoParameterArray()[59] = 1; ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") Inherits Eigen::PardisoImpl< Derived >. | | | --- | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1pardisolu#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1pardisolu#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | solve() [1/2] ------------- template<typename MatrixType > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<Derived, Rhs> [Eigen::SparseSolverBase](classeigen_1_1sparsesolverbase)< Derived >::solve | ( | typename Rhs | | ) | | | inline | Returns an expression of the solution x of \( A x = b \) using the current decomposition of A. See also compute() solve() [2/2] ------------- template<typename MatrixType > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<Derived, Rhs> [Eigen::SparseSolverBase](classeigen_1_1sparsesolverbase)< Derived >::solve | ( | typename Rhs | | ) | | | inline | Returns an expression of the solution x of \( A x = b \) using the current decomposition of A. See also compute() --- The documentation for this class was generated from the following file:* [PardisoSupport.h](https://eigen.tuxfamily.org/dox/PardisoSupport_8h_source.html) eigen3 Interfacing with raw buffers: the Map class Interfacing with raw buffers: the Map class =========================================== This page explains how to work with "raw" C/C++ arrays. This can be useful in a variety of contexts, particularly when "importing" vectors and matrices from other libraries into Eigen. Introduction ============== Occasionally you may have a pre-defined array of numbers that you want to use within Eigen as a vector or matrix. While one option is to make a copy of the data, most commonly you probably want to re-use this memory as an Eigen type. Fortunately, this is very easy with the [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") class. Map types and declaring Map variables ======================================= A [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") object has a type defined by its Eigen equivalent: ``` Map<Matrix<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime> > ``` Note that, in this default case, a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") requires just a single template parameter. To construct a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") variable, you need two other pieces of information: a pointer to the region of memory defining the array of coefficients, and the desired shape of the matrix or vector. For example, to define a matrix of `float` with sizes determined at compile time, you might do the following: ``` Map<MatrixXf> mf(pf,rows,columns); ``` where `pf` is a `float` `*` pointing to the array of memory. A fixed-size read-only vector of integers might be declared as ``` Map<const Vector4i> mi(pi); ``` where `pi` is an `int` `*`. In this case the size does not have to be passed to the constructor, because it is already specified by the Matrix/Array type. Note that [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") does not have a default constructor; you *must* pass a pointer to initialize the object. However, you can work around this requirement (see [Changing the mapped array](group__tutorialmapclass#TutorialMapPlacementNew)). [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") is flexible enough to accommodate a variety of different data representations. There are two other (optional) template parameters: ``` Map<typename MatrixType, int MapOptions, typename StrideType> ``` * `MapOptions` specifies whether the pointer is `[Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)`, or `[Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686)`. The default is `[Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686)`. * `StrideType` allows you to specify a custom layout for the memory array, using the [Stride](classeigen_1_1stride "Holds strides information for Map.") class. One example would be to specify that the data array is organized in row-major format: | Example: | Output: | | --- | --- | | ``` int array[8]; for(int i = 0; i < 8; ++i) array[i] = i; cout << "Column-major:\n" << Map<Matrix<int,2,4> >(array) << endl; cout << "Row-major:\n" << Map<Matrix<int,2,4,RowMajor> >(array) << endl; cout << "Row-major using stride:\n" << Map<Matrix<int,2,4>, [Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686), Stride<1,4> >(array) << endl; ``` | ``` Column-major: 0 2 4 6 1 3 5 7 Row-major: 0 1 2 3 4 5 6 7 Row-major using stride: 0 1 2 3 4 5 6 7 ``` | However, [Stride](classeigen_1_1stride "Holds strides information for Map.") is even more flexible than this; for details, see the documentation for the [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Stride](classeigen_1_1stride "Holds strides information for Map.") classes. Using Map variables ===================== You can use a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") object just like any other Eigen type: | Example: | Output: | | --- | --- | | ``` typedef Matrix<float,1,Dynamic> MatrixType; typedef Map<MatrixType> MapType; typedef Map<const MatrixType> MapTypeConst; // a read-only map const int n_dims = 5; MatrixType m1(n_dims), m2(n_dims); m1.setRandom(); m2.setRandom(); float *p = &m2(0); // get the address storing the data for m2 MapType m2map(p,m2.size()); // m2map shares data with m2 MapTypeConst m2mapconst(p,m2.size()); // a read-only accessor for m2 cout << "m1: " << m1 << endl; cout << "m2: " << m2 << endl; cout << "Squared euclidean distance: " << (m1-m2).squaredNorm() << endl; cout << "Squared euclidean distance, using map: " << (m1-m2map).squaredNorm() << endl; m2map(3) = 7; // this will change m2, since they share the same array cout << "Updated m2: " << m2 << endl; cout << "m2 coefficient 2, constant accessor: " << m2mapconst(2) << endl; /\* m2mapconst(2) = 5; \*/ // this yields a compile-time error ``` | ``` m1: 0.68 -0.211 0.566 0.597 0.823 m2: -0.605 -0.33 0.536 -0.444 0.108 Squared euclidean distance: 3.26 Squared euclidean distance, using map: 3.26 Updated m2: -0.605 -0.33 0.536 7 0.108 m2 coefficient 2, constant accessor: 0.536 ``` | All Eigen functions are written to accept [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") objects just like other Eigen types. However, when writing your own functions taking Eigen types, this does *not* happen automatically: a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") type is not identical to its [Dense](structeigen_1_1dense) equivalent. See [Writing Functions Taking Eigen Types as Parameters](topicfunctiontakingeigentypes) for details. Changing the mapped array =========================== It is possible to change the array of a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") object after declaration, using the C++ "placement new" syntax: | Example: | Output: | | --- | --- | | ``` int data[] = {1,2,3,4,5,6,7,8,9}; Map<RowVectorXi> v(data,4); cout << "The mapped vector v is: " << v << "\n"; new (&v) Map<RowVectorXi>(data+4,5); cout << "Now v is: " << v << "\n"; ``` | ``` The mapped vector v is: 1 2 3 4 Now v is: 5 6 7 8 9 ``` | Despite appearances, this does not invoke the memory allocator, because the syntax specifies the location for storing the result. This syntax makes it possible to declare a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") object without first knowing the mapped array's location in memory: ``` Map<Matrix3f> A(NULL); // don't try to use this matrix yet! VectorXf b(n_matrices); for (int i = 0; i < n_matrices; i++) { new (&A) Map<Matrix3f>(get_matrix_pointer(i)); b(i) = A.trace(); } ```
programming_docs
eigen3 Eigen::TriangularViewImpl Eigen::TriangularViewImpl ========================= ### template<typename MatrixType, unsigned int Mode> class Eigen::TriangularViewImpl< MatrixType, Mode, Sparse > Base class for a triangular part in a **sparse** matrix. This class is an abstract base class of class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix."), and objects of type TriangularViewImpl cannot be instantiated. It extends class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix.") with additional methods which are available for sparse expressions only. See also class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix."), SparseMatrixBase::triangularView() | | | --- | | | | template<typename OtherDerived > | | void | [solveInPlace](classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4#a3f3385e827fcc0bf27d1ec21c80740bc) ([MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | void | [solveInPlace](classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4#a70190d4105e1fd4f27abbf73365dfa0c) ([SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< TriangularView< MatrixType, Mode > >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode > >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | const [Product](classeigen_1_1product)< [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode >, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode > > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode >, Upper|Lower > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< TriangularView< MatrixType, Mode > >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode > & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode > & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< TriangularView< MatrixType, Mode > >](classeigen_1_1sparsematrixbase) | | typedef internal::traits< [TriangularView](classeigen_1_1triangularview)< MatrixType, Mode > >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< TriangularView< MatrixType, Mode > >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | solveInPlace() [1/2] -------------------- template<typename MatrixType , unsigned int Mode> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | void Eigen::TriangularViewImpl< MatrixType, Mode, [Sparse](structeigen_1_1sparse) >::solveInPlace | ( | [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | Applies the inverse of `*this` to the dense vector or matrix *other*, "in-place" solveInPlace() [2/2] -------------------- template<typename MatrixType , unsigned int Mode> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | void Eigen::TriangularViewImpl< MatrixType, Mode, [Sparse](structeigen_1_1sparse) >::solveInPlace | ( | [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > & | *other* | ) | const | Applies the inverse of `*this` to the sparse vector or matrix *other*, "in-place" --- The documentation for this class was generated from the following file:* [SparseTriangularView.h](https://eigen.tuxfamily.org/dox/SparseTriangularView_8h_source.html) eigen3 Eigen::SparseCompressedBase Eigen::SparseCompressedBase =========================== ### template<typename Derived> class Eigen::SparseCompressedBase< Derived > Common base class for sparse [compressed]-{row|column}-storage format. This class defines the common interface for all derived classes implementing the compressed sparse storage format, such as: * [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation.") * [Ref<SparseMatrixType,Options>](classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4 "A sparse matrix expression referencing an existing sparse expression.") * [Map<SparseMatrixType>](classeigen_1_1map_3_01sparsematrixtype_01_4 "Specialization of class Map for SparseMatrix-like storage.") | | | --- | | | | [Map](classeigen_1_1map)< [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a7cf299e08d2a4f6d6869e631e51b12fe) () | | | | const [Map](classeigen_1_1map)< const [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a101b155485ae59ea1261c4f6040f3dc4) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#aa64818e1aa43015dad01b114b2ab4687) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#a411e972b097e6aef225415a4c2d0a0b5) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#afc056a3895eae1a4c4767252ff04966a) () const | | | | bool | [isCompressed](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsecompressedbase#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a2624d4c2661c582de168246c56e8d71e) () const | | | | Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f44c739398794ea77f310b745cc5627) () const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< Derived >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< Derived, [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)|[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | | [SparseCompressedBase](classeigen_1_1sparsecompressedbase#af79f020db965367d97eb954fc68d8f99) () | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | enum | { [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604) , [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14) , [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) , **MaxRowsAtCompileTime** , **MaxColsAtCompileTime** , **MaxSizeAtCompileTime** , [IsVectorAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a14a3f566ed2a074beddb8aef0223bfdf) , [NumDimensions](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2366131ffcc38bff48a1c7572eb86dd3) , [Flags](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2af043b36fe9e08df0107cf6de496165) , **IsRowMajor** , **InnerSizeAtCompileTime** } | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | SparseCompressedBase() ---------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::[SparseCompressedBase](classeigen_1_1sparsecompressedbase) | ( | | ) | | | inlineprotected | Default constructor. Do nothing. coeffs() [1/2] -------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Map](classeigen_1_1map)<[Array](classeigen_1_1array)<Scalar,[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2),1> > [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::coeffs | ( | | ) | | | inline | Returns a read-write view of the stored coefficients as a 1D array expression Warning this method is for **compressed** **storage** **only**, and it will trigger an assertion otherwise. Here is an example: ``` SparseMatrix<double> A(3,3); A.insert(1,2) = 0; A.insert(0,1) = 1; A.insert(2,0) = 2; A.makeCompressed(); cout << "The matrix A is:" << endl << MatrixXd(A) << endl; cout << "it has " << A.nonZeros() << " stored non zero coefficients that are: " << A.coeffs().transpose() << endl; A.coeffs() += 10; cout << "After adding 10 to every stored non zero coefficient, the matrix A is:" << endl << MatrixXd(A) << endl; ``` and the output is: ``` The matrix A is: 0 1 0 0 0 0 2 0 0 it has 3 stored non zero coefficients that are: 2 1 0 After adding 10 to every stored non zero coefficient, the matrix A is: 0 11 0 0 0 10 12 0 0 ``` See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [isCompressed()](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) coeffs() [2/2] -------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Map](classeigen_1_1map)<const [Array](classeigen_1_1array)<Scalar,[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2),1> > [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::coeffs | ( | | ) | const | | inline | Returns a read-only view of the stored coefficients as a 1D array expression. Warning this method is for **compressed** **storage** **only**, and it will trigger an assertion otherwise. See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [isCompressed()](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) innerIndexPtr() [1/2] --------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::innerIndexPtr | ( | | ) | | | inline | Returns a non-const pointer to the array of inner indices. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [outerIndexPtr()](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) innerIndexPtr() [2/2] --------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::innerIndexPtr | ( | | ) | const | | inline | Returns a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [outerIndexPtr()](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) innerNonZeroPtr() [1/2] ----------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::innerNonZeroPtr | ( | | ) | | | inline | Returns a non-const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 in compressed mode innerNonZeroPtr() [2/2] ----------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::innerNonZeroPtr | ( | | ) | const | | inline | Returns a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 in compressed mode isCompressed() -------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::isCompressed | ( | | ) | const | | inline | Returns whether `*this` is in compressed form. nonZeros() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::nonZeros | ( | | ) | const | | inline | Returns the number of non zero coefficients outerIndexPtr() [1/2] --------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::outerIndexPtr | ( | | ) | | | inline | Returns a non-const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 for [SparseVector](classeigen_1_1sparsevector "a sparse vector class") See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [innerIndexPtr()](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) outerIndexPtr() [2/2] --------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::outerIndexPtr | ( | | ) | const | | inline | Returns a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 for [SparseVector](classeigen_1_1sparsevector "a sparse vector class") See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [innerIndexPtr()](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) valuePtr() [1/2] ---------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::valuePtr | ( | | ) | | | inline | Returns a non-const pointer to the array of values. This function is aimed at interoperability with other libraries. See also [innerIndexPtr()](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a), [outerIndexPtr()](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) valuePtr() [2/2] ---------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Scalar\* [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::valuePtr | ( | | ) | const | | inline | Returns a const pointer to the array of values. This function is aimed at interoperability with other libraries. See also [innerIndexPtr()](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a), [outerIndexPtr()](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) --- The documentation for this class was generated from the following file:* [SparseCompressedBase.h](https://eigen.tuxfamily.org/dox/SparseCompressedBase_8h_source.html)
programming_docs
eigen3 Eigenvalues module Eigenvalues module ================== This module mainly provides various eigenvalue solvers. This module also provides some [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") methods, including: * [MatrixBase::eigenvalues()](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d "Computes the eigenvalues of a matrix."), * [MatrixBase::operatorNorm()](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102 "Computes the L2 operator norm.") ``` #include <Eigen/Eigenvalues> ``` | | | --- | | | | class | [Eigen::ComplexEigenSolver< \_MatrixType >](classeigen_1_1complexeigensolver) | | | Computes eigenvalues and eigenvectors of general complex matrices. [More...](classeigen_1_1complexeigensolver#details) | | | | class | [Eigen::ComplexSchur< \_MatrixType >](classeigen_1_1complexschur) | | | Performs a complex Schur decomposition of a real or complex square matrix. [More...](classeigen_1_1complexschur#details) | | | | class | [Eigen::EigenSolver< \_MatrixType >](classeigen_1_1eigensolver) | | | Computes eigenvalues and eigenvectors of general matrices. [More...](classeigen_1_1eigensolver#details) | | | | class | [Eigen::GeneralizedEigenSolver< \_MatrixType >](classeigen_1_1generalizedeigensolver) | | | Computes the generalized eigenvalues and eigenvectors of a pair of general matrices. [More...](classeigen_1_1generalizedeigensolver#details) | | | | class | [Eigen::GeneralizedSelfAdjointEigenSolver< \_MatrixType >](classeigen_1_1generalizedselfadjointeigensolver) | | | Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem. [More...](classeigen_1_1generalizedselfadjointeigensolver#details) | | | | class | [Eigen::HessenbergDecomposition< \_MatrixType >](classeigen_1_1hessenbergdecomposition) | | | Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation. [More...](classeigen_1_1hessenbergdecomposition#details) | | | | class | [Eigen::RealQZ< \_MatrixType >](classeigen_1_1realqz) | | | Performs a real QZ decomposition of a pair of square matrices. [More...](classeigen_1_1realqz#details) | | | | class | [Eigen::RealSchur< \_MatrixType >](classeigen_1_1realschur) | | | Performs a real Schur decomposition of a square matrix. [More...](classeigen_1_1realschur#details) | | | | class | [Eigen::SelfAdjointEigenSolver< \_MatrixType >](classeigen_1_1selfadjointeigensolver) | | | Computes eigenvalues and eigenvectors of selfadjoint matrices. [More...](classeigen_1_1selfadjointeigensolver#details) | | | | class | [Eigen::Tridiagonalization< \_MatrixType >](classeigen_1_1tridiagonalization) | | | Tridiagonal decomposition of a selfadjoint matrix. [More...](classeigen_1_1tridiagonalization#details) | | | eigen3 Using Eigen in CUDA kernels Using Eigen in CUDA kernels =========================== Staring from CUDA 5.5 and [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3, it is possible to use [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s matrices, vectors, and arrays for fixed size within CUDA kernels. This is especially useful when working on numerous but small problems. By default, when [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s headers are included within a .cu file compiled by nvcc most [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s functions and methods are prefixed by the `**device**` `**host**` keywords making them callable from both host and device code. This support can be disabled by defining `EIGEN_NO_CUDA` before including any [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s header. This might be useful to disable some warnings when a .cu file makes use of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") on the host side only. However, in both cases, host's SIMD vectorization has to be disabled in .cu files. It is thus **strongly** **recommended** to properly move all costly host computation from your .cu files to regular .cpp files. Known issues: * `nvcc` with MS Visual Studio does not work (patch welcome) * `nvcc` 5.5 with gcc-4.7 (or greater) has issues with the standard `<limits>` header file. To workaround this, you can add the following before including any other files: ``` // workaround issue between gcc >= 4.7 and cuda 5.5 #if (defined \_\_GNUC\_\_) && (\_\_GNUC\_\_>4 || \_\_GNUC\_MINOR\_\_>=7) #undef \_GLIBCXX\_ATOMIC\_BUILTINS #undef \_GLIBCXX\_USE\_INT128 #endif ``` * On 64bits system [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") uses `long` `int` as the default type for indexes and sizes. On CUDA device, it would make sense to default to 32 bits `int`. However, to keep host and CUDA code compatible, this cannot be done automatically by Eigen, and the user is thus required to define `EIGEN_DEFAULT_DENSE_INDEX_TYPE` to `int` throughout his code (or only for CUDA code if there is no interaction between host and CUDA code through Eigen's object). eigen3 Eigen::COLAMDOrdering Eigen::COLAMDOrdering ===================== ### template<typename StorageIndex> class Eigen::COLAMDOrdering< StorageIndex > Template Parameters | | | | --- | --- | | StorageIndex | The type of indices of the matrix | Functor computing the *column* *approximate* *minimum* *degree* ordering The matrix should be in column-major and **compressed** format (see [SparseMatrix::makeCompressed()](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd)). | | | --- | | | | template<typename MatrixType > | | void | [operator()](classeigen_1_1colamdordering#a708cb20191dcd79856d922f262405946) (const MatrixType &mat, [PermutationType](classeigen_1_1permutationmatrix) &perm) | | | operator()() ------------ template<typename StorageIndex > template<typename MatrixType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::COLAMDOrdering](classeigen_1_1colamdordering)< StorageIndex >::operator() | ( | const MatrixType & | *mat*, | | | | [PermutationType](classeigen_1_1permutationmatrix) & | *perm* | | | ) | | | | inline | Compute the permutation vector *perm* form the sparse matrix *mat* Warning The input sparse matrix *mat* must be in compressed mode (see [SparseMatrix::makeCompressed()](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd)). --- The documentation for this class was generated from the following file:* [Ordering.h](https://eigen.tuxfamily.org/dox/Ordering_8h_source.html) eigen3 Eigen::MapBase Eigen::MapBase ============== ### template<typename Derived> class Eigen::MapBase< Derived, ReadOnlyAccessors > Base class for dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") expression with direct access. This base class provides the const low-level accessors (e.g. coeff, coeffRef) of dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") objects with direct access. Typical users do not have to directly deal with this class. This class can be extended by through the macro plugin `EIGEN_MAPBASE_PLUGIN`. See [customizing Eigen](topiccustomizing_plugins) for details. The `Derived` class has to provide the following two methods describing the memory layout: ``` [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) innerStride() const; ``` ``` [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) outerStride() const; ``` See also class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."), class [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") | | | --- | | | | const Scalar & | [coeff](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#aea142bb9ac9aa1b8c6b44f413daa4b88) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index) const | | | | const Scalar & | [coeff](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#a6d8ebb28996655c441d5d744ac227c8d) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rowId, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) colId) const | | | | const Scalar & | [coeffRef](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#a474a755c6699eeeb9fd4fc70c502cdec) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index) const | | | | const Scalar & | [coeffRef](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#acaf91005e3230bbffe1c69a4199a0506) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rowId, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) colId) const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [cols](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#adb0a19af0c52f9f36160abe0d2de67e1) () const EIGEN\_NOEXCEPT | | | | const Scalar \* | [data](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#a1bee30414766e9116a7abed067ca8007) () const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [rows](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#abc334ba08270706556366d1cfbb05d95) () const EIGEN\_NOEXCEPT | | | coeff() [1/2] ------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const Scalar& Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::coeff | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *index* | ) | const | | inline | This is an overloaded version of [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. See [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) for details. coeff() [2/2] ------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const Scalar& Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::coeff | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rowId*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *colId* | | | ) | | const | | inline | This is an overloaded version of [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. See [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) for details. coeffRef() [1/2] ---------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const Scalar& Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::coeffRef | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *index* | ) | const | | inline | This is the const version of coeffRef(Index) which is thus synonym of coeff(Index). It is provided for convenience. coeffRef() [2/2] ---------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const Scalar& Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::coeffRef | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rowId*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *colId* | | | ) | | const | | inline | This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index). It is provided for convenience. cols() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::cols | ( | void | | ) | const | | inline | Returns the number of columns. See also [rows()](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#abc334ba08270706556366d1cfbb05d95), ColsAtCompileTime data() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Scalar\* Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::data | ( | | ) | const | | inline | Returns a pointer to the first coefficient of the matrix or vector. Note When addressing this data, make sure to honor the strides returned by innerStride() and outerStride(). See also innerStride(), outerStride() rows() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) Eigen::MapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::rows | ( | void | | ) | const | | inline | Returns the number of rows. See also [cols()](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#adb0a19af0c52f9f36160abe0d2de67e1), RowsAtCompileTime --- The documentation for this class was generated from the following file:* [MapBase.h](https://eigen.tuxfamily.org/dox/MapBase_8h_source.html) eigen3 Eigen::SelfAdjointEigenSolver Eigen::SelfAdjointEigenSolver ============================= ### template<typename \_MatrixType> class Eigen::SelfAdjointEigenSolver< \_MatrixType > Computes eigenvalues and eigenvectors of selfadjoint matrices. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | A matrix \( A \) is selfadjoint if it equals its adjoint. For real matrices, this means that the matrix is symmetric: it equals its transpose. This class computes the eigenvalues and eigenvectors of a selfadjoint matrix. These are the scalars \( \lambda \) and vectors \( v \) such that \( Av = \lambda v \). The eigenvalues of a selfadjoint matrix are always real. If \( D \) is a diagonal matrix with the eigenvalues on the diagonal, and \( V \) is a matrix with the eigenvectors as its columns, then \( A = V D V^{-1} \). This is called the eigendecomposition. For a selfadjoint matrix, \( V \) is unitary, meaning its inverse is equal to its adjoint, \( V^{-1} = V^{\dagger} \). If \( A \) is real, then \( V \) is also real and therefore orthogonal, meaning its inverse is equal to its transpose, \( V^{-1} = V^T \). The algorithm exploits the fact that the matrix is selfadjoint, making it faster and more accurate than the general purpose eigenvalue algorithms implemented in [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices.") and [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices."). Only the **lower** **triangular** **part** of the input matrix is referenced. Call the function [compute()](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24 "Computes eigendecomposition of given matrix.") to compute the eigenvalues and eigenvectors of a given matrix. Alternatively, you can use the SelfAdjointEigenSolver(const MatrixType&, int) constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix.") and [eigenvectors()](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266 "Returns the eigenvectors of given matrix.") functions. The documentation for SelfAdjointEigenSolver(const MatrixType&, int) contains an example of the typical use of this class. To solve the *generalized* eigenvalue problem \( Av = \lambda Bv \) and the likes, see the class [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem."). See also [MatrixBase::eigenvalues()](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d "Computes the eigenvalues of a matrix."), class [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") | | | --- | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) | | | | typedef [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f) >::Real | [RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) | | | Real scalar type for `_MatrixType`. [More...](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) | | | | typedef internal::plain\_col\_type< MatrixType, [RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) >::type | [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) | | | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix."). [More...](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f) | | | Scalar type for matrices of type `_MatrixType`. | | | | | | --- | | | | template<typename InputType > | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) & | [compute](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Computes eigendecomposition of given matrix. [More...](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24) | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) & | [computeDirect](classeigen_1_1selfadjointeigensolver#afe520161701f5f585bcc4cedb8657bd1) (const MatrixType &matrix, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Computes eigendecomposition of given matrix using a closed-form algorithm. [More...](classeigen_1_1selfadjointeigensolver#afe520161701f5f585bcc4cedb8657bd1) | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) & | [computeFromTridiagonal](classeigen_1_1selfadjointeigensolver#a297893df7098c43278d385e4d4e23fe4) (const [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) &diag, const [SubDiagonalType](classeigen_1_1matrix) &subdiag, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Computes the eigen decomposition from a tridiagonal symmetric matrix. [More...](classeigen_1_1selfadjointeigensolver#a297893df7098c43278d385e4d4e23fe4) | | | | const [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) & | [eigenvalues](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41) () const | | | Returns the eigenvalues of given matrix. [More...](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41) | | | | const [EigenvectorsType](classeigen_1_1matrix) & | [eigenvectors](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266) () const | | | Returns the eigenvectors of given matrix. [More...](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1selfadjointeigensolver#a31e8a509231e57e684c53799693607ae) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1selfadjointeigensolver#a31e8a509231e57e684c53799693607ae) | | | | MatrixType | [operatorInverseSqrt](classeigen_1_1selfadjointeigensolver#ae4b13fe4ce22faf74e50d346fc51a66e) () const | | | Computes the inverse square root of the matrix. [More...](classeigen_1_1selfadjointeigensolver#ae4b13fe4ce22faf74e50d346fc51a66e) | | | | MatrixType | [operatorSqrt](classeigen_1_1selfadjointeigensolver#aeeedb2ae618f21a4eb59465746c1cee5) () const | | | Computes the positive-definite square root of the matrix. [More...](classeigen_1_1selfadjointeigensolver#aeeedb2ae618f21a4eb59465746c1cee5) | | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver#a8f3dde67faa971dd97e8141617762326) () | | | Default constructor for fixed-size matrices. [More...](classeigen_1_1selfadjointeigensolver#a8f3dde67faa971dd97e8141617762326) | | | | template<typename InputType > | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver#a7d8cba55cce60cb3931148208cc5bd0e) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Constructor; computes eigendecomposition of given matrix. [More...](classeigen_1_1selfadjointeigensolver#a7d8cba55cce60cb3931148208cc5bd0e) | | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver#a825919ee41153a19910c72d1bff31c8e) ([Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) size) | | | Constructor, pre-allocates memory for dynamic-size matrices. [More...](classeigen_1_1selfadjointeigensolver#a825919ee41153a19910c72d1bff31c8e) | | | | | | --- | | | | static const int | [m\_maxIterations](classeigen_1_1selfadjointeigensolver#a9ba10b83f095b18dbea345db7304acfa) | | | Maximum number of iterations. [More...](classeigen_1_1selfadjointeigensolver#a9ba10b83f095b18dbea345db7304acfa) | | | Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::[Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) | **[Deprecated:](deprecated#_deprecated000019)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 RealScalar ---------- template<typename \_MatrixType > | | | --- | | typedef [NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f)>::Real [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::[RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) | Real scalar type for `_MatrixType`. This is just `Scalar` if [Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f "Scalar type for matrices of type _MatrixType.") is real (e.g., `float` or `double`), and the type of the real part of `Scalar` if [Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f "Scalar type for matrices of type _MatrixType.") is complex. RealVectorType -------------- template<typename \_MatrixType > | | | --- | | typedef internal::plain\_col\_type<MatrixType, [RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd)>::type [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::[RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix."). This is a column vector with entries of type [RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd "Real scalar type for _MatrixType."). The length of the vector is the size of `_MatrixType`. SelfAdjointEigenSolver() [1/3] ------------------------------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::[SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) | ( | | ) | | | inline | Default constructor for fixed-size matrices. The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24 "Computes eigendecomposition of given matrix."). This constructor can only be used if `_MatrixType` is a fixed-size matrix; use [SelfAdjointEigenSolver(Index)](classeigen_1_1selfadjointeigensolver#a825919ee41153a19910c72d1bff31c8e "Constructor, pre-allocates memory for dynamic-size matrices.") for dynamic-size matrices. Example: ``` SelfAdjointEigenSolver<Matrix4f> es; Matrix4f X = [Matrix4f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); Matrix4f A = X + X.transpose(); es.compute(A); cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; es.compute(A + [Matrix4f::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(4,4)); // re-use es to compute eigenvalues of A+I cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; ``` Output: ``` The eigenvalues of A are: -1.58 -0.473 1.32 2.46 The eigenvalues of A+I are: -0.581 0.527 2.32 3.46 ``` SelfAdjointEigenSolver() [2/3] ------------------------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::[SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) | ( | [Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) | *size* | ) | | | inlineexplicit | Constructor, pre-allocates memory for dynamic-size matrices. Parameters | | | | | --- | --- | --- | | [in] | size | Positive integer, size of the matrix whose eigenvalues and eigenvectors will be computed. | This constructor is useful for dynamic-size matrices, when the user intends to perform decompositions via [compute()](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24 "Computes eigendecomposition of given matrix."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24 "Computes eigendecomposition of given matrix.") for an example SelfAdjointEigenSolver() [3/3] ------------------------------ template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::[SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | int | *options* = `[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)` | | | ) | | | | inlineexplicit | Constructor; computes eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Selfadjoint matrix whose eigendecomposition is to be computed. Only the lower triangular part of the matrix is referenced. | | [in] | options | Can be [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4) (default) or [EigenvaluesOnly](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906). | This constructor calls compute(const MatrixType&, int) to compute the eigenvalues of the matrix `matrix`. The eigenvectors are computed if `options` equals [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4). Example: ``` MatrixXd X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric 5x5 matrix, A:" << endl << A << endl << endl; SelfAdjointEigenSolver<MatrixXd> es(A); cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; double lambda = es.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXd v = es.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then lambda \* v = " << endl << lambda * v << endl; cout << "... and A \* v = " << endl << A * v << endl << endl; MatrixXd D = es.eigenvalues().asDiagonal(); MatrixXd V = es.eigenvectors(); cout << "Finally, V \* D \* V^(-1) = " << endl << V * D * V.inverse() << endl; ``` Output: ``` Here is a random symmetric 5x5 matrix, A: 1.36 -0.816 0.521 1.43 -0.144 -0.816 -0.659 0.794 -0.173 -0.406 0.521 0.794 -0.541 0.461 0.179 1.43 -0.173 0.461 -1.43 0.822 -0.144 -0.406 0.179 0.822 -1.37 The eigenvalues of A are: -2.65 -1.77 -0.745 0.227 2.29 The matrix of eigenvectors, V, is: -0.326 -0.0984 0.347 -0.0109 0.874 -0.207 -0.642 0.228 0.662 -0.232 0.0495 0.629 -0.164 0.74 0.164 0.721 -0.397 -0.402 0.115 0.385 -0.573 -0.156 -0.799 -0.0256 0.0858 Consider the first eigenvalue, lambda = -2.65 If v is the corresponding eigenvector, then lambda * v = 0.865 0.55 -0.131 -1.91 1.52 ... and A * v = 0.865 0.55 -0.131 -1.91 1.52 Finally, V * D * V^(-1) = 1.36 -0.816 0.521 1.43 -0.144 -0.816 -0.659 0.794 -0.173 -0.406 0.521 0.794 -0.541 0.461 0.179 1.43 -0.173 0.461 -1.43 0.822 -0.144 -0.406 0.179 0.822 -1.37 ``` See also compute(const MatrixType&, int) compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | --- | --- | --- | --- | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)& [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | int | *options* = `[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)` | | | ) | | | Computes eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Selfadjoint matrix whose eigendecomposition is to be computed. Only the lower triangular part of the matrix is referenced. | | [in] | options | Can be [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4) (default) or [EigenvaluesOnly](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906). | Returns Reference to `*this` This function computes the eigenvalues of `matrix`. The [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix.") function can be used to retrieve them. If `options` equals [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4), then the eigenvectors are also computed and can be retrieved by calling [eigenvectors()](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266 "Returns the eigenvectors of given matrix."). This implementation uses a symmetric QR algorithm. The matrix is first reduced to tridiagonal form using the [Tridiagonalization](classeigen_1_1tridiagonalization "Tridiagonal decomposition of a selfadjoint matrix.") class. The tridiagonal matrix is then brought to diagonal form with implicit symmetric QR steps with Wilkinson shift. Details can be found in Section 8.3 of Golub & Van Loan, *Matrix Computations*. The cost of the computation is about \( 9n^3 \) if the eigenvectors are required and \( 4n^3/3 \) if they are not required. This method reuses the memory in the [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") object that was allocated when the object was constructed, if the size of the matrix does not change. Example: ``` SelfAdjointEigenSolver<MatrixXf> es(4); MatrixXf X = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXf A = X + X.transpose(); es.compute(A); cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; es.compute(A + [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(4,4)); // re-use es to compute eigenvalues of A+I cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; ``` Output: ``` The eigenvalues of A are: -1.58 -0.473 1.32 2.46 The eigenvalues of A+I are: -0.581 0.527 2.32 3.46 ``` See also SelfAdjointEigenSolver(const MatrixType&, int) computeDirect() --------------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< MatrixType > & [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< MatrixType >::computeDirect | ( | const MatrixType & | *matrix*, | | | | int | *options* = `[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)` | | | ) | | | Computes eigendecomposition of given matrix using a closed-form algorithm. This is a variant of compute(const MatrixType&, int options) which directly solves the underlying polynomial equation. Currently only 2x2 and 3x3 matrices for which the sizes are known at compile time are supported (e.g., Matrix3d). This method is usually significantly faster than the QR iterative algorithm but it might also be less accurate. It is also worth noting that for 3x3 matrices it involves trigonometric operations which are not necessarily available for all scalar types. For the 3x3 case, we observed the following worst case relative error regarding the eigenvalues: * double: 1e-8 * float: 1e-3 See also compute(const MatrixType&, int options) computeFromTridiagonal() ------------------------ template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< MatrixType > & [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< MatrixType >::computeFromTridiagonal | ( | const [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) & | *diag*, | | | | const [SubDiagonalType](classeigen_1_1matrix) & | *subdiag*, | | | | int | *options* = `[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)` | | | ) | | | Computes the eigen decomposition from a tridiagonal symmetric matrix. Parameters | | | | | --- | --- | --- | | [in] | diag | The vector containing the diagonal of the matrix. | | [in] | subdiag | The subdiagonal of the matrix. | | [in] | options | Can be [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4) (default) or [EigenvaluesOnly](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906). | Returns Reference to `*this` This function assumes that the matrix has been reduced to tridiagonal form. See also compute(const MatrixType&, int) for more information eigenvalues() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287)& [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::eigenvalues | ( | | ) | const | | inline | Returns the eigenvalues of given matrix. Returns A const reference to the column vector containing the eigenvalues. Precondition The eigenvalues have been computed before. The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are sorted in increasing order. Example: ``` MatrixXd ones = [MatrixXd::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); SelfAdjointEigenSolver<MatrixXd> es(ones); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << es.eigenvalues() << endl; ``` Output: ``` The eigenvalues of the 3x3 matrix of ones are: -3.09e-16 0 3 ``` See also [eigenvectors()](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266 "Returns the eigenvectors of given matrix."), [MatrixBase::eigenvalues()](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d "Computes the eigenvalues of a matrix.") eigenvectors() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [EigenvectorsType](classeigen_1_1matrix)& [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::eigenvectors | ( | | ) | const | | inline | Returns the eigenvectors of given matrix. Returns A const reference to the matrix whose columns are the eigenvectors. Precondition The eigenvectors have been computed before. Column \( k \) of the returned matrix is an eigenvector corresponding to eigenvalue number \( k \) as returned by [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix."). The eigenvectors are normalized to have (Euclidean) norm equal to one. If this object was used to solve the eigenproblem for the selfadjoint matrix \( A \), then the matrix returned by this function is the matrix \( V \) in the eigendecomposition \( A = V D V^{-1} \). For a selfadjoint matrix, \( V \) is unitary, meaning its inverse is equal to its adjoint, \( V^{-1} = V^{\dagger} \). If \( A \) is real, then \( V \) is also real and therefore orthogonal, meaning its inverse is equal to its transpose, \( V^{-1} = V^T \). Example: ``` MatrixXd ones = [MatrixXd::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); SelfAdjointEigenSolver<MatrixXd> es(ones); cout << "The first eigenvector of the 3x3 matrix of ones is:" << endl << es.eigenvectors().col(0) << endl; ``` Output: ``` The first eigenvector of the 3x3 matrix of ones is: -0.816 0.408 0.408 ``` See also [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix.") info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NoConvergence` otherwise. operatorInverseSqrt() --------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | MatrixType [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::operatorInverseSqrt | ( | | ) | const | | inline | Computes the inverse square root of the matrix. Returns the inverse positive-definite square root of the matrix Precondition The eigenvalues and eigenvectors of a positive-definite matrix have been computed before. This function uses the eigendecomposition \( A = V D V^{-1} \) to compute the inverse square root as \( V D^{-1/2} V^{-1} \). This is cheaper than first computing the square root with [operatorSqrt()](classeigen_1_1selfadjointeigensolver#aeeedb2ae618f21a4eb59465746c1cee5 "Computes the positive-definite square root of the matrix.") and then its inverse with [MatrixBase::inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf). Example: ``` MatrixXd X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXd A = X * X.transpose(); cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; SelfAdjointEigenSolver<MatrixXd> es(A); cout << "The inverse square root of A is: " << endl; cout << es.operatorInverseSqrt() << endl; cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl; cout << es.operatorSqrt().inverse() << endl; ``` Output: ``` Here is a random positive-definite matrix, A: 1.41 -0.697 -0.111 0.508 -0.697 0.423 0.0991 -0.4 -0.111 0.0991 1.25 0.902 0.508 -0.4 0.902 1.4 The inverse square root of A is: 1.88 2.78 -0.546 0.605 2.78 8.61 -2.3 2.74 -0.546 -2.3 1.92 -1.36 0.605 2.74 -1.36 2.18 We can also compute it with operatorSqrt() and inverse(). That yields: 1.88 2.78 -0.546 0.605 2.78 8.61 -2.3 2.74 -0.546 -2.3 1.92 -1.36 0.605 2.74 -1.36 2.18 ``` See also [operatorSqrt()](classeigen_1_1selfadjointeigensolver#aeeedb2ae618f21a4eb59465746c1cee5 "Computes the positive-definite square root of the matrix."), [MatrixBase::inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), [MatrixFunctions Module](unsupported/group__matrixfunctions__module) operatorSqrt() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | MatrixType [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::operatorSqrt | ( | | ) | const | | inline | Computes the positive-definite square root of the matrix. Returns the positive-definite square root of the matrix Precondition The eigenvalues and eigenvectors of a positive-definite matrix have been computed before. The square root of a positive-definite matrix \( A \) is the positive-definite matrix whose square equals \( A \). This function uses the eigendecomposition \( A = V D V^{-1} \) to compute the square root as \( A^{1/2} = V D^{1/2} V^{-1} \). Example: ``` MatrixXd X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXd A = X * X.transpose(); cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl; SelfAdjointEigenSolver<MatrixXd> es(A); MatrixXd sqrtA = es.operatorSqrt(); cout << "The square root of A is: " << endl << sqrtA << endl; cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl; ``` Output: ``` Here is a random positive-definite matrix, A: 1.41 -0.697 -0.111 0.508 -0.697 0.423 0.0991 -0.4 -0.111 0.0991 1.25 0.902 0.508 -0.4 0.902 1.4 The square root of A is: 1.09 -0.432 -0.0685 0.2 -0.432 0.379 0.141 -0.269 -0.0685 0.141 1 0.468 0.2 -0.269 0.468 1.04 If we square this, we get: 1.41 -0.697 -0.111 0.508 -0.697 0.423 0.0991 -0.4 -0.111 0.0991 1.25 0.902 0.508 -0.4 0.902 1.4 ``` See also [operatorInverseSqrt()](classeigen_1_1selfadjointeigensolver#ae4b13fe4ce22faf74e50d346fc51a66e "Computes the inverse square root of the matrix."), [MatrixFunctions Module](unsupported/group__matrixfunctions__module) m\_maxIterations ---------------- template<typename \_MatrixType > | | | | | --- | --- | --- | | | | | --- | | const int [Eigen::SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver)< \_MatrixType >::m\_maxIterations | | static | Maximum number of iterations. The algorithm terminates if it does not converge within m\_maxIterations \* n iterations, where n denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK). --- The documentation for this class was generated from the following file:* [SelfAdjointEigenSolver.h](https://eigen.tuxfamily.org/dox/SelfAdjointEigenSolver_8h_source.html)
programming_docs
eigen3 Eigen::CwiseUnaryOp Eigen::CwiseUnaryOp =================== ### template<typename UnaryOp, typename XprType> class Eigen::CwiseUnaryOp< UnaryOp, XprType > Generic expression where a coefficient-wise unary operator is applied to an expression. Template Parameters | | | | --- | --- | | UnaryOp | template functor implementing the operator | | XprType | the type of the expression to which we are applying the unary operator | This class represents an expression where a unary operator is applied to an expression. It is the return type of all operations taking exactly 1 input expression, regardless of the presence of other inputs such as scalars. For example, the operator\* in the expression 3\*matrix is considered unary, because only the right-hand side is an expression, and its return type is a specialization of [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression."). Most of the time, this is the only way that it is used, so you typically don't have to name [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") types explicitly. See also MatrixBase::unaryExpr(const CustomUnaryOp &) const, class [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions."), class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor.") Inherits Eigen::CwiseUnaryOpImpl< UnaryOp, XprType, internal::traits< XprType >::StorageKind >, and Eigen::internal::no\_assignment\_operator. | | | --- | | | | const UnaryOp & | [functor](classeigen_1_1cwiseunaryop#aa70041dd94ec46f330cf19a06425d172) () const | | | | internal::remove\_all< XprTypeNested >::type & | [nestedExpression](classeigen_1_1cwiseunaryop#a073345b7e19f058c1890f8538e0cfd96) () | | | | const internal::remove\_all< XprTypeNested >::type & | [nestedExpression](classeigen_1_1cwiseunaryop#a89589b919998657056de6378dd7dedc3) () const | | | functor() --------- template<typename UnaryOp , typename XprType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const UnaryOp& [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< UnaryOp, XprType >::functor | ( | | ) | const | | inline | Returns the functor representing the unary operation nestedExpression() [1/2] ------------------------ template<typename UnaryOp , typename XprType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::remove\_all<XprTypeNested>::type& [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< UnaryOp, XprType >::nestedExpression | ( | | ) | | | inline | Returns the nested expression nestedExpression() [2/2] ------------------------ template<typename UnaryOp , typename XprType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::remove\_all<XprTypeNested>::type& [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< UnaryOp, XprType >::nestedExpression | ( | | ) | const | | inline | Returns the nested expression --- The documentation for this class was generated from the following file:* [CwiseUnaryOp.h](https://eigen.tuxfamily.org/dox/CwiseUnaryOp_8h_source.html) eigen3 Eigen::TranspositionsStorage Eigen::TranspositionsStorage ============================ The type used to identify a permutation storage. --- The documentation for this struct was generated from the following file:* [Constants.h](https://eigen.tuxfamily.org/dox/Constants_8h_source.html) eigen3 Eigen::SimplicialCholesky Eigen::SimplicialCholesky ========================= ### template<typename \_MatrixType, int \_UpLo, typename \_Ordering> class Eigen::SimplicialCholesky< \_MatrixType, \_UpLo, \_Ordering > **[Deprecated:](deprecated#_deprecated000032)** use [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") or class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") See also class [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root."), class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") | | | --- | | | | void | [analyzePattern](classeigen_1_1simplicialcholesky#a6af3f64b855a96a2635302f863b5fd91) (const MatrixType &a) | | | | [SimplicialCholesky](classeigen_1_1simplicialcholesky) & | [compute](classeigen_1_1simplicialcholesky#a7883b49a88b26162ba6d8b044e2ee75b) (const MatrixType &matrix) | | | | void | [factorize](classeigen_1_1simplicialcholesky#ab1b21d430cc2a8e332221313a4f2f2e3) (const MatrixType &a) | | | | Public Member Functions inherited from [Eigen::SimplicialCholeskyBase< SimplicialCholesky< \_MatrixType, \_UpLo, \_Ordering > >](classeigen_1_1simplicialcholeskybase) | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1simplicialcholeskybase#a3ac877f73aaaff670e6ae7554eb02fc8) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1simplicialcholeskybase#a3ac877f73aaaff670e6ae7554eb02fc8) | | | | const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, StorageIndex > & | [permutationP](classeigen_1_1simplicialcholeskybase#aff1480e595a21726beaec9a586a94d5a) () const | | | | const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, StorageIndex > & | [permutationPinv](classeigen_1_1simplicialcholeskybase#a0e23d1f4a88c211be7098faf1cb41674) () const | | | | [SimplicialCholesky](classeigen_1_1simplicialcholesky)< \_MatrixType, \_UpLo, \_Ordering > & | [setShift](classeigen_1_1simplicialcholeskybase#a362352f755101faaac59c1ed9d5e3559) (const RealScalar &offset, const RealScalar &scale=1) | | | | | [SimplicialCholeskyBase](classeigen_1_1simplicialcholeskybase#a098baba1dbe07ca3a775c8df1f8a0e71) () | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< SimplicialCholesky< \_MatrixType, \_UpLo, \_Ordering > >](classeigen_1_1sparsesolverbase) | | const [Solve](classeigen_1_1solve)< [SimplicialCholesky](classeigen_1_1simplicialcholesky)< \_MatrixType, \_UpLo, \_Ordering >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | const [Solve](classeigen_1_1solve)< [SimplicialCholesky](classeigen_1_1simplicialcholesky)< \_MatrixType, \_UpLo, \_Ordering >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | | | | --- | | | | Protected Member Functions inherited from [Eigen::SimplicialCholeskyBase< SimplicialCholesky< \_MatrixType, \_UpLo, \_Ordering > >](classeigen_1_1simplicialcholeskybase) | | void | [compute](classeigen_1_1simplicialcholeskybase#a9a741744dda2261cae26cddf96a35bf0) (const MatrixType &matrix) | | | analyzePattern() ---------------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SimplicialCholesky](classeigen_1_1simplicialcholesky)< \_MatrixType, \_UpLo, \_Ordering >::analyzePattern | ( | const MatrixType & | *a* | ) | | | inline | Performs a symbolic decomposition on the sparcity of *matrix*. This function is particularly useful when solving for several problems having the same structure. See also [factorize()](classeigen_1_1simplicialcholesky#ab1b21d430cc2a8e332221313a4f2f2e3) compute() --------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [SimplicialCholesky](classeigen_1_1simplicialcholesky)& [Eigen::SimplicialCholesky](classeigen_1_1simplicialcholesky)< \_MatrixType, \_UpLo, \_Ordering >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Computes the sparse Cholesky decomposition of *matrix* factorize() ----------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SimplicialCholesky](classeigen_1_1simplicialcholesky)< \_MatrixType, \_UpLo, \_Ordering >::factorize | ( | const MatrixType & | *a* | ) | | | inline | Performs a numeric decomposition of *matrix* The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. See also [analyzePattern()](classeigen_1_1simplicialcholesky#a6af3f64b855a96a2635302f863b5fd91) --- The documentation for this class was generated from the following file:* [SimplicialCholesky.h](https://eigen.tuxfamily.org/dox/SimplicialCholesky_8h_source.html) eigen3 Getting started Getting started =============== This is a very short guide on how to get started with [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). It has a dual purpose. It serves as a minimal introduction to the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") library for people who want to start coding as soon as possible. You can also read this page as the first part of the Tutorial, which explains the library in more detail; in this case you will continue with [The Matrix class](group__tutorialmatrixclass). How to "install" Eigen? ========================= In order to use [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), you just need to download and extract [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s source code (see [the wiki](http://eigen.tuxfamily.org/index.php?title=Main_Page#Download) for download instructions). In fact, the header files in the `[Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")` subdirectory are the only files required to compile programs using [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). The header files are the same for all platforms. It is not necessary to use CMake or install anything. A simple first program ======================== Here is a rather simple program to get you started. ``` #include <iostream> #include <Eigen/Dense> using [Eigen::MatrixXd](classeigen_1_1matrix); int main() { MatrixXd m(2,2); m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); std::cout << m << std::endl; } ``` We will explain the program after telling you how to compile it. Compiling and running your first program ========================================== There is no library to link to. The only thing that you need to keep in mind when compiling the above program is that the compiler must be able to find the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") header files. The directory in which you placed [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s source code must be in the include path. With GCC you use the -I option to achieve this, so you can compile the program with a command like this: ``` g++ -I /path/to/eigen/ my_program.cpp -o my_program ``` On Linux or Mac OS X, another option is to symlink or copy the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") folder into /usr/local/include/. This way, you can compile the program with: ``` g++ my_program.cpp -o my_program ``` When you run the program, it produces the following output: ``` 3 -1 2.5 1.5 ``` Explanation of the first program ================================== The [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") header files define many types, but for simple applications it may be enough to use only the `MatrixXd` type. This represents a matrix of arbitrary size (hence the `X` in `MatrixXd`), in which every entry is a `double` (hence the `d` in `MatrixXd`). See the [quick reference guide](group__quickrefpage#QuickRef_Types) for an overview of the different types you can use to represent a matrix. The `Eigen/Dense` header file defines all member functions for the MatrixXd type and related types (see also the [table of header files](group__quickrefpage#QuickRef_Headers)). All classes and functions defined in this header file (and other [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") header files) are in the `[Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")` namespace. The first line of the `main` function declares a variable of type `MatrixXd` and specifies that it is a matrix with 2 rows and 2 columns (the entries are not initialized). The statement `m(0,0) = 3` sets the entry in the top-left corner to 3. You need to use round parentheses to refer to entries in the matrix. As usual in computer science, the index of the first index is 0, as opposed to the convention in mathematics that the first index is 1. The following three statements sets the other three entries. The final line outputs the matrix `m` to the standard output stream. Example 2: Matrices and vectors ================================= Here is another example, which combines matrices with vectors. Concentrate on the left-hand program for now; we will talk about the right-hand program later. | Size set at run time: | Size set at compile time: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace [Eigen](namespaceeigen); using namespace std; int main() { MatrixXd m = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,3); m = (m + [MatrixXd::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(3,3,1.2)) * 50; cout << "m =" << endl << m << endl; VectorXd v(3); v << 1, 2, 3; cout << "m \* v =" << endl << m * v << endl; } ``` | ``` #include <iostream> #include <Eigen/Dense> using namespace [Eigen](namespaceeigen); using namespace std; int main() { Matrix3d m = [Matrix3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); m = (m + [Matrix3d::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(1.2)) * 50; cout << "m =" << endl << m << endl; Vector3d v(1,2,3); cout << "m \* v =" << endl << m * v << endl; } ``` | The output is as follows: ``` m = 94 89.8 43.5 49.4 101 86.8 88.3 29.8 37.8 m * v = 404 512 261 ``` Explanation of the second example =================================== The second example starts by declaring a 3-by-3 matrix `m` which is initialized using the [Random()](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) method with random values between -1 and 1. The next line applies a linear mapping such that the values are between 10 and 110. The function call [MatrixXd::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(3,3,1.2) returns a 3-by-3 matrix expression having all coefficients equal to 1.2. The rest is standard arithmetic. The next line of the `main` function introduces a new type: `VectorXd`. This represents a (column) vector of arbitrary size. Here, the vector `v` is created to contain `3` coefficients which are left uninitialized. The one but last line uses the so-called comma-initializer, explained in [Advanced initialization](group__tutorialadvancedinitialization), to set all coefficients of the vector `v` to be as follows: \[ v = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}. \] The final line of the program multiplies the matrix `m` with the vector `v` and outputs the result. Now look back at the second example program. We presented two versions of it. In the version in the left column, the matrix is of type `MatrixXd` which represents matrices of arbitrary size. The version in the right column is similar, except that the matrix is of type `Matrix3d`, which represents matrices of a fixed size (here 3-by-3). Because the type already encodes the size of the matrix, it is not necessary to specify the size in the constructor; compare `MatrixXd m(3,3)` with `Matrix3d m`. Similarly, we have `VectorXd` on the left (arbitrary size) versus `Vector3d` on the right (fixed size). Note that here the coefficients of vector `v` are directly set in the constructor, though the same syntax of the left example could be used too. The use of fixed-size matrices and vectors has two advantages. The compiler emits better (faster) code because it knows the size of the matrices and vectors. Specifying the size in the type also allows for more rigorous checking at compile-time. For instance, the compiler will complain if you try to multiply a `Matrix4d` (a 4-by-4 matrix) with a `Vector3d` (a vector of size 3). However, the use of many types increases compilation time and the size of the executable. The size of the matrix may also not be known at compile-time. A rule of thumb is to use fixed-size matrices for size 4-by-4 and smaller. Where to go from here? ======================== It's worth taking the time to read the [long tutorial](group__tutorialmatrixclass). However if you think you don't need it, you can directly use the classes documentation and our [Quick reference guide](group__quickrefpage). * **Next:** [The Matrix class](group__tutorialmatrixclass) eigen3 Eigen::ForceAlignedAccess Eigen::ForceAlignedAccess ========================= ### template<typename ExpressionType> class Eigen::ForceAlignedAccess< ExpressionType > Enforce aligned packet loads and stores regardless of what is requested. Parameters | | | | --- | --- | | ExpressionType | the type of the object of which we are forcing aligned packet access | This class is the return type of [MatrixBase::forceAlignedAccess()](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699) and most of the time this is the only way it is used. See also [MatrixBase::forceAlignedAccess()](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699) Inherits internal::dense\_xpr\_base::type. --- The documentation for this class was generated from the following file:* [ForceAlignedAccess.h](https://eigen.tuxfamily.org/dox/ForceAlignedAccess_8h_source.html) eigen3 Deprecated List Deprecated List =============== Member [Eigen::Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) Synonym for Aligned16. Member [Eigen::AlignedBit](group__flags#gac5795adacd266512a26890973503ed88) Member [Eigen::AlignedBox< \_Scalar, \_AmbientDim >::Index](classeigen_1_1alignedbox#a774ef355da13d6bee6a6e7244c15231a) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::AlignedBox< \_Scalar, \_AmbientDim >::isNull](classeigen_1_1alignedbox#a37b401dd265c942c9ef2db1e2b1e56e5) () const use [isEmpty()](classeigen_1_1alignedbox#a2d994551368f0d06876a31dccb26de59) Member [Eigen::AlignedBox< \_Scalar, \_AmbientDim >::setNull](classeigen_1_1alignedbox#a2399d72bf7dbd9f3589c69f32cbec306) () use [setEmpty()](classeigen_1_1alignedbox#a16bc3e6779107a091f08e4cb7e36e793) Member [Eigen::AlignedScaling2d](namespaceeigen#af8975289b8134a5021e806029516e82c) Member [Eigen::AlignedScaling2f](namespaceeigen#af2440178a1f5f6abef6ee0231bc49184) Member [Eigen::AlignedScaling3d](namespaceeigen#a0aff001d5740f13797c9acd4e3276673) Member [Eigen::AlignedScaling3f](namespaceeigen#a45caf8b0e6da378885f4ae3f06c5cde3) Member [Eigen::ComplexEigenSolver< \_MatrixType >::Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::ComplexSchur< \_MatrixType >::Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::DenseBase< Derived >::flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const it now returns `*this` Member [Eigen::DenseBase< Derived >::lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const DenseBase< OtherDerived > &other) Member [Eigen::DenseBase< Derived >::LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const Scalar &low, const Scalar &high) because of accuracy loss. In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3, it is an alias for [LinSpaced(const Scalar&,const Scalar&)](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860 "Sets a linearly spaced vector.") Member [Eigen::DenseBase< Derived >::LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, Index size, const Scalar &low, const Scalar &high) because of accuracy loss. In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3, it is an alias for [LinSpaced(Index,const Scalar&,const Scalar&)](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768 "Sets a linearly spaced vector.") Member [Eigen::EigenSolver< \_MatrixType >::Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::EvalBeforeAssigningBit](group__flags#ga0972b20dc004d13984e642b3bd12532e) means the expression should be evaluated before any assignment Member [Eigen::GeneralizedEigenSolver< \_MatrixType >::Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::HessenbergDecomposition< \_MatrixType >::Index](classeigen_1_1hessenbergdecomposition#a8e287ac222f53e2c8ce82faa43e95ac6) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::Hyperplane< \_Scalar, \_AmbientDim, \_Options >::Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Class [Eigen::MappedSparseMatrix< \_Scalar, \_Flags, \_StorageIndex >](classeigen_1_1mappedsparsematrix) Use [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.")<SparseMatrix<> > Member [Eigen::ParametrizedLine< \_Scalar, \_AmbientDim, \_Options >::Index](classeigen_1_1parametrizedline#a3c9f84dd8608940282b16652a296c764) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::ParametrizedLine< \_Scalar, \_AmbientDim, \_Options >::intersection](classeigen_1_1parametrizedline#a980dc8dc59ea6de2fb496055181a1d08) (const Hyperplane< \_Scalar, \_AmbientDim, OtherOptions > &hyperplane) const use intersectionParameter() Member [Eigen::RealQZ< \_MatrixType >::Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::RealSchur< \_MatrixType >::Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::SelfAdjointEigenSolver< \_MatrixType >::Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Class [Eigen::SimplicialCholesky< \_MatrixType, \_UpLo, \_Ordering >](classeigen_1_1simplicialcholesky) use [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") or class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") Member [Eigen::Stride< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::SVDBase< Derived >::Index](classeigen_1_1svdbase#a6229a37997eca1072b52cca5ee7a2bec) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::Transform< \_Scalar, \_Dim, \_Mode, \_Options >::Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::TriangularViewImpl< \_MatrixType, \_Mode, Dense >::swap](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a0c1ece2f97341c7c7e698d67343421a5) (MatrixBase< OtherDerived > const &other) Member [Eigen::Tridiagonalization< \_MatrixType >::Index](classeigen_1_1tridiagonalization#a7bd1f9fccec1e93b77a2214b2d30aae9) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Member [Eigen::VectorwiseOp< ExpressionType, Direction >::Index](classeigen_1_1vectorwiseop#a4907c654e5810edd98e4162093b19532) since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3
programming_docs
eigen3 Eigen::TriangularViewImpl Eigen::TriangularViewImpl ========================= ### template<typename \_MatrixType, unsigned int \_Mode> class Eigen::TriangularViewImpl< \_MatrixType, \_Mode, Dense > Base class for a triangular part in a **dense** matrix. This class is an abstract base class of class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix."), and objects of type TriangularViewImpl cannot be instantiated. It extends class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix.") with additional methods which available for dense expressions only. See also class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix."), MatrixBase::triangularView() | | | --- | | | | Scalar | [coeff](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a51093bbf9d6c6bad6a8afee9c93d4b3f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | Scalar & | [coeffRef](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#afb8cc8b16f27fa263757506e818f3e7f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | template<typename DenseDerived > | | void | [evalToLazy](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#ab8db3e55eee50cdc56650b3498e235eb) ([MatrixBase](classeigen_1_1matrixbase)< DenseDerived > &other) const | | | | void | [fill](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#ab1086025ddef904f5fae0282de474d24) (const Scalar &value) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#ad3252106d7e004d3410238cab92e3258) () const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< [TriangularViewType](classeigen_1_1triangularview), OtherDerived > | [operator\*](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#ad21c964c4d5dff8aa496558ef74731f1) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &rhs) const | | | | [TriangularViewType](classeigen_1_1triangularview) & | [operator\*=](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#adb13b29d664962dc3f62551644f11e87) (const typename internal::traits< MatrixType >::Scalar &other) | | | | template<typename Other > | | [TriangularViewType](classeigen_1_1triangularview) & | [operator+=](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a1d2edf8ab80733b8b2620d8c2a3100d3) (const [DenseBase](classeigen_1_1densebase)< Other > &other) | | | | template<typename Other > | | [TriangularViewType](classeigen_1_1triangularview) & | [operator-=](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a79ff0326cd78da5bb2bdc4a88f5428c9) (const [DenseBase](classeigen_1_1densebase)< Other > &other) | | | | [TriangularViewType](classeigen_1_1triangularview) & | [operator/=](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#af1b9165f5ab6b57a8305c0dc359adf7c) (const typename internal::traits< MatrixType >::Scalar &other) | | | | template<typename OtherDerived > | | [TriangularViewType](classeigen_1_1triangularview) & | [operator=](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a09db8ccbd4b2da7c7e8d520458166cc1) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | [TriangularViewType](classeigen_1_1triangularview) & | [operator=](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a556c7e90c64e86a3a8e722989dda1bc6) (const [TriangularBase](classeigen_1_1triangularbase)< OtherDerived > &other) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#afe47788156e483b9025ab320cc7f925e) () const | | | | [TriangularViewType](classeigen_1_1triangularview) & | [setConstant](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a02574e5085e789ff9840d2b708e0126f) (const Scalar &value) | | | | [TriangularViewType](classeigen_1_1triangularview) & | [setOnes](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a4e6b3b2af8d0d6d06d14ec3c7092cffc) () | | | | [TriangularViewType](classeigen_1_1triangularview) & | [setZero](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a7530e86074859407aaec5132549b40ee) () | | | | template<int Side, typename Other > | | const internal::triangular\_solve\_retval< Side, [TriangularViewType](classeigen_1_1triangularview), Other > | [solve](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a911664ccf5522c778ffc5405247e8a59) (const [MatrixBase](classeigen_1_1matrixbase)< Other > &other) const | | | | template<int Side, typename OtherDerived > | | void | [solveInPlace](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a43bae99c287250d6092c8f8d1ba90e91) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED void | [swap](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a0c1ece2f97341c7c7e698d67343421a5) ([MatrixBase](classeigen_1_1matrixbase)< OtherDerived > const &other) | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a4e16e0824796bfa218cc91da98fe05b1) ([TriangularBase](classeigen_1_1triangularbase)< OtherDerived > &other) | | | | Public Member Functions inherited from [Eigen::TriangularBase< TriangularView< \_MatrixType, \_Mode > >](classeigen_1_1triangularbase) | | void | [copyCoeff](classeigen_1_1triangularbase#a0abe130a9130ac6df16f3c8c55490b43) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col, Other &other) | | | | void | [evalTo](classeigen_1_1triangularbase#a604d4f76a376ced36f8b9c3374c76c3e) ([MatrixBase](classeigen_1_1matrixbase)< DenseDerived > &other) const | | | | void | [evalToLazy](classeigen_1_1triangularbase#ab8db3e55eee50cdc56650b3498e235eb) ([MatrixBase](classeigen_1_1matrixbase)< DenseDerived > &other) const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | coeff() ------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::coeff | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | const | | inline | See also [MatrixBase::coeff()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) Warning the coordinates must fit into the referenced triangular part coeffRef() ---------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::coeffRef | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | See also MatrixBase::coeffRef() Warning the coordinates must fit into the referenced triangular part evalToLazy() ------------ template<typename \_MatrixType , unsigned int \_Mode> template<typename DenseDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::TriangularBase](classeigen_1_1triangularbase)< Derived >::evalToLazy | ( | typename DenseDerived | | ) | | Assigns a triangular or selfadjoint matrix to a dense matrix. If the matrix is triangular, the opposite part is set to zero. fill() ------ template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::fill | ( | const Scalar & | *value* | ) | | | inline | See also [MatrixBase::fill()](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) innerStride() ------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::innerStride | ( | | ) | const | | inline | Returns the inner-stride of the underlying dense matrix See also DenseCoeffsBase::innerStride() operator\*() ------------ template<typename \_MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<[TriangularViewType](classeigen_1_1triangularview),OtherDerived> Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *rhs* | ) | const | | inline | Efficient triangular matrix times vector/matrix product operator\*=() ------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator\*= | ( | const typename internal::traits< MatrixType >::Scalar & | *other* | ) | | | inline | See also [MatrixBase::operator\*=()](classeigen_1_1matrixbase#a3783b6168995ca117a1c19fea3630ac4) operator+=() ------------ template<typename \_MatrixType , unsigned int \_Mode> template<typename Other > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator+= | ( | const [DenseBase](classeigen_1_1densebase)< Other > & | *other* | ) | | | inline | See also [MatrixBase::operator+=()](classeigen_1_1matrixbase#a983cc3be0bbe11b3d041a415b76ce010) operator-=() ------------ template<typename \_MatrixType , unsigned int \_Mode> template<typename Other > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator-= | ( | const [DenseBase](classeigen_1_1densebase)< Other > & | *other* | ) | | | inline | See also [MatrixBase::operator-=()](classeigen_1_1matrixbase#a1042124b0ddee66e78ac7b0a9ac4cc9c) operator/=() ------------ template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator/= | ( | const typename internal::traits< MatrixType >::Scalar & | *other* | ) | | | inline | See also DenseBase::operator/=() operator=() [1/2] ----------------- template<typename \_MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator= | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | Shortcut for ``` *this = other.other.triangularView<(*this)::Mode>() ``` operator=() [2/2] ----------------- template<typename \_MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::operator= | ( | const [TriangularBase](classeigen_1_1triangularbase)< OtherDerived > & | *other* | ) | | Assigns a triangular matrix to a triangular part of a dense matrix outerStride() ------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::outerStride | ( | | ) | const | | inline | Returns the outer-stride of the underlying dense matrix See also DenseCoeffsBase::outerStride() setConstant() ------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::setConstant | ( | const Scalar & | *value* | ) | | | inline | See also [MatrixBase::setConstant()](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) setOnes() --------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::setOnes | ( | | ) | | | inline | See also [MatrixBase::setOnes()](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) setZero() --------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [TriangularViewType](classeigen_1_1triangularview)& Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::setZero | ( | | ) | | | inline | See also [MatrixBase::setZero()](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) solve() ------- template<typename \_MatrixType , unsigned int \_Mode> template<int Side, typename Other > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const internal::triangular\_solve\_retval<Side,[TriangularViewType](classeigen_1_1triangularview), Other> Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Other > & | *other* | ) | const | | inline | Returns the product of the inverse of `*this` with *other*, *\*this* being triangular. This function computes the inverse-matrix matrix product inverse(`*this`) \* *other* if *Side==OnTheLeft* (the default), or the right-inverse-multiply *other* \* inverse(`*this`) if *Side==OnTheRight*. Note that the template parameter `Side` can be omitted, in which case `Side==OnTheLeft` The matrix `*this` must be triangular and invertible (i.e., all the coefficients of the diagonal must be non zero). It works as a forward (resp. backward) substitution if `*this` is an upper (resp. lower) triangular matrix. Example: ``` Matrix3d m = [Matrix3d::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(); m.triangularView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().[setOnes](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a4e6b3b2af8d0d6d06d14ec3c7092cffc)(); cout << "Here is the matrix m:\n" << m << endl; Matrix3d n = [Matrix3d::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(); n.triangularView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>() *= 2; cout << "Here is the matrix n:\n" << n << endl; cout << "And now here is m.inverse()\*n, taking advantage of the fact that" " m is upper-triangular:\n" << m.triangularView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().[solve](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a911664ccf5522c778ffc5405247e8a59)(n) << endl; cout << "And this is n\*m.inverse():\n" << m.triangularView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().solve<Eigen::OnTheRight>(n); ``` Output: ``` Here is the matrix m: 1 1 1 0 1 1 0 0 1 Here is the matrix n: 2 1 1 2 2 1 2 2 2 And now here is m.inverse()*n, taking advantage of the fact that m is upper-triangular: 0 -1 0 0 0 -1 2 2 2 And this is n*m.inverse(): 2 -1 0 2 0 -1 2 0 0 ``` This function returns an expression of the inverse-multiply and can works in-place if it is assigned to the same matrix or vector *other*. For users coming from BLAS, this function (and more specifically [solveInPlace()](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a43bae99c287250d6092c8f8d1ba90e91)) offer all the operations supported by the `*TRSV` and `*TRSM` BLAS routines. See also TriangularView::solveInPlace() solveInPlace() -------------- template<typename \_MatrixType , unsigned int \_Mode> template<int Side, typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | void Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::solveInPlace | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | "in-place" version of TriangularView::solve() where the result is written in *other* Warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. This function will const\_cast it, so constness isn't honored here. Note that the template parameter `Side` can be omitted, in which case `Side==OnTheLeft` See [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix."):[solve()](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#a911664ccf5522c778ffc5405247e8a59) for the details. swap() [1/2] ------------ template<typename \_MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_DEPRECATED void Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::swap | ( | [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > const & | *other* | ) | | | inline | Shortcut for ``` (*this).swap(other.triangularView<(*this)::Mode>()) ``` **[Deprecated:](deprecated#_deprecated000007)** swap() [2/2] ------------ template<typename \_MatrixType , unsigned int \_Mode> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void Eigen::TriangularViewImpl< \_MatrixType, \_Mode, [Dense](structeigen_1_1dense) >::swap | ( | [TriangularBase](classeigen_1_1triangularbase)< OtherDerived > & | *other* | ) | | | inline | Swaps the coefficients of the common triangular parts of two matrices --- The documentation for this class was generated from the following file:* [TriangularMatrix.h](https://eigen.tuxfamily.org/dox/TriangularMatrix_8h_source.html)
programming_docs
eigen3 Eigen::MatrixXpr Eigen::MatrixXpr ================ The type used to identify a matrix expression --- The documentation for this struct was generated from the following file:* [Constants.h](https://eigen.tuxfamily.org/dox/Constants_8h_source.html) eigen3 Eigen::IndexedView Eigen::IndexedView ================== ### template<typename XprType, typename RowIndices, typename ColIndices> class Eigen::IndexedView< XprType, RowIndices, ColIndices > Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices. Template Parameters | | | | --- | --- | | XprType | the type of the expression in which we are taking the intersections of sub-rows and sub-columns | | RowIndices | the type of the object defining the sequence of row indices | | ColIndices | the type of the object defining the sequence of column indices | This class represents an expression of a sub-matrix (or sub-vector) defined as the intersection of sub-sets of rows and columns, that are themself defined by generic sequences of row indices \( \{r\_0,r\_1,..r\_{m-1}\} \) and column indices \( \{c\_0,c\_1,..c\_{n-1} \}\). Let \( A \) be the nested matrix, then the resulting matrix \( B \) has `m` rows and `n` columns, and its entries are given by: \( B(i,j) = A(r\_i,c\_j) \). The `RowIndices` and `ColIndices` types must be compatible with the following API: ``` <integral type> operator[]([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde)) const; [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size() const; ``` Typical supported types thus include: * std::vector<int> * std::valarray<int> * std::array<int> * Plain C arrays: int[N] * Eigen::ArrayXi * decltype(ArrayXi::LinSpaced(...)) * Any view/expressions of the previous types * [Eigen::ArithmeticSequence](classeigen_1_1arithmeticsequence) * Eigen::internal::AllRange (helper for [Eigen::all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)) * Eigen::internal::SingleRange (helper for single index) * etc. In typical usages of Eigen, this class should never be used directly. It is the return type of DenseBase::operator()(const RowIndices&, const ColIndices&). See also class [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") Inherits Eigen::IndexedViewImpl< XprType, RowIndices, ColIndices, internal::traits< XprType >::StorageKind >. | | | --- | | | | const ColIndices & | [colIndices](classeigen_1_1indexedview#ae4abc26fe04506a02d49e704e112f5bf) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [cols](classeigen_1_1indexedview#a6d5f355dd721df6d39482a04e5ffd44d) () const | | | | internal::remove\_reference< XprType >::type & | [nestedExpression](classeigen_1_1indexedview#ae6ada15bd2ae4302c097409fc91592b1) () | | | | const internal::remove\_all< XprType >::type & | [nestedExpression](classeigen_1_1indexedview#a2b2aa602ef1947b4752115605d106534) () const | | | | const RowIndices & | [rowIndices](classeigen_1_1indexedview#af038f6d19de286c0b959f3c1b8daa20d) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [rows](classeigen_1_1indexedview#ae0d840059e7753d58f3de53da7d04ce0) () const | | | colIndices() ------------ template<typename XprType , typename RowIndices , typename ColIndices > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const ColIndices& [Eigen::IndexedView](classeigen_1_1indexedview)< XprType, RowIndices, ColIndices >::colIndices | ( | | ) | const | | inline | Returns a const reference to the object storing/generating the column indices cols() ------ template<typename XprType , typename RowIndices , typename ColIndices > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::IndexedView](classeigen_1_1indexedview)< XprType, RowIndices, ColIndices >::cols | ( | void | | ) | const | | inline | Returns number of columns nestedExpression() [1/2] ------------------------ template<typename XprType , typename RowIndices , typename ColIndices > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::remove\_reference<XprType>::type& [Eigen::IndexedView](classeigen_1_1indexedview)< XprType, RowIndices, ColIndices >::nestedExpression | ( | | ) | | | inline | Returns the nested expression nestedExpression() [2/2] ------------------------ template<typename XprType , typename RowIndices , typename ColIndices > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::remove\_all<XprType>::type& [Eigen::IndexedView](classeigen_1_1indexedview)< XprType, RowIndices, ColIndices >::nestedExpression | ( | | ) | const | | inline | Returns the nested expression rowIndices() ------------ template<typename XprType , typename RowIndices , typename ColIndices > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const RowIndices& [Eigen::IndexedView](classeigen_1_1indexedview)< XprType, RowIndices, ColIndices >::rowIndices | ( | | ) | const | | inline | Returns a const reference to the object storing/generating the row indices rows() ------ template<typename XprType , typename RowIndices , typename ColIndices > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::IndexedView](classeigen_1_1indexedview)< XprType, RowIndices, ColIndices >::rows | ( | void | | ) | const | | inline | Returns number of rows --- The documentation for this class was generated from the following file:* [IndexedView.h](https://eigen.tuxfamily.org/dox/IndexedView_8h_source.html) eigen3 KLUSupport module KLUSupport module ================= This module provides an interface to the KLU library which is part of the [suitesparse](http://www.suitesparse.com) package. It provides the following factorization class: * class KLU: a sparse LU factorization, well-suited for circuit simulation. ``` #include <Eigen/KLUSupport> ``` In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. The dependencies depend on how umfpack has been compiled. For a cmake based project, you can use our FindKLU.cmake module to help you in this task. | | | --- | | | | int | [Eigen::klu\_solve](group__klusupport__module#gad6d0ed07a6ee97fcef4fe3bce6a674d4) (klu\_symbolic \*Symbolic, klu\_numeric \*Numeric, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) ldim, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) nrhs, double B[], klu\_common \*Common, double) | | | A sparse LU factorization and solver based on KLU. [More...](group__klusupport__module#gad6d0ed07a6ee97fcef4fe3bce6a674d4) | | | klu\_solve() ------------ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | int Eigen::klu\_solve | ( | klu\_symbolic \* | *Symbolic*, | | | | klu\_numeric \* | *Numeric*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *ldim*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *nrhs*, | | | | double | *B*[], | | | | klu\_common \* | *Common*, | | | | double | | | | ) | | | | inline | A sparse LU factorization and solver based on KLU. This class allows to solve for A.X = B sparse linear problems via a LU factorization using the KLU library. The sparse matrix A must be squared and full rank. The vectors or matrices X and B can be either dense or sparse. Warning The input matrix A should be in a **compressed** and **column-major** form. Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [UmfPackLU](classeigen_1_1umfpacklu "A sparse LU factorization and solver based on UmfPack."), class [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") eigen3 Eigen::symbolic::SymbolValue Eigen::symbolic::SymbolValue ============================ ### template<typename Tag> class Eigen::symbolic::SymbolValue< Tag > Represents the actual value of a symbol identified by its tag It is the return type of SymbolValue::operator=, and most of the time this is only way it is used. | | | --- | | | | | [SymbolValue](classeigen_1_1symbolic_1_1symbolvalue#a2db2a280f108f3253e4f21858a2d14ca) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) val) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [value](classeigen_1_1symbolic_1_1symbolvalue#a8f87badf23a7d5e32145c9ea08aaa300) () const | | | SymbolValue() ------------- template<typename Tag > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::symbolic::SymbolValue](classeigen_1_1symbolic_1_1symbolvalue)< Tag >::[SymbolValue](classeigen_1_1symbolic_1_1symbolvalue) | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *val* | ) | | | inline | Default constructor from the value *val* value() ------- template<typename Tag > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::symbolic::SymbolValue](classeigen_1_1symbolic_1_1symbolvalue)< Tag >::value | ( | | ) | const | | inline | Returns the stored value of the symbol --- The documentation for this class was generated from the following file:* [SymbolicIndex.h](https://eigen.tuxfamily.org/dox/SymbolicIndex_8h_source.html) eigen3 Explanation of the assertion on unaligned arrays Explanation of the assertion on unaligned arrays ================================================ Hello! You are seeing this webpage because your program terminated on an assertion failure like this one: ``` my_program: path/to/eigen/Eigen/src/Core/DenseStorage.h:44: Eigen::internal::matrix_array<T, Size, MatrixOptions, Align>::internal::matrix_array() [with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]: Assertion `(reinterpret_cast<size_t>(array) & (sizemask)) == 0 && "this assertion is explained here: <http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html> READ THIS WEB PAGE !!! ****"' failed. ``` There are 4 known causes for this issue. If you can target [c++17] only with a recent compiler (e.g., GCC>=7, clang>=5, MSVC>=19.12), then you're lucky: enabling c++17 should be enough (if not, please [report](http://eigen.tuxfamily.org/bz/) to us). Otherwise, please read on to understand those issues and learn how to fix them. Where in my own code is the cause of the problem? =================================================== First of all, you need to find out where in your own code this assertion was triggered from. At first glance, the error message doesn't look helpful, as it refers to a file inside Eigen! However, since your program crashed, if you can reproduce the crash, you can get a backtrace using any debugger. For example, if you're using GCC, you can use the GDB debugger as follows: ``` $ gdb ./my_program # Start GDB on your program > run # Start running your program ... # Now reproduce the crash! > bt # Obtain the backtrace ``` Now that you know precisely where in your own code the problem is happening, read on to understand what you need to change. Cause 1: Structures having Eigen objects as members ===================================================== If you have code like this, ``` class Foo { //... [Eigen::Vector4d](classeigen_1_1matrix) v; //... }; //... Foo *foo = new Foo; ``` then you need to read this separate page: [Structures Having Eigen Members](group__topicstructhavingeigenmembers). Note that here, Eigen::Vector4d is only used as an example, more generally the issue arises for all [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable). Cause 2: STL Containers or manual memory allocation ===================================================== If you use STL Containers such as std::vector, std::map, ..., with Eigen objects, or with classes containing Eigen objects, like this, ``` std::vector<Eigen::Matrix2d> my_vector; struct my_class { ... [Eigen::Matrix2d](classeigen_1_1matrix) m; ... }; std::map<int, my_class> my_map; ``` then you need to read this separate page: [Using STL Containers with Eigen](group__topicstlcontainers). Note that here, Eigen::Matrix2d is only used as an example, more generally the issue arises for all [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable) and [structures having such Eigen objects as member](group__topicstructhavingeigenmembers). The same issue will be exhibited by any classes/functions by-passing operator new to allocate memory, that is, by performing custom memory allocation followed by calls to the placement new operator. This is for instance typically the case of ``std::make_shared`` or `std::allocate_shared` for which is the solution is to use an [aligned allocator](classeigen_1_1aligned__allocator) as detailed in the [solution for STL containers](group__topicstlcontainers). Cause 3: Passing Eigen objects by value ========================================= If some function in your code is getting an Eigen object passed by value, like this, ``` void func([Eigen::Vector4d](classeigen_1_1matrix) v); ``` then you need to read this separate page: [Passing Eigen objects by value to functions](group__topicpassingbyvalue). Note that here, Eigen::Vector4d is only used as an example, more generally the issue arises for all [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable). Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows) ============================================================================================== This is a must-read for people using GCC on Windows (like MinGW or TDM-GCC). If you have this assertion failure in an innocent function declaring a local variable like this: ``` void foo() { [Eigen::Quaternionf](classeigen_1_1quaternion) q; //... } ``` then you need to read this separate page: [Compiler making a wrong assumption on stack alignment](group__topicwrongstackalignment). Note that here, [Eigen::Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b) is only used as an example, more generally the issue arises for all [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable). General explanation of this assertion ======================================= [Fixed-size vectorizable Eigen objects](group__topicfixedsizevectorizable) must absolutely be created at properly aligned locations, otherwise SIMD instructions addressing them will crash. For instance, SSE/NEON/MSA/Altivec/VSX targets will require 16-byte-alignment, whereas AVX and AVX512 targets may require up to 32 and 64 byte alignment respectively. Eigen normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their `operator new`. However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion. I don't care about optimal vectorization, how do I get rid of that stuff? =========================================================================== Three possibilities: * Use the `DontAlign` option to [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."), [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), etc. objects that gives you trouble. This way Eigen won't try to over-align them, and thus won"t assume any special alignment. On the down side, you will pay the cost of unaligned loads/stores for them, but on modern CPUs, the overhead is either null or marginal. See [here](group__topicstructhavingeigenmembers#StructHavingEigenMembers_othersolutions) for an example. * Define [EIGEN\_MAX\_STATIC\_ALIGN\_BYTES](topicpreprocessordirectives#TopicPreprocessorDirectivesPerformance) to 0. That disables all 16-byte (and above) static alignment code, while keeping 16-byte (or above) heap alignment. This has the effect of vectorizing fixed-size objects (like Matrix4d) through unaligned stores (as controlled by [EIGEN\_UNALIGNED\_VECTORIZE](topicpreprocessordirectives#TopicPreprocessorDirectivesPerformance) ), while keeping unchanged the vectorization of dynamic-size objects (like MatrixXd). On 64 bytes systems, you might also define it 16 to disable only 32 and 64 bytes of over-alignment. But do note that this breaks ABI compatibility with the default behavior of static alignment. * Or define both [EIGEN\_DONT\_VECTORIZE](topicpreprocessordirectives#TopicPreprocessorDirectivesPerformance) and `EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT`. This keeps the 16-byte (or above) alignment code and thus preserves ABI compatibility, but completely disables vectorization. If you want to know why defining `EIGEN_DONT_VECTORIZE` does not by itself disable 16-byte (or above) alignment and the assertion, here's the explanation: It doesn't disable the assertion, because otherwise code that runs fine without vectorization would suddenly crash when enabling vectorization. It doesn't disable 16-byte (or above) alignment, because that would mean that vectorized and non-vectorized code are not mutually ABI-compatible. This ABI compatibility is very important, even for people who develop only an in-house application, as for instance one may want to have in the same application a vectorized path and a non-vectorized path. How can I check my code is safe regarding alignment issues? ============================================================= Unfortunately, there is no possibility in c++ to detect any of the aforementioned shortcoming at compile time (though static analyzers are becoming more and more powerful and could detect some of them). Even at runtime, all we can do is to catch invalid unaligned allocation and trigger the explicit assertion mentioned at the beginning of this page. Therefore, if your program runs fine on a given system with some given compilation flags, then this does not guarantee that your code is safe. For instance, on most 64 bits systems buffer are aligned on 16 bytes boundary and so, if you do not enable AVX instruction set, then your code will run fine. On the other hand, the same code may assert if moving to a more exotic platform, or enabling AVX instructions that required 32 bytes alignment by default. The situation is not hopeless though. Assuming your code is well covered by unit test, then you can check its alignment safety by linking it to a custom malloc library returning 8 bytes aligned buffers only. This way all alignment shortcomings should pop-up. To this end, you must also compile your program with [EIGEN\_MALLOC\_ALREADY\_ALIGNED=0](topicpreprocessordirectives#TopicPreprocessorDirectivesPerformance) .
programming_docs
eigen3 Eigen::ArithmeticSequence Eigen::ArithmeticSequence ========================= ### template<typename FirstType, typename SizeType, typename IncrType> class Eigen::ArithmeticSequence< FirstType, SizeType, IncrType > This class represents an arithmetic progression \( a\_0, a\_1, a\_2, ..., a\_{n-1}\) defined by its *first* value \( a\_0 \), its *size* (aka length) *n*, and the *increment* (aka stride) that is equal to \( a\_{i+1}-a\_{i}\) for any *i*. It is internally used as the return type of the [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) and [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) functions, and as the input arguments of DenseBase::operator()(const RowIndices&, const ColIndices&), and most of the time this is the only way it is used. Template Parameters | | | | --- | --- | | FirstType | type of the first element, usually an Index, but internally it can be a symbolic expression | | SizeType | type representing the size of the sequence, usually an Index or a compile time integral constant. Internally, it can also be a symbolic expression | | IncrType | type of the increment, can be a runtime Index, or a compile time integral constant (default is compile-time 1) | See also [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969), [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda), DenseBase::operator()(const RowIndices&, const ColIndices&), class [IndexedView](classeigen_1_1indexedview "Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices.") | | | --- | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [first](classeigen_1_1arithmeticsequence#a780ee27a63b77d4f34f74d8ca2381d12) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [operator[]](classeigen_1_1arithmeticsequence#a34a4117a3590ccc99177449f8c47740e) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [size](classeigen_1_1arithmeticsequence#aef60a3585c1551c77e6dbf568b06c485) () const | | | first() ------- template<typename FirstType , typename SizeType , typename IncrType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::ArithmeticSequence](classeigen_1_1arithmeticsequence)< FirstType, SizeType, IncrType >::first | ( | | ) | const | | inline | Returns the first element \( a\_0 \) in the sequence operator[]() ------------ template<typename FirstType , typename SizeType , typename IncrType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::ArithmeticSequence](classeigen_1_1arithmeticsequence)< FirstType, SizeType, IncrType >::operator[] | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *i* | ) | const | | inline | Returns the value \( a\_i \) at index *i* in the sequence. size() ------ template<typename FirstType , typename SizeType , typename IncrType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::ArithmeticSequence](classeigen_1_1arithmeticsequence)< FirstType, SizeType, IncrType >::size | ( | | ) | const | | inline | Returns the size, i.e., number of elements, of the sequence --- The documentation for this class was generated from the following file:* [ArithmeticSequence.h](https://eigen.tuxfamily.org/dox/ArithmeticSequence_8h_source.html) eigen3 Eigen::DenseCoeffsBase Eigen::DenseCoeffsBase ====================== ### template<typename Derived> class Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors > Base class providing direct read/write coefficient access to matrices and arrays. Template Parameters | | | | --- | --- | | Derived | Type of the derived class | Note [DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) Constant indicating direct access This class defines functions to work with strides which can be used to access entries directly. This class inherits [DenseCoeffsBase<Derived, WriteAccessors>](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4 "Base class providing read/write coefficient access to matrices and arrays.") which defines functions to access entries read/write using `operator()`. See also [The class hierarchy](topicclasshierarchy) | | | --- | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#af1bac522aee4402639189f387592000b) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a4e94e17926e1cf597deb2928e779cef6) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#abb333f6f10467f6f8d7b59c213dea49e) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a63bc5874eb4e320e54eb079b43b49d22) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae66b7d18b2a85f3139b703126974c900) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#adc8286576b31e11f056057be666a0ec8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a0171eee1d9e582d1ac7ec0f18f5f615a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae6ba07bad9e3026afe54806fdefe32bb) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#aa2040f14e60fed1a4a68ca7f042e1bbf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Scalar & | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) () | | | | Scalar & | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) () | | | | Scalar & | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8) () | | | | Scalar & | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73) () | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | cols() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::cols | ( | void | | ) | | | inline | Returns the number of columns. See also [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), ColsAtCompileTime colStride() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) >::colStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive columns. See also innerStride(), outerStride(), rowStride() derived() [1/2] --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | Derived& [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::derived | | inline | Returns a reference to the derived object derived() [2/2] --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const Derived& [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::derived | | inline | Returns a const reference to the derived object innerStride() ------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) >::innerStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive elements within a slice in the inner direction. See also outerStride(), rowStride(), colStride() outerStride() ------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) >::outerStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns in a column-major matrix). See also innerStride(), rowStride(), colStride() rows() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::rows | ( | void | | ) | | | inline | Returns the number of rows. See also [cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), RowsAtCompileTime rowStride() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) >::rowStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive rows. See also innerStride(), outerStride(), colStride() size() ------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::size | | inline | Returns the number of coefficients, which is [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2)\*cols(). See also [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), SizeAtCompileTime. --- The documentation for this class was generated from the following file:* [DenseCoeffsBase.h](https://eigen.tuxfamily.org/dox/DenseCoeffsBase_8h_source.html) eigen3 SVD module SVD module ========== This module provides SVD decomposition for matrices (both real and complex). Two decomposition algorithms are provided: * [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. * [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD") implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. These decompositions are accessible via the respective classes and following [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") methods: * [MatrixBase::jacobiSvd()](classeigen_1_1matrixbase#a5745dca9c54390633b434e54a1d1eedd) * [MatrixBase::bdcSvd()](classeigen_1_1matrixbase#ae171b74b5d530846ee0836135ffcf837) ``` #include <Eigen/SVD> ``` | | | --- | | | | class | [Eigen::BDCSVD< \_MatrixType >](classeigen_1_1bdcsvd) | | | class Bidiagonal Divide and Conquer SVD [More...](classeigen_1_1bdcsvd#details) | | | | class | [Eigen::JacobiSVD< \_MatrixType, QRPreconditioner >](classeigen_1_1jacobisvd) | | | Two-sided Jacobi SVD decomposition of a rectangular matrix. [More...](classeigen_1_1jacobisvd#details) | | | | class | [Eigen::SVDBase< Derived >](classeigen_1_1svdbase) | | | Base class of SVD algorithms. [More...](classeigen_1_1svdbase#details) | | |
programming_docs
eigen3 Benchmark of dense decompositions Benchmark of dense decompositions ================================= This page presents a speed comparison of the dense matrix decompositions offered by Eigen for a wide range of square matrices and overconstrained problems. For a more general overview on the features and numerical robustness of linear solvers and decompositions, check this [table](group__topiclinearalgebradecompositions) . This benchmark has been run on a laptop equipped with an Intel core i7 @ 2,6 GHz, and compiled with clang with **AVX** and **FMA** instruction sets enabled but without multi-threading. It uses **single** **precision** **float** numbers. For double, you can get a good estimate by multiplying the timings by a factor 2. The square matrices are symmetric, and for the overconstrained matrices, the reported timmings include the cost to compute the symmetric covariance matrix \( A^T A \) for the first four solvers based on Cholesky and LU, as denoted by the **\*** symbol (top-right corner part of the table). Timings are in **milliseconds**, and factors are relative to the [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") decomposition which is the fastest but also the least general and robust. | solver/size | 8x8 | 100x100 | 1000x1000 | 4000x4000 | 10000x8 | 10000x100 | 10000x1000 | 10000x4000 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") | 0.05 | 0.42 | 5.83 | 374.55 | 6.79 [\*](#note_ls) | 30.15 [\*](#note_ls) | 236.34 [\*](#note_ls) | 3847.17 [\*](#note_ls) | | [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") | 0.07 (x1.3) | 0.65 (x1.5) | 26.86 (x4.6) | 2361.18 (x6.3) | 6.81 (x1) [\*](#note_ls) | 31.91 (x1.1) [\*](#note_ls) | 252.61 (x1.1) [\*](#note_ls) | 5807.66 (x1.5) [\*](#note_ls) | | [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.") | 0.08 (x1.5) | 0.69 (x1.6) | 15.63 (x2.7) | 709.32 (x1.9) | 6.81 (x1) [\*](#note_ls) | 31.32 (x1) [\*](#note_ls) | 241.68 (x1) [\*](#note_ls) | 4270.48 (x1.1) [\*](#note_ls) | | [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features.") | 0.1 (x1.9) | 4.48 (x10.6) | 281.33 (x48.2) | - | 6.83 (x1) [\*](#note_ls) | 32.67 (x1.1) [\*](#note_ls) | 498.25 (x2.1) [\*](#note_ls) | - | | [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix.") | 0.19 (x3.5) | 2.18 (x5.2) | 23.42 (x4) | 1337.52 (x3.6) | 34.26 (x5) | 129.01 (x4.3) | 377.37 (x1.6) | 4839.1 (x1.3) | | [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting.") | 0.23 (x4.3) | 2.23 (x5.3) | 103.34 (x17.7) | 9987.16 (x26.7) | 36.05 (x5.3) | 163.18 (x5.4) | 2354.08 (x10) | 37860.5 (x9.8) | | [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition "Complete orthogonal decomposition (COD) of a matrix.") | 0.23 (x4.3) | 2.22 (x5.2) | 99.44 (x17.1) | 10555.3 (x28.2) | 35.75 (x5.3) | 169.39 (x5.6) | 2150.56 (x9.1) | 36981.8 (x9.6) | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") | 0.23 (x4.3) | 4.64 (x11) | 289.1 (x49.6) | - | 69.38 (x10.2) | 446.73 (x14.8) | 4852.12 (x20.5) | - | | [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") | 1.01 (x18.6) | 71.43 (x168.4) | - | - | 113.81 (x16.7) | 1179.66 (x39.1) | - | - | | [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD") | 1.07 (x19.7) | 21.83 (x51.5) | 331.77 (x56.9) | 18587.9 (x49.6) | 110.53 (x16.3) | 397.67 (x13.2) | 2975 (x12.6) | 48593.2 (x12.6) | **\***: This decomposition do not support direct least-square solving for over-constrained problems, and the reported timing include the cost to form the symmetric covariance matrix \( A^T A \). **Observations:** * [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") is always the fastest solvers. * For largely over-constrained problems, the cost of Cholesky/LU decompositions is dominated by the computation of the symmetric covariance matrix. * For large problem sizes, only the decomposition implementing a cache-friendly blocking strategy scale well. Those include [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features."), [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features."), [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix."), and [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD"). This explain why for a 4k x 4k matrix, [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix.") is faster than [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting."). In the future, [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") and [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting.") will also implement blocking strategies. * [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition "Complete orthogonal decomposition (COD) of a matrix.") is based on [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting.") and they thus achieve the same level of performance. The above table has been generated by the [bench/dense\_solvers.cpp](https://gitlab.com/libeigen/eigen/raw/master/bench/dense_solvers.cpp) file, feel-free to hack it to generate a table matching your hardware, compiler, and favorite problem sizes. eigen3 Eigen::Transform Eigen::Transform ================ ### template<typename \_Scalar, int \_Dim, int \_Mode, int \_Options> class Eigen::Transform< \_Scalar, \_Dim, \_Mode, \_Options > Represents an homogeneous transformation in a N dimensional space. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the coefficients | | \_Dim | the dimension of the space | | \_Mode | the type of the transformation. Can be:* [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb): the transformation is stored as a (Dim+1)^2 matrix, where the last row is assumed to be [0 ... 0 1]. * [AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490): the transformation is stored as a (Dim)x(Dim+1) matrix. * [Projective](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0f7338b8672884554e8642bce9e44183): the transformation is stored as a (Dim+1)^2 matrix without any assumption. * [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef): same as [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) with the additional assumption that the linear part represents a rotation. This assumption is exploited to speed up some functions such as [inverse()](classeigen_1_1transform#ab8dbcd157bf194efca1a5413c0945211) and [rotation()](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746). | | \_Options | has the same meaning as in class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). It allows to specify DontAlign and/or RowMajor. These Options are passed directly to the underlying matrix type. | The homography is internally represented and stored by a matrix which is available through the [matrix()](classeigen_1_1transform#a758fbaf6aa41a5493659aa0c9bfe0dcf) method. To understand the behavior of this class you have to think a [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") object as its internal matrix representation. The chosen convention is right multiply: ``` v' = T \* v ``` Therefore, an affine transformation matrix M is shaped like this: \( \left( \begin{array}{cc} linear & translation\\ 0 ... 0 & 1 \end{array} \right) \) Note that for a projective transformation the last row can be anything, and then the interpretation of different parts might be slightly different. However, unlike a plain matrix, the [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") class provides many features simplifying both its assembly and usage. In particular, it can be composed with any other transformations ([Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space."),[Translation](classeigen_1_1translation "Represents a translation transformation."),[RotationBase](classeigen_1_1rotationbase "Common base class for compact rotation representations."),[DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage.")) and can be directly used to transform implicit homogeneous vectors. All these operations are handled via the operator\*. For the composition of transformations, its principle consists to first convert the right/left hand sides of the product to a compatible (Dim+1)^2 matrix and then perform a pure matrix product. Of course, internally, operator\* tries to perform the minimal number of operations according to the nature of each terms. Likewise, when applying the transform to points, the latters are automatically promoted to homogeneous vectors before doing the matrix product. The conventions to homogeneous representations are performed as follow: **[Translation](classeigen_1_1translation "Represents a translation transformation.")** t (Dim)x(1): \( \left( \begin{array}{cc} I & t \\ 0\,...\,0 & 1 \end{array} \right) \) **Rotation** R (Dim)x(Dim): \( \left( \begin{array}{cc} R & 0\\ 0\,...\,0 & 1 \end{array} \right) \) **Scaling** **[DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage.")** S (Dim)x(Dim): \( \left( \begin{array}{cc} S & 0\\ 0\,...\,0 & 1 \end{array} \right) \) **Column** **point** v (Dim)x(1): \( \left( \begin{array}{c} v\\ 1 \end{array} \right) \) **Set** **of** **column** **points** V1...Vn (Dim)x(n): \( \left( \begin{array}{ccc} v\_1 & ... & v\_n\\ 1 & ... & 1 \end{array} \right) \) The concatenation of a [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") object with any kind of other transformation always returns a [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") object. A little exception to the "as pure matrix product" rule is the case of the transformation of non homogeneous vectors by an affine transformation. In that case the last matrix row can be ignored, and the product returns non homogeneous vectors. Since, for instance, a Dim x Dim matrix is interpreted as a linear transformation, it is not possible to directly transform Dim vectors stored in a Dim x Dim matrix. The solution is either to use a Dim x Dynamic matrix or explicitly request a vector transformation by making the vector homogeneous: ``` m' = T \* m.colwise().homogeneous(); ``` Note that there is zero overhead. Conversion methods from/to Qt's QMatrix and QTransform are available if the preprocessor token EIGEN\_QT\_SUPPORT is defined. This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_TRANSFORM_PLUGIN`. See also class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), class [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") | | | --- | | | | typedef internal::conditional< int(Mode)==int([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)), [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) &, [Block](classeigen_1_1block)< [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c), Dim, HDim > >::type | [AffinePart](classeigen_1_1transform#a8319bad977b0dabf2dfaf2e2dc30f13e) | | | | typedef internal::conditional< int(Mode)==int([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)), const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) &, const [Block](classeigen_1_1block)< const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c), Dim, HDim > >::type | [ConstAffinePart](classeigen_1_1transform#adfa0bf2d9504548cdc9b9051b2fa9673) | | | | typedef const [Block](classeigen_1_1block)< [ConstMatrixType](classeigen_1_1transform#aed436d14b16bd862bac5367990085795), Dim, Dim, int(Mode)==([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)) &&(int(Options)&[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f))==0 > | [ConstLinearPart](classeigen_1_1transform#a75810d3f0d098e00b43a5531f33d78e1) | | | | typedef const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) | [ConstMatrixType](classeigen_1_1transform#aed436d14b16bd862bac5367990085795) | | | | typedef const [Block](classeigen_1_1block)< [ConstMatrixType](classeigen_1_1transform#aed436d14b16bd862bac5367990085795), Dim, 1,!(internal::traits< [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) >::Flags &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762))> | [ConstTranslationPart](classeigen_1_1transform#a3eab3259d3fac8106eb3139bc96ba852) | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Dim, Options > | [LinearMatrixType](classeigen_1_1transform#a48138c0370e55371b95946c90d69e25c) | | | | typedef [Block](classeigen_1_1block)< [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c), Dim, Dim, int(Mode)==([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)) &&(int(Options)&[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f))==0 > | [LinearPart](classeigen_1_1transform#a2195bd42561e691a8f6e7d989e77f328) | | | | typedef internal::make\_proper\_matrix\_type< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Rows, HDim, Options >::type | [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) | | | | typedef \_Scalar | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) | | | | typedef [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, TransformTimeDiagonalMode > | [TransformTimeDiagonalReturnType](classeigen_1_1transform#a51af5e8d8d9d9bfec091ff8aa5b7845a) | | | | typedef [Block](classeigen_1_1block)< [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c), Dim, 1,!(internal::traits< [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) >::Flags &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762))> | [TranslationPart](classeigen_1_1transform#aabeaa2d375bf1b6b1d5cb5d1904fbd06) | | | | typedef [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim > | [TranslationType](classeigen_1_1transform#a6b463d14d8be4c0eda2eed6e943b831f) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, 1 > | [VectorType](classeigen_1_1transform#aaeb4ae2f95c8edb0655fd84ab3f89e79) | | | | | | --- | | | | [AffinePart](classeigen_1_1transform#a8319bad977b0dabf2dfaf2e2dc30f13e) | [affine](classeigen_1_1transform#a9795374292c085bca4d123397d6b37d9) () | | | | [ConstAffinePart](classeigen_1_1transform#adfa0bf2d9504548cdc9b9051b2fa9673) | [affine](classeigen_1_1transform#a761a9c20fd5eefa58ca2f9babdf4c5d8) () const | | | | template<typename NewScalarType > | | internal::cast\_return\_type< [Transform](classeigen_1_1transform), [Transform](classeigen_1_1transform)< NewScalarType, Dim, Mode, Options > >::type | [cast](classeigen_1_1transform#a86a66867b2a9ee0c9c4e920baf2bdacd) () const | | | | template<typename RotationMatrixType , typename ScalingMatrixType > | | void | [computeRotationScaling](classeigen_1_1transform#a7213fd78501c1185c4a1441e33c812d3) (RotationMatrixType \*[rotation](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746), ScalingMatrixType \*scaling) const | | | | template<typename ScalingMatrixType , typename RotationMatrixType > | | void | [computeScalingRotation](classeigen_1_1transform#a247b079c63f46bb652b3776484838216) (ScalingMatrixType \*scaling, RotationMatrixType \*[rotation](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746)) const | | | | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) \* | [data](classeigen_1_1transform#aefd183e4e0ca89c39b78d5ad7cf3e014) () | | | | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) \* | [data](classeigen_1_1transform#a432669c64a0d6925ee5ea54f76d24a32) () const | | | | | [EIGEN\_MAKE\_ALIGNED\_OPERATOR\_NEW\_IF\_VECTORIZABLE\_FIXED\_SIZE](classeigen_1_1transform#a30c94c2156e9345f4bdb6cc9661e275b) (\_Scalar, \_Dim==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) :(\_Dim+1) \*(\_Dim+1)) enum | | | | template<typename PositionDerived , typename OrientationType , typename ScaleDerived > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [fromPositionOrientationScale](classeigen_1_1transform#afac1e7bd782e5cc92cbf70128809d5d1) (const [MatrixBase](classeigen_1_1matrixbase)< PositionDerived > &position, const OrientationType &orientation, const [MatrixBase](classeigen_1_1matrixbase)< ScaleDerived > &scale) | | | | [Transform](classeigen_1_1transform) | [inverse](classeigen_1_1transform#ab8dbcd157bf194efca1a5413c0945211) ([TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) traits=([TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107)) Mode) const | | | | bool | [isApprox](classeigen_1_1transform#abd1696d9bb754e5c8734e691e03243f9) (const [Transform](classeigen_1_1transform) &other, const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) >::Real &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) >::dummy\_precision()) const | | | | [LinearPart](classeigen_1_1transform#a2195bd42561e691a8f6e7d989e77f328) | [linear](classeigen_1_1transform#ad36538ee2c2970722eff343ee1bbfc7c) () | | | | [ConstLinearPart](classeigen_1_1transform#a75810d3f0d098e00b43a5531f33d78e1) | [linear](classeigen_1_1transform#af8c38249632146453785add778dc1081) () const | | | | void | [makeAffine](classeigen_1_1transform#abef09a0e86261aeba4e10227fa3fa26b) () | | | | [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) & | [matrix](classeigen_1_1transform#a758fbaf6aa41a5493659aa0c9bfe0dcf) () | | | | const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) & | [matrix](classeigen_1_1transform#a0ac079dc1995058cbbded553b8d4485c) () const | | | | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | [operator()](classeigen_1_1transform#a09fce82b9bdedb5deb2b223a3d716d3f) ([Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) row, [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) col) | | | | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) | [operator()](classeigen_1_1transform#a9672c84cb1477eee118be144e7e5d581) ([Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) row, [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) col) const | | | | template<typename DiagonalDerived > | | const [TransformTimeDiagonalReturnType](classeigen_1_1transform#a51af5e8d8d9d9bfec091ff8aa5b7845a) | [operator\*](classeigen_1_1transform#ab3d93a2aba9d06e7d134798f92617da7) (const DiagonalBase< DiagonalDerived > &b) const | | | | template<typename OtherDerived > | | const internal::transform\_right\_product\_impl< [Transform](classeigen_1_1transform), OtherDerived >::ResultType | [operator\*](classeigen_1_1transform#a257ab8b9141982bd6f56771ba822526f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) const | | | | const [Transform](classeigen_1_1transform) | [operator\*](classeigen_1_1transform#a7e75d983600d35b603f740a3a28bbc6c) (const [Transform](classeigen_1_1transform) &other) const | | | | template<int OtherMode, int OtherOptions> | | internal::transform\_transform\_product\_impl< [Transform](classeigen_1_1transform), [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, OtherMode, OtherOptions > >::ResultType | [operator\*](classeigen_1_1transform#ad4fc26aef2abfb9fdadb7d64aaf58c31) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, OtherMode, OtherOptions > &other) const | | | | template<typename OtherDerived > | | [Transform](classeigen_1_1transform) & | [operator=](classeigen_1_1transform#a826047489741a19b81c6552f8257b1cf) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | [Transform](classeigen_1_1transform) & | [operator=](classeigen_1_1transform#a8ed8318285ccc7498197da7df1273bd5) (const QMatrix &other) | | | | [Transform](classeigen_1_1transform) & | [operator=](classeigen_1_1transform#a54986164dcb1d0f7bfa216b8ef5272f6) (const QTransform &other) | | | | template<typename RotationType > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [prerotate](classeigen_1_1transform#ac5d65c2387e8d8b8f1526fc2c8443661) (const RotationType &[rotation](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746)) | | | | template<typename OtherDerived > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [prescale](classeigen_1_1transform#a0d87009c9449d1920c037eb58468e757) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | [Transform](classeigen_1_1transform) & | [prescale](classeigen_1_1transform#a96c5e49e1d779299f4975dfef93e14b3) (const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) &s) | | | | [Transform](classeigen_1_1transform) & | [preshear](classeigen_1_1transform#a17c40209cfd2d094cf654504aca95bf1) (const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) &sx, const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) &sy) | | | | template<typename OtherDerived > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [pretranslate](classeigen_1_1transform#ae9be55c2f6f4d56b0878c983c0ff9cc6) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | template<typename RotationType > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [rotate](classeigen_1_1transform#a992087c44abac402a90e48218632d435) (const RotationType &[rotation](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746)) | | | | RotationReturnType | [rotation](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746) () const | | | | template<typename OtherDerived > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [scale](classeigen_1_1transform#a8eea19fd9f6a6966a1a810acda22f93d) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | [Transform](classeigen_1_1transform) & | [scale](classeigen_1_1transform#a7757f5d9e708e625cbd936b19269b2c8) (const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) &s) | | | | void | [setIdentity](classeigen_1_1transform#accf8eb8ac609d20cf099c62124c0505a) () | | | | [Transform](classeigen_1_1transform) & | [shear](classeigen_1_1transform#ae93a25d5e15af9446d7e5bc0e7a959d0) (const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) &sx, const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) &sy) | | | | QMatrix | [toQMatrix](classeigen_1_1transform#adaa35139dce9e7e8e144bbdecf97f63f) (void) const | | | | QTransform | [toQTransform](classeigen_1_1transform#ae954e369a06472f44b72b199beb83cd2) (void) const | | | | | [Transform](classeigen_1_1transform#a19d71151dfbbe89db15961c93726dd70) () | | | | template<typename OtherDerived > | | | [Transform](classeigen_1_1transform#aec37de6bc74c0769dc4e47ba759bf9ec) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | | [Transform](classeigen_1_1transform#a83d61d4a1bd1c502c97ad67f87d55006) (const QMatrix &other) | | | | | [Transform](classeigen_1_1transform#a63e9a5b9cf964921c24023dd680dee6d) (const QTransform &other) | | | | template<typename OtherScalarType > | | | [Transform](classeigen_1_1transform#a2c3e732625ec300ef4e4cb1e17a82d35) (const [Transform](classeigen_1_1transform)< OtherScalarType, Dim, Mode, Options > &other) | | | | template<typename OtherDerived > | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & | [translate](classeigen_1_1transform#aa28c8ebe8367243653e8fb151670b24b) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | [TranslationPart](classeigen_1_1transform#aabeaa2d375bf1b6b1d5cb5d1904fbd06) | [translation](classeigen_1_1transform#aa3e4201cc8d1fd98136af66544148dc7) () | | | | [ConstTranslationPart](classeigen_1_1transform#a3eab3259d3fac8106eb3139bc96ba852) | [translation](classeigen_1_1transform#adf4c6d97bd3f10edfa95bb04331ec8ed) () const | | | | | | --- | | | | static const [Transform](classeigen_1_1transform) | [Identity](classeigen_1_1transform#a5897c4cba8d6d19ea8711496fe75836f) () | | | Returns an identity transformation. [More...](classeigen_1_1transform#a5897c4cba8d6d19ea8711496fe75836f) | | | AffinePart ---------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef internal::conditional<int(Mode)==int([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)), [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c)&, [Block](classeigen_1_1block)<[MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c),Dim,HDim> >::type [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[AffinePart](classeigen_1_1transform#a8319bad977b0dabf2dfaf2e2dc30f13e) | type of read/write reference to the affine part of the transformation ConstAffinePart --------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef internal::conditional<int(Mode)==int([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)), const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c)&, const [Block](classeigen_1_1block)<const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c),Dim,HDim> >::type [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[ConstAffinePart](classeigen_1_1transform#adfa0bf2d9504548cdc9b9051b2fa9673) | type of read reference to the affine part of the transformation ConstLinearPart --------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef const [Block](classeigen_1_1block)<[ConstMatrixType](classeigen_1_1transform#aed436d14b16bd862bac5367990085795),Dim,Dim,int(Mode)==([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)) && (int(Options)&[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f))==0> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[ConstLinearPart](classeigen_1_1transform#a75810d3f0d098e00b43a5531f33d78e1) | type of read reference to the linear part of the transformation ConstMatrixType --------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[ConstMatrixType](classeigen_1_1transform#aed436d14b16bd862bac5367990085795) | constified MatrixType ConstTranslationPart -------------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef const [Block](classeigen_1_1block)<[ConstMatrixType](classeigen_1_1transform#aed436d14b16bd862bac5367990085795),Dim,1,!(internal::traits<[MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c)>::Flags & [RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762))> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[ConstTranslationPart](classeigen_1_1transform#a3eab3259d3fac8106eb3139bc96ba852) | type of a read reference to the translation part of the rotation Index ----- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) | **[Deprecated:](deprecated#_deprecated000031)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 LinearMatrixType ---------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Dim,Options> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[LinearMatrixType](classeigen_1_1transform#a48138c0370e55371b95946c90d69e25c) | type of the matrix used to represent the linear part of the transformation LinearPart ---------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Block](classeigen_1_1block)<[MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c),Dim,Dim,int(Mode)==([AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490)) && (int(Options)&[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f))==0> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[LinearPart](classeigen_1_1transform#a2195bd42561e691a8f6e7d989e77f328) | type of read/write reference to the linear part of the transformation MatrixType ---------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef internal::make\_proper\_matrix\_type<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Rows,HDim,Options>::type [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c) | type of the matrix used to represent the transformation Scalar ------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef \_Scalar [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) | the scalar type of the coefficients TransformTimeDiagonalReturnType ------------------------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,TransformTimeDiagonalMode> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[TransformTimeDiagonalReturnType](classeigen_1_1transform#a51af5e8d8d9d9bfec091ff8aa5b7845a) | The return type of the product between a diagonal matrix and a transform TranslationPart --------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Block](classeigen_1_1block)<[MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c),Dim,1,!(internal::traits<[MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c)>::Flags & [RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762))> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[TranslationPart](classeigen_1_1transform#aabeaa2d375bf1b6b1d5cb5d1904fbd06) | type of a read/write reference to the translation part of the rotation TranslationType --------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Translation](classeigen_1_1translation)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[TranslationType](classeigen_1_1transform#a6b463d14d8be4c0eda2eed6e943b831f) | corresponding translation type VectorType ---------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,1> [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[VectorType](classeigen_1_1transform#aaeb4ae2f95c8edb0655fd84ab3f89e79) | type of a vector Transform() [1/5] ----------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[Transform](classeigen_1_1transform) | ( | | ) | | | inline | Default constructor without initialization of the meaningful coefficients. If Mode==Affine or Mode==Isometry, then the last row is set to [0 ... 0 1] Transform() [2/5] ----------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[Transform](classeigen_1_1transform) | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inlineexplicit | Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. Transform() [3/5] ----------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::[Transform](classeigen_1_1transform) | ( | const QMatrix & | *other* | ) | | | inline | Initializes `*this` from a QMatrix assuming the dimension is 2. This function is available only if the token EIGEN\_QT\_SUPPORT is defined. Transform() [4/5] ----------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::[Transform](classeigen_1_1transform) | ( | const QTransform< \_Scalar, \_Dim, \_Mode, \_Options > & | *other* | ) | | | inline | Initializes `*this` from a QTransform assuming the dimension is 2. This function is available only if the token EIGEN\_QT\_SUPPORT is defined. Transform() [5/5] ----------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherScalarType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::[Transform](classeigen_1_1transform) | ( | const [Transform](classeigen_1_1transform)< OtherScalarType, Dim, Mode, Options > & | *other* | ) | | | inlineexplicit | Copy constructor with scalar type conversion affine() [1/2] -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [AffinePart](classeigen_1_1transform#a8319bad977b0dabf2dfaf2e2dc30f13e) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::affine | ( | | ) | | | inline | Returns a writable expression of the Dim x HDim affine part of the transformation affine() [2/2] -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ConstAffinePart](classeigen_1_1transform#adfa0bf2d9504548cdc9b9051b2fa9673) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::affine | ( | | ) | const | | inline | Returns a read-only expression of the Dim x HDim affine part of the transformation cast() ------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename NewScalarType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::cast\_return\_type<[Transform](classeigen_1_1transform),[Transform](classeigen_1_1transform)<NewScalarType,Dim,Mode,Options> >::type [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::cast | ( | | ) | const | | inline | Returns `*this` with scalar type casted to *NewScalarType* Note that if *NewScalarType* is equal to the current scalar type of `*this` then this function smartly returns a const reference to `*this`. computeRotationScaling() ------------------------ template<typename Scalar , int Dim, int Mode, int Options> template<typename RotationMatrixType , typename ScalingMatrixType > | | | | | | --- | --- | --- | --- | | void [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::computeRotationScaling | ( | RotationMatrixType \* | *rotation*, | | | | ScalingMatrixType \* | *scaling* | | | ) | | const | decomposes the linear part of the transformation as a product rotation x scaling, the scaling being not necessarily positive. If either pointer is zero, the corresponding computation is skipped. This is defined in the SVD module. ``` #include <Eigen/SVD> ``` See also [computeScalingRotation()](classeigen_1_1transform#a247b079c63f46bb652b3776484838216), [rotation()](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746), class SVD computeScalingRotation() ------------------------ template<typename Scalar , int Dim, int Mode, int Options> template<typename ScalingMatrixType , typename RotationMatrixType > | | | | | | --- | --- | --- | --- | | void [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::computeScalingRotation | ( | ScalingMatrixType \* | *scaling*, | | | | RotationMatrixType \* | *rotation* | | | ) | | const | decomposes the linear part of the transformation as a product scaling x rotation, the scaling being not necessarily positive. If either pointer is zero, the corresponding computation is skipped. This is defined in the SVD module. ``` #include <Eigen/SVD> ``` See also [computeRotationScaling()](classeigen_1_1transform#a7213fd78501c1185c4a1441e33c812d3), [rotation()](classeigen_1_1transform#ad73300a550f878bb7f34485c3d132746), class SVD data() [1/2] ------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d)\* [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::data | ( | | ) | | | inline | Returns a non-const pointer to the column major internal matrix data() [2/2] ------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d)\* [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::data | ( | | ) | const | | inline | Returns a const pointer to the column major internal matrix EIGEN\_MAKE\_ALIGNED\_OPERATOR\_NEW\_IF\_VECTORIZABLE\_FIXED\_SIZE() -------------------------------------------------------------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::EIGEN\_MAKE\_ALIGNED\_OPERATOR\_NEW\_IF\_VECTORIZABLE\_FIXED\_SIZE | ( | \_Scalar | , | | | | \_Dim | = `=[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) : (_Dim+1)*(_Dim+1)` | | | ) | | | | inline | < space dimension in which the transformation holds < size of a respective homogeneous vector fromPositionOrientationScale() ------------------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename PositionDerived , typename OrientationType , typename ScaleDerived > | | | | | | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::fromPositionOrientationScale | ( | const [MatrixBase](classeigen_1_1matrixbase)< PositionDerived > & | *position*, | | | | const OrientationType & | *orientation*, | | | | const [MatrixBase](classeigen_1_1matrixbase)< ScaleDerived > & | *scale* | | | ) | | | Convenient method to set `*this` from a position, orientation and scale of a 3D object. Identity() ---------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | static const [Transform](classeigen_1_1transform) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::Identity | ( | | ) | | | inlinestatic | Returns an identity transformation. inverse() --------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::inverse | ( | [TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) | *hint* = `([TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107))Mode` | ) | const | | inline | Returns the inverse transformation according to some given knowledge on `*this`. Parameters | | | | --- | --- | | hint | allows to optimize the inversion process when the transformation is known to be not a general transformation (optional). The possible values are:* [Projective](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0f7338b8672884554e8642bce9e44183) if the transformation is not necessarily affine, i.e., if the last row is not guaranteed to be [0 ... 0 1] * [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) if the last row can be assumed to be [0 ... 0 1] * [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) if the transformation is only a concatenations of translations and rotations. The default is the template class parameter `Mode`. | Warning unless *traits* is always set to NoShear or NoScaling, this function requires the generic inverse method of [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") defined in the LU module. If you forget to include this module, then you will get hard to debug linking errors. See also [MatrixBase::inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) isApprox() ---------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::isApprox | ( | const [Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options > & | *other*, | | | | const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) >::Real & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d)>::dummy_precision()` | | | ) | | const | | inline | Returns `true` if `*this` is approximately equal to *other*, within the precision determined by *prec*. See also [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) linear() [1/2] -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [LinearPart](classeigen_1_1transform#a2195bd42561e691a8f6e7d989e77f328) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::linear | ( | | ) | | | inline | Returns a writable expression of the linear part of the transformation linear() [2/2] -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ConstLinearPart](classeigen_1_1transform#a75810d3f0d098e00b43a5531f33d78e1) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::linear | ( | | ) | const | | inline | Returns a read-only expression of the linear part of the transformation makeAffine() ------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::makeAffine | ( | | ) | | | inline | Sets the last row to [0 ... 0 1] matrix() [1/2] -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c)& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::matrix | ( | | ) | | | inline | Returns a writable expression of the transformation matrix matrix() [2/2] -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [MatrixType](classeigen_1_1transform#a30f72ba46abc2bb3c7fa919c1078fc9c)& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::matrix | ( | | ) | const | | inline | Returns a read-only expression of the transformation matrix operator()() [1/2] ------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d)& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator() | ( | [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) | *row*, | | | | [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) | *col* | | | ) | | | | inline | shortcut for m\_matrix(row,col); See also MatrixBase::operator(Index,Index) operator()() [2/2] ------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator() | ( | [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) | *row*, | | | | [Index](classeigen_1_1transform#a49df3689ac2b736bcb564dec47d6486c) | *col* | | | ) | | const | | inline | shortcut for m\_matrix(row,col); See also MatrixBase::operator(Index,Index) const operator\*() [1/4] ------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename DiagonalDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [TransformTimeDiagonalReturnType](classeigen_1_1transform#a51af5e8d8d9d9bfec091ff8aa5b7845a) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator\* | ( | const DiagonalBase< DiagonalDerived > & | *b* | ) | const | | inline | Returns The product expression of a transform *a* times a diagonal matrix *b* The rhs diagonal matrix is interpreted as an affine scaling transformation. The product results in a [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") of the same type (mode) as the lhs only if the lhs mode is no isometry. In that case, the returned transform is an affinity. operator\*() [2/4] ------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const internal::transform\_right\_product\_impl<[Transform](classeigen_1_1transform), OtherDerived>::ResultType [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator\* | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | const | | inline | Returns an expression of the product between the transform `*this` and a matrix expression *other*. The right-hand-side *other* can be either: * an homogeneous vector of size Dim+1, * a set of homogeneous vectors of size Dim+1 x N, * a transformation matrix of size Dim+1 x Dim+1. Moreover, if `*this` represents an affine transformation (i.e., Mode!=Projective), then *other* can also be: * a point of size Dim (computes: ``` this->[linear](classeigen_1_1transform#af8c38249632146453785add778dc1081)() * other + this->[translation](classeigen_1_1transform#adf4c6d97bd3f10edfa95bb04331ec8ed)() ``` ), * a set of N points as a Dim x N matrix (computes: ``` (this->[linear](classeigen_1_1transform#af8c38249632146453785add778dc1081)() * other).colwise() + this->[translation](classeigen_1_1transform#adf4c6d97bd3f10edfa95bb04331ec8ed)() ``` ), In all cases, the return type is a matrix or vector of same sizes as the right-hand-side *other*. If you want to interpret *other* as a linear or affine transformation, then first convert it to a Transform<> type, or do your own cooking. Finally, if you want to apply Affine transformations to vectors, then explicitly apply the linear part only: ``` Affine3f A; Vector3f v1, v2; v2 = A.linear() * v1; ``` operator\*() [3/4] ------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Transform](classeigen_1_1transform) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator\* | ( | const [Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options > & | *other* | ) | const | | inline | Concatenates two transformations operator\*() [4/4] ------------------ template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<int OtherMode, int OtherOptions> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | internal::transform\_transform\_product\_impl<[Transform](classeigen_1_1transform),[Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,OtherMode,OtherOptions> >::ResultType [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator\* | ( | const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, OtherMode, OtherOptions > & | *other* | ) | const | | inline | Concatenates two different transformations operator=() [1/3] ----------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::operator= | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | Set `*this` from a Dim^2 or (Dim+1)^2 matrix. operator=() [2/3] ----------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::operator= | ( | const QMatrix & | *other* | ) | | | inline | Set `*this` from a QMatrix assuming the dimension is 2. This function is available only if the token EIGEN\_QT\_SUPPORT is defined. operator=() [3/3] ----------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::operator= | ( | const QTransform< \_Scalar, \_Dim, \_Mode, \_Options > & | *other* | ) | | | inline | Set `*this` from a QTransform assuming the dimension is 2. This function is available only if the token EIGEN\_QT\_SUPPORT is defined. prerotate() ----------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename RotationType > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::prerotate | ( | const RotationType & | *rotation* | ) | | Applies on the left the rotation represented by the rotation *rotation* to `*this` and returns a reference to `*this`. See rotate() for further details. See also rotate() prescale() [1/2] ---------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::prescale | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | Applies on the left the non uniform scale transformation represented by the vector *other* to `*this` and returns a reference to `*this`. See also scale() prescale() [2/2] ---------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::prescale | ( | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | *s* | ) | | | inline | Applies on the left a uniform scale of a factor *c* to `*this` and returns a reference to `*this`. See also scale(Scalar) preshear() ---------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::preshear | ( | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | *sx*, | | | | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | *sy* | | | ) | | | Applies on the left the shear transformation represented by the vector *other* to `*this` and returns a reference to `*this`. Warning 2D only. See also [shear()](classeigen_1_1transform#ae93a25d5e15af9446d7e5bc0e7a959d0) pretranslate() -------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::pretranslate | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | Applies on the left the translation matrix represented by the vector *other* to `*this` and returns a reference to `*this`. See also translate() rotate() -------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename RotationType > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::rotate | ( | const RotationType & | *rotation* | ) | | Applies on the right the rotation represented by the rotation *rotation* to `*this` and returns a reference to `*this`. The template parameter *RotationType* is the type of the rotation which must be known by internal::toRotationMatrix<>. Natively supported types includes: * any scalar (2D), * a Dim x Dim matrix expression, * a [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") (3D), * a [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.") (3D) This mechanism is easily extendable to support user types such as Euler angles, or a pair of [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") for 4D rotations. See also rotate(Scalar), class [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), class [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis."), prerotate(RotationType) rotation() ---------- template<typename Scalar , int Dim, int Mode, int Options> | | | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::RotationReturnType [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::rotation | Returns the rotation part of the transformation If Mode==Isometry, then this method is an alias for [linear()](classeigen_1_1transform#ad36538ee2c2970722eff343ee1bbfc7c), otherwise it calls [computeRotationScaling()](classeigen_1_1transform#a7213fd78501c1185c4a1441e33c812d3) to extract the rotation through a SVD decomposition. This is defined in the SVD module. ``` #include <Eigen/SVD> ``` See also [computeRotationScaling()](classeigen_1_1transform#a7213fd78501c1185c4a1441e33c812d3), [computeScalingRotation()](classeigen_1_1transform#a247b079c63f46bb652b3776484838216), class SVD scale() [1/2] ------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::scale | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | Applies on the right the non uniform scale transformation represented by the vector *other* to `*this` and returns a reference to `*this`. See also prescale() scale() [2/2] ------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::scale | ( | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | *s* | ) | | | inline | Applies on the right a uniform scale of a factor *c* to `*this` and returns a reference to `*this`. See also prescale(Scalar) setIdentity() ------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::setIdentity | ( | | ) | | | inline | See also [MatrixBase::setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683) shear() ------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options > & [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::shear | ( | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | *sx*, | | | | const [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d) & | *sy* | | | ) | | | Applies on the right the shear transformation represented by the vector *other* to `*this` and returns a reference to `*this`. Warning 2D only. See also [preshear()](classeigen_1_1transform#a17c40209cfd2d094cf654504aca95bf1) toQMatrix() ----------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | QMatrix [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::toQMatrix | ( | void | | ) | const | | inline | Returns a QMatrix from `*this` assuming the dimension is 2. Warning this conversion might loss data if `*this` is not affine This function is available only if the token EIGEN\_QT\_SUPPORT is defined. toQTransform() -------------- template<typename Scalar , int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | QTransform [Eigen::Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d), Dim, Mode, Options >::toQTransform | ( | void | | ) | const | | inline | Returns a QTransform from `*this` assuming the dimension is 2. This function is available only if the token EIGEN\_QT\_SUPPORT is defined. translate() ----------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1transform#a4e69ced9d651745b8ed4eda46f41795d),Dim,Mode,Options>& [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::translate | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | Applies on the right the translation matrix represented by the vector *other* to `*this` and returns a reference to `*this`. See also pretranslate() translation() [1/2] ------------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [TranslationPart](classeigen_1_1transform#aabeaa2d375bf1b6b1d5cb5d1904fbd06) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::translation | ( | | ) | | | inline | Returns a writable expression of the translation vector of the transformation translation() [2/2] ------------------- template<typename \_Scalar , int \_Dim, int \_Mode, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ConstTranslationPart](classeigen_1_1transform#a3eab3259d3fac8106eb3139bc96ba852) [Eigen::Transform](classeigen_1_1transform)< \_Scalar, \_Dim, \_Mode, \_Options >::translation | ( | | ) | const | | inline | Returns a read-only expression of the translation vector of the transformation --- The documentation for this class was generated from the following file:* [Transform.h](https://eigen.tuxfamily.org/dox/Transform_8h_source.html)
programming_docs
eigen3 Eigen::SparseLU Eigen::SparseLU =============== ### template<typename \_MatrixType, typename \_OrderingType> class Eigen::SparseLU< \_MatrixType, \_OrderingType > [Sparse](structeigen_1_1sparse) supernodal LU factorization for general matrices. This class implements the supernodal LU factorization for general matrices. It uses the main techniques from the sequential [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") package (<http://crd-legacy.lbl.gov/~xiaoye/SuperLU/>). It handles transparently real and complex arithmetic with single and double precision, depending on the scalar type of your input matrix. The code has been optimized to provide BLAS-3 operations during supernode-panel updates. It benefits directly from the built-in high-performant [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") BLAS routines. Moreover, when the size of a supernode is very small, the BLAS calls are avoided to enable a better optimization from the compiler. For best performance, you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors. An important parameter of this class is the ordering method. It is used to reorder the columns (and eventually the rows) of the matrix to reduce the number of new elements that are created during numerical factorization. The cheapest method available is COLAMD. See [the OrderingMethods module](group__orderingmethods__module) for the list of built-in and external ordering methods. Simple example with key steps ``` VectorXd x(n), b(n); SparseMatrix<double> A; SparseLU<SparseMatrix<double>, COLAMDOrdering<int> > solver; // fill A and b; // Compute the ordering permutation vector from the structural pattern of A solver.analyzePattern(A); // Compute the numerical factorization solver.factorize(A); //Use the factors to solve the linear system x = solver.solve(b); ``` Warning The input matrix A should be in a **compressed** and **column-major** form. Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. Note Unlike the initial [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") implementation, there is no step to equilibrate the matrix. For badly scaled matrices, this step can be useful to reduce the pivoting during factorization. If this is the case for your matrices, you can try the basic scaling method at "unsupported/Eigen/src/IterativeSolvers/Scaling.h" Template Parameters | | | | --- | --- | | \_MatrixType | The type of the sparse matrix. It must be a column-major SparseMatrix<> | | \_OrderingType | The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) [OrderingMethods module](group__orderingmethods__module) | | | --- | | | | Scalar | [absDeterminant](classeigen_1_1sparselu#a06fa89424239fb169d408f08252426d0) () | | | | const SparseLUTransposeView< true, [SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType > > | [adjoint](classeigen_1_1sparselu#abfb5115138d22e69a13370d766ed2576) () | | | | void | [analyzePattern](classeigen_1_1sparselu#aa907ff958c4f4855145091d2686f3a8a) (const MatrixType &matrix) | | | | const [PermutationType](classeigen_1_1permutationmatrix) & | [colsPermutation](classeigen_1_1sparselu#ab7b0d15d0d9fd1faa164298f92ca59cd) () const | | | | void | [compute](classeigen_1_1sparselu#a96a8dcb02015ab9be5777d4ba9173266) (const MatrixType &matrix) | | | | Scalar | [determinant](classeigen_1_1sparselu#a02d63d242d27211b5c5827f5d4fd99ff) () | | | | void | [factorize](classeigen_1_1sparselu#a39858b0e72f2659d596364e252b34cbc) (const MatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1sparselu#ab0d0c1744ffd5a1dff578a44bcef2a3d) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1sparselu#ab0d0c1744ffd5a1dff578a44bcef2a3d) | | | | void | [isSymmetric](classeigen_1_1sparselu#afff3bd506cd78172e5219c707562729f) (bool sym) | | | | std::string | [lastErrorMessage](classeigen_1_1sparselu#a5458c4e851d7d75c8ca92c4fd02d2adb) () const | | | | Scalar | [logAbsDeterminant](classeigen_1_1sparselu#a89e30a7df205596784a5a73f4768eaec) () const | | | | SparseLUMatrixLReturnType< SCMatrix > | [matrixL](classeigen_1_1sparselu#a634abe55e5a076f2e10db78871105a8f) () const | | | | SparseLUMatrixUReturnType< SCMatrix, [MappedSparseMatrix](classeigen_1_1mappedsparsematrix)< Scalar, [ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62), StorageIndex > > | [matrixU](classeigen_1_1sparselu#aaf395a8fca527144215ff19cc7b8b637) () const | | | | const [PermutationType](classeigen_1_1permutationmatrix) & | [rowsPermutation](classeigen_1_1sparselu#a691295e65c06df599876d78ac2c7fada) () const | | | | void | [setPivotThreshold](classeigen_1_1sparselu#a94c726c9ebb71a60b529fe47d942ad57) (const RealScalar &thresh) | | | | Scalar | [signDeterminant](classeigen_1_1sparselu#a6651143e3b18fa90cfb3808b6fd23c4e) () | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< [SparseLU](classeigen_1_1sparselu), Rhs > | [solve](classeigen_1_1sparselu#a0b10cb439f52ce1b85a371fca8c79b89) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &B) const | | | | const SparseLUTransposeView< false, [SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType > > | [transpose](classeigen_1_1sparselu#a9b2faf06fd28c92230e74d114cc3b80b) () | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< SparseLU< \_MatrixType, \_OrderingType > >](classeigen_1_1sparsesolverbase) | | const [Solve](classeigen_1_1solve)< [SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | const [Solve](classeigen_1_1solve)< [SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | absDeterminant() ---------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::absDeterminant | ( | | ) | | | inline | Returns the absolute value of the determinant of the matrix of which \*this is the QR decomposition. Warning a determinant can be very big or small, so for matrices of large enough dimension, there is a risk of overflow/underflow. One way to work around that is to use [logAbsDeterminant()](classeigen_1_1sparselu#a89e30a7df205596784a5a73f4768eaec) instead. See also [logAbsDeterminant()](classeigen_1_1sparselu#a89e30a7df205596784a5a73f4768eaec), [signDeterminant()](classeigen_1_1sparselu#a6651143e3b18fa90cfb3808b6fd23c4e) adjoint() --------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const SparseLUTransposeView<true, [SparseLU](classeigen_1_1sparselu)<\_MatrixType,\_OrderingType> > [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::adjoint | ( | | ) | | | inline | Returns an expression of the adjoint of the factored matrix A typical usage is to solve for the adjoint problem A' x = b: ``` solver.compute(A); x = solver.adjoint().solve(b); ``` For real scalar types, this function is equivalent to [transpose()](classeigen_1_1sparselu#a9b2faf06fd28c92230e74d114cc3b80b). See also [transpose()](classeigen_1_1sparselu#a9b2faf06fd28c92230e74d114cc3b80b), [solve()](classeigen_1_1sparselu#a0b10cb439f52ce1b85a371fca8c79b89) analyzePattern() ---------------- template<typename MatrixType , typename OrderingType > | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseLU](classeigen_1_1sparselu)< MatrixType, OrderingType >::analyzePattern | ( | const MatrixType & | *mat* | ) | | Compute the column permutation to minimize the fill-in * Apply this permutation to the input matrix - * Compute the column elimination tree on the permuted matrix * Postorder the elimination tree and the column permutation colsPermutation() ----------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [PermutationType](classeigen_1_1permutationmatrix)& [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::colsPermutation | ( | | ) | const | | inline | Returns a reference to the column matrix permutation \( P\_c^T \) such that \(P\_r A P\_c^T = L U\) See also [rowsPermutation()](classeigen_1_1sparselu#a691295e65c06df599876d78ac2c7fada) compute() --------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the symbolic and numeric factorization of the input sparse matrix. The input matrix should be in column-major storage. determinant() ------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::determinant | ( | | ) | | | inline | Returns The determinant of the matrix. See also [absDeterminant()](classeigen_1_1sparselu#a06fa89424239fb169d408f08252426d0), [logAbsDeterminant()](classeigen_1_1sparselu#a89e30a7df205596784a5a73f4768eaec) factorize() ----------- template<typename MatrixType , typename OrderingType > | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseLU](classeigen_1_1sparselu)< MatrixType, OrderingType >::factorize | ( | const MatrixType & | *matrix* | ) | | * Numerical factorization * Interleaved with the symbolic factorization On exit, info is = 0: successful factorization > 0: if info = i, and i is > > <= A->ncol: U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations. > A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol. If lwork = -1, it is the estimated amount of space needed, plus A->ncol. info() ------ template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NumericalIssue` if the LU factorization reports a problem, zero diagonal for instance `InvalidInput` if the input matrix is invalid See also iparm() isSymmetric() ------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::isSymmetric | ( | bool | *sym* | ) | | | inline | Indicate that the pattern of the input matrix is symmetric lastErrorMessage() ------------------ template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | std::string [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::lastErrorMessage | ( | | ) | const | | inline | Returns A string describing the type of error logAbsDeterminant() ------------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::logAbsDeterminant | ( | | ) | const | | inline | Returns the natural log of the absolute value of the determinant of the matrix of which \*\*this is the QR decomposition Note This method is useful to work around the risk of overflow/underflow that's inherent to the determinant computation. See also [absDeterminant()](classeigen_1_1sparselu#a06fa89424239fb169d408f08252426d0), [signDeterminant()](classeigen_1_1sparselu#a6651143e3b18fa90cfb3808b6fd23c4e) matrixL() --------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | SparseLUMatrixLReturnType<SCMatrix> [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::matrixL | ( | | ) | const | | inline | Returns an expression of the matrix L, internally stored as supernodes The only operation available with this expression is the triangular solve ``` y = b; [matrixL](classeigen_1_1sparselu#a634abe55e5a076f2e10db78871105a8f)().solveInPlace(y); ``` matrixU() --------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | SparseLUMatrixUReturnType<SCMatrix,[MappedSparseMatrix](classeigen_1_1mappedsparsematrix)<Scalar,[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62),StorageIndex> > [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::matrixU | ( | | ) | const | | inline | Returns an expression of the matrix U, The only operation available with this expression is the triangular solve ``` y = b; [matrixU](classeigen_1_1sparselu#aaf395a8fca527144215ff19cc7b8b637)().solveInPlace(y); ``` rowsPermutation() ----------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [PermutationType](classeigen_1_1permutationmatrix)& [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::rowsPermutation | ( | | ) | const | | inline | Returns a reference to the row matrix permutation \( P\_r \) such that \(P\_r A P\_c^T = L U\) See also [colsPermutation()](classeigen_1_1sparselu#ab7b0d15d0d9fd1faa164298f92ca59cd) setPivotThreshold() ------------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::setPivotThreshold | ( | const RealScalar & | *thresh* | ) | | | inline | Set the threshold used for a diagonal entry to be an acceptable pivot. signDeterminant() ----------------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::signDeterminant | ( | | ) | | | inline | Returns A number representing the sign of the determinant See also [absDeterminant()](classeigen_1_1sparselu#a06fa89424239fb169d408f08252426d0), [logAbsDeterminant()](classeigen_1_1sparselu#a89e30a7df205596784a5a73f4768eaec) solve() ------- template<typename \_MatrixType , typename \_OrderingType > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<[SparseLU](classeigen_1_1sparselu), Rhs> [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *B* | ) | const | | inline | Returns the solution X of \( A X = B \) using the current decomposition of A. Warning the destination matrix X in X = this->solve(B) must be colmun-major. See also [compute()](classeigen_1_1sparselu#a96a8dcb02015ab9be5777d4ba9173266) transpose() ----------- template<typename \_MatrixType , typename \_OrderingType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const SparseLUTransposeView<false,[SparseLU](classeigen_1_1sparselu)<\_MatrixType,\_OrderingType> > [Eigen::SparseLU](classeigen_1_1sparselu)< \_MatrixType, \_OrderingType >::transpose | ( | | ) | | | inline | Returns an expression of the transposed of the factored matrix. A typical usage is to solve for the transposed problem A^T x = b: ``` solver.compute(A); x = solver.transpose().solve(b); ``` See also [adjoint()](classeigen_1_1sparselu#abfb5115138d22e69a13370d766ed2576), [solve()](classeigen_1_1sparselu#a0b10cb439f52ce1b85a371fca8c79b89) --- The documentation for this class was generated from the following file:* [SparseLU.h](https://eigen.tuxfamily.org/dox/SparseLU_8h_source.html) eigen3 Householder module Householder module ================== This module provides Householder transformations. ``` #include <Eigen/Householder> ``` | | | --- | | | | class | [Eigen::HouseholderSequence< VectorsType, CoeffsType, Side >](classeigen_1_1householdersequence) | | | Sequence of Householder reflections acting on subspaces with decreasing size. [More...](classeigen_1_1householdersequence#details) | | | | | | --- | | | | template<typename VectorsType , typename CoeffsType > | | [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType > | [Eigen::householderSequence](group__householder__module#ga5f2b3f80cdf7ae96609e4a8d2e55e371) (const VectorsType &v, const CoeffsType &h) | | | Convenience function for constructing a Householder sequence. [More...](group__householder__module#ga5f2b3f80cdf7ae96609e4a8d2e55e371) | | | | template<typename VectorsType , typename CoeffsType > | | [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, [OnTheRight](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba329fc3a54ceb2b6e0e73b400998b8a82) > | [Eigen::rightHouseholderSequence](group__householder__module#ga897ebce658762148f706f73a05525e89) (const VectorsType &v, const CoeffsType &h) | | | Convenience function for constructing a Householder sequence. [More...](group__householder__module#ga897ebce658762148f706f73a05525e89) | | | householderSequence() --------------------- template<typename VectorsType , typename CoeffsType > | | | | | | --- | --- | --- | --- | | [HouseholderSequence](classeigen_1_1householdersequence)<VectorsType,CoeffsType> Eigen::householderSequence | ( | const VectorsType & | *v*, | | | | const CoeffsType & | *h* | | | ) | | | Convenience function for constructing a Householder sequence. % . \ # </> \ Returns A [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size.") constructed from the specified arguments. rightHouseholderSequence() -------------------------- template<typename VectorsType , typename CoeffsType > | | | | | | --- | --- | --- | --- | | [HouseholderSequence](classeigen_1_1householdersequence)<VectorsType,CoeffsType,[OnTheRight](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba329fc3a54ceb2b6e0e73b400998b8a82)> Eigen::rightHouseholderSequence | ( | const VectorsType & | *v*, | | | | const CoeffsType & | *h* | | | ) | | | Convenience function for constructing a Householder sequence. % . \ # </> \ Returns A [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size.") constructed from the specified arguments. This function differs from [householderSequence()](group__householder__module#ga5f2b3f80cdf7ae96609e4a8d2e55e371 "Convenience function for constructing a Householder sequence.") in that the template argument `OnTheSide` of the constructed [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size.") is set to OnTheRight, instead of the default OnTheLeft.
programming_docs
eigen3 Using Intel® MKL from Eigen Using Intel® MKL from Eigen =========================== Since Eigen version 3.1 and later, users can benefit from built-in Intel® Math Kernel Library (MKL) optimizations with an installed copy of Intel MKL 10.3 (or later). [Intel MKL](http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php) provides highly optimized multi-threaded mathematical routines for x86-compatible architectures. Intel MKL is available on Linux, Mac and Windows for both Intel64 and IA32 architectures. Note Intel® MKL is a proprietary software and it is the responsibility of users to buy or register for community (free) Intel MKL licenses for their products. Moreover, the license of the user product has to allow linking to proprietary software that excludes any unmodified versions of the GPL. Using Intel MKL through Eigen is easy: 1. define the `EIGEN_USE_MKL_ALL` macro before including any Eigen's header 2. link your program to MKL libraries (see the [MKL linking advisor](http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/)) 3. on a 64bits system, you must use the LP64 interface (not the ILP64 one) When doing so, a number of Eigen's algorithms are silently substituted with calls to Intel MKL routines. These substitutions apply only for **Dynamic** **or** **large** enough objects with one of the following four standard scalar types: `float`, `double`, `complex<float>`, and `complex<double>`. Operations on other scalar types or mixing reals and complexes will continue to use the built-in algorithms. In addition you can choose which parts will be substituted by defining one or multiple of the following macros: | | | | --- | --- | | `EIGEN_USE_BLAS` | Enables the use of external BLAS level 2 and 3 routines | | `EIGEN_USE_LAPACKE` | Enables the use of external Lapack routines via the [Lapacke](http://www.netlib.org/lapack/lapacke.html) C interface to Lapack | | `EIGEN_USE_LAPACKE_STRICT` | Same as `EIGEN_USE_LAPACKE` but algorithm of lower robustness are disabled. This currently concerns only [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") which otherwise would be replaced by `gesvd` that is less robust than Jacobi rotations. | | `EIGEN_USE_MKL_VML` | Enables the use of Intel VML (vector operations) | | `EIGEN_USE_MKL_ALL` | Defines `EIGEN_USE_BLAS`, `EIGEN_USE_LAPACKE`, and `EIGEN_USE_MKL_VML` | The `EIGEN_USE_BLAS` and `EIGEN_USE_LAPACKE*` macros can be combined with `EIGEN_USE_MKL` to explicitly tell [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") that the underlying BLAS/Lapack implementation is Intel MKL. The main effect is to enable MKL direct call feature (`MKL_DIRECT_CALL`). This may help to increase performance of some MKL BLAS (?GEMM, ?GEMV, ?TRSM, ?AXPY and ?DOT) and LAPACK (LU, Cholesky and QR) routines for very small matrices. MKL direct call can be disabled by defining `EIGEN_MKL_NO_DIRECT_CALL`. Note that the BLAS and LAPACKE backends can be enabled for any F77 compatible BLAS and LAPACK libraries. See this [page](topicusingblaslapack) for the details. Finally, the PARDISO sparse solver shipped with Intel MKL can be used through the [PardisoLU](classeigen_1_1pardisolu), [PardisoLLT](classeigen_1_1pardisollt) and [PardisoLDLT](classeigen_1_1pardisoldlt) classes of the [PardisoSupport module](group__pardisosupport__module). The following table summarizes the list of functions covered by `EIGEN_USE_MKL_VML:` | Code example | MKL routines | | --- | --- | | ``` v2=v1.array().sin(); v2=v1.array().asin(); v2=v1.array().cos(); v2=v1.array().acos(); v2=v1.array().tan(); v2=v1.array().exp(); v2=v1.array().log(); v2=v1.array().sqrt(); v2=v1.array().square(); v2=v1.array().pow(1.5); ``` | ``` v?Sin v?Asin v?Cos v?Acos v?Tan v?Exp v?Ln v?Sqrt v?Sqr v?Powx ``` | In the examples, v1 and v2 are dense vectors. Links ======= * Intel MKL can be purchased and downloaded [here](http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php). * Intel MKL is also bundled with [Intel Composer XE](http://software.intel.com/en-us/articles/intel-composer-xe/). eigen3 Eigen::MatrixWrapper Eigen::MatrixWrapper ==================== ### template<typename ExpressionType> class Eigen::MatrixWrapper< ExpressionType > Expression of an array as a mathematical vector or matrix. This class is the return type of [ArrayBase::matrix()](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c), and most of the time this is the only way it is use. See also MatrixBase::matrix(), class [ArrayWrapper](classeigen_1_1arraywrapper "Expression of a mathematical vector or matrix as an array object.") | | | --- | | | | void | [resize](classeigen_1_1matrixwrapper#a780b21d85415ae4849a914f522d531c4) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) newSize) | | | | void | [resize](classeigen_1_1matrixwrapper#a9579312bf37b956c95a56a47f1a0f5a0) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | | Public Member Functions inherited from [Eigen::MatrixBase< MatrixWrapper< ExpressionType > >](classeigen_1_1matrixbase) | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [acosh](classeigen_1_1matrixbase#a765140ddee0c6b39bbfa3b8917de67be) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::acosh . [More...](classeigen_1_1matrixbase#a765140ddee0c6b39bbfa3b8917de67be) | | | | const AdjointReturnType | [adjoint](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) () const | | | | void | [adjointInPlace](classeigen_1_1matrixbase#a51c5982c1f64e45a939515b701fa6f4a) () | | | | void | [applyHouseholderOnTheLeft](classeigen_1_1matrixbase#a8f2c8059ef3f04cfa0c73b4c012db855) (const EssentialPart &essential, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*workspace) | | | | void | [applyHouseholderOnTheRight](classeigen_1_1matrixbase#ab3e52262b41fa40e194dda245e0f9675) (const EssentialPart &essential, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*workspace) | | | | void | [applyOnTheLeft](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | void | [applyOnTheLeft](classeigen_1_1matrixbase#ae669131f6e18f7e8f06fae271754f435) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) p, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) q, const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > &j) | | | | void | [applyOnTheRight](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | void | [applyOnTheRight](group__jacobi__module#gaa07f741c86219601664433777827bf1c) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) p, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) q, const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > &j) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [array](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) () | | | | const [ArrayWrapper](classeigen_1_1arraywrapper)< const [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [array](classeigen_1_1matrixbase#a72f287fe7b2a7e7a66d16cc88166d47f) () const | | | | const [DiagonalWrapper](classeigen_1_1diagonalwrapper)< const [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [asDiagonal](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0) () const | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [asinh](classeigen_1_1matrixbase#a8efaf691d9c74b362a43b1b793706ea1) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic sine use ArrayBase::asinh . [More...](classeigen_1_1matrixbase#a8efaf691d9c74b362a43b1b793706ea1) | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [atanh](classeigen_1_1matrixbase#ab87d29c00e6d75aeab43eff53bf5164c) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::atanh . [More...](classeigen_1_1matrixbase#ab87d29c00e6d75aeab43eff53bf5164c) | | | | [BDCSVD](classeigen_1_1bdcsvd)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [bdcSvd](classeigen_1_1matrixbase#ae171b74b5d530846ee0836135ffcf837) (unsigned int computationOptions=0) const | | | | RealScalar | [blueNorm](classeigen_1_1matrixbase#a3f3faa00163c16824ff03e58a210c74c) () const | | | | const [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [colPivHouseholderQr](classeigen_1_1matrixbase#adee8c19c833245bbb00a591dce68e8a4) () const | | | | const [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [completeOrthogonalDecomposition](classeigen_1_1matrixbase#ae90b6846f05bd30b8d52b66e427e3e09) () const | | | | void | [computeInverseAndDetWithCheck](classeigen_1_1matrixbase#a7baaf2fdec0191a2166cf9fd84a2dcb2) (ResultType &[inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), typename ResultType::Scalar &[determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061), bool &invertible, const RealScalar &absDeterminantThreshold=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | void | [computeInverseWithCheck](classeigen_1_1matrixbase#a116f3b50d2af7dbdf7473e517a5b8b0f) (ResultType &[inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), bool &invertible, const RealScalar &absDeterminantThreshold=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [cos](classeigen_1_1matrixbase#a34d626eb756bbeb4069d1eb0e6494c65) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise cosine use ArrayBase::cos . [More...](classeigen_1_1matrixbase#a34d626eb756bbeb4069d1eb0e6494c65) | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [cosh](classeigen_1_1matrixbase#a627e6f11bf5854ade9a5abfc344c0367) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic cosine use ArrayBase::cosh . [More...](classeigen_1_1matrixbase#a627e6f11bf5854ade9a5abfc344c0367) | | | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [cross](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [cross3](group__geometry__module#gabde56e2a0baba550815a0b05139e4d42) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) () const | | | | [DiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3) () | | | | [ConstDiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#aebdeedcf67e46d969c556c6c7d9780ee) () const | | | | [DiagonalDynamicIndexReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index) | | | | [ConstDiagonalDynamicIndexReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#aed11a711c0a3d5dbf8bc094008e29846) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index) const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [diagonalSize](classeigen_1_1matrixbase#ab79e511b9322b8b801858e253fb257eb) () const | | | | [ScalarBinaryOpTraits](structeigen_1_1scalarbinaryoptraits)< typename internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), typename internal::traits< OtherDerived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::ReturnType | [dot](classeigen_1_1matrixbase#adfd32bf5fcf6ee603c924dde9bf7bc39) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | EigenvaluesReturnType | [eigenvalues](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d) () const | | | Computes the eigenvalues of a matrix. [More...](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d) | | | | [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), 3, 1 > | [eulerAngles](group__geometry__module#ga17994d2e81b723295f5bc3b1f862ed3b) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) a0, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) a1, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) a2) const | | | | const MatrixExponentialReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [exp](classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise exponential use ArrayBase::exp . [More...](classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [forceAlignedAccess](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699) () | | | | const [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [forceAlignedAccess](classeigen_1_1matrixbase#ad2fdb842d9a715f8778d0b33c29cfe49) () const | | | | internal::conditional< Enable, [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >, [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & >::type | [forceAlignedAccessIf](classeigen_1_1matrixbase#ae35213d1dd4dd13ebe9a7a762d6bb847) () | | | | internal::add\_const\_on\_value\_type< typename internal::conditional< Enable, [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >, [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & >::type >::type | [forceAlignedAccessIf](classeigen_1_1matrixbase#af42d92f115d4b8fa3d5aa731ed496ed1) () const | | | | const [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [fullPivHouseholderQr](classeigen_1_1matrixbase#a863bc0e06b641a089508eabec6835ab2) () const | | | | const [FullPivLU](classeigen_1_1fullpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [fullPivLu](classeigen_1_1matrixbase#a25da97d31acab0ee5d9d13bdbb0569da) () const | | | | const HNormalizedReturnType | [hnormalized](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) () const | | | homogeneous normalization [More...](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) | | | | [HomogeneousReturnType](classeigen_1_1homogeneous) | [homogeneous](group__geometry__module#gaf3229c2d3669e983075ab91f7f480cb1) () const | | | | const [HouseholderQR](classeigen_1_1householderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [householderQr](classeigen_1_1matrixbase#a9a9377aab1cea26db5f25bab7e682f8f) () const | | | | RealScalar | [hypotNorm](classeigen_1_1matrixbase#a32222d3b6677e6cdf0b801463f329b72) () const | | | | const [Inverse](classeigen_1_1inverse)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) () const | | | | bool | [isDiagonal](classeigen_1_1matrixbase#a97027ea54c8cd1ddb1c578fee5cedc67) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isIdentity](classeigen_1_1matrixbase#a4ccbd8dfa06e9d47b9bf84711f8b9d40) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isLowerTriangular](classeigen_1_1matrixbase#a1e96c42d79a56f0a6ade30ce031e17eb) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isOrthogonal](classeigen_1_1matrixbase#aefdc8e4e4c156fdd79a21479e75dcd8a) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isUnitary](classeigen_1_1matrixbase#a8a7ee34ce202cac3eeea9cf20c9e4833) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isUpperTriangular](classeigen_1_1matrixbase#aae3ec1660bb4ac584220481c54ab4a64) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | [JacobiSVD](classeigen_1_1jacobisvd)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [jacobiSvd](classeigen_1_1matrixbase#a5745dca9c54390633b434e54a1d1eedd) (unsigned int computationOptions=0) const | | | | const [Product](classeigen_1_1product)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, OtherDerived, LazyProduct > | [lazyProduct](classeigen_1_1matrixbase#ae0c280b1066c14ed577021f38876527f) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | const [LDLT](classeigen_1_1ldlt)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [ldlt](classeigen_1_1matrixbase#a0ecf058a0727a4cab8b42d79e95072e1) () const | | | | const [LLT](classeigen_1_1llt)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [llt](classeigen_1_1matrixbase#a90c45f7a30265df792d5aeaddead2635) () const | | | | const MatrixLogarithmReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [log](classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise logarithm use ArrayBase::log . [More...](classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) | | | | RealScalar | [lpNorm](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35) () const | | | | const [PartialPivLU](classeigen_1_1partialpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [lu](classeigen_1_1matrixbase#afb312afbfe960cbda67811552d876fae) () const | | | | void | [makeHouseholder](classeigen_1_1matrixbase#a13291e900f7e81ddc6e5b8802f82092b) (EssentialPart &essential, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, RealScalar &beta) const | | | | void | [makeHouseholderInPlace](classeigen_1_1matrixbase#aebf4bac7dffe2685ab93734fb776e817) ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, RealScalar &beta) | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [matrixFunction](classeigen_1_1matrixbase#a1a6cc9f734eb175e785a1118305245fc) (StemFunction f) const | | | Helper function for the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). | | | | [NoAlias](classeigen_1_1noalias)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, [Eigen::MatrixBase](classeigen_1_1matrixbase) > | [noalias](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) () | | | | RealScalar | [norm](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) () const | | | | void | [normalize](classeigen_1_1matrixbase#ad16303c47ba36f7a41ea264cb26bceb6) () | | | | const [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [normalized](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) () const | | | | bool | [operator!=](classeigen_1_1matrixbase#a028c7ac8094d610042fd0f9feca68f63) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | const [Product](classeigen_1_1product)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, DiagonalDerived, LazyProduct > | [operator\*](classeigen_1_1matrixbase#a36fb95c37f0a454e0e2e5cb120b2df7f) (const DiagonalBase< DiagonalDerived > &[diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3)) const | | | | const [Product](classeigen_1_1product)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, OtherDerived > | [operator\*](classeigen_1_1matrixbase#ae2d220efbf7047f0894787888288cfcc) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator\*=](classeigen_1_1matrixbase#a3783b6168995ca117a1c19fea3630ac4) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator+=](classeigen_1_1matrixbase#a983cc3be0bbe11b3d041a415b76ce010) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator-=](classeigen_1_1matrixbase#a1042124b0ddee66e78ac7b0a9ac4cc9c) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator=](classeigen_1_1matrixbase#a373bf62ad398162df5a71963ed7cbeff) (const [MatrixBase](classeigen_1_1matrixbase) &other) | | | | bool | [operator==](classeigen_1_1matrixbase#a80e3e1e83fdf43f9f7fb6ff51836b24d) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | RealScalar | [operatorNorm](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102) () const | | | Computes the L2 operator norm. [More...](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102) | | | | const [PartialPivLU](classeigen_1_1partialpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [partialPivLu](classeigen_1_1matrixbase#a6199d8aaf26c1b8ac3097fdfa7733a1e) () const | | | | const MatrixPowerReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [pow](classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) (const RealScalar &p) const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use ArrayBase::pow . [More...](classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) | | | | const MatrixComplexPowerReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [pow](classeigen_1_1matrixbase#a91dcacf224bd8b18346914bdf7eefc31) (const std::complex< RealScalar > &p) const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use ArrayBase::pow . [More...](classeigen_1_1matrixbase#a91dcacf224bd8b18346914bdf7eefc31) | | | | [MatrixBase](classeigen_1_1matrixbase)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::template SelfAdjointViewReturnType< UpLo >::Type | [selfadjointView](classeigen_1_1matrixbase#ad446541377593656c1399862fe6a0f94) () | | | | [MatrixBase](classeigen_1_1matrixbase)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::template ConstSelfAdjointViewReturnType< UpLo >::Type | [selfadjointView](classeigen_1_1matrixbase#a67eb836f331d9b567e7f36ec0782fa07) () const | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setIdentity](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683) () | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setIdentity](classeigen_1_1matrixbase#a97dec020729928e328fe8ae9aad1e99e) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | Resizes to the given size, and writes the identity expression (not necessarily square) into \*this. [More...](classeigen_1_1matrixbase#a97dec020729928e328fe8ae9aad1e99e) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setUnit](classeigen_1_1matrixbase#ac7cf3e0e69550d36de8778b09a645afd) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) | | | Set the coefficients of `*this` to the i-th unit (basis) vector. [More...](classeigen_1_1matrixbase#ac7cf3e0e69550d36de8778b09a645afd) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setUnit](classeigen_1_1matrixbase#a90bed3b6468a17a9054b07cde7a751a6) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) newSize, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) | | | Resizes to the given *newSize*, and writes the i-th unit (basis) vector into \*this. [More...](classeigen_1_1matrixbase#a90bed3b6468a17a9054b07cde7a751a6) | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [sin](classeigen_1_1matrixbase#a02f4ff0fcbbae2f3ccaa5981e8ad5e34) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise sine use ArrayBase::sin . [More...](classeigen_1_1matrixbase#a02f4ff0fcbbae2f3ccaa5981e8ad5e34) | | | | const MatrixFunctionReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [sinh](classeigen_1_1matrixbase#a9c37eab2dc7baf83809269254c9129e0) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic sine use ArrayBase::sinh . [More...](classeigen_1_1matrixbase#a9c37eab2dc7baf83809269254c9129e0) | | | | const [SparseView](classeigen_1_1sparseview)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [sparseView](group__sparsecore__module#ga320dd291cbf4339c6118c41521b75350) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &m\_reference=[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)(0), const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &m\_epsilon=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | const MatrixSquareRootReturnValue< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [sqrt](classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise square root use ArrayBase::sqrt . [More...](classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) | | | | RealScalar | [squaredNorm](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) () const | | | | RealScalar | [stableNorm](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1) () const | | | | void | [stableNormalize](classeigen_1_1matrixbase#a0b1443fa322615379557ade3399a3c3c) () | | | | const [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [stableNormalized](classeigen_1_1matrixbase#a399dca938633b9f8df5ec4beefeccec0) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [trace](classeigen_1_1matrixbase#a544b609f65eb2bd3e368b3fc2d79479e) () const | | | | [MatrixBase](classeigen_1_1matrixbase)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::template TriangularViewReturnType< Mode >::Type | [triangularView](classeigen_1_1matrixbase#a56665aa894f49f2765291fee0eaeb9c6) () | | | | [MatrixBase](classeigen_1_1matrixbase)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::template ConstTriangularViewReturnType< Mode >::Type | [triangularView](classeigen_1_1matrixbase#aa044521145e74117ad1df42460d7b520) () const | | | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [unitOrthogonal](group__geometry__module#gaa0dc2c32a9379eeb2b4c4a05c1a6fe52) (void) const | | | | Public Member Functions inherited from [Eigen::DenseBase< MatrixWrapper< ExpressionType > >](classeigen_1_1densebase) | | bool | [all](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) () const | | | | bool | [allFinite](classeigen_1_1densebase#af1e669fd3aaae50a4870dc1b8f3b8884) () const | | | | bool | [any](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [begin](classeigen_1_1densebase#a57591454af931f9dffa71c9da28d5641) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [begin](classeigen_1_1densebase#ad9368ce70b06167ec5fc19398d329f5e) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cbegin](classeigen_1_1densebase#ae9a3dfd9b826ba3103de0128576fb15b) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cend](classeigen_1_1densebase#aeb3b76f02986c2af2521d07164b5ffde) () const | | | | [ColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) () | | | | [ConstColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [count](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [end](classeigen_1_1densebase#ae71d079e16d91360d10066b316b48485) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [end](classeigen_1_1densebase#ab34773522e43bfb02e9cf652d7b5dd60) () const | | | | EvalReturnType | [eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) () const | | | | void | [fill](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | EIGEN\_DEPRECATED const [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const | | | | const [WithFormat](classeigen_1_1withformat)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [format](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) (const [IOFormat](structeigen_1_1ioformat) &fmt) const | | | | bool | [hasNaN](classeigen_1_1densebase#ab13d158c900560d3e1b25d85d2d33dd6) () const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [innerSize](classeigen_1_1densebase#a58ca41d9635a8ab3c5a268ef3f7f0d75) () const | | | | bool | [isApprox](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isApproxToConstant](classeigen_1_1densebase#af9b150d48bc5e4366887ccb466e40c6b) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isConstant](classeigen_1_1densebase#a1ca84e4179b3e5081ed11d89bbd9e74f) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isMuchSmallerThan](classeigen_1_1densebase#a3c4db0c6dd974fa88bbb58b2cf3d5664) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isMuchSmallerThan](classeigen_1_1densebase#adfca6ff4e473f68fbbeabbd03b7504a9) (const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &other, const RealScalar &prec) const | | | | bool | [isOnes](classeigen_1_1densebase#aa56d6b4477cd3c92a9cf42f4b96e47c2) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isZero](classeigen_1_1densebase#af36014ec300f53a65083057ed4e89822) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | EIGEN\_DEPRECATED [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) () const | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#aced8ffda52ff061b6586ace2657ebf30) (IndexType \*index) const | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) (IndexType \*row, IndexType \*col) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7) () const | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) () const | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#ac9265f4f91430b9cc75d63fb6865bb29) (IndexType \*index) const | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) (IndexType \*row, IndexType \*col) const | | | | const [NestByValue](classeigen_1_1nestbyvalue)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [nestByValue](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) () const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [nonZeros](classeigen_1_1densebase#acb8d5574eff335381e7441ade87700a0) () const | | | | [CommaInitializer](structeigen_1_1commainitializer)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [operator<<](classeigen_1_1densebase#a0f0e34696162b34762b2bf4bd948f90c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [CommaInitializer](structeigen_1_1commainitializer)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > | [operator<<](classeigen_1_1densebase#a0e575eb0ba6cc6bc5f347872abd8509d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &s) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator=](classeigen_1_1densebase#a5281dadff89f46eef719b38e5d073a8f) (const [DenseBase](classeigen_1_1densebase) &other) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator=](classeigen_1_1densebase#ab66155169d20c035e80d521a8b918e97) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [operator=](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [outerSize](classeigen_1_1densebase#a03f71699bc26ca2ee4e42ec4538862d7) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) () const | | | | internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [redux](classeigen_1_1densebase#a63ce1e4fab36bff43bbadcdd06a67724) (const Func &func) const | | | | const [Replicate](classeigen_1_1replicate)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, RowFactor, ColFactor > | [replicate](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) () const | | | | const [Replicate](classeigen_1_1replicate)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, Dynamic, Dynamic > | [replicate](classeigen_1_1densebase#afae2d5e36f1158d1b1681dac3cdbd58e) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rowFactor, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) colFactor) const | | | | void | [resize](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) newSize) | | | | void | [resize](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | | [ReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) () | | | | [ConstReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a9e2f3ac4019184abf95ca0e1a8d82866) () const | | | | void | [reverseInPlace](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) () | | | | [RowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) () | | | | [ConstRowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc) () const | | | | const [Select](classeigen_1_1select)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, ThenDerived, ElseDerived > | [select](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | const [Select](classeigen_1_1select)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, ThenDerived, typename ThenDerived::ConstantReturnType > | [select](classeigen_1_1densebase#a57ef09a843004095f84c198dd145641b) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const | | | | const [Select](classeigen_1_1select)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >, typename ElseDerived::ConstantReturnType, ElseDerived > | [select](classeigen_1_1densebase#a9e8e78c75887d4539071a0b7a61ca103) (const typename ElseDerived::Scalar &thenScalar, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setConstant](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setLinSpaced](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setLinSpaced](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setOnes](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) () | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setRandom](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) () | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > & | [setZero](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) () | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) () const | | | | void | [swap](classeigen_1_1densebase#af9e7e4305fdb7781f2b2f05fa801f21e) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | void | [swap](classeigen_1_1densebase#a44e25adc6da9cd1d79f4c5bd7c1819cb) ([PlainObjectBase](classeigen_1_1plainobjectbase)< OtherDerived > &other) | | | | [TransposeReturnType](classeigen_1_1transpose) | [transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) () const | | | | void | [transposeInPlace](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) () | | | | CoeffReturnType | [value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) () const | | | | void | [visit](classeigen_1_1densebase#a4225b90fcc74f18dd479b401124b3841) (Visitor &func) const | | | | | | --- | | | | Public Types inherited from [Eigen::DenseBase< MatrixWrapper< ExpressionType > >](classeigen_1_1densebase) | | typedef random\_access\_iterator\_type | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | | | | typedef random\_access\_iterator\_type | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | | | | typedef [Array](classeigen_1_1array)< typename internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), AutoAlign|(internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &RowMajorBit ? RowMajor :ColMajor), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) | | | | typedef [Matrix](classeigen_1_1matrix)< typename internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), AutoAlign|(internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &RowMajorBit ? RowMajor :ColMajor), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e) | | | | typedef internal::conditional< internal::is\_same< typename internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::XprKind, [MatrixXpr](structeigen_1_1matrixxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e), [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) >::type | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | The plain matrix or array type corresponding to this expression. [More...](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | | typedef internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | | | | typedef internal::traits< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > >::[StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | [StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | The type used to store indices. [More...](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | | typedef [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [value\_type](classeigen_1_1densebase#a9276182dab8236c33f1e7abf491d504d) | | | | Static Public Member Functions inherited from [Eigen::MatrixBase< MatrixWrapper< ExpressionType > >](classeigen_1_1matrixbase) | | static const IdentityReturnType | [Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f) () | | | | static const IdentityReturnType | [Identity](classeigen_1_1matrixbase#acf33ce20ef03ead47cb3dbcd5f416ede) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | | static const BasisReturnType | [Unit](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) | | | | static const BasisReturnType | [Unit](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) | | | | static const BasisReturnType | [UnitW](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) () | | | | static const BasisReturnType | [UnitX](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d) () | | | | static const BasisReturnType | [UnitY](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc) () | | | | static const BasisReturnType | [UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0) () | | | | Static Public Member Functions inherited from [Eigen::DenseBase< MatrixWrapper< ExpressionType > >](classeigen_1_1densebase) | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#aed89b5cc6e3b7d9d5bd63aed245ccd6d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a1fdd3189ae3a41d250593334d82210cf) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a5dc65501accd02c30f7c1840c2a30a41) (const CustomNullaryOp &func) | | | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols, const CustomNullaryOp &func) | | | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const CustomNullaryOp &func) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101) () | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a8b2a51018a73a766f5b91aef3487f013) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#ab710a58e4a80fbcb2594242372c8fe56) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) () | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#a7eb5f974a8f0b67eac7080db1da0e308) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761) () | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ae41a9b5050ed27d9e93c82c9c8622cd3) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ac22f79b812fa564061042407f2ba8f5b) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | | Protected Member Functions inherited from [Eigen::DenseBase< MatrixWrapper< ExpressionType > >](classeigen_1_1densebase) | | | [DenseBase](classeigen_1_1densebase#aa284042d0e1b0ad9b6a00db7fd2d9f7f) () | | | | Related Functions inherited from [Eigen::DenseBase< MatrixWrapper< ExpressionType > >](classeigen_1_1densebase) | | std::ostream & | [operator<<](classeigen_1_1densebase#a3806d3f42de165878dace160e6aba40a) (std::ostream &s, const [DenseBase](classeigen_1_1densebase)< [MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType > > &m) | | | resize() [1/2] -------------- template<typename ExpressionType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >::resize | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *newSize* | ) | | | inline | Forwards the resizing request to the nested expression See also [DenseBase::resize(Index)](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) resize() [2/2] -------------- template<typename ExpressionType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixWrapper](classeigen_1_1matrixwrapper)< ExpressionType >::resize | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *cols* | | | ) | | | | inline | Forwards the resizing request to the nested expression See also [DenseBase::resize(Index,Index)](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) --- The documentation for this class was generated from the following files:* [ArrayBase.h](https://eigen.tuxfamily.org/dox/ArrayBase_8h_source.html) * [ArrayWrapper.h](https://eigen.tuxfamily.org/dox/ArrayWrapper_8h_source.html)
programming_docs
eigen3 Common pitfalls Common pitfalls =============== Compilation error with template methods ========================================= See this [page](topictemplatekeyword) . Aliasing ========== Don't miss this [page](group__topicaliasing) on aliasing, especially if you got wrong results in statements where the destination appears on the right hand side of the expression. Alignment Issues (runtime assertion) ====================================== Eigen does explicit vectorization, and while that is appreciated by many users, that also leads to some issues in special situations where data alignment is compromised. Indeed, prior to C++17, C++ does not have quite good enough support for explicit data alignment. In that case your program hits an assertion failure (that is, a "controlled crash") with a message that tells you to consult this page: ``` http://eigen.tuxfamily.org/dox/group\_\_TopicUnalignedArrayAssert.html ``` Have a look at [it](group__topicunalignedarrayassert) and see for yourself if that's something that you can cope with. It contains detailed information about how to deal with each known cause for that issue. Now what if you don't care about vectorization and so don't want to be annoyed with these alignment issues? Then read [how to get rid of them](group__topicunalignedarrayassert#getrid) . C++11 and the auto keyword ============================ In short: do not use the auto keywords with Eigen's expressions, unless you are 100% sure about what you are doing. In particular, do not use the auto keyword as a replacement for a `Matrix<>` type. Here is an example: ``` MatrixXd A, B; auto C = A*B; for(...) { ... w = C * v; ...} ``` In this example, the type of C is not a `MatrixXd` but an abstract expression representing a matrix product and storing references to `A` and `B`. Therefore, the product of `A*B` will be carried out multiple times, once per iteration of the for loop. Moreover, if the coefficients of `A` or `B` change during the iteration, then `C` will evaluate to different values as in the following example: ``` MatrixXd A = ..., B = ...; auto C = A*B; MatrixXd R1 = C; A = ...; MatrixXd R2 = C; ``` for which we end up with `R1` ≠ `R2`. Here is another example leading to a segfault: ``` auto C = ((A+B).eval()).transpose(); // do something with C ``` The problem is that `eval()` returns a temporary object (in this case a `MatrixXd`) which is then referenced by the `Transpose<>` expression. However, this temporary is deleted right after the first line, and then the `C` expression references a dead object. One possible fix consists in applying `eval()` on the whole expression: ``` auto C = (A+B).transpose().eval(); ``` The same issue might occur when sub expressions are automatically evaluated by Eigen as in the following example: ``` VectorXd u, v; auto C = u + (A*v).normalized(); // do something with C ``` Here the `normalized()` method has to evaluate the expensive product `A*v` to avoid evaluating it twice. Again, one possible fix is to call .eval() on the whole expression: ``` auto C = (u + (A*v).normalized()).eval(); ``` In this case, `C` will be a regular `VectorXd` object. Note that [DenseBase::eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) is smart enough to avoid copies when the underlying expression is already a plain `Matrix<>`. Header Issues (failure to compile) ==================================== With all libraries, one must check the documentation for which header to include. The same is true with Eigen, but slightly worse: with Eigen, a method in a class may require an additional `#include` over what the class itself requires! For example, if you want to use the `cross()` method on a vector (it computes a cross-product) then you need to: ``` #include<Eigen/Geometry> ``` We try to always document this, but do tell us if we forgot an occurrence. Ternary operator ================== In short: avoid the use of the ternary operator `(COND ? THEN : ELSE)` with Eigen's expressions for the `THEN` and `ELSE` statements. To see why, let's consider the following example: ``` Vector3f A; A << 1, 2, 3; Vector3f B = ((1 < 0) ? (A.reverse()) : A); ``` This example will return `B = 3, 2, 1`. Do you see why? The reason is that in c++ the type of the `ELSE` statement is inferred from the type of the `THEN` expression such that both match. Since `THEN` is a `Reverse<Vector3f>`, the `ELSE` statement A is converted to a `Reverse<Vector3f>`, and the compiler thus generates: ``` Vector3f B = ((1 < 0) ? (A.reverse()) : Reverse<Vector3f>(A)); ``` In this very particular case, a workaround would be to call A.reverse().eval() for the `THEN` statement, but the safest and fastest is really to avoid this ternary operator with Eigen's expressions and use a if/else construct. Pass-by-value =============== If you don't know why passing-by-value is wrong with Eigen, read this [page](group__topicpassingbyvalue) first. While you may be extremely careful and use care to make sure that all of your code that explicitly uses Eigen types is pass-by-reference you have to watch out for templates which define the argument types at compile time. If a template has a function that takes arguments pass-by-value, and the relevant template parameter ends up being an Eigen type, then you will of course have the same alignment problems that you would in an explicitly defined function passing Eigen types by reference. Using Eigen types with other third party libraries or even the STL can present the same problem. `boost::bind` for example uses pass-by-value to store arguments in the returned functor. This will of course be a problem. There are at least two ways around this: * If the value you are passing is guaranteed to be around for the life of the functor, you can use boost::ref() to wrap the value as you pass it to boost::bind. Generally this is not a solution for values on the stack as if the functor ever gets passed to a lower or independent scope, the object may be gone by the time it's attempted to be used. * The other option is to make your functions take a reference counted pointer like boost::shared\_ptr as the argument. This avoids needing to worry about managing the lifetime of the object being passed. Matrices with boolean coefficients ==================================== The current behaviour of using `[Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")` with boolean coefficients is inconsistent and likely to change in future versions of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), so please use it carefully! A simple example for such an inconsistency is ``` template<int Size> void foo() { [Eigen::Matrix<bool, Size, Size>](classeigen_1_1matrix) A, B, C; A.[setOnes](classeigen_1_1plainobjectbase#a8700dc6d8e05436c0b34ae15ca9274a5)(); B.[setOnes](classeigen_1_1plainobjectbase#a8700dc6d8e05436c0b34ae15ca9274a5)(); C = A * B - A * B; std::cout << C << "\n"; } ``` since calling `foo<3>()` prints the zero matrix while calling `foo<10>()` prints the identity matrix. eigen3 Eigen::SuperLU Eigen::SuperLU ============== ### template<typename \_MatrixType> class Eigen::SuperLU< \_MatrixType > A sparse direct LU factorization and solver based on the [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") library. This class allows to solve for A.X = B sparse linear problems via a direct LU factorization using the [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") library. The sparse matrix A must be squared and invertible. The vectors or matrices X and B can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | Warning This class is only for the 4.x versions of [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library."). The 3.x and 5.x versions are not supported. This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") | | | --- | | | | void | [analyzePattern](classeigen_1_1superlu#a493cdfada27415a6037b004ff974eace) (const MatrixType &matrix) | | | | void | [factorize](classeigen_1_1superlu#a0b5a5fbda1a1f368003c7c01021a4636) (const MatrixType &matrix) | | | | Public Member Functions inherited from [Eigen::SuperLUBase< \_MatrixType, SuperLU< \_MatrixType > >](classeigen_1_1superlubase) | | void | [analyzePattern](classeigen_1_1superlubase#a2d3f48425328d9b3cbdca369889007f3) (const MatrixType &) | | | | void | [compute](classeigen_1_1superlubase#a28cb3ef7914ecb6fdae1935b53f6be40) (const MatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1superlubase#aa67da5c8c24110931c949c5896c5ec03) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1superlubase#aa67da5c8c24110931c949c5896c5ec03) | | | | superlu\_options\_t & | [options](classeigen_1_1superlubase#a42d9d79073379f1e75b0f2c49879ed5b) () | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | analyzePattern() ---------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SuperLU](classeigen_1_1superlu)< \_MatrixType >::analyzePattern | ( | const MatrixType & | *matrix* | ) | | | inline | Performs a symbolic decomposition on the sparcity of *matrix*. This function is particularly useful when solving for several problems having the same structure. See also [factorize()](classeigen_1_1superlu#a0b5a5fbda1a1f368003c7c01021a4636) factorize() ----------- template<typename MatrixType > | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SuperLU](classeigen_1_1superlu)< MatrixType >::factorize | ( | const MatrixType & | *matrix* | ) | | Performs a numeric decomposition of *matrix* The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. See also [analyzePattern()](classeigen_1_1superlu#a493cdfada27415a6037b004ff974eace) --- The documentation for this class was generated from the following file:* [SuperLUSupport.h](https://eigen.tuxfamily.org/dox/SuperLUSupport_8h_source.html) eigen3 SuperLUSupport module SuperLUSupport module ===================== This module provides an interface to the [SuperLU](http://crd-legacy.lbl.gov/~xiaoye/SuperLU/) library. It provides the following factorization class: * class SuperLU: a supernodal sequential LU factorization. * class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). Warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. When including this module, you have to use SUPERLU\_EMPTY instead of EMPTY which is no longer defined because it is too polluting. ``` #include <Eigen/SuperLUSupport> ``` In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. The dependencies depend on how superlu has been compiled. For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. | | | --- | | | | class | [Eigen::SuperILU< \_MatrixType >](classeigen_1_1superilu) | | | A sparse direct **incomplete** LU factorization and solver based on the [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") library. [More...](classeigen_1_1superilu#details) | | | | class | [Eigen::SuperLU< \_MatrixType >](classeigen_1_1superlu) | | | A sparse direct LU factorization and solver based on the [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") library. [More...](classeigen_1_1superlu#details) | | | | class | [Eigen::SuperLUBase< \_MatrixType, Derived >](classeigen_1_1superlubase) | | | The base class for the direct and incomplete LU factorization of [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library."). [More...](classeigen_1_1superlubase#details) | | | eigen3 Eigen::RealSchur Eigen::RealSchur ================ ### template<typename \_MatrixType> class Eigen::RealSchur< \_MatrixType > Performs a real Schur decomposition of a square matrix. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the real Schur decomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | Given a real square matrix A, this class computes the real Schur decomposition: \( A = U T U^T \) where U is a real orthogonal matrix and T is a real quasi-triangular matrix. An orthogonal matrix is a matrix whose inverse is equal to its transpose, \( U^{-1} = U^T \). A quasi-triangular matrix is a block-triangular matrix whose diagonal consists of 1-by-1 blocks and 2-by-2 blocks with complex eigenvalues. The eigenvalues of the blocks on the diagonal of T are the same as the eigenvalues of the matrix A, and thus the real Schur decomposition is used in [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices.") to compute the eigendecomposition of a matrix. Call the function [compute()](classeigen_1_1realschur#a60caf9ffad11d728ea458c4dd36d0a98 "Computes Schur decomposition of given matrix.") to compute the real Schur decomposition of a given matrix. Alternatively, you can use the RealSchur(const MatrixType&, bool) constructor which computes the real Schur decomposition at construction time. Once the decomposition is computed, you can use the [matrixU()](classeigen_1_1realschur#a85622ccbecff99c8933d21f0a22b22bb "Returns the orthogonal matrix in the Schur decomposition.") and [matrixT()](classeigen_1_1realschur#abb78996b43b8642a5f507415730445cb "Returns the quasi-triangular matrix in the Schur decomposition.") functions to retrieve the matrices U and T in the decomposition. The documentation of RealSchur(const MatrixType&, bool) contains an example of the typical use of this class. Note The implementation is adapted from [JAMA](http://math.nist.gov/javanumerics/jama/) (public domain). Their code is based on EISPACK. See also class [ComplexSchur](classeigen_1_1complexschur "Performs a complex Schur decomposition of a real or complex square matrix."), class [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") | | | --- | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) | | | | | | --- | | | | template<typename InputType > | | [RealSchur](classeigen_1_1realschur) & | [compute](classeigen_1_1realschur#a60caf9ffad11d728ea458c4dd36d0a98) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeU=true) | | | Computes Schur decomposition of given matrix. [More...](classeigen_1_1realschur#a60caf9ffad11d728ea458c4dd36d0a98) | | | | template<typename HessMatrixType , typename OrthMatrixType > | | [RealSchur](classeigen_1_1realschur) & | [computeFromHessenberg](classeigen_1_1realschur#ac4acc917dcaddefae5f35acd2c536d65) (const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU) | | | Computes Schur decomposition of a Hessenberg matrix H = Z T Z^T. [More...](classeigen_1_1realschur#ac4acc917dcaddefae5f35acd2c536d65) | | | | [Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) | [getMaxIterations](classeigen_1_1realschur#a99453076a9617a6af353b5b1f3220c25) () | | | Returns the maximum number of iterations. | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1realschur#a386fd2b1a3a8401eca7183ac074deec8) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1realschur#a386fd2b1a3a8401eca7183ac074deec8) | | | | const MatrixType & | [matrixT](classeigen_1_1realschur#abb78996b43b8642a5f507415730445cb) () const | | | Returns the quasi-triangular matrix in the Schur decomposition. [More...](classeigen_1_1realschur#abb78996b43b8642a5f507415730445cb) | | | | const MatrixType & | [matrixU](classeigen_1_1realschur#a85622ccbecff99c8933d21f0a22b22bb) () const | | | Returns the orthogonal matrix in the Schur decomposition. [More...](classeigen_1_1realschur#a85622ccbecff99c8933d21f0a22b22bb) | | | | template<typename InputType > | | | [RealSchur](classeigen_1_1realschur#afef4d3dc5a493aca2760c20b34337016) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeU=true) | | | Constructor; computes real Schur decomposition of given matrix. [More...](classeigen_1_1realschur#afef4d3dc5a493aca2760c20b34337016) | | | | | [RealSchur](classeigen_1_1realschur#a826c83e2f1d4c8332606a14ea121ff5f) ([Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) size=RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 1 :RowsAtCompileTime) | | | Default constructor. [More...](classeigen_1_1realschur#a826c83e2f1d4c8332606a14ea121ff5f) | | | | [RealSchur](classeigen_1_1realschur) & | [setMaxIterations](classeigen_1_1realschur#ad189e8776ee20a12046694f98b354322) ([Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) maxIters) | | | Sets the maximum number of iterations allowed. [More...](classeigen_1_1realschur#ad189e8776ee20a12046694f98b354322) | | | | | | --- | | | | static const int | [m\_maxIterationsPerRow](classeigen_1_1realschur#a5cf45fb60964a3e7ea3a6718a8d7acdf) | | | Maximum number of iterations per row. [More...](classeigen_1_1realschur#a5cf45fb60964a3e7ea3a6718a8d7acdf) | | | Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::[Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) | **[Deprecated:](deprecated#_deprecated000018)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 RealSchur() [1/2] ----------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::[RealSchur](classeigen_1_1realschur) | ( | [Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) | *size* = `RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 1 : RowsAtCompileTime` | ) | | | inlineexplicit | Default constructor. Parameters | | | | | --- | --- | --- | | [in] | size | Positive integer, size of the matrix whose Schur decomposition will be computed. | The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1realschur#a60caf9ffad11d728ea458c4dd36d0a98 "Computes Schur decomposition of given matrix."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1realschur#a60caf9ffad11d728ea458c4dd36d0a98 "Computes Schur decomposition of given matrix.") for an example. RealSchur() [2/2] ----------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::[RealSchur](classeigen_1_1realschur) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeU* = `true` | | | ) | | | | inlineexplicit | Constructor; computes real Schur decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose Schur decomposition is to be computed. | | [in] | computeU | If true, both T and U are computed; if false, only T is computed. | This constructor calls [compute()](classeigen_1_1realschur#a60caf9ffad11d728ea458c4dd36d0a98 "Computes Schur decomposition of given matrix.") to compute the Schur decomposition. Example: ``` MatrixXd A = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; RealSchur<MatrixXd> schur(A); cout << "The orthogonal matrix U is:" << endl << schur.matrixU() << endl; cout << "The quasi-triangular matrix T is:" << endl << schur.matrixT() << endl << endl; MatrixXd U = schur.matrixU(); MatrixXd T = schur.matrixT(); cout << "U \* T \* U^T = " << endl << U * T * U.transpose() << endl; ``` Output: ``` Here is a random 6x6 matrix, A: 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 The orthogonal matrix U is: 0.348 -0.754 0.00435 -0.351 0.0146 0.432 -0.16 -0.266 -0.747 0.457 -0.366 0.0571 0.505 -0.157 0.0746 0.644 0.518 -0.177 0.703 0.324 -0.409 -0.349 -0.187 -0.275 0.296 0.372 0.24 0.324 -0.379 0.684 -0.126 0.305 -0.46 -0.161 0.647 0.485 The quasi-triangular matrix T is: -0.2 -1.83 0.864 0.271 1.09 0.139 0.647 0.298 -0.0536 0.676 -0.288 0.0231 0 0 0.967 -0.201 -0.429 0.847 0 0 0 0.353 0.603 0.694 0 0 0 0 0.572 -1.03 0 0 0 0 0.0184 0.664 U * T * U^T = 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 ``` compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | --- | --- | --- | --- | | [RealSchur](classeigen_1_1realschur)& [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeU* = `true` | | | ) | | | Computes Schur decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose Schur decomposition is to be computed. | | [in] | computeU | If true, both T and U are computed; if false, only T is computed. | Returns Reference to `*this` The Schur decomposition is computed by first reducing the matrix to Hessenberg form using the class [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation."). The Hessenberg matrix is then reduced to triangular form by performing Francis QR iterations with implicit double shift. The cost of computing the Schur decomposition depends on the number of iterations; as a rough guide, it may be taken to be \(25n^3\) flops if *computeU* is true and \(10n^3\) flops if *computeU* is false. Example: ``` MatrixXf A = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); RealSchur<MatrixXf> schur(4); schur.compute(A, /\* computeU = \*/ false); cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl; schur.compute(A.inverse(), /\* computeU = \*/ false); cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl; ``` Output: ``` The matrix T in the decomposition of A is: 0.523 -0.698 0.148 0.742 0.475 0.986 -0.793 0.721 0 0 -0.28 -0.77 0 0 0.0145 -0.367 The matrix T in the decomposition of A^(-1) is: -3.06 -4.57 -5.97 5.48 0.168 -2.62 -3.27 3.9 0 0 0.427 0.573 0 0 -1.05 1.35 ``` See also compute(const MatrixType&, bool, Index) computeFromHessenberg() ----------------------- template<typename \_MatrixType > template<typename HessMatrixType , typename OrthMatrixType > | | | | | | --- | --- | --- | --- | | [RealSchur](classeigen_1_1realschur)& [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::computeFromHessenberg | ( | const HessMatrixType & | *matrixH*, | | | | const OrthMatrixType & | *matrixQ*, | | | | bool | *computeU* | | | ) | | | Computes Schur decomposition of a Hessenberg matrix H = Z T Z^T. Parameters | | | | | --- | --- | --- | | [in] | matrixH | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") in Hessenberg form H | | [in] | matrixQ | orthogonal matrix Q that transform a matrix A to H : A = Q H Q^T | | | computeU | Computes the matriX U of the Schur vectors | Returns Reference to `*this` This routine assumes that the matrix is already reduced in Hessenberg form matrixH using either the class [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.") or another mean. It computes the upper quasi-triangular matrix T of the Schur decomposition of H When computeU is true, this routine computes the matrix U such that A = U T U^T = (QZ) T (QZ)^T = Q H Q^T where A is the initial matrix NOTE Q is referenced if computeU is true; so, if the initial orthogonal matrix is not available, the user should give an identity matrix (Q.setIdentity()) See also compute(const MatrixType&, bool) info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NoConvergence` otherwise. matrixT() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::matrixT | ( | | ) | const | | inline | Returns the quasi-triangular matrix in the Schur decomposition. Returns A const reference to the matrix T. Precondition Either the constructor RealSchur(const MatrixType&, bool) or the member function compute(const MatrixType&, bool) has been called before to compute the Schur decomposition of a matrix. See also RealSchur(const MatrixType&, bool) for an example matrixU() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::matrixU | ( | | ) | const | | inline | Returns the orthogonal matrix in the Schur decomposition. Returns A const reference to the matrix U. Precondition Either the constructor RealSchur(const MatrixType&, bool) or the member function compute(const MatrixType&, bool) has been called before to compute the Schur decomposition of a matrix, and `computeU` was set to true (the default value). See also RealSchur(const MatrixType&, bool) for an example setMaxIterations() ------------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [RealSchur](classeigen_1_1realschur)& [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::setMaxIterations | ( | [Index](classeigen_1_1realschur#a8bd4653e2d9569a44ecc95e746422d3f) | *maxIters* | ) | | | inline | Sets the maximum number of iterations allowed. If not specified by the user, the maximum number of iterations is m\_maxIterationsPerRow times the size of the matrix. m\_maxIterationsPerRow ---------------------- template<typename \_MatrixType > | | | | | --- | --- | --- | | | | | --- | | const int [Eigen::RealSchur](classeigen_1_1realschur)< \_MatrixType >::m\_maxIterationsPerRow | | static | Maximum number of iterations per row. If not otherwise specified, the maximum number of iterations is this number times the size of the matrix. It is currently set to 40. --- The documentation for this class was generated from the following file:* [RealSchur.h](https://eigen.tuxfamily.org/dox/RealSchur_8h_source.html)
programming_docs
eigen3 SparseCore module SparseCore module ================= This module provides a sparse matrix representation, and basic associated matrix manipulations and operations. See the [Sparse tutorial](group__tutorialsparse) ``` #include <Eigen/SparseCore> ``` This module depends on: Core. | | | --- | | | | class | [Eigen::Map< SparseMatrixType >](classeigen_1_1map_3_01sparsematrixtype_01_4) | | | Specialization of class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for SparseMatrix-like storage. [More...](classeigen_1_1map_3_01sparsematrixtype_01_4#details) | | | | class | [Eigen::Ref< SparseMatrixType, Options >](classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4) | | | A sparse matrix expression referencing an existing sparse expression. [More...](classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4#details) | | | | class | [Eigen::Ref< SparseVectorType >](classeigen_1_1ref_3_01sparsevectortype_01_4) | | | A sparse vector expression referencing an existing sparse vector expression. [More...](classeigen_1_1ref_3_01sparsevectortype_01_4#details) | | | | class | [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | | Common base class for sparse [compressed]-{row|column}-storage format. [More...](classeigen_1_1sparsecompressedbase#details) | | | | class | [Eigen::SparseMapBase< Derived, ReadOnlyAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4) | | | Common base class for [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") instance of sparse matrix and vector. [More...](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#details) | | | | class | [Eigen::SparseMapBase< Derived, WriteAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4) | | | Common base class for writable [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") instance of sparse matrix and vector. [More...](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#details) | | | | class | [Eigen::SparseMatrix< \_Scalar, \_Options, \_StorageIndex >](classeigen_1_1sparsematrix) | | | A versatible sparse matrix representation. [More...](classeigen_1_1sparsematrix#details) | | | | class | [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | | Base class of any sparse matrices or sparse expressions. [More...](classeigen_1_1sparsematrixbase#details) | | | | class | [Eigen::SparseSelfAdjointView< MatrixType, \_Mode >](classeigen_1_1sparseselfadjointview) | | | Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix. [More...](classeigen_1_1sparseselfadjointview#details) | | | | class | [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | | A base class for sparse solvers. [More...](classeigen_1_1sparsesolverbase#details) | | | | class | [Eigen::SparseVector< \_Scalar, \_Options, \_StorageIndex >](classeigen_1_1sparsevector) | | | a sparse vector class [More...](classeigen_1_1sparsevector#details) | | | | class | [Eigen::SparseView< MatrixType >](classeigen_1_1sparseview) | | | Expression of a dense or sparse matrix with zero or too small values removed. [More...](classeigen_1_1sparseview#details) | | | | class | [Eigen::TriangularViewImpl< MatrixType, Mode, Sparse >](classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4) | | | Base class for a triangular part in a **sparse** matrix. [More...](classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4#details) | | | | class | [Eigen::Triplet< Scalar, StorageIndex >](classeigen_1_1triplet) | | | A small structure to hold a non zero as a triplet (i,j,value). [More...](classeigen_1_1triplet#details) | | | | | | --- | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [Eigen::MatrixBase< Derived >::sparseView](group__sparsecore__module#ga320dd291cbf4339c6118c41521b75350) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &m\_reference=[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)(0), const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &m\_epsilon=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | sparseView() ------------ template<typename Derived > | | | | | | --- | --- | --- | --- | | const [SparseView](classeigen_1_1sparseview)< Derived > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::sparseView | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *reference* = `[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)(0)`, | | | | const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real & | *epsilon* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | | | ) | | const | Returns a sparse expression of the dense expression `*this` with values smaller than *reference* \* *epsilon* removed. This method is typically used when prototyping to convert a quickly assembled dense [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") `D` to a [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation.") `S:` ``` MatrixXd D(n,m); SparseMatrix<double> S; S = D.sparseView(); // suppress numerical zeros (exact) S = D.sparseView(reference); S = D.sparseView(reference,epsilon); ``` where *reference* is a meaningful non zero reference value, and *epsilon* is a tolerance factor defaulting to NumTraits<Scalar>::dummy\_precision(). See also [SparseMatrixBase::pruned()](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d), class [SparseView](classeigen_1_1sparseview "Expression of a dense or sparse matrix with zero or too small values removed.") eigen3 Using custom scalar types Using custom scalar types ========================= By default, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") currently supports standard floating-point types (`float`, `double`, `std::complex<float>`, `std::complex<double>`, `long` `double`), as well as all native integer types (e.g., `int`, `unsigned` `int`, `short`, etc.), and `bool`. On x86-64 systems, `long` `double` permits to locally enforces the use of x87 registers with extended accuracy (in comparison to SSE). In order to add support for a custom type `T` you need: 1. make sure the common operator (+,-,\*,/,etc.) are supported by the type `T` 2. add a specialization of struct Eigen::NumTraits<T> (see [NumTraits](structeigen_1_1numtraits)) 3. define the math functions that makes sense for your type. This includes standard ones like sqrt, pow, sin, tan, conj, real, imag, etc, as well as abs2 which is [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") specific. (see the file [Eigen/src/Core/MathFunctions.h](https://eigen.tuxfamily.org/dox/MathFunctions_8h_source.html)) The math function should be defined in the same namespace than `T`, or in the `std` namespace though that second approach is not recommended. Here is a concrete example adding support for the Adolc's `adouble` type. [Adolc](https://projects.coin-or.org/ADOL-C) is an automatic differentiation library. The type `adouble` is basically a real value tracking the values of any number of partial derivatives. ``` #ifndef ADOLCSUPPORT\_H #define ADOLCSUPPORT\_H #define ADOLC\_TAPELESS #include <adolc/adouble.h> #include <Eigen/Core> namespace [Eigen](namespaceeigen) { template<> struct NumTraits<adtl::adouble> : NumTraits<double> // permits to get the epsilon, dummy\_precision, lowest, highest functions { typedef adtl::adouble Real; typedef adtl::adouble NonInteger; typedef adtl::adouble Nested; enum { IsComplex = 0, IsInteger = 0, IsSigned = 1, RequireInitialization = 1, ReadCost = 1, AddCost = 3, MulCost = 3 }; }; } namespace adtl { inline const adouble& [conj](namespaceeigen#ab84f39a06a18e1ebb23f8be80345b79d)(const adouble& x) { return x; } inline const adouble& [real](namespaceeigen#ac74dc920119b1eba45e9218d9f402afc)(const adouble& x) { return x; } inline adouble [imag](namespaceeigen#a04d60a3c8a266f63c08e03615c1985c9)(const adouble&) { return 0.; } inline adouble [abs](namespaceeigen#ae27242789e7e62a8c42579b79be59b1a)(const adouble& x) { return fabs(x); } inline adouble [abs2](namespaceeigen#a54cc34b64b4935307efc06d56cd531df)(const adouble& x) { return x*x; } } #endif // ADOLCSUPPORT\_H ``` This other example adds support for the `mpq_class` type from [GMP](https://gmplib.org/). It shows in particular how to change the way [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") picks the best pivot during LU factorization. It selects the coefficient with the highest score, where the score is by default the absolute value of a number, but we can define a different score, for instance to prefer pivots with a more compact representation (this is an example, not a recommendation). Note that the scores should always be non-negative and only zero is allowed to have a score of zero. Also, this can interact badly with thresholds for inexact scalar types. ``` #include <gmpxx.h> #include <Eigen/Core> #include <boost/operators.hpp> namespace [Eigen](namespaceeigen) { template<> struct NumTraits<mpq_class> : GenericNumTraits<mpq_class> { typedef mpq_class Real; typedef mpq_class NonInteger; typedef mpq_class Nested; static inline Real epsilon() { return 0; } static inline Real dummy_precision() { return 0; } static inline int digits10() { return 0; } enum { IsInteger = 0, IsSigned = 1, IsComplex = 0, RequireInitialization = 1, ReadCost = 6, AddCost = 150, MulCost = 100 }; }; namespace internal { template<> struct scalar_score_coeff_op<mpq_class> { struct result_type : boost::totally_ordered1<result_type> { std::size_t len; result_type(int i = 0) : len(i) {} // Eigen uses Score(0) and Score() result_type(mpq_class const& q) : len(mpz_size(q.get_num_mpz_t())+ mpz_size(q.get_den_mpz_t())-1) {} friend bool operator<(result_type x, result_type y) { // 0 is the worst possible pivot if (x.len == 0) return y.len > 0; if (y.len == 0) return false; // Prefer a pivot with a small representation return x.len > y.len; } friend bool operator==(result_type x, result_type y) { // Only used to test if the score is 0 return x.len == y.len; } }; result_type operator()(mpq_class const& x) const { return x; } }; } } ``` eigen3 Matrix manipulation via nullary-expressions Matrix manipulation via nullary-expressions =========================================== The main purpose of the class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor.") is to define *procedural* matrices such as constant or random matrices as returned by the Ones(), Zero(), Constant(), Identity() and Random() methods. Nevertheless, with some imagination it is possible to accomplish very sophisticated matrix manipulation with minimal efforts such that [implementing new expression](topicnewexpressiontype) is rarely needed. Example 1: circulant matrix ============================= To explore these possibilities let us start with the *circulant* example of the [implementing new expression](topicnewexpressiontype) topic. Let us recall that a circulant matrix is a matrix where each column is the same as the column to the left, except that it is cyclically shifted downwards. For example, here is a 4-by-4 circulant matrix: \[ \begin{bmatrix} 1 & 8 & 4 & 2 \\ 2 & 1 & 8 & 4 \\ 4 & 2 & 1 & 8 \\ 8 & 4 & 2 & 1 \end{bmatrix} \] A circulant matrix is uniquely determined by its first column. We wish to write a function `makeCirculant` which, given the first column, returns an expression representing the circulant matrix. For this exercise, the return type of `makeCirculant` will be a [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor.") that we need to instantiate with: 1 - a proper `circulant_functor` storing the input vector and implementing the adequate coefficient accessor `operator(i,j)` 2 - a template instantiation of class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") conveying compile-time information such as the scalar type, sizes, and preferred storage layout. Calling `ArgType` the type of the input vector, we can construct the equivalent squared [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") type as follows: ``` template<class ArgType> struct circulant_helper { typedef Matrix<typename ArgType::Scalar, ArgType::SizeAtCompileTime, ArgType::SizeAtCompileTime, [ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62), ArgType::MaxSizeAtCompileTime, ArgType::MaxSizeAtCompileTime> MatrixType; }; ``` This little helper structure will help us to implement our `makeCirculant` function as follows: ``` template <class ArgType> CwiseNullaryOp<circulant_functor<ArgType>, typename circulant_helper<ArgType>::MatrixType> makeCirculant(const [Eigen::MatrixBase<ArgType>](classeigen_1_1matrixbase)& [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1)) { typedef typename circulant_helper<ArgType>::MatrixType MatrixType; return MatrixType::NullaryExpr([arg](namespaceeigen#aa539408a09481d35961e11ee78793db1).size(), [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1).size(), circulant_functor<ArgType>([arg](namespaceeigen#aa539408a09481d35961e11ee78793db1).derived())); } ``` As usual, our function takes as argument a `[MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")` (see this [page](topicfunctiontakingeigentypes) for more details). Then, the [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor.") object is constructed through the [DenseBase::NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) static method with the adequate runtime sizes. Then, we need to implement our `circulant_functor`, which is a straightforward exercise: ``` template<class ArgType> class circulant_functor { const ArgType &m_vec; public: circulant_functor(const ArgType& [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1)) : m_vec([arg](namespaceeigen#aa539408a09481d35961e11ee78793db1)) {} const typename ArgType::Scalar& operator() ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) const { [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index = row - col; if (index < 0) index += m_vec.size(); return m_vec(index); } }; ``` We are now all set to try our new feature: ``` int main() { [Eigen::VectorXd](classeigen_1_1matrix) vec(4); vec << 1, 2, 4, 8; [Eigen::MatrixXd](classeigen_1_1matrix) mat; mat = makeCirculant(vec); std::cout << mat << std::endl; } ``` If all the fragments are combined, the following output is produced, showing that the program works as expected: ``` 1 8 4 2 2 1 8 4 4 2 1 8 8 4 2 1 ``` This implementation of `makeCirculant` is much simpler than [defining a new expression](topicnewexpressiontype) from scratch. Example 2: indexing rows and columns ====================================== The goal here is to mimic MatLab's ability to index a matrix through two vectors of indices referencing the rows and columns to be picked respectively, like this: ``` A = 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 A([1 2 1], [3 2 1 0 0 2]) = 0 1 -6 -2 -2 1 9 0 -3 6 6 0 0 1 -6 -2 -2 1 ``` To this end, let us first write a nullary-functor storing references to the input matrix and to the two arrays of indices, and implementing the required `operator()(i,j)`: ``` template<class ArgType, class RowIndexType, class ColIndexType> class indexing_functor { const ArgType &m_arg; const RowIndexType &m_rowIndices; const ColIndexType &m_colIndices; public: typedef Matrix<typename ArgType::Scalar, RowIndexType::SizeAtCompileTime, ColIndexType::SizeAtCompileTime, ArgType::Flags&[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762)?[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f):[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62), RowIndexType::MaxSizeAtCompileTime, ColIndexType::MaxSizeAtCompileTime> MatrixType; indexing_functor(const ArgType& [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1), const RowIndexType& row_indices, const ColIndexType& col_indices) : m_arg([arg](namespaceeigen#aa539408a09481d35961e11ee78793db1)), m_rowIndices(row_indices), m_colIndices(col_indices) {} const typename ArgType::Scalar& operator() ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) const { return m_arg(m_rowIndices[row], m_colIndices[col]); } }; ``` Then, let's create an `indexing(A,rows,cols)` function creating the nullary expression: ``` template <class ArgType, class RowIndexType, class ColIndexType> CwiseNullaryOp<indexing_functor<ArgType,RowIndexType,ColIndexType>, typename indexing_functor<ArgType,RowIndexType,ColIndexType>::MatrixType> mat_indexing(const [Eigen::MatrixBase<ArgType>](classeigen_1_1matrixbase)& [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1), const RowIndexType& row_indices, const ColIndexType& col_indices) { typedef indexing_functor<ArgType,RowIndexType,ColIndexType> Func; typedef typename Func::MatrixType MatrixType; return MatrixType::NullaryExpr(row_indices.size(), col_indices.size(), Func([arg](namespaceeigen#aa539408a09481d35961e11ee78793db1).derived(), row_indices, col_indices)); } ``` Finally, here is an example of how this function can be used: ``` [Eigen::MatrixXi](classeigen_1_1matrix) A = [Eigen::MatrixXi::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); Array3i ri(1,2,1); ArrayXi ci(6); ci << 3,2,1,0,0,2; [Eigen::MatrixXi](classeigen_1_1matrix) B = mat_indexing(A, ri, ci); std::cout << "A =" << std::endl; std::cout << A << std::endl << std::endl; std::cout << "A([" << ri.[transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c)() << "], [" << ci.transpose() << "]) =" << std::endl; std::cout << B << std::endl; ``` This straightforward implementation is already quite powerful as the row or column index arrays can also be expressions to perform offsetting, modulo, striding, reverse, etc. ``` B = mat_indexing(A, ri+1, ci); std::cout << "A(ri+1,ci) =" << std::endl; std::cout << B << std::endl << std::endl; #if EIGEN\_COMP\_CXXVER >= 11 B = mat_indexing(A, [ArrayXi::LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d)(13,0,12).unaryExpr([](int x){return x%4;}), [ArrayXi::LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d)(4,0,3)); std::cout << "A(ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)) =" << std::endl; std::cout << B << std::endl << std::endl; #endif ``` and the output is: ``` A(ri+1,ci) = 9 0 -3 6 6 0 9 3 6 6 6 3 9 0 -3 6 6 0 A(ArrayXi::LinSpaced(13,0,12).unaryExpr([](int x){return x%4;}), ArrayXi::LinSpaced(4,0,3)) = 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 7 9 -5 -3 ```
programming_docs
eigen3 Solving Sparse Linear Systems Solving Sparse Linear Systems ============================= In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), there are several methods available to solve linear systems when the coefficient matrix is sparse. Because of the special representation of this class of matrices, special care should be taken in order to get a good performance. See [Sparse matrix manipulations](group__tutorialsparse) for a detailed introduction about sparse matrices in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). This page lists the sparse solvers available in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). The main steps that are common to all these linear solvers are introduced as well. Depending on the properties of the matrix, the desired accuracy, the end-user is able to tune those steps in order to improve the performance of its code. Note that it is not required to know deeply what's hiding behind these steps: the last section presents a benchmark routine that can be easily used to get an insight on the performance of all the available solvers. List of sparse solvers ======================== Eigen currently provides a wide set of built-in solvers, as well as wrappers to external solver libraries. They are summarized in the following tables: Built-in direct solvers ------------------------- | Class | Solver kind | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") kind | Features related to performance | License | Notes | | --- | --- | --- | --- | --- | --- | | [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") `#include<Eigen/[SparseCholesky](group__sparsecholesky__module)>` | Direct LLt factorization | SPD | Fill-in reducing | LGPL | [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") is often preferable | | [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") `#include<Eigen/[SparseCholesky](group__sparsecholesky__module)>` | Direct LDLt factorization | SPD | Fill-in reducing | LGPL | Recommended for very sparse and not too large problems (e.g., 2D Poisson eq.) | | [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") `#include<Eigen/[SparseLU](group__sparselu__module)>` | LU factorization | Square | Fill-in reducing, Leverage fast dense algebra | MPL2 | optimized for small and large problems with irregular patterns | | [SparseQR](classeigen_1_1sparseqr "Sparse left-looking QR factorization with numerical column pivoting.") `#include<Eigen/[SparseQR](group__sparseqr__module)>` | QR factorization | Any, rectangular | Fill-in reducing | MPL2 | recommended for least-square problems, has a basic rank-revealing feature | Built-in iterative solvers ---------------------------- | Class | Solver kind | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") kind | Supported preconditioners, [default] | License | Notes | | --- | --- | --- | --- | --- | --- | | [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems.") `#include<Eigen/[IterativeLinearSolvers](group__iterativelinearsolvers__module)>` | Classic iterative CG | SPD | [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix."), [[DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.")], [IncompleteCholesky](classeigen_1_1incompletecholesky "Modified Incomplete Cholesky with dual threshold.") | MPL2 | Recommended for large symmetric problems (e.g., 3D Poisson eq.) | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems.") `#include<Eigen/[IterativeLinearSolvers](group__iterativelinearsolvers__module)>` | CG for rectangular least-square problem | Rectangular | [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix."), [[LeastSquareDiagonalPreconditioner](classeigen_1_1leastsquarediagonalpreconditioner "Jacobi preconditioner for LeastSquaresConjugateGradient.")] | MPL2 | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") for min |A'Ax-b|^2 without forming A'A | | [BiCGSTAB](classeigen_1_1bicgstab "A bi conjugate gradient stabilized solver for sparse square problems.") `#include<Eigen/[IterativeLinearSolvers](group__iterativelinearsolvers__module)>` | Iterative stabilized bi-conjugate gradient | Square | [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix."), [[DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.")], [IncompleteLUT](classeigen_1_1incompletelut "Incomplete LU factorization with dual-threshold strategy.") | MPL2 | To speedup the convergence, try it with the [IncompleteLUT](classeigen_1_1incompletelut) preconditioner. | Wrappers to external solvers ------------------------------ | Class | Module | Solver kind | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") kind | Features related to performance | Dependencies,License | Notes | | --- | --- | --- | --- | --- | --- | --- | | [PastixLLT](classeigen_1_1pastixllt "A sparse direct supernodal Cholesky (LLT) factorization and solver based on the PaStiX library.") [PastixLDLT](classeigen_1_1pastixldlt "A sparse direct supernodal Cholesky (LLT) factorization and solver based on the PaStiX library.") [PastixLU](classeigen_1_1pastixlu "Interface to the PaStix solver.") | [PaStiXSupport](group__pastixsupport__module) | Direct LLt, LDLt, LU factorizations | SPD SPD Square | Fill-in reducing, Leverage fast dense algebra, Multithreading | Requires the [PaStiX](http://pastix.gforge.inria.fr) package, **CeCILL-C** | optimized for tough problems and symmetric patterns | | [CholmodSupernodalLLT](classeigen_1_1cholmodsupernodalllt "A supernodal Cholesky (LLT) factorization and solver based on Cholmod.") | [CholmodSupport](group__cholmodsupport__module) | Direct LLt factorization | SPD | Fill-in reducing, Leverage fast dense algebra | Requires the [SuiteSparse](http://www.suitesparse.com) package, **GPL** | | | [UmfPackLU](classeigen_1_1umfpacklu "A sparse LU factorization and solver based on UmfPack.") | [UmfPackSupport](group__umfpacksupport__module) | Direct LU factorization | Square | Fill-in reducing, Leverage fast dense algebra | Requires the [SuiteSparse](http://www.suitesparse.com) package, **GPL** | | | KLU | [KLUSupport](group__klusupport__module) | Direct LU factorization | Square | Fill-in reducing, suitted for circuit simulation | Requires the [SuiteSparse](http://www.suitesparse.com) package, **GPL** | | | [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") | [SuperLUSupport](group__superlusupport__module) | Direct LU factorization | Square | Fill-in reducing, Leverage fast dense algebra | Requires the [SuperLU](http://crd-legacy.lbl.gov/~xiaoye/SuperLU/) library, (BSD-like) | | | [SPQR](classeigen_1_1spqr "Sparse QR factorization based on SuiteSparseQR library.") | [SPQRSupport](group__spqrsupport__module) | QR factorization | Any, rectangular | fill-in reducing, multithreaded, fast dense algebra | requires the [SuiteSparse](http://www.suitesparse.com) package, **GPL** | recommended for linear least-squares problems, has a rank-revealing feature | | [PardisoLLT](classeigen_1_1pardisollt "A sparse direct Cholesky (LLT) factorization and solver based on the PARDISO library.") [PardisoLDLT](classeigen_1_1pardisoldlt "A sparse direct Cholesky (LDLT) factorization and solver based on the PARDISO library.") [PardisoLU](classeigen_1_1pardisolu "A sparse direct LU factorization and solver based on the PARDISO library.") | [PardisoSupport](group__pardisosupport__module) | Direct LLt, LDLt, LU factorizations | SPD SPD Square | Fill-in reducing, Leverage fast dense algebra, Multithreading | Requires the [Intel MKL](http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php) package, **Proprietary** | optimized for tough problems patterns, see also [using MKL with Eigen](topicusingintelmkl) | Here `SPD` means symmetric positive definite. Sparse solver concept ======================= All these solvers follow the same general concept. Here is a typical and general example: ``` #include <Eigen/RequiredModuleName> // ... SparseMatrix<double> A; // fill A VectorXd b, x; // fill b // solve Ax = b SolverClassName<SparseMatrix<double> > solver; solver.compute(A); if(solver.info()!=[Success](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea671a2aeb0f527802806a441d58a80fcf)) { // decomposition failed return; } x = solver.solve(b); if(solver.info()!=[Success](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea671a2aeb0f527802806a441d58a80fcf)) { // solving failed return; } // solve for another right hand side: x1 = solver.solve(b1); ``` For `SPD` solvers, a second optional template argument allows to specify which triangular part have to be used, e.g.: ``` #include <Eigen/IterativeLinearSolvers> ConjugateGradient<SparseMatrix<double>, [Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)> solver; x = solver.compute(A).solve(b); ``` In the above example, only the upper triangular part of the input matrix A is considered for solving. The opposite triangle might either be empty or contain arbitrary values. In the case where multiple problems with the same sparsity pattern have to be solved, then the "compute" step can be decomposed as follow: ``` SolverClassName<SparseMatrix<double> > solver; solver.analyzePattern(A); // for this step the numerical values of A are not used solver.factorize(A); x1 = solver.solve(b1); x2 = solver.solve(b2); ... A = ...; // modify the values of the nonzeros of A, the nonzeros pattern must stay unchanged solver.factorize(A); x1 = solver.solve(b1); x2 = solver.solve(b2); ... ``` The compute() method is equivalent to calling both analyzePattern() and factorize(). Each solver provides some specific features, such as determinant, access to the factors, controls of the iterations, and so on. More details are available in the documentations of the respective classes. Finally, most of the iterative solvers, can also be used in a **matrix-free** context, see the following [example](group__matrixfreesolverexample) . The Compute Step ================== In the compute() function, the matrix is generally factorized: [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") for self-adjoint matrices, [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") for general hermitian matrices, LU for non hermitian matrices and QR for rectangular matrices. These are the results of using direct solvers. For this class of solvers precisely, the compute step is further subdivided into analyzePattern() and factorize(). The goal of analyzePattern() is to reorder the nonzero elements of the matrix, such that the factorization step creates less fill-in. This step exploits only the structure of the matrix. Hence, the results of this step can be used for other linear systems where the matrix has the same structure. Note however that sometimes, some external solvers (like [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.")) require that the values of the matrix are set in this step, for instance to equilibrate the rows and columns of the matrix. In this situation, the results of this step should not be used with other matrices. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") provides a limited set of methods to reorder the matrix in this step, either built-in (COLAMD, AMD) or external (METIS). These methods are set in template parameter list of the solver : ``` DirectSolverClassName<SparseMatrix<double>, OrderingMethod<IndexType> > solver; ``` See the [OrderingMethods module](group__orderingmethods__module) for the list of available methods and the associated options. In factorize(), the factors of the coefficient matrix are computed. This step should be called each time the values of the matrix change. However, the structural pattern of the matrix should not change between multiple calls. For iterative solvers, the compute step is used to eventually setup a preconditioner. For instance, with the ILUT preconditioner, the incomplete factors L and U are computed in this step. Remember that, basically, the goal of the preconditioner is to speedup the convergence of an iterative method by solving a modified linear system where the coefficient matrix has more clustered eigenvalues. For real problems, an iterative solver should always be used with a preconditioner. In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), a preconditioner is selected by simply adding it as a template parameter to the iterative solver object. ``` IterativeSolverClassName<SparseMatrix<double>, PreconditionerName<SparseMatrix<double> > solver; ``` The member function preconditioner() returns a read-write reference to the preconditioner to directly interact with it. See the [Iterative solvers module](group__iterativelinearsolvers__module) and the documentation of each class for the list of available methods. The Solve step ================ The solve() function computes the solution of the linear systems with one or many right hand sides. ``` X = solver.solve(B); ``` Here, B can be a vector or a matrix where the columns form the different right hand sides. The solve() function can be called several times as well, for instance when all the right hand sides are not available at once. ``` x1 = solver.solve(b1); // Get the second right hand side b2 x2 = solver.solve(b2); // ... ``` For direct methods, the solution are computed at the machine precision. Sometimes, the solution need not be too accurate. In this case, the iterative methods are more suitable and the desired accuracy can be set before the solve step using **setTolerance()**. For all the available functions, please, refer to the documentation of the [Iterative solvers module](group__iterativelinearsolvers__module) . BenchmarkRoutine ================== Most of the time, all you need is to know how much time it will take to solve your system, and hopefully, what is the most suitable solver. In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), we provide a benchmark routine that can be used for this purpose. It is very easy to use. In the build directory, navigate to bench/spbench and compile the routine by typing **make** *spbenchsolver*. Run it with –help option to get the list of all available options. Basically, the matrices to test should be in [MatrixMarket Coordinate format](http://math.nist.gov/MatrixMarket/formats.html), and the routine returns the statistics from all available solvers in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). To export your matrices and right-hand-side vectors in the matrix-market format, you can the the unsupported SparseExtra module: ``` #include <unsupported/Eigen/SparseExtra> ... Eigen::saveMarket(A, "filename.mtx"); Eigen::saveMarket(A, "filename\_SPD.mtx", [Eigen::Symmetric](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdad5381b2d1c8973a08303c94e7da02333)); // if A is symmetric-positive-definite Eigen::saveMarketVector(B, "filename\_b.mtx"); ``` The following table gives an example of XML statistics from several [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") built-in and external solvers. | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") | N | NNZ | | UMFPACK | SUPERLU | PASTIX LU | [BiCGSTAB](classeigen_1_1bicgstab "A bi conjugate gradient stabilized solver for sparse square problems.") | BiCGSTAB+ILUT | GMRES+ILUT | [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") | CHOLMOD [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") | PASTIX [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") | [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") | CHOLMOD SP [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") | CHOLMOD [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") | PASTIX [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") | CG | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | vector\_graphics | 12855 | 72069 | Compute Time | 0.0254549 | 0.0215677 | 0.0701827 | 0.000153388 | 0.0140107 | 0.0153709 | 0.0101601 | 0.00930502 | 0.0649689 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.00337835 | 0.000951826 | 0.00484373 | 0.0374886 | 0.0046445 | 0.00847754 | 0.000541813 | 0.000293696 | 0.00485376 | | Total Time | 0.0288333 | 0.0225195 | 0.0750265 | 0.037642 | 0.0186552 | 0.0238484 | 0.0107019 | 0.00959871 | 0.0698227 | | Error(Iter) | 1.299e-16 | 2.04207e-16 | 4.83393e-15 | 3.94856e-11 (80) | 1.03861e-12 (3) | 5.81088e-14 (6) | 1.97578e-16 | 1.83927e-16 | 4.24115e-15 | | poisson\_SPD | 19788 | 308232 | Compute Time | 0.425026 | 1.82378 | 0.617367 | 0.000478921 | 1.34001 | 1.33471 | 0.796419 | 0.857573 | 0.473007 | 0.814826 | 0.184719 | 0.861555 | 0.470559 | 0.000458188 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.0280053 | 0.0194402 | 0.0268747 | 0.249437 | 0.0548444 | 0.0926991 | 0.00850204 | 0.0053171 | 0.0258932 | 0.00874603 | 0.00578155 | 0.00530361 | 0.0248942 | 0.239093 | | Total Time | 0.453031 | 1.84322 | 0.644241 | 0.249916 | 1.39486 | 1.42741 | 0.804921 | 0.862891 | 0.4989 | 0.823572 | 0.190501 | 0.866859 | 0.495453 | 0.239551 | | Error(Iter) | 4.67146e-16 | 1.068e-15 | 1.3397e-15 | 6.29233e-11 (201) | 3.68527e-11 (6) | 3.3168e-15 (16) | 1.86376e-15 | 1.31518e-16 | 1.42593e-15 | 3.45361e-15 | 3.14575e-16 | 2.21723e-15 | 7.21058e-16 | 9.06435e-12 (261) | | sherman2 | 1080 | 23094 | Compute Time | 0.00631754 | 0.015052 | 0.0247514 | - | 0.0214425 | 0.0217988 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.000478424 | 0.000337998 | 0.0010291 | - | 0.00243152 | 0.00246152 | | Total Time | 0.00679597 | 0.01539 | 0.0257805 | - | 0.023874 | 0.0242603 | | Error(Iter) | 1.83099e-15 | 8.19351e-15 | 2.625e-14 | 1.3678e+69 (1080) | 4.1911e-12 (7) | 5.0299e-13 (12) | | bcsstk01\_SPD | 48 | 400 | Compute Time | 0.000169079 | 0.00010789 | 0.000572538 | 1.425e-06 | 9.1612e-05 | 8.3985e-05 | 5.6489e-05 | 7.0913e-05 | 0.000468251 | 5.7389e-05 | 8.0212e-05 | 5.8394e-05 | 0.000463017 | 1.333e-06 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 1.2288e-05 | 1.1124e-05 | 0.000286387 | 8.5896e-05 | 1.6381e-05 | 1.6984e-05 | 3.095e-06 | 4.115e-06 | 0.000325438 | 3.504e-06 | 7.369e-06 | 3.454e-06 | 0.000294095 | 6.0516e-05 | | Total Time | 0.000181367 | 0.000119014 | 0.000858925 | 8.7321e-05 | 0.000107993 | 0.000100969 | 5.9584e-05 | 7.5028e-05 | 0.000793689 | 6.0893e-05 | 8.7581e-05 | 6.1848e-05 | 0.000757112 | 6.1849e-05 | | Error(Iter) | 1.03474e-16 | 2.23046e-16 | 2.01273e-16 | 4.87455e-07 (48) | 1.03553e-16 (2) | 3.55965e-16 (2) | 2.48189e-16 | 1.88808e-16 | 1.97976e-16 | 2.37248e-16 | 1.82701e-16 | 2.71474e-16 | 2.11322e-16 | 3.547e-09 (48) | | sherman1 | 1000 | 3750 | Compute Time | 0.00228805 | 0.00209231 | 0.00528268 | 9.846e-06 | 0.00163522 | 0.00162155 | 0.000789259 | 0.000804495 | 0.00438269 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.000213788 | 9.7983e-05 | 0.000938831 | 0.00629835 | 0.000361764 | 0.00078794 | 4.3989e-05 | 2.5331e-05 | 0.000917166 | | Total Time | 0.00250184 | 0.00219029 | 0.00622151 | 0.0063082 | 0.00199698 | 0.00240949 | 0.000833248 | 0.000829826 | 0.00529986 | | Error(Iter) | 1.16839e-16 | 2.25968e-16 | 2.59116e-16 | 3.76779e-11 (248) | 4.13343e-11 (4) | 2.22347e-14 (10) | 2.05861e-16 | 1.83555e-16 | 1.02917e-15 | | young1c | 841 | 4089 | Compute Time | 0.00235843 | 0.00217228 | 0.00568075 | 1.2735e-05 | 0.00264866 | 0.00258236 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.000329599 | 0.000168634 | 0.00080118 | 0.0534738 | 0.00187193 | 0.00450211 | | Total Time | 0.00268803 | 0.00234091 | 0.00648193 | 0.0534865 | 0.00452059 | 0.00708447 | | Error(Iter) | 1.27029e-16 | 2.81321e-16 | 5.0492e-15 | 8.0507e-11 (706) | 3.00447e-12 (8) | 1.46532e-12 (16) | | mhd1280b | 1280 | 22778 | Compute Time | 0.00234898 | 0.00207079 | 0.00570918 | 2.5976e-05 | 0.00302563 | 0.00298036 | 0.00144525 | 0.000919922 | 0.00426444 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.00103392 | 0.000211911 | 0.00105 | 0.0110432 | 0.000628287 | 0.00392089 | 0.000138303 | 6.2446e-05 | 0.00097564 | | Total Time | 0.0033829 | 0.0022827 | 0.00675918 | 0.0110692 | 0.00365392 | 0.00690124 | 0.00158355 | 0.000982368 | 0.00524008 | | Error(Iter) | 1.32953e-16 | 3.08646e-16 | 6.734e-16 | 8.83132e-11 (40) | 1.51153e-16 (1) | 6.08556e-16 (8) | 1.89264e-16 | 1.97477e-16 | 6.68126e-09 | | crashbasis | 160000 | 1750416 | Compute Time | 3.2019 | 5.7892 | 15.7573 | 0.00383515 | 3.1006 | 3.09921 | | [Solve](classeigen_1_1solve "Pseudo expression representing a solving operation.") Time | 0.261915 | 0.106225 | 0.402141 | 1.49089 | 0.24888 | 0.443673 | | Total Time | 3.46381 | 5.89542 | 16.1594 | 1.49473 | 3.34948 | 3.54288 | | Error(Iter) | 1.76348e-16 | 4.58395e-16 | 1.67982e-14 | 8.64144e-11 (61) | 8.5996e-12 (2) | 6.04042e-14 (5) |
programming_docs
eigen3 Eigen::DenseCoeffsBase Eigen::DenseCoeffsBase ====================== ### template<typename Derived> class Eigen::DenseCoeffsBase< Derived, DirectAccessors > Base class providing direct read-only coefficient access to matrices and arrays. Template Parameters | | | | --- | --- | | Derived | Type of the derived class | Note [DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) Constant indicating direct access This class defines functions to work with strides which can be used to access entries directly. This class inherits [DenseCoeffsBase<Derived, ReadOnlyAccessors>](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4 "Base class providing read-only coefficient access to matrices and arrays.") which defines functions to access entries read-only using `operator()` . See also [The class hierarchy](topicclasshierarchy) | | | --- | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#af8b144e79782a441448d59e00834f31a) () const | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#a8b17f1bcdb474072e079bb1a7926ef7f) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#ad88c60c4a2356be2c436f3264dd20b55) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#a95a043ca237afe8ccb18c6900091b170) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | cols() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::cols | ( | void | | ) | | | inline | Returns the number of columns. See also [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), ColsAtCompileTime colStride() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) >::colStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive columns. See also innerStride(), outerStride(), rowStride() derived() [1/2] --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | Derived& [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::derived | | inline | Returns a reference to the derived object derived() [2/2] --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const Derived& [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::derived | | inline | Returns a const reference to the derived object innerStride() ------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) >::innerStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive elements within a slice in the inner direction. See also outerStride(), rowStride(), colStride() outerStride() ------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) >::outerStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns in a column-major matrix). See also innerStride(), rowStride(), colStride() rows() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::rows | ( | void | | ) | | | inline | Returns the number of rows. See also [cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), RowsAtCompileTime rowStride() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::DenseCoeffsBase< Derived, [DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) >::rowStride | ( | | ) | const | | inline | Returns the pointer increment between two consecutive rows. See also innerStride(), outerStride(), colStride() size() ------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::size | | inline | Returns the number of coefficients, which is [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2)\*cols(). See also [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), SizeAtCompileTime. --- The documentation for this class was generated from the following file:* [DenseCoeffsBase.h](https://eigen.tuxfamily.org/dox/DenseCoeffsBase_8h_source.html) eigen3 Eigen::SparseVector Eigen::SparseVector =================== ### template<typename \_Scalar, int \_Options, typename \_StorageIndex> class Eigen::SparseVector< \_Scalar, \_Options, \_StorageIndex > a sparse vector class Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e. the type of the coefficients | See <http://www.netlib.org/linalg/html_templates/node91.html> for details on the storage scheme. This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_SPARSEVECTOR_PLUGIN`. | | | --- | | | | Scalar & | [coeffRef](classeigen_1_1sparsevector#a4b1845ada6ae59dd7afe361e30136ace) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | | void | [conservativeResize](classeigen_1_1sparsevector#ab8dbb1f73b6250c10c0860eb13ca5cca) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsevector#aeaa74603bb1405f622726907795c9b5a) () const | | | | void | [prune](classeigen_1_1sparsevector#af094e30271da69f865b5d97f338f81d1) (const Scalar &reference, const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< RealScalar >::dummy\_precision()) | | | | void | [resize](classeigen_1_1sparsevector#a1020011c75fb70b21257c8d04ee07514) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1sparsevector#a2dc842b3bb2ba3692e210565c48aff3c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | Scalar | [sum](classeigen_1_1sparsevector#a05e8aff0ba5c4dd4ab69e173d80d1a68) () const | | | | void | [swap](classeigen_1_1sparsevector#a977f1796d4b332a0827c5a1d7b1ed561) ([SparseVector](classeigen_1_1sparsevector) &other) | | | | | [~SparseVector](classeigen_1_1sparsevector#ad519592c203aedf33c524feb1bdaad1b) () | | | | Public Member Functions inherited from [Eigen::SparseCompressedBase< SparseVector< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsecompressedbase) | | [Map](classeigen_1_1map)< [Array](classeigen_1_1array)< Scalar, Dynamic, 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a7cf299e08d2a4f6d6869e631e51b12fe) () | | | | const [Map](classeigen_1_1map)< const [Array](classeigen_1_1array)< Scalar, Dynamic, 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a101b155485ae59ea1261c4f6040f3dc4) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#aa64818e1aa43015dad01b114b2ab4687) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#a411e972b097e6aef225415a4c2d0a0b5) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#afc056a3895eae1a4c4767252ff04966a) () const | | | | bool | [isCompressed](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsecompressedbase#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a2624d4c2661c582de168246c56e8d71e) () const | | | | Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f44c739398794ea77f310b745cc5627) () const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< SparseVector< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex > >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | const [Product](classeigen_1_1product)< [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex > > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >, Upper|Lower > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< SparseVector< \_Scalar, \_Options, \_StorageIndex > >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex > & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex > & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< SparseVector< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsematrixbase) | | typedef internal::traits< [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex > >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< SparseVector< \_Scalar, \_Options, \_StorageIndex > >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SparseCompressedBase< SparseVector< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsecompressedbase) | | | [SparseCompressedBase](classeigen_1_1sparsecompressedbase#af79f020db965367d97eb954fc68d8f99) () | | | ~SparseVector() --------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::~[SparseVector](classeigen_1_1sparsevector) | ( | | ) | | | inline | Destructor coeffRef() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Scalar& [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::coeffRef | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *i* | ) | | | inline | Returns a reference to the coefficient value at given index *i* This operation involes a log(rho\*size) binary search. If the coefficient does not exist yet, then a sorted insertion into a sequential buffer is performed. This insertion might be very costly if the number of nonzeros above *i* is large. conservativeResize() -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::conservativeResize | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *newSize* | ) | | | inline | Resizes the sparse vector to *newSize*, while leaving old values untouched. If the size of the vector is decreased, then the storage of the out-of bounds coefficients is kept and reserved. Call .data().squeeze() to free extra memory. See also reserve(), setZero() nonZeros() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::nonZeros | ( | | ) | const | | inline | Returns the number of non zero coefficients prune() ------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::prune | ( | const Scalar & | *reference*, | | | | const RealScalar & | *epsilon* = `[NumTraits](structeigen_1_1numtraits)<RealScalar>::dummy_precision()` | | | ) | | | | inline | Suppresses all nonzeros which are **much** **smaller** **than** *reference* under the tolerance *epsilon* resize() [1/2] -------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::resize | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *newSize* | ) | | | inline | Resizes the sparse vector to *newSize* This method deletes all entries, thus leaving an empty sparse vector See also [conservativeResize()](classeigen_1_1sparsevector#ab8dbb1f73b6250c10c0860eb13ca5cca), setZero() resize() [2/2] -------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::resize | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inline | Resizes the sparse vector to *rows* x *cols* This method is provided for compatibility with matrices. For a column vector, *cols* must be equal to 1. For a row vector, *rows* must be equal to 1. See also [resize(Index)](classeigen_1_1sparsevector#a1020011c75fb70b21257c8d04ee07514) sum() ----- template<typename \_Scalar , int \_Options, typename \_Index > | | | --- | | internal::traits< [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_Index > >::Scalar [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_Index >::sum | Overloaded for performance swap() ------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex >::swap | ( | [SparseVector](classeigen_1_1sparsevector)< \_Scalar, \_Options, \_StorageIndex > & | *other* | ) | | | inline | Swaps the values of `*this` and *other*. Overloaded for performance: this version performs a *shallow* swap by swapping pointers and attributes only. See also SparseMatrixBase::swap() --- The documentation for this class was generated from the following files:* [SparseUtil.h](https://eigen.tuxfamily.org/dox/SparseUtil_8h_source.html) * [SparseVector.h](https://eigen.tuxfamily.org/dox/SparseVector_8h_source.html) * [SparseRedux.h](https://eigen.tuxfamily.org/dox/SparseRedux_8h_source.html)
programming_docs
eigen3 Eigen::PastixLDLT Eigen::PastixLDLT ================= ### template<typename \_MatrixType, int \_UpLo> class Eigen::PastixLDLT< \_MatrixType, \_UpLo > A sparse direct supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PaStiX library. This class is used to solve the linear systems A.X = B via a LDL^T supernodal Cholesky factorization available in the PaStiX library. The matrix A should be symmetric and positive definite WARNING Selfadjoint complex matrices are not supported in the current version of PaStiX The vectors or matrices X and B can be either dense or sparse Template Parameters | | | | --- | --- | | MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | UpLo | The part of the matrix to use : Lower or Upper. The default is Lower as required by PaStiX | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") Inherits Eigen::PastixBase< Derived >. | | | --- | | | | void | [analyzePattern](classeigen_1_1pastixldlt#a01947862303ca404b9ce5033751a221b) (const MatrixType &matrix) | | | | void | [compute](classeigen_1_1pastixldlt#abf3135c2dc17d9df26fef80e6456a691) (const MatrixType &matrix) | | | | void | [factorize](classeigen_1_1pastixldlt#a182b0ee676a131413363cc73bc309ef7) (const MatrixType &matrix) | | | analyzePattern() ---------------- template<typename \_MatrixType , int \_UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PastixLDLT](classeigen_1_1pastixldlt)< \_MatrixType, \_UpLo >::analyzePattern | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the LDL^T symbolic factorization of `matrix` using its sparsity pattern The result of this operation can be used with successive matrices having the same pattern as `matrix` See also [factorize()](classeigen_1_1pastixldlt#a182b0ee676a131413363cc73bc309ef7) compute() --------- template<typename \_MatrixType , int \_UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PastixLDLT](classeigen_1_1pastixldlt)< \_MatrixType, \_UpLo >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the L and D factors of the LDL^T factorization of `matrix` See also [analyzePattern()](classeigen_1_1pastixldlt#a01947862303ca404b9ce5033751a221b) [factorize()](classeigen_1_1pastixldlt#a182b0ee676a131413363cc73bc309ef7) factorize() ----------- template<typename \_MatrixType , int \_UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PastixLDLT](classeigen_1_1pastixldlt)< \_MatrixType, \_UpLo >::factorize | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the LDL^T supernodal numerical factorization of `matrix` --- The documentation for this class was generated from the following file:* [PaStiXSupport.h](https://eigen.tuxfamily.org/dox/PaStiXSupport_8h_source.html) eigen3 STL iterators and algorithms STL iterators and algorithms ============================ Since the version 3.4, Eigen's dense matrices and arrays provide STL compatible iterators. As demonstrated below, this makes them naturally compatible with range-for-loops and STL's algorithms. Iterating over 1D arrays and vectors ====================================== Any dense 1D expressions exposes the pair of `begin()/end()` methods to iterate over them. This directly enables c++11 range for loops: | Example: | Output: | | --- | --- | | ``` VectorXi v = [VectorXi::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4); cout << "Here is the vector v:\n"; for(auto x : v) cout << x << " "; cout << "\n"; ``` | ``` Here is the vector v: 7 -2 6 6 ``` | One dimensional expressions can also easily be passed to STL algorithms: | Example: | Output: | | --- | --- | | ``` Array4i v = [Array4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)().abs(); cout << "Here is the initial vector v:\n" << v.transpose() << "\n"; std::sort(v.begin(), v.end()); cout << "Here is the sorted vector v:\n" << v.transpose() << "\n"; ``` | ``` Here is the initial vector v: 7 2 6 6 Here is the sorted vector v: 2 6 6 7 ``` | Similar to `std::vector`, 1D expressions also exposes the pair of `cbegin()/cend()` methods to conveniently get const iterators on non-const object. Iterating over coefficients of 2D arrays and matrices ======================================================= STL iterators are intrinsically designed to iterate over 1D structures. This is why `begin()/end()` methods are disabled for 2D expressions. Iterating over all coefficients of a 2D expressions is still easily accomplished by creating a 1D linear view through `reshaped()`: | Example: | Output: | | --- | --- | | ``` Matrix2i A = [Matrix2i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here are the coeffs of the 2x2 matrix A:\n"; for(auto x : A.reshaped()) cout << x << " "; cout << "\n"; ``` | ``` Here are the coeffs of the 2x2 matrix A: 7 -2 6 6 ``` | Iterating over rows or columns of 2D arrays and matrices ========================================================== It is also possible to get iterators over rows or columns of 2D expressions. Those are available through the `rowwise()` and `colwise()` proxies. Here is an example sorting each row of a matrix: | Example: | Output: | | --- | --- | | ``` ArrayXXi A = [ArrayXXi::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4).abs(); cout << "Here is the initial matrix A:\n" << A << "\n"; for(auto row : A.rowwise()) std::sort(row.begin(), row.end()); cout << "Here is the sorted matrix A:\n" << A << "\n"; ``` | ``` Here is the initial matrix A: 7 9 5 3 2 6 1 0 6 3 0 9 6 6 3 9 Here is the sorted matrix A: 3 5 7 9 0 1 2 6 0 3 6 9 3 6 6 9 ``` | eigen3 Eigen::Map Eigen::Map ========== ### template<typename \_Scalar, int \_Options> class Eigen::Map< const Quaternion< \_Scalar >, \_Options > [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") expression mapping a constant memory buffer. Template Parameters | | | | --- | --- | | \_Scalar | the type of the [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") coefficients | | \_Options | see class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") | This is a specialization of class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."). This class allows to view a 4 scalar memory buffer as an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") object. See also class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."), class [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), class [QuaternionBase](classeigen_1_1quaternionbase "Base class for quaternion expressions.") | | | --- | | | | | [Map](classeigen_1_1map_3_01const_01quaternion_3_01__scalar_01_4_00_01__options_01_4#a62785b607c1f24dfc042e28dedc791f8) (const Scalar \*coeffs) | | | | Public Member Functions inherited from [Eigen::QuaternionBase< Map< const Quaternion< \_Scalar >, \_Options > >](classeigen_1_1quaternionbase) | | [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) | [\_transformVector](classeigen_1_1quaternionbase#aabef1f6fc62535f6f85d590108915ee8) (const [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) &v) const | | | | internal::traits< [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [angularDistance](classeigen_1_1quaternionbase#a74f13d7c853484996494c26c633ae02a) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | internal::cast\_return\_type< [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options >, [Quaternion](classeigen_1_1quaternion)< NewScalarType > >::type | [cast](classeigen_1_1quaternionbase#a951d627764be63ca1e8c2c4c7315e43f) () const | | | | internal::traits< [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::Coefficients & | [coeffs](classeigen_1_1quaternionbase#ae61294790c0cc308d3f69690a657672c) () | | | | const internal::traits< [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::Coefficients & | [coeffs](classeigen_1_1quaternionbase#a193e79f616335a0067e3e784c7cf85fa) () const | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [conjugate](classeigen_1_1quaternionbase#a5e63b775d0a93161ce6137ec0a17f6b0) () const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [dot](classeigen_1_1quaternionbase#aa2d22c5b321c9539dd625ca415422236) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [inverse](classeigen_1_1quaternionbase#ab12ee41b3b06adc3062217a795a6a9f5) () const | | | | bool | [isApprox](classeigen_1_1quaternionbase#a64bc41c96a9e99567e0f8409f8f0f680) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) >::dummy\_precision()) const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [norm](classeigen_1_1quaternionbase#aad4b1faef1eabdc7fdd4d305e9881149) () const | | | | void | [normalize](classeigen_1_1quaternionbase#a7a487a8a129b46be562f42044102c1f8) () | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [normalized](classeigen_1_1quaternionbase#ade799f18b7ec19c02ddae3a4921fa8a0) () const | | | | bool | [operator!=](classeigen_1_1quaternionbase#a530edf22f03853cd07ba829ea0d505dc) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< typename internal::traits< [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [operator\*](classeigen_1_1quaternionbase#afdf1dc395c1cff6716ec9b80fd15b414) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [operator\*=](classeigen_1_1quaternionbase#afd8ee6b6420fbdd22fab7cd016212441) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &q) | | | | [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [operator=](classeigen_1_1quaternionbase#aa7c114c6e62a37d4fc53b6e82ed78eac) (const [AngleAxisType](classeigen_1_1quaternionbase#aed266c63b10a4028304901d9c8614199) &aa) | | | | [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [operator=](classeigen_1_1quaternionbase#a20a6702c9da3fc2950178d920d0aaf84) (const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &xpr) | | | | bool | [operator==](classeigen_1_1quaternionbase#ad206c9014409c06970884dbfc00e6c3c) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [setFromTwoVectors](classeigen_1_1quaternionbase#a7ae84bfbcc9f3f19f10294496a836bee) (const [MatrixBase](classeigen_1_1matrixbase)< Derived1 > &a, const [MatrixBase](classeigen_1_1matrixbase)< Derived2 > &b) | | | | [QuaternionBase](classeigen_1_1quaternionbase) & | [setIdentity](classeigen_1_1quaternionbase#a4695b0f6eebfb217ae2fbd579ceda24a) () | | | | [Quaternion](classeigen_1_1quaternion)< typename internal::traits< [Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [slerp](classeigen_1_1quaternionbase#ac840bde67d22f2deca330561c65d144e) (const [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) &t, const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [squaredNorm](classeigen_1_1quaternionbase#a09730db4ef0b546f5cf29f6b180b3c87) () const | | | | [Matrix3](classeigen_1_1quaternionbase#ac3972e6cb0f56cccbe9e3946a7e494f8) | [toRotationMatrix](classeigen_1_1quaternionbase#a8cf07ab9875baba2eecdd62ff93bfc3f) () const | | | | [VectorBlock](classeigen_1_1vectorblock)< Coefficients, 3 > | [vec](classeigen_1_1quaternionbase#a91f93bde88f52796cfcd92c3594f39e5) () | | | | const [VectorBlock](classeigen_1_1vectorblock)< const Coefficients, 3 > | [vec](classeigen_1_1quaternionbase#ada8bdb403471df23511bdc0f227962ea) () const | | | | NonConstCoeffReturnType | [w](classeigen_1_1quaternionbase#ad884cf20a0b0b92bb63ab3fe9d6d6b7f) () | | | | CoeffReturnType | [w](classeigen_1_1quaternionbase#ab5eae91bedac0afaab0074cec5e535bc) () const | | | | NonConstCoeffReturnType | [x](classeigen_1_1quaternionbase#a8b05bac2a1c099b341396f725e85f3b1) () | | | | CoeffReturnType | [x](classeigen_1_1quaternionbase#afdd8e260d5de861a6136cb9e6ceaa4b4) () const | | | | NonConstCoeffReturnType | [y](classeigen_1_1quaternionbase#a6005245a72520df258d30af6b5448595) () | | | | CoeffReturnType | [y](classeigen_1_1quaternionbase#aad37efca5d9fde3f4cb03a208f38d74f) () const | | | | NonConstCoeffReturnType | [z](classeigen_1_1quaternionbase#a9afed6a7fa4fcdfbe599d7b5b207fc1b) () | | | | CoeffReturnType | [z](classeigen_1_1quaternionbase#a8389b65a61aa3fc76d3ba4bd4a63e529) () const | | | | Public Member Functions inherited from [Eigen::RotationBase< Derived, \_Dim >](classeigen_1_1rotationbase) | | Derived | [inverse](classeigen_1_1rotationbase#a8532fb716ea4267cf8bbdb99e5e54837) () const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [matrix](classeigen_1_1rotationbase#a91b5bdb1c7b90ec7b33107c6f7d3b171) () const | | | | template<typename OtherDerived > | | internal::rotation\_base\_generic\_product\_selector< Derived, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType | [operator\*](classeigen_1_1rotationbase#a09a4757e7aff7a95bebf4fa8a965a4eb) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &e) const | | | | template<int Mode, int Options> | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode > | [operator\*](classeigen_1_1rotationbase#aaca1c3d834e2bc7ebfd046d96cac990c) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode, Options > &t) const | | | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) > | [operator\*](classeigen_1_1rotationbase#a26d0603783666526a98d08bd45d9c751) (const [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim > &t) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [operator\*](classeigen_1_1rotationbase#a05af64a1bc759c5fed4ff7afd1414ba4) (const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > &s) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [toRotationMatrix](classeigen_1_1rotationbase#a94fe3683c867c39d34505932b07e956a) () const | | | | | | --- | | | | Public Types inherited from [Eigen::QuaternionBase< Map< const Quaternion< \_Scalar >, \_Options > >](classeigen_1_1quaternionbase) | | typedef [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [AngleAxisType](classeigen_1_1quaternionbase#aed266c63b10a4028304901d9c8614199) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), 3, 3 > | [Matrix3](classeigen_1_1quaternionbase#ac3972e6cb0f56cccbe9e3946a7e494f8) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), 3, 1 > | [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) | | | | Public Types inherited from [Eigen::RotationBase< Derived, \_Dim >](classeigen_1_1rotationbase) | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Dim > | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | | | | Static Public Member Functions inherited from [Eigen::QuaternionBase< Map< const Quaternion< \_Scalar >, \_Options > >](classeigen_1_1quaternionbase) | | static [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [Identity](classeigen_1_1quaternionbase#a6f31a6f98016f186515b3277f4757962) () | | | Map() ----- template<typename \_Scalar , int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< const [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options >::[Map](classeigen_1_1map) | ( | const Scalar \* | *coeffs* | ) | | | inlineexplicit | Constructs a Mapped [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") object from the pointer *coeffs* The pointer *coeffs* must reference the four coefficients of [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") in the following order: ``` *coeffs == {[x](classeigen_1_1quaternionbase#afdd8e260d5de861a6136cb9e6ceaa4b4), [y](classeigen_1_1quaternionbase#aad37efca5d9fde3f4cb03a208f38d74f), [z](classeigen_1_1quaternionbase#a8389b65a61aa3fc76d3ba4bd4a63e529), [w](classeigen_1_1quaternionbase#ab5eae91bedac0afaab0074cec5e535bc)} ``` If the template parameter \_Options is set to [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8), then the pointer coeffs must be aligned. --- The documentation for this class was generated from the following file:* [Quaternion.h](https://eigen.tuxfamily.org/dox/Quaternion_8h_source.html)
programming_docs
eigen3 The class hierarchy The class hierarchy =================== This page explains the design of the core classes in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s class hierarchy and how they fit together. Casual users probably need not concern themselves with these details, but it may be useful for both advanced users and [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") developers. Principles ============ [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s class hierarchy is designed so that virtual functions are avoided where their overhead would significantly impair performance. Instead, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") achieves polymorphism with the Curiously Recurring Template Pattern (CRTP). In this pattern, the base class (for instance, `[MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")`) is in fact a template class, and the derived class (for instance, `[Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")`) inherits the base class with the derived class itself as a template argument (in this case, `[Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")` inherits from `[MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")<[Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")>`). This allows [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") to resolve the polymorphic function calls at compile time. In addition, the design avoids multiple inheritance. One reason for this is that in our experience, some compilers (like MSVC) fail to perform empty base class optimization, which is crucial for our fixed-size types. The core classes ================== These are the classes that you need to know about if you want to write functions that accept or return [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") objects. * [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") means plain dense matrix. If `m` is a `Matrix`, then, for instance, `m+m` is no longer a `Matrix`, it is a "matrix expression". * [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") means dense matrix expression. This means that a `MatrixBase` is something that can be added, matrix-multiplied, LU-decomposed, QR-decomposed... All matrix expression classes, including `Matrix` itself, inherit `MatrixBase`. * [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") means plain dense array. If `x` is an `Array`, then, for instance, `x+x` is no longer an `Array`, it is an "array expression". * [ArrayBase](classeigen_1_1arraybase "Base class for all 1D and 2D array, and related expressions.") means dense array expression. This means that an `ArrayBase` is something that can be added, array-multiplied, and on which you can perform all sorts of array operations... All array expression classes, including `Array` itself, inherit `ArrayBase`. * [DenseBase](classeigen_1_1densebase "Base class for all dense matrices, vectors, and arrays.") means dense (matrix or array) expression. Both `ArrayBase` and `MatrixBase` inherit `DenseBase`. `DenseBase` is where all the methods go that apply to dense expressions regardless of whether they are matrix or array expressions. For example, the [block(...)](topicclasshierarchy) methods are in `DenseBase`. Base classes ============== These classes serve as base classes for the five core classes mentioned above. They are more internal and so less interesting for users of the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") library. * [PlainObjectBase](classeigen_1_1plainobjectbase "Dense storage base class for matrices and arrays.") means dense (matrix or array) plain object, i.e. something that stores its own dense array of coefficients. This is where, for instance, the [resize()](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a) methods go. `PlainObjectBase` is inherited by `Matrix` and by `Array`. But above, we said that `Matrix` inherits `MatrixBase` and `Array` inherits `ArrayBase`. So does that mean multiple inheritance? No, because `PlainObjectBase` *itself* inherits `MatrixBase` or `ArrayBase` depending on whether we are in the matrix or array case. When we said above that `Matrix` inherited `MatrixBase`, we omitted to say it does so indirectly via `PlainObjectBase`. Same for `Array`. * DenseCoeffsBase means something that has dense coefficient accessors. It is a base class for `DenseBase`. The reason for `DenseCoeffsBase` to exist is that the set of available coefficient accessors is very different depending on whether a dense expression has direct memory access or not (the `DirectAccessBit` flag). For example, if `x` is a plain matrix, then `x` has direct access, and `x.transpose()` and `x.block(...)` also have direct access, because their coefficients can be read right off memory, but for example, `x+x` does not have direct memory access, because obtaining any of its coefficients requires a computation (an addition), it can't be just read off memory. * [EigenBase](structeigen_1_1eigenbase) means anything that can be evaluated into a plain dense matrix or array (even if that would be a bad idea). `EigenBase` is really the absolute base class for anything that remotely looks like a matrix or array. It is a base class for `DenseCoeffsBase`, so it sits below all our dense class hierarchy, but it is not limited to dense expressions. For example, `EigenBase` is also inherited by diagonal matrices, sparse matrices, etc... Inheritance diagrams ====================== The inheritance diagram for [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") looks as follows: ``` [EigenBase](structeigen_1_1eigenbase)<Matrix> <-- DenseCoeffsBase<Matrix> (direct access case) <-- [DenseBase](classeigen_1_1densebase "Base class for all dense matrices, vectors, and arrays.")<Matrix> <-- [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")<Matrix> <-- [PlainObjectBase](classeigen_1_1plainobjectbase "Dense storage base class for matrices and arrays.")<Matrix> (matrix case) <-- [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") ``` The inheritance diagram for [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") looks as follows: ``` [EigenBase](structeigen_1_1eigenbase)<Array> <-- DenseCoeffsBase<Array> (direct access case) <-- [DenseBase](classeigen_1_1densebase "Base class for all dense matrices, vectors, and arrays.")<Array> <-- [ArrayBase](classeigen_1_1arraybase "Base class for all 1D and 2D array, and related expressions.")<Array> <-- [PlainObjectBase](classeigen_1_1plainobjectbase "Dense storage base class for matrices and arrays.")<Array> (array case) <-- [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") ``` The inheritance diagram for some other matrix expression class, here denoted by `SomeMatrixXpr`, looks as follows: ``` [EigenBase](structeigen_1_1eigenbase)<SomeMatrixXpr> <-- DenseCoeffsBase<SomeMatrixXpr> (direct access or no direct access case) <-- [DenseBase](classeigen_1_1densebase "Base class for all dense matrices, vectors, and arrays.")<SomeMatrixXpr> <-- [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.")<SomeMatrixXpr> <-- SomeMatrixXpr ``` The inheritance diagram for some other array expression class, here denoted by `SomeArrayXpr`, looks as follows: ``` [EigenBase](structeigen_1_1eigenbase)<SomeArrayXpr> <-- DenseCoeffsBase<SomeArrayXpr> (direct access or no direct access case) <-- [DenseBase](classeigen_1_1densebase "Base class for all dense matrices, vectors, and arrays.")<SomeArrayXpr> <-- [ArrayBase](classeigen_1_1arraybase "Base class for all 1D and 2D array, and related expressions.")<SomeArrayXpr> <-- SomeArrayXpr ``` Finally, consider an example of something that is not a dense expression, for instance a diagonal matrix. The corresponding inheritance diagram is: ``` [EigenBase](structeigen_1_1eigenbase)<DiagonalMatrix> <-- DiagonalBase<DiagonalMatrix> <-- [DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage.") ``` eigen3 CholmodSupport module CholmodSupport module ===================== This module provides an interface to the Cholmod library which is part of the [suitesparse](http://www.suitesparse.com) package. It provides the two following main factorization classes: * class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. * class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). For the sake of completeness, this module also propose the two following classes: * class CholmodSimplicialLLT * class CholmodSimplicialLDLT Note that these classes does not bring any particular advantage compared to the built-in SimplicialLLT and SimplicialLDLT factorization classes. ``` #include <Eigen/CholmodSupport> ``` In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. The dependencies depend on how cholmod has been compiled. For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. | | | --- | | | | class | [Eigen::CholmodBase< \_MatrixType, \_UpLo, Derived >](classeigen_1_1cholmodbase) | | | The base class for the direct Cholesky factorization of Cholmod. [More...](classeigen_1_1cholmodbase#details) | | | | class | [Eigen::CholmodDecomposition< \_MatrixType, \_UpLo >](classeigen_1_1cholmoddecomposition) | | | A general Cholesky factorization and solver based on Cholmod. [More...](classeigen_1_1cholmoddecomposition#details) | | | | class | [Eigen::CholmodSimplicialLDLT< \_MatrixType, \_UpLo >](classeigen_1_1cholmodsimplicialldlt) | | | A simplicial direct Cholesky ([LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.")) factorization and solver based on Cholmod. [More...](classeigen_1_1cholmodsimplicialldlt#details) | | | | class | [Eigen::CholmodSimplicialLLT< \_MatrixType, \_UpLo >](classeigen_1_1cholmodsimplicialllt) | | | A simplicial direct Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on Cholmod. [More...](classeigen_1_1cholmodsimplicialllt#details) | | | | class | [Eigen::CholmodSupernodalLLT< \_MatrixType, \_UpLo >](classeigen_1_1cholmodsupernodalllt) | | | A supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on Cholmod. [More...](classeigen_1_1cholmodsupernodalllt#details) | | | eigen3 Eigen::MappedSparseMatrix Eigen::MappedSparseMatrix ========================= ### template<typename \_Scalar, int \_Flags, typename \_StorageIndex> class Eigen::MappedSparseMatrix< \_Scalar, \_Flags, \_StorageIndex > [Sparse](structeigen_1_1sparse) matrix. **[Deprecated:](deprecated#_deprecated000033)** Use [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.")<SparseMatrix<> > Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e. the type of the coefficients | See <http://www.netlib.org/linalg/html_templates/node91.html> for details on the storage scheme. | | | --- | | | | | [~MappedSparseMatrix](classeigen_1_1mappedsparsematrix#a0c36a53853f1659ea59447bcb9a20799) () | | | | Public Member Functions inherited from [Eigen::Map< SparseMatrix< \_Scalar, \_Flags, \_StorageIndex > >](classeigen_1_1map) | | | [Map](classeigen_1_1map#a43b3e84aba2ff1a241dbc3d177fb2e22) (PointerArgType dataPtr, const StrideType &stride=StrideType()) | | | | | [Map](classeigen_1_1map#a3f621386d55a373f53082ac62579897e) (PointerArgType dataPtr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols, const StrideType &stride=StrideType()) | | | | | [Map](classeigen_1_1map#a52069afac76e3f609a6865106dc10254) (PointerArgType dataPtr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const StrideType &stride=StrideType()) | | | ~MappedSparseMatrix() --------------------- template<typename \_Scalar , int \_Flags, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::MappedSparseMatrix](classeigen_1_1mappedsparsematrix)< \_Scalar, \_Flags, \_StorageIndex >::~[MappedSparseMatrix](classeigen_1_1mappedsparsematrix) | ( | | ) | | | inline | Empty destructor --- The documentation for this class was generated from the following file:* [MappedSparseMatrix.h](https://eigen.tuxfamily.org/dox/MappedSparseMatrix_8h_source.html) eigen3 Eigen::Transpositions Eigen::Transpositions ===================== ### template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex> class Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex > Represents a sequence of transpositions (row/column interchange) Template Parameters | | | | --- | --- | | SizeAtCompileTime | the number of transpositions, or Dynamic | | MaxSizeAtCompileTime | the maximum number of transpositions, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. | This class represents a permutation transformation as a sequence of *n* transpositions \([T\_{n-1} \ldots T\_{i} \ldots T\_{0}]\). It is internally stored as a vector of integers `indices`. Each transposition \( T\_{i} \) applied on the left of a matrix ( \( T\_{i} M\)) interchanges the rows `i` and `indices`[i] of the matrix `M`. A transposition applied on the right (e.g., \( M T\_{i}\)) yields a column interchange. Compared to the class [PermutationMatrix](classeigen_1_1permutationmatrix "Permutation matrix."), such a sequence of transpositions is what is computed during a decomposition with pivoting, and it is faster when applying the permutation in-place. To apply a sequence of transpositions to a matrix, simply use the operator \* as in the following example: ``` Transpositions tr; MatrixXf mat; mat = tr * mat; ``` In this example, we detect that the matrix appears on both side, and so the transpositions are applied in-place without any temporary or extra copy. See also class [PermutationMatrix](classeigen_1_1permutationmatrix "Permutation matrix.") Inherits Eigen::TranspositionsBase< Derived >. | | | --- | | | | IndicesType & | [indices](classeigen_1_1transpositions#a678dfbd513871473bcd36bbc453eed8c) () | | | | const IndicesType & | [indices](classeigen_1_1transpositions#a786fd676c156124025aaf446d811d14f) () const | | | | template<typename OtherDerived > | | [Transpositions](classeigen_1_1transpositions) & | [operator=](classeigen_1_1transpositions#a991cbd0dcd647b414bbfdbacb642dbbd) (const TranspositionsBase< OtherDerived > &other) | | | | template<typename Other > | | | [Transpositions](classeigen_1_1transpositions#a415e07d885093f3f256394f59d4986f4) (const [MatrixBase](classeigen_1_1matrixbase)< Other > &[indices](classeigen_1_1transpositions#a786fd676c156124025aaf446d811d14f)) | | | | template<typename OtherDerived > | | | [Transpositions](classeigen_1_1transpositions#aae3eb58072f5b26f3851925eec5a006f) (const TranspositionsBase< OtherDerived > &other) | | | | | [Transpositions](classeigen_1_1transpositions#a6a02dae883f9bc072de3268e1696d0ba) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | Transpositions() [1/3] ---------------------- template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transpositions](classeigen_1_1transpositions)< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >::[Transpositions](classeigen_1_1transpositions) | ( | const TranspositionsBase< OtherDerived > & | *other* | ) | | | inline | Copy constructor. Transpositions() [2/3] ---------------------- template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex > template<typename Other > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transpositions](classeigen_1_1transpositions)< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >::[Transpositions](classeigen_1_1transpositions) | ( | const [MatrixBase](classeigen_1_1matrixbase)< Other > & | *indices* | ) | | | inlineexplicit | Generic constructor from expression of the transposition indices. Transpositions() [3/3] ---------------------- template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Transpositions](classeigen_1_1transpositions)< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >::[Transpositions](classeigen_1_1transpositions) | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *size* | ) | | | inline | Constructs an uninitialized permutation matrix of given size. indices() [1/2] --------------- template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | IndicesType& [Eigen::Transpositions](classeigen_1_1transpositions)< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >::indices | ( | | ) | | | inline | Returns a reference to the stored array representing the transpositions. indices() [2/2] --------------- template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const IndicesType& [Eigen::Transpositions](classeigen_1_1transpositions)< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >::indices | ( | | ) | const | | inline | const version of [indices()](classeigen_1_1transpositions#a678dfbd513871473bcd36bbc453eed8c). operator=() ----------- template<int SizeAtCompileTime, int MaxSizeAtCompileTime, typename \_StorageIndex > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transpositions](classeigen_1_1transpositions)& [Eigen::Transpositions](classeigen_1_1transpositions)< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >::operator= | ( | const TranspositionsBase< OtherDerived > & | *other* | ) | | | inline | Copies the *other* transpositions into `*this` --- The documentation for this class was generated from the following file:* [Transpositions.h](https://eigen.tuxfamily.org/dox/Transpositions_8h_source.html)
programming_docs
eigen3 MetisSupport module MetisSupport module =================== ``` #include <Eigen/MetisSupport> ``` This module defines an interface to the METIS reordering package (<http://glaros.dtc.umn.edu/gkhome/views/metis>). It can be used just as any other built-in method as explained in [here.](group__orderingmethods__module) eigen3 Eigen::Map Eigen::Map ========== ### template<typename PlainObjectType, int MapOptions, typename StrideType> class Eigen::Map< PlainObjectType, MapOptions, StrideType > A matrix or vector expression mapping an existing array of data. Template Parameters | | | | --- | --- | | PlainObjectType | the equivalent matrix type of the mapped data | | MapOptions | specifies the pointer alignment in bytes. It can be: `[Aligned128](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a60057da2408e499b5656244d0b26cc20)`, `[Aligned64](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a2639cfa1e8faac751556bc0009fe95a4)`, `[Aligned32](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a8a380b1cd0c3e5a6cceac06f8235157a)`, `[Aligned16](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ad0b140cd97bc74365b51843d28379655)`, `[Aligned8](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a9d99d7a9ff1da5c949bec22733bfba14)` or `[Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686)`. The default is `[Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686)`. | | StrideType | optionally specifies strides. By default, [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") assumes the memory layout of an ordinary, contiguous array. This can be overridden by specifying strides. The type passed here must be a specialization of the [Stride](classeigen_1_1stride "Holds strides information for Map.") template, see examples below. | This class represents a matrix or vector expression mapping an existing array of data. It can be used to let [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") interface without any overhead with non-Eigen data structures, such as plain C arrays or structures from other libraries. By default, it assumes that the data is laid out contiguously in memory. You can however override this by explicitly specifying inner and outer strides. Here's an example of simply mapping a contiguous array as a [column-major](group__topicstorageorders) matrix: ``` int array[9]; for(int i = 0; i < 9; ++i) array[i] = i; cout << Map<Matrix3i>(array) << endl; ``` Output: ``` 0 3 6 1 4 7 2 5 8 ``` If you need to map non-contiguous arrays, you can do so by specifying strides: Here's an example of mapping an array as a vector, specifying an inner stride, that is, the pointer increment between two consecutive coefficients. Here, we're specifying the inner stride as a compile-time fixed value. ``` int array[12]; for(int i = 0; i < 12; ++i) array[i] = i; cout << Map<VectorXi, 0, InnerStride<2> > (array, 6) // the inner stride has already been passed as template parameter << endl; ``` Output: ``` 0 2 4 6 8 10 ``` Here's an example of mapping an array while specifying an outer stride. Here, since we're mapping as a column-major matrix, 'outer stride' means the pointer increment between two consecutive columns. Here, we're specifying the outer stride as a runtime parameter. Note that here `OuterStride<>` is a short version of `OuterStride<Dynamic>` because the default template parameter of [OuterStride](classeigen_1_1outerstride "Convenience specialization of Stride to specify only an outer stride See class Map for some examples.") is `Dynamic` ``` int array[12]; for(int i = 0; i < 12; ++i) array[i] = i; cout << Map<MatrixXi, 0, OuterStride<> >(array, 3, 3, OuterStride<>(4)) << endl; ``` Output: ``` 0 4 8 1 5 9 2 6 10 ``` For more details and for an example of specifying both an inner and an outer stride, see class [Stride](classeigen_1_1stride "Holds strides information for Map."). **Tip:** to change the array of data mapped by a [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") object, you can use the C++ placement new syntax: Example: ``` int data[] = {1,2,3,4,5,6,7,8,9}; Map<RowVectorXi> v(data,4); cout << "The mapped vector v is: " << v << "\n"; new (&v) Map<RowVectorXi>(data+4,5); cout << "Now v is: " << v << "\n"; ``` Output: ``` The mapped vector v is: 1 2 3 4 Now v is: 5 6 7 8 9 ``` This class is the return type of [PlainObjectBase::Map()](classeigen_1_1plainobjectbase#aaf9fcc07dc13f89cf71d4a4e2b220d24) but can also be used directly. See also [PlainObjectBase::Map()](classeigen_1_1plainobjectbase#aaf9fcc07dc13f89cf71d4a4e2b220d24), [Storage orders](group__topicstorageorders) | | | --- | | | | | [Map](classeigen_1_1map#a43b3e84aba2ff1a241dbc3d177fb2e22) (PointerArgType dataPtr, const StrideType &stride=StrideType()) | | | | | [Map](classeigen_1_1map#a3f621386d55a373f53082ac62579897e) (PointerArgType dataPtr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) cols, const StrideType &stride=StrideType()) | | | | | [Map](classeigen_1_1map#a52069afac76e3f609a6865106dc10254) (PointerArgType dataPtr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size, const StrideType &stride=StrideType()) | | | Map() [1/3] ----------- template<typename PlainObjectType , int MapOptions, typename StrideType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< PlainObjectType, MapOptions, StrideType >::[Map](classeigen_1_1map) | ( | PointerArgType | *dataPtr*, | | | | const StrideType & | *stride* = `StrideType()` | | | ) | | | | inlineexplicit | Constructor in the fixed-size case. Parameters | | | | --- | --- | | dataPtr | pointer to the array to map | | stride | optional [Stride](classeigen_1_1stride "Holds strides information for Map.") object, passing the strides. | Map() [2/3] ----------- template<typename PlainObjectType , int MapOptions, typename StrideType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< PlainObjectType, MapOptions, StrideType >::[Map](classeigen_1_1map) | ( | PointerArgType | *dataPtr*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *size*, | | | | const StrideType & | *stride* = `StrideType()` | | | ) | | | | inline | Constructor in the dynamic-size vector case. Parameters | | | | --- | --- | | dataPtr | pointer to the array to map | | size | the size of the vector expression | | stride | optional [Stride](classeigen_1_1stride "Holds strides information for Map.") object, passing the strides. | Map() [3/3] ----------- template<typename PlainObjectType , int MapOptions, typename StrideType > | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< PlainObjectType, MapOptions, StrideType >::[Map](classeigen_1_1map) | ( | PointerArgType | *dataPtr*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *cols*, | | | | const StrideType & | *stride* = `StrideType()` | | | ) | | | | inline | Constructor in the dynamic-size matrix case. Parameters | | | | --- | --- | | dataPtr | pointer to the array to map | | rows | the number of rows of the matrix expression | | cols | the number of columns of the matrix expression | | stride | optional [Stride](classeigen_1_1stride "Holds strides information for Map.") object, passing the strides. | --- The documentation for this class was generated from the following file:* [Map.h](https://eigen.tuxfamily.org/dox/Map_8h_source.html) eigen3 The Array class and coefficient-wise operations The Array class and coefficient-wise operations =============================================== This page aims to provide an overview and explanations on how to use [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class. What is the Array class? ========================== The [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class provides general-purpose arrays, as opposed to the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class which is intended for linear algebra. Furthermore, the [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class provides an easy way to perform coefficient-wise operations, which might not have a linear algebraic meaning, such as adding a constant to every coefficient in the array or multiplying two arrays coefficient-wise. Array types ============= [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") is a class template taking the same template parameters as [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). As with [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), the first three template parameters are mandatory: ``` Array<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime> ``` The last three template parameters are optional. Since this is exactly the same as for [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), we won't explain it again here and just refer to [The Matrix class](group__tutorialmatrixclass). [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") also provides typedefs for some common cases, in a way that is similar to the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") typedefs but with some slight differences, as the word "array" is used for both 1-dimensional and 2-dimensional arrays. We adopt the convention that typedefs of the form ArrayNt stand for 1-dimensional arrays, where N and t are the size and the scalar type, as in the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") typedefs explained on [this page](group__tutorialmatrixclass). For 2-dimensional arrays, we use typedefs of the form ArrayNNt. Some examples are shown in the following table: | Type | Typedef | | --- | --- | | ``` Array<float,Dynamic,1> ``` | ``` ArrayXf ``` | | ``` Array<float,3,1> ``` | ``` Array3f ``` | | ``` Array<double,Dynamic,Dynamic> ``` | ``` ArrayXXd ``` | | ``` Array<double,3,3> ``` | ``` Array33d ``` | Accessing values inside an Array ================================== The parenthesis operator is overloaded to provide write and read access to the coefficients of an array, just as with matrices. Furthermore, the `<<` operator can be used to initialize arrays (via the comma initializer) or to print them. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { ArrayXXf m(2,2); // assign some values coefficient by coefficient m(0,0) = 1.0; m(0,1) = 2.0; m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0); // print values to standard output cout << m << endl << endl; // using the comma-initializer is also allowed m << 1.0,2.0, 3.0,4.0; // print values to standard output cout << m << endl; } ``` | ``` 1 2 3 5 1 2 3 4 ``` | For more information about the comma initializer, see [Advanced initialization](group__tutorialadvancedinitialization). Addition and subtraction ========================== Adding and subtracting two arrays is the same as for matrices. The operation is valid if both arrays have the same size, and the addition or subtraction is done coefficient-wise. Arrays also support expressions of the form `array + scalar` which add a scalar to each coefficient in the array. This provides a functionality that is not directly available for [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") objects. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { ArrayXXf a(3,3); ArrayXXf b(3,3); a << 1,2,3, 4,5,6, 7,8,9; b << 1,2,3, 1,2,3, 1,2,3; // Adding two arrays cout << "a + b = " << endl << a + b << endl << endl; // Subtracting a scalar from an array cout << "a - 2 = " << endl << a - 2 << endl; } ``` | ``` a + b = 2 4 6 5 7 9 8 10 12 a - 2 = -1 0 1 2 3 4 5 6 7 ``` | Array multiplication ====================== First of all, of course you can multiply an array by a scalar, this works in the same way as matrices. Where arrays are fundamentally different from matrices, is when you multiply two together. Matrices interpret multiplication as matrix product and arrays interpret multiplication as coefficient-wise product. Thus, two arrays can be multiplied if and only if they have the same dimensions. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { ArrayXXf a(2,2); ArrayXXf b(2,2); a << 1,2, 3,4; b << 5,6, 7,8; cout << "a \* b = " << endl << a * b << endl; } ``` | ``` a * b = 5 12 21 32 ``` | Other coefficient-wise operations =================================== The [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class defines other coefficient-wise operations besides the addition, subtraction and multiplication operators described above. For example, the [.abs()](group__tutorialarrayclass) method takes the absolute value of each coefficient, while [.sqrt()](group__tutorialarrayclass) computes the square root of the coefficients. If you have two arrays of the same size, you can call [.min(.)](group__tutorialarrayclass) to construct the array whose coefficients are the minimum of the corresponding coefficients of the two given arrays. These operations are illustrated in the following example. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { ArrayXf a = [ArrayXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5); a *= 2; cout << "a =" << endl << a << endl; cout << "a.abs() =" << endl << a.abs() << endl; cout << "a.abs().sqrt() =" << endl << a.abs().sqrt() << endl; cout << "a.min(a.abs().sqrt()) =" << endl << a.min(a.abs().sqrt()) << endl; } ``` | ``` a = 1.36 -0.422 1.13 1.19 1.65 a.abs() = 1.36 0.422 1.13 1.19 1.65 a.abs().sqrt() = 1.17 0.65 1.06 1.09 1.28 a.min(a.abs().sqrt()) = 1.17 -0.422 1.06 1.09 1.28 ``` | More coefficient-wise operations can be found in the [Quick reference guide](group__quickrefpage). Converting between array and matrix expressions ================================================= When should you use objects of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class and when should you use objects of the [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class? You cannot apply [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") operations on arrays, or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") operations on matrices. Thus, if you need to do linear algebraic operations such as matrix multiplication, then you should use matrices; if you need to do coefficient-wise operations, then you should use arrays. However, sometimes it is not that simple, but you need to use both [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") operations. In that case, you need to convert a matrix to an array or reversely. This gives access to all operations regardless of the choice of declaring objects as arrays or as matrices. [Matrix expressions](classeigen_1_1matrixbase) have an [.array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) method that 'converts' them into [array expressions](classeigen_1_1arraybase), so that coefficient-wise operations can be applied easily. Conversely, [array expressions](classeigen_1_1arraybase) have a [.matrix()](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) method. As with all [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") expression abstractions, this doesn't have any runtime cost (provided that you let your compiler optimize). Both [.array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) and [.matrix()](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) can be used as rvalues and as lvalues. Mixing matrices and arrays in an expression is forbidden with [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). For instance, you cannot add a matrix and array directly; the operands of a `+` operator should either both be matrices or both be arrays. However, it is easy to convert from one to the other with [.array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) and [.matrix()](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c). The exception to this rule is the assignment operator: it is allowed to assign a matrix expression to an array variable, or to assign an array expression to a matrix variable. The following example shows how to use array operations on a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") object by employing the [.array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) method. For example, the statement `result = m.array() * n.array()` takes two matrices `m` and `n`, converts them both to an array, uses to multiply them coefficient-wise and assigns the result to the matrix variable `result` (this is legal because [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") allows assigning array expressions to matrix variables). As a matter of fact, this usage case is so common that [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") provides a [const .cwiseProduct(.)](group__tutorialarrayclass) method for matrices to compute the coefficient-wise product. This is also shown in the example program. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = m * n; cout << "-- Matrix m\*n: --" << endl << result << endl << endl; result = m.array() * n.array(); cout << "-- Array m\*n: --" << endl << result << endl << endl; result = m.cwiseProduct(n); cout << "-- With cwiseProduct: --" << endl << result << endl << endl; result = m.array() + 4; cout << "-- Array m + 4: --" << endl << result << endl << endl; } ``` | ``` -- Matrix m*n: -- 19 22 43 50 -- Array m*n: -- 5 12 21 32 -- With cwiseProduct: -- 5 12 21 32 -- Array m + 4: -- 5 6 7 8 ``` | Similarly, if `array1` and `array2` are arrays, then the expression `array1.matrix() * array2.matrix()` computes their matrix product. Here is a more advanced example. The expression `(m.array() + 4).matrix() * m` adds 4 to every coefficient in the matrix `m` and then computes the matrix product of the result with `m`. Similarly, the expression `(m.array() * n.array()).matrix() * m` computes the coefficient-wise product of the matrices `m` and `n` and then the matrix product of the result with `m`. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = (m.array() + 4).matrix() * m; cout << "-- Combination 1: --" << endl << result << endl << endl; result = (m.array() * n.array()).matrix() * m; cout << "-- Combination 2: --" << endl << result << endl << endl; } ``` | ``` -- Combination 1: -- 23 34 31 46 -- Combination 2: -- 41 58 117 170 ``` |
programming_docs
eigen3 Eigen::TriangularView Eigen::TriangularView ===================== ### template<typename \_MatrixType, unsigned int \_Mode> class Eigen::TriangularView< \_MatrixType, \_Mode > Expression of a triangular part in a matrix. Parameters | | | | --- | --- | | MatrixType | the type of the object in which we are taking the triangular part | | Mode | the kind of triangular matrix expression to construct. Can be [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1), [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749), [UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad), [UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda), [StrictlyUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda7b37877e0b9b0df28c9c2b669a633265), or [StrictlyLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2424988b6fca98be70b595632753ba81). This is in fact a bit field; it must have either [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1) or [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749), and additionally it may have [UnitDiag](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2ef430bff6cc12c2d1e0ef01b95f7ff3) or [ZeroDiag](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdac4dc554a61510151ddd5bafaf6040223) or neither. | This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular matrices one should speak of "trapezoid" parts. This class is the return type of MatrixBase::triangularView() and SparseMatrixBase::triangularView(), and most of the time this is the only way it is used. See also MatrixBase::triangularView() Inherits Eigen::TriangularViewImpl< \_MatrixType, \_Mode, internal::traits< \_MatrixType >::StorageKind >. | | | --- | | | | const [AdjointReturnType](classeigen_1_1triangularview) | [adjoint](classeigen_1_1triangularview#aaa336e1b759eea3050139bcdd55f8349) () const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [cols](classeigen_1_1triangularview#a12d7ac8a095cda817cd241f1aae2f8fb) () const EIGEN\_NOEXCEPT | | | | const [ConjugateReturnType](classeigen_1_1triangularview) | [conjugate](classeigen_1_1triangularview#a53c6a7764a6610f4955788f6134a8d78) () const | | | | template<bool Cond> | | internal::conditional< Cond, [ConjugateReturnType](classeigen_1_1triangularview), [ConstTriangularView](classeigen_1_1triangularview) >::type | [conjugateIf](classeigen_1_1triangularview#a3461c3e9ccb404c66291c298ec986af9) () const | | | | Scalar | [determinant](classeigen_1_1triangularview#ab8cd6bfc705c0c05a6755ae7437376f9) () const | | | | NestedExpression & | [nestedExpression](classeigen_1_1triangularview#a5877fec0b1cd3727d08218f9938abf96) () | | | | const NestedExpression & | [nestedExpression](classeigen_1_1triangularview#a02fdc4b367a9c83f7e2e706037558dd1) () const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [rows](classeigen_1_1triangularview#a324c2afde060bc028233e0ba81f4f24b) () const EIGEN\_NOEXCEPT | | | | [SelfAdjointView](classeigen_1_1selfadjointview)< MatrixTypeNestedNonRef, Mode > | [selfadjointView](classeigen_1_1triangularview#a408d1e6601f83ae8b7cd5edc8ad313a5) () | | | | const [SelfAdjointView](classeigen_1_1selfadjointview)< MatrixTypeNestedNonRef, Mode > | [selfadjointView](classeigen_1_1triangularview#a669d39567c1a2f805582c7538f2752b5) () const | | | | [TransposeReturnType](classeigen_1_1triangularview) | [transpose](classeigen_1_1triangularview#ac9efe6f446781eb1eb6e62d4a7707fd4) () | | | | const [ConstTransposeReturnType](classeigen_1_1triangularview) | [transpose](classeigen_1_1triangularview#aa45efa0f1d6f8c009b75a4f6fc00e063) () const | | | adjoint() --------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [AdjointReturnType](classeigen_1_1triangularview) [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::adjoint | ( | | ) | const | | inline | See also [MatrixBase::adjoint() const](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) cols() ------ template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::cols | ( | void | | ) | const | | inline | Returns the number of columns. See also [rows()](classeigen_1_1triangularview#a324c2afde060bc028233e0ba81f4f24b), ColsAtCompileTime conjugate() ----------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [ConjugateReturnType](classeigen_1_1triangularview) [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::conjugate | ( | void | | ) | const | | inline | See also MatrixBase::conjugate() const conjugateIf() ------------- template<typename \_MatrixType , unsigned int \_Mode> template<bool Cond> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::conditional<Cond,[ConjugateReturnType](classeigen_1_1triangularview),[ConstTriangularView](classeigen_1_1triangularview)>::type [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::conjugateIf | ( | | ) | const | | inline | Returns an expression of the complex conjugate of `*this` if Cond==true, returns `*this` otherwise. determinant() ------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::determinant | ( | | ) | const | | inline | Returns the determinant of the triangular matrix See also [MatrixBase::determinant()](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) nestedExpression() [1/2] ------------------------ template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | NestedExpression& [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::nestedExpression | ( | | ) | | | inline | Returns a reference to the nested expression nestedExpression() [2/2] ------------------------ template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const NestedExpression& [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::nestedExpression | ( | | ) | const | | inline | Returns a const reference to the nested expression rows() ------ template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::rows | ( | void | | ) | const | | inline | Returns the number of rows. See also [cols()](classeigen_1_1triangularview#a12d7ac8a095cda817cd241f1aae2f8fb), RowsAtCompileTime selfadjointView() [1/2] ----------------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [SelfAdjointView](classeigen_1_1selfadjointview)<MatrixTypeNestedNonRef,Mode> [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::selfadjointView | ( | | ) | | | inline | Returns a selfadjoint view of the referenced triangular part which must be either `[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)` or `[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)`. This is a shortcut for ``` this->[nestedExpression](classeigen_1_1triangularview#a02fdc4b367a9c83f7e2e706037558dd1)().selfadjointView<(*this)::Mode>() ``` See also MatrixBase::selfadjointView() selfadjointView() [2/2] ----------------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [SelfAdjointView](classeigen_1_1selfadjointview)<MatrixTypeNestedNonRef,Mode> [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::selfadjointView | ( | | ) | const | | inline | This is the const version of [selfadjointView()](classeigen_1_1triangularview#a408d1e6601f83ae8b7cd5edc8ad313a5) transpose() [1/2] ----------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [TransposeReturnType](classeigen_1_1triangularview) [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::transpose | ( | | ) | | | inline | See also [MatrixBase::transpose()](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) transpose() [2/2] ----------------- template<typename \_MatrixType , unsigned int \_Mode> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [ConstTransposeReturnType](classeigen_1_1triangularview) [Eigen::TriangularView](classeigen_1_1triangularview)< \_MatrixType, \_Mode >::transpose | ( | | ) | const | | inline | See also [MatrixBase::transpose() const](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) --- The documentation for this class was generated from the following file:* [TriangularMatrix.h](https://eigen.tuxfamily.org/dox/TriangularMatrix_8h_source.html) eigen3 PaStiXSupport module PaStiXSupport module ==================== This module provides an interface to the [PaSTiX](http://pastix.gforge.inria.fr/) library. PaSTiX is a general **supernodal**, **parallel** and **opensource** sparse solver. It provides the two following main factorization classes: * class PastixLLT : a supernodal, parallel LLt Cholesky factorization. * class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. * class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). ``` #include <Eigen/PaStiXSupport> ``` In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. This wrapper resuires PaStiX version 5.x compiled without MPI support. The dependencies depend on how PaSTiX has been compiled. For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. | | | --- | | | | class | [Eigen::PastixLDLT< \_MatrixType, \_UpLo >](classeigen_1_1pastixldlt) | | | A sparse direct supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PaStiX library. [More...](classeigen_1_1pastixldlt#details) | | | | class | [Eigen::PastixLLT< \_MatrixType, \_UpLo >](classeigen_1_1pastixllt) | | | A sparse direct supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PaStiX library. [More...](classeigen_1_1pastixllt#details) | | | | class | [Eigen::PastixLU< \_MatrixType, IsStrSym >](classeigen_1_1pastixlu) | | | Interface to the PaStix solver. [More...](classeigen_1_1pastixlu#details) | | | eigen3 Eigen::MetisOrdering Eigen::MetisOrdering ==================== ### template<typename StorageIndex> class Eigen::MetisOrdering< StorageIndex > Get the fill-reducing ordering from the METIS package If A is the original matrix and Ap is the permuted matrix, the fill-reducing permutation is defined as follows : Row (column) i of A is the matperm(i) row (column) of Ap. WARNING: As computed by METIS, this corresponds to the vector iperm (instead of perm) --- The documentation for this class was generated from the following file:* [MetisSupport.h](https://eigen.tuxfamily.org/dox/MetisSupport_8h_source.html) eigen3 Eigen::UmfPackLU Eigen::UmfPackLU ================ ### template<typename \_MatrixType> class Eigen::UmfPackLU< \_MatrixType > A sparse LU factorization and solver based on UmfPack. This class allows to solve for A.X = B sparse linear problems via a LU factorization using the UmfPack library. The sparse matrix A must be squared and full rank. The vectors or matrices X and B can be either dense or sparse. Warning The input matrix A should be in a **compressed** and **column-major** form. Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") | | | --- | | | | template<typename InputMatrixType > | | void | [analyzePattern](classeigen_1_1umfpacklu#ac7ea28b2017d6b26b7b08497f294e5e6) (const InputMatrixType &matrix) | | | | template<typename InputMatrixType > | | void | [compute](classeigen_1_1umfpacklu#a05fb2b5717ebd67e46b83439721ceee7) (const InputMatrixType &matrix) | | | | template<typename InputMatrixType > | | void | [factorize](classeigen_1_1umfpacklu#a1471bf890503e743c45d75cc02a5345d) (const InputMatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1umfpacklu#a68738a0d99c67316877706f98b033402) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1umfpacklu#a68738a0d99c67316877706f98b033402) | | | | void | [printUmfpackControl](classeigen_1_1umfpacklu#a1e3543c0e6ae499e3d25f5a8a8f50623) () | | | | void | [printUmfpackInfo](classeigen_1_1umfpacklu#a9b42dd0135fc9bcffec37f043022f135) () | | | | void | [printUmfpackStatus](classeigen_1_1umfpacklu#aea06a54a1e4e8fc1ec522103825cc7b6) () | | | | [UmfpackControl](classeigen_1_1array) & | [umfpackControl](classeigen_1_1umfpacklu#a679bd267a0407d4ca985d97f0b864101) () | | | | const [UmfpackControl](classeigen_1_1array) & | [umfpackControl](classeigen_1_1umfpacklu#ae83d178202f3d44c1789c1c93842bf2e) () const | | | | int | [umfpackFactorizeReturncode](classeigen_1_1umfpacklu#a822fa9d82754269c379dc4ce17920b0a) () const | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< UmfPackLU< \_MatrixType > >](classeigen_1_1sparsesolverbase) | | const [Solve](classeigen_1_1solve)< [UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | const [Solve](classeigen_1_1solve)< [UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | analyzePattern() ---------------- template<typename \_MatrixType > template<typename InputMatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::analyzePattern | ( | const InputMatrixType & | *matrix* | ) | | | inline | Performs a symbolic decomposition on the sparcity of *matrix*. This function is particularly useful when solving for several problems having the same structure. See also [factorize()](classeigen_1_1umfpacklu#a1471bf890503e743c45d75cc02a5345d), [compute()](classeigen_1_1umfpacklu#a05fb2b5717ebd67e46b83439721ceee7) compute() --------- template<typename \_MatrixType > template<typename InputMatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::compute | ( | const InputMatrixType & | *matrix* | ) | | | inline | Computes the sparse Cholesky decomposition of *matrix* Note that the matrix should be column-major, and in compressed format for best performance. See also [SparseMatrix::makeCompressed()](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd). factorize() ----------- template<typename \_MatrixType > template<typename InputMatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::factorize | ( | const InputMatrixType & | *matrix* | ) | | | inline | Performs a numeric decomposition of *matrix* The given matrix must has the same sparcity than the matrix on which the pattern anylysis has been performed. See also [analyzePattern()](classeigen_1_1umfpacklu#ac7ea28b2017d6b26b7b08497f294e5e6), [compute()](classeigen_1_1umfpacklu#a05fb2b5717ebd67e46b83439721ceee7) info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NumericalIssue` if the matrix.appears to be negative. printUmfpackControl() --------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::printUmfpackControl | ( | | ) | | | inline | Prints the current UmfPack control settings. See also [umfpackControl()](classeigen_1_1umfpacklu#a679bd267a0407d4ca985d97f0b864101) printUmfpackInfo() ------------------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::printUmfpackInfo | ( | | ) | | | inline | Prints statistics collected by UmfPack. See also [analyzePattern()](classeigen_1_1umfpacklu#ac7ea28b2017d6b26b7b08497f294e5e6), [compute()](classeigen_1_1umfpacklu#a05fb2b5717ebd67e46b83439721ceee7) printUmfpackStatus() -------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::printUmfpackStatus | ( | | ) | | | inline | Prints the status of the previous factorization operation performed by UmfPack (symbolic or numerical factorization). See also [analyzePattern()](classeigen_1_1umfpacklu#ac7ea28b2017d6b26b7b08497f294e5e6), [compute()](classeigen_1_1umfpacklu#a05fb2b5717ebd67e46b83439721ceee7) umfpackControl() [1/2] ---------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [UmfpackControl](classeigen_1_1array)& [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::umfpackControl | ( | | ) | | | inline | Provides access to the control settings array used by UmfPack. If this array contains NaN's, the default values are used. See UMFPACK documentation for details. umfpackControl() [2/2] ---------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [UmfpackControl](classeigen_1_1array)& [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::umfpackControl | ( | | ) | const | | inline | Provides access to the control settings array used by UmfPack. If this array contains NaN's, the default values are used. See UMFPACK documentation for details. umfpackFactorizeReturncode() ---------------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | int [Eigen::UmfPackLU](classeigen_1_1umfpacklu)< \_MatrixType >::umfpackFactorizeReturncode | ( | | ) | const | | inline | Provides the return status code returned by UmfPack during the numeric factorization. See also [factorize()](classeigen_1_1umfpacklu#a1471bf890503e743c45d75cc02a5345d), [compute()](classeigen_1_1umfpacklu#a05fb2b5717ebd67e46b83439721ceee7) --- The documentation for this class was generated from the following file:* [UmfPackSupport.h](https://eigen.tuxfamily.org/dox/UmfPackSupport_8h_source.html)
programming_docs
eigen3 Using BLAS/LAPACK from Eigen Using BLAS/LAPACK from Eigen ============================ Since Eigen version 3.3 and later, any F77 compatible BLAS or LAPACK libraries can be used as backends for dense matrix products and dense matrix decompositions. For instance, one can use [Intel® MKL](http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php), Apple's Accelerate framework on OSX, [OpenBLAS](http://www.openblas.net/), [Netlib LAPACK](http://www.netlib.org/lapack), etc. Do not miss this [page](topicusingintelmkl) for further discussions on the specific use of Intel® MKL (also includes VML, PARDISO, etc.) In order to use an external BLAS and/or LAPACK library, you must link you own application to the respective libraries and their dependencies. For LAPACK, you must also link to the standard [Lapacke](http://www.netlib.org/lapack/lapacke.html) library, which is used as a convenient think layer between Eigen's C++ code and LAPACK F77 interface. Then you must activate their usage by defining one or multiple of the following macros (**before** including any Eigen's header): Note For Mac users, in order to use the lapack version shipped with the Accelerate framework, you also need the lapacke library. Using [MacPorts](https://www.macports.org/), this is as easy as: ``` sudo port install lapack ``` and then use the following link flags: `-framework` `Accelerate` `/opt/local/lib/lapack/liblapacke`.dylib | | | | --- | --- | | `EIGEN_USE_BLAS` | Enables the use of external BLAS level 2 and 3 routines (compatible with any F77 BLAS interface) | | `EIGEN_USE_LAPACKE` | Enables the use of external Lapack routines via the [Lapacke](http://www.netlib.org/lapack/lapacke.html) C interface to Lapack (compatible with any F77 LAPACK interface) | | `EIGEN_USE_LAPACKE_STRICT` | Same as `EIGEN_USE_LAPACKE` but algorithms of lower numerical robustness are disabled. This currently concerns only [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") which otherwise would be replaced by `gesvd` that is less robust than Jacobi rotations. | When doing so, a number of Eigen's algorithms are silently substituted with calls to BLAS or LAPACK routines. These substitutions apply only for **Dynamic** **or** **large** enough objects with one of the following four standard scalar types: `float`, `double`, `complex<float>`, and `complex<double>`. Operations on other scalar types or mixing reals and complexes will continue to use the built-in algorithms. The breadth of Eigen functionality that can be substituted is listed in the table below. | Functional domain | Code example | BLAS/LAPACK routines | | --- | --- | --- | | Matrix-matrix operations `EIGEN_USE_BLAS` | ``` m1*m2.transpose(); m1.selfadjointView<[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>()*m2; m1*m2.triangularView<[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>(); m1.selfadjointView<[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>().rankUpdate(m2,1.0); ``` | ``` ?gemm ?symm/?hemm ?trmm dsyrk/ssyrk ``` | | Matrix-vector operations `EIGEN_USE_BLAS` | ``` m1.adjoint()*b; m1.selfadjointView<[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>()*b; m1.triangularView<[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>()*b; ``` | ``` ?gemv ?symv/?hemv ?trmv ``` | | LU decomposition `EIGEN_USE_LAPACKE` `EIGEN_USE_LAPACKE_STRICT` | ``` v1 = m1.lu().solve(v2); ``` | ``` ?getrf ``` | | Cholesky decomposition `EIGEN_USE_LAPACKE` `EIGEN_USE_LAPACKE_STRICT` | ``` v1 = m2.selfadjointView<[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().llt().solve(v2); ``` | ``` ?potrf ``` | | QR decomposition `EIGEN_USE_LAPACKE` `EIGEN_USE_LAPACKE_STRICT` | ``` m1.householderQr(); m1.colPivHouseholderQr(); ``` | ``` ?geqrf ?geqp3 ``` | | Singular value decomposition `EIGEN_USE_LAPACKE` | ``` JacobiSVD<MatrixXd> svd; svd.compute(m1, [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47)); ``` | ``` ?gesvd ``` | | Eigen-value decompositions `EIGEN_USE_LAPACKE` `EIGEN_USE_LAPACKE_STRICT` | ``` EigenSolver<MatrixXd> es(m1); ComplexEigenSolver<MatrixXcd> ces(m1); SelfAdjointEigenSolver<MatrixXd> saes(m1+m1.transpose()); GeneralizedSelfAdjointEigenSolver<MatrixXd> gsaes(m1+m1.transpose(),m2+m2.transpose()); ``` | ``` ?gees ?gees ?syev/?heev ?syev/?heev, ?potrf ``` | | Schur decomposition `EIGEN_USE_LAPACKE` `EIGEN_USE_LAPACKE_STRICT` | ``` RealSchur<MatrixXd> schurR(m1); ComplexSchur<MatrixXcd> schurC(m1); ``` | ``` ?gees ``` | In the examples, m1 and m2 are dense matrices and v1 and v2 are dense vectors. eigen3 Space transformations Space transformations ===================== In this page, we will introduce the many possibilities offered by the [geometry module](group__geometry__module) to deal with 2D and 3D rotations and projective or affine transformations. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s Geometry module provides two different kinds of geometric transformations: * Abstract transformations, such as rotations (represented by [angle and axis](classeigen_1_1angleaxis) or by a [quaternion](classeigen_1_1quaternion)), [translations](classeigen_1_1translation), [scalings](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b). These transformations are NOT represented as matrices, but you can nevertheless mix them with matrices and vectors in expressions, and convert them to matrices if you wish. * Projective or affine transformation matrices: see the [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") class. These are really matrices. Note If you are working with OpenGL 4x4 matrices then Affine3f and Affine3d are what you want. Since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") defaults to column-major storage, you can directly use the [Transform::data()](classeigen_1_1transform#aefd183e4e0ca89c39b78d5ad7cf3e014) method to pass your transformation matrix to OpenGL. You can construct a [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") from an abstract transformation, like this: ``` Transform t(AngleAxis(angle,axis)); ``` or like this: ``` Transform t; t = AngleAxis(angle,axis); ``` But note that unfortunately, because of how C++ works, you can **not** do this: ``` Transform t = AngleAxis(angle,axis); ``` **Explanation:** In the C++ language, this would require [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") to have a non-explicit conversion constructor from [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis."), but we really don't want to allow implicit casting here. Transformation types ====================== | Transformation type | Typical initialization code | | --- | --- | | [2D rotation](classeigen_1_1rotation2d) from an angle | ``` Rotation2D<float> rot2(angle_in_radian); ``` | | 3D rotation as an [angle + axis](classeigen_1_1angleaxis) | ``` AngleAxis<float> aa(angle_in_radian, Vector3f(ax,ay,az)); ``` The axis vector must be normalized. | | 3D rotation as a [quaternion](classeigen_1_1quaternion) | ``` Quaternion<float> q; q = AngleAxis<float>(angle_in_radian, axis); ``` | | N-D Scaling | ``` [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(sx, sy) [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(sx, sy, sz) [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(s) [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(vecN) ``` | | N-D [Translation](classeigen_1_1translation "Represents a translation transformation.") | ``` Translation<float,2>(tx, ty) Translation<float,3>(tx, ty, tz) Translation<float,N>(s) Translation<float,N>(vecN) ``` | | N-D [Affine transformation](group__tutorialgeometry#TutorialGeoTransform) | ``` Transform<float,N,Affine> t = concatenation_of_any_transformations; Transform<float,3,Affine> t = Translation3f(p) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(a,axis) * [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(s); ``` | | N-D Linear transformations *(pure rotations, scaling, etc.)* | ``` Matrix<float,N> t = concatenation_of_rotations_and_scalings; Matrix<float,2> t = [Rotation2Df](group__geometry__module#ga35e2cace3ada497794734edb8bc33b6e)(a) * [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(s); Matrix<float,3> t = [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(a,axis) * [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(s); ``` | **Notes on rotations** To transform more than a single vector the preferred representations are rotation matrices, while for other usages [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") is the representation of choice as they are compact, fast and stable. Finally [Rotation2D](classeigen_1_1rotation2d "Represents a rotation/orientation in a 2 dimensional space.") and [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.") are mainly convenient types to create other rotation objects. **Notes on [Translation](classeigen_1_1translation "Represents a translation transformation.") and Scaling** Like [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis."), these classes were designed to simplify the creation/initialization of linear ([Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")) and affine ([Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.")) transformations. Nevertheless, unlike [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.") which is inefficient to use, these classes might still be interesting to write generic and efficient algorithms taking as input any kind of transformations. Any of the above transformation types can be converted to any other types of the same nature, or to a more generic type. Here are some additional examples: | | | --- | | ``` [Rotation2Df](group__geometry__module#ga35e2cace3ada497794734edb8bc33b6e) r; r = Matrix2f(..); // assumes a pure rotation matrix [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf) aa; aa = [Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b)(..); [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf) aa; aa = Matrix3f(..); // assumes a pure rotation matrix Matrix2f m; m = [Rotation2Df](group__geometry__module#ga35e2cace3ada497794734edb8bc33b6e)(..); Matrix3f m; m = [Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b)(..); Matrix3f m; m = [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(..); Affine3f m; m = AngleAxis3f(..); Affine3f m; m = [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(..); Affine3f m; m = Translation3f(..); Affine3f m; m = Matrix3f(..); ``` | Common API across transformation types ======================================== To some extent, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s [geometry module](group__geometry__module) allows you to write generic algorithms working on any kind of transformation representations: | | | | --- | --- | | Concatenation of two transformations | ``` gen1 * gen2; ``` | | Apply the transformation to a vector | ``` vec2 = gen1 * vec1; ``` | | Get the inverse of the transformation | ``` gen2 = gen1.inverse(); ``` | | Spherical interpolation ([Rotation2D](classeigen_1_1rotation2d "Represents a rotation/orientation in a 2 dimensional space.") and [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") only) | ``` rot3 = rot1.slerp(alpha,rot2); ``` | Affine transformations ======================== Generic affine transformations are represented by the [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") class which internally is a (Dim+1)^2 matrix. In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") we have chosen to not distinghish between points and vectors such that all points are actually represented by displacement vectors from the origin ( \( \mathbf{p} \equiv \mathbf{p}-0 \) ). With that in mind, real points and vector distinguish when the transformation is applied. | | | | --- | --- | | Apply the transformation to a **point** | ``` VectorNf p1, p2; p2 = t * p1; ``` | | Apply the transformation to a **vector** | ``` VectorNf vec1, vec2; vec2 = t.linear() * vec1; ``` | | Apply a *general* transformation to a **normal** **vector** | ``` VectorNf n1, n2; MatrixNf normalMatrix = t.linear().inverse().transpose(); n2 = (normalMatrix * n1).normalized(); ``` | | (See subject 5.27 of this [faq](http://www.faqs.org/faqs/graphics/algorithms-faq) for the explanations) | | Apply a transformation with *pure* *rotation* to a **normal** **vector** (no scaling, no shear) | ``` n2 = t.linear() * n1; ``` | | OpenGL compatibility **3D** | ``` glLoadMatrixf(t.data()); ``` | | OpenGL compatibility **2D** | ``` Affine3f aux([Affine3f::Identity](classeigen_1_1transform#a5897c4cba8d6d19ea8711496fe75836f)()); aux.linear().topLeftCorner<2,2>() = t.linear(); aux.translation().start<2>() = t.translation(); glLoadMatrixf(aux.data()); ``` | **Component** **accessors** | | | | --- | --- | | full read-write access to the internal matrix | ``` t.matrix() = matN1xN1; // N1 means N+1 matN1xN1 = t.matrix(); ``` | | coefficient accessors | ``` t(i,j) = scalar; <=> t.matrix()(i,j) = scalar; scalar = t(i,j); <=> scalar = t.matrix()(i,j); ``` | | translation part | ``` t.translation() = vecN; vecN = t.translation(); ``` | | linear part | ``` t.linear() = matNxN; matNxN = t.linear(); ``` | | extract the rotation matrix | ``` matNxN = t.rotation(); ``` | **Transformation** **creation** While transformation objects can be created and updated concatenating elementary transformations, the [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") class also features a procedural API: | | procedural API | equivalent natural API | | --- | --- | --- | | [Translation](classeigen_1_1translation "Represents a translation transformation.") | ``` t.translate(Vector_(tx,ty,..)); t.pretranslate(Vector_(tx,ty,..)); ``` | ``` t *= Translation_(tx,ty,..); t = Translation_(tx,ty,..) * t; ``` | | **Rotation** *In 2D and for the procedural API, any\_rotation can also be an angle in radian* | ``` t.rotate(any_rotation); t.prerotate(any_rotation); ``` | ``` t *= any_rotation; t = any_rotation * t; ``` | | Scaling | ``` t.scale(Vector_(sx,sy,..)); t.scale(s); t.prescale(Vector_(sx,sy,..)); t.prescale(s); ``` | ``` t *= [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(sx,sy,..); t *= [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(s); t = [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(sx,sy,..) * t; t = [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(s) * t; ``` | | Shear transformation ( **2D** **only** ! ) | ``` t.shear(sx,sy); t.preshear(sx,sy); ``` | | Note that in both API, any many transformations can be concatenated in a single expression as shown in the two following equivalent examples: | | | --- | | ``` t.pretranslate(..).rotate(..).translate(..).scale(..); ``` | | ``` t = Translation_(..) * t * RotationType(..) * Translation_(..) * [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b)(..); ``` | Euler angles ============== | | | | --- | --- | | Euler angles might be convenient to create rotation objects. On the other hand, since there exist 24 different conventions, they are pretty confusing to use. This example shows how to create a rotation matrix according to the 2-1-2 convention. | ``` Matrix3f m; m = [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(angle1, [Vector3f::UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0)()) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(angle2, [Vector3f::UnitY](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc)()) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(angle3, [Vector3f::UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0)()); ``` | eigen3 Eigen::Ref Eigen::Ref ========== ### template<typename PlainObjectType, int Options, typename StrideType> class Eigen::Ref< PlainObjectType, Options, StrideType > A matrix or vector expression mapping an existing expression. Template Parameters | | | | --- | --- | | PlainObjectType | the equivalent matrix type of the mapped data | | Options | specifies the pointer alignment in bytes. It can be: `[Aligned128](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a60057da2408e499b5656244d0b26cc20)`, , `[Aligned64](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a2639cfa1e8faac751556bc0009fe95a4)`, `[Aligned32](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a8a380b1cd0c3e5a6cceac06f8235157a)`, `[Aligned16](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ad0b140cd97bc74365b51843d28379655)`, `[Aligned8](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a9d99d7a9ff1da5c949bec22733bfba14)` or `[Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686)`. The default is `[Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686)`. | | StrideType | optionally specifies strides. By default, [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") implies a contiguous storage along the inner dimension (inner stride==1), but accepts a variable outer stride (leading dimension). This can be overridden by specifying strides. The type passed here must be a specialization of the [Stride](classeigen_1_1stride "Holds strides information for Map.") template, see examples below. | This class provides a way to write non-template functions taking [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") objects as parameters while limiting the number of copies. A Ref<> object can represent either a const expression or a l-value: ``` // in-out argument: void foo1(Ref<VectorXf> x); // read-only const argument: void foo2(const Ref<const VectorXf>& x); ``` In the in-out case, the input argument must satisfy the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. By default, a Ref<VectorXf> can reference any dense vector expression of float having a contiguous memory layout. Likewise, a Ref<MatrixXf> can reference any column-major dense matrix expression of float whose column's elements are contiguously stored with the possibility to have a constant space in-between each column, i.e. the inner stride must be equal to 1, but the outer stride (or leading dimension) can be greater than the number of rows. In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. Here are some examples: ``` MatrixXf A; VectorXf a; foo1(a.head()); // OK foo1(A.col()); // OK foo1(A.row()); // Compilation error because here innerstride!=1 foo2(A.row()); // Compilation error because A.row() is a 1xN object while foo2 is expecting a Nx1 object foo2(A.row().transpose()); // The row is copied into a contiguous temporary foo2(2*a); // The expression is evaluated into a temporary foo2(A.col().segment(2,4)); // No temporary ``` The range of inputs that can be referenced without temporary can be enlarged using the last two template parameters. Here is an example accepting an innerstride!=1: ``` // in-out argument: void foo3(Ref<VectorXf,0,InnerStride<> > x); foo3(A.row()); // OK ``` The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involve more expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overload internally calling a template function, e.g.: ``` // in the .h: void foo(const Ref<MatrixXf>& A); void foo(const Ref<MatrixXf,0,Stride<> >& A); // in the .cpp: template<typename TypeOfA> void foo_impl(const TypeOfA& A) { ... // crazy code goes here } void foo(const Ref<MatrixXf>& A) { foo_impl(A); } void foo(const Ref<MatrixXf,0,Stride<> >& A) { foo_impl(A); } ``` See also the following stackoverflow questions for further references: * [Correct usage of the Eigen::Ref<> class](http://stackoverflow.com/questions/21132538/correct-usage-of-the-eigenref-class) See also [PlainObjectBase::Map()](classeigen_1_1plainobjectbase#aaf9fcc07dc13f89cf71d4a4e2b220d24), [Storage orders](group__topicstorageorders) Inherits Eigen::RefBase< Derived >. | | | --- | | | | template<typename Derived > | | | [Ref](classeigen_1_1ref#a037addaa81f13e5765e30a92d2c4f2b1) ([DenseBase](classeigen_1_1densebase)< Derived > &expr) | | | Ref() ----- template<typename PlainObjectType , int Options, typename StrideType > template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Ref](classeigen_1_1ref)< PlainObjectType, Options, StrideType >::[Ref](classeigen_1_1ref) | ( | [DenseBase](classeigen_1_1densebase)< Derived > & | *expr* | ) | | | inline | Implicit constructor from any dense expression --- The documentation for this class was generated from the following file:* [Ref.h](https://eigen.tuxfamily.org/dox/Ref_8h_source.html)
programming_docs
eigen3 Eigen::CwiseUnaryView Eigen::CwiseUnaryView ===================== ### template<typename ViewOp, typename MatrixType> class Eigen::CwiseUnaryView< ViewOp, MatrixType > Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector. Template Parameters | | | | --- | --- | | ViewOp | template functor implementing the view | | MatrixType | the type of the matrix we are applying the unary operator | This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. It is the return type of [real()](namespaceeigen#ac74dc920119b1eba45e9218d9f402afc) and [imag()](namespaceeigen#a04d60a3c8a266f63c08e03615c1985c9), and most of the time this is the only way it is used. See also MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") Inherits Eigen::CwiseUnaryViewImpl< ViewOp, MatrixType, internal::traits< MatrixType >::StorageKind >. | | | --- | | | | const ViewOp & | [functor](classeigen_1_1cwiseunaryview#af01271cdadcbcf195b5d3130ff2e1a48) () const | | | | internal::remove\_reference< MatrixTypeNested >::type & | [nestedExpression](classeigen_1_1cwiseunaryview#add6689b53e595e968e89592ea30b6800) () | | | | const internal::remove\_all< MatrixTypeNested >::type & | [nestedExpression](classeigen_1_1cwiseunaryview#a21d59e387e600b1d650cb002175760b4) () const | | | functor() --------- template<typename ViewOp , typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const ViewOp& [Eigen::CwiseUnaryView](classeigen_1_1cwiseunaryview)< ViewOp, MatrixType >::functor | ( | | ) | const | | inline | Returns the functor representing unary operation nestedExpression() [1/2] ------------------------ template<typename ViewOp , typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::remove\_reference<MatrixTypeNested>::type& [Eigen::CwiseUnaryView](classeigen_1_1cwiseunaryview)< ViewOp, MatrixType >::nestedExpression | ( | | ) | | | inline | Returns the nested expression nestedExpression() [2/2] ------------------------ template<typename ViewOp , typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::remove\_all<MatrixTypeNested>::type& [Eigen::CwiseUnaryView](classeigen_1_1cwiseunaryview)< ViewOp, MatrixType >::nestedExpression | ( | | ) | const | | inline | Returns the nested expression --- The documentation for this class was generated from the following file:* [CwiseUnaryView.h](https://eigen.tuxfamily.org/dox/CwiseUnaryView_8h_source.html) eigen3 Eigen::Matrix Eigen::Matrix ============= ### template<typename \_Scalar, int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> class Eigen::Matrix< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > The matrix class, also used for vectors and row-vectors. The Matrix class is the work-horse for all *dense* ([note](classeigen_1_1matrix#dense)) matrices and vectors within [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). Vectors are matrices with one column, and row-vectors are matrices with one row. The Matrix class encompasses *both* fixed-size and dynamic-size objects ([note](classeigen_1_1matrix#fixedsize)). The first three template parameters are required: Template Parameters | | | | --- | --- | | \_Scalar | Numeric type, e.g. float, double, int or std::complex<float>. User defined scalar types are supported as well (see [here](topiccustomizing_customscalar#user_defined_scalars)). | | \_Rows | Number of rows, or **Dynamic** | | \_Cols | Number of columns, or **Dynamic** | The remaining template parameters are optional – in most cases you don't have to worry about them. Template Parameters | | | | --- | --- | | \_Options | A combination of either **[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f)** or **[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)**, and of either **[AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)** or **[DontAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a56908522e51443a0aa0567f879c2e78a)**. The former controls [storage order](group__topicstorageorders), and defaults to column-major. The latter controls alignment, which is required for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. | | \_MaxRows | Maximum number of rows. Defaults to *\_Rows* ([note](classeigen_1_1matrix#maxrows)). | | \_MaxCols | Maximum number of columns. Defaults to *\_Cols* ([note](classeigen_1_1matrix#maxrows)). | [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") provides a number of typedefs covering the usual cases. Here are some examples: * `Matrix2d` is a 2x2 square matrix of doubles (`Matrix<double, 2, 2>`) * `Vector4f` is a vector of 4 floats (`Matrix<float, 4, 1>`) * `RowVector3i` is a row-vector of 3 ints (`Matrix<int, 1, 3>`) * `MatrixXf` is a dynamic-size matrix of floats (`Matrix<float, Dynamic, Dynamic>`) * `VectorXf` is a dynamic-size vector of floats (`Matrix<float, Dynamic, 1>`) * `Matrix2Xf` is a partially fixed-size (dynamic-size) matrix of floats (`Matrix<float, 2, Dynamic>`) * `MatrixX3d` is a partially dynamic-size (fixed-size) matrix of double (`Matrix<double, Dynamic, 3>`) See [this page](group__matrixtypedefs) for a complete list of predefined *Matrix* and *Vector* typedefs. You can access elements of vectors and matrices using normal subscripting: ``` [Eigen::VectorXd](classeigen_1_1matrix) v(10); v[0] = 0.1; v[1] = 0.2; v(0) = 0.3; v(1) = 0.4; [Eigen::MatrixXi](classeigen_1_1matrix) m(10, 10); m(0, 1) = 1; m(0, 2) = 2; m(0, 3) = 3; ``` This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_MATRIX_PLUGIN`. ***Some notes:*** **[Dense](structeigen_1_1dense) versus sparse:** This Matrix class handles dense, not sparse matrices and vectors. For sparse matrices and vectors, see the [Sparse](structeigen_1_1sparse) module. [Dense](structeigen_1_1dense) matrices and vectors are plain usual arrays of coefficients. All the coefficients are stored, in an ordinary contiguous array. This is unlike [Sparse](structeigen_1_1sparse) matrices and vectors where the coefficients are stored as a list of nonzero coefficients. **Fixed-size versus dynamic-size:** Fixed-size means that the numbers of rows and columns are known are compile-time. In this case, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") allocates the array of coefficients as a fixed-size array, as a class member. This makes sense for very small matrices, typically up to 4x4, sometimes up to 16x16. Larger matrices should be declared as dynamic-size even if one happens to know their size at compile-time. Dynamic-size means that the numbers of rows or columns are not necessarily known at compile-time. In this case they are runtime variables, and the array of coefficients is allocated dynamically on the heap. Note that *dense* matrices, be they Fixed-size or Dynamic-size, *do not* expand dynamically in the sense of a std::map. If you want this behavior, see the [Sparse](structeigen_1_1sparse) module. **\_MaxRows and \_MaxCols:** In most cases, one just leaves these parameters to the default values. These parameters mean the maximum size of rows and columns that the matrix may have. They are useful in cases when the exact numbers of rows and columns are not known are compile-time, but it is known at compile-time that they cannot exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case \_MaxRows and \_MaxCols are the dimensions of the original matrix, while \_Rows and \_Cols are Dynamic. ***ABI and storage layout*** The table below summarizes the ABI of some possible [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") instances which is fixed thorough the lifetime of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3. | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") type | Equivalent C structure | | --- | --- | | ``` Matrix<T,Dynamic,Dynamic> ``` | ``` struct { T *[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116); // with (size\_t(data)%EIGEN\_MAX\_ALIGN\_BYTES)==0 [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, cols; }; ``` | | ``` Matrix<T,Dynamic,1> Matrix<T,1,Dynamic> ``` | ``` struct { T *[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116); // with (size\_t(data)%EIGEN\_MAX\_ALIGN\_BYTES)==0 [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9); }; ``` | | ``` Matrix<T,Rows,Cols> ``` | ``` struct { T [data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)[Rows*Cols]; // with (size\_t(data)%A(Rows\*Cols\*sizeof(T)))==0 }; ``` | | ``` Matrix<T,Dynamic,Dynamic,0,MaxRows,MaxCols> ``` | ``` struct { T [data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)[MaxRows*MaxCols]; // with (size\_t(data)%A(MaxRows\*MaxCols\*sizeof(T)))==0 [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rows, cols; }; ``` | Note that in this table Rows, Cols, MaxRows and MaxCols are all positive integers. A(S) is defined to the largest possible power-of-two smaller to EIGEN\_MAX\_STATIC\_ALIGN\_BYTES. See also [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") for the majority of the API methods for matrices, [The class hierarchy](topicclasshierarchy), [Storage orders](group__topicstorageorders) | | | --- | | | | typedef [PlainObjectBase](classeigen_1_1plainobjectbase)< [Matrix](classeigen_1_1matrix) > | [Base](classeigen_1_1matrix#a9f405923954599ec7a71ee6bad2c53f1) | | | Base class typedef. [More...](classeigen_1_1matrix#a9f405923954599ec7a71ee6bad2c53f1) | | | | Public Types inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | enum | { [RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab) , [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) , [SizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da25cb495affdbd796198462b8ef06be91) , [MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306) , [MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) , [MaxSizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da3a459062d39cb34452518f5f201161d2) , [IsVectorAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da1156955c8099c5072934b74c72654ed0) , [NumDimensions](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da4d4548a01ba37a6c2031a3c1f0a37d34) , [Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) , [IsRowMajor](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da406b6af91d61d348ba1c9764bdd66008) , **InnerSizeAtCompileTime** , **InnerStrideAtCompileTime** , **OuterStrideAtCompileTime** } | | | | typedef random\_access\_iterator\_type | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | | | | typedef random\_access\_iterator\_type | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | | | | typedef [Array](classeigen_1_1array)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) | | | | typedef [Matrix](classeigen_1_1matrix)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e) | | | | typedef internal::conditional< internal::is\_same< typename internal::traits< Derived >::XprKind, [MatrixXpr](structeigen_1_1matrixxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e), [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) >::type | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | The plain matrix or array type corresponding to this expression. [More...](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | [StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | The type used to store indices. [More...](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | | typedef [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [value\_type](classeigen_1_1densebase#a9276182dab8236c33f1e7abf491d504d) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | | | --- | | | | | [Matrix](classeigen_1_1matrix#a8f7eef9d36f1057338309afb339c1661) () | | | Default constructor. [More...](classeigen_1_1matrix#a8f7eef9d36f1057338309afb339c1661) | | | | template<typename OtherDerived > | | | [Matrix](classeigen_1_1matrix#ac1a504f785d221680d41d25224a64ce3) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copy constructor for generic expressions. [More...](classeigen_1_1matrix#ac1a504f785d221680d41d25224a64ce3) | | | | | [Matrix](classeigen_1_1matrix#a3615e7b050e4432e19189d5cf6671869) (const [Matrix](classeigen_1_1matrix) &other) | | | Copy constructor. | | | | template<typename OtherDerived > | | | [Matrix](classeigen_1_1matrix#a2f6bdcb76b48999cb9135b828bba4e7d) (const [RotationBase](classeigen_1_1rotationbase)< OtherDerived, [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) > &r) | | | Constructs a Dim x Dim rotation matrix from the rotation *r*. [More...](classeigen_1_1matrix#a2f6bdcb76b48999cb9135b828bba4e7d) | | | | template<typename... ArgTypes> | | | [Matrix](classeigen_1_1matrix#a25719cfdf1a07ba77708dbc6b3c79e96) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a1, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a2, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a3, const ArgTypes &... args) | | | | | [Matrix](classeigen_1_1matrix#a94173a014c2bdc8add568f43ddfd85af) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000)) | | | Constructs an initialized 1x1 matrix with the given coefficient. [More...](classeigen_1_1matrix#a94173a014c2bdc8add568f43ddfd85af) | | | | | [Matrix](classeigen_1_1matrix#a285010dc9f5dd33b030dd115ff6f6307) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8)) | | | Constructs an initialized 2D vector with given coefficients. [More...](classeigen_1_1matrix#a285010dc9f5dd33b030dd115ff6f6307) | | | | | [Matrix](classeigen_1_1matrix#a3166762a368fd1dec9bfa57e4e76bb50) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73)) | | | Constructs an initialized 3D vector with given coefficients. [More...](classeigen_1_1matrix#a3166762a368fd1dec9bfa57e4e76bb50) | | | | | [Matrix](classeigen_1_1matrix#a1b56bac44d4b7d0d652f03daf6d99dca) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad)) | | | Constructs an initialized 4D vector with given coefficients. [More...](classeigen_1_1matrix#a1b56bac44d4b7d0d652f03daf6d99dca) | | | | | [Matrix](classeigen_1_1matrix#ac59ab3932980f113533eaed7fc651756) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | Constructs a fixed-sized matrix initialized with coefficients starting at *data*. | | | | | [Matrix](classeigen_1_1matrix#afaad3c2d97f248465fa63ce43ac9eb42) (const std::initializer\_list< std::initializer\_list< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >> &list) | | | Constructs a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and initializes it from the coefficients given as initializer-lists grouped by row. [c++11] [More...](classeigen_1_1matrix#afaad3c2d97f248465fa63ce43ac9eb42) | | | | | [Matrix](classeigen_1_1matrix#a1c8627a7a051df98bdf6daab12852e02) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) dim) | | | Constructs a vector or row-vector with given dimension. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. [More...](classeigen_1_1matrix#a1c8627a7a051df98bdf6daab12852e02) | | | | | [Matrix](classeigen_1_1matrix#adca6b686dcbf607bd53a8cbe4dfed85c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | Constructs an uninitialized matrix with *rows* rows and *cols* columns. [More...](classeigen_1_1matrix#adca6b686dcbf607bd53a8cbe4dfed85c) | | | | template<typename OtherDerived > | | [Matrix](classeigen_1_1matrix) & | [operator=](classeigen_1_1matrix#a2477f75c24da9f1a1522a632b5934dd8) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1matrix#a2477f75c24da9f1a1522a632b5934dd8) | | | | [Matrix](classeigen_1_1matrix) & | [operator=](classeigen_1_1matrix#a0b287f226563b8410312bd474b2a1ccc) (const [Matrix](classeigen_1_1matrix) &other) | | | Assigns matrices to each other. [More...](classeigen_1_1matrix#a0b287f226563b8410312bd474b2a1ccc) | | | | template<typename OtherDerived > | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Storage, \_MaxRows, \_MaxCols > & | [operator=](classeigen_1_1matrix#a3fe9da2ac8949d30da03ac35801d34dd) (const [RotationBase](classeigen_1_1rotationbase)< OtherDerived, [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) > &r) | | | Set a Dim x Dim rotation matrix from the rotation *r*. [More...](classeigen_1_1matrix#a3fe9da2ac8949d30da03ac35801d34dd) | | | | Public Member Functions inherited from [Eigen::PlainObjectBase< Matrix< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >](classeigen_1_1plainobjectbase) | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeff](classeigen_1_1plainobjectbase#ac99d445913f04acc50280ae99dffd9c3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeff](classeigen_1_1plainobjectbase#a954cd075bcd7babb429e3e4b9a418651) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a72e84dc1bb573ad8ecc9109fbbc1b63b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a541526a4f452554785e78bc41287b348) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a992d58b5453e441dcfc80f21c2bfd1d7) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a038a419ccb6e2c55593b27f17626fd62) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) const | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#a712c25be1652e5a64a00f28c8ed11462) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#a8c9b27a1df4d180b9fb5755bebea2dbd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#a78a42a7c0be768374781f67f40c9ab0d) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#afc474a09ec9704629b795d7907fb6c37) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [conservativeResizeLike](classeigen_1_1plainobjectbase#a4ece7540eda6a1ae7d3730397ce72bec) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \* | [data](classeigen_1_1plainobjectbase#ad12a492bcadea9b65ccd9bc8404c01f1) () | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \* | [data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116) () const | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [lazyAssign](classeigen_1_1plainobjectbase#a70fc6030f9ee72fbe0b3adade2a4a2bd) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [operator=](classeigen_1_1plainobjectbase#ad90648194e9fa6a0e1296ba1e4db8787) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1plainobjectbase#ad90648194e9fa6a0e1296ba1e4db8787) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [operator=](classeigen_1_1plainobjectbase#afbf3af8d6195c9b1b2103c2dd1231247) (const [PlainObjectBase](classeigen_1_1plainobjectbase) &other) | | | | void | [resize](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [resize](classeigen_1_1plainobjectbase#ae4bbe4c06c1feb1035573eee7f5c3623) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | void | [resize](classeigen_1_1plainobjectbase#a8bee1e51417bfa386dd54b37f6d9e2fe) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | void | [resize](classeigen_1_1plainobjectbase#a0dd078df3ff8b3833723ce84ce519651) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [resizeLike](classeigen_1_1plainobjectbase#aabf64c98e5415ad39828a83cc5bdac40) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &\_other) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#aac6bc5261783ec3008a51c2654de73e8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#af9996d6a98f45e84a908dc9851c8332e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#a56e04c9e00a84eeb26774842f4a0f6fd) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#ae521bf911dfa2823c8056dc9c1776bcd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#acc39eaf7ba22b725c86f1b9b8bb57c3c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#a73ab57abb640bf35e0dbf9dba225a1db) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#af57b7361afefe60e2940802e7ef2ca54) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#aee6d32f2e6615645b5f1152f99bc8549) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#a8700dc6d8e05436c0b34ae15ca9274a5) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#ad06b9d8ddac261a871c9ff550a925975) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#a3bd80eb3e6779ba362628b1cb62a665e) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#ab04727b1a70e7d0b5ce9d004b3349075) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#a5f0f6cc8039ed5ac026cd32ed5bbe6ea) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#a8921e8a7f9a5ea167231d29f8feb8700) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#a66a2a4ffc386ca72214d0ac3161fdc03) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#ae705648096d7e74b32daa82dd297dc54) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | Public Member Functions inherited from [Eigen::MatrixBase< Derived >](classeigen_1_1matrixbase) | | const MatrixFunctionReturnValue< Derived > | [acosh](classeigen_1_1matrixbase#a765140ddee0c6b39bbfa3b8917de67be) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::acosh . [More...](classeigen_1_1matrixbase#a765140ddee0c6b39bbfa3b8917de67be) | | | | const AdjointReturnType | [adjoint](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) () const | | | | void | [adjointInPlace](classeigen_1_1matrixbase#a51c5982c1f64e45a939515b701fa6f4a) () | | | | template<typename EssentialPart > | | void | [applyHouseholderOnTheLeft](classeigen_1_1matrixbase#a8f2c8059ef3f04cfa0c73b4c012db855) (const EssentialPart &essential, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*workspace) | | | | template<typename EssentialPart > | | void | [applyHouseholderOnTheRight](classeigen_1_1matrixbase#ab3e52262b41fa40e194dda245e0f9675) (const EssentialPart &essential, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*workspace) | | | | template<typename OtherDerived > | | void | [applyOnTheLeft](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | template<typename OtherScalar > | | void | [applyOnTheLeft](classeigen_1_1matrixbase#ae669131f6e18f7e8f06fae271754f435) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) p, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) q, const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > &j) | | | | template<typename OtherDerived > | | void | [applyOnTheRight](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | template<typename OtherScalar > | | void | [applyOnTheRight](group__jacobi__module#gaa07f741c86219601664433777827bf1c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) p, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) q, const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > &j) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< Derived > | [array](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) () | | | | const [ArrayWrapper](classeigen_1_1arraywrapper)< const Derived > | [array](classeigen_1_1matrixbase#a72f287fe7b2a7e7a66d16cc88166d47f) () const | | | | const [DiagonalWrapper](classeigen_1_1diagonalwrapper)< const Derived > | [asDiagonal](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0) () const | | | | const MatrixFunctionReturnValue< Derived > | [asinh](classeigen_1_1matrixbase#a8efaf691d9c74b362a43b1b793706ea1) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic sine use ArrayBase::asinh . [More...](classeigen_1_1matrixbase#a8efaf691d9c74b362a43b1b793706ea1) | | | | const MatrixFunctionReturnValue< Derived > | [atanh](classeigen_1_1matrixbase#ab87d29c00e6d75aeab43eff53bf5164c) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::atanh . [More...](classeigen_1_1matrixbase#ab87d29c00e6d75aeab43eff53bf5164c) | | | | [BDCSVD](classeigen_1_1bdcsvd)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [bdcSvd](classeigen_1_1matrixbase#ae171b74b5d530846ee0836135ffcf837) (unsigned int computationOptions=0) const | | | | RealScalar | [blueNorm](classeigen_1_1matrixbase#a3f3faa00163c16824ff03e58a210c74c) () const | | | | const [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [colPivHouseholderQr](classeigen_1_1matrixbase#adee8c19c833245bbb00a591dce68e8a4) () const | | | | const [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [completeOrthogonalDecomposition](classeigen_1_1matrixbase#ae90b6846f05bd30b8d52b66e427e3e09) () const | | | | template<typename ResultType > | | void | [computeInverseAndDetWithCheck](classeigen_1_1matrixbase#a7baaf2fdec0191a2166cf9fd84a2dcb2) (ResultType &[inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), typename ResultType::Scalar &[determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061), bool &invertible, const RealScalar &absDeterminantThreshold=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename ResultType > | | void | [computeInverseWithCheck](classeigen_1_1matrixbase#a116f3b50d2af7dbdf7473e517a5b8b0f) (ResultType &[inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), bool &invertible, const RealScalar &absDeterminantThreshold=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | const MatrixFunctionReturnValue< Derived > | [cos](classeigen_1_1matrixbase#a34d626eb756bbeb4069d1eb0e6494c65) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise cosine use ArrayBase::cos . [More...](classeigen_1_1matrixbase#a34d626eb756bbeb4069d1eb0e6494c65) | | | | const MatrixFunctionReturnValue< Derived > | [cosh](classeigen_1_1matrixbase#a627e6f11bf5854ade9a5abfc344c0367) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic cosine use ArrayBase::cosh . [More...](classeigen_1_1matrixbase#a627e6f11bf5854ade9a5abfc344c0367) | | | | template<typename OtherDerived > | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [cross](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [cross3](group__geometry__module#gabde56e2a0baba550815a0b05139e4d42) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) () const | | | | [DiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3) () | | | | [ConstDiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#aebdeedcf67e46d969c556c6c7d9780ee) () const | | | | [DiagonalDynamicIndexReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | [ConstDiagonalDynamicIndexReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#aed11a711c0a3d5dbf8bc094008e29846) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [diagonalSize](classeigen_1_1matrixbase#ab79e511b9322b8b801858e253fb257eb) () const | | | | template<typename OtherDerived > | | [ScalarBinaryOpTraits](structeigen_1_1scalarbinaryoptraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), typename internal::traits< OtherDerived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::ReturnType | [dot](classeigen_1_1matrixbase#adfd32bf5fcf6ee603c924dde9bf7bc39) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | EigenvaluesReturnType | [eigenvalues](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d) () const | | | Computes the eigenvalues of a matrix. [More...](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d) | | | | [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), 3, 1 > | [eulerAngles](group__geometry__module#ga17994d2e81b723295f5bc3b1f862ed3b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a0, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a1, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a2) const | | | | const MatrixExponentialReturnValue< Derived > | [exp](classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise exponential use ArrayBase::exp . [More...](classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) | | | | Derived & | [forceAlignedAccess](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699) () | | | | const Derived & | [forceAlignedAccess](classeigen_1_1matrixbase#ad2fdb842d9a715f8778d0b33c29cfe49) () const | | | | template<bool Enable> | | internal::conditional< Enable, [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< Derived >, Derived & >::type | [forceAlignedAccessIf](classeigen_1_1matrixbase#ae35213d1dd4dd13ebe9a7a762d6bb847) () | | | | template<bool Enable> | | internal::add\_const\_on\_value\_type< typename internal::conditional< Enable, [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< Derived >, Derived & >::type >::type | [forceAlignedAccessIf](classeigen_1_1matrixbase#af42d92f115d4b8fa3d5aa731ed496ed1) () const | | | | const [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [fullPivHouseholderQr](classeigen_1_1matrixbase#a863bc0e06b641a089508eabec6835ab2) () const | | | | const [FullPivLU](classeigen_1_1fullpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [fullPivLu](classeigen_1_1matrixbase#a25da97d31acab0ee5d9d13bdbb0569da) () const | | | | const HNormalizedReturnType | [hnormalized](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) () const | | | homogeneous normalization [More...](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) | | | | [HomogeneousReturnType](classeigen_1_1homogeneous) | [homogeneous](group__geometry__module#gaf3229c2d3669e983075ab91f7f480cb1) () const | | | | const [HouseholderQR](classeigen_1_1householderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [householderQr](classeigen_1_1matrixbase#a9a9377aab1cea26db5f25bab7e682f8f) () const | | | | RealScalar | [hypotNorm](classeigen_1_1matrixbase#a32222d3b6677e6cdf0b801463f329b72) () const | | | | const [Inverse](classeigen_1_1inverse)< Derived > | [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) () const | | | | bool | [isDiagonal](classeigen_1_1matrixbase#a97027ea54c8cd1ddb1c578fee5cedc67) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isIdentity](classeigen_1_1matrixbase#a4ccbd8dfa06e9d47b9bf84711f8b9d40) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isLowerTriangular](classeigen_1_1matrixbase#a1e96c42d79a56f0a6ade30ce031e17eb) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isOrthogonal](classeigen_1_1matrixbase#aefdc8e4e4c156fdd79a21479e75dcd8a) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isUnitary](classeigen_1_1matrixbase#a8a7ee34ce202cac3eeea9cf20c9e4833) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isUpperTriangular](classeigen_1_1matrixbase#aae3ec1660bb4ac584220481c54ab4a64) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | [JacobiSVD](classeigen_1_1jacobisvd)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [jacobiSvd](classeigen_1_1matrixbase#a5745dca9c54390633b434e54a1d1eedd) (unsigned int computationOptions=0) const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, LazyProduct > | [lazyProduct](classeigen_1_1matrixbase#ae0c280b1066c14ed577021f38876527f) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | const [LDLT](classeigen_1_1ldlt)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [ldlt](classeigen_1_1matrixbase#a0ecf058a0727a4cab8b42d79e95072e1) () const | | | | const [LLT](classeigen_1_1llt)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [llt](classeigen_1_1matrixbase#a90c45f7a30265df792d5aeaddead2635) () const | | | | const MatrixLogarithmReturnValue< Derived > | [log](classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise logarithm use ArrayBase::log . [More...](classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) | | | | template<int p> | | RealScalar | [lpNorm](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35) () const | | | | const [PartialPivLU](classeigen_1_1partialpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [lu](classeigen_1_1matrixbase#afb312afbfe960cbda67811552d876fae) () const | | | | template<typename EssentialPart > | | void | [makeHouseholder](classeigen_1_1matrixbase#a13291e900f7e81ddc6e5b8802f82092b) (EssentialPart &essential, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, RealScalar &beta) const | | | | void | [makeHouseholderInPlace](classeigen_1_1matrixbase#aebf4bac7dffe2685ab93734fb776e817) ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, RealScalar &beta) | | | | const MatrixFunctionReturnValue< Derived > | [matrixFunction](classeigen_1_1matrixbase#a1a6cc9f734eb175e785a1118305245fc) (StemFunction f) const | | | Helper function for the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). | | | | [NoAlias](classeigen_1_1noalias)< Derived, [Eigen::MatrixBase](classeigen_1_1matrixbase) > | [noalias](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) () | | | | RealScalar | [norm](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) () const | | | | void | [normalize](classeigen_1_1matrixbase#ad16303c47ba36f7a41ea264cb26bceb6) () | | | | const [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [normalized](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) () const | | | | template<typename OtherDerived > | | bool | [operator!=](classeigen_1_1matrixbase#a028c7ac8094d610042fd0f9feca68f63) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename DiagonalDerived > | | const [Product](classeigen_1_1product)< Derived, DiagonalDerived, LazyProduct > | [operator\*](classeigen_1_1matrixbase#a36fb95c37f0a454e0e2e5cb120b2df7f) (const DiagonalBase< DiagonalDerived > &[diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3)) const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived > | [operator\*](classeigen_1_1matrixbase#ae2d220efbf7047f0894787888288cfcc) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | Derived & | [operator\*=](classeigen_1_1matrixbase#a3783b6168995ca117a1c19fea3630ac4) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator+=](classeigen_1_1matrixbase#a983cc3be0bbe11b3d041a415b76ce010) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator-=](classeigen_1_1matrixbase#a1042124b0ddee66e78ac7b0a9ac4cc9c) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | Derived & | [operator=](classeigen_1_1matrixbase#a373bf62ad398162df5a71963ed7cbeff) (const [MatrixBase](classeigen_1_1matrixbase) &other) | | | | template<typename OtherDerived > | | bool | [operator==](classeigen_1_1matrixbase#a80e3e1e83fdf43f9f7fb6ff51836b24d) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | RealScalar | [operatorNorm](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102) () const | | | Computes the L2 operator norm. [More...](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102) | | | | const [PartialPivLU](classeigen_1_1partialpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [partialPivLu](classeigen_1_1matrixbase#a6199d8aaf26c1b8ac3097fdfa7733a1e) () const | | | | const MatrixPowerReturnValue< Derived > | [pow](classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) (const RealScalar &p) const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use [ArrayBase::pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) . [More...](classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) | | | | const MatrixComplexPowerReturnValue< Derived > | [pow](classeigen_1_1matrixbase#a91dcacf224bd8b18346914bdf7eefc31) (const std::complex< RealScalar > &p) const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use [ArrayBase::pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) . [More...](classeigen_1_1matrixbase#a91dcacf224bd8b18346914bdf7eefc31) | | | | template<unsigned int UpLo> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template SelfAdjointViewReturnType< UpLo >::Type | [selfadjointView](classeigen_1_1matrixbase#ad446541377593656c1399862fe6a0f94) () | | | | template<unsigned int UpLo> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template ConstSelfAdjointViewReturnType< UpLo >::Type | [selfadjointView](classeigen_1_1matrixbase#a67eb836f331d9b567e7f36ec0782fa07) () const | | | | Derived & | [setIdentity](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683) () | | | | Derived & | [setIdentity](classeigen_1_1matrixbase#a97dec020729928e328fe8ae9aad1e99e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | Resizes to the given size, and writes the identity expression (not necessarily square) into \*this. [More...](classeigen_1_1matrixbase#a97dec020729928e328fe8ae9aad1e99e) | | | | Derived & | [setUnit](classeigen_1_1matrixbase#ac7cf3e0e69550d36de8778b09a645afd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | Set the coefficients of `*this` to the i-th unit (basis) vector. [More...](classeigen_1_1matrixbase#ac7cf3e0e69550d36de8778b09a645afd) | | | | Derived & | [setUnit](classeigen_1_1matrixbase#a90bed3b6468a17a9054b07cde7a751a6) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | Resizes to the given *newSize*, and writes the i-th unit (basis) vector into \*this. [More...](classeigen_1_1matrixbase#a90bed3b6468a17a9054b07cde7a751a6) | | | | const MatrixFunctionReturnValue< Derived > | [sin](classeigen_1_1matrixbase#a02f4ff0fcbbae2f3ccaa5981e8ad5e34) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise sine use ArrayBase::sin . [More...](classeigen_1_1matrixbase#a02f4ff0fcbbae2f3ccaa5981e8ad5e34) | | | | const MatrixFunctionReturnValue< Derived > | [sinh](classeigen_1_1matrixbase#a9c37eab2dc7baf83809269254c9129e0) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic sine use ArrayBase::sinh . [More...](classeigen_1_1matrixbase#a9c37eab2dc7baf83809269254c9129e0) | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [sparseView](group__sparsecore__module#ga320dd291cbf4339c6118c41521b75350) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &m\_reference=[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)(0), const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &m\_epsilon=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | const MatrixSquareRootReturnValue< Derived > | [sqrt](classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise square root use ArrayBase::sqrt . [More...](classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) | | | | RealScalar | [squaredNorm](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) () const | | | | RealScalar | [stableNorm](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1) () const | | | | void | [stableNormalize](classeigen_1_1matrixbase#a0b1443fa322615379557ade3399a3c3c) () | | | | const [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [stableNormalized](classeigen_1_1matrixbase#a399dca938633b9f8df5ec4beefeccec0) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [trace](classeigen_1_1matrixbase#a544b609f65eb2bd3e368b3fc2d79479e) () const | | | | template<unsigned int Mode> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template TriangularViewReturnType< Mode >::Type | [triangularView](classeigen_1_1matrixbase#a56665aa894f49f2765291fee0eaeb9c6) () | | | | template<unsigned int Mode> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template ConstTriangularViewReturnType< Mode >::Type | [triangularView](classeigen_1_1matrixbase#aa044521145e74117ad1df42460d7b520) () const | | | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [unitOrthogonal](group__geometry__module#gaa0dc2c32a9379eeb2b4c4a05c1a6fe52) (void) const | | | | Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | bool | [all](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) () const | | | | bool | [allFinite](classeigen_1_1densebase#af1e669fd3aaae50a4870dc1b8f3b8884) () const | | | | bool | [any](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [begin](classeigen_1_1densebase#a57591454af931f9dffa71c9da28d5641) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [begin](classeigen_1_1densebase#ad9368ce70b06167ec5fc19398d329f5e) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cbegin](classeigen_1_1densebase#ae9a3dfd9b826ba3103de0128576fb15b) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cend](classeigen_1_1densebase#aeb3b76f02986c2af2521d07164b5ffde) () const | | | | [ColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) () | | | | [ConstColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [count](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [end](classeigen_1_1densebase#ae71d079e16d91360d10066b316b48485) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [end](classeigen_1_1densebase#ab34773522e43bfb02e9cf652d7b5dd60) () const | | | | EvalReturnType | [eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) () const | | | | void | [fill](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | template<unsigned int Added, unsigned int Removed> | | EIGEN\_DEPRECATED const Derived & | [flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const | | | | const [WithFormat](classeigen_1_1withformat)< Derived > | [format](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) (const [IOFormat](structeigen_1_1ioformat) &fmt) const | | | | bool | [hasNaN](classeigen_1_1densebase#ab13d158c900560d3e1b25d85d2d33dd6) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1densebase#a58ca41d9635a8ab3c5a268ef3f7f0d75) () const | | | | template<typename OtherDerived > | | bool | [isApprox](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isApproxToConstant](classeigen_1_1densebase#af9b150d48bc5e4366887ccb466e40c6b) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isConstant](classeigen_1_1densebase#a1ca84e4179b3e5081ed11d89bbd9e74f) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#a3c4db0c6dd974fa88bbb58b2cf3d5664) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename Derived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#adfca6ff4e473f68fbbeabbd03b7504a9) (const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &other, const RealScalar &prec) const | | | | bool | [isOnes](classeigen_1_1densebase#aa56d6b4477cd3c92a9cf42f4b96e47c2) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isZero](classeigen_1_1densebase#af36014ec300f53a65083057ed4e89822) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED Derived & | [lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#aced8ffda52ff061b6586ace2657ebf30) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) (IndexType \*row, IndexType \*col) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7) () const | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#ac9265f4f91430b9cc75d63fb6865bb29) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) (IndexType \*row, IndexType \*col) const | | | | const [NestByValue](classeigen_1_1nestbyvalue)< Derived > | [nestByValue](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1densebase#acb8d5574eff335381e7441ade87700a0) () const | | | | template<typename OtherDerived > | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0f0e34696162b34762b2bf4bd948f90c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0e575eb0ba6cc6bc5f347872abd8509d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &s) | | | | Derived & | [operator=](classeigen_1_1densebase#a5281dadff89f46eef719b38e5d073a8f) (const [DenseBase](classeigen_1_1densebase) &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#ab66155169d20c035e80d521a8b918e97) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1densebase#a03f71699bc26ca2ee4e42ec4538862d7) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) () const | | | | template<typename Func > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [redux](classeigen_1_1densebase#a63ce1e4fab36bff43bbadcdd06a67724) (const Func &func) const | | | | template<int RowFactor, int ColFactor> | | const [Replicate](classeigen_1_1replicate)< Derived, RowFactor, ColFactor > | [replicate](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) () const | | | | const [Replicate](classeigen_1_1replicate)< Derived, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [replicate](classeigen_1_1densebase#afae2d5e36f1158d1b1681dac3cdbd58e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowFactor, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colFactor) const | | | | void | [resize](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | [ReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) () | | | | [ConstReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a9e2f3ac4019184abf95ca0e1a8d82866) () const | | | | void | [reverseInPlace](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) () | | | | [RowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) () | | | | [ConstRowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc) () const | | | | template<typename ThenDerived , typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, ElseDerived > | [select](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | template<typename ThenDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > | [select](classeigen_1_1densebase#a57ef09a843004095f84c198dd145641b) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const | | | | template<typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > | [select](classeigen_1_1densebase#a9e8e78c75887d4539071a0b7a61ca103) (const typename ElseDerived::Scalar &thenScalar, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | Derived & | [setConstant](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) | | | | Derived & | [setOnes](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) () | | | | Derived & | [setRandom](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) () | | | | Derived & | [setZero](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) () | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) () const | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#af9e7e4305fdb7781f2b2f05fa801f21e) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#a44e25adc6da9cd1d79f4c5bd7c1819cb) ([PlainObjectBase](classeigen_1_1plainobjectbase)< OtherDerived > &other) | | | | [TransposeReturnType](classeigen_1_1transpose) | [transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) () const | | | | void | [transposeInPlace](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) () | | | | CoeffReturnType | [value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) () const | | | | template<typename Visitor > | | void | [visit](classeigen_1_1densebase#a4225b90fcc74f18dd479b401124b3841) (Visitor &func) const | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#af1bac522aee4402639189f387592000b) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a4e94e17926e1cf597deb2928e779cef6) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#abb333f6f10467f6f8d7b59c213dea49e) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a63bc5874eb4e320e54eb079b43b49d22) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae66b7d18b2a85f3139b703126974c900) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#adc8286576b31e11f056057be666a0ec8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a0171eee1d9e582d1ac7ec0f18f5f615a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae6ba07bad9e3026afe54806fdefe32bb) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#aa2040f14e60fed1a4a68ca7f042e1bbf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Scalar & | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) () | | | | Scalar & | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) () | | | | Scalar & | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8) () | | | | Scalar & | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73) () | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Static Public Member Functions inherited from [Eigen::PlainObjectBase< Matrix< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >](classeigen_1_1plainobjectbase) | | static [ConstMapType](classeigen_1_1map) | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [MapType](classeigen_1_1map) | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [ConstMapType](classeigen_1_1map) | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [MapType](classeigen_1_1map) | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [ConstMapType](classeigen_1_1map) | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static [MapType](classeigen_1_1map) | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static StridedConstMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static [ConstAlignedMapType](classeigen_1_1map) | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [AlignedMapType](classeigen_1_1map) | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [ConstAlignedMapType](classeigen_1_1map) | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [AlignedMapType](classeigen_1_1map) | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [ConstAlignedMapType](classeigen_1_1map) | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static [AlignedMapType](classeigen_1_1map) | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static StridedConstAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | Static Public Member Functions inherited from [Eigen::MatrixBase< Derived >](classeigen_1_1matrixbase) | | static const IdentityReturnType | [Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f) () | | | | static const IdentityReturnType | [Identity](classeigen_1_1matrixbase#acf33ce20ef03ead47cb3dbcd5f416ede) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const BasisReturnType | [Unit](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | | static const BasisReturnType | [Unit](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | | static const BasisReturnType | [UnitW](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) () | | | | static const BasisReturnType | [UnitX](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d) () | | | | static const BasisReturnType | [UnitY](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc) () | | | | static const BasisReturnType | [UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0) () | | | | Static Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#aed89b5cc6e3b7d9d5bd63aed245ccd6d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a1fdd3189ae3a41d250593334d82210cf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a5dc65501accd02c30f7c1840c2a30a41) (const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const CustomNullaryOp &func) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101) () | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a8b2a51018a73a766f5b91aef3487f013) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#ab710a58e4a80fbcb2594242372c8fe56) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) () | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#a7eb5f974a8f0b67eac7080db1da0e308) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761) () | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ae41a9b5050ed27d9e93c82c9c8622cd3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ac22f79b812fa564061042407f2ba8f5b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | Protected Member Functions inherited from [Eigen::PlainObjectBase< Matrix< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >](classeigen_1_1plainobjectbase) | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a73dca0493df0fe4f8e518e379a80cbdd) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a8fa7e42fd02b266ac54d57cdc735e83d) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a520234520136dffad88301a507da4fa5) (const [PlainObjectBase](classeigen_1_1plainobjectbase) &other) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a281044f167c388339c2d704e5d292fa5) (const ReturnByValue< OtherDerived > &other) | | | Copy constructor with in-place evaluation. | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a5b6ba62bc9d263390e81a77a44f23dd9) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a1, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a2, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a3, const ArgTypes &... args) | | | Construct a row of column vector with fixed size from an arbitrary number of coefficients. [c++11] [More...](classeigen_1_1plainobjectbase#a5b6ba62bc9d263390e81a77a44f23dd9) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#ab6cde095b242924b47479662b16d78b9) (const std::initializer\_list< std::initializer\_list< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >> &list) | | | Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer lists [c++11] | | | | void | **\_resize\_to\_match** (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [\_set](classeigen_1_1plainobjectbase#a09c4b519ee4c635144581e9fe03b6174) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | Copies the value of the expression *other* into `*this` with automatic resizing. [More...](classeigen_1_1plainobjectbase#a09c4b519ee4c635144581e9fe03b6174) | | | | [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | **\_set\_noalias** (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | void | **\_init2** ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, typename internal::enable\_if< Base::SizeAtCompileTime!=2, T0 >::type \*=0) | | | | void | **\_init2** (const T0 &val0, const T1 &val1, typename internal::enable\_if< Base::SizeAtCompileTime==2, T0 >::type \*=0) | | | | void | **\_init2** (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val0, const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val1, typename internal::enable\_if<(!internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< T0, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< T1, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&Base::SizeAtCompileTime==2, T1 >::type \*=0) | | | | void | **\_init1** ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), typename internal::enable\_if<(Base::SizeAtCompileTime!=1||!internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&((!internal::is\_same< typename internal::traits< [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >::XprKind, [ArrayXpr](structeigen_1_1arrayxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)||Base::SizeAtCompileTime==Dynamic)), T >::type \*=0) | | | | void | **\_init1** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, typename internal::enable\_if< Base::SizeAtCompileTime==1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T >::type \*=0) | | | | void | **\_init1** (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val0, typename internal::enable\_if<(!internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), T >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&Base::SizeAtCompileTime==1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T \* >::type \*=0) | | | | void | **\_init1** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | void | **\_init1** (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | void | **\_init1** (const [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > &other) | | | | void | **\_init1** (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | void | **\_init1** (const ReturnByValue< OtherDerived > &other) | | | | void | **\_init1** (const [RotationBase](classeigen_1_1rotationbase)< OtherDerived, [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) > &r) | | | | void | **\_init1** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, typename internal::enable\_if< Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) &&internal::is\_same< typename internal::traits< [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >::XprKind, [ArrayXpr](structeigen_1_1arrayxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T >::type \*=0) | | | | void | **\_init1** (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val0, typename internal::enable\_if<(!internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), T >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) &&internal::is\_same< typename internal::traits< [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >::XprKind, [ArrayXpr](structeigen_1_1arrayxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T \* >::type \*=0) | | | | Protected Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | | [DenseBase](classeigen_1_1densebase#aa284042d0e1b0ad9b6a00db7fd2d9f7f) () | | | | Related Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | template<typename Derived > | | std::ostream & | [operator<<](classeigen_1_1densebase#a3806d3f42de165878dace160e6aba40a) (std::ostream &s, const [DenseBase](classeigen_1_1densebase)< Derived > &m) | | | Base ---- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | --- | | typedef [PlainObjectBase](classeigen_1_1plainobjectbase)<[Matrix](classeigen_1_1matrix)> [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::Base | Base class typedef. See also [PlainObjectBase](classeigen_1_1plainobjectbase "Dense storage base class for matrices and arrays.") Matrix() [1/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | | ) | | | inline | Default constructor. For fixed-size matrices, does nothing. For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix is called a null matrix. This constructor is the unique way to create null matrices: resizing a matrix to 0 is not supported. See also [resize(Index,Index)](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a) Matrix() [2/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename... ArgTypes> | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a0*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a1*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a2*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a3*, | | | | const ArgTypes &... | *args* | | | ) | | | | inline | Example: ``` Matrix<int, 1, 6> a(1, 2, 3, 4, 5, 6); Matrix<int, 3, 1> b {1, 2, 3}; cout << a << "\n\n" << b << endl; ``` Output: ``` 1 2 3 4 5 6 1 2 3 ``` See also [Matrix(const std::initializer\_list<std::initializer\_list<Scalar>>&)](classeigen_1_1matrix#afaad3c2d97f248465fa63ce43ac9eb42 "Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by ro...") Matrix() [3/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const std::initializer\_list< std::initializer\_list< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >> & | *list* | ) | | | inlineexplicit | Constructs a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and initializes it from the coefficients given as initializer-lists grouped by row. [c++11] In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: Example: ``` MatrixXd m { {1, 2, 3}, {4, 5, 6} }; cout << m << endl; ``` Output: ``` 1 2 3 4 5 6 ``` Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. In the case of a compile-time column vector, implicit transposition from a single row is allowed. Therefore `VectorXd{{1,2,3,4,5}}` is legal and the more verbose syntax `RowVectorXd{{1},{2},{3},{4},{5}}` can be avoided: Example: ``` VectorXi v {{1, 2}}; cout << v << endl; ``` Output: ``` 1 2 ``` In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes, and implicit transposition is allowed for compile-time vectors only. See also [Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)](classeigen_1_1matrix#a25719cfdf1a07ba77708dbc6b3c79e96) Matrix() [4/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *dim* | ) | | | inlineexplicit | Constructs a vector or row-vector with given dimension. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. This is useful for dynamic-size vectors. For fixed-size vectors, it is redundant to pass these parameters, so one should use the default constructor [Matrix()](classeigen_1_1matrix#a8f7eef9d36f1057338309afb339c1661 "Default constructor.") instead. Warning This constructor is disabled for fixed-size `1x1` matrices. For instance, calling Matrix<double,1,1>(1) will call the initialization constructor: [Matrix(const Scalar&)](classeigen_1_1matrix#a94173a014c2bdc8add568f43ddfd85af "Constructs an initialized 1x1 matrix with the given coefficient."). For fixed-size `1x1` matrices it is therefore recommended to use the default constructor [Matrix()](classeigen_1_1matrix#a8f7eef9d36f1057338309afb339c1661 "Default constructor.") instead, especially when using one of the non standard `EIGEN_INITIALIZE_MATRICES_BY_{ZERO`,`NAN}` macros (see [Preprocessor directives](topicpreprocessordirectives)). Matrix() [5/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *x* | ) | | Constructs an initialized 1x1 matrix with the given coefficient. See also Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) Matrix() [6/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | Constructs an uninitialized matrix with *rows* rows and *cols* columns. This is useful for dynamic-size matrices. For fixed-size matrices, it is redundant to pass these parameters, so one should use the default constructor [Matrix()](classeigen_1_1matrix#a8f7eef9d36f1057338309afb339c1661 "Default constructor.") instead. Warning This constructor is disabled for fixed-size `1x2` and `2x1` vectors. For instance, calling Matrix2f(2,1) will call the initialization constructor: [Matrix(const Scalar& x, const Scalar& y)](classeigen_1_1matrix#a285010dc9f5dd33b030dd115ff6f6307 "Constructs an initialized 2D vector with given coefficients."). For fixed-size `1x2` or `2x1` vectors it is therefore recommended to use the default constructor [Matrix()](classeigen_1_1matrix#a8f7eef9d36f1057338309afb339c1661 "Default constructor.") instead, especially when using one of the non standard `EIGEN_INITIALIZE_MATRICES_BY_{ZERO`,`NAN}` macros (see [Preprocessor directives](topicpreprocessordirectives)). Matrix() [7/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *x*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *y* | | | ) | | | Constructs an initialized 2D vector with given coefficients. See also Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) Matrix() [8/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *x*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *y*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *z* | | | ) | | | | inline | Constructs an initialized 3D vector with given coefficients. See also Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) Matrix() [9/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *x*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *y*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *z*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *w* | | | ) | | | | inline | Constructs an initialized 4D vector with given coefficients. See also Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) Matrix() [10/11] ---------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | Copy constructor for generic expressions. See also MatrixBase::operator=(const EigenBase<OtherDerived>&) Matrix() [11/11] ---------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Storage, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Storage, \_MaxRows, \_MaxCols >::[Matrix](classeigen_1_1matrix) | ( | const [RotationBase](classeigen_1_1rotationbase)< OtherDerived, [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) > & | *r* | ) | | | explicit | Constructs a Dim x Dim rotation matrix from the rotation *r*. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` operator=() [1/3] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Matrix](classeigen_1_1matrix)& [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | Copies the generic expression *other* into \*this. The expression must provide a (templated) evalTo(Derived& dst) const function which does the actual job. In practice, this allows any user to write its own special matrix without having to modify [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") Returns a reference to \*this. operator=() [2/3] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Matrix](classeigen_1_1matrix)& [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | *other* | ) | | | inline | Assigns matrices to each other. Note This is a special case of the templated operator=. Its purpose is to prevent a default operator= from hiding the templated operator=. operator=() [3/3] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [Matrix](classeigen_1_1matrix)<\_Scalar, \_Rows, \_Cols, \_Storage, \_MaxRows, \_MaxCols>& [Eigen::Matrix](classeigen_1_1matrix)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [RotationBase](classeigen_1_1rotationbase)< OtherDerived, [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) > & | *r* | ) | | Set a Dim x Dim rotation matrix from the rotation *r*. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` --- The documentation for this class was generated from the following files:* [Matrix.h](https://eigen.tuxfamily.org/dox/Matrix_8h_source.html) * [RotationBase.h](https://eigen.tuxfamily.org/dox/RotationBase_8h_source.html)
programming_docs
eigen3 The Matrix class The Matrix class ================ In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), all matrices and vectors are objects of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") template class. Vectors are just a special case of matrices, with either 1 row or 1 column. The first three template parameters of Matrix =============================================== The [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class takes six template parameters, but for now it's enough to learn about the first three first parameters. The three remaining parameters have default values, which for now we will leave untouched, and which we [discuss below](group__tutorialmatrixclass#TutorialMatrixOptTemplParams). The three mandatory template parameters of [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") are: ``` Matrix<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime> ``` * `Scalar` is the scalar type, i.e. the type of the coefficients. That is, if you want a matrix of floats, choose `float` here. See [Scalar types](topicscalartypes) for a list of all supported scalar types and for how to extend support to new types. * `RowsAtCompileTime` and `ColsAtCompileTime` are the number of rows and columns of the matrix as known at compile time (see [below](group__tutorialmatrixclass#TutorialMatrixDynamic) for what to do if the number is not known at compile time). We offer a lot of convenience typedefs to cover the usual cases. For example, `Matrix4f` is a 4x4 matrix of floats. Here is how it is defined by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."): ``` typedef Matrix<float, 4, 4> Matrix4f; ``` We discuss [below](group__tutorialmatrixclass#TutorialMatrixTypedefs) these convenience typedefs. Vectors ========= As mentioned above, in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), vectors are just a special case of matrices, with either 1 row or 1 column. The case where they have 1 column is the most common; such vectors are called column-vectors, often abbreviated as just vectors. In the other case where they have 1 row, they are called row-vectors. For example, the convenience typedef `Vector3f` is a (column) vector of 3 floats. It is defined as follows by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."): ``` typedef Matrix<float, 3, 1> Vector3f; ``` We also offer convenience typedefs for row-vectors, for example: ``` typedef Matrix<int, 1, 2> RowVector2i; ``` The special value Dynamic =========================== Of course, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") is not limited to matrices whose dimensions are known at compile time. The `RowsAtCompileTime` and `ColsAtCompileTime` template parameters can take the special value `Dynamic` which indicates that the size is unknown at compile time, so must be handled as a run-time variable. In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") terminology, such a size is referred to as a *dynamic* *size*; while a size that is known at compile time is called a *fixed* *size*. For example, the convenience typedef `MatrixXd`, meaning a matrix of doubles with dynamic size, is defined as follows: ``` typedef Matrix<double, Dynamic, Dynamic> MatrixXd; ``` And similarly, we define a self-explanatory typedef `VectorXi` as follows: ``` typedef Matrix<int, Dynamic, 1> VectorXi; ``` You can perfectly have e.g. a fixed number of rows with a dynamic number of columns, as in: ``` Matrix<float, 3, Dynamic> ``` Constructors ============== A default constructor is always available, never performs any dynamic memory allocation, and never initializes the matrix coefficients. You can do: ``` Matrix3f a; MatrixXf b; ``` Here, * `a` is a 3-by-3 matrix, with a plain float[9] array of uninitialized coefficients, * `b` is a dynamic-size matrix whose size is currently 0-by-0, and whose array of coefficients hasn't yet been allocated at all. Constructors taking sizes are also available. For matrices, the number of rows is always passed first. For vectors, just pass the vector size. They allocate the array of coefficients with the given size, but don't initialize the coefficients themselves: ``` MatrixXf a(10,15); VectorXf b(30); ``` Here, * `a` is a 10x15 dynamic-size matrix, with allocated but currently uninitialized coefficients. * `b` is a dynamic-size vector of size 30, with allocated but currently uninitialized coefficients. In order to offer a uniform API across fixed-size and dynamic-size matrices, it is legal to use these constructors on fixed-size matrices, even if passing the sizes is useless in this case. So this is legal: ``` Matrix3f a(3,3); ``` and is a no-operation. Matrices and vectors can also be initialized from lists of coefficients. Prior to C++11, this feature is limited to small fixed-size column or vectors up to size 4: ``` Vector2d a(5.0, 6.0); Vector3d b(5.0, 6.0, 7.0); Vector4d c(5.0, 6.0, 7.0, 8.0); ``` If C++11 is enabled, fixed-size column or row vectors of arbitrary size can be initialized by passing an arbitrary number of coefficients: ``` Vector2i a(1, 2); // A column vector containing the elements {1, 2} Matrix<int, 5, 1> b {1, 2, 3, 4, 5}; // A row-vector containing the elements {1, 2, 3, 4, 5} Matrix<int, 1, 5> c = {1, 2, 3, 4, 5}; // A column vector containing the elements {1, 2, 3, 4, 5} ``` In the general case of matrices and vectors with either fixed or runtime sizes, coefficients have to be grouped by rows and passed as an initializer list of initializer list ([details](classeigen_1_1matrix#afaad3c2d97f248465fa63ce43ac9eb42) ): ``` MatrixXi a { // construct a 2x2 matrix {1, 2}, // first row {3, 4} // second row }; Matrix<double, 2, 3> b { {2, 3, 4}, {5, 6, 7}, }; ``` For column or row vectors, implicit transposition is allowed. This means that a column vector can be initialized from a single row: ``` VectorXd a {{1.5, 2.5, 3.5}}; // A column-vector with 3 coefficients RowVectorXd b {{1.0, 2.0, 3.0, 4.0}}; // A row-vector with 4 coefficients ``` Coefficient accessors ======================= The primary coefficient accessors and mutators in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") are the overloaded parenthesis operators. For matrices, the row index is always passed first. For vectors, just pass one index. The numbering starts at 0. This example is self-explanatory: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace [Eigen](namespaceeigen); int main() { MatrixXd m(2,2); m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); std::cout << "Here is the matrix m:\n" << m << std::endl; VectorXd v(2); v(0) = 4; v(1) = v(0) - 1; std::cout << "Here is the vector v:\n" << v << std::endl; } ``` | ``` Here is the matrix m: 3 -1 2.5 1.5 Here is the vector v: 4 3 ``` | Note that the syntax `m(index)` is not restricted to vectors, it is also available for general matrices, meaning index-based access in the array of coefficients. This however depends on the matrix's storage order. All [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") matrices default to column-major storage order, but this can be changed to row-major, see [Storage orders](group__topicstorageorders). The operator[] is also overloaded for index-based access in vectors, but keep in mind that C++ doesn't allow operator[] to take more than one argument. We restrict operator[] to vectors, because an awkwardness in the C++ language would make matrix[i,j] compile to the same thing as matrix[j] ! Comma-initialization ====================== Matrix and vector coefficients can be conveniently set using the so-called *comma-initializer* syntax. For now, it is enough to know this example: | Example: | Output: | | --- | --- | | ``` Matrix3f m; m << 1, 2, 3, 4, 5, 6, 7, 8, 9; std::cout << m; ``` | ``` 1 2 3 4 5 6 7 8 9 ``` | The right-hand side can also contain matrix expressions as discussed in [this page](group__tutorialadvancedinitialization). Resizing ========== The current size of a matrix can be retrieved by [rows()](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2), [cols()](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) and [size()](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9). These methods return the number of rows, the number of columns and the number of coefficients, respectively. Resizing a dynamic-size matrix is done by the [resize()](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a) method. | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace [Eigen](namespaceeigen); int main() { MatrixXd m(2,5); m.resize(4,3); std::cout << "The matrix m is of size " << m.rows() << "x" << m.cols() << std::endl; std::cout << "It has " << m.size() << " coefficients" << std::endl; VectorXd v(2); v.resize(5); std::cout << "The vector v is of size " << v.size() << std::endl; std::cout << "As a matrix, v is of size " << v.rows() << "x" << v.cols() << std::endl; } ``` | ``` The matrix m is of size 4x3 It has 12 coefficients The vector v is of size 5 As a matrix, v is of size 5x1 ``` | The resize() method is a no-operation if the actual matrix size doesn't change; otherwise it is destructive: the values of the coefficients may change. If you want a conservative variant of resize() which does not change the coefficients, use [conservativeResize()](classeigen_1_1plainobjectbase#a712c25be1652e5a64a00f28c8ed11462), see [this page](topicresizing) for more details. All these methods are still available on fixed-size matrices, for the sake of API uniformity. Of course, you can't actually resize a fixed-size matrix. Trying to change a fixed size to an actually different value will trigger an assertion failure; but the following code is legal: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace [Eigen](namespaceeigen); int main() { Matrix4d m; m.resize(4,4); // no operation std::cout << "The matrix m is of size " << m.rows() << "x" << m.cols() << std::endl; } ``` | ``` The matrix m is of size 4x4 ``` | Assignment and resizing ========================= Assignment is the action of copying a matrix into another, using `operator=`. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") resizes the matrix on the left-hand side automatically so that it matches the size of the matrix on the right-hand size. For example: | Example: | Output: | | --- | --- | | ``` MatrixXf a(2,2); std::cout << "a is of size " << a.rows() << "x" << a.cols() << std::endl; MatrixXf b(3,3); a = b; std::cout << "a is now of size " << a.rows() << "x" << a.cols() << std::endl; ``` | ``` a is of size 2x2 a is now of size 3x3 ``` | Of course, if the left-hand side is of fixed size, resizing it is not allowed. If you do not want this automatic resizing to happen (for example for debugging purposes), you can disable it, see [this page](topicresizing). Fixed vs. Dynamic size ======================== When should one use fixed sizes (e.g. `Matrix4f`), and when should one prefer dynamic sizes (e.g. `MatrixXf`)? The simple answer is: use fixed sizes for very small sizes where you can, and use dynamic sizes for larger sizes or where you have to. For small sizes, especially for sizes smaller than (roughly) 16, using fixed sizes is hugely beneficial to performance, as it allows [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") to avoid dynamic memory allocation and to unroll loops. Internally, a fixed-size [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") matrix is just a plain array, i.e. doing ``` Matrix4f mymatrix; ``` really amounts to just doing ``` float mymatrix[16]; ``` so this really has zero runtime cost. By contrast, the array of a dynamic-size matrix is always allocated on the heap, so doing ``` MatrixXf mymatrix(rows,columns); ``` amounts to doing ``` float *mymatrix = new float[rows*columns]; ``` and in addition to that, the MatrixXf object stores its number of rows and columns as member variables. The limitation of using fixed sizes, of course, is that this is only possible when you know the sizes at compile time. Also, for large enough sizes, say for sizes greater than (roughly) 32, the performance benefit of using fixed sizes becomes negligible. Worse, trying to create a very large matrix using fixed sizes inside a function could result in a stack overflow, since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") will try to allocate the array automatically as a local variable, and this is normally done on the stack. Finally, depending on circumstances, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") can also be more aggressive trying to vectorize (use SIMD instructions) when dynamic sizes are used, see [Vectorization](topicvectorization). Optional template parameters ============================== We mentioned at the beginning of this page that the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class takes six template parameters, but so far we only discussed the first three. The remaining three parameters are optional. Here is the complete list of template parameters: ``` Matrix<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime, int Options = 0, int MaxRowsAtCompileTime = RowsAtCompileTime, int MaxColsAtCompileTime = ColsAtCompileTime> ``` * `Options` is a bit field. Here, we discuss only one bit: `RowMajor`. It specifies that the matrices of this type use row-major storage order; by default, the storage order is column-major. See the page on [storage orders](group__topicstorageorders). For example, this type means row-major 3x3 matrices: ``` Matrix<float, 3, 3, RowMajor> ``` * `MaxRowsAtCompileTime` and `MaxColsAtCompileTime` are useful when you want to specify that, even though the exact sizes of your matrices are not known at compile time, a fixed upper bound is known at compile time. The biggest reason why you might want to do that is to avoid dynamic memory allocation. For example the following matrix type uses a plain array of 12 floats, without dynamic memory allocation: ``` Matrix<float, Dynamic, Dynamic, 0, 3, 4> ``` Convenience typedefs ====================== [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") defines the following [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") typedefs: * MatrixNt for Matrix<type, N, N>. For example, MatrixXi for Matrix<int, Dynamic, Dynamic>. * VectorNt for Matrix<type, N, 1>. For example, Vector2f for Matrix<float, 2, 1>. * RowVectorNt for Matrix<type, 1, N>. For example, RowVector3d for Matrix<double, 1, 3>. Where: * N can be any one of `2`, `3`, `4`, or `X` (meaning `Dynamic`). * t can be any one of `i` (meaning int), `f` (meaning float), `d` (meaning double), `cf` (meaning complex<float>), or `cd` (meaning complex<double>). The fact that typedefs are only defined for these five types doesn't mean that they are the only supported scalar types. For example, all standard integer types are supported, see [Scalar types](topicscalartypes). eigen3 Eigen::Reshaped Eigen::Reshaped =============== ### template<typename XprType, int Rows, int Cols, int Order> class Eigen::Reshaped< XprType, Rows, Cols, Order > Expression of a fixed-size or dynamic-size reshape. Template Parameters | | | | --- | --- | | XprType | the type of the expression in which we are taking a reshape | | Rows | the number of rows of the reshape we are taking at compile time (optional) | | Cols | the number of columns of the reshape we are taking at compile time (optional) | | Order | can be ColMajor or RowMajor, default is ColMajor. | This class represents an expression of either a fixed-size or dynamic-size reshape. It is the return type of DenseBase::reshaped(NRowsType,NColsType) and most of the time this is the only way it is used. However, in C++98, if you want to directly maniputate reshaped expressions, for instance if you want to write a function returning such an expression, you will need to use this class. In C++11, it is advised to use the *auto* keyword for such use cases. Here is an example illustrating the dynamic case: ``` #include <Eigen/Core> #include <iostream> using namespace std; using namespace [Eigen](namespaceeigen); template<typename Derived> const Reshaped<const Derived> reshape_helper(const MatrixBase<Derived>& m, int rows, int cols) { return Reshaped<const Derived>(m.derived(), rows, cols); } int main(int, char**) { MatrixXd m(3, 4); m << 1, 4, 7, 10, 2, 5, 8, 11, 3, 6, 9, 12; cout << m << endl; Ref<const MatrixXd> n = reshape_helper(m, 2, 6); cout << "Matrix m is:" << endl << m << endl; cout << "Matrix n is:" << endl << n << endl; } ``` Output: ``` 1 4 7 10 2 5 8 11 3 6 9 12 Matrix m is: 1 4 7 10 2 5 8 11 3 6 9 12 Matrix n is: 1 3 5 7 9 11 2 4 6 8 10 12 ``` Here is an example illustrating the fixed-size case: ``` #include <Eigen/Core> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; template<typename Derived> [Eigen::Reshaped<Derived, 4, 2>](classeigen_1_1reshaped) reshape_helper(MatrixBase<Derived>& m) { return [Eigen::Reshaped<Derived, 4, 2>](classeigen_1_1reshaped)(m.derived()); } int main(int, char**) { MatrixXd m(2, 4); m << 1, 2, 3, 4, 5, 6, 7, 8; MatrixXd n = reshape_helper(m); cout << "matrix m is:" << endl << m << endl; cout << "matrix n is:" << endl << n << endl; return 0; } ``` Output: ``` matrix m is: 1 2 3 4 5 6 7 8 matrix n is: 1 3 5 7 2 4 6 8 ``` See also DenseBase::reshaped(NRowsType,NColsType) Inherits Eigen::ReshapedImpl< XprType, Rows, Cols, Order, internal::traits< XprType >::StorageKind >. | | | --- | | | | | [Reshaped](classeigen_1_1reshaped#a6de25b03b93cb3dc55ba7fcafae87984) (XprType &xpr) | | | | | [Reshaped](classeigen_1_1reshaped#a26f25c9bc61d72ae9db5d62112d4a26a) (XprType &xpr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) reshapeRows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) reshapeCols) | | | Reshaped() [1/2] ---------------- template<typename XprType , int Rows, int Cols, int Order> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Reshaped](classeigen_1_1reshaped)< XprType, Rows, Cols, Order >::[Reshaped](classeigen_1_1reshaped) | ( | XprType & | *xpr* | ) | | | inline | Fixed-size constructor Reshaped() [2/2] ---------------- template<typename XprType , int Rows, int Cols, int Order> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Reshaped](classeigen_1_1reshaped)< XprType, Rows, Cols, Order >::[Reshaped](classeigen_1_1reshaped) | ( | XprType & | *xpr*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *reshapeRows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *reshapeCols* | | | ) | | | | inline | Dynamic-size constructor --- The documentation for this class was generated from the following file:* [Reshaped.h](https://eigen.tuxfamily.org/dox/Reshaped_8h_source.html)
programming_docs
eigen3 Eigen::CholmodDecomposition Eigen::CholmodDecomposition =========================== ### template<typename \_MatrixType, int \_UpLo = Lower> class Eigen::CholmodDecomposition< \_MatrixType, \_UpLo > A general Cholesky factorization and solver based on Cholmod. This class allows to solve for A.X = B sparse linear problems via a LL^T or LDL^T Cholesky factorization using the Cholmod library. The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices X and B can be either dense or sparse. This variant permits to change the underlying Cholesky method at runtime. On the other hand, it does not provide access to the result of the factorization. The default is to let Cholmod automatically choose between a simplicial and supernodal factorization. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | \_UpLo | the triangular part that will be used for the computations. It can be Lower or Upper. Default is Lower. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. Warning Only double precision real and complex scalar types are supported by Cholmod. See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) | | | --- | | | | Public Member Functions inherited from [Eigen::CholmodBase< \_MatrixType, Lower, CholmodDecomposition< \_MatrixType, Lower > >](classeigen_1_1cholmodbase) | | void | [analyzePattern](classeigen_1_1cholmodbase#a5ac967e9f4ccfc43ca9e610b89232c24) (const MatrixType &matrix) | | | | cholmod\_common & | [cholmod](classeigen_1_1cholmodbase#a6a85bf52d6aa480240a64f277d7f96c6) () | | | | [CholmodDecomposition](classeigen_1_1cholmoddecomposition)< \_MatrixType, Lower > & | [compute](classeigen_1_1cholmodbase#abaf5be01b1e3035a4de0b19f5b63549e) (const MatrixType &matrix) | | | | Scalar | [determinant](classeigen_1_1cholmodbase#ab4ffb4a9735ad7e81a01d5789ce96547) () const | | | | void | [factorize](classeigen_1_1cholmodbase#a5bd9c9ec4d1c15f202a6c66b5e9ef37b) (const MatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) | | | | Scalar | [logDeterminant](classeigen_1_1cholmodbase#a597f7839a39604af18a8741a0d8c46bf) () const | | | | [CholmodDecomposition](classeigen_1_1cholmoddecomposition)< \_MatrixType, Lower > & | [setShift](classeigen_1_1cholmodbase#a886fc102723ca7bde4ac7162dfd72f5d) (const RealScalar &offset) | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | --- The documentation for this class was generated from the following file:* [CholmodSupport.h](https://eigen.tuxfamily.org/dox/CholmodSupport_8h_source.html) eigen3 Eigen::Block Eigen::Block ============ ### template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel> class Eigen::Block< XprType, BlockRows, BlockCols, InnerPanel > Expression of a fixed-size or dynamic-size block. Template Parameters | | | | --- | --- | | XprType | the type of the expression in which we are taking a block | | BlockRows | the number of rows of the block we are taking at compile time (optional) | | BlockCols | the number of columns of the block we are taking at compile time (optional) | | InnerPanel | is true, if the block maps to a set of rows of a row major matrix or to set of columns of a column major matrix (optional). The parameter allows to determine at compile time whether aligned access is possible on the block expression. | This class represents an expression of either a fixed-size or dynamic-size block. It is the return type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block<int,int>(Index,Index) and most of the time this is the only way it is used. However, if you want to directly maniputate block expressions, for instance if you want to write a function returning such an expression, you will need to use this class. Here is an example illustrating the dynamic case: ``` #include <Eigen/Core> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; template<typename Derived> [Eigen::Block<Derived>](classeigen_1_1block) topLeftCorner(MatrixBase<Derived>& m, int rows, int cols) { return [Eigen::Block<Derived>](classeigen_1_1block)(m.derived(), 0, 0, rows, cols); } template<typename Derived> const [Eigen::Block<const Derived>](classeigen_1_1block) topLeftCorner(const MatrixBase<Derived>& m, int rows, int cols) { return [Eigen::Block<const Derived>](classeigen_1_1block)(m.derived(), 0, 0, rows, cols); } int main(int, char**) { Matrix4d m = [Matrix4d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(); cout << topLeftCorner(4*m, 2, 3) << endl; // calls the const version topLeftCorner(m, 2, 3) *= 5; // calls the non-const version cout << "Now the matrix m is:" << endl << m << endl; return 0; } ``` Output: ``` 4 0 0 0 4 0 Now the matrix m is: 5 0 0 0 0 5 0 0 0 0 1 0 0 0 0 1 ``` Note Even though this expression has dynamic size, in the case where *XprType* has fixed size, this expression inherits a fixed maximal size which means that evaluating it does not cause a dynamic memory allocation. Here is an example illustrating the fixed-size case: ``` #include <Eigen/Core> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; template<typename Derived> [Eigen::Block<Derived, 2, 2>](classeigen_1_1block) topLeft2x2Corner(MatrixBase<Derived>& m) { return [Eigen::Block<Derived, 2, 2>](classeigen_1_1block)(m.derived(), 0, 0); } template<typename Derived> const [Eigen::Block<const Derived, 2, 2>](classeigen_1_1block) topLeft2x2Corner(const MatrixBase<Derived>& m) { return [Eigen::Block<const Derived, 2, 2>](classeigen_1_1block)(m.derived(), 0, 0); } int main(int, char**) { Matrix3d m = [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(); cout << topLeft2x2Corner(4*m) << endl; // calls the const version topLeft2x2Corner(m) *= 2; // calls the non-const version cout << "Now the matrix m is:" << endl << m << endl; return 0; } ``` Output: ``` 4 0 0 4 Now the matrix m is: 2 0 0 0 2 0 0 0 1 ``` See also DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class [VectorBlock](classeigen_1_1vectorblock "Expression of a fixed-size or dynamic-size sub-vector.") Inherits Eigen::BlockImpl< XprType, BlockRows, BlockCols, InnerPanel, internal::traits< XprType >::StorageKind >. | | | --- | | | | | [Block](classeigen_1_1block#aebf8889be487c3fd556ffc32ba97cb0a) (XprType &xpr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) | | | | | [Block](classeigen_1_1block#a66685b5f860015fd2e752489213dc0a9) (XprType &xpr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) startRow, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) startCol) | | | | | [Block](classeigen_1_1block#a7203a3c88122d60221c3730517fff607) (XprType &xpr, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) startRow, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) startCol, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) blockRows, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) blockCols) | | | Block() [1/3] ------------- template<typename XprType , int BlockRows, int BlockCols, bool InnerPanel> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Block](classeigen_1_1block)< XprType, BlockRows, BlockCols, InnerPanel >::[Block](classeigen_1_1block) | ( | XprType & | *xpr*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *i* | | | ) | | | | inline | Column or Row constructor Block() [2/3] ------------- template<typename XprType , int BlockRows, int BlockCols, bool InnerPanel> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Block](classeigen_1_1block)< XprType, BlockRows, BlockCols, InnerPanel >::[Block](classeigen_1_1block) | ( | XprType & | *xpr*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *startRow*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *startCol* | | | ) | | | | inline | Fixed-size constructor Block() [3/3] ------------- template<typename XprType , int BlockRows, int BlockCols, bool InnerPanel> | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Block](classeigen_1_1block)< XprType, BlockRows, BlockCols, InnerPanel >::[Block](classeigen_1_1block) | ( | XprType & | *xpr*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *startRow*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *startCol*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *blockRows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *blockCols* | | | ) | | | | inline | Dynamic-size constructor --- The documentation for this class was generated from the following file:* [Block.h](https://eigen.tuxfamily.org/dox/Block_8h_source.html) eigen3 Eigen::GeneralizedSelfAdjointEigenSolver Eigen::GeneralizedSelfAdjointEigenSolver ======================================== ### template<typename \_MatrixType> class Eigen::GeneralizedSelfAdjointEigenSolver< \_MatrixType > Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | This class solves the generalized eigenvalue problem \( Av = \lambda Bv \). In this case, the matrix \( A \) should be selfadjoint and the matrix \( B \) should be positive definite. Only the **lower** **triangular** **part** of the input matrix is referenced. Call the function [compute()](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023 "Computes generalized eigendecomposition of given matrix pencil.") to compute the eigenvalues and eigenvectors of a given matrix. Alternatively, you can use the [GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int)](classeigen_1_1generalizedselfadjointeigensolver#addc0409c9cb1a5ac9cbbd00efe68908e "Constructor; computes generalized eigendecomposition of given matrix pencil.") constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix.") and [eigenvectors()](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266 "Returns the eigenvectors of given matrix.") functions. The documentation for [GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int)](classeigen_1_1generalizedselfadjointeigensolver#addc0409c9cb1a5ac9cbbd00efe68908e "Constructor; computes generalized eigendecomposition of given matrix pencil.") contains an example of the typical use of this class. See also class [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices."), class [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") | | | --- | | | | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver) & | [compute](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023) (const MatrixType &matA, const MatrixType &matB, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)|[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f)) | | | Computes generalized eigendecomposition of given matrix pencil. [More...](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023) | | | | | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver#a501effdbf722c0609ea05ff3fd4cc721) () | | | Default constructor for fixed-size matrices. [More...](classeigen_1_1generalizedselfadjointeigensolver#a501effdbf722c0609ea05ff3fd4cc721) | | | | | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver#addc0409c9cb1a5ac9cbbd00efe68908e) (const MatrixType &matA, const MatrixType &matB, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)|[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f)) | | | Constructor; computes generalized eigendecomposition of given matrix pencil. [More...](classeigen_1_1generalizedselfadjointeigensolver#addc0409c9cb1a5ac9cbbd00efe68908e) | | | | | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver#aac849f01a8c6148c645acd10bd3a9b0e) ([Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) size) | | | Constructor, pre-allocates memory for dynamic-size matrices. [More...](classeigen_1_1generalizedselfadjointeigensolver#aac849f01a8c6148c645acd10bd3a9b0e) | | | | Public Member Functions inherited from [Eigen::SelfAdjointEigenSolver< \_MatrixType >](classeigen_1_1selfadjointeigensolver) | | template<typename InputType > | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) & | [compute](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Computes eigendecomposition of given matrix. [More...](classeigen_1_1selfadjointeigensolver#adf397f6bce9f93c4b0139a47e261fc24) | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) & | [computeDirect](classeigen_1_1selfadjointeigensolver#afe520161701f5f585bcc4cedb8657bd1) (const MatrixType &matrix, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Computes eigendecomposition of given matrix using a closed-form algorithm. [More...](classeigen_1_1selfadjointeigensolver#afe520161701f5f585bcc4cedb8657bd1) | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) & | [computeFromTridiagonal](classeigen_1_1selfadjointeigensolver#a297893df7098c43278d385e4d4e23fe4) (const [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) &diag, const [SubDiagonalType](classeigen_1_1matrix) &subdiag, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Computes the eigen decomposition from a tridiagonal symmetric matrix. [More...](classeigen_1_1selfadjointeigensolver#a297893df7098c43278d385e4d4e23fe4) | | | | const [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) & | [eigenvalues](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41) () const | | | Returns the eigenvalues of given matrix. [More...](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41) | | | | const [EigenvectorsType](classeigen_1_1matrix) & | [eigenvectors](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266) () const | | | Returns the eigenvectors of given matrix. [More...](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1selfadjointeigensolver#a31e8a509231e57e684c53799693607ae) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1selfadjointeigensolver#a31e8a509231e57e684c53799693607ae) | | | | MatrixType | [operatorInverseSqrt](classeigen_1_1selfadjointeigensolver#ae4b13fe4ce22faf74e50d346fc51a66e) () const | | | Computes the inverse square root of the matrix. [More...](classeigen_1_1selfadjointeigensolver#ae4b13fe4ce22faf74e50d346fc51a66e) | | | | MatrixType | [operatorSqrt](classeigen_1_1selfadjointeigensolver#aeeedb2ae618f21a4eb59465746c1cee5) () const | | | Computes the positive-definite square root of the matrix. [More...](classeigen_1_1selfadjointeigensolver#aeeedb2ae618f21a4eb59465746c1cee5) | | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver#a8f3dde67faa971dd97e8141617762326) () | | | Default constructor for fixed-size matrices. [More...](classeigen_1_1selfadjointeigensolver#a8f3dde67faa971dd97e8141617762326) | | | | template<typename InputType > | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver#a7d8cba55cce60cb3931148208cc5bd0e) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, int options=[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)) | | | Constructor; computes eigendecomposition of given matrix. [More...](classeigen_1_1selfadjointeigensolver#a7d8cba55cce60cb3931148208cc5bd0e) | | | | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver#a825919ee41153a19910c72d1bff31c8e) ([Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) size) | | | Constructor, pre-allocates memory for dynamic-size matrices. [More...](classeigen_1_1selfadjointeigensolver#a825919ee41153a19910c72d1bff31c8e) | | | | | | --- | | | | Public Types inherited from [Eigen::SelfAdjointEigenSolver< \_MatrixType >](classeigen_1_1selfadjointeigensolver) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) | | | | typedef [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f) >::Real | [RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) | | | Real scalar type for `_MatrixType`. [More...](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) | | | | typedef internal::plain\_col\_type< MatrixType, [RealScalar](classeigen_1_1selfadjointeigensolver#a5dae5f422a3c71060e6bd31332bf64fd) >::type | [RealVectorType](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) | | | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix."). [More...](classeigen_1_1selfadjointeigensolver#acd090d5fdfc3cc017a13b6d8daa92287) | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1selfadjointeigensolver#a0bfcedf4245b6846007ca4f01e4feb1f) | | | Scalar type for matrices of type `_MatrixType`. | | | | Static Public Attributes inherited from [Eigen::SelfAdjointEigenSolver< \_MatrixType >](classeigen_1_1selfadjointeigensolver) | | static const int | [m\_maxIterations](classeigen_1_1selfadjointeigensolver#a9ba10b83f095b18dbea345db7304acfa) | | | Maximum number of iterations. [More...](classeigen_1_1selfadjointeigensolver#a9ba10b83f095b18dbea345db7304acfa) | | | GeneralizedSelfAdjointEigenSolver() [1/3] ----------------------------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver)< \_MatrixType >::[GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver) | ( | | ) | | | inline | Default constructor for fixed-size matrices. The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023 "Computes generalized eigendecomposition of given matrix pencil."). This constructor can only be used if `_MatrixType` is a fixed-size matrix; use [GeneralizedSelfAdjointEigenSolver(Index)](classeigen_1_1generalizedselfadjointeigensolver#aac849f01a8c6148c645acd10bd3a9b0e "Constructor, pre-allocates memory for dynamic-size matrices.") for dynamic-size matrices. GeneralizedSelfAdjointEigenSolver() [2/3] ----------------------------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver)< \_MatrixType >::[GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver) | ( | [Index](classeigen_1_1selfadjointeigensolver#a8a59ab7734b6eae2754fd78bc7c3a360) | *size* | ) | | | inlineexplicit | Constructor, pre-allocates memory for dynamic-size matrices. Parameters | | | | | --- | --- | --- | | [in] | size | Positive integer, size of the matrix whose eigenvalues and eigenvectors will be computed. | This constructor is useful for dynamic-size matrices, when the user intends to perform decompositions via [compute()](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023 "Computes generalized eigendecomposition of given matrix pencil."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023 "Computes generalized eigendecomposition of given matrix pencil.") for an example GeneralizedSelfAdjointEigenSolver() [3/3] ----------------------------------------- template<typename \_MatrixType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver)< \_MatrixType >::[GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver) | ( | const MatrixType & | *matA*, | | | | const MatrixType & | *matB*, | | | | int | *options* = `[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)|[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f)` | | | ) | | | | inline | Constructor; computes generalized eigendecomposition of given matrix pencil. Parameters | | | | | --- | --- | --- | | [in] | matA | Selfadjoint matrix in matrix pencil. Only the lower triangular part of the matrix is referenced. | | [in] | matB | Positive-definite matrix in matrix pencil. Only the lower triangular part of the matrix is referenced. | | [in] | options | A or-ed set of flags {[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4),[EigenvaluesOnly](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906)} | {[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f),[ABx\_lx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9a7d9813cec527e299a36b749b0f7e1e),[BAx\_lx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9870817d373c41ba0dc7f6b5ab0895b8)}. Default is [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)|[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f). | This constructor calls [compute(const MatrixType&, const MatrixType&, int)](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023 "Computes generalized eigendecomposition of given matrix pencil.") to compute the eigenvalues and (if requested) the eigenvectors of the generalized eigenproblem \( Ax = \lambda B x \) with *matA* the selfadjoint matrix \( A \) and *matB* the positive definite matrix \( B \). Each eigenvector \( x \) satisfies the property \( x^\* B x = 1 \). The eigenvectors are computed if *options* contains ComputeEigenvectors. In addition, the two following variants can be solved via `options:` * `ABx_lx:` \( ABx = \lambda x \) * `BAx_lx:` \( BAx = \lambda x \) Example: ``` MatrixXd X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric matrix, A:" << endl << A << endl; X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5,5); MatrixXd B = X * X.transpose(); cout << "and a random postive-definite matrix, B:" << endl << B << endl << endl; GeneralizedSelfAdjointEigenSolver<MatrixXd> es(A,B); cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; double lambda = es.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXd v = es.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then A \* v = " << endl << A * v << endl; cout << "... and lambda \* B \* v = " << endl << lambda * B * v << endl << endl; ``` Output: ``` Here is a random symmetric matrix, A: 1.36 -0.816 0.521 1.43 -0.144 -0.816 -0.659 0.794 -0.173 -0.406 0.521 0.794 -0.541 0.461 0.179 1.43 -0.173 0.461 -1.43 0.822 -0.144 -0.406 0.179 0.822 -1.37 and a random postive-definite matrix, B: 0.132 0.0109 -0.0512 0.0674 -0.143 0.0109 1.68 1.13 -1.12 0.916 -0.0512 1.13 2.3 -2.14 1.86 0.0674 -1.12 -2.14 2.69 -2.01 -0.143 0.916 1.86 -2.01 1.68 The eigenvalues of the pencil (A,B) are: -227 -3.9 -0.837 0.101 54.2 The matrix of eigenvectors, V, is: 14.2 -1.03 0.0766 -0.0273 -8.36 0.0546 -0.115 0.729 0.478 0.374 -9.23 0.624 -0.0165 0.499 3.01 7.88 1.3 0.225 0.109 -3.85 20.8 0.805 -0.567 -0.0828 -8.73 Consider the first eigenvalue, lambda = -227 If v is the corresponding eigenvector, then A * v = 22.8 -28.8 19.8 21.9 -25.9 ... and lambda * B * v = 22.8 -28.8 19.8 21.9 -25.9 ``` See also [compute(const MatrixType&, const MatrixType&, int)](classeigen_1_1generalizedselfadjointeigensolver#a724764fe196612b752042692156ed023 "Computes generalized eigendecomposition of given matrix pencil.") compute() --------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver)< MatrixType > & [Eigen::GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver)< MatrixType >::compute | ( | const MatrixType & | *matA*, | | | | const MatrixType & | *matB*, | | | | int | *options* = `[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)|[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f)` | | | ) | | | Computes generalized eigendecomposition of given matrix pencil. Parameters | | | | | --- | --- | --- | | [in] | matA | Selfadjoint matrix in matrix pencil. Only the lower triangular part of the matrix is referenced. | | [in] | matB | Positive-definite matrix in matrix pencil. Only the lower triangular part of the matrix is referenced. | | [in] | options | A or-ed set of flags {[ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4),[EigenvaluesOnly](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906)} | {[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f),[ABx\_lx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9a7d9813cec527e299a36b749b0f7e1e),[BAx\_lx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9870817d373c41ba0dc7f6b5ab0895b8)}. Default is [ComputeEigenvectors](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4)|[Ax\_lBx](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a5eb11a88a4bd445f58f1b24598d3848f). | Returns Reference to `*this` According to `options`, this function computes eigenvalues and (if requested) the eigenvectors of one of the following three generalized eigenproblems: * `Ax_lBx:` \( Ax = \lambda B x \) * `ABx_lx:` \( ABx = \lambda x \) * `BAx_lx:` \( BAx = \lambda x \) with *matA* the selfadjoint matrix \( A \) and *matB* the positive definite matrix \( B \). In addition, each eigenvector \( x \) satisfies the property \( x^\* B x = 1 \). The [eigenvalues()](classeigen_1_1selfadjointeigensolver#a3df8721abcc71132f7f02bf9dfe78e41 "Returns the eigenvalues of given matrix.") function can be used to retrieve the eigenvalues. If `options` contains ComputeEigenvectors, then the eigenvectors are also computed and can be retrieved by calling [eigenvectors()](classeigen_1_1selfadjointeigensolver#a229c4c26d87c5d2663cd3cc8a4c68266 "Returns the eigenvectors of given matrix."). The implementation uses [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") to compute the Cholesky decomposition \( B = LL^\* \) and computes the classical eigendecomposition of the selfadjoint matrix \( L^{-1} A (L^\*)^{-1} \) if `options` contains Ax\_lBx and of \( L^{\*} A L \) otherwise. This solves the generalized eigenproblem, because any solution of the generalized eigenproblem \( Ax = \lambda B x \) corresponds to a solution \( L^{-1} A (L^\*)^{-1} (L^\* x) = \lambda (L^\* x) \) of the eigenproblem for \( L^{-1} A (L^\*)^{-1} \). Similar statements can be made for the two other variants. Example: ``` MatrixXd X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5,5); MatrixXd A = X * X.transpose(); X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5,5); MatrixXd B = X * X.transpose(); GeneralizedSelfAdjointEigenSolver<MatrixXd> es(A,B,[EigenvaluesOnly](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906)); cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; es.compute(B,A,false); cout << "The eigenvalues of the pencil (B,A) are:" << endl << es.eigenvalues() << endl; ``` Output: ``` The eigenvalues of the pencil (A,B) are: 0.0289 0.299 2.11 8.64 2.08e+03 The eigenvalues of the pencil (B,A) are: 0.000481 0.116 0.473 3.34 34.6 ``` See also [GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int)](classeigen_1_1generalizedselfadjointeigensolver#addc0409c9cb1a5ac9cbbd00efe68908e "Constructor; computes generalized eigendecomposition of given matrix pencil.") --- The documentation for this class was generated from the following file:* [GeneralizedSelfAdjointEigenSolver.h](https://eigen.tuxfamily.org/dox/GeneralizedSelfAdjointEigenSolver_8h_source.html)
programming_docs
eigen3 Using STL Containers with Eigen Using STL Containers with Eigen =============================== Executive summary =================== If you're compiling in [c++17] mode only with a sufficiently recent compiler (e.g., GCC>=7, clang>=5, MSVC>=19.12), then everything is taken care by the compiler and you can stop reading. Otherwise, using STL containers on [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable), or classes having members of such types, requires the use of an over-aligned allocator. That is, an allocator capable of allocating buffers with 16, 32, or even 64 bytes alignment. Eigen does provide one ready for use: [aligned\_allocator](classeigen_1_1aligned__allocator "STL compatible allocator to use with types requiring a non standrad alignment."). Prior to [c++11], if you want to use the `std::vector` container, then you also have to `#include <Eigen/StdVector>` . These issues arise only with [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable) and [structures having such Eigen objects as member](group__topicstructhavingeigenmembers). For other Eigen types, such as Vector3f or MatrixXd, no special care is needed when using STL containers. Using an aligned allocator ============================ STL containers take an optional template parameter, the allocator type. When using STL containers on [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable), you need tell the container to use an allocator that will always allocate memory at 16-byte-aligned (or more) locations. Fortunately, Eigen does provide such an allocator: [Eigen::aligned\_allocator](classeigen_1_1aligned__allocator "STL compatible allocator to use with types requiring a non standrad alignment."). For example, instead of ``` std::map<int, Eigen::Vector4d> ``` you need to use ``` std::map<int, Eigen::Vector4d, std::less<int>, [Eigen::aligned\_allocator<std::pair<const int, Eigen::Vector4d>](classeigen_1_1aligned__allocator) > > ``` Note that the third parameter `std::less<int>` is just the default value, but we have to include it because we want to specify the fourth parameter, which is the allocator type. The case of std::vector ========================= This section is for c++98/03 users only. [c++11] (or above) users can stop reading here. So in c++98/03, the situation with `std::vector` is more complicated because of a bug in the standard (explanation below). To workaround the issue, we had to specialize it for the [Eigen::aligned\_allocator](classeigen_1_1aligned__allocator "STL compatible allocator to use with types requiring a non standrad alignment.") type. In practice you **must** use the [Eigen::aligned\_allocator](classeigen_1_1aligned__allocator "STL compatible allocator to use with types requiring a non standrad alignment.") (not another aligned allocator), **and** #include <Eigen/StdVector>. Here is an example: ``` #include<Eigen/StdVector> /\* ... \*/ std::vector<Eigen::Vector4f,Eigen::aligned_allocator<Eigen::Vector4f> > ``` **Explanation:** The `resize()` method of `std::vector` takes a `value_type` argument (defaulting to `value_type()`). So with `std::vector<Eigen::Vector4d>`, some Eigen::Vector4d objects will be passed by value, which discards any alignment modifiers, so a Eigen::Vector4d can be created at an unaligned location. In order to avoid that, the only solution we saw was to specialize `std::vector` to make it work on a slight modification of, here, Eigen::Vector4d, that is able to deal properly with this situation. An alternative - specializing std::vector for Eigen types ----------------------------------------------------------- As an alternative to the recommended approach described above, you have the option to specialize std::vector for [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") types requiring alignment. The advantage is that you won't need to declare std::vector all over with [Eigen::aligned\_allocator](classeigen_1_1aligned__allocator "STL compatible allocator to use with types requiring a non standrad alignment."). One drawback on the other hand side is that the specialization needs to be defined before all code pieces in which e.g. `std::vector<Vector2d>` is used. Otherwise, without knowing the specialization the compiler will compile that particular instance with the default `std::allocator` and you program is most likely to crash. Here is an example: ``` #include<Eigen/StdVector> /\* ... \*/ EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Matrix2d) std::vector<Eigen::Vector2d> ``` eigen3 Eigen::CwiseTernaryOp Eigen::CwiseTernaryOp ===================== ### template<typename TernaryOp, typename Arg1Type, typename Arg2Type, typename Arg3Type> class Eigen::CwiseTernaryOp< TernaryOp, Arg1Type, Arg2Type, Arg3Type > Generic expression where a coefficient-wise ternary operator is applied to two expressions. Template Parameters | | | | --- | --- | | TernaryOp | template functor implementing the operator | | Arg1Type | the type of the first argument | | Arg2Type | the type of the second argument | | Arg3Type | the type of the third argument | This class represents an expression where a coefficient-wise ternary operator is applied to three expressions. It is the return type of ternary operators, by which we mean only those ternary operators where all three arguments are [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") expressions. For example, the return type of betainc(matrix1, matrix2, matrix3) is a [CwiseTernaryOp](classeigen_1_1cwiseternaryop "Generic expression where a coefficient-wise ternary operator is applied to two expressions."). Most of the time, this is the only way that it is used, so you typically don't have to name [CwiseTernaryOp](classeigen_1_1cwiseternaryop "Generic expression where a coefficient-wise ternary operator is applied to two expressions.") types explicitly. See also MatrixBase::ternaryExpr(const MatrixBase<Argument2> &, const MatrixBase<Argument3> &, const CustomTernaryOp &) const, class [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions."), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression."), class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor.") Inherits Eigen::CwiseTernaryOpImpl< TernaryOp, Arg1Type, Arg2Type, Arg3Type, internal::traits< Arg1Type >::StorageKind >, and Eigen::internal::no\_assignment\_operator. | | | --- | | | | const \_Arg1Nested & | [arg1](classeigen_1_1cwiseternaryop#a776de41baf8921bcdba24ec2166f0a3e) () const | | | | const \_Arg2Nested & | [arg2](classeigen_1_1cwiseternaryop#afebd6d4ed4101bcbb34c36f99ff27fda) () const | | | | const \_Arg3Nested & | [arg3](classeigen_1_1cwiseternaryop#a07e6cc21d253ae0bd68913fb65aa8151) () const | | | | const TernaryOp & | [functor](classeigen_1_1cwiseternaryop#a9009f896ee1103c8f28a748e59f12b9a) () const | | | arg1() ------ template<typename TernaryOp , typename Arg1Type , typename Arg2Type , typename Arg3Type > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const \_Arg1Nested& [Eigen::CwiseTernaryOp](classeigen_1_1cwiseternaryop)< TernaryOp, Arg1Type, Arg2Type, Arg3Type >::arg1 | ( | | ) | const | | inline | Returns the first argument nested expression arg2() ------ template<typename TernaryOp , typename Arg1Type , typename Arg2Type , typename Arg3Type > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const \_Arg2Nested& [Eigen::CwiseTernaryOp](classeigen_1_1cwiseternaryop)< TernaryOp, Arg1Type, Arg2Type, Arg3Type >::arg2 | ( | | ) | const | | inline | Returns the first argument nested expression arg3() ------ template<typename TernaryOp , typename Arg1Type , typename Arg2Type , typename Arg3Type > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const \_Arg3Nested& [Eigen::CwiseTernaryOp](classeigen_1_1cwiseternaryop)< TernaryOp, Arg1Type, Arg2Type, Arg3Type >::arg3 | ( | | ) | const | | inline | Returns the third argument nested expression functor() --------- template<typename TernaryOp , typename Arg1Type , typename Arg2Type , typename Arg3Type > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const TernaryOp& [Eigen::CwiseTernaryOp](classeigen_1_1cwiseternaryop)< TernaryOp, Arg1Type, Arg2Type, Arg3Type >::functor | ( | | ) | const | | inline | Returns the functor representing the ternary operation --- The documentation for this class was generated from the following file:* [CwiseTernaryOp.h](https://eigen.tuxfamily.org/dox/CwiseTernaryOp_8h_source.html) eigen3 Eigen::NestByValue Eigen::NestByValue ================== ### template<typename ExpressionType> class Eigen::NestByValue< ExpressionType > Expression which must be nested by value. Template Parameters | | | | --- | --- | | ExpressionType | the type of the object of which we are requiring nesting-by-value | This class is the return type of [MatrixBase::nestByValue()](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) and most of the time this is the only way it is used. See also [MatrixBase::nestByValue()](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) Inherits internal::dense\_xpr\_base::type. --- The documentation for this class was generated from the following file:* [NestByValue.h](https://eigen.tuxfamily.org/dox/NestByValue_8h_source.html) eigen3 Reshape Reshape ======= Since the version 3.4, Eigen exposes convenient methods to reshape a matrix to another matrix of different sizes or vector. All cases are handled via the DenseBase::reshaped(NRowsType,NColsType) and DenseBase::reshaped() functions. Those functions do not perform in-place reshaping, but instead return a *view* on the input expression. Reshaped 2D views =================== The more general reshaping transformation is handled via: `reshaped(nrows,ncols)`. Here is an example reshaping a 4x4 matrix to a 2x8 one: | Example: | Output: | | --- | --- | | ``` Matrix4i m = [Matrix4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; ``` | ``` Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is m.reshaped(2, 8): 7 6 9 -3 -5 0 -3 9 -2 6 -6 6 1 3 0 9 ``` | By default, the input coefficients are always interpreted in column-major order regardless of the storage order of the input expression. For more control on ordering, compile-time sizes, and automatic size deduction, please see de documentation of DenseBase::reshaped(NRowsType,NColsType) that contains all the details with many examples. 1D linear views ================= A very common usage of reshaping is to create a 1D linear view over a given 2D matrix or expression. In this case, sizes can be deduced and thus omitted as in the following example: | Example: | | --- | | ``` Matrix4i m = [Matrix4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped().transpose():" << endl << m.reshaped().transpose() << endl; cout << "Here is m.reshaped<RowMajor>().transpose(): " << endl << m.reshaped<[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f)>().transpose() << endl; ``` | | Output: | | ``` Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is m.reshaped().transpose(): 7 -2 6 6 9 -6 -3 6 -5 1 0 3 -3 0 9 9 Here is m.reshaped<RowMajor>().transpose(): 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 ``` | This shortcut always returns a column vector and by default input coefficients are always interpreted in column-major order. Again, see the documentation of DenseBase::reshaped() for more control on the ordering. TutorialReshapeInPlace ======================== The above examples create reshaped views, but what about reshaping inplace a given matrix? Of course this task in only conceivable for matrix and arrays having runtime dimensions. In many cases, this can be accomplished via [PlainObjectBase::resize(Index,Index)](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a): | Example: | | --- | | ``` MatrixXi m = [Matrix4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; m.resize(2,8); cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; ``` | | Output: | | ``` Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is m.reshaped(2, 8): 7 6 9 -3 -5 0 -3 9 -2 6 -6 6 1 3 0 9 Here is the matrix m after m.resize(2,8): 7 6 9 -3 -5 0 -3 9 -2 6 -6 6 1 3 0 9 ``` | However beware that unlike `reshaped`, the result of `resize` depends on the input storage order. It thus behaves similarly to `reshaped<AutoOrder>`: | Example: | | --- | | ``` Matrix<int,Dynamic,Dynamic,RowMajor> m = [Matrix4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl; cout << "Here is m.reshaped<AutoOrder>(2, 8):" << endl << m.reshaped<AutoOrder>(2, 8) << endl; m.resize(2,8); cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl; ``` | | Output: | | ``` Here is the matrix m: 7 -2 6 6 9 -6 -3 6 -5 1 0 3 -3 0 9 9 Here is m.reshaped(2, 8): 7 -5 -2 1 6 0 6 3 9 -3 -6 0 -3 9 6 9 Here is m.reshaped<AutoOrder>(2, 8): 7 -2 6 6 9 -6 -3 6 -5 1 0 3 -3 0 9 9 Here is the matrix m after m.resize(2,8): 7 -2 6 6 9 -6 -3 6 -5 1 0 3 -3 0 9 9 ``` | Finally, assigning a reshaped matrix to itself is currently not supported and will result to undefined-behavior because of [aliasing](group__topicaliasing) . The following is forbidden: ``` A = A.reshaped(2,8); ``` This is OK: ``` A = A.reshaped(2,8).eval(); ``` eigen3 Eigen::ArrayXpr Eigen::ArrayXpr =============== The type used to identify an array expression --- The documentation for this struct was generated from the following file:* [Constants.h](https://eigen.tuxfamily.org/dox/Constants_8h_source.html) eigen3 Structures Having Eigen Members Structures Having Eigen Members =============================== Executive Summary =================== If you define a structure having members of [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable), you must ensure that calling operator new on it allocates properly aligned buffers. If you're compiling in [c++17] mode only with a sufficiently recent compiler (e.g., GCC>=7, clang>=5, MSVC>=19.12), then everything is taken care by the compiler and you can stop reading. Otherwise, you have to overload its `operator new` so that it generates properly aligned pointers (e.g., 32-bytes-aligned for Vector4d and AVX). Fortunately, Eigen provides you with a macro `EIGEN_MAKE_ALIGNED_OPERATOR_NEW` that does that for you. What kind of code needs to be changed? ======================================== The kind of code that needs to be changed is this: ``` class Foo { ... [Eigen::Vector2d](classeigen_1_1matrix) v; ... }; ... Foo *foo = new Foo; ``` In other words: you have a class that has as a member a [fixed-size vectorizable Eigen object](group__topicfixedsizevectorizable), and then you dynamically create an object of that class. How should such code be modified? =================================== Very easy, you just need to put a `EIGEN_MAKE_ALIGNED_OPERATOR_NEW` macro in a public part of your class, like this: ``` class Foo { ... [Eigen::Vector4d](classeigen_1_1matrix) v; ... public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; ... Foo *foo = new Foo; ``` This macro makes `new Foo` always return an aligned pointer. In [c++17], this macro is empty. If this approach is too intrusive, see also the [other solutions](group__topicstructhavingeigenmembers#StructHavingEigenMembers_othersolutions). Why is this needed? ===================== OK let's say that your code looks like this: ``` class Foo { ... [Eigen::Vector4d](classeigen_1_1matrix) v; ... }; ... Foo *foo = new Foo; ``` A Eigen::Vector4d consists of 4 doubles, which is 256 bits. This is exactly the size of an AVX register, which makes it possible to use AVX for all sorts of operations on this vector. But AVX instructions (at least the ones that Eigen uses, which are the fast ones) require 256-bit alignment. Otherwise you get a segmentation fault. For this reason, Eigen takes care by itself to require 256-bit alignment for Eigen::Vector4d, by doing two things: * Eigen requires 256-bit alignment for the Eigen::Vector4d's array (of 4 doubles). With [c++11] this is done with the [alignas](https://en.cppreference.com/w/cpp/keyword/alignas) keyword, or compiler's extensions for c++98/03. * Eigen overloads the `operator new` of Eigen::Vector4d so it will always return 256-bit aligned pointers. (removed in [c++17]) Thus, normally, you don't have to worry about anything, Eigen handles alignment of operator new for you... ... except in one case. When you have a `class Foo` like above, and you dynamically allocate a new `Foo` as above, then, since `Foo` doesn't have aligned `operator new`, the returned pointer foo is not necessarily 256-bit aligned. The alignment attribute of the member `v` is then relative to the start of the class `Foo`. If the `foo` pointer wasn't aligned, then `foo->v` won't be aligned either! The solution is to let `class Foo` have an aligned `operator new`, as we showed in the previous section. This explanation also holds for SSE/NEON/MSA/Altivec/VSX targets, which require 16-bytes alignment, and AVX512 which requires 64-bytes alignment for fixed-size objects multiple of 64 bytes (e.g., Eigen::Matrix4d). Should I then put all the members of Eigen types at the beginning of my class? ================================================================================ That's not required. Since Eigen takes care of declaring adequate alignment, all members that need it are automatically aligned relatively to the class. So code like this works fine: ``` class Foo { double x; [Eigen::Vector4d](classeigen_1_1matrix) v; public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; ``` That said, as usual, it is recommended to sort the members so that alignment does not waste memory. In the above example, with AVX, the compiler will have to reserve 24 empty bytes between `x` and `v`. What about dynamic-size matrices and vectors? =============================================== Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically their own array of coefficients, so they take care of requiring absolute alignment automatically. So they don't cause this issue. The issue discussed here is only with [fixed-size vectorizable matrices and vectors](group__topicfixedsizevectorizable). So is this a bug in Eigen? ============================ No, it's not our bug. It's more like an inherent problem of the c++ language specification that has been solved in c++17 through the feature known as [dynamic memory allocation for over-aligned data](http://wg21.link/p0035r4). What if I want to do this conditionally (depending on template parameters) ? ============================================================================== For this situation, we offer the macro `EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)`. It will generate aligned operators like `EIGEN_MAKE_ALIGNED_OPERATOR_NEW` if `NeedsToAlign` is true. It will generate operators with the default alignment if `NeedsToAlign` is false. In [c++17], this macro is empty. Example: ``` template<int n> class Foo { typedef [Eigen::Matrix<float,n,1>](classeigen_1_1matrix) [Vector](group__matrixtypedefs#ga2623c0d4641dda067fbdb9a009ef0c91); enum { NeedsToAlign = (sizeof([Vector](group__matrixtypedefs#ga2623c0d4641dda067fbdb9a009ef0c91))%16)==0 }; ... [Vector](group__matrixtypedefs#ga2623c0d4641dda067fbdb9a009ef0c91) v; ... public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) }; ... Foo<4> *foo4 = new Foo<4>; // foo4 is guaranteed to be 128bit-aligned Foo<3> *foo3 = new Foo<3>; // foo3 has only the system default alignment guarantee ``` Other solutions ================= In case putting the `EIGEN_MAKE_ALIGNED_OPERATOR_NEW` macro everywhere is too intrusive, there exists at least two other solutions. Disabling alignment --------------------- The first is to disable alignment requirement for the fixed size members: ``` class Foo { ... [Eigen::Matrix<double,4,1,Eigen::DontAlign>](classeigen_1_1matrix) v; ... }; ``` This `v` is fully compatible with aligned Eigen::Vector4d. This has only for effect to make load/stores to `v` more expensive (usually slightly, but that's hardware dependent). Private structure ------------------- The second consist in storing the fixed-size objects into a private struct which will be dynamically allocated at the construction time of the main object: ``` struct Foo_d { EIGEN_MAKE_ALIGNED_OPERATOR_NEW Vector4d v; ... }; struct Foo { Foo() { init_d(); } ~Foo() { delete d; } void bar() { // use d->v instead of v ... } private: void init_d() { d = new Foo_d; } Foo_d* d; }; ``` The clear advantage here is that the class `Foo` remains unchanged regarding alignment issues. The drawback is that an additional heap allocation will be required whatsoever.
programming_docs
eigen3 Understanding Eigen Understanding Eigen =================== * [What happens inside Eigen, on a simple example](topicinsideeigenexample) * [The class hierarchy](topicclasshierarchy) * [Lazy Evaluation and Aliasing](topiclazyevaluation) eigen3 Reductions, visitors and broadcasting Reductions, visitors and broadcasting ===================================== This page explains [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s reductions, visitors and broadcasting and how they are used with [matrices](classeigen_1_1matrixbase) and [arrays](classeigen_1_1arraybase) . Reductions ============ In [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), a reduction is a function taking a matrix or array, and returning a single scalar value. One of the most used reductions is [.sum()](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) , returning the sum of all the coefficients inside a given matrix or array. | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; int main() { [Eigen::Matrix2d](classeigen_1_1matrix) mat; mat << 1, 2, 3, 4; cout << "Here is mat.sum(): " << mat.[sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c)() << endl; cout << "Here is mat.prod(): " << mat.[prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f)() << endl; cout << "Here is mat.mean(): " << mat.[mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7)() << endl; cout << "Here is mat.minCoeff(): " << mat.[minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2)() << endl; cout << "Here is mat.maxCoeff(): " << mat.[maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1)() << endl; cout << "Here is mat.trace(): " << mat.[trace](classeigen_1_1matrixbase#a544b609f65eb2bd3e368b3fc2d79479e)() << endl; } ``` | ``` Here is mat.sum(): 10 Here is mat.prod(): 24 Here is mat.mean(): 2.5 Here is mat.minCoeff(): 1 Here is mat.maxCoeff(): 4 Here is mat.trace(): 5 ``` | The *trace* of a matrix, as returned by the function `trace()`, is the sum of the diagonal coefficients and can equivalently be computed `a.diagonal().sum()`. Norm computations ------------------- The (Euclidean a.k.a. \(\ell^2\)) squared norm of a vector can be obtained [squaredNorm()](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) . It is equal to the dot product of the vector by itself, and equivalently to the sum of squared absolute values of its coefficients. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") also provides the [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) method, which returns the square root of [squaredNorm()](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) . These operations can also operate on matrices; in that case, a n-by-p matrix is seen as a vector of size (n\*p), so for example the [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) method returns the "Frobenius" or "Hilbert-Schmidt" norm. We refrain from speaking of the \(\ell^2\) norm of a matrix because that can mean different things. If you want other coefficient-wise \(\ell^p\) norms, use the [lpNorm<p>()](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35) method. The template parameter *p* can take the special value *Infinity* if you want the \(\ell^\infty\) norm, which is the maximum of the absolute values of the coefficients. The following example demonstrates these methods. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; using namespace [Eigen](namespaceeigen); int main() { VectorXf v(2); MatrixXf m(2,2), n(2,2); v << -1, 2; m << 1,-2, -3,4; cout << "v.squaredNorm() = " << v.squaredNorm() << endl; cout << "v.norm() = " << v.norm() << endl; cout << "v.lpNorm<1>() = " << v.lpNorm<1>() << endl; cout << "v.lpNorm<Infinity>() = " << v.lpNorm<[Infinity](namespaceeigen#a7951593b031e13d90223c83d022ce99e)>() << endl; cout << endl; cout << "m.squaredNorm() = " << m.squaredNorm() << endl; cout << "m.norm() = " << m.norm() << endl; cout << "m.lpNorm<1>() = " << m.lpNorm<1>() << endl; cout << "m.lpNorm<Infinity>() = " << m.lpNorm<[Infinity](namespaceeigen#a7951593b031e13d90223c83d022ce99e)>() << endl; } ``` | ``` v.squaredNorm() = 5 v.norm() = 2.23607 v.lpNorm<1>() = 3 v.lpNorm<Infinity>() = 2 m.squaredNorm() = 30 m.norm() = 5.47723 m.lpNorm<1>() = 10 m.lpNorm<Infinity>() = 4 ``` | **Operator** **norm:** The 1-norm and \(\infty\)-norm [matrix operator norms](https://en.wikipedia.org/wiki/Operator_norm) can easily be computed as follows: | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; int main() { MatrixXf m(2,2); m << 1,-2, -3,4; cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff() << " == " << m.colwise().lpNorm<1>().maxCoeff() << endl; cout << "infty-norm(m) = " << m.cwiseAbs().rowwise().sum().maxCoeff() << " == " << m.rowwise().lpNorm<1>().maxCoeff() << endl; } ``` | ``` 1-norm(m) = 6 == 6 infty-norm(m) = 7 == 7 ``` | See below for more explanations on the syntax of these expressions. Boolean reductions -------------------- The following reductions operate on boolean values: * [all()](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) returns **true** if all of the coefficients in a given [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") evaluate to **true** . * [any()](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) returns **true** if at least one of the coefficients in a given [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") evaluates to **true** . * [count()](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) returns the number of coefficients in a given [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") that evaluate to **true**. These are typically used in conjunction with the coefficient-wise comparison and equality operators provided by [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."). For instance, `array > 0` is an Array of the same size as `array` , with **true** at those positions where the corresponding coefficient of `array` is positive. Thus, `(array > 0).[all()](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)` tests whether all coefficients of `array` are positive. This can be seen in the following example: | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; using namespace [Eigen](namespaceeigen); int main() { ArrayXXf a(2,2); a << 1,2, 3,4; cout << "(a > 0).all() = " << (a > 0).[all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)() << endl; cout << "(a > 0).any() = " << (a > 0).any() << endl; cout << "(a > 0).count() = " << (a > 0).count() << endl; cout << endl; cout << "(a > 2).all() = " << (a > 2).[all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)() << endl; cout << "(a > 2).any() = " << (a > 2).any() << endl; cout << "(a > 2).count() = " << (a > 2).count() << endl; } ``` | ``` (a > 0).all() = 1 (a > 0).any() = 1 (a > 0).count() = 4 (a > 2).all() = 0 (a > 2).any() = 1 (a > 2).count() = 2 ``` | User defined reductions ------------------------- TODO In the meantime you can have a look at the DenseBase::redux() function. Visitors ========== Visitors are useful when one wants to obtain the location of a coefficient inside a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."). The simplest examples are [maxCoeff(&x,&y)](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) and [minCoeff(&x,&y)](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2), which can be used to find the location of the greatest or smallest coefficient in a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."). The arguments passed to a visitor are pointers to the variables where the row and column position are to be stored. These variables should be of type [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) , as shown below: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; using namespace [Eigen](namespaceeigen); int main() { [Eigen::MatrixXf](classeigen_1_1matrix) m(2,2); m << 1, 2, 3, 4; //get location of maximum [MatrixXf::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) maxRow, maxCol; float max = m.maxCoeff(&maxRow, &maxCol); //get location of minimum [MatrixXf::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) minRow, minCol; float min = m.minCoeff(&minRow, &minCol); cout << "Max: " << max << ", at: " << maxRow << "," << maxCol << endl; cout << "Min: " << min << ", at: " << minRow << "," << minCol << endl; } ``` | ``` Max: 4, at: 1,1 Min: 1, at: 0,0 ``` | Both functions also return the value of the minimum or maximum coefficient. Partial reductions ==================== Partial reductions are reductions that can operate column- or row-wise on a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."), applying the reduction operation on each column or row and returning a column or row vector with the corresponding values. Partial reductions are applied with [colwise()](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) or [rowwise()](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) . A simple example is obtaining the maximum of the elements in each column in a given matrix, storing the result in a row vector: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; int main() { [Eigen::MatrixXf](classeigen_1_1matrix) mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Column's maximum: " << std::endl << mat.[colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1)().[maxCoeff](classeigen_1_1vectorwiseop#a6646b584db116c1661b5bb56750bd6f6)() << std::endl; } ``` | ``` Column's maximum: 3 2 7 9 ``` | The same operation can be performed row-wise: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; int main() { [Eigen::MatrixXf](classeigen_1_1matrix) mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Row's maximum: " << std::endl << mat.[rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc)().[maxCoeff](classeigen_1_1vectorwiseop#a6646b584db116c1661b5bb56750bd6f6)() << std::endl; } ``` | ``` Row's maximum: 9 7 ``` | **Note that column-wise operations return a row vector, while row-wise operations return a column vector.** Combining partial reductions with other operations ---------------------------------------------------- It is also possible to use the result of a partial reduction to do further processing. Here is another example that finds the column whose sum of elements is the maximum within a matrix. With column-wise partial reductions this can be coded as: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; using namespace [Eigen](namespaceeigen); int main() { MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; [MatrixXf::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) maxIndex; float maxNorm = mat.[colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1)().[sum](classeigen_1_1vectorwiseop#a7030fc687c24d687ed7cd70733ba611c)().maxCoeff(&maxIndex); std::cout << "Maximum sum at position " << maxIndex << std::endl; std::cout << "The corresponding vector is: " << std::endl; std::cout << mat.col( maxIndex ) << std::endl; std::cout << "And its sum is is: " << maxNorm << std::endl; } ``` | ``` Maximum sum at position 2 The corresponding vector is: 6 7 And its sum is is: 13 ``` | The previous example applies the [sum()](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) reduction on each column though the [colwise()](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) visitor, obtaining a new matrix whose size is 1x4. Therefore, if \[ \mbox{m} = \begin{bmatrix} 1 & 2 & 6 & 9 \\ 3 & 1 & 7 & 2 \end{bmatrix} \] then \[ \mbox{m.colwise().sum()} = \begin{bmatrix} 4 & 3 & 13 & 11 \end{bmatrix} \] The [maxCoeff()](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) reduction is finally applied to obtain the column index where the maximum sum is found, which is the column index 2 (third column) in this case. Broadcasting ============== The concept behind broadcasting is similar to partial reductions, with the difference that broadcasting constructs an expression where a vector (column or row) is interpreted as a matrix by replicating it in one direction. A simple example is to add a certain column vector to each column in a matrix. This can be accomplished with: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; int main() { [Eigen::MatrixXf](classeigen_1_1matrix) mat(2,4); [Eigen::VectorXf](classeigen_1_1matrix) v(2); mat << 1, 2, 6, 9, 3, 1, 7, 2; v << 0, 1; //add v to each column of m mat.[colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1)() += v; std::cout << "Broadcasting result: " << std::endl; std::cout << mat << std::endl; } ``` | ``` Broadcasting result: 1 2 6 9 4 2 8 3 ``` | We can interpret the instruction `mat.colwise() += v` in two equivalent ways. It adds the vector `v` to every column of the matrix. Alternatively, it can be interpreted as repeating the vector `v` four times to form a four-by-two matrix which is then added to `mat:` \[ \begin{bmatrix} 1 & 2 & 6 & 9 \\ 3 & 1 & 7 & 2 \end{bmatrix} + \begin{bmatrix} 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 2 & 6 & 9 \\ 4 & 2 & 8 & 3 \end{bmatrix}. \] The operators `-=`, `+` and `-` can also be used column-wise and row-wise. On arrays, we can also use the operators `*=`, `/=`, `*` and `/` to perform coefficient-wise multiplication and division column-wise or row-wise. These operators are not available on matrices because it is not clear what they would do. If you want multiply column 0 of a matrix `mat` with `v(0)`, column 1 with `v(1)`, and so on, then use `mat = mat * v.asDiagonal()`. It is important to point out that the vector to be added column-wise or row-wise must be of type Vector, and cannot be a [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). If this is not met then you will get compile-time error. This also means that broadcasting operations can only be applied with an object of type Vector, when operating with [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). The same applies for the [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class, where the equivalent for VectorXf is ArrayXf. As always, you should not mix arrays and matrices in the same expression. To perform the same operation row-wise we can do: | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; int main() { [Eigen::MatrixXf](classeigen_1_1matrix) mat(2,4); [Eigen::VectorXf](classeigen_1_1matrix) v(4); mat << 1, 2, 6, 9, 3, 1, 7, 2; v << 0,1,2,3; //add v to each row of m mat.[rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc)() += v.transpose(); std::cout << "Broadcasting result: " << std::endl; std::cout << mat << std::endl; } ``` | ``` Broadcasting result: 1 3 8 12 3 2 9 5 ``` | Combining broadcasting with other operations ---------------------------------------------- Broadcasting can also be combined with other operations, such as [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") or [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") operations, reductions and partial reductions. Now that broadcasting, reductions and partial reductions have been introduced, we can dive into a more advanced example that finds the nearest neighbour of a vector `v` within the columns of matrix `m`. The Euclidean distance will be used in this example, computing the squared Euclidean distance with the partial reduction named [squaredNorm()](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) : | Example: | Output: | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; using namespace [Eigen](namespaceeigen); int main() { [Eigen::MatrixXf](classeigen_1_1matrix) m(2,4); [Eigen::VectorXf](classeigen_1_1matrix) v(2); m << 1, 23, 6, 9, 3, 11, 7, 2; v << 2, 3; [MatrixXf::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index; // find nearest neighbour (m.colwise() - v).colwise().squaredNorm().minCoeff(&index); cout << "Nearest neighbour is column " << index << ":" << endl; cout << m.col(index) << endl; } ``` | ``` Nearest neighbour is column 0: 1 3 ``` | The line that does the job is ``` (m.colwise() - v).colwise().squaredNorm().minCoeff(&index); ``` We will go step by step to understand what is happening: * `m.colwise() - v` is a broadcasting operation, subtracting `v` from each column in `m`. The result of this operation is a new matrix whose size is the same as matrix `m`: \[ \mbox{m.colwise() - v} = \begin{bmatrix} -1 & 21 & 4 & 7 \\ 0 & 8 & 4 & -1 \end{bmatrix} \] * `(m.colwise() - v).colwise().squaredNorm()` is a partial reduction, computing the squared norm column-wise. The result of this operation is a row vector where each coefficient is the squared Euclidean distance between each column in `m` and `v`: \[ \mbox{(m.colwise() - v).colwise().squaredNorm()} = \begin{bmatrix} 1 & 505 & 32 & 50 \end{bmatrix} \] * Finally, `minCoeff(&index)` is used to obtain the index of the column in `m` that is closest to `v` in terms of Euclidean distance. eigen3 Extending MatrixBase Extending MatrixBase ==================== In this section we will see how to add custom methods to [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."). Since all expressions and matrix types inherit [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."), adding a method to [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") make it immediately available to all expressions ! A typical use case is, for instance, to make [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") compatible with another API. You certainly know that in C++ it is not possible to add methods to an existing class. So how that's possible ? Here the trick is to include in the declaration of [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") a file defined by the preprocessor token `EIGEN_MATRIXBASE_PLUGIN:` ``` class MatrixBase { // ... #ifdef EIGEN\_MATRIXBASE\_PLUGIN #include EIGEN\_MATRIXBASE\_PLUGIN #endif }; ``` Therefore to extend [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") with your own methods you just have to create a file with your method declaration and define EIGEN\_MATRIXBASE\_PLUGIN before you include any [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s header file. You can extend many of the other classes used in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") by defining similarly named preprocessor symbols. For instance, define `EIGEN_ARRAYBASE_PLUGIN` if you want to extend the [ArrayBase](classeigen_1_1arraybase "Base class for all 1D and 2D array, and related expressions.") class. A full list of classes that can be extended in this way and the corresponding preprocessor symbols can be found on our page [Preprocessor directives](topicpreprocessordirectives). Here is an example of an extension file for adding methods to [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."): **MatrixBaseAddons.h** ``` inline Scalar at(uint i, uint j) const { return this->operator()(i,j); } inline Scalar& at(uint i, uint j) { return this->operator()(i,j); } inline Scalar at(uint i) const { return this->operator[](i); } inline Scalar& at(uint i) { return this->operator[](i); } inline RealScalar squaredLength() const { return squaredNorm(); } inline RealScalar length() const { return norm(); } inline RealScalar invLength(void) const { return fast_inv_sqrt(squaredNorm()); } template<typename OtherDerived> inline Scalar squaredDistanceTo(const MatrixBase<OtherDerived>& other) const { return (derived() - other.derived()).squaredNorm(); } template<typename OtherDerived> inline RealScalar distanceTo(const MatrixBase<OtherDerived>& other) const { return internal::sqrt(derived().squaredDistanceTo(other)); } inline void scaleTo(RealScalar l) { RealScalar vl = norm(); if (vl>1e-9) derived() *= (l/vl); } inline Transpose<Derived> transposed() {return this->transpose();} inline const Transpose<Derived> transposed() const {return this->transpose();} inline uint minComponentId(void) const { int i; this->minCoeff(&i); return i; } inline uint maxComponentId(void) const { int i; this->maxCoeff(&i); return i; } template<typename OtherDerived> void makeFloor(const MatrixBase<OtherDerived>& other) { derived() = derived().cwiseMin(other.derived()); } template<typename OtherDerived> void makeCeil(const MatrixBase<OtherDerived>& other) { derived() = derived().cwiseMax(other.derived()); } const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const Derived, const ConstantReturnType> operator+(const Scalar& scalar) const { return CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const Derived, const ConstantReturnType>(derived(), Constant(rows(),cols(),scalar)); } friend const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ConstantReturnType, Derived> operator+(const Scalar& scalar, const MatrixBase<Derived>& mat) { return CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ConstantReturnType, Derived>(Constant(rows(),cols(),scalar), mat.derived()); } ``` Then one can the following declaration in the config.h or whatever prerequisites header file of his project: ``` #define EIGEN\_MATRIXBASE\_PLUGIN "MatrixBaseAddons.h" ```
programming_docs
eigen3 Eigen::CholmodBase Eigen::CholmodBase ================== ### template<typename \_MatrixType, int \_UpLo, typename Derived> class Eigen::CholmodBase< \_MatrixType, \_UpLo, Derived > The base class for the direct Cholesky factorization of Cholmod. See also class [CholmodSupernodalLLT](classeigen_1_1cholmodsupernodalllt "A supernodal Cholesky (LLT) factorization and solver based on Cholmod."), class [CholmodSimplicialLDLT](classeigen_1_1cholmodsimplicialldlt "A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod."), class [CholmodSimplicialLLT](classeigen_1_1cholmodsimplicialllt "A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod.") | | | --- | | | | void | [analyzePattern](classeigen_1_1cholmodbase#a5ac967e9f4ccfc43ca9e610b89232c24) (const MatrixType &matrix) | | | | cholmod\_common & | [cholmod](classeigen_1_1cholmodbase#a6a85bf52d6aa480240a64f277d7f96c6) () | | | | Derived & | [compute](classeigen_1_1cholmodbase#abaf5be01b1e3035a4de0b19f5b63549e) (const MatrixType &matrix) | | | | Scalar | [determinant](classeigen_1_1cholmodbase#ab4ffb4a9735ad7e81a01d5789ce96547) () const | | | | void | [factorize](classeigen_1_1cholmodbase#a5bd9c9ec4d1c15f202a6c66b5e9ef37b) (const MatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) | | | | Scalar | [logDeterminant](classeigen_1_1cholmodbase#a597f7839a39604af18a8741a0d8c46bf) () const | | | | Derived & | [setShift](classeigen_1_1cholmodbase#a886fc102723ca7bde4ac7162dfd72f5d) (const RealScalar &offset) | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | analyzePattern() ---------------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::analyzePattern | ( | const MatrixType & | *matrix* | ) | | | inline | Performs a symbolic decomposition on the sparsity pattern of *matrix*. This function is particularly useful when solving for several problems having the same structure. See also [factorize()](classeigen_1_1cholmodbase#a5bd9c9ec4d1c15f202a6c66b5e9ef37b) cholmod() --------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | cholmod\_common& [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::cholmod | ( | | ) | | | inline | Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations. See the Cholmod user guide for details. compute() --------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Computes the sparse Cholesky decomposition of *matrix* determinant() ------------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::determinant | ( | | ) | const | | inline | Returns the determinant of the underlying matrix from the current factorization factorize() ----------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::factorize | ( | const MatrixType & | *matrix* | ) | | | inline | Performs a numeric decomposition of *matrix* The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. See also [analyzePattern()](classeigen_1_1cholmodbase#a5ac967e9f4ccfc43ca9e610b89232c24) info() ------ template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NumericalIssue` if the matrix.appears to be negative. logDeterminant() ---------------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::logDeterminant | ( | | ) | const | | inline | Returns the log determinant of the underlying matrix from the current factorization setShift() ---------- template<typename \_MatrixType , int \_UpLo, typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::CholmodBase](classeigen_1_1cholmodbase)< \_MatrixType, \_UpLo, Derived >::setShift | ( | const RealScalar & | *offset* | ) | | | inline | Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. During the numerical factorization, an offset term is added to the diagonal coefficients: `d_ii` = *offset* + `d_ii` The default is *offset=0*. Returns a reference to `*this`. --- The documentation for this class was generated from the following file:* [CholmodSupport.h](https://eigen.tuxfamily.org/dox/CholmodSupport_8h_source.html) eigen3 Eigen::FullPivLU Eigen::FullPivLU ================ ### template<typename \_MatrixType> class Eigen::FullPivLU< \_MatrixType > LU decomposition of a matrix with complete pivoting, and related features. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the LU decomposition | This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is decomposed as \( A = P^{-1} L U Q^{-1} \) where L is unit-lower-triangular, U is upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any zeros are at the end. This decomposition provides the generic approach to solving systems of linear equations, computing the rank, invertibility, inverse, kernel, and determinant. This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix, working with the SVD allows to select the smallest singular values of the matrix, something that the LU decomposition doesn't see. The data of the LU decomposition can be directly accessed through the methods [matrixLU()](classeigen_1_1fullpivlu#afea0b8fc707a9097d46fe358cb18bbff), [permutationP()](classeigen_1_1fullpivlu#ad8f1d7266a434c524d3e0dbcc7a0f588), [permutationQ()](classeigen_1_1fullpivlu#a8d18190c7618de271cba7293f0493a36). As an example, here is how the original matrix can be retrieved: ``` typedef Matrix<double, 5, 3> Matrix5x3; typedef Matrix<double, 5, 5> Matrix5x5; Matrix5x3 m = Matrix5x3::Random(); cout << "Here is the matrix m:" << endl << m << endl; [Eigen::FullPivLU<Matrix5x3>](classeigen_1_1fullpivlu) lu(m); cout << "Here is, up to permutations, its LU decomposition matrix:" << endl << lu.matrixLU() << endl; cout << "Here is the L part:" << endl; Matrix5x5 l = Matrix5x5::Identity(); l.block<5,3>(0,0).triangularView<StrictlyLower>() = lu.matrixLU(); cout << l << endl; cout << "Here is the U part:" << endl; Matrix5x3 u = lu.matrixLU().triangularView<[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>(); cout << u << endl; cout << "Let us now reconstruct the original matrix m:" << endl; cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl; ``` Output: ``` Here is the matrix m: 0.68 -0.605 -0.0452 -0.211 -0.33 0.258 0.566 0.536 -0.27 0.597 -0.444 0.0268 0.823 0.108 0.904 Here is, up to permutations, its LU decomposition matrix: 0.904 0.823 0.108 -0.299 0.812 0.569 -0.05 0.888 -1.1 0.0296 0.705 0.768 0.285 -0.549 0.0436 Here is the L part: 1 0 0 0 0 -0.299 1 0 0 0 -0.05 0.888 1 0 0 0.0296 0.705 0.768 1 0 0.285 -0.549 0.0436 0 1 Here is the U part: 0.904 0.823 0.108 0 0.812 0.569 0 0 -1.1 0 0 0 0 0 0 Let us now reconstruct the original matrix m: 0.68 -0.605 -0.0452 -0.211 -0.33 0.258 0.566 0.536 -0.27 0.597 -0.444 0.0268 0.823 0.108 0.904 ``` This class supports the [inplace decomposition](group__inplacedecomposition) mechanism. See also [MatrixBase::fullPivLu()](classeigen_1_1matrixbase#a25da97d31acab0ee5d9d13bdbb0569da), [MatrixBase::determinant()](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061), [MatrixBase::inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) | | | --- | | | | template<typename InputType > | | [FullPivLU](classeigen_1_1fullpivlu) & | [compute](classeigen_1_1fullpivlu#a0a3c3b1bbafa31a03567a4573ebabc79) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | | internal::traits< MatrixType >::Scalar | [determinant](classeigen_1_1fullpivlu#a71654e5c60a26407ecccfaa5b34bb0aa) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [dimensionOfKernel](classeigen_1_1fullpivlu#a64e191225834e91161ea53ad4b78167b) () const | | | | | [FullPivLU](classeigen_1_1fullpivlu#af225528d1c6e623a2b1dce091907d13e) () | | | Default Constructor. [More...](classeigen_1_1fullpivlu#af225528d1c6e623a2b1dce091907d13e) | | | | template<typename InputType > | | | [FullPivLU](classeigen_1_1fullpivlu#a31a6a984478a9f721f367667fe4c5ab1) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | | template<typename InputType > | | | [FullPivLU](classeigen_1_1fullpivlu#a3e903b9f401e3fc5d1ca7c6951c76185) ([EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Constructs a LU factorization from a given matrix. [More...](classeigen_1_1fullpivlu#a3e903b9f401e3fc5d1ca7c6951c76185) | | | | | [FullPivLU](classeigen_1_1fullpivlu#ae83ebd2a24088f04e3ac835b0dc001e1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | Default Constructor with memory preallocation. [More...](classeigen_1_1fullpivlu#ae83ebd2a24088f04e3ac835b0dc001e1) | | | | const internal::image\_retval< [FullPivLU](classeigen_1_1fullpivlu) > | [image](classeigen_1_1fullpivlu#a0893985d2dab367baa6e57c6fd0c4956) (const MatrixType &originalMatrix) const | | | | const [Inverse](classeigen_1_1inverse)< [FullPivLU](classeigen_1_1fullpivlu) > | [inverse](classeigen_1_1fullpivlu#ae6f4bb55f859f6353f99cf15ecff4b25) () const | | | | bool | [isInjective](classeigen_1_1fullpivlu#ab13992c852aa593461d9b81790b56667) () const | | | | bool | [isInvertible](classeigen_1_1fullpivlu#afdf2579c93473650f2ef2a47a376c4a0) () const | | | | bool | [isSurjective](classeigen_1_1fullpivlu#a1f6222875fc3a181ee1544b9b36dfda5) () const | | | | const internal::kernel\_retval< [FullPivLU](classeigen_1_1fullpivlu) > | [kernel](classeigen_1_1fullpivlu#a70f52eeb2cd07dfbf790fce106fb4015) () const | | | | const MatrixType & | [matrixLU](classeigen_1_1fullpivlu#afea0b8fc707a9097d46fe358cb18bbff) () const | | | | RealScalar | [maxPivot](classeigen_1_1fullpivlu#abced9f280f5fc49c2e62605c782b237b) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonzeroPivots](classeigen_1_1fullpivlu#aa71132a751ad3c78178e33d6b2987400) () const | | | | const [PermutationPType](classeigen_1_1permutationmatrix) & | [permutationP](classeigen_1_1fullpivlu#ad8f1d7266a434c524d3e0dbcc7a0f588) () const | | | | const [PermutationQType](classeigen_1_1permutationmatrix) & | [permutationQ](classeigen_1_1fullpivlu#a8d18190c7618de271cba7293f0493a36) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rank](classeigen_1_1fullpivlu#a67a870aa69e699e058d04802ba0bdad9) () const | | | | RealScalar | [rcond](classeigen_1_1fullpivlu#a0bc63f910960dc3e35acecc8442025b6) () const | | | | MatrixType | [reconstructedMatrix](classeigen_1_1fullpivlu#a191a4f598b0c192a83ab48984e87ee51) () const | | | | [FullPivLU](classeigen_1_1fullpivlu) & | [setThreshold](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681) (const RealScalar &[threshold](classeigen_1_1fullpivlu#ad77539203694f2d85ff7d11616e5a0a5)) | | | | [FullPivLU](classeigen_1_1fullpivlu) & | [setThreshold](classeigen_1_1fullpivlu#a1b5e30add3dfb6625da1213d68418f44) (Default\_t) | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< [FullPivLU](classeigen_1_1fullpivlu), Rhs > | [solve](classeigen_1_1fullpivlu#af563471f6f3283fd10779ef02dd0b748) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | RealScalar | [threshold](classeigen_1_1fullpivlu#ad77539203694f2d85ff7d11616e5a0a5) () const | | | | Public Member Functions inherited from [Eigen::SolverBase< FullPivLU< \_MatrixType > >](classeigen_1_1solverbase) | | AdjointReturnType | [adjoint](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) () const | | | | [FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType > & | [derived](classeigen_1_1solverbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType > & | [derived](classeigen_1_1solverbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | const [Solve](classeigen_1_1solve)< [FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >, Rhs > | [solve](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | | [SolverBase](classeigen_1_1solverbase#a4d5e5baddfba3790ab1a5f247dcc4dc1) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | FullPivLU() [1/4] ----------------- template<typename MatrixType > | | | --- | | [Eigen::FullPivLU](classeigen_1_1fullpivlu)< MatrixType >::[FullPivLU](classeigen_1_1fullpivlu) | Default Constructor. The default constructor is useful in cases in which the user intends to perform decompositions via LU::compute(const MatrixType&). FullPivLU() [2/4] ----------------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [Eigen::FullPivLU](classeigen_1_1fullpivlu)< MatrixType >::[FullPivLU](classeigen_1_1fullpivlu) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | Default Constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem *size*. See also [FullPivLU()](classeigen_1_1fullpivlu#af225528d1c6e623a2b1dce091907d13e "Default Constructor.") FullPivLU() [3/4] ----------------- template<typename MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::FullPivLU](classeigen_1_1fullpivlu)< MatrixType >::[FullPivLU](classeigen_1_1fullpivlu) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | explicit | Constructor. Parameters | | | | --- | --- | | matrix | the matrix of which to compute the LU decomposition. It is required to be nonzero. | FullPivLU() [4/4] ----------------- template<typename MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::FullPivLU](classeigen_1_1fullpivlu)< MatrixType >::[FullPivLU](classeigen_1_1fullpivlu) | ( | [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | explicit | Constructs a LU factorization from a given matrix. This overloaded constructor is provided for [inplace decomposition](group__inplacedecomposition) when `MatrixType` is a [Eigen::Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression."). See also FullPivLU(const EigenBase&) compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivLU](classeigen_1_1fullpivlu)& [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inline | Computes the LU decomposition of the given matrix. Parameters | | | | --- | --- | | matrix | the matrix of which to compute the LU decomposition. It is required to be nonzero. | Returns a reference to \*this determinant() ------------- template<typename MatrixType > | | | --- | | internal::traits< MatrixType >::Scalar [Eigen::FullPivLU](classeigen_1_1fullpivlu)< MatrixType >::determinant | Returns the determinant of the matrix of which \*this is the LU decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the LU decomposition has already been computed. Note This is only for square matrices. For fixed-size matrices of size up to 4, [MatrixBase::determinant()](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) offers optimized paths. Warning a determinant can be very big or small, so for matrices of large enough dimension, there is a risk of overflow/underflow. See also [MatrixBase::determinant()](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) dimensionOfKernel() ------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::dimensionOfKernel | ( | | ) | const | | inline | Returns the dimension of the kernel of the matrix of which \*this is the LU decomposition. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). image() ------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const internal::image\_retval<[FullPivLU](classeigen_1_1fullpivlu)> [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::image | ( | const MatrixType & | *originalMatrix* | ) | const | | inline | Returns the image of the matrix, also called its column-space. The columns of the returned matrix will form a basis of the image (column-space). Parameters | | | | --- | --- | | originalMatrix | the original matrix, of which \*this is the LU decomposition. The reason why it is needed to pass it here, is that this allows a large optimization, as otherwise this method would need to reconstruct it from the LU decomposition. | Note If the image has dimension zero, then the returned matrix is a column-vector filled with zeros. This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). Example: ``` Matrix3d m; m << 1,1,0, 1,3,2, 0,1,1; cout << "Here is the matrix m:" << endl << m << endl; cout << "Notice that the middle column is the sum of the two others, so the " << "columns are linearly dependent." << endl; cout << "Here is a matrix whose columns have the same span but are linearly independent:" << endl << m.fullPivLu().image(m) << endl; ``` Output: ``` Here is the matrix m: 1 1 0 1 3 2 0 1 1 Notice that the middle column is the sum of the two others, so the columns are linearly dependent. Here is a matrix whose columns have the same span but are linearly independent: 1 1 3 1 1 0 ``` See also [kernel()](classeigen_1_1fullpivlu#a70f52eeb2cd07dfbf790fce106fb4015) inverse() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Inverse](classeigen_1_1inverse)<[FullPivLU](classeigen_1_1fullpivlu)> [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::inverse | ( | | ) | const | | inline | Returns the inverse of the matrix of which \*this is the LU decomposition. Note If this matrix is not invertible, the returned matrix has undefined coefficients. Use [isInvertible()](classeigen_1_1fullpivlu#afdf2579c93473650f2ef2a47a376c4a0) to first determine whether this matrix is invertible. See also [MatrixBase::inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) isInjective() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::isInjective | ( | | ) | const | | inline | Returns true if the matrix of which \*this is the LU decomposition represents an injective linear map, i.e. has trivial kernel; false otherwise. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). isInvertible() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::isInvertible | ( | | ) | const | | inline | Returns true if the matrix of which \*this is the LU decomposition is invertible. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). isSurjective() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::isSurjective | ( | | ) | const | | inline | Returns true if the matrix of which \*this is the LU decomposition represents a surjective linear map; false otherwise. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). kernel() -------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::kernel\_retval<[FullPivLU](classeigen_1_1fullpivlu)> [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::kernel | ( | | ) | const | | inline | Returns the kernel of the matrix, also called its null-space. The columns of the returned matrix will form a basis of the kernel. Note If the kernel has dimension zero, then the returned matrix is a column-vector filled with zeros. This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). Example: ``` MatrixXf m = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,5); cout << "Here is the matrix m:" << endl << m << endl; MatrixXf ker = m.fullPivLu().kernel(); cout << "Here is a matrix whose columns form a basis of the kernel of m:" << endl << ker << endl; cout << "By definition of the kernel, m\*ker is zero:" << endl << m*ker << endl; ``` Output: ``` Here is the matrix m: 0.68 0.597 -0.33 0.108 -0.27 -0.211 0.823 0.536 -0.0452 0.0268 0.566 -0.605 -0.444 0.258 0.904 Here is a matrix whose columns form a basis of the kernel of m: -0.219 0.763 0.00335 -0.447 0 1 1 0 -0.145 -0.285 By definition of the kernel, m*ker is zero: 7.45e-09 1.49e-08 -1.86e-09 -4.05e-08 0 -2.98e-08 ``` See also [image()](classeigen_1_1fullpivlu#a0893985d2dab367baa6e57c6fd0c4956) matrixLU() ---------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::matrixLU | ( | | ) | const | | inline | Returns the LU decomposition matrix: the upper-triangular part is U, the unit-lower-triangular part is L (at least for square matrices; in the non-square case, special care is needed, see the documentation of class [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features.")). See also matrixL(), matrixU() maxPivot() ---------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::maxPivot | ( | | ) | const | | inline | Returns the absolute value of the biggest pivot, i.e. the biggest diagonal coefficient of U. nonzeroPivots() --------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::nonzeroPivots | ( | | ) | const | | inline | Returns the number of nonzero pivots in the LU decomposition. Here nonzero is meant in the exact sense, not in a fuzzy sense. So that notion isn't really intrinsically interesting, but it is still useful when implementing algorithms. See also [rank()](classeigen_1_1fullpivlu#a67a870aa69e699e058d04802ba0bdad9) permutationP() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [PermutationPType](classeigen_1_1permutationmatrix)& [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::permutationP | ( | | ) | const | | inline | Returns the permutation matrix P See also [permutationQ()](classeigen_1_1fullpivlu#a8d18190c7618de271cba7293f0493a36) permutationQ() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [PermutationQType](classeigen_1_1permutationmatrix)& [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::permutationQ | ( | | ) | const | | inline | Returns the permutation matrix Q See also [permutationP()](classeigen_1_1fullpivlu#ad8f1d7266a434c524d3e0dbcc7a0f588) rank() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::rank | ( | | ) | const | | inline | Returns the rank of the matrix of which \*this is the LU decomposition. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). rcond() ------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::rcond | ( | | ) | const | | inline | Returns an estimate of the reciprocal condition number of the matrix of which `*this` is the LU decomposition. reconstructedMatrix() --------------------- template<typename MatrixType > | | | --- | | MatrixType [Eigen::FullPivLU](classeigen_1_1fullpivlu)< MatrixType >::reconstructedMatrix | Returns the matrix represented by the decomposition, i.e., it returns the product: \( P^{-1} L U Q^{-1} \). This function is provided for debug purposes. setThreshold() [1/2] -------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivLU](classeigen_1_1fullpivlu)& [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::setThreshold | ( | const RealScalar & | *threshold* | ) | | | inline | Allows to prescribe a threshold to be used by certain methods, such as [rank()](classeigen_1_1fullpivlu#a67a870aa69e699e058d04802ba0bdad9), who need to determine when pivots are to be considered nonzero. This is not used for the LU decomposition itself. When it needs to get the threshold value, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") calls [threshold()](classeigen_1_1fullpivlu#ad77539203694f2d85ff7d11616e5a0a5). By default, this uses a formula to automatically determine a reasonable threshold. Once you have called the present method [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681), your value is used instead. Parameters | | | | --- | --- | | threshold | The new value to use as the threshold. | A pivot will be considered nonzero if its absolute value is strictly greater than \( \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \) where maxpivot is the biggest pivot. If you want to come back to the default behavior, call [setThreshold(Default\_t)](classeigen_1_1fullpivlu#a1b5e30add3dfb6625da1213d68418f44) setThreshold() [2/2] -------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivLU](classeigen_1_1fullpivlu)& [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::setThreshold | ( | Default\_t | | ) | | | inline | Allows to come back to the default behavior, letting [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") use its default formula for determining the threshold. You should pass the special object Eigen::Default as parameter here. ``` lu.setThreshold(Eigen::Default); ``` See the documentation of [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). solve() ------- template<typename \_MatrixType > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<[FullPivLU](classeigen_1_1fullpivlu), Rhs> [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *b* | ) | const | | inline | Returns a solution x to the equation Ax=b, where A is the matrix of which \*this is the LU decomposition. Parameters | | | | --- | --- | | b | the right-hand-side of the equation to solve. Can be a vector or a matrix, the only requirement in order for the equation to make sense is that b.rows()==A.rows(), where A is the matrix of which \*this is the LU decomposition. | Returns a solution. This method just tries to find as good a solution as possible. If you want to check whether a solution exists or if it is accurate, just call this function to get a result and then compute the error of this result, or use [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) directly, for instance like this: ``` bool a_solution_exists = (A*result).isApprox(b, precision); ``` This method avoids dividing by zero, so that the non-existence of a solution doesn't by itself mean that you'll get `inf` or `nan` values. If there exists more than one solution, this method will arbitrarily choose one. If you need a complete analysis of the space of solutions, take the one solution obtained by this method and add to it elements of the kernel, as determined by [kernel()](classeigen_1_1fullpivlu#a70f52eeb2cd07dfbf790fce106fb4015). Example: ``` Matrix<float,2,3> m = [Matrix<float,2,3>::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); Matrix2f y = [Matrix2f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix<float,3,2> x = m.fullPivLu().solve(y); if((m*x).isApprox(y)) { cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; } else cout << "The equation mx=y does not have any solution." << endl; ``` Output: ``` Here is the matrix m: 0.68 0.566 0.823 -0.211 0.597 -0.605 Here is the matrix y: -0.33 -0.444 0.536 0.108 Here is a solution x to the equation mx=y: 0 0 0.291 -0.216 -0.6 -0.391 ``` See also TriangularView::solve(), [kernel()](classeigen_1_1fullpivlu#a70f52eeb2cd07dfbf790fce106fb4015), [inverse()](classeigen_1_1fullpivlu#ae6f4bb55f859f6353f99cf15ecff4b25) threshold() ----------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::FullPivLU](classeigen_1_1fullpivlu)< \_MatrixType >::threshold | ( | | ) | const | | inline | Returns the threshold that will be used by certain methods such as [rank()](classeigen_1_1fullpivlu#a67a870aa69e699e058d04802ba0bdad9). See the documentation of [setThreshold(const RealScalar&)](classeigen_1_1fullpivlu#a414592d82de98f5bd075965caf56d681). --- The documentation for this class was generated from the following file:* [FullPivLU.h](https://eigen.tuxfamily.org/dox/FullPivLU_8h_source.html)
programming_docs
eigen3 Eigen::Quaternion Eigen::Quaternion ================= ### template<typename \_Scalar, int \_Options> class Eigen::Quaternion< \_Scalar, \_Options > The quaternion class used to represent 3D orientations and rotations. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the coefficients | | \_Options | controls the memory alignment of the coefficients. Can be # AutoAlign or # DontAlign. Default is AutoAlign. | This class represents a quaternion \( w+xi+yj+zk \) that is a convenient representation of orientations and rotations of objects in three dimensions. Compared to other representations like Euler angles or 3x3 matrices, quaternions offer the following advantages: * **compact** storage (4 scalars) * **efficient** to compose (28 flops), * **stable** spherical interpolation The following two typedefs are provided for convenience: * `Quaternionf` for `float` * `Quaterniond` for `double` Warning Operations interpreting the quaternion as rotation have undefined behavior if the quaternion is not normalized. See also class [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis."), class [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") | | | --- | | | | template<typename Derived1 , typename Derived2 > | | [Quaternion](classeigen_1_1quaternion)< Scalar, Options > | [FromTwoVectors](classeigen_1_1quaternion#acdb1eb44eb733b24749bc7892badde64) (const [MatrixBase](classeigen_1_1matrixbase)< Derived1 > &a, const [MatrixBase](classeigen_1_1matrixbase)< Derived2 > &b) | | | | | [Quaternion](classeigen_1_1quaternion#abf659c4044ea281b399ca2e3420d710a) () | | | | | [Quaternion](classeigen_1_1quaternion#a8a827dc86c80446a77eebba0e8a9e3e4) (const [AngleAxisType](classeigen_1_1angleaxis) &aa) | | | | template<typename Derived > | | | [Quaternion](classeigen_1_1quaternion#aba694e0bbafcf5554b77cfe8ce69c14a) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &other) | | | | template<typename OtherScalar , int OtherOptions> | | | [Quaternion](classeigen_1_1quaternion#a966673475496b60ea5ccdd0ed07249da) (const [Quaternion](classeigen_1_1quaternion)< OtherScalar, OtherOptions > &other) | | | | template<class Derived > | | | [Quaternion](classeigen_1_1quaternion#a1e8d6929381eca05005fa77e0bf92400) (const [QuaternionBase](classeigen_1_1quaternionbase)< Derived > &other) | | | | | [Quaternion](classeigen_1_1quaternion#ad30f4da9a2c0c8dd95520ee8a6d14ef6) (const Scalar &[w](classeigen_1_1quaternionbase#ab5eae91bedac0afaab0074cec5e535bc), const Scalar &[x](classeigen_1_1quaternionbase#afdd8e260d5de861a6136cb9e6ceaa4b4), const Scalar &[y](classeigen_1_1quaternionbase#aad37efca5d9fde3f4cb03a208f38d74f), const Scalar &[z](classeigen_1_1quaternionbase#a8389b65a61aa3fc76d3ba4bd4a63e529)) | | | | | [Quaternion](classeigen_1_1quaternion#af8c298da20d235d1c8029b73acbef6f9) (const Scalar \*data) | | | | Public Member Functions inherited from [Eigen::QuaternionBase< Quaternion< \_Scalar, \_Options > >](classeigen_1_1quaternionbase) | | [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) | [\_transformVector](classeigen_1_1quaternionbase#aabef1f6fc62535f6f85d590108915ee8) (const [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) &v) const | | | | internal::traits< [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [angularDistance](classeigen_1_1quaternionbase#a74f13d7c853484996494c26c633ae02a) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | internal::cast\_return\_type< [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >, [Quaternion](classeigen_1_1quaternion)< NewScalarType > >::type | [cast](classeigen_1_1quaternionbase#a951d627764be63ca1e8c2c4c7315e43f) () const | | | | internal::traits< [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > >::Coefficients & | [coeffs](classeigen_1_1quaternionbase#ae61294790c0cc308d3f69690a657672c) () | | | | const internal::traits< [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > >::Coefficients & | [coeffs](classeigen_1_1quaternionbase#a193e79f616335a0067e3e784c7cf85fa) () const | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [conjugate](classeigen_1_1quaternionbase#a5e63b775d0a93161ce6137ec0a17f6b0) () const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [dot](classeigen_1_1quaternionbase#aa2d22c5b321c9539dd625ca415422236) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [inverse](classeigen_1_1quaternionbase#ab12ee41b3b06adc3062217a795a6a9f5) () const | | | | bool | [isApprox](classeigen_1_1quaternionbase#a64bc41c96a9e99567e0f8409f8f0f680) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) >::dummy\_precision()) const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [norm](classeigen_1_1quaternionbase#aad4b1faef1eabdc7fdd4d305e9881149) () const | | | | void | [normalize](classeigen_1_1quaternionbase#a7a487a8a129b46be562f42044102c1f8) () | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [normalized](classeigen_1_1quaternionbase#ade799f18b7ec19c02ddae3a4921fa8a0) () const | | | | bool | [operator!=](classeigen_1_1quaternionbase#a530edf22f03853cd07ba829ea0d505dc) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< typename internal::traits< [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [operator\*](classeigen_1_1quaternionbase#afdf1dc395c1cff6716ec9b80fd15b414) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > & | [operator\*=](classeigen_1_1quaternionbase#afd8ee6b6420fbdd22fab7cd016212441) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &q) | | | | [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > & | [operator=](classeigen_1_1quaternionbase#aa7c114c6e62a37d4fc53b6e82ed78eac) (const [AngleAxisType](classeigen_1_1quaternionbase#aed266c63b10a4028304901d9c8614199) &aa) | | | | [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > & | [operator=](classeigen_1_1quaternionbase#a20a6702c9da3fc2950178d920d0aaf84) (const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &xpr) | | | | bool | [operator==](classeigen_1_1quaternionbase#ad206c9014409c06970884dbfc00e6c3c) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > & | [setFromTwoVectors](classeigen_1_1quaternionbase#a7ae84bfbcc9f3f19f10294496a836bee) (const [MatrixBase](classeigen_1_1matrixbase)< Derived1 > &a, const [MatrixBase](classeigen_1_1matrixbase)< Derived2 > &b) | | | | [QuaternionBase](classeigen_1_1quaternionbase) & | [setIdentity](classeigen_1_1quaternionbase#a4695b0f6eebfb217ae2fbd579ceda24a) () | | | | [Quaternion](classeigen_1_1quaternion)< typename internal::traits< [Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [slerp](classeigen_1_1quaternionbase#ac840bde67d22f2deca330561c65d144e) (const [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) &t, const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [squaredNorm](classeigen_1_1quaternionbase#a09730db4ef0b546f5cf29f6b180b3c87) () const | | | | [Matrix3](classeigen_1_1quaternionbase#ac3972e6cb0f56cccbe9e3946a7e494f8) | [toRotationMatrix](classeigen_1_1quaternionbase#a8cf07ab9875baba2eecdd62ff93bfc3f) () const | | | | [VectorBlock](classeigen_1_1vectorblock)< Coefficients, 3 > | [vec](classeigen_1_1quaternionbase#a91f93bde88f52796cfcd92c3594f39e5) () | | | | const [VectorBlock](classeigen_1_1vectorblock)< const Coefficients, 3 > | [vec](classeigen_1_1quaternionbase#ada8bdb403471df23511bdc0f227962ea) () const | | | | NonConstCoeffReturnType | [w](classeigen_1_1quaternionbase#ad884cf20a0b0b92bb63ab3fe9d6d6b7f) () | | | | CoeffReturnType | [w](classeigen_1_1quaternionbase#ab5eae91bedac0afaab0074cec5e535bc) () const | | | | NonConstCoeffReturnType | [x](classeigen_1_1quaternionbase#a8b05bac2a1c099b341396f725e85f3b1) () | | | | CoeffReturnType | [x](classeigen_1_1quaternionbase#afdd8e260d5de861a6136cb9e6ceaa4b4) () const | | | | NonConstCoeffReturnType | [y](classeigen_1_1quaternionbase#a6005245a72520df258d30af6b5448595) () | | | | CoeffReturnType | [y](classeigen_1_1quaternionbase#aad37efca5d9fde3f4cb03a208f38d74f) () const | | | | NonConstCoeffReturnType | [z](classeigen_1_1quaternionbase#a9afed6a7fa4fcdfbe599d7b5b207fc1b) () | | | | CoeffReturnType | [z](classeigen_1_1quaternionbase#a8389b65a61aa3fc76d3ba4bd4a63e529) () const | | | | Public Member Functions inherited from [Eigen::RotationBase< Derived, \_Dim >](classeigen_1_1rotationbase) | | Derived | [inverse](classeigen_1_1rotationbase#a8532fb716ea4267cf8bbdb99e5e54837) () const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [matrix](classeigen_1_1rotationbase#a91b5bdb1c7b90ec7b33107c6f7d3b171) () const | | | | template<typename OtherDerived > | | internal::rotation\_base\_generic\_product\_selector< Derived, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType | [operator\*](classeigen_1_1rotationbase#a09a4757e7aff7a95bebf4fa8a965a4eb) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &e) const | | | | template<int Mode, int Options> | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode > | [operator\*](classeigen_1_1rotationbase#aaca1c3d834e2bc7ebfd046d96cac990c) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode, Options > &t) const | | | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) > | [operator\*](classeigen_1_1rotationbase#a26d0603783666526a98d08bd45d9c751) (const [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim > &t) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [operator\*](classeigen_1_1rotationbase#a05af64a1bc759c5fed4ff7afd1414ba4) (const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > &s) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [toRotationMatrix](classeigen_1_1rotationbase#a94fe3683c867c39d34505932b07e956a) () const | | | | | | --- | | | | static [Quaternion](classeigen_1_1quaternion) | [UnitRandom](classeigen_1_1quaternion#a7da87cda5567ff1e860782d638643868) () | | | | Static Public Member Functions inherited from [Eigen::QuaternionBase< Quaternion< \_Scalar, \_Options > >](classeigen_1_1quaternionbase) | | static [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [Identity](classeigen_1_1quaternionbase#a6f31a6f98016f186515b3277f4757962) () | | | | | | --- | | | | Public Types inherited from [Eigen::QuaternionBase< Quaternion< \_Scalar, \_Options > >](classeigen_1_1quaternionbase) | | typedef [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [AngleAxisType](classeigen_1_1quaternionbase#aed266c63b10a4028304901d9c8614199) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), 3, 3 > | [Matrix3](classeigen_1_1quaternionbase#ac3972e6cb0f56cccbe9e3946a7e494f8) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), 3, 1 > | [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) | | | | Public Types inherited from [Eigen::RotationBase< Derived, \_Dim >](classeigen_1_1rotationbase) | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Dim > | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | | | Quaternion() [1/7] ------------------ template<typename \_Scalar , int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | | ) | | | inline | Default constructor leaving the quaternion uninitialized. Quaternion() [2/7] ------------------ template<typename \_Scalar , int \_Options> | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | const Scalar & | *w*, | | | | const Scalar & | *x*, | | | | const Scalar & | *y*, | | | | const Scalar & | *z* | | | ) | | | | inline | Constructs and initializes the quaternion \( w+xi+yj+zk \) from its four coefficients *w*, *x*, *y* and *z*. Warning Note the order of the arguments: the real *w* coefficient first, while internally the coefficients are stored in the following order: [`x`, `y`, `z`, `w`] Quaternion() [3/7] ------------------ template<typename \_Scalar , int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | const Scalar \* | *data* | ) | | | inlineexplicit | Constructs and initialize a quaternion from the array data Quaternion() [4/7] ------------------ template<typename \_Scalar , int \_Options> template<class Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | const [QuaternionBase](classeigen_1_1quaternionbase)< Derived > & | *other* | ) | | | inline | Copy constructor Quaternion() [5/7] ------------------ template<typename \_Scalar , int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | const [AngleAxisType](classeigen_1_1angleaxis) & | *aa* | ) | | | inlineexplicit | Constructs and initializes a quaternion from the angle-axis *aa* Quaternion() [6/7] ------------------ template<typename \_Scalar , int \_Options> template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *other* | ) | | | inlineexplicit | Constructs and initializes a quaternion from either: * a rotation matrix expression, * a 4D vector expression representing quaternion coefficients. Quaternion() [7/7] ------------------ template<typename \_Scalar , int \_Options> template<typename OtherScalar , int OtherOptions> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::[Quaternion](classeigen_1_1quaternion) | ( | const [Quaternion](classeigen_1_1quaternion)< OtherScalar, OtherOptions > & | *other* | ) | | | inlineexplicit | Explicit copy constructor with scalar conversion FromTwoVectors() ---------------- template<typename \_Scalar , int \_Options> template<typename Derived1 , typename Derived2 > | | | | | | --- | --- | --- | --- | | [Quaternion](classeigen_1_1quaternion)<Scalar,Options> [Eigen::Quaternion](classeigen_1_1quaternion)< \_Scalar, \_Options >::FromTwoVectors | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived1 > & | *a*, | | | | const [MatrixBase](classeigen_1_1matrixbase)< Derived2 > & | *b* | | | ) | | | Returns a quaternion representing a rotation between the two arbitrary vectors *a* and *b*. In other words, the built rotation represent a rotation sending the line of direction *a* to the line of direction *b*, both lines passing through the origin. Returns resulting quaternion Note that the two input vectors do **not** have to be normalized, and do not need to have the same norm. UnitRandom() ------------ template<typename Scalar , int Options> | | | | | --- | --- | --- | | | | | --- | | [Quaternion](classeigen_1_1quaternion)< Scalar, Options > [Eigen::Quaternion](classeigen_1_1quaternion)< Scalar, Options >::UnitRandom | | static | Returns a random unit quaternion following a uniform distribution law on SO(3) Note The implementation is based on <http://planning.cs.uiuc.edu/node198.html> --- The documentation for this class was generated from the following file:* [Quaternion.h](https://eigen.tuxfamily.org/dox/Quaternion_8h_source.html) eigen3 QR module QR module ========= This module provides various QR decompositions This module also provides some [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") methods, including: * [MatrixBase::householderQr()](classeigen_1_1matrixbase#a9a9377aab1cea26db5f25bab7e682f8f) * [MatrixBase::colPivHouseholderQr()](classeigen_1_1matrixbase#adee8c19c833245bbb00a591dce68e8a4) * [MatrixBase::fullPivHouseholderQr()](classeigen_1_1matrixbase#a863bc0e06b641a089508eabec6835ab2) ``` #include <Eigen/QR> ``` | | | --- | | | | class | [Eigen::ColPivHouseholderQR< \_MatrixType >](classeigen_1_1colpivhouseholderqr) | | | Householder rank-revealing QR decomposition of a matrix with column-pivoting. [More...](classeigen_1_1colpivhouseholderqr#details) | | | | class | [Eigen::CompleteOrthogonalDecomposition< \_MatrixType >](classeigen_1_1completeorthogonaldecomposition) | | | Complete orthogonal decomposition (COD) of a matrix. [More...](classeigen_1_1completeorthogonaldecomposition#details) | | | | class | [Eigen::FullPivHouseholderQR< \_MatrixType >](classeigen_1_1fullpivhouseholderqr) | | | Householder rank-revealing QR decomposition of a matrix with full pivoting. [More...](classeigen_1_1fullpivhouseholderqr#details) | | | | class | [Eigen::HouseholderQR< \_MatrixType >](classeigen_1_1householderqr) | | | Householder QR decomposition of a matrix. [More...](classeigen_1_1householderqr#details) | | |
programming_docs
eigen3 Quick reference guide Quick reference guide ===================== --- Modules and Header files ========================== The [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") library is divided in a Core module and several additional modules. Each module has a corresponding header file which has to be included in order to use the module. The `Dense` and `[Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")` header files are provided to conveniently gain access to several modules at once. | Module | Header file | Contents | | --- | --- | --- | | [Core](group__core__module) | ``` #include <Eigen/Core> ``` | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") classes, basic linear algebra (including triangular and selfadjoint products), array manipulation | | [Geometry](group__geometry__module) | ``` #include <Eigen/Geometry> ``` | [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space."), [Translation](classeigen_1_1translation "Represents a translation transformation."), Scaling, [Rotation2D](classeigen_1_1rotation2d "Represents a rotation/orientation in a 2 dimensional space.") and 3D rotations ([Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.")) | | [LU](group__lu__module) | ``` #include <Eigen/LU> ``` | [Inverse](classeigen_1_1inverse "Expression of the inverse of another expression."), determinant, LU decompositions with solver ([FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features."), [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.")) | | [Cholesky](group__cholesky__module) | ``` #include <Eigen/Cholesky> ``` | [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") and [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") Cholesky factorization with solver | | [Householder](group__householder__module) | ``` #include <Eigen/Householder> ``` | Householder transformations; this module is used by several linear algebra modules | | [SVD](group__svd__module) | ``` #include <Eigen/SVD> ``` | SVD decompositions with least-squares solver ([JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix."), [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD")) | | [QR](group__qr__module) | ``` #include <Eigen/QR> ``` | QR decomposition with solver ([HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix."), [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting."), [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.")) | | [Eigenvalues](group__eigenvalues__module) | ``` #include <Eigen/Eigenvalues> ``` | Eigenvalue, eigenvector decompositions ([EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices."), [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.")) | | [Sparse](group__sparse__module) | ``` #include <Eigen/Sparse> ``` | Sparse matrix storage and related basic linear algebra ([SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation."), [SparseVector](classeigen_1_1sparsevector "a sparse vector class")) (see [Quick reference guide for sparse matrices](group__sparsequickrefpage) for details on sparse modules) | | | ``` #include <Eigen/Dense> ``` | Includes Core, Geometry, LU, Cholesky, SVD, QR, and Eigenvalues header files | | | ``` #include <Eigen/Eigen> ``` | Includes Dense and Sparse header files (the whole [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") library) | Array, matrix and vector types ================================ **Recall:** [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") provides two kinds of dense objects: mathematical matrices and vectors which are both represented by the template class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), and general 1D and 2D arrays represented by the template class [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations."): ``` typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> MyMatrixType; typedef Array<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> MyArrayType; ``` * `Scalar` is the scalar type of the coefficients (e.g., `float`, `double`, `bool`, `int`, etc.). * `RowsAtCompileTime` and `ColsAtCompileTime` are the number of rows and columns of the matrix as known at compile-time or `Dynamic`. * `Options` can be `ColMajor` or `RowMajor`, default is `ColMajor`. (see class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") for more options) All combinations are allowed: you can have a matrix with a fixed number of rows and a dynamic number of columns, etc. The following are all valid: ``` Matrix<double, 6, Dynamic> // Dynamic number of columns (heap allocation) Matrix<double, Dynamic, 2> // Dynamic number of rows (heap allocation) Matrix<double, Dynamic, Dynamic, RowMajor> // Fully dynamic, row major (heap allocation) Matrix<double, 13, 3> // Fully fixed (usually allocated on stack) ``` In most cases, you can simply use one of the convenience typedefs for [matrices](group__matrixtypedefs) and [arrays](group__arraytypedefs). Some examples: | Matrices | Arrays | | --- | --- | | ``` Matrix<float,Dynamic,Dynamic> <=> MatrixXf Matrix<double,Dynamic,1> <=> VectorXd Matrix<int,1,Dynamic> <=> RowVectorXi Matrix<float,3,3> <=> Matrix3f Matrix<float,4,1> <=> Vector4f ``` | ``` Array<float,Dynamic,Dynamic> <=> ArrayXXf Array<double,Dynamic,1> <=> ArrayXd Array<int,1,Dynamic> <=> RowArrayXi Array<float,3,3> <=> Array33f Array<float,4,1> <=> Array4f ``` | Conversion between the matrix and array worlds: ``` Array44f a1, a2; Matrix4f m1, m2; m1 = a1 * a2; // coeffwise product, implicit conversion from array to matrix. a1 = m1 * m2; // matrix product, implicit conversion from matrix to array. a2 = a1 + m1.array(); // mixing array and matrix is forbidden m2 = a1.matrix() + m1; // and explicit conversion is required. ArrayWrapper<Matrix4f> m1a(m1); // m1a is an alias for m1.array(), they share the same coefficients MatrixWrapper<Array44f> a1m(a1); ``` In the rest of this document we will use the following symbols to emphasize the features which are specifics to a given kind of object: * [\*](#matrixonly) linear algebra matrix and vector only * [\*](#arrayonly) array objects only Basic matrix manipulation --------------------------- | | 1D objects | 2D objects | Notes | | --- | --- | --- | --- | | Constructors | ``` Vector4d v4; Vector2f v1(x, y); Array3i v2(x, y, z); Vector4d v3(x, y, z, w); VectorXf v5; // empty object ArrayXf v6(size); ``` | ``` Matrix4f m1; MatrixXf m5; // empty object MatrixXf m6(nb_rows, nb_columns); ``` | By default, the coefficients are left uninitialized | | Comma initializer | ``` Vector3f v1; v1 << x, y, z; ArrayXf v2(4); v2 << 1, 2, 3, 4; ``` | ``` Matrix3f m1; m1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; ``` | | | Comma initializer (bis) | ``` int rows=5, cols=5; MatrixXf m(rows,cols); m << (Matrix3f() << 1, 2, 3, 4, 5, 6, 7, 8, 9).finished(), [MatrixXf::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(3,cols-3), [MatrixXf::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(rows-3,3), [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(rows-3,cols-3); cout << m; ``` | output: ``` 1 2 3 0 0 4 5 6 0 0 7 8 9 0 0 0 0 0 1 0 0 0 0 0 1 ``` | | Runtime info | ``` vector.size(); vector.innerStride(); vector.data(); ``` | ``` matrix.rows(); matrix.cols(); matrix.innerSize(); matrix.outerSize(); matrix.innerStride(); matrix.outerStride(); matrix.data(); ``` | Inner/Outer\* are storage order dependent | | Compile-time info | ``` ObjectType::Scalar ObjectType::RowsAtCompileTime ObjectType::RealScalar ObjectType::ColsAtCompileTime ObjectType::Index ObjectType::SizeAtCompileTime ``` | | | Resizing | ``` vector.resize(size); vector.resizeLike(other_vector); vector.conservativeResize(size); ``` | ``` matrix.resize(nb_rows, nb_cols); matrix.resize(Eigen::NoChange, nb_cols); matrix.resize(nb_rows, Eigen::NoChange); matrix.resizeLike(other_matrix); matrix.conservativeResize(nb_rows, nb_cols); ``` | no-op if the new sizes match, otherwise data are lost resizing with data preservation | | Coeff access with range checking | ``` vector(i) vector.x() vector[i] vector.y() vector.z() vector.w() ``` | ``` matrix(i,j) ``` | Range checking is disabled if NDEBUG or EIGEN\_NO\_DEBUG is defined | | Coeff access without range checking | ``` vector.coeff(i) vector.coeffRef(i) ``` | ``` matrix.coeff(i,j) matrix.coeffRef(i,j) ``` | | | Assignment/copy | ``` object = expression; object_of_float = expression_of_double.cast<float>(); ``` | the destination is automatically resized (if possible) | Predefined Matrices --------------------- | Fixed-size matrix or vector | Dynamic-size matrix | Dynamic-size vector | | --- | --- | --- | | ``` typedef {Matrix3f|Array33f} FixedXD; FixedXD x; x = FixedXD::Zero(); x = FixedXD::Ones(); x = FixedXD::Constant(value); x = FixedXD::Random(); x = FixedXD::LinSpaced(size, low, high); x.setZero(); x.setOnes(); x.setConstant(value); x.setRandom(); x.setLinSpaced(size, low, high); ``` | ``` typedef {MatrixXf|ArrayXXf} Dynamic2D; Dynamic2D x; x = Dynamic2D::Zero(rows, cols); x = Dynamic2D::Ones(rows, cols); x = Dynamic2D::Constant(rows, cols, value); x = Dynamic2D::Random(rows, cols); N/A x.setZero(rows, cols); x.setOnes(rows, cols); x.setConstant(rows, cols, value); x.setRandom(rows, cols); N/A ``` | ``` typedef {VectorXf|ArrayXf} Dynamic1D; Dynamic1D x; x = Dynamic1D::Zero(size); x = Dynamic1D::Ones(size); x = Dynamic1D::Constant(size, value); x = Dynamic1D::Random(size); x = Dynamic1D::LinSpaced(size, low, high); x.setZero(size); x.setOnes(size); x.setConstant(size, value); x.setRandom(size); x.setLinSpaced(size, low, high); ``` | | Identity and [basis vectors](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539) [\*](#matrixonly) | | ``` x = FixedXD::Identity(); x.setIdentity(); [Vector3f::UnitX](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d)() // 1 0 0 Vector3f::UnitY() // 0 1 0 Vector3f::UnitZ() // 0 0 1 Vector4f::Unit(i) x.setUnit(i); ``` | ``` x = Dynamic2D::Identity(rows, cols); x.setIdentity(rows, cols); N/A ``` | ``` N/A [VectorXf::Unit](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539)(size,i) x.setUnit(size,i); [VectorXf::Unit](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539)(4,1) == Vector4f(0,1,0,0) == [Vector4f::UnitY](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc)() ``` | Note that it is allowed to call any of the `set*` functions to a dynamic-sized vector or matrix without passing new sizes. For instance: ``` MatrixXi M(3,3); M.setIdentity(); ``` Mapping external arrays ------------------------- | | | | --- | --- | | Contiguous memory | ``` float data[] = {1,2,3,4}; Map<Vector3f> v1(data); // uses v1 as a Vector3f object Map<ArrayXf> v2(data,3); // uses v2 as a ArrayXf object Map<Array22f> m1(data); // uses m1 as a Array22f object Map<MatrixXf> m2(data,2,2); // uses m2 as a MatrixXf object ``` | | Typical usage of strides | ``` float data[] = {1,2,3,4,5,6,7,8,9}; Map<VectorXf,0,InnerStride<2> > v1(data,3); // = [1,3,5] Map<VectorXf,0,InnerStride<> > v2(data,3,InnerStride<>(3)); // = [1,4,7] Map<MatrixXf,0,OuterStride<3> > m2(data,2,3); // both lines |1,4,7| Map<MatrixXf,0,OuterStride<> > m1(data,2,3,OuterStride<>(3)); // are equal to: |2,5,8| ``` | Arithmetic Operators ====================== | | | | --- | --- | | add subtract | ``` mat3 = mat1 + mat2; mat3 += mat1; mat3 = mat1 - mat2; mat3 -= mat1; ``` | | scalar product | ``` mat3 = mat1 * s1; mat3 *= s1; mat3 = s1 * mat1; mat3 = mat1 / s1; mat3 /= s1; ``` | | matrix/vector products [\*](#matrixonly) | ``` col2 = mat1 * col1; row2 = row1 * mat1; row1 *= mat1; mat3 = mat1 * mat2; mat3 *= mat1; ``` | | transposition adjoint [\*](#matrixonly) | ``` mat1 = mat2.transpose(); mat1.transposeInPlace(); mat1 = mat2.adjoint(); mat1.adjointInPlace(); ``` | | [dot](classeigen_1_1matrixbase#adfd32bf5fcf6ee603c924dde9bf7bc39) product inner product [\*](#matrixonly) | ``` scalar = vec1.dot(vec2); scalar = col1.adjoint() * col2; scalar = (col1.adjoint() * col2).value(); ``` | | outer product [\*](#matrixonly) | ``` mat = col1 * col2.transpose(); ``` | | [norm](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) [normalization](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) [\*](#matrixonly) | ``` scalar = vec1.norm(); scalar = vec1.squaredNorm() vec2 = vec1.normalized(); vec1.normalize(); // inplace ``` | | [cross product](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) [\*](#matrixonly) | ``` #include <Eigen/Geometry> vec3 = vec1.cross(vec2); ``` | Coefficient-wise & Array operators ==================================== In addition to the aforementioned operators, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") supports numerous coefficient-wise operator and functions. Most of them unambiguously makes sense in array-world[\*](#arrayonly). The following operators are readily available for arrays, or available through .array() for vectors and matrices: | | | | --- | --- | | Arithmetic operators | ``` array1 * array2 array1 / array2 array1 *= array2 array1 /= array2 array1 + scalar array1 - scalar array1 += scalar array1 -= scalar ``` | | Comparisons | ``` array1 < array2 array1 > array2 array1 < scalar array1 > scalar array1 <= array2 array1 >= array2 array1 <= scalar array1 >= scalar array1 == array2 array1 != array2 array1 == scalar array1 != scalar array1.min(array2) array1.max(array2) array1.min(scalar) array1.max(scalar) ``` | | Trigo, power, and misc functions and the STL-like variants | ``` array1.abs2() array1.abs() [abs](namespaceeigen#ae27242789e7e62a8c42579b79be59b1a)(array1) array1.sqrt() [sqrt](namespaceeigen#af4f536e8ea56702e63088efb3706d1f0)(array1) array1.log() [log](namespaceeigen#ae8bb75ba4f5f30a7571146dbfa653c6d)(array1) array1.log10() [log10](namespaceeigen#a25256faeec3ffd0f3615a0e1e45dfb14)(array1) array1.exp() [exp](namespaceeigen#ae491aecf7dab66ac7e11008c5766694d)(array1) array1.pow(array2) pow(array1,array2) array1.pow(scalar) pow(array1,scalar) pow(scalar,array2) array1.square() array1.cube() array1.inverse() array1.sin() [sin](namespaceeigen#ae6e8ad270ff41c088d7651567594f796)(array1) array1.cos() [cos](namespaceeigen#ad01d50a42869218f1d54af13f71517a6)(array1) array1.tan() [tan](namespaceeigen#a3bc116a6243f38c22f851581aa7b521a)(array1) array1.asin() [asin](namespaceeigen#a6c5c246b877ac331495d21e7a5d51616)(array1) array1.acos() [acos](namespaceeigen#a3fe3a136370fefae062591304c6a7ebd)(array1) array1.atan() [atan](namespaceeigen#a230744e17147d12e8ef3f2fc3796f64f)(array1) array1.sinh() [sinh](namespaceeigen#af284ce359b6efd4b594a9f8a1f5e5d96)(array1) array1.cosh() [cosh](namespaceeigen#a34b99a26a2a1e7ff985a5ace16eedfcb)(array1) array1.tanh() [tanh](namespaceeigen#a0110c233d357169fd58fdf5656992a98)(array1) array1.arg() [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1)(array1) array1.floor() [floor](namespaceeigen#abf03d773a87830bc7fde51bcd94c89a0)(array1) array1.ceil() [ceil](namespaceeigen#aa73e38be0689a463ae14141b9cf89c35)(array1) array1.round() [round](namespaceeigen#ad9eaa98e8016ef17024a18a2f3e5bef3)(aray1) array1.isFinite() [isfinite](namespaceeigen#aba24ec81dec745a00b7f33adead89811)(array1) array1.isInf() [isinf](namespaceeigen#a1f1103712e337c4c96a05f949637a4c8)(array1) array1.isNaN() [isnan](namespaceeigen#a99adfc5178f3fd5488304284388b2a10)(array1) ``` | The following coefficient-wise operators are available for all kind of expressions (matrices, vectors, and arrays), and for both real or complex scalar types: | [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s API | STL-like APIs[\*](#arrayonly) | Comments | | --- | --- | --- | | ``` mat1.real() mat1.imag() mat1.conjugate() ``` | ``` [real](namespaceeigen#ac74dc920119b1eba45e9218d9f402afc)(array1) [imag](namespaceeigen#a04d60a3c8a266f63c08e03615c1985c9)(array1) [conj](namespaceeigen#ab84f39a06a18e1ebb23f8be80345b79d)(array1) ``` | ``` // read-write, no-op for real expressions // read-only for real, read-write for complexes // no-op for real expressions ``` | Some coefficient-wise operators are readily available for for matrices and vectors through the following cwise\* methods: | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") API [\*](#matrixonly) | Via [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") conversions | | --- | --- | | ``` mat1.cwiseMin(mat2) mat1.cwiseMin(scalar) mat1.cwiseMax(mat2) mat1.cwiseMax(scalar) mat1.cwiseAbs2() mat1.cwiseAbs() mat1.cwiseSqrt() mat1.cwiseInverse() mat1.cwiseProduct(mat2) mat1.cwiseQuotient(mat2) mat1.cwiseEqual(mat2) mat1.cwiseEqual(scalar) mat1.cwiseNotEqual(mat2) ``` | ``` mat1.array().min(mat2.array()) mat1.array().min(scalar) mat1.array().max(mat2.array()) mat1.array().max(scalar) mat1.array().abs2() mat1.array().abs() mat1.array().sqrt() mat1.array().inverse() mat1.array() * mat2.array() mat1.array() / mat2.array() mat1.array() == mat2.array() mat1.array() == scalar mat1.array() != mat2.array() ``` | The main difference between the two API is that the one based on cwise\* methods returns an expression in the matrix world, while the second one (based on .array()) returns an array expression. Recall that .array() has no cost, it only changes the available API and interpretation of the data. It is also very simple to apply any user defined function `foo` using DenseBase::unaryExpr together with [std::ptr\_fun](http://en.cppreference.com/w/cpp/utility/functional/ptr_fun) (c++03, deprecated or removed in newer C++ versions), [std::ref](http://en.cppreference.com/w/cpp/utility/functional/ref) (c++11), or [lambdas](http://en.cppreference.com/w/cpp/language/lambda) (c++11): ``` mat1.unaryExpr(std::ptr_fun(foo)); mat1.unaryExpr(std::ref(foo)); mat1.unaryExpr([](double x) { return foo(x); }); ``` Please note that it's not possible to pass a raw function pointer to `unaryExpr`, so please warp it as shown above. Reductions ============ [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") provides several reduction methods such as: [minCoeff()](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) , [maxCoeff()](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) , [sum()](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) , [prod()](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) , [trace()](classeigen_1_1matrixbase#a544b609f65eb2bd3e368b3fc2d79479e) [\*](#matrixonly), [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) [\*](#matrixonly), [squaredNorm()](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) [\*](#matrixonly), [all()](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) , and [any()](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) . All reduction operations can be done matrix-wise, [column-wise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) or [row-wise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) . Usage example: | | | | | --- | --- | --- | | ``` 5 3 1 mat = 2 7 8 9 4 6 ``` | ``` mat.minCoeff(); ``` | ``` 1 ``` | | ``` mat.colwise().minCoeff(); ``` | ``` 2 3 1 ``` | | ``` mat.rowwise().minCoeff(); ``` | ``` 1 2 4 ``` | Special versions of [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) and [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) : ``` int i, j; s = vector.minCoeff(&i); // s == vector[i] s = matrix.maxCoeff(&i, &j); // s == matrix(i,j) ``` Typical use cases of [all()](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14) and any(): ``` if((array1 > 0).[all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)()) ... // if all coefficients of array1 are greater than 0 ... if((array1 < array2).any()) ... // if there exist a pair i,j such that array1(i,j) < array2(i,j) ... ``` Sub-matrices ============== **PLEASE HELP US IMPROVING THIS SECTION.** Eigen 3.4 supports a much improved API for sub-matrices, including, slicing and indexing from arrays: [Slicing and Indexing](group__tutorialslicingindexing) Read-write access to a [column](group__quickrefpage) or a [row](group__quickrefpage) of a matrix (or array): ``` mat1.row(i) = mat2.col(j); mat1.col(j1).swap(mat1.col(j2)); ``` Read-write access to sub-vectors: | Default versions | Optimized versions when the size is known at compile time | | | --- | --- | --- | | ``` vec1.head(n) ``` | ``` vec1.head<n>() ``` | the first `n` coeffs | | ``` vec1.tail(n) ``` | ``` vec1.tail<n>() ``` | the last `n` coeffs | | ``` vec1.segment(pos,n) ``` | ``` vec1.segment<n>(pos) ``` | the `n` coeffs in the range [`pos` : `pos` + `n` - 1] | | Read-write access to sub-matrices: | | ``` mat1.block(i,j,rows,cols) ``` [(more)](group__quickrefpage) | ``` mat1.block<rows,cols>(i,j) ``` [(more)](group__quickrefpage) | the `rows` x `cols` sub-matrix starting from position (`i`,`j`) | | ``` mat1.topLeftCorner(rows,cols) mat1.topRightCorner(rows,cols) mat1.bottomLeftCorner(rows,cols) mat1.bottomRightCorner(rows,cols) ``` | ``` mat1.topLeftCorner<rows,cols>() mat1.topRightCorner<rows,cols>() mat1.bottomLeftCorner<rows,cols>() mat1.bottomRightCorner<rows,cols>() ``` | the `rows` x `cols` sub-matrix taken in one of the four corners | | ``` mat1.topRows(rows) mat1.bottomRows(rows) mat1.leftCols(cols) mat1.rightCols(cols) ``` | ``` mat1.topRows<rows>() mat1.bottomRows<rows>() mat1.leftCols<cols>() mat1.rightCols<cols>() ``` | specialized versions of block() when the block fit two corners | Miscellaneous operations ========================== **PLEASE HELP US IMPROVING THIS SECTION.** Eigen 3.4 supports a new API for reshaping: [Reshape](group__tutorialreshape) Reverse --------- Vectors, rows, and/or columns of a matrix can be reversed (see [DenseBase::reverse()](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f), [DenseBase::reverseInPlace()](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921), [VectorwiseOp::reverse()](classeigen_1_1vectorwiseop#ab8caf5367e2bd636536c8a0e0c89fe15)). ``` vec.reverse() mat.colwise().reverse() mat.rowwise().reverse() vec.reverseInPlace() ``` Replicate ----------- Vectors, matrices, rows, and/or columns can be replicated in any direction (see [DenseBase::replicate()](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e), [VectorwiseOp::replicate()](classeigen_1_1vectorwiseop#a5f0c8dc9e9c4aeaa2057f15800f5c18c)) ``` vec.replicate(times) vec.replicate<Times> mat.replicate(vertical_times, horizontal_times) mat.replicate<VerticalTimes, HorizontalTimes>() mat.colwise().replicate(vertical_times, horizontal_times) mat.colwise().replicate<VerticalTimes, HorizontalTimes>() mat.rowwise().replicate(vertical_times, horizontal_times) mat.rowwise().replicate<VerticalTimes, HorizontalTimes>() ``` Diagonal, Triangular, and Self-adjoint matrices ================================================= (matrix world [\*](#matrixonly)) Diagonal matrices ------------------- | Operation | Code | | --- | --- | | view a vector [as a diagonal matrix](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0) | ``` mat1 = vec1.asDiagonal(); ``` | | Declare a diagonal matrix | ``` DiagonalMatrix<Scalar,SizeAtCompileTime> diag1(size); diag1.diagonal() = vector; ``` | | Access the [diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3) and [super/sub diagonals](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7) of a matrix as a vector (read/write) | ``` vec1 = mat1.diagonal(); mat1.diagonal() = vec1; // main diagonal vec1 = mat1.diagonal(+n); mat1.diagonal(+n) = vec1; // n-th super diagonal vec1 = mat1.diagonal(-n); mat1.diagonal(-n) = vec1; // n-th sub diagonal vec1 = mat1.diagonal<1>(); mat1.diagonal<1>() = vec1; // first super diagonal vec1 = mat1.diagonal<-2>(); mat1.diagonal<-2>() = vec1; // second sub diagonal ``` | | Optimized products and inverse | ``` mat3 = scalar * diag1 * mat1; mat3 += scalar * mat1 * vec1.asDiagonal(); mat3 = vec1.asDiagonal().inverse() * mat1 mat3 = mat1 * diag1.inverse() ``` | Triangular views ------------------ [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix.") gives a view on a triangular part of a dense matrix and allows to perform optimized operations on it. The opposite triangular part is never referenced and can be used to store other information. Note The .triangularView() template member function requires the `template` keyword if it is used on an object of a type that depends on a template parameter; see [The template and typename keywords in C++](topictemplatekeyword) for details. | Operation | Code | | --- | --- | | Reference to a triangular with optional unit or null diagonal (read/write): | ``` m.triangularView<Xxx>() ``` `Xxx` = [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1), [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749), [StrictlyUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda7b37877e0b9b0df28c9c2b669a633265), [StrictlyLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2424988b6fca98be70b595632753ba81), [UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad), [UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda) | | Writing to a specific triangular part: (only the referenced triangular part is evaluated) | ``` m1.triangularView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>() = m2 + m3 ``` | | Conversion to a dense matrix setting the opposite triangular part to zero: | ``` m2 = m1.triangularView<[Eigen::UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad)>() ``` | | Products: | ``` m3 += s1 * m1.adjoint().triangularView<[Eigen::UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad)>() * m2 m3 -= s1 * m2.conjugate() * m1.adjoint().triangularView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>() ``` | | Solving linear equations: \( M\_2 := L\_1^{-1} M\_2 \) \( M\_3 := {L\_1^\*}^{-1} M\_3 \) \( M\_4 := M\_4 U\_1^{-1} \) | ``` L1.triangularView<[Eigen::UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda)>().solveInPlace(M2) L1.triangularView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>().adjoint().solveInPlace(M3) U1.triangularView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().solveInPlace<OnTheRight>(M4) ``` | Symmetric/selfadjoint views ----------------------------- Just as for triangular matrix, you can reference any triangular part of a square matrix to see it as a selfadjoint matrix and perform special and optimized operations. Again the opposite triangular part is never referenced and can be used to store other information. Note The .selfadjointView() template member function requires the `template` keyword if it is used on an object of a type that depends on a template parameter; see [The template and typename keywords in C++](topictemplatekeyword) for details. | Operation | Code | | --- | --- | | Conversion to a dense matrix: | ``` m2 = m.selfadjointView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>(); ``` | | [Product](classeigen_1_1product "Expression of the product of two arbitrary matrices or vectors.") with another general matrix or vector: | ``` m3 = s1 * m1.conjugate().selfadjointView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>() * m3; m3 -= s1 * m3.adjoint() * m1.selfadjointView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>(); ``` | | Rank 1 and rank K update: \( upper(M\_1) \mathrel{{+}{=}} s\_1 M\_2 M\_2^\* \) \( lower(M\_1) \mathbin{{-}{=}} M\_2^\* M\_2 \) | ``` M1.selfadjointView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().rankUpdate(M2,s1); M1.selfadjointView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>().rankUpdate(M2.adjoint(),-1); ``` | | Rank 2 update: ( \( M \mathrel{{+}{=}} s u v^\* + s v u^\* \)) | ``` M.selfadjointView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().rankUpdate(u,v,s); ``` | | Solving linear equations: ( \( M\_2 := M\_1^{-1} M\_2 \)) | ``` // via a standard Cholesky factorization m2 = m1.selfadjointView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>().llt().solve(m2); // via a Cholesky factorization with pivoting m2 = m1.selfadjointView<[Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>().ldlt().solve(m2); ``` |
programming_docs
eigen3 Compiler making a wrong assumption on stack alignment Compiler making a wrong assumption on stack alignment ===================================================== #### It appears that this was a GCC bug that has been fixed in GCC 4.5. If you hit this issue, please upgrade to GCC 4.5 and report to us, so we can update this page. This is an issue that, so far, we met only with GCC on Windows: for instance, MinGW and TDM-GCC. By default, in a function like this, ``` void foo() { [Eigen::Quaternionf](classeigen_1_1quaternion) q; //... } ``` GCC assumes that the stack is already 16-byte-aligned so that the object *q* will be created at a 16-byte-aligned location. For this reason, it doesn't take any special care to explicitly align the object *q*, as [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") requires. The problem is that, in some particular cases, this assumption can be wrong on Windows, where the stack is only guaranteed to have 4-byte alignment. Indeed, even though GCC takes care of aligning the stack in the main function and does its best to keep it aligned, when a function is called from another thread or from a binary compiled with another compiler, the stack alignment can be corrupted. This results in the object 'q' being created at an unaligned location, making your program crash with the [assertion on unaligned arrays](group__topicunalignedarrayassert). So far we found the three following solutions. Local solution ================ A local solution is to mark such a function with this attribute: ``` __attribute__((force_align_arg_pointer)) void foo() { [Eigen::Quaternionf](classeigen_1_1quaternion) q; //... } ``` Read [this GCC documentation](http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Function-Attributes.html#Function-Attributes) to understand what this does. Of course this should only be done on GCC on Windows, so for portability you'll have to encapsulate this in a macro which you leave empty on other platforms. The advantage of this solution is that you can finely select which function might have a corrupted stack alignment. Of course on the downside this has to be done for every such function, so you may prefer one of the following two global solutions. Global solutions ================== A global solution is to edit your project so that when compiling with GCC on Windows, you pass this option to GCC: ``` -mincoming-stack-boundary=2 ``` Explanation: this tells GCC that the stack is only required to be aligned to 2^2=4 bytes, so that GCC now knows that it really must take extra care to honor the 16 byte alignment of [fixed-size vectorizable Eigen types](group__topicfixedsizevectorizable) when needed. Another global solution is to pass this option to gcc: ``` -mstackrealign ``` which has the same effect than adding the `force_align_arg_pointer` attribute to all functions. These global solutions are easy to use, but note that they may slowdown your program because they lead to extra prologue/epilogue instructions for every function. eigen3 Eigen::ArrayBase Eigen::ArrayBase ================ ### template<typename Derived> class Eigen::ArrayBase< Derived > Base class for all 1D and 2D array, and related expressions. An array is similar to a dense vector or matrix. While matrices are mathematical objects with well defined linear algebra operators, an array is just a collection of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, all operations applied to an array are performed coefficient wise. Furthermore, arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient constructors allowing to easily write generic code working for both scalar values and arrays. This class is the base that is inherited by all array expression types. Template Parameters | | | | --- | --- | | Derived | is the derived type, e.g., an array or an expression type. | This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_ARRAYBASE_PLUGIN`. See also class [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions."), [The class hierarchy](topicclasshierarchy) | | | --- | | | | [MatrixWrapper](classeigen_1_1matrixwrapper)< Derived > | [matrix](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) () | | | | template<typename OtherDerived > | | Derived & | [operator\*=](classeigen_1_1arraybase#a6a5ff80e9d85106a1c9958219961c21d) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator+=](classeigen_1_1arraybase#a9cc9fdb4d0d6eb80a45107b86aacbfed) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator-=](classeigen_1_1arraybase#aac76a5e5e735b97f955189825cef7e2c) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator/=](classeigen_1_1arraybase#a1717e11dfe9341e9cfba13140cedddce) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | Derived & | [operator=](classeigen_1_1arraybase#a8587d8d893f5225a4511e9d76d9fe3cc) (const [ArrayBase](classeigen_1_1arraybase) &other) | | | | Derived & | [operator=](classeigen_1_1arraybase#a80cacb05b6881fba659efb2377e4fd22) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | bool | [all](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) () const | | | | bool | [allFinite](classeigen_1_1densebase#af1e669fd3aaae50a4870dc1b8f3b8884) () const | | | | bool | [any](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [begin](classeigen_1_1densebase#a57591454af931f9dffa71c9da28d5641) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [begin](classeigen_1_1densebase#ad9368ce70b06167ec5fc19398d329f5e) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cbegin](classeigen_1_1densebase#ae9a3dfd9b826ba3103de0128576fb15b) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cend](classeigen_1_1densebase#aeb3b76f02986c2af2521d07164b5ffde) () const | | | | [ColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) () | | | | [ConstColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [count](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [end](classeigen_1_1densebase#ae71d079e16d91360d10066b316b48485) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [end](classeigen_1_1densebase#ab34773522e43bfb02e9cf652d7b5dd60) () const | | | | EvalReturnType | [eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) () const | | | | void | [fill](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | template<unsigned int Added, unsigned int Removed> | | EIGEN\_DEPRECATED const Derived & | [flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const | | | | const [WithFormat](classeigen_1_1withformat)< Derived > | [format](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) (const [IOFormat](structeigen_1_1ioformat) &fmt) const | | | | bool | [hasNaN](classeigen_1_1densebase#ab13d158c900560d3e1b25d85d2d33dd6) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1densebase#a58ca41d9635a8ab3c5a268ef3f7f0d75) () const | | | | template<typename OtherDerived > | | bool | [isApprox](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isApproxToConstant](classeigen_1_1densebase#af9b150d48bc5e4366887ccb466e40c6b) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isConstant](classeigen_1_1densebase#a1ca84e4179b3e5081ed11d89bbd9e74f) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#a3c4db0c6dd974fa88bbb58b2cf3d5664) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename Derived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#adfca6ff4e473f68fbbeabbd03b7504a9) (const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &other, const RealScalar &prec) const | | | | bool | [isOnes](classeigen_1_1densebase#aa56d6b4477cd3c92a9cf42f4b96e47c2) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isZero](classeigen_1_1densebase#af36014ec300f53a65083057ed4e89822) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED Derived & | [lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#aced8ffda52ff061b6586ace2657ebf30) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) (IndexType \*row, IndexType \*col) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7) () const | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#ac9265f4f91430b9cc75d63fb6865bb29) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) (IndexType \*row, IndexType \*col) const | | | | const [NestByValue](classeigen_1_1nestbyvalue)< Derived > | [nestByValue](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1densebase#acb8d5574eff335381e7441ade87700a0) () const | | | | template<typename OtherDerived > | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0f0e34696162b34762b2bf4bd948f90c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0e575eb0ba6cc6bc5f347872abd8509d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &s) | | | | Derived & | [operator=](classeigen_1_1densebase#a5281dadff89f46eef719b38e5d073a8f) (const [DenseBase](classeigen_1_1densebase) &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#ab66155169d20c035e80d521a8b918e97) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1densebase#a03f71699bc26ca2ee4e42ec4538862d7) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) () const | | | | template<typename Func > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [redux](classeigen_1_1densebase#a63ce1e4fab36bff43bbadcdd06a67724) (const Func &func) const | | | | template<int RowFactor, int ColFactor> | | const [Replicate](classeigen_1_1replicate)< Derived, RowFactor, ColFactor > | [replicate](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) () const | | | | const [Replicate](classeigen_1_1replicate)< Derived, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [replicate](classeigen_1_1densebase#afae2d5e36f1158d1b1681dac3cdbd58e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowFactor, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colFactor) const | | | | void | [resize](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | [ReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) () | | | | [ConstReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a9e2f3ac4019184abf95ca0e1a8d82866) () const | | | | void | [reverseInPlace](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) () | | | | [RowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) () | | | | [ConstRowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc) () const | | | | template<typename ThenDerived , typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, ElseDerived > | [select](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | template<typename ThenDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > | [select](classeigen_1_1densebase#a57ef09a843004095f84c198dd145641b) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const | | | | template<typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > | [select](classeigen_1_1densebase#a9e8e78c75887d4539071a0b7a61ca103) (const typename ElseDerived::Scalar &thenScalar, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | Derived & | [setConstant](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) | | | | Derived & | [setOnes](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) () | | | | Derived & | [setRandom](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) () | | | | Derived & | [setZero](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) () | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) () const | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#af9e7e4305fdb7781f2b2f05fa801f21e) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#a44e25adc6da9cd1d79f4c5bd7c1819cb) ([PlainObjectBase](classeigen_1_1plainobjectbase)< OtherDerived > &other) | | | | [TransposeReturnType](classeigen_1_1transpose) | [transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) () const | | | | void | [transposeInPlace](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) () | | | | CoeffReturnType | [value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) () const | | | | template<typename Visitor > | | void | [visit](classeigen_1_1densebase#a4225b90fcc74f18dd479b401124b3841) (Visitor &func) const | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#af1bac522aee4402639189f387592000b) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a4e94e17926e1cf597deb2928e779cef6) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#abb333f6f10467f6f8d7b59c213dea49e) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a63bc5874eb4e320e54eb079b43b49d22) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae66b7d18b2a85f3139b703126974c900) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#adc8286576b31e11f056057be666a0ec8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a0171eee1d9e582d1ac7ec0f18f5f615a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae6ba07bad9e3026afe54806fdefe32bb) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#aa2040f14e60fed1a4a68ca7f042e1bbf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Scalar & | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) () | | | | Scalar & | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) () | | | | Scalar & | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8) () | | | | Scalar & | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73) () | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | (Note that these are not member functions.) | | template<typename Derived , typename ExponentDerived > | | const [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_pow\_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const Derived, const ExponentDerived > | [pow](classeigen_1_1arraybase#acb769e1ab1d809abb77c7ab98021ad81) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Eigen::ArrayBase](classeigen_1_1arraybase)< ExponentDerived > &exponents) | | | | template<typename Derived , typename ScalarExponent > | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< Derived::Scalar, ScalarExponent >, Derived, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< ScalarExponent > > | [pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const ScalarExponent &exponent) | | | | template<typename Scalar , typename Derived > | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), Derived::Scalar >, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >, Derived > | [pow](classeigen_1_1arraybase#acb7a6224d50620991d1fb9888b8be6e6) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000)) | | | | Related Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | template<typename Derived > | | std::ostream & | [operator<<](classeigen_1_1densebase#a3806d3f42de165878dace160e6aba40a) (std::ostream &s, const [DenseBase](classeigen_1_1densebase)< Derived > &m) | | | | | | --- | | | | Public Types inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | enum | { [RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab) , [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) , [SizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da25cb495affdbd796198462b8ef06be91) , [MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306) , [MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) , [MaxSizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da3a459062d39cb34452518f5f201161d2) , [IsVectorAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da1156955c8099c5072934b74c72654ed0) , [NumDimensions](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da4d4548a01ba37a6c2031a3c1f0a37d34) , [Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) , [IsRowMajor](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da406b6af91d61d348ba1c9764bdd66008) , **InnerSizeAtCompileTime** , **InnerStrideAtCompileTime** , **OuterStrideAtCompileTime** } | | | | typedef random\_access\_iterator\_type | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | | | | typedef random\_access\_iterator\_type | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | | | | typedef [Array](classeigen_1_1array)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) | | | | typedef [Matrix](classeigen_1_1matrix)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e) | | | | typedef internal::conditional< internal::is\_same< typename internal::traits< Derived >::XprKind, [MatrixXpr](structeigen_1_1matrixxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e), [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) >::type | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | The plain matrix or array type corresponding to this expression. [More...](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | [StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | The type used to store indices. [More...](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | | typedef [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [value\_type](classeigen_1_1densebase#a9276182dab8236c33f1e7abf491d504d) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Static Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#aed89b5cc6e3b7d9d5bd63aed245ccd6d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a1fdd3189ae3a41d250593334d82210cf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a5dc65501accd02c30f7c1840c2a30a41) (const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const CustomNullaryOp &func) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101) () | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a8b2a51018a73a766f5b91aef3487f013) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#ab710a58e4a80fbcb2594242372c8fe56) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) () | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#a7eb5f974a8f0b67eac7080db1da0e308) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761) () | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ae41a9b5050ed27d9e93c82c9c8622cd3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ac22f79b812fa564061042407f2ba8f5b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | Protected Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | | [DenseBase](classeigen_1_1densebase#aa284042d0e1b0ad9b6a00db7fd2d9f7f) () | | | matrix() -------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [MatrixWrapper](classeigen_1_1matrixwrapper)<Derived> [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::matrix | ( | | ) | | | inline | Returns an [Matrix](classeigen_1_1matrixbase) expression of this array See also [MatrixBase::array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) operator\*=() ------------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::operator\*= | ( | const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` \* *other* coefficient wise. Returns a reference to `*this` operator+=() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::operator+= | ( | const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` + *other*. Returns a reference to `*this` operator-=() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::operator-= | ( | const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` - *other*. Returns a reference to `*this` operator/=() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::operator/= | ( | const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` / *other* coefficient wise. Returns a reference to `*this` operator=() [1/2] ----------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::operator= | ( | const [ArrayBase](classeigen_1_1arraybase)< Derived > & | *other* | ) | | | inline | Special case of the template operator=, in order to prevent the compiler from generating a default operator= (issue hit with g++ 4.1) operator=() [2/2] ----------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived >::operator= | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *value* | ) | | | inline | Set all the entries to *value*. See also [DenseBase::setConstant()](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559), [DenseBase::fill()](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) pow() [1/3] ----------- template<typename Derived , typename ExponentDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_pow\_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const Derived, const ExponentDerived > pow | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x*, | | | | const [Eigen::ArrayBase](classeigen_1_1arraybase)< ExponentDerived > & | *exponents* | | | ) | | | | related | Returns an expression of the coefficient-wise power of *x* to the given array of *exponents*. This function computes the coefficient-wise power. Example: ``` Array<double,1,3> [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000)(8,25,3), e(1./3.,0.5,2.); cout << "[" << [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) << "]^[" << e << "] = " << [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000).pow(e) << endl; // using ArrayBase::pow cout << "[" << [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) << "]^[" << e << "] = " << [pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3)([x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000),e) << endl; // using Eigen::pow ``` Output: ``` [ 8 25 3]^[0.333 0.5 2] = 2 5 9 [ 8 25 3]^[0.333 0.5 2] = 2 5 9 ``` See also [ArrayBase::pow()](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) pow() [2/3] ----------- template<typename Derived , typename ScalarExponent > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< Derived::Scalar, ScalarExponent >, Derived, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< ScalarExponent > > pow | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x*, | | | | const ScalarExponent & | *exponent* | | | ) | | | | related | Returns an expression of the coefficient-wise power of *x* to the given constant *exponent*. Template Parameters | | | | --- | --- | | ScalarExponent | is the scalar type of *exponent*. It must be compatible with the scalar type of the given expression (`Derived::Scalar`). | See also [ArrayBase::pow()](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) pow() [3/3] ----------- template<typename Scalar , typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), Derived::Scalar >, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >, Derived > pow | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *x*, | | | | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | | | ) | | | | related | Returns an expression of the coefficient-wise power of the scalar *x* to the given array of *exponents*. This function computes the coefficient-wise power between a scalar and an array of exponents. Template Parameters | | | | --- | --- | | Scalar | is the scalar type of *x*. It must be compatible with the scalar type of the given array expression (`Derived::Scalar`). | Example: ``` Array<double,1,3> e(2,-3,1./3.); cout << "10^[" << e << "] = " << [pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3)(10,e) << endl; ``` Output: ``` 10^[ 2 -3 0.333] = 100 0.001 2.15 ``` See also [ArrayBase::pow()](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) --- The documentation for this class was generated from the following files:* [ArrayBase.h](https://eigen.tuxfamily.org/dox/ArrayBase_8h_source.html) * [GlobalFunctions.h](https://eigen.tuxfamily.org/dox/GlobalFunctions_8h_source.html) * [SelfCwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/SelfCwiseBinaryOp_8h_source.html)
programming_docs
eigen3 Lazy Evaluation and Aliasing Lazy Evaluation and Aliasing ============================ Executive summary: Eigen has intelligent compile-time mechanisms to enable lazy evaluation and removing temporaries where appropriate. It will handle aliasing automatically in most cases, for example with matrix products. The automatic behavior can be overridden manually by using the [MatrixBase::eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) and [MatrixBase::noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) methods. When you write a line of code involving a complex expression such as ``` mat1 = mat2 + mat3 * (mat4 + mat5); ``` Eigen determines automatically, for each sub-expression, whether to evaluate it into a temporary variable. Indeed, in certain cases it is better to evaluate a sub-expression into a temporary variable, while in other cases it is better to avoid that. A traditional math library without expression templates always evaluates all sub-expressions into temporaries. So with this code, ``` vec1 = vec2 + vec3; ``` a traditional library would evaluate `vec2` + vec3 into a temporary `vec4` and then copy `vec4` into `vec1`. This is of course inefficient: the arrays are traversed twice, so there are a lot of useless load/store operations. Expression-templates-based libraries can avoid evaluating sub-expressions into temporaries, which in many cases results in large speed improvements. This is called *lazy evaluation* as an expression is getting evaluated as late as possible. In Eigen **all expressions are lazy-evaluated**. More precisely, an expression starts to be evaluated once it is assigned to a matrix. Until then nothing happens beyond constructing the abstract expression tree. In contrast to most other expression-templates-based libraries, however, **Eigen might choose to evaluate some sub-expressions into temporaries**. There are two reasons for that: first, pure lazy evaluation is not always a good choice for performance; second, pure lazy evaluation can be very dangerous, for example with matrix products: doing `mat = mat*mat` gives a wrong result if the matrix product is directly evaluated within the destination matrix, because of the way matrix product works. For these reasons, Eigen has intelligent compile-time mechanisms to determine automatically which sub-expression should be evaluated into a temporary variable. So in the basic example, ``` mat1 = mat2 + mat3; ``` Eigen chooses not to introduce any temporary. Thus the arrays are traversed only once, producing optimized code. If you really want to force immediate evaluation, use [eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b): ``` mat1 = (mat2 + mat3).eval(); ``` Here is now a more involved example: ``` mat1 = -mat2 + mat3 + 5 * mat4; ``` Here again Eigen won't introduce any temporary, thus producing a single **fused** evaluation loop, which is clearly the correct choice. Which sub-expressions are evaluated into temporaries? ======================================================= The default evaluation strategy is to fuse the operations in a single loop, and Eigen will choose it except in a few circumstances. **The first circumstance** in which Eigen chooses to evaluate a sub-expression is when it sees an assignment `a = b;` and the expression `b` has the evaluate-before-assigning [flag](group__flags). The most important example of such an expression is the [matrix product expression](classeigen_1_1product). For example, when you do ``` mat = mat * mat; ``` Eigen will evaluate `mat * mat` into a temporary matrix, and then copies it into the original `mat`. This guarantees a correct result as we saw above that lazy evaluation gives wrong results with matrix products. It also doesn't cost much, as the cost of the matrix product itself is much higher. Note that this temporary is introduced at evaluation time only, that is, within operator= in this example. The expression `mat * mat` still return a abstract product type. What if you know that the result does no alias the operand of the product and want to force lazy evaluation? Then use [.noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) instead. Here is an example: ``` mat1.noalias() = mat2 * mat2; ``` Here, since we know that mat2 is not the same matrix as mat1, we know that lazy evaluation is not dangerous, so we may force lazy evaluation. Concretely, the effect of noalias() here is to bypass the evaluate-before-assigning [flag](group__flags). **The second circumstance** in which Eigen chooses to evaluate a sub-expression, is when it sees a nested expression such as `a + b` where `b` is already an expression having the evaluate-before-nesting [flag](group__flags). Again, the most important example of such an expression is the [matrix product expression](classeigen_1_1product). For example, when you do ``` mat1 = mat2 * mat3 + mat4 * mat5; ``` the products `mat2 * mat3` and `mat4 * mat5` gets evaluated separately into temporary matrices before being summed up in `mat1`. Indeed, to be efficient matrix products need to be evaluated within a destination matrix at hand, and not as simple "dot products". For small matrices, however, you might want to enforce a "dot-product" based lazy evaluation with lazyProduct(). Again, it is important to understand that those temporaries are created at evaluation time only, that is in operator =. See TopicPitfalls\_auto\_keyword for common pitfalls regarding this remark. **The third circumstance** in which Eigen chooses to evaluate a sub-expression, is when its cost model shows that the total cost of an operation is reduced if a sub-expression gets evaluated into a temporary. Indeed, in certain cases, an intermediate result is sufficiently costly to compute and is reused sufficiently many times, that is worth "caching". Here is an example: ``` mat1 = mat2 * (mat3 + mat4); ``` Here, provided the matrices have at least 2 rows and 2 columns, each coefficient of the expression `mat3 + mat4` is going to be used several times in the matrix product. Instead of computing the sum every time, it is much better to compute it once and store it in a temporary variable. Eigen understands this and evaluates `mat3 + mat4` into a temporary variable before evaluating the product. eigen3 Eigen::Replicate Eigen::Replicate ================ ### template<typename MatrixType, int RowFactor, int ColFactor> class Eigen::Replicate< MatrixType, RowFactor, ColFactor > Expression of the multiple replication of a matrix or vector. Template Parameters | | | | --- | --- | | MatrixType | the type of the object we are replicating | | RowFactor | number of repetitions at compile time along the vertical direction, can be Dynamic. | | ColFactor | number of repetitions at compile time along the horizontal direction, can be Dynamic. | This class represents an expression of the multiple replication of a matrix or vector. It is the return type of [DenseBase::replicate()](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) and most of the time this is the only way it is used. See also [DenseBase::replicate()](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) Inherits internal::dense\_xpr\_base::type. --- The documentation for this class was generated from the following file:* [Replicate.h](https://eigen.tuxfamily.org/dox/Replicate_8h_source.html) eigen3 Eigen::Tridiagonalization Eigen::Tridiagonalization ========================= ### template<typename \_MatrixType> class Eigen::Tridiagonalization< \_MatrixType > Tridiagonal decomposition of a selfadjoint matrix. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the tridiagonal decomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | This class performs a tridiagonal decomposition of a selfadjoint matrix \( A \) such that: \( A = Q T Q^\* \) where \( Q \) is unitary and \( T \) a real symmetric tridiagonal matrix. A tridiagonal matrix is a matrix which has nonzero elements only on the main diagonal and the first diagonal below and above it. The Hessenberg decomposition of a selfadjoint matrix is in fact a tridiagonal decomposition. This class is used in [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") to compute the eigenvalues and eigenvectors of a selfadjoint matrix. Call the function [compute()](classeigen_1_1tridiagonalization#acd288abb081d3b40b87e4b98cd8f6ee9 "Computes tridiagonal decomposition of given matrix.") to compute the tridiagonal decomposition of a given matrix. Alternatively, you can use the Tridiagonalization(const MatrixType&) constructor which computes the tridiagonal Schur decomposition at construction time. Once the decomposition is computed, you can use the [matrixQ()](classeigen_1_1tridiagonalization#a000f7392eda930576ffd2af1fae54af2 "Returns the unitary matrix Q in the decomposition.") and [matrixT()](classeigen_1_1tridiagonalization#a6eb5ef94b8b9bb013c0e69b6df56d0df "Returns an expression of the tridiagonal matrix T in the decomposition.") functions to retrieve the matrices Q and T in the decomposition. The documentation of Tridiagonalization(const MatrixType&) contains an example of the typical use of this class. See also class [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation."), class [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") | | | --- | | | | typedef [HouseholderSequence](classeigen_1_1householdersequence)< [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9), typename internal::remove\_all< typename CoeffVectorType::ConjugateReturnType >::type > | [HouseholderSequenceType](classeigen_1_1tridiagonalization#af322315c8bea9990152c9d09bfa2a69f) | | | Return type of [matrixQ()](classeigen_1_1tridiagonalization#a000f7392eda930576ffd2af1fae54af2 "Returns the unitary matrix Q in the decomposition.") | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1tridiagonalization#a7bd1f9fccec1e93b77a2214b2d30aae9) | | | | typedef \_MatrixType | [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9) | | | Synonym for the template parameter `_MatrixType`. | | | | | | --- | | | | template<typename InputType > | | [Tridiagonalization](classeigen_1_1tridiagonalization) & | [compute](classeigen_1_1tridiagonalization#acd288abb081d3b40b87e4b98cd8f6ee9) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Computes tridiagonal decomposition of given matrix. [More...](classeigen_1_1tridiagonalization#acd288abb081d3b40b87e4b98cd8f6ee9) | | | | DiagonalReturnType | [diagonal](classeigen_1_1tridiagonalization#a0b7ff4860aa6f7c0761b1059c012fd8e) () const | | | Returns the diagonal of the tridiagonal matrix T in the decomposition. [More...](classeigen_1_1tridiagonalization#a0b7ff4860aa6f7c0761b1059c012fd8e) | | | | [CoeffVectorType](classeigen_1_1matrix) | [householderCoefficients](classeigen_1_1tridiagonalization#ac95b4e43dcf6c3c5074b8bea4fc67887) () const | | | Returns the Householder coefficients. [More...](classeigen_1_1tridiagonalization#ac95b4e43dcf6c3c5074b8bea4fc67887) | | | | [HouseholderSequenceType](classeigen_1_1tridiagonalization#af322315c8bea9990152c9d09bfa2a69f) | [matrixQ](classeigen_1_1tridiagonalization#a000f7392eda930576ffd2af1fae54af2) () const | | | Returns the unitary matrix Q in the decomposition. [More...](classeigen_1_1tridiagonalization#a000f7392eda930576ffd2af1fae54af2) | | | | MatrixTReturnType | [matrixT](classeigen_1_1tridiagonalization#a6eb5ef94b8b9bb013c0e69b6df56d0df) () const | | | Returns an expression of the tridiagonal matrix T in the decomposition. [More...](classeigen_1_1tridiagonalization#a6eb5ef94b8b9bb013c0e69b6df56d0df) | | | | const [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9) & | [packedMatrix](classeigen_1_1tridiagonalization#a47858b3895e64acafb1bb2e97f98a154) () const | | | Returns the internal representation of the decomposition. [More...](classeigen_1_1tridiagonalization#a47858b3895e64acafb1bb2e97f98a154) | | | | SubDiagonalReturnType | [subDiagonal](classeigen_1_1tridiagonalization#ac423dbb91157c159bdcb4b5a8371232e) () const | | | Returns the subdiagonal of the tridiagonal matrix T in the decomposition. [More...](classeigen_1_1tridiagonalization#ac423dbb91157c159bdcb4b5a8371232e) | | | | template<typename InputType > | | | [Tridiagonalization](classeigen_1_1tridiagonalization#a05406b7df9a92fdcba72d31443f67a98) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Constructor; computes tridiagonal decomposition of given matrix. [More...](classeigen_1_1tridiagonalization#a05406b7df9a92fdcba72d31443f67a98) | | | | | [Tridiagonalization](classeigen_1_1tridiagonalization#a9ea2e6154bf35494ee68e037f0867cbd) ([Index](classeigen_1_1tridiagonalization#a7bd1f9fccec1e93b77a2214b2d30aae9) size=Size==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 2 :Size) | | | Default constructor. [More...](classeigen_1_1tridiagonalization#a9ea2e6154bf35494ee68e037f0867cbd) | | | Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::[Index](classeigen_1_1tridiagonalization#a7bd1f9fccec1e93b77a2214b2d30aae9) | **[Deprecated:](deprecated#_deprecated000020)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Tridiagonalization() [1/2] -------------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::[Tridiagonalization](classeigen_1_1tridiagonalization) | ( | [Index](classeigen_1_1tridiagonalization#a7bd1f9fccec1e93b77a2214b2d30aae9) | *size* = `Size==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 2 : Size` | ) | | | inlineexplicit | Default constructor. Parameters | | | | | --- | --- | --- | | [in] | size | Positive integer, size of the matrix whose tridiagonal decomposition will be computed. | The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1tridiagonalization#acd288abb081d3b40b87e4b98cd8f6ee9 "Computes tridiagonal decomposition of given matrix."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1tridiagonalization#acd288abb081d3b40b87e4b98cd8f6ee9 "Computes tridiagonal decomposition of given matrix.") for an example. Tridiagonalization() [2/2] -------------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::[Tridiagonalization](classeigen_1_1tridiagonalization) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inlineexplicit | Constructor; computes tridiagonal decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Selfadjoint matrix whose tridiagonal decomposition is to be computed. | This constructor calls [compute()](classeigen_1_1tridiagonalization#acd288abb081d3b40b87e4b98cd8f6ee9 "Computes tridiagonal decomposition of given matrix.") to compute the tridiagonal decomposition. Example: ``` MatrixXd X = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; Tridiagonalization<MatrixXd> triOfA(A); MatrixXd Q = triOfA.matrixQ(); cout << "The orthogonal matrix Q is:" << endl << Q << endl; MatrixXd T = triOfA.matrixT(); cout << "The tridiagonal matrix T is:" << endl << T << endl << endl; cout << "Q \* T \* Q^T = " << endl << Q * T * Q.transpose() << endl; ``` Output: ``` Here is a random symmetric 5x5 matrix: 1.36 -0.816 0.521 1.43 -0.144 -0.816 -0.659 0.794 -0.173 -0.406 0.521 0.794 -0.541 0.461 0.179 1.43 -0.173 0.461 -1.43 0.822 -0.144 -0.406 0.179 0.822 -1.37 The orthogonal matrix Q is: 1 0 0 0 0 0 -0.471 0.127 -0.671 -0.558 0 0.301 -0.195 0.437 -0.825 0 0.825 0.0459 -0.563 -0.00872 0 -0.0832 -0.971 -0.202 0.0922 The tridiagonal matrix T is: 1.36 1.73 0 0 0 1.73 -1.2 -0.966 0 0 0 -0.966 -1.28 0.214 0 0 0 0.214 -1.69 0.345 0 0 0 0.345 0.164 Q * T * Q^T = 1.36 -0.816 0.521 1.43 -0.144 -0.816 -0.659 0.794 -0.173 -0.406 0.521 0.794 -0.541 0.461 0.179 1.43 -0.173 0.461 -1.43 0.822 -0.144 -0.406 0.179 0.822 -1.37 ``` compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Tridiagonalization](classeigen_1_1tridiagonalization)& [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inline | Computes tridiagonal decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Selfadjoint matrix whose tridiagonal decomposition is to be computed. | Returns Reference to `*this` The tridiagonal decomposition is computed by bringing the columns of the matrix successively in the required form using Householder reflections. The cost is \( 4n^3/3 \) flops, where \( n \) denotes the size of the given matrix. This method reuses of the allocated data in the [Tridiagonalization](classeigen_1_1tridiagonalization "Tridiagonal decomposition of a selfadjoint matrix.") object, if the size of the matrix does not change. Example: ``` Tridiagonalization<MatrixXf> tri; MatrixXf X = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXf A = X + X.transpose(); tri.compute(A); cout << "The matrix T in the tridiagonal decomposition of A is: " << endl; cout << tri.matrixT() << endl; tri.compute(2*A); // re-use tri to compute eigenvalues of 2A cout << "The matrix T in the tridiagonal decomposition of 2A is: " << endl; cout << tri.matrixT() << endl; ``` Output: ``` The matrix T in the tridiagonal decomposition of A is: 1.36 -0.704 0 0 -0.704 0.0147 1.71 0 0 1.71 0.856 0.641 0 0 0.641 -0.506 The matrix T in the tridiagonal decomposition of 2A is: 2.72 -1.41 0 0 -1.41 0.0294 3.43 0 0 3.43 1.71 1.28 0 0 1.28 -1.01 ``` diagonal() ---------- template<typename MatrixType > | | | --- | | [Tridiagonalization](classeigen_1_1tridiagonalization)< [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9) >::DiagonalReturnType [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9) >::diagonal | Returns the diagonal of the tridiagonal matrix T in the decomposition. Returns expression representing the diagonal of T Precondition Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix. Example: ``` MatrixXcd X = [MatrixXcd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXcd A = X + X.adjoint(); cout << "Here is a random self-adjoint 4x4 matrix:" << endl << A << endl << endl; Tridiagonalization<MatrixXcd> triOfA(A); MatrixXd T = triOfA.matrixT(); cout << "The tridiagonal matrix T is:" << endl << T << endl << endl; cout << "We can also extract the diagonals of T directly ..." << endl; VectorXd diag = triOfA.diagonal(); cout << "The diagonal is:" << endl << diag << endl; VectorXd subdiag = triOfA.subDiagonal(); cout << "The subdiagonal is:" << endl << subdiag << endl; ``` Output: ``` Here is a random self-adjoint 4x4 matrix: (-0.422,0) (0.705,-1.01) (-0.17,-0.552) (0.338,-0.357) (0.705,1.01) (0.515,0) (0.241,-0.446) (0.05,-1.64) (-0.17,0.552) (0.241,0.446) (-1.03,0) (0.0449,1.72) (0.338,0.357) (0.05,1.64) (0.0449,-1.72) (1.36,0) The tridiagonal matrix T is: -0.422 -1.45 0 0 -1.45 1.01 -1.42 0 0 -1.42 1.8 -1.2 0 0 -1.2 -1.96 We can also extract the diagonals of T directly ... The diagonal is: -0.422 1.01 1.8 -1.96 The subdiagonal is: -1.45 -1.42 -1.2 ``` See also [matrixT()](classeigen_1_1tridiagonalization#a6eb5ef94b8b9bb013c0e69b6df56d0df "Returns an expression of the tridiagonal matrix T in the decomposition."), [subDiagonal()](classeigen_1_1tridiagonalization#ac423dbb91157c159bdcb4b5a8371232e "Returns the subdiagonal of the tridiagonal matrix T in the decomposition.") householderCoefficients() ------------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [CoeffVectorType](classeigen_1_1matrix) [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::householderCoefficients | ( | | ) | const | | inline | Returns the Householder coefficients. Returns a const reference to the vector of Householder coefficients Precondition Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix. The Householder coefficients allow the reconstruction of the matrix \( Q \) in the tridiagonal decomposition from the packed data. Example: ``` Matrix4d X = [Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); Matrix4d A = X + X.transpose(); cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; Tridiagonalization<Matrix4d> triOfA(A); Vector3d hc = triOfA.householderCoefficients(); cout << "The vector of Householder coefficients is:" << endl << hc << endl; ``` Output: ``` Here is a random symmetric 4x4 matrix: 1.36 0.612 0.122 0.326 0.612 -1.21 -0.222 0.563 0.122 -0.222 -0.0904 1.16 0.326 0.563 1.16 1.66 The vector of Householder coefficients is: 1.87 1.24 0 ``` See also [packedMatrix()](classeigen_1_1tridiagonalization#a47858b3895e64acafb1bb2e97f98a154 "Returns the internal representation of the decomposition."), [Householder module](group__householder__module) matrixQ() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [HouseholderSequenceType](classeigen_1_1tridiagonalization#af322315c8bea9990152c9d09bfa2a69f) [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::matrixQ | ( | | ) | const | | inline | Returns the unitary matrix Q in the decomposition. Returns object representing the matrix Q Precondition Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix. This function returns a light-weight object of template class [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size."). You can either apply it directly to a matrix or you can convert it to a matrix of type [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9 "Synonym for the template parameter _MatrixType."). See also Tridiagonalization(const MatrixType&) for an example, [matrixT()](classeigen_1_1tridiagonalization#a6eb5ef94b8b9bb013c0e69b6df56d0df "Returns an expression of the tridiagonal matrix T in the decomposition."), class [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size.") matrixT() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | MatrixTReturnType [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::matrixT | ( | | ) | const | | inline | Returns an expression of the tridiagonal matrix T in the decomposition. Returns expression object representing the matrix T Precondition Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix. Currently, this function can be used to extract the matrix T from internal data and copy it to a dense matrix object. In most cases, it may be sufficient to directly use the packed matrix or the vector expressions returned by [diagonal()](classeigen_1_1tridiagonalization#a0b7ff4860aa6f7c0761b1059c012fd8e "Returns the diagonal of the tridiagonal matrix T in the decomposition.") and [subDiagonal()](classeigen_1_1tridiagonalization#ac423dbb91157c159bdcb4b5a8371232e "Returns the subdiagonal of the tridiagonal matrix T in the decomposition.") instead of creating a new dense copy matrix with this function. See also Tridiagonalization(const MatrixType&) for an example, [matrixQ()](classeigen_1_1tridiagonalization#a000f7392eda930576ffd2af1fae54af2 "Returns the unitary matrix Q in the decomposition."), [packedMatrix()](classeigen_1_1tridiagonalization#a47858b3895e64acafb1bb2e97f98a154 "Returns the internal representation of the decomposition."), [diagonal()](classeigen_1_1tridiagonalization#a0b7ff4860aa6f7c0761b1059c012fd8e "Returns the diagonal of the tridiagonal matrix T in the decomposition."), [subDiagonal()](classeigen_1_1tridiagonalization#ac423dbb91157c159bdcb4b5a8371232e "Returns the subdiagonal of the tridiagonal matrix T in the decomposition.") packedMatrix() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9)& [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< \_MatrixType >::packedMatrix | ( | | ) | const | | inline | Returns the internal representation of the decomposition. Returns a const reference to a matrix with the internal representation of the decomposition. Precondition Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix. The returned matrix contains the following information: * the strict upper triangular part is equal to the input matrix A. * the diagonal and lower sub-diagonal represent the real tridiagonal symmetric matrix T. * the rest of the lower part contains the Householder vectors that, combined with Householder coefficients returned by [householderCoefficients()](classeigen_1_1tridiagonalization#ac95b4e43dcf6c3c5074b8bea4fc67887 "Returns the Householder coefficients."), allows to reconstruct the matrix Q as \( Q = H\_{N-1} \ldots H\_1 H\_0 \). Here, the matrices \( H\_i \) are the Householder transformations \( H\_i = (I - h\_i v\_i v\_i^T) \) where \( h\_i \) is the \( i \)th Householder coefficient and \( v\_i \) is the Householder vector defined by \( v\_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \) with M the matrix returned by this function. See LAPACK for further details on this packed storage. Example: ``` Matrix4d X = [Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); Matrix4d A = X + X.transpose(); cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; Tridiagonalization<Matrix4d> triOfA(A); Matrix4d pm = triOfA.packedMatrix(); cout << "The packed matrix M is:" << endl << pm << endl; cout << "The diagonal and subdiagonal corresponds to the matrix T, which is:" << endl << triOfA.matrixT() << endl; ``` Output: ``` Here is a random symmetric 4x4 matrix: 1.36 0.612 0.122 0.326 0.612 -1.21 -0.222 0.563 0.122 -0.222 -0.0904 1.16 0.326 0.563 1.16 1.66 The packed matrix M is: 1.36 0.612 0.122 0.326 -0.704 0.0147 -0.222 0.563 0.0925 1.71 0.856 1.16 0.248 0.785 0.641 -0.506 The diagonal and subdiagonal corresponds to the matrix T, which is: 1.36 -0.704 0 0 -0.704 0.0147 1.71 0 0 1.71 0.856 0.641 0 0 0.641 -0.506 ``` See also [householderCoefficients()](classeigen_1_1tridiagonalization#ac95b4e43dcf6c3c5074b8bea4fc67887 "Returns the Householder coefficients.") subDiagonal() ------------- template<typename MatrixType > | | | --- | | [Tridiagonalization](classeigen_1_1tridiagonalization)< [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9) >::SubDiagonalReturnType [Eigen::Tridiagonalization](classeigen_1_1tridiagonalization)< [MatrixType](classeigen_1_1tridiagonalization#add0f4b2216d0ea8ee0f7d8525deaf0a9) >::subDiagonal | Returns the subdiagonal of the tridiagonal matrix T in the decomposition. Returns expression representing the subdiagonal of T Precondition Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix. See also [diagonal()](classeigen_1_1tridiagonalization#a0b7ff4860aa6f7c0761b1059c012fd8e "Returns the diagonal of the tridiagonal matrix T in the decomposition.") for an example, [matrixT()](classeigen_1_1tridiagonalization#a6eb5ef94b8b9bb013c0e69b6df56d0df "Returns an expression of the tridiagonal matrix T in the decomposition.") --- The documentation for this class was generated from the following file:* [Tridiagonalization.h](https://eigen.tuxfamily.org/dox/Tridiagonalization_8h_source.html)
programming_docs
eigen3 Eigen::Solve Eigen::Solve ============ ### template<typename Decomposition, typename RhsType> class Eigen::Solve< Decomposition, RhsType > Pseudo expression representing a solving operation. Template Parameters | | | | --- | --- | | Decomposition | the type of the matrix or decomposition object | | Rhstype | the type of the right-hand side | This class represents an expression of A.solve(B) and most of the time this is the only way it is used. Inherits Eigen::SolveImpl< Decomposition, RhsType, internal::traits< RhsType >::StorageKind >. --- The documentation for this class was generated from the following file:* [Solve.h](https://eigen.tuxfamily.org/dox/Solve_8h_source.html) eigen3 Eigen::InnerStride Eigen::InnerStride ================== ### template<int Value> class Eigen::InnerStride< Value > Convenience specialization of [Stride](classeigen_1_1stride "Holds strides information for Map.") to specify only an inner stride See class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for some examples. | | | --- | | | | Public Types inherited from [Eigen::Stride< 0, Value >](classeigen_1_1stride) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | | | | Public Member Functions inherited from [Eigen::Stride< 0, Value >](classeigen_1_1stride) | | EIGEN\_CONSTEXPR [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | [inner](classeigen_1_1stride#ab827ee701f5ccbd8f9bdeb32497df572) () const | | | | EIGEN\_CONSTEXPR [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | [outer](classeigen_1_1stride#a010ffe25388932a6c83c6d9d95b95442) () const | | | | | [Stride](classeigen_1_1stride#ae3f37b08ff44d2afe971c0894c2f44a5) () | | | | | [Stride](classeigen_1_1stride#aa9bb1a33da8c785d9cc4ad5d799b9253) (const [Stride](classeigen_1_1stride) &other) | | | | | [Stride](classeigen_1_1stride#a81e299d9d2f8bbfc6d240705dabe5833) ([Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) outerStride, [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) innerStride) | | | --- The documentation for this class was generated from the following file:* [Stride.h](https://eigen.tuxfamily.org/dox/Stride_8h_source.html) eigen3 Eigen::CwiseNullaryOp Eigen::CwiseNullaryOp ===================== ### template<typename NullaryOp, typename PlainObjectType> class Eigen::CwiseNullaryOp< NullaryOp, PlainObjectType > Generic expression of a matrix where all coefficients are defined by a functor. Template Parameters | | | | --- | --- | | NullaryOp | template functor implementing the operator | | PlainObjectType | the underlying plain matrix/array type | This class represents an expression of a generic nullary operator. It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods, and most of the time this is the only way it is used. However, if you want to write a function returning such an expression, you will need to use this class. The functor NullaryOp must expose one of the following method: | | | | --- | --- | | `operator()()` | if the procedural generation does not depend on the coefficient entries (e.g., random numbers) | | `operator()(Index i)` | if the procedural generation makes sense for vectors only and that it depends on the coefficient index `i` (e.g., linspace) | | `operator()(Index i,Index j)` | if the procedural generation depends on the matrix coordinates `i`, `j` (e.g., to generate a checkerboard with 0 and 1) | It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized for vectors. See [DenseBase::NullaryExpr(Index,const CustomNullaryOp&)](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) for an example binding C++11 random number generators. A nullary expression can also be used to implement custom sophisticated matrix manipulations that cannot be covered by the existing set of natively supported matrix manipulations. See this [page](topiccustomizing_nullaryexpr) for some examples and additional explanations on the behavior of [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor."). See also class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression."), class [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions."), [DenseBase::NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) Inherits internal::dense\_xpr\_base::type, and Eigen::internal::no\_assignment\_operator. | | | --- | | | | const NullaryOp & | [functor](classeigen_1_1cwisenullaryop#afef9c2479e357786e4c92da1aa625248) () const | | | functor() --------- template<typename NullaryOp , typename PlainObjectType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const NullaryOp& [Eigen::CwiseNullaryOp](classeigen_1_1cwisenullaryop)< NullaryOp, PlainObjectType >::functor | ( | | ) | const | | inline | Returns the functor representing the nullary operation --- The documentation for this class was generated from the following file:* [CwiseNullaryOp.h](https://eigen.tuxfamily.org/dox/CwiseNullaryOp_8h_source.html) eigen3 Eigen::Stride Eigen::Stride ============= ### template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> class Eigen::Stride< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime > Holds strides information for [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."). This class holds the strides information for mapping arrays with strides with class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."). It holds two values: the inner stride and the outer stride. The inner stride is the pointer increment between two consecutive entries within a given row of a row-major matrix or within a given column of a column-major matrix. The outer stride is the pointer increment between two consecutive rows of a row-major matrix or between two consecutive columns of a column-major matrix. These two values can be passed either at compile-time as template parameters, or at runtime as arguments to the constructor. Indeed, this class takes two template parameters: Template Parameters | | | | --- | --- | | \_OuterStrideAtCompileTime | the outer stride, or Dynamic if you want to specify it at runtime. | | \_InnerStrideAtCompileTime | the inner stride, or Dynamic if you want to specify it at runtime. | Here is an example: ``` int array[24]; for(int i = 0; i < 24; ++i) array[i] = i; cout << Map<MatrixXi, 0, Stride<Dynamic,2> > (array, 3, 3, Stride<Dynamic,2>(8, 2)) << endl; ``` Output: ``` 0 8 16 2 10 18 4 12 20 ``` Both strides can be negative, however, a negative stride of -1 cannot be specified at compiletime because of the ambiguity with Dynamic which is defined to -1 (historically, negative strides were not allowed). See also class [InnerStride](classeigen_1_1innerstride "Convenience specialization of Stride to specify only an inner stride See class Map for some examples."), class [OuterStride](classeigen_1_1outerstride "Convenience specialization of Stride to specify only an outer stride See class Map for some examples."), [Storage orders](group__topicstorageorders) | | | --- | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | | | | | | --- | | | | EIGEN\_CONSTEXPR [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | [inner](classeigen_1_1stride#ab827ee701f5ccbd8f9bdeb32497df572) () const | | | | EIGEN\_CONSTEXPR [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | [outer](classeigen_1_1stride#a010ffe25388932a6c83c6d9d95b95442) () const | | | | | [Stride](classeigen_1_1stride#ae3f37b08ff44d2afe971c0894c2f44a5) () | | | | | [Stride](classeigen_1_1stride#aa9bb1a33da8c785d9cc4ad5d799b9253) (const [Stride](classeigen_1_1stride) &other) | | | | | [Stride](classeigen_1_1stride#a81e299d9d2f8bbfc6d240705dabe5833) ([Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) outerStride, [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) innerStride) | | | Index ----- template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::[Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | **[Deprecated:](deprecated#_deprecated000005)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Stride() [1/3] -------------- template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::[Stride](classeigen_1_1stride) | ( | | ) | | | inline | Default constructor, for use when strides are fixed at compile time Stride() [2/3] -------------- template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::[Stride](classeigen_1_1stride) | ( | [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | *outerStride*, | | | | [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) | *innerStride* | | | ) | | | | inline | Constructor allowing to pass the strides at runtime Stride() [3/3] -------------- template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::[Stride](classeigen_1_1stride) | ( | const [Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime > & | *other* | ) | | | inline | Copy constructor inner() ------- template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) [Eigen::Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::inner | ( | | ) | const | | inline | Returns the inner stride outer() ------- template<int \_OuterStrideAtCompileTime, int \_InnerStrideAtCompileTime> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](classeigen_1_1stride#a96c2dfb0ce43fd8e19adcdf6094f5f63) [Eigen::Stride](classeigen_1_1stride)< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >::outer | ( | | ) | const | | inline | Returns the outer stride --- The documentation for this class was generated from the following file:* [Stride.h](https://eigen.tuxfamily.org/dox/Stride_8h_source.html) eigen3 Eigen::Product Eigen::Product ============== ### template<typename \_Lhs, typename \_Rhs, int Option> class Eigen::Product< \_Lhs, \_Rhs, Option > Expression of the product of two arbitrary matrices or vectors. Template Parameters | | | | --- | --- | | \_Lhs | the type of the left-hand side expression | | \_Rhs | the type of the right-hand side expression | This class represents an expression of the product of two arbitrary matrices. The other template parameters are: Template Parameters | | | | --- | --- | | Option | can be DefaultProduct, AliasFreeProduct, or LazyProduct | Inherits Eigen::ProductImpl< \_Lhs, \_Rhs, Option, internal::product\_promote\_storage\_type< internal::traits< \_Lhs >::StorageKind, internal::traits< \_Rhs >::StorageKind, internal::product\_type< \_Lhs, \_Rhs >::ret >::ret >. --- The documentation for this class was generated from the following file:* [Product.h](https://eigen.tuxfamily.org/dox/Product_8h_source.html) eigen3 Eigen::NoAlias Eigen::NoAlias ============== ### template<typename ExpressionType, template< typename > class StorageBase> class Eigen::NoAlias< ExpressionType, StorageBase > Pseudo expression providing an operator = assuming no aliasing. Template Parameters | | | | --- | --- | | ExpressionType | the type of the object on which to do the lazy assignment | This class represents an expression with special assignment operators assuming no aliasing between the target expression and the source expression. More precisely it alloas to bypass the EvalBeforeAssignBit flag of the source expression. It is the return type of [MatrixBase::noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) and most of the time this is the only way it is used. See also [MatrixBase::noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) --- The documentation for this class was generated from the following file:* [NoAlias.h](https://eigen.tuxfamily.org/dox/NoAlias_8h_source.html) eigen3 Eigen::PardisoLDLT Eigen::PardisoLDLT ================== ### template<typename MatrixType, int Options> class Eigen::PardisoLDLT< MatrixType, Options > A sparse direct Cholesky ([LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.")) factorization and solver based on the PARDISO library. This class allows to solve for A.X = B sparse linear problems via a LDL^T Cholesky factorization using the Intel MKL PARDISO library. The sparse matrix A is assumed to be selfajoint and positive definite. For complex matrices, A can also be symmetric only, see the *Options* template parameter. The vectors or matrices X and B can be either dense or sparse. By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set: ``` solver.pardisoParameterArray()[59] = 1; ``` Template Parameters | | | | --- | --- | | MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | Options | can be any bitwise combination of Upper, Lower, and Symmetric. The default is Upper, meaning only the upper triangular part has to be used. Symmetric can be used for symmetric, non-selfadjoint complex matrices, the default being to assume a selfadjoint matrix. Upper|Lower can be used to tell both triangular parts can be used as input. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SimplicialLDLT](classeigen_1_1simplicialldlt "A direct sparse LDLT Cholesky factorizations without square root.") Inherits Eigen::PardisoImpl< Derived >. --- The documentation for this class was generated from the following file:* [PardisoSupport.h](https://eigen.tuxfamily.org/dox/PardisoSupport_8h_source.html) eigen3 Eigen::BDCSVD Eigen::BDCSVD ============= ### template<typename \_MatrixType> class Eigen::BDCSVD< \_MatrixType > class Bidiagonal Divide and Conquer SVD Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the SVD decomposition | This class first reduces the input matrix to bi-diagonal form using class UpperBidiagonalization, and then performs a divide-and-conquer diagonalization. Small blocks are diagonalized using class [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix."). You can control the switching size with the setSwitchSize() method, default is 16. For small matrice (<16), it is thus preferable to directly use [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix."). For larger ones, [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD") is highly recommended and can several order of magnitude faster. Warning this algorithm is unlikely to provide accurate result when compiled with unsafe math optimizations. For instance, this concerns Intel's compiler (ICC), which performs such optimization by default unless you compile with the `-fp-model` `precise` option. Likewise, the `-ffast-math` option of GCC or clang will significantly degrade the accuracy. See also class [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") | | | --- | | | | | [BDCSVD](classeigen_1_1bdcsvd#a39514816d38f9c418cf3f3514b511c2c) () | | | Default Constructor. [More...](classeigen_1_1bdcsvd#a39514816d38f9c418cf3f3514b511c2c) | | | | | [BDCSVD](classeigen_1_1bdcsvd#a302746d9c534cd513c1df87c7ae4850d) (const MatrixType &matrix, unsigned int computationOptions=0) | | | Constructor performing the decomposition of given matrix. [More...](classeigen_1_1bdcsvd#a302746d9c534cd513c1df87c7ae4850d) | | | | | [BDCSVD](classeigen_1_1bdcsvd#a3e1fa48b3d042b7daf7392724a68bb60) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1bdcsvd#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1bdcsvd#a2d768a9877f5f69f49432d447b552bfe), unsigned int computationOptions=0) | | | Default Constructor with memory preallocation. [More...](classeigen_1_1bdcsvd#a3e1fa48b3d042b7daf7392724a68bb60) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1bdcsvd#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [BDCSVD](classeigen_1_1bdcsvd) & | [compute](classeigen_1_1bdcsvd#acf27f41ed044d74ea8e8cbaf17ffdb04) (const MatrixType &matrix) | | | Method performing the decomposition of given matrix using current options. [More...](classeigen_1_1bdcsvd#acf27f41ed044d74ea8e8cbaf17ffdb04) | | | | [BDCSVD](classeigen_1_1bdcsvd) & | [compute](classeigen_1_1bdcsvd#a52e3c627775010775c64d16a00cdb770) (const MatrixType &matrix, unsigned int computationOptions) | | | Method performing the decomposition of given matrix using custom options. [More...](classeigen_1_1bdcsvd#a52e3c627775010775c64d16a00cdb770) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1bdcsvd#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::SVDBase< BDCSVD< \_MatrixType > >](classeigen_1_1svdbase) | | bool | [computeU](classeigen_1_1svdbase#a705a7c2709e1624ccc19aa748a78d473) () const | | | | bool | [computeV](classeigen_1_1svdbase#a5f12efcb791eb007d4a4890ac5255ac4) () const | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292) | | | | const [MatrixUType](classeigen_1_1matrix) & | [matrixU](classeigen_1_1svdbase#afc7fe1546b0f6e1801b86f22f5664cb8) () const | | | | const [MatrixVType](classeigen_1_1matrix) & | [matrixV](classeigen_1_1svdbase#a245a453b5e7347f737295c23133238c4) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonzeroSingularValues](classeigen_1_1svdbase#afe8a555f38393a319a71ec0f0331c9ef) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rank](classeigen_1_1svdbase#a30b89e24f42f1692079eea31b361d26a) () const | | | | [BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType > & | [setThreshold](classeigen_1_1svdbase#a1c95d05398fc15e410a28560ef70a5a6) (const RealScalar &[threshold](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69)) | | | | [BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType > & | [setThreshold](classeigen_1_1svdbase#a27586b69dbfb63f714d1d45fd6304f97) (Default\_t) | | | | const SingularValuesType & | [singularValues](classeigen_1_1svdbase#a4e7bac123570c348f7ed6be909e1e474) () const | | | | const [Solve](classeigen_1_1solve)< [BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType >, Rhs > | [solve](classeigen_1_1svdbase#ab28499936c0764fe5b56b9f4de701e26) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | RealScalar | [threshold](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69) () const | | | | Public Member Functions inherited from [Eigen::SolverBase< Derived >](classeigen_1_1solverbase) | | AdjointReturnType | [adjoint](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) () const | | | | Derived & | [derived](classeigen_1_1solverbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1solverbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | | [SolverBase](classeigen_1_1solverbase#a4d5e5baddfba3790ab1a5f247dcc4dc1) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SVDBase< BDCSVD< \_MatrixType > >](classeigen_1_1svdbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1svdbase#a6229a37997eca1072b52cca5ee7a2bec) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SVDBase< BDCSVD< \_MatrixType > >](classeigen_1_1svdbase) | | | [SVDBase](classeigen_1_1svdbase#abed06fc6f4b743e1f76a7b317539da87) () | | | Default Constructor. [More...](classeigen_1_1svdbase#abed06fc6f4b743e1f76a7b317539da87) | | | BDCSVD() [1/3] -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType >::[BDCSVD](classeigen_1_1bdcsvd) | ( | | ) | | | inline | Default Constructor. The default constructor is useful in cases in which the user intends to perform decompositions via [BDCSVD::compute(const MatrixType&)](classeigen_1_1bdcsvd#acf27f41ed044d74ea8e8cbaf17ffdb04 "Method performing the decomposition of given matrix using current options."). BDCSVD() [2/3] -------------- template<typename \_MatrixType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType >::[BDCSVD](classeigen_1_1bdcsvd) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols*, | | | | unsigned int | *computationOptions* = `0` | | | ) | | | | inline | Default Constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem size. See also [BDCSVD()](classeigen_1_1bdcsvd#a39514816d38f9c418cf3f3514b511c2c "Default Constructor.") BDCSVD() [3/3] -------------- template<typename \_MatrixType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType >::[BDCSVD](classeigen_1_1bdcsvd) | ( | const MatrixType & | *matrix*, | | | | unsigned int | *computationOptions* = `0` | | | ) | | | | inline | Constructor performing the decomposition of given matrix. Parameters | | | | --- | --- | | matrix | the matrix to decompose | | computationOptions | optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. By default, none is computed. This is a bit - field, the possible bits are [ComputeFullU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9fa9302d510cee20c26311154937e23f), [ComputeThinU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527), [ComputeFullV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a36581f7c662f7def31efd500c284f930), [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47). | Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not available with the (non - default) [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") preconditioner. cols() ------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::cols | ( | void | | ) | | | inline | Returns the number of columns. See also [rows()](classeigen_1_1bdcsvd#ac22eb0695d00edd7d4a3b2d0a98b81c2), ColsAtCompileTime compute() [1/2] --------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [BDCSVD](classeigen_1_1bdcsvd)& [Eigen::BDCSVD](classeigen_1_1bdcsvd)< \_MatrixType >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Method performing the decomposition of given matrix using current options. Parameters | | | | --- | --- | | matrix | the matrix to decompose | This method uses the current *computationOptions*, as already passed to the constructor or to [compute(const MatrixType&, unsigned int)](classeigen_1_1bdcsvd#a52e3c627775010775c64d16a00cdb770 "Method performing the decomposition of given matrix using custom options."). compute() [2/2] --------------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [BDCSVD](classeigen_1_1bdcsvd)< MatrixType > & [Eigen::BDCSVD](classeigen_1_1bdcsvd)< MatrixType >::compute | ( | const MatrixType & | *matrix*, | | | | unsigned int | *computationOptions* | | | ) | | | Method performing the decomposition of given matrix using custom options. Parameters | | | | --- | --- | | matrix | the matrix to decompose | | computationOptions | optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. By default, none is computed. This is a bit - field, the possible bits are [ComputeFullU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9fa9302d510cee20c26311154937e23f), [ComputeThinU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527), [ComputeFullV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a36581f7c662f7def31efd500c284f930), [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47). | Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not available with the (non - default) [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") preconditioner. rows() ------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::rows | ( | void | | ) | | | inline | Returns the number of rows. See also [cols()](classeigen_1_1bdcsvd#a2d768a9877f5f69f49432d447b552bfe), RowsAtCompileTime --- The documentation for this class was generated from the following file:* [BDCSVD.h](https://eigen.tuxfamily.org/dox/BDCSVD_8h_source.html)
programming_docs
eigen3 Eigen::WithFormat Eigen::WithFormat ================= ### template<typename ExpressionType> class Eigen::WithFormat< ExpressionType > Pseudo expression providing matrix output with given format. Template Parameters | | | | --- | --- | | ExpressionType | the type of the object on which IO stream operations are performed | This class represents an expression with stream operators controlled by a given [IOFormat](structeigen_1_1ioformat "Stores a set of parameters controlling the way matrices are printed."). It is the return type of [DenseBase::format()](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) and most of the time this is the only way it is used. See class [IOFormat](structeigen_1_1ioformat "Stores a set of parameters controlling the way matrices are printed.") for some examples. See also [DenseBase::format()](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7), class [IOFormat](structeigen_1_1ioformat "Stores a set of parameters controlling the way matrices are printed.") --- The documentation for this class was generated from the following file:* [IO.h](https://eigen.tuxfamily.org/dox/IO_8h_source.html) eigen3 Eigen::VectorBlock Eigen::VectorBlock ================== ### template<typename VectorType, int Size> class Eigen::VectorBlock< VectorType, Size > Expression of a fixed-size or dynamic-size sub-vector. Template Parameters | | | | --- | --- | | VectorType | the type of the object in which we are taking a sub-vector | | Size | size of the sub-vector we are taking at compile time (optional) | This class represents an expression of either a fixed-size or dynamic-size sub-vector. It is the return type of DenseBase::segment(Index,Index) and DenseBase::segment<int>(Index) and most of the time this is the only way it is used. However, if you want to directly manipulate sub-vector expressions, for instance if you want to write a function returning such an expression, you will need to use this class. Here is an example illustrating the dynamic case: ``` #include <Eigen/Core> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; template<typename Derived> [Eigen::VectorBlock<Derived>](classeigen_1_1vectorblock) segmentFromRange(MatrixBase<Derived>& v, int start, int end) { return [Eigen::VectorBlock<Derived>](classeigen_1_1vectorblock)(v.derived(), start, end-start); } template<typename Derived> const [Eigen::VectorBlock<const Derived>](classeigen_1_1vectorblock) segmentFromRange(const MatrixBase<Derived>& v, int start, int end) { return [Eigen::VectorBlock<const Derived>](classeigen_1_1vectorblock)(v.derived(), start, end-start); } int main(int, char**) { Matrix<int,1,6> v; v << 1,2,3,4,5,6; cout << segmentFromRange(2*v, 2, 4) << endl; // calls the const version segmentFromRange(v, 1, 3) *= 5; // calls the non-const version cout << "Now the vector v is:" << endl << v << endl; return 0; } ``` Output: ``` 6 8 Now the vector v is: 1 10 15 4 5 6 ``` Note Even though this expression has dynamic size, in the case where *VectorType* has fixed size, this expression inherits a fixed maximal size which means that evaluating it does not cause a dynamic memory allocation. Here is an example illustrating the fixed-size case: ``` #include <Eigen/Core> #include <iostream> using namespace [Eigen](namespaceeigen); using namespace std; template<typename Derived> [Eigen::VectorBlock<Derived, 2>](classeigen_1_1vectorblock) firstTwo(MatrixBase<Derived>& v) { return [Eigen::VectorBlock<Derived, 2>](classeigen_1_1vectorblock)(v.derived(), 0); } template<typename Derived> const [Eigen::VectorBlock<const Derived, 2>](classeigen_1_1vectorblock) firstTwo(const MatrixBase<Derived>& v) { return [Eigen::VectorBlock<const Derived, 2>](classeigen_1_1vectorblock)(v.derived(), 0); } int main(int, char**) { Matrix<int,1,6> v; v << 1,2,3,4,5,6; cout << firstTwo(4*v) << endl; // calls the const version firstTwo(v) *= 2; // calls the non-const version cout << "Now the vector v is:" << endl << v << endl; return 0; } ``` Output: ``` 4 8 Now the vector v is: 2 4 3 4 5 6 ``` See also class [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block."), DenseBase::segment(Index,Index,Index,Index), DenseBase::segment(Index,Index) | | | --- | | | | | [VectorBlock](classeigen_1_1vectorblock#a2364b6e64015c451ed93b68d39eaeffd) (VectorType &vector, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) start) | | | | | [VectorBlock](classeigen_1_1vectorblock#a11a5f0478de60b9cd8c15faf6dbc5baf) (VectorType &vector, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) start, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size) | | | VectorBlock() [1/2] ------------------- template<typename VectorType , int Size> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::VectorBlock](classeigen_1_1vectorblock)< VectorType, Size >::[VectorBlock](classeigen_1_1vectorblock) | ( | VectorType & | *vector*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *start*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *size* | | | ) | | | | inline | Dynamic-size constructor VectorBlock() [2/2] ------------------- template<typename VectorType , int Size> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::VectorBlock](classeigen_1_1vectorblock)< VectorType, Size >::[VectorBlock](classeigen_1_1vectorblock) | ( | VectorType & | *vector*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *start* | | | ) | | | | inline | Fixed-size constructor --- The documentation for this class was generated from the following file:* [VectorBlock.h](https://eigen.tuxfamily.org/dox/VectorBlock_8h_source.html) eigen3 Eigen::ScalarBinaryOpTraits Eigen::ScalarBinaryOpTraits =========================== ### template<typename ScalarA, typename ScalarB, typename BinaryOp = internal::scalar\_product\_op<ScalarA,ScalarB>> class Eigen::ScalarBinaryOpTraits< ScalarA, ScalarB, BinaryOp > Determines whether the given binary operation of two numeric types is allowed and what the scalar return type is. This class permits to control the scalar return type of any binary operation performed on two different scalar types through (partial) template specializations. For instance, let `U1`, `U2` and `U3` be three user defined scalar types for which most operations between instances of `U1` and `U2` returns an `U3`. You can let Eigen knows that by defining: ``` template<typename BinaryOp> struct ScalarBinaryOpTraits<U1,U2,BinaryOp> { typedef U3 ReturnType; }; template<typename BinaryOp> struct ScalarBinaryOpTraits<U2,U1,BinaryOp> { typedef U3 ReturnType; }; ``` You can then explicitly disable some particular operations to get more explicit error messages: ``` template<> struct ScalarBinaryOpTraits<U1,U2,internal::scalar_max_op<U1,U2> > {}; ``` Or customize the return type for individual operation: ``` template<> struct ScalarBinaryOpTraits<U1,U2,internal::scalar_sum_op<U1,U2> > { typedef U1 ReturnType; }; ``` By default, the following generic combinations are supported: | ScalarA | ScalarB | BinaryOp | ReturnType | Note | | --- | --- | --- | --- | --- | | `T` | `T` | `*` | `T` | | | `NumTraits<T>::Real` | `T` | `*` | `T` | Only if `NumTraits<T>::IsComplex` | | `T` | `NumTraits<T>::Real` | `*` | `T` | Only if `NumTraits<T>::IsComplex` | See also [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") --- The documentation for this class was generated from the following file:* [XprHelper.h](https://eigen.tuxfamily.org/dox/XprHelper_8h_source.html) eigen3 Eigen::symbolic::BaseExpr Eigen::symbolic::BaseExpr ========================= ### template<typename Derived> class Eigen::symbolic::BaseExpr< Derived > Common base class of any symbolic expressions | | | --- | | | | template<typename T > | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [eval](classeigen_1_1symbolic_1_1baseexpr#a4149f50157823063e59c18ce04ed2496) (const T &values) const | | | eval() ------ template<typename Derived > template<typename T > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::symbolic::BaseExpr](classeigen_1_1symbolic_1_1baseexpr)< Derived >::eval | ( | const T & | *values* | ) | const | | inline | Evaluate the expression given the *values* of the symbols. Parameters | | | | --- | --- | | values | defines the values of the symbols, it can either be a [SymbolValue](classeigen_1_1symbolic_1_1symbolvalue) or a std::tuple of [SymbolValue](classeigen_1_1symbolic_1_1symbolvalue) as constructed by [SymbolExpr::operator=](classeigen_1_1symbolic_1_1symbolexpr#a0bd43167911dc398fba4e3f0f142a64d) operator. | --- The documentation for this class was generated from the following file:* [SymbolicIndex.h](https://eigen.tuxfamily.org/dox/SymbolicIndex_8h_source.html) eigen3 Aliasing Aliasing ======== In Eigen, aliasing refers to assignment statement in which the same matrix (or array or vector) appears on the left and on the right of the assignment operators. Statements like `mat = 2 * mat;` or `mat = mat.transpose();` exhibit aliasing. The aliasing in the first example is harmless, but the aliasing in the second example leads to unexpected results. This page explains what aliasing is, when it is harmful, and what to do about it. Examples ========== Here is a simple example exhibiting aliasing: | Example | Output | | --- | --- | | ``` MatrixXi mat(3,3); mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << "Here is the matrix mat:\n" << mat << endl; // This assignment shows the aliasing problem mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2); cout << "After the assignment, mat = \n" << mat << endl; ``` | ``` Here is the matrix mat: 1 2 3 4 5 6 7 8 9 After the assignment, mat = 1 2 3 4 1 2 7 4 1 ``` | The output is not what one would expect. The problem is the assignment ``` mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2); ``` This assignment exhibits aliasing: the coefficient `mat(1,1)` appears both in the block `mat.bottomRightCorner(2,2)` on the left-hand side of the assignment and the block `mat.topLeftCorner(2,2)` on the right-hand side. After the assignment, the (2,2) entry in the bottom right corner should have the value of `mat(1,1)` before the assignment, which is 5. However, the output shows that `mat(2,2)` is actually 1. The problem is that Eigen uses lazy evaluation (see [Expression templates in Eigen](topiceigenexpressiontemplates)) for `mat.topLeftCorner(2,2)`. The result is similar to ``` mat(1,1) = mat(0,0); mat(1,2) = mat(0,1); mat(2,1) = mat(1,0); mat(2,2) = mat(1,1); ``` Thus, `mat(2,2)` is assigned the *new* value of `mat(1,1)` instead of the old value. The next section explains how to solve this problem by calling [eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b). Aliasing occurs more naturally when trying to shrink a matrix. For example, the expressions `vec = vec.head(n)` and `mat = mat.block(i,j,r,c)` exhibit aliasing. In general, aliasing cannot be detected at compile time: if `mat` in the first example were a bit bigger, then the blocks would not overlap, and there would be no aliasing problem. However, Eigen does detect some instances of aliasing, albeit at run time. The following example exhibiting aliasing was mentioned in [Matrix and vector arithmetic](group__tutorialmatrixarithmetic) : | Example | Output | | --- | --- | | ``` Matrix2i a; a << 1, 2, 3, 4; cout << "Here is the matrix a:\n" << a << endl; a = a.transpose(); // !!! do NOT do this !!! cout << "and the result of the aliasing effect:\n" << a << endl; ``` | ``` Here is the matrix a: 1 2 3 4 and the result of the aliasing effect: 1 2 2 4 ``` | Again, the output shows the aliasing issue. However, by default Eigen uses a run-time assertion to detect this and exits with a message like ``` void Eigen::DenseBase<Derived>::checkTransposeAliasing(const OtherDerived&) const [with OtherDerived = Eigen::Transpose<Eigen::Matrix<int, 2, 2, 0, 2, 2> >, Derived = Eigen::Matrix<int, 2, 2, 0, 2, 2>]: Assertion `(!internal::check_transpose_aliasing_selector<Scalar,internal::blas_traits<Derived>::IsTransposed,OtherDerived>::run(internal::extract_data(derived()), other)) && "aliasing detected during transposition, use transposeInPlace() or evaluate the rhs into a temporary using .eval()"' failed. ``` The user can turn Eigen's run-time assertions like the one to detect this aliasing problem off by defining the EIGEN\_NO\_DEBUG macro, and the above program was compiled with this macro turned off in order to illustrate the aliasing problem. See [Assertions](topicassertions) for more information about Eigen's run-time assertions. Resolving aliasing issues =========================== If you understand the cause of the aliasing issue, then it is obvious what must happen to solve it: Eigen has to evaluate the right-hand side fully into a temporary matrix/array and then assign it to the left-hand side. The function [eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) does precisely that. For example, here is the corrected version of the first example above: | Example | Output | | --- | --- | | ``` MatrixXi mat(3,3); mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << "Here is the matrix mat:\n" << mat << endl; // The eval() solves the aliasing problem mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval(); cout << "After the assignment, mat = \n" << mat << endl; ``` | ``` Here is the matrix mat: 1 2 3 4 5 6 7 8 9 After the assignment, mat = 1 2 3 4 1 2 7 4 5 ``` | Now, `mat(2,2)` equals 5 after the assignment, as it should be. The same solution also works for the second example, with the transpose: simply replace the line `a = a.transpose();` with `a = a.transpose().eval();`. However, in this common case there is a better solution. Eigen provides the special-purpose function [transposeInPlace()](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) which replaces a matrix by its transpose. This is shown below: | Example | Output | | --- | --- | | ``` MatrixXf a(2,3); a << 1, 2, 3, 4, 5, 6; cout << "Here is the initial matrix a:\n" << a << endl; a.transposeInPlace(); cout << "and after being transposed:\n" << a << endl; ``` | ``` Here is the initial matrix a: 1 2 3 4 5 6 and after being transposed: 1 4 2 5 3 6 ``` | If an xxxInPlace() function is available, then it is best to use it, because it indicates more clearly what you are doing. This may also allow Eigen to optimize more aggressively. These are some of the xxxInPlace() functions provided: | Original function | In-place function | | --- | --- | | [MatrixBase::adjoint()](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) | [MatrixBase::adjointInPlace()](classeigen_1_1matrixbase#a51c5982c1f64e45a939515b701fa6f4a) | | [DenseBase::reverse()](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) | [DenseBase::reverseInPlace()](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) | | [LDLT::solve()](classeigen_1_1ldlt#aa257dd7a8acf8b347d5a22a13d6ca3e1) | LDLT::solveInPlace() | | [LLT::solve()](classeigen_1_1llt#a3738bb3ce6f9b837a2beb432b937499f) | LLT::solveInPlace() | | TriangularView::solve() | TriangularView::solveInPlace() | | [DenseBase::transpose()](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) | [DenseBase::transposeInPlace()](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) | In the special case where a matrix or vector is shrunk using an expression like `vec = vec.head(n)`, you can use [conservativeResize()](classeigen_1_1plainobjectbase#a712c25be1652e5a64a00f28c8ed11462) . Aliasing and component-wise operations ======================================== As explained above, it may be dangerous if the same matrix or array occurs on both the left-hand side and the right-hand side of an assignment operator, and it is then often necessary to evaluate the right-hand side explicitly. However, applying component-wise operations (such as matrix addition, scalar multiplication and array multiplication) is safe. The following example has only component-wise operations. Thus, there is no need for [eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) even though the same matrix appears on both sides of the assignments. | Example | Output | | --- | --- | | ``` MatrixXf mat(2,2); mat << 1, 2, 4, 7; cout << "Here is the matrix mat:\n" << mat << endl << endl; mat = 2 * mat; cout << "After 'mat = 2 \* mat', mat = \n" << mat << endl << endl; mat = mat - [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(2,2); cout << "After the subtraction, it becomes\n" << mat << endl << endl; ArrayXXf arr = mat; arr = arr.square(); cout << "After squaring, it becomes\n" << arr << endl << endl; // Combining all operations in one statement: mat << 1, 2, 4, 7; mat = (2 * mat - [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(2,2)).array().square(); cout << "Doing everything at once yields\n" << mat << endl << endl; ``` | ``` Here is the matrix mat: 1 2 4 7 After 'mat = 2 * mat', mat = 2 4 8 14 After the subtraction, it becomes 1 4 8 13 After squaring, it becomes 1 16 64 169 Doing everything at once yields 1 16 64 169 ``` | In general, an assignment is safe if the (i,j) entry of the expression on the right-hand side depends only on the (i,j) entry of the matrix or array on the left-hand side and not on any other entries. In that case it is not necessary to evaluate the right-hand side explicitly. Aliasing and matrix multiplication ==================================== [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") multiplication is the only operation in Eigen that assumes aliasing by default, **under the condition that the destination matrix is not resized**. Thus, if `matA` is a **squared** matrix, then the statement `matA = matA * matA;` is safe. All other operations in Eigen assume that there are no aliasing problems, either because the result is assigned to a different matrix or because it is a component-wise operation. | Example | Output | | --- | --- | | ``` MatrixXf matA(2,2); matA << 2, 0, 0, 2; matA = matA * matA; cout << matA; ``` | ``` 4 0 0 4 ``` | However, this comes at a price. When executing the expression `matA = matA * matA`, Eigen evaluates the product in a temporary matrix which is assigned to `matA` after the computation. This is fine. But Eigen does the same when the product is assigned to a different matrix (e.g., `matB = matA * matA`). In that case, it is more efficient to evaluate the product directly into `matB` instead of evaluating it first into a temporary matrix and copying that matrix to `matB`. The user can indicate with the [noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) function that there is no aliasing, as follows: `matB.noalias() = matA * matA`. This allows Eigen to evaluate the matrix product `matA * matA` directly into `matB`. | Example | Output | | --- | --- | | ``` MatrixXf matA(2,2), matB(2,2); matA << 2, 0, 0, 2; // Simple but not quite as efficient matB = matA * matA; cout << matB << endl << endl; // More complicated but also more efficient matB.noalias() = matA * matA; cout << matB; ``` | ``` 4 0 0 4 4 0 0 4 ``` | Of course, you should not use `noalias()` when there is in fact aliasing taking place. If you do, then you may get wrong results: | Example | Output | | --- | --- | | ``` MatrixXf matA(2,2); matA << 2, 0, 0, 2; matA.noalias() = matA * matA; cout << matA; ``` | ``` 4 0 0 4 ``` | Moreover, starting in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3, aliasing is **not** assumed if the destination matrix is resized and the product is not directly assigned to the destination. Therefore, the following example is also wrong: | Example | Output | | --- | --- | | ``` MatrixXf A(2,2), B(3,2); B << 2, 0, 0, 3, 1, 1; A << 2, 0, 0, -2; A = (B * A).cwiseAbs(); cout << A; ``` | ``` 4 0 0 6 2 2 ``` | As for any aliasing issue, you can resolve it by explicitly evaluating the expression prior to assignment: | Example | Output | | --- | --- | | ``` MatrixXf A(2,2), B(3,2); B << 2, 0, 0, 3, 1, 1; A << 2, 0, 0, -2; A = (B * A).eval().cwiseAbs(); cout << A; ``` | ``` 4 0 0 6 2 2 ``` | Summary ========= Aliasing occurs when the same matrix or array coefficients appear both on the left- and the right-hand side of an assignment operator. * Aliasing is harmless with coefficient-wise computations; this includes scalar multiplication and matrix or array addition. * When you multiply two matrices, Eigen assumes that aliasing occurs. If you know that there is no aliasing, then you can use [noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b). * In all other situations, Eigen assumes that there is no aliasing issue and thus gives the wrong result if aliasing does in fact occur. To prevent this, you have to use [eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) or one of the xxxInPlace() functions.
programming_docs
eigen3 Eigen::DiagonalPreconditioner Eigen::DiagonalPreconditioner ============================= ### template<typename \_Scalar> class Eigen::DiagonalPreconditioner< \_Scalar > A preconditioner based on the digonal entries. This class allows to approximately solve for A.x = b problems assuming A is a diagonal matrix. In other words, this preconditioner neglects all off diagonal entries and, in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s language, solves for: ``` A.diagonal().asDiagonal() . x = b ``` Template Parameters | | | | --- | --- | | \_Scalar | the type of the scalar. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . This preconditioner is suitable for both selfadjoint and general problems. The diagonal entries are pre-inverted and stored into a dense vector. Note A variant that has yet to be implemented would attempt to preserve the norm of each column. See also class [LeastSquareDiagonalPreconditioner](classeigen_1_1leastsquarediagonalpreconditioner "Jacobi preconditioner for LeastSquaresConjugateGradient."), class [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems.") --- The documentation for this class was generated from the following file:* [BasicPreconditioners.h](https://eigen.tuxfamily.org/dox/BasicPreconditioners_8h_source.html) eigen3 Eigen::SparseMatrixBase Eigen::SparseMatrixBase ======================= ### template<typename Derived> class Eigen::SparseMatrixBase< Derived > Base class of any sparse matrices or sparse expressions. Template Parameters | | | | --- | --- | | Derived | is the derived type, e.g. a sparse matrix type, or an expression, etc. | This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_SPARSEMATRIXBASE_PLUGIN`. | | | --- | | | | enum | { [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604) , [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14) , [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) , **MaxRowsAtCompileTime** , **MaxColsAtCompileTime** , **MaxSizeAtCompileTime** , [IsVectorAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a14a3f566ed2a074beddb8aef0223bfdf) , [NumDimensions](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2366131ffcc38bff48a1c7572eb86dd3) , [Flags](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2af043b36fe9e08df0107cf6de496165) , **IsRowMajor** , **InnerSizeAtCompileTime** } | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | | | --- | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< Derived >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< Derived, [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)|[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | StorageIndex ------------ template<typename Derived > | | | --- | | typedef internal::traits<Derived>::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | The integer type used to **store** indices within a [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation."). For a `SparseMatrix<Scalar,Options,IndexType>` it an alias of the third template parameter `IndexType`. value\_type ----------- template<typename Derived > | | | --- | | typedef Scalar [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::[value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. It is an alias for the Scalar type anonymous enum -------------- template<typename Derived > | | | --- | | anonymous enum | | Enumerator | | --- | | RowsAtCompileTime | The number of rows at compile-time. This is just a copy of the value provided by the *Derived* type. If a value is not known at compile-time, it is set to the *Dynamic* constant. See also [MatrixBase::rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [MatrixBase::cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14), [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) | | ColsAtCompileTime | The number of columns at compile-time. This is just a copy of the value provided by the *Derived* type. If a value is not known at compile-time, it is set to the *Dynamic* constant. See also [MatrixBase::rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [MatrixBase::cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604), [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) | | SizeAtCompileTime | This is equal to the number of coefficients, i.e. the number of rows times the number of columns, or to *Dynamic* if this is not known at compile-time. See also [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604), [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14) | | IsVectorAtCompileTime | This is set to true if either the number of rows or the number of columns is known at compile-time to be equal to 1. Indeed, in that case, we are dealing with a column-vector (if there is only one column) or with a row-vector (if there is only one row). | | NumDimensions | This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, and 2 for matrices. | | Flags | This stores expression [Flags](group__flags) flags which may or may not be inherited by new expressions constructed from this one. See the [list of flags](group__flags). | cols() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::cols | ( | void | | ) | const | | inline | Returns the number of columns. See also [rows()](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) eval() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::eval<Derived>::type [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::eval | ( | | ) | const | | inline | Returns the matrix or vector obtained by evaluating this expression. Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy. innerSize() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::innerSize | ( | | ) | const | | inline | Returns the size of the inner dimension according to the storage order, i.e., the number of rows for a columns major matrix, and the number of cols otherwise isVector() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::isVector | ( | | ) | const | | inline | Returns true if either the number of rows or the number of columns is equal to 1. In other words, this function returns ``` [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f)()==1 || [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee)()==1 ``` See also [rows()](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f), [cols()](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee), [IsVectorAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a14a3f566ed2a074beddb8aef0223bfdf). operator\*() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Product](classeigen_1_1product)< Derived, OtherDerived, AliasFreeProduct > [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::operator\* | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > & | *other* | ) | const | | inline | Returns an expression of the product of two sparse matrices. By default a conservative product preserving the symbolic non zeros is performed. The automatic pruning of the small values can be achieved by calling the [pruned()](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) function in which case a totally different product algorithm is employed: ``` C = (A*B).[pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d)(); // suppress numerical zeros (exact) C = (A*B).[pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d)(ref); C = (A*B).[pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d)(ref,epsilon); ``` where `ref` is a meaningful non zero reference value. outerSize() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::outerSize | ( | | ) | const | | inline | Returns the size of the storage major dimension, i.e., the number of columns for a columns major matrix, and the number of rows otherwise pruned() -------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [SparseView](classeigen_1_1sparseview)< Derived > [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::pruned | ( | const Scalar & | *reference* = `Scalar(0)`, | | | | const RealScalar & | *epsilon* = `[NumTraits](structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Returns an expression of `*this` with values smaller than *reference* \* *epsilon* removed. This method is typically used in conjunction with the product of two sparse matrices to automatically prune the smallest values as follows: ``` C = (A*B).[pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d)(); // suppress numerical zeros (exact) C = (A*B).[pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d)(ref); C = (A*B).[pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d)(ref,epsilon); ``` where `ref` is a meaningful non zero reference value. rows() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::rows | ( | void | | ) | const | | inline | Returns the number of rows. See also [cols()](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) size() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::size | ( | | ) | const | | inline | Returns the number of coefficients, which is *[rows()](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f)\*cols*(). See also [rows()](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f), [cols()](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee). twistedBy() ----------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | SparseSymmetricPermutationProduct<Derived,[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)|[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)> [Eigen::SparseMatrixBase](classeigen_1_1sparsematrixbase)< Derived >::twistedBy | ( | const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > & | *perm* | ) | const | | inline | Returns an expression of P H P^-1 where H is the matrix represented by `*this` --- The documentation for this class was generated from the following files:* [SparseMatrixBase.h](https://eigen.tuxfamily.org/dox/SparseMatrixBase_8h_source.html) * [SparseAssign.h](https://eigen.tuxfamily.org/dox/SparseAssign_8h_source.html) * [SparseCwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/SparseCwiseBinaryOp_8h_source.html) * [SparseCwiseUnaryOp.h](https://eigen.tuxfamily.org/dox/SparseCwiseUnaryOp_8h_source.html) * [SparseDot.h](https://eigen.tuxfamily.org/dox/SparseDot_8h_source.html) * [SparseFuzzy.h](https://eigen.tuxfamily.org/dox/SparseFuzzy_8h_source.html) * [SparseProduct.h](https://eigen.tuxfamily.org/dox/SparseProduct_8h_source.html) * [SparseRedux.h](https://eigen.tuxfamily.org/dox/SparseRedux_8h_source.html) * [SparseSelfAdjointView.h](https://eigen.tuxfamily.org/dox/SparseSelfAdjointView_8h_source.html) * [SparseTriangularView.h](https://eigen.tuxfamily.org/dox/SparseTriangularView_8h_source.html) * [SparseView.h](https://eigen.tuxfamily.org/dox/SparseView_8h_source.html) eigen3 Eigen::ComplexEigenSolver Eigen::ComplexEigenSolver ========================= ### template<typename \_MatrixType> class Eigen::ComplexEigenSolver< \_MatrixType > Computes eigenvalues and eigenvectors of general complex matrices. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | The eigenvalues and eigenvectors of a matrix \( A \) are scalars \( \lambda \) and vectors \( v \) such that \( Av = \lambda v \). If \( D \) is a diagonal matrix with the eigenvalues on the diagonal, and \( V \) is a matrix with the eigenvectors as its columns, then \( A V = V D \). The matrix \( V \) is almost always invertible, in which case we have \( A = V D V^{-1} \). This is called the eigendecomposition. The main function in this class is [compute()](classeigen_1_1complexeigensolver#aeb7e38c6db5369f5c974f3786e94c1f0 "Computes eigendecomposition of given matrix."), which computes the eigenvalues and eigenvectors of a given function. The documentation for that function contains an example showing the main features of the class. See also class [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), class [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") | | | --- | | | | typedef std::complex< RealScalar > | [ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143) | | | Complex scalar type for [MatrixType](classeigen_1_1complexeigensolver#ad61f6278843a601096276c9a72c0252f "Synonym for the template parameter _MatrixType."). [More...](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143) | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143), ColsAtCompileTime, 1, Options &(~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f)), MaxColsAtCompileTime, 1 > | [EigenvalueType](classeigen_1_1complexeigensolver#ad3a663b1ff5200a098dabbbf9b7162b1) | | | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b "Returns the eigenvalues of given matrix."). [More...](classeigen_1_1complexeigensolver#ad3a663b1ff5200a098dabbbf9b7162b1) | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > | [EigenvectorType](classeigen_1_1complexeigensolver#a67cd4d20590abfd86b2639c4c8ea3dd6) | | | Type for matrix of eigenvectors as returned by [eigenvectors()](classeigen_1_1complexeigensolver#a3aa5e27800349990778da8fa532c1270 "Returns the eigenvectors of given matrix."). [More...](classeigen_1_1complexeigensolver#a67cd4d20590abfd86b2639c4c8ea3dd6) | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) | | | | typedef \_MatrixType | [MatrixType](classeigen_1_1complexeigensolver#ad61f6278843a601096276c9a72c0252f) | | | Synonym for the template parameter `_MatrixType`. | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1complexeigensolver#a61035d40c9498bb1d47628cdd4946785) | | | Scalar type for matrices of type [MatrixType](classeigen_1_1complexeigensolver#ad61f6278843a601096276c9a72c0252f "Synonym for the template parameter _MatrixType."). | | | | | | --- | | | | | [ComplexEigenSolver](classeigen_1_1complexeigensolver#a3322a21574c61eefd450c003515ad802) () | | | Default constructor. [More...](classeigen_1_1complexeigensolver#a3322a21574c61eefd450c003515ad802) | | | | template<typename InputType > | | | [ComplexEigenSolver](classeigen_1_1complexeigensolver#a748de5c1e7f730e16421e6d451437600) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeEigenvectors=true) | | | Constructor; computes eigendecomposition of given matrix. [More...](classeigen_1_1complexeigensolver#a748de5c1e7f730e16421e6d451437600) | | | | | [ComplexEigenSolver](classeigen_1_1complexeigensolver#a86751f64ebcd5c554551fb5eaaa02db7) ([Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) size) | | | Default Constructor with memory preallocation. [More...](classeigen_1_1complexeigensolver#a86751f64ebcd5c554551fb5eaaa02db7) | | | | template<typename InputType > | | [ComplexEigenSolver](classeigen_1_1complexeigensolver) & | [compute](classeigen_1_1complexeigensolver#aeb7e38c6db5369f5c974f3786e94c1f0) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeEigenvectors=true) | | | Computes eigendecomposition of given matrix. [More...](classeigen_1_1complexeigensolver#aeb7e38c6db5369f5c974f3786e94c1f0) | | | | const [EigenvalueType](classeigen_1_1complexeigensolver#ad3a663b1ff5200a098dabbbf9b7162b1) & | [eigenvalues](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b) () const | | | Returns the eigenvalues of given matrix. [More...](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b) | | | | const [EigenvectorType](classeigen_1_1complexeigensolver#a67cd4d20590abfd86b2639c4c8ea3dd6) & | [eigenvectors](classeigen_1_1complexeigensolver#a3aa5e27800349990778da8fa532c1270) () const | | | Returns the eigenvectors of given matrix. [More...](classeigen_1_1complexeigensolver#a3aa5e27800349990778da8fa532c1270) | | | | [Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) | [getMaxIterations](classeigen_1_1complexeigensolver#aeec4754e32bf2d1c650bf3aed110c3d3) () | | | Returns the maximum number of iterations. | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1complexeigensolver#ad4d9d8b90145900b9686d2dabbe46730) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1complexeigensolver#ad4d9d8b90145900b9686d2dabbe46730) | | | | [ComplexEigenSolver](classeigen_1_1complexeigensolver) & | [setMaxIterations](classeigen_1_1complexeigensolver#a0c5a974da17774d75be41e351e6bda62) ([Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) maxIters) | | | Sets the maximum number of iterations allowed. | | | ComplexScalar ------------- template<typename \_MatrixType > | | | --- | | typedef std::complex<RealScalar> [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143) | Complex scalar type for [MatrixType](classeigen_1_1complexeigensolver#ad61f6278843a601096276c9a72c0252f "Synonym for the template parameter _MatrixType."). This is `std::complex<Scalar>` if [Scalar](classeigen_1_1complexeigensolver#a61035d40c9498bb1d47628cdd4946785 "Scalar type for matrices of type MatrixType.") is real (e.g., `float` or `double`) and just `Scalar` if [Scalar](classeigen_1_1complexeigensolver#a61035d40c9498bb1d47628cdd4946785 "Scalar type for matrices of type MatrixType.") is complex. EigenvalueType -------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143), ColsAtCompileTime, 1, Options&(~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f)), MaxColsAtCompileTime, 1> [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[EigenvalueType](classeigen_1_1complexeigensolver#ad3a663b1ff5200a098dabbbf9b7162b1) | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b "Returns the eigenvalues of given matrix."). This is a column vector with entries of type [ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143 "Complex scalar type for MatrixType."). The length of the vector is the size of [MatrixType](classeigen_1_1complexeigensolver#ad61f6278843a601096276c9a72c0252f "Synonym for the template parameter _MatrixType."). EigenvectorType --------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[EigenvectorType](classeigen_1_1complexeigensolver#a67cd4d20590abfd86b2639c4c8ea3dd6) | Type for matrix of eigenvectors as returned by [eigenvectors()](classeigen_1_1complexeigensolver#a3aa5e27800349990778da8fa532c1270 "Returns the eigenvectors of given matrix."). This is a square matrix with entries of type [ComplexScalar](classeigen_1_1complexeigensolver#a3604c99a69fac3bee42c88cb2b589143 "Complex scalar type for MatrixType."). The size is the same as the size of [MatrixType](classeigen_1_1complexeigensolver#ad61f6278843a601096276c9a72c0252f "Synonym for the template parameter _MatrixType."). Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) | **[Deprecated:](deprecated#_deprecated000012)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 ComplexEigenSolver() [1/3] -------------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[ComplexEigenSolver](classeigen_1_1complexeigensolver) | ( | | ) | | | inline | Default constructor. The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1complexeigensolver#aeb7e38c6db5369f5c974f3786e94c1f0 "Computes eigendecomposition of given matrix."). ComplexEigenSolver() [2/3] -------------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[ComplexEigenSolver](classeigen_1_1complexeigensolver) | ( | [Index](classeigen_1_1complexeigensolver#abc0218d8b902af0d6c759bfc0a8a8d74) | *size* | ) | | | inlineexplicit | Default Constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem *size*. See also [ComplexEigenSolver()](classeigen_1_1complexeigensolver#a3322a21574c61eefd450c003515ad802 "Default constructor.") ComplexEigenSolver() [3/3] -------------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::[ComplexEigenSolver](classeigen_1_1complexeigensolver) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeEigenvectors* = `true` | | | ) | | | | inlineexplicit | Constructor; computes eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose eigendecomposition is to be computed. | | [in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. | This constructor calls [compute()](classeigen_1_1complexeigensolver#aeb7e38c6db5369f5c974f3786e94c1f0 "Computes eigendecomposition of given matrix.") to compute the eigendecomposition. compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | --- | --- | --- | --- | | [ComplexEigenSolver](classeigen_1_1complexeigensolver)& [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeEigenvectors* = `true` | | | ) | | | Computes eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose eigendecomposition is to be computed. | | [in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. | Returns Reference to `*this` This function computes the eigenvalues of the complex matrix `matrix`. The [eigenvalues()](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b "Returns the eigenvalues of given matrix.") function can be used to retrieve them. If `computeEigenvectors` is true, then the eigenvectors are also computed and can be retrieved by calling [eigenvectors()](classeigen_1_1complexeigensolver#a3aa5e27800349990778da8fa532c1270 "Returns the eigenvectors of given matrix."). The matrix is first reduced to Schur form using the [ComplexSchur](classeigen_1_1complexschur "Performs a complex Schur decomposition of a real or complex square matrix.") class. The Schur decomposition is then used to compute the eigenvalues and eigenvectors. The cost of the computation is dominated by the cost of the Schur decomposition, which is \( O(n^3) \) where \( n \) is the size of the matrix. Example: ``` MatrixXcf A = [MatrixXcf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; ComplexEigenSolver<MatrixXcf> ces; ces.compute(A); cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl; complex<float> lambda = ces.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXcf v = ces.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then lambda \* v = " << endl << lambda * v << endl; cout << "... and A \* v = " << endl << A * v << endl << endl; cout << "Finally, V \* D \* V^(-1) = " << endl << ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl; ``` Output: ``` Here is a random 4x4 matrix, A: (-0.211,0.68) (0.108,-0.444) (0.435,0.271) (-0.198,-0.687) (0.597,0.566) (0.258,-0.0452) (0.214,-0.717) (-0.782,-0.74) (-0.605,0.823) (0.0268,-0.27) (-0.514,-0.967) (-0.563,0.998) (0.536,-0.33) (0.832,0.904) (0.608,-0.726) (0.678,0.0259) The eigenvalues of A are: (0.137,0.505) (-0.758,1.22) (1.52,-0.402) (-0.691,-1.63) The matrix of eigenvectors, V, is: (-0.246,-0.106) (0.418,0.263) (0.0417,-0.296) (-0.122,0.271) (-0.205,-0.629) (0.466,-0.457) (0.244,-0.456) (0.247,0.23) (-0.432,-0.0359) (-0.0651,-0.0146) (-0.191,0.334) (0.859,-0.0877) (-0.301,0.46) (-0.41,-0.397) (0.623,0.328) (-0.116,0.195) Consider the first eigenvalue, lambda = (0.137,0.505) If v is the corresponding eigenvector, then lambda * v = (0.0197,-0.139) (0.29,-0.19) (-0.0412,-0.223) (-0.274,-0.0891) ... and A * v = (0.0197,-0.139) (0.29,-0.19) (-0.0412,-0.223) (-0.274,-0.0891) Finally, V * D * V^(-1) = (-0.211,0.68) (0.108,-0.444) (0.435,0.271) (-0.198,-0.687) (0.597,0.566) (0.258,-0.0452) (0.214,-0.717) (-0.782,-0.74) (-0.605,0.823) (0.0268,-0.27) (-0.514,-0.967) (-0.563,0.998) (0.536,-0.33) (0.832,0.904) (0.608,-0.726) (0.678,0.0259) ``` eigenvalues() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [EigenvalueType](classeigen_1_1complexeigensolver#ad3a663b1ff5200a098dabbbf9b7162b1)& [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::eigenvalues | ( | | ) | const | | inline | Returns the eigenvalues of given matrix. Returns A const reference to the column vector containing the eigenvalues. Precondition Either the constructor ComplexEigenSolver(const MatrixType& matrix, bool) or the member function compute(const MatrixType& matrix, bool) has been called before to compute the eigendecomposition of a matrix. This function returns a column vector containing the eigenvalues. Eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are not sorted in any particular order. Example: ``` MatrixXcf ones = [MatrixXcf::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); ComplexEigenSolver<MatrixXcf> ces(ones, /\* computeEigenvectors = \*/ false); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << ces.eigenvalues() << endl; ``` Output: ``` The eigenvalues of the 3x3 matrix of ones are: (0,-0) (0,0) (3,0) ``` eigenvectors() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [EigenvectorType](classeigen_1_1complexeigensolver#a67cd4d20590abfd86b2639c4c8ea3dd6)& [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::eigenvectors | ( | | ) | const | | inline | Returns the eigenvectors of given matrix. Returns A const reference to the matrix whose columns are the eigenvectors. Precondition Either the constructor ComplexEigenSolver(const MatrixType& matrix, bool) or the member function compute(const MatrixType& matrix, bool) has been called before to compute the eigendecomposition of a matrix, and `computeEigenvectors` was set to true (the default). This function returns a matrix whose columns are the eigenvectors. Column \( k \) is an eigenvector corresponding to eigenvalue number \( k \) as returned by [eigenvalues()](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b "Returns the eigenvalues of given matrix."). The eigenvectors are normalized to have (Euclidean) norm equal to one. The matrix returned by this function is the matrix \( V \) in the eigendecomposition \( A = V D V^{-1} \), if it exists. Example: ``` MatrixXcf ones = [MatrixXcf::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); ComplexEigenSolver<MatrixXcf> ces(ones); cout << "The first eigenvector of the 3x3 matrix of ones is:" << endl << ces.eigenvectors().col(0) << endl; ``` Output: ``` The first eigenvector of the 3x3 matrix of ones is: (-0.816,0) (0.408,0) (0.408,0) ``` info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::ComplexEigenSolver](classeigen_1_1complexeigensolver)< \_MatrixType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NoConvergence` otherwise. --- The documentation for this class was generated from the following file:* [ComplexEigenSolver.h](https://eigen.tuxfamily.org/dox/ComplexEigenSolver_8h_source.html)
programming_docs
eigen3 Eigen::Triplet Eigen::Triplet ============== ### template<typename Scalar, typename StorageIndex = typename SparseMatrix<Scalar>::StorageIndex> class Eigen::Triplet< Scalar, StorageIndex > A small structure to hold a non zero as a triplet (i,j,value). See also [SparseMatrix::setFromTriplets()](classeigen_1_1sparsematrix#acc35051d698e3973f1de5b9b78dbe345) | | | --- | | | | const StorageIndex & | [col](classeigen_1_1triplet#a3531e3e2098507a069a368d72d46471e) () const | | | | const StorageIndex & | [row](classeigen_1_1triplet#ae88b0ad6d31daa53e298b9cc4201fdee) () const | | | | const Scalar & | [value](classeigen_1_1triplet#a003ea53c6559b106406f7916d6610547) () const | | | col() ----- template<typename Scalar , typename StorageIndex = typename SparseMatrix<Scalar>::StorageIndex> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const StorageIndex& [Eigen::Triplet](classeigen_1_1triplet)< Scalar, StorageIndex >::col | ( | | ) | const | | inline | Returns the column index of the element row() ----- template<typename Scalar , typename StorageIndex = typename SparseMatrix<Scalar>::StorageIndex> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const StorageIndex& [Eigen::Triplet](classeigen_1_1triplet)< Scalar, StorageIndex >::row | ( | | ) | const | | inline | Returns the row index of the element value() ------- template<typename Scalar , typename StorageIndex = typename SparseMatrix<Scalar>::StorageIndex> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Scalar& [Eigen::Triplet](classeigen_1_1triplet)< Scalar, StorageIndex >::value | ( | | ) | const | | inline | Returns the value of the element --- The documentation for this class was generated from the following file:* [SparseUtil.h](https://eigen.tuxfamily.org/dox/SparseUtil_8h_source.html) eigen3 Eigen::MapBase Eigen::MapBase ============== ### template<typename Derived> class Eigen::MapBase< Derived, WriteAccessors > Base class for non-const dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") expression with direct access. This base class provides the non-const low-level accessors (e.g. coeff and coeffRef) of dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") objects with direct access. It inherits [MapBase<Derived, ReadOnlyAccessors>](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4 "Base class for dense Map and Block expression with direct access.") which defines the const variant for reading specific entries. See also class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."), class [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") | | | --- | | | | Public Member Functions inherited from [Eigen::MapBase< Derived, ReadOnlyAccessors >](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4) | | const Scalar & | [coeff](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#aea142bb9ac9aa1b8c6b44f413daa4b88) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index) const | | | | const Scalar & | [coeff](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#a6d8ebb28996655c441d5d744ac227c8d) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rowId, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) colId) const | | | | const Scalar & | [coeffRef](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#a474a755c6699eeeb9fd4fc70c502cdec) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) index) const | | | | const Scalar & | [coeffRef](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#acaf91005e3230bbffe1c69a4199a0506) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) rowId, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) colId) const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [cols](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#adb0a19af0c52f9f36160abe0d2de67e1) () const EIGEN\_NOEXCEPT | | | | const Scalar \* | [data](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#a1bee30414766e9116a7abed067ca8007) () const | | | | EIGEN\_CONSTEXPR [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [rows](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#abc334ba08270706556366d1cfbb05d95) () const EIGEN\_NOEXCEPT | | | --- The documentation for this class was generated from the following file:* [MapBase.h](https://eigen.tuxfamily.org/dox/MapBase_8h_source.html) eigen3 Eigen::CwiseBinaryOp Eigen::CwiseBinaryOp ==================== ### template<typename BinaryOp, typename LhsType, typename RhsType> class Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType > Generic expression where a coefficient-wise binary operator is applied to two expressions. Template Parameters | | | | --- | --- | | BinaryOp | template functor implementing the operator | | LhsType | the type of the left-hand side | | RhsType | the type of the right-hand side | This class represents an expression where a coefficient-wise binary operator is applied to two expressions. It is the return type of binary operators, by which we mean only those binary operators where both the left-hand side and the right-hand side are [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") expressions. For example, the return type of matrix1+matrix2 is a [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions."). Most of the time, this is the only way that it is used, so you typically don't have to name [CwiseBinaryOp](classeigen_1_1cwisebinaryop "Generic expression where a coefficient-wise binary operator is applied to two expressions.") types explicitly. See also MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression."), class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor.") Inherits Eigen::CwiseBinaryOpImpl< BinaryOp, LhsType, RhsType, internal::cwise\_promote\_storage\_type< internal::traits< LhsType >::StorageKind, internal::traits< RhsType >::StorageKind, BinaryOp >::ret >, and Eigen::internal::no\_assignment\_operator. | | | --- | | | | const BinaryOp & | [functor](classeigen_1_1cwisebinaryop#adfb40100689f5e13be1786db5d7fecbf) () const | | | | const \_LhsNested & | [lhs](classeigen_1_1cwisebinaryop#a33b8ee8eda1d963591b80ec07525f918) () const | | | | const \_RhsNested & | [rhs](classeigen_1_1cwisebinaryop#ae508116a8a328c0ca01df38cb4819663) () const | | | functor() --------- template<typename BinaryOp , typename LhsType , typename RhsType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const BinaryOp& [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< BinaryOp, LhsType, RhsType >::functor | ( | | ) | const | | inline | Returns the functor representing the binary operation lhs() ----- template<typename BinaryOp , typename LhsType , typename RhsType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const \_LhsNested& [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< BinaryOp, LhsType, RhsType >::lhs | ( | | ) | const | | inline | Returns the left hand side nested expression rhs() ----- template<typename BinaryOp , typename LhsType , typename RhsType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const \_RhsNested& [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< BinaryOp, LhsType, RhsType >::rhs | ( | | ) | const | | inline | Returns the right hand side nested expression --- The documentation for this class was generated from the following file:* [CwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/CwiseBinaryOp_8h_source.html) eigen3 Eigen::IdentityPreconditioner Eigen::IdentityPreconditioner ============================= A naive preconditioner which approximates any matrix as the identity matrix. This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also class [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.") --- The documentation for this class was generated from the following file:* [BasicPreconditioners.h](https://eigen.tuxfamily.org/dox/BasicPreconditioners_8h_source.html) eigen3 Eigen::JacobiSVD Eigen::JacobiSVD ================ ### template<typename \_MatrixType, int QRPreconditioner> class Eigen::JacobiSVD< \_MatrixType, QRPreconditioner > Two-sided Jacobi SVD decomposition of a rectangular matrix. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the SVD decomposition | | QRPreconditioner | this optional parameter allows to specify the type of QR decomposition that will be used internally for the R-SVD step for non-square matrices. See discussion of possible values below. | SVD decomposition consists in decomposing any n-by-p matrix *A* as a product \[ A = U S V^\* \] where *U* is a n-by-n unitary, *V* is a p-by-p unitary, and *S* is a n-by-p real positive matrix which is zero outside of its main diagonal; the diagonal entries of S are known as the *singular* *values* of *A* and the columns of *U* and *V* are known as the left and right *singular* *vectors* of *A* respectively. Singular values are always sorted in decreasing order. This [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") decomposition computes only the singular values by default. If you want *U* or *V*, you need to ask for them explicitly. You can ask for only *thin* *U* or *V* to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting *m* be the smaller value among *n* and *p*, there are only *m* singular vectors; the remaining columns of *U* and *V* do not correspond to actual singular vectors. Asking for *thin* *U* or *V* means asking for only their *m* first columns to be formed. So *U* is then a n-by-m matrix, and *V* is then a p-by-m matrix. Notice that thin *U* and *V* are all you need for (least squares) solving. Here's an example demonstrating basic usage: ``` MatrixXf m = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,2); cout << "Here is the matrix m:" << endl << m << endl; JacobiSVD<MatrixXf> svd(m, [ComputeThinU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527) | [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47)); cout << "Its singular values are:" << endl << svd.singularValues() << endl; cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl; cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl; Vector3f rhs(1, 0, 0); cout << "Now consider this rhs vector:" << endl << rhs << endl; cout << "A least-squares solution of m\*x = rhs is:" << endl << svd.solve(rhs) << endl; ``` Output: ``` Here is the matrix m: 0.68 0.597 -0.211 0.823 0.566 -0.605 Its singular values are: 1.19 0.899 Its left singular vectors are the columns of the thin U matrix: 0.388 0.866 0.712 -0.0634 -0.586 0.496 Its right singular vectors are the columns of the thin V matrix: -0.183 0.983 0.983 0.183 Now consider this rhs vector: 1 0 0 A least-squares solution of m*x = rhs is: 0.888 0.496 ``` This [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") class is a two-sided Jacobi R-SVD decomposition, ensuring optimal reliability and accuracy. The downside is that it's slower than bidiagonalizing SVD algorithms for large square matrices; however its complexity is still \( O(n^2p) \) where *n* is the smaller dimension and *p* is the greater dimension, meaning that it is still of the same order of complexity as the faster bidiagonalizing R-SVD algorithms. In particular, like any R-SVD, it takes advantage of non-squareness in that its complexity is only linear in the greater dimension. If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to terminate in finite (and reasonable) time. The possible values for QRPreconditioner are: * ColPivHouseholderQRPreconditioner is the default. In practice it's very safe. It uses column-pivoting QR. * FullPivHouseholderQRPreconditioner, is the safest and slowest. It uses full-pivoting QR. Contrary to other QRs, it doesn't allow computing thin unitaries. * HouseholderQRPreconditioner is the fastest, and less safe and accurate than the pivoting variants. It uses non-pivoting QR. This is very similar in safety and accuracy to the bidiagonalization process used by bidiagonalizing SVD algorithms (since bidiagonalization is inherently non-pivoting). However the resulting SVD is still more reliable than bidiagonalizing SVDs because the Jacobi-based iterarive process is more reliable than the optimized bidiagonal SVD iterations. * NoQRPreconditioner allows not to use a QR preconditioner at all. This is useful if you know that you will only be computing [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") decompositions of square matrices. Non-square matrices require a QR preconditioner. Using this option will result in faster compilation and smaller executable code. It won't significantly speed up computation, since [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") is always checking if QR preconditioning is needed before applying it anyway. See also [MatrixBase::jacobiSvd()](classeigen_1_1matrixbase#a5745dca9c54390633b434e54a1d1eedd) | | | --- | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1jacobisvd#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [JacobiSVD](classeigen_1_1jacobisvd) & | [compute](classeigen_1_1jacobisvd#acc7b9a4068cf7b69ae3227d217ed7efd) (const MatrixType &matrix) | | | Method performing the decomposition of given matrix using current options. [More...](classeigen_1_1jacobisvd#acc7b9a4068cf7b69ae3227d217ed7efd) | | | | [JacobiSVD](classeigen_1_1jacobisvd) & | [compute](classeigen_1_1jacobisvd#a5dab376cc86cf0d36674bcdad4af3f5a) (const MatrixType &matrix, unsigned int computationOptions) | | | Method performing the decomposition of given matrix using custom options. [More...](classeigen_1_1jacobisvd#a5dab376cc86cf0d36674bcdad4af3f5a) | | | | | [JacobiSVD](classeigen_1_1jacobisvd#a55315ab9cd060019a5ad07be798ff3b9) () | | | Default Constructor. [More...](classeigen_1_1jacobisvd#a55315ab9cd060019a5ad07be798ff3b9) | | | | | [JacobiSVD](classeigen_1_1jacobisvd#abfd1dd454a6e3edec7feecd97c818a78) (const MatrixType &matrix, unsigned int computationOptions=0) | | | Constructor performing the decomposition of given matrix. [More...](classeigen_1_1jacobisvd#abfd1dd454a6e3edec7feecd97c818a78) | | | | | [JacobiSVD](classeigen_1_1jacobisvd#a5d9ea7c8f361337727260efd77ee03ac) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1jacobisvd#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1jacobisvd#a2d768a9877f5f69f49432d447b552bfe), unsigned int computationOptions=0) | | | Default Constructor with memory preallocation. [More...](classeigen_1_1jacobisvd#a5d9ea7c8f361337727260efd77ee03ac) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1jacobisvd#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::SVDBase< JacobiSVD< \_MatrixType, QRPreconditioner > >](classeigen_1_1svdbase) | | bool | [computeU](classeigen_1_1svdbase#a705a7c2709e1624ccc19aa748a78d473) () const | | | | bool | [computeV](classeigen_1_1svdbase#a5f12efcb791eb007d4a4890ac5255ac4) () const | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1svdbase#a06c311bc452dc1ca5abce2f640e15292) | | | | const [MatrixUType](classeigen_1_1matrix) & | [matrixU](classeigen_1_1svdbase#afc7fe1546b0f6e1801b86f22f5664cb8) () const | | | | const [MatrixVType](classeigen_1_1matrix) & | [matrixV](classeigen_1_1svdbase#a245a453b5e7347f737295c23133238c4) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonzeroSingularValues](classeigen_1_1svdbase#afe8a555f38393a319a71ec0f0331c9ef) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rank](classeigen_1_1svdbase#a30b89e24f42f1692079eea31b361d26a) () const | | | | [JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner > & | [setThreshold](classeigen_1_1svdbase#a1c95d05398fc15e410a28560ef70a5a6) (const RealScalar &[threshold](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69)) | | | | [JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner > & | [setThreshold](classeigen_1_1svdbase#a27586b69dbfb63f714d1d45fd6304f97) (Default\_t) | | | | const SingularValuesType & | [singularValues](classeigen_1_1svdbase#a4e7bac123570c348f7ed6be909e1e474) () const | | | | const [Solve](classeigen_1_1solve)< [JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner >, Rhs > | [solve](classeigen_1_1svdbase#ab28499936c0764fe5b56b9f4de701e26) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | RealScalar | [threshold](classeigen_1_1svdbase#a98b2ee98690358951807353812a05c69) () const | | | | Public Member Functions inherited from [Eigen::SolverBase< Derived >](classeigen_1_1solverbase) | | AdjointReturnType | [adjoint](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) () const | | | | Derived & | [derived](classeigen_1_1solverbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1solverbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | | [SolverBase](classeigen_1_1solverbase#a4d5e5baddfba3790ab1a5f247dcc4dc1) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SVDBase< JacobiSVD< \_MatrixType, QRPreconditioner > >](classeigen_1_1svdbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1svdbase#a6229a37997eca1072b52cca5ee7a2bec) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SVDBase< JacobiSVD< \_MatrixType, QRPreconditioner > >](classeigen_1_1svdbase) | | | [SVDBase](classeigen_1_1svdbase#abed06fc6f4b743e1f76a7b317539da87) () | | | Default Constructor. [More...](classeigen_1_1svdbase#abed06fc6f4b743e1f76a7b317539da87) | | | JacobiSVD() [1/3] ----------------- template<typename \_MatrixType , int QRPreconditioner> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner >::[JacobiSVD](classeigen_1_1jacobisvd) | ( | | ) | | | inline | Default Constructor. The default constructor is useful in cases in which the user intends to perform decompositions via [JacobiSVD::compute(const MatrixType&)](classeigen_1_1jacobisvd#acc7b9a4068cf7b69ae3227d217ed7efd "Method performing the decomposition of given matrix using current options."). JacobiSVD() [2/3] ----------------- template<typename \_MatrixType , int QRPreconditioner> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner >::[JacobiSVD](classeigen_1_1jacobisvd) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols*, | | | | unsigned int | *computationOptions* = `0` | | | ) | | | | inline | Default Constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem size. See also [JacobiSVD()](classeigen_1_1jacobisvd#a55315ab9cd060019a5ad07be798ff3b9 "Default Constructor.") JacobiSVD() [3/3] ----------------- template<typename \_MatrixType , int QRPreconditioner> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner >::[JacobiSVD](classeigen_1_1jacobisvd) | ( | const MatrixType & | *matrix*, | | | | unsigned int | *computationOptions* = `0` | | | ) | | | | inlineexplicit | Constructor performing the decomposition of given matrix. Parameters | | | | --- | --- | | matrix | the matrix to decompose | | computationOptions | optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. By default, none is computed. This is a bit-field, the possible bits are [ComputeFullU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9fa9302d510cee20c26311154937e23f), [ComputeThinU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527), [ComputeFullV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a36581f7c662f7def31efd500c284f930), [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47). | Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not available with the (non-default) [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") preconditioner. cols() ------ template<typename \_MatrixType , int QRPreconditioner> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::cols | ( | void | | ) | | | inline | Returns the number of columns. See also [rows()](classeigen_1_1jacobisvd#ac22eb0695d00edd7d4a3b2d0a98b81c2), ColsAtCompileTime compute() [1/2] --------------- template<typename \_MatrixType , int QRPreconditioner> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [JacobiSVD](classeigen_1_1jacobisvd)& [Eigen::JacobiSVD](classeigen_1_1jacobisvd)< \_MatrixType, QRPreconditioner >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Method performing the decomposition of given matrix using current options. Parameters | | | | --- | --- | | matrix | the matrix to decompose | This method uses the current *computationOptions*, as already passed to the constructor or to [compute(const MatrixType&, unsigned int)](classeigen_1_1jacobisvd#a5dab376cc86cf0d36674bcdad4af3f5a "Method performing the decomposition of given matrix using custom options."). compute() [2/2] --------------- template<typename MatrixType , int QRPreconditioner> | | | | | | --- | --- | --- | --- | | [JacobiSVD](classeigen_1_1jacobisvd)< MatrixType, QRPreconditioner > & [Eigen::JacobiSVD](classeigen_1_1jacobisvd)< MatrixType, QRPreconditioner >::compute | ( | const MatrixType & | *matrix*, | | | | unsigned int | *computationOptions* | | | ) | | | Method performing the decomposition of given matrix using custom options. Parameters | | | | --- | --- | | matrix | the matrix to decompose | | computationOptions | optional parameter allowing to specify if you want full or thin U or V unitaries to be computed. By default, none is computed. This is a bit-field, the possible bits are [ComputeFullU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a9fa9302d510cee20c26311154937e23f), [ComputeThinU](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527), [ComputeFullV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a36581f7c662f7def31efd500c284f930), [ComputeThinV](group__enums#ggae3e239fb70022eb8747994cf5d68b4a9a540036417bfecf2e791a70948c227f47). | Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not available with the (non-default) [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") preconditioner. rows() ------ template<typename \_MatrixType , int QRPreconditioner> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::rows | ( | void | | ) | | | inline | Returns the number of rows. See also [cols()](classeigen_1_1jacobisvd#a2d768a9877f5f69f49432d447b552bfe), RowsAtCompileTime --- The documentation for this class was generated from the following file:* [JacobiSVD.h](https://eigen.tuxfamily.org/dox/JacobiSVD_8h_source.html)
programming_docs
eigen3 Eigen::MatrixBase Eigen::MatrixBase ================= ### template<typename Derived> class Eigen::MatrixBase< Derived > Base class for all dense matrices, vectors, and expressions. This class is the base that is inherited by all matrix, vector, and related expression types. Most of the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") API is contained in this class, and its base classes. Other important classes for the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") API are [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), and [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations."). Note that some methods are defined in other modules such as the [LU module](group__lu__module) LU module for all functions related to matrix inversions. Template Parameters | | | | --- | --- | | Derived | is the derived type, e.g. a matrix type, or an expression, etc. | When writing a function taking [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") objects as argument, if you want your function to take as argument any matrix, vector, or expression, just let it take a [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") argument. As an example, here is a function printFirstRow which, given a matrix, vector, or expression *x*, prints the first row of *x*. ``` template<typename Derived> void printFirstRow(const [Eigen::MatrixBase<Derived>](classeigen_1_1matrixbase)& [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000)) { cout << [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000).row(0) << endl; } ``` This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_MATRIXBASE_PLUGIN`. See also [The class hierarchy](topicclasshierarchy) | | | --- | | | | const MatrixFunctionReturnValue< Derived > | [acosh](classeigen_1_1matrixbase#a765140ddee0c6b39bbfa3b8917de67be) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::acosh . [More...](classeigen_1_1matrixbase#a765140ddee0c6b39bbfa3b8917de67be) | | | | const AdjointReturnType | [adjoint](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) () const | | | | void | [adjointInPlace](classeigen_1_1matrixbase#a51c5982c1f64e45a939515b701fa6f4a) () | | | | template<typename EssentialPart > | | void | [applyHouseholderOnTheLeft](classeigen_1_1matrixbase#a8f2c8059ef3f04cfa0c73b4c012db855) (const EssentialPart &essential, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*workspace) | | | | template<typename EssentialPart > | | void | [applyHouseholderOnTheRight](classeigen_1_1matrixbase#ab3e52262b41fa40e194dda245e0f9675) (const EssentialPart &essential, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*workspace) | | | | template<typename OtherDerived > | | void | [applyOnTheLeft](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | template<typename OtherScalar > | | void | [applyOnTheLeft](classeigen_1_1matrixbase#ae669131f6e18f7e8f06fae271754f435) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) p, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) q, const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > &j) | | | | template<typename OtherDerived > | | void | [applyOnTheRight](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | template<typename OtherScalar > | | void | [applyOnTheRight](group__jacobi__module#gaa07f741c86219601664433777827bf1c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) p, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) q, const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > &j) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< Derived > | [array](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497) () | | | | const [ArrayWrapper](classeigen_1_1arraywrapper)< const Derived > | [array](classeigen_1_1matrixbase#a72f287fe7b2a7e7a66d16cc88166d47f) () const | | | | const [DiagonalWrapper](classeigen_1_1diagonalwrapper)< const Derived > | [asDiagonal](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0) () const | | | | const MatrixFunctionReturnValue< Derived > | [asinh](classeigen_1_1matrixbase#a8efaf691d9c74b362a43b1b793706ea1) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic sine use ArrayBase::asinh . [More...](classeigen_1_1matrixbase#a8efaf691d9c74b362a43b1b793706ea1) | | | | const MatrixFunctionReturnValue< Derived > | [atanh](classeigen_1_1matrixbase#ab87d29c00e6d75aeab43eff53bf5164c) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::atanh . [More...](classeigen_1_1matrixbase#ab87d29c00e6d75aeab43eff53bf5164c) | | | | [BDCSVD](classeigen_1_1bdcsvd)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [bdcSvd](classeigen_1_1matrixbase#ae171b74b5d530846ee0836135ffcf837) (unsigned int computationOptions=0) const | | | | RealScalar | [blueNorm](classeigen_1_1matrixbase#a3f3faa00163c16824ff03e58a210c74c) () const | | | | const [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [colPivHouseholderQr](classeigen_1_1matrixbase#adee8c19c833245bbb00a591dce68e8a4) () const | | | | const [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [completeOrthogonalDecomposition](classeigen_1_1matrixbase#ae90b6846f05bd30b8d52b66e427e3e09) () const | | | | template<typename ResultType > | | void | [computeInverseAndDetWithCheck](classeigen_1_1matrixbase#a7baaf2fdec0191a2166cf9fd84a2dcb2) (ResultType &[inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), typename ResultType::Scalar &[determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061), bool &invertible, const RealScalar &absDeterminantThreshold=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename ResultType > | | void | [computeInverseWithCheck](classeigen_1_1matrixbase#a116f3b50d2af7dbdf7473e517a5b8b0f) (ResultType &[inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), bool &invertible, const RealScalar &absDeterminantThreshold=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | const MatrixFunctionReturnValue< Derived > | [cos](classeigen_1_1matrixbase#a34d626eb756bbeb4069d1eb0e6494c65) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise cosine use ArrayBase::cos . [More...](classeigen_1_1matrixbase#a34d626eb756bbeb4069d1eb0e6494c65) | | | | const MatrixFunctionReturnValue< Derived > | [cosh](classeigen_1_1matrixbase#a627e6f11bf5854ade9a5abfc344c0367) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic cosine use ArrayBase::cosh . [More...](classeigen_1_1matrixbase#a627e6f11bf5854ade9a5abfc344c0367) | | | | template<typename OtherDerived > | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [cross](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [cross3](group__geometry__module#gabde56e2a0baba550815a0b05139e4d42) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) () const | | | | [DiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3) () | | | | [ConstDiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#aebdeedcf67e46d969c556c6c7d9780ee) () const | | | | [DiagonalDynamicIndexReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | [ConstDiagonalDynamicIndexReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1matrixbase#aed11a711c0a3d5dbf8bc094008e29846) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [diagonalSize](classeigen_1_1matrixbase#ab79e511b9322b8b801858e253fb257eb) () const | | | | template<typename OtherDerived > | | [ScalarBinaryOpTraits](structeigen_1_1scalarbinaryoptraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), typename internal::traits< OtherDerived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::ReturnType | [dot](classeigen_1_1matrixbase#adfd32bf5fcf6ee603c924dde9bf7bc39) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | EigenvaluesReturnType | [eigenvalues](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d) () const | | | Computes the eigenvalues of a matrix. [More...](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d) | | | | [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), 3, 1 > | [eulerAngles](group__geometry__module#ga17994d2e81b723295f5bc3b1f862ed3b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a0, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a1, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a2) const | | | | const MatrixExponentialReturnValue< Derived > | [exp](classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise exponential use ArrayBase::exp . [More...](classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) | | | | Derived & | [forceAlignedAccess](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699) () | | | | const Derived & | [forceAlignedAccess](classeigen_1_1matrixbase#ad2fdb842d9a715f8778d0b33c29cfe49) () const | | | | template<bool Enable> | | internal::conditional< Enable, [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< Derived >, Derived & >::type | [forceAlignedAccessIf](classeigen_1_1matrixbase#ae35213d1dd4dd13ebe9a7a762d6bb847) () | | | | template<bool Enable> | | internal::add\_const\_on\_value\_type< typename internal::conditional< Enable, [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< Derived >, Derived & >::type >::type | [forceAlignedAccessIf](classeigen_1_1matrixbase#af42d92f115d4b8fa3d5aa731ed496ed1) () const | | | | const [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [fullPivHouseholderQr](classeigen_1_1matrixbase#a863bc0e06b641a089508eabec6835ab2) () const | | | | const [FullPivLU](classeigen_1_1fullpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [fullPivLu](classeigen_1_1matrixbase#a25da97d31acab0ee5d9d13bdbb0569da) () const | | | | const HNormalizedReturnType | [hnormalized](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) () const | | | homogeneous normalization [More...](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) | | | | [HomogeneousReturnType](classeigen_1_1homogeneous) | [homogeneous](group__geometry__module#gaf3229c2d3669e983075ab91f7f480cb1) () const | | | | const [HouseholderQR](classeigen_1_1householderqr)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [householderQr](classeigen_1_1matrixbase#a9a9377aab1cea26db5f25bab7e682f8f) () const | | | | RealScalar | [hypotNorm](classeigen_1_1matrixbase#a32222d3b6677e6cdf0b801463f329b72) () const | | | | const [Inverse](classeigen_1_1inverse)< Derived > | [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) () const | | | | bool | [isDiagonal](classeigen_1_1matrixbase#a97027ea54c8cd1ddb1c578fee5cedc67) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isIdentity](classeigen_1_1matrixbase#a4ccbd8dfa06e9d47b9bf84711f8b9d40) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isLowerTriangular](classeigen_1_1matrixbase#a1e96c42d79a56f0a6ade30ce031e17eb) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isOrthogonal](classeigen_1_1matrixbase#aefdc8e4e4c156fdd79a21479e75dcd8a) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isUnitary](classeigen_1_1matrixbase#a8a7ee34ce202cac3eeea9cf20c9e4833) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isUpperTriangular](classeigen_1_1matrixbase#aae3ec1660bb4ac584220481c54ab4a64) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | [JacobiSVD](classeigen_1_1jacobisvd)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [jacobiSvd](classeigen_1_1matrixbase#a5745dca9c54390633b434e54a1d1eedd) (unsigned int computationOptions=0) const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, LazyProduct > | [lazyProduct](classeigen_1_1matrixbase#ae0c280b1066c14ed577021f38876527f) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | const [LDLT](classeigen_1_1ldlt)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [ldlt](classeigen_1_1matrixbase#a0ecf058a0727a4cab8b42d79e95072e1) () const | | | | const [LLT](classeigen_1_1llt)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [llt](classeigen_1_1matrixbase#a90c45f7a30265df792d5aeaddead2635) () const | | | | const MatrixLogarithmReturnValue< Derived > | [log](classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise logarithm use ArrayBase::log . [More...](classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) | | | | template<int p> | | RealScalar | [lpNorm](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35) () const | | | | const [PartialPivLU](classeigen_1_1partialpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [lu](classeigen_1_1matrixbase#afb312afbfe960cbda67811552d876fae) () const | | | | template<typename EssentialPart > | | void | [makeHouseholder](classeigen_1_1matrixbase#a13291e900f7e81ddc6e5b8802f82092b) (EssentialPart &essential, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, RealScalar &beta) const | | | | void | [makeHouseholderInPlace](classeigen_1_1matrixbase#aebf4bac7dffe2685ab93734fb776e817) ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &tau, RealScalar &beta) | | | | const MatrixFunctionReturnValue< Derived > | [matrixFunction](classeigen_1_1matrixbase#a1a6cc9f734eb175e785a1118305245fc) (StemFunction f) const | | | Helper function for the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). | | | | [NoAlias](classeigen_1_1noalias)< Derived, [Eigen::MatrixBase](classeigen_1_1matrixbase) > | [noalias](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) () | | | | RealScalar | [norm](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) () const | | | | void | [normalize](classeigen_1_1matrixbase#ad16303c47ba36f7a41ea264cb26bceb6) () | | | | const [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [normalized](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) () const | | | | template<typename OtherDerived > | | bool | [operator!=](classeigen_1_1matrixbase#a028c7ac8094d610042fd0f9feca68f63) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename DiagonalDerived > | | const [Product](classeigen_1_1product)< Derived, DiagonalDerived, LazyProduct > | [operator\*](classeigen_1_1matrixbase#a36fb95c37f0a454e0e2e5cb120b2df7f) (const DiagonalBase< DiagonalDerived > &[diagonal](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3)) const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived > | [operator\*](classeigen_1_1matrixbase#ae2d220efbf7047f0894787888288cfcc) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | Derived & | [operator\*=](classeigen_1_1matrixbase#a3783b6168995ca117a1c19fea3630ac4) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator+=](classeigen_1_1matrixbase#a983cc3be0bbe11b3d041a415b76ce010) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator-=](classeigen_1_1matrixbase#a1042124b0ddee66e78ac7b0a9ac4cc9c) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) | | | | Derived & | [operator=](classeigen_1_1matrixbase#a373bf62ad398162df5a71963ed7cbeff) (const [MatrixBase](classeigen_1_1matrixbase) &other) | | | | template<typename OtherDerived > | | bool | [operator==](classeigen_1_1matrixbase#a80e3e1e83fdf43f9f7fb6ff51836b24d) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | RealScalar | [operatorNorm](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102) () const | | | Computes the L2 operator norm. [More...](classeigen_1_1matrixbase#a0ff9bc0b9bea2d0822a2bf3192783102) | | | | const [PartialPivLU](classeigen_1_1partialpivlu)< [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [partialPivLu](classeigen_1_1matrixbase#a6199d8aaf26c1b8ac3097fdfa7733a1e) () const | | | | const MatrixPowerReturnValue< Derived > | [pow](classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) (const RealScalar &p) const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use [ArrayBase::pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) . [More...](classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) | | | | const MatrixComplexPowerReturnValue< Derived > | [pow](classeigen_1_1matrixbase#a91dcacf224bd8b18346914bdf7eefc31) (const std::complex< RealScalar > &p) const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use [ArrayBase::pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) . [More...](classeigen_1_1matrixbase#a91dcacf224bd8b18346914bdf7eefc31) | | | | template<unsigned int UpLo> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template SelfAdjointViewReturnType< UpLo >::Type | [selfadjointView](classeigen_1_1matrixbase#ad446541377593656c1399862fe6a0f94) () | | | | template<unsigned int UpLo> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template ConstSelfAdjointViewReturnType< UpLo >::Type | [selfadjointView](classeigen_1_1matrixbase#a67eb836f331d9b567e7f36ec0782fa07) () const | | | | Derived & | [setIdentity](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683) () | | | | Derived & | [setIdentity](classeigen_1_1matrixbase#a97dec020729928e328fe8ae9aad1e99e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | Resizes to the given size, and writes the identity expression (not necessarily square) into \*this. [More...](classeigen_1_1matrixbase#a97dec020729928e328fe8ae9aad1e99e) | | | | Derived & | [setUnit](classeigen_1_1matrixbase#ac7cf3e0e69550d36de8778b09a645afd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | Set the coefficients of `*this` to the i-th unit (basis) vector. [More...](classeigen_1_1matrixbase#ac7cf3e0e69550d36de8778b09a645afd) | | | | Derived & | [setUnit](classeigen_1_1matrixbase#a90bed3b6468a17a9054b07cde7a751a6) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | Resizes to the given *newSize*, and writes the i-th unit (basis) vector into \*this. [More...](classeigen_1_1matrixbase#a90bed3b6468a17a9054b07cde7a751a6) | | | | const MatrixFunctionReturnValue< Derived > | [sin](classeigen_1_1matrixbase#a02f4ff0fcbbae2f3ccaa5981e8ad5e34) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise sine use ArrayBase::sin . [More...](classeigen_1_1matrixbase#a02f4ff0fcbbae2f3ccaa5981e8ad5e34) | | | | const MatrixFunctionReturnValue< Derived > | [sinh](classeigen_1_1matrixbase#a9c37eab2dc7baf83809269254c9129e0) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic sine use ArrayBase::sinh . [More...](classeigen_1_1matrixbase#a9c37eab2dc7baf83809269254c9129e0) | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [sparseView](group__sparsecore__module#ga320dd291cbf4339c6118c41521b75350) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &m\_reference=[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)(0), const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &m\_epsilon=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | const MatrixSquareRootReturnValue< Derived > | [sqrt](classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) () const | | | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise square root use ArrayBase::sqrt . [More...](classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) | | | | RealScalar | [squaredNorm](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) () const | | | | RealScalar | [stableNorm](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1) () const | | | | void | [stableNormalize](classeigen_1_1matrixbase#a0b1443fa322615379557ade3399a3c3c) () | | | | const [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [stableNormalized](classeigen_1_1matrixbase#a399dca938633b9f8df5ec4beefeccec0) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [trace](classeigen_1_1matrixbase#a544b609f65eb2bd3e368b3fc2d79479e) () const | | | | template<unsigned int Mode> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template TriangularViewReturnType< Mode >::Type | [triangularView](classeigen_1_1matrixbase#a56665aa894f49f2765291fee0eaeb9c6) () | | | | template<unsigned int Mode> | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template ConstTriangularViewReturnType< Mode >::Type | [triangularView](classeigen_1_1matrixbase#aa044521145e74117ad1df42460d7b520) () const | | | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [unitOrthogonal](group__geometry__module#gaa0dc2c32a9379eeb2b4c4a05c1a6fe52) (void) const | | | | Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | bool | [all](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) () const | | | | bool | [allFinite](classeigen_1_1densebase#af1e669fd3aaae50a4870dc1b8f3b8884) () const | | | | bool | [any](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [begin](classeigen_1_1densebase#a57591454af931f9dffa71c9da28d5641) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [begin](classeigen_1_1densebase#ad9368ce70b06167ec5fc19398d329f5e) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cbegin](classeigen_1_1densebase#ae9a3dfd9b826ba3103de0128576fb15b) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cend](classeigen_1_1densebase#aeb3b76f02986c2af2521d07164b5ffde) () const | | | | [ColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) () | | | | [ConstColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [count](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [end](classeigen_1_1densebase#ae71d079e16d91360d10066b316b48485) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [end](classeigen_1_1densebase#ab34773522e43bfb02e9cf652d7b5dd60) () const | | | | EvalReturnType | [eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) () const | | | | void | [fill](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | template<unsigned int Added, unsigned int Removed> | | EIGEN\_DEPRECATED const Derived & | [flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const | | | | const [WithFormat](classeigen_1_1withformat)< Derived > | [format](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) (const [IOFormat](structeigen_1_1ioformat) &fmt) const | | | | bool | [hasNaN](classeigen_1_1densebase#ab13d158c900560d3e1b25d85d2d33dd6) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1densebase#a58ca41d9635a8ab3c5a268ef3f7f0d75) () const | | | | template<typename OtherDerived > | | bool | [isApprox](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isApproxToConstant](classeigen_1_1densebase#af9b150d48bc5e4366887ccb466e40c6b) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isConstant](classeigen_1_1densebase#a1ca84e4179b3e5081ed11d89bbd9e74f) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#a3c4db0c6dd974fa88bbb58b2cf3d5664) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename Derived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#adfca6ff4e473f68fbbeabbd03b7504a9) (const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &other, const RealScalar &prec) const | | | | bool | [isOnes](classeigen_1_1densebase#aa56d6b4477cd3c92a9cf42f4b96e47c2) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isZero](classeigen_1_1densebase#af36014ec300f53a65083057ed4e89822) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED Derived & | [lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#aced8ffda52ff061b6586ace2657ebf30) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) (IndexType \*row, IndexType \*col) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7) () const | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#ac9265f4f91430b9cc75d63fb6865bb29) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) (IndexType \*row, IndexType \*col) const | | | | const [NestByValue](classeigen_1_1nestbyvalue)< Derived > | [nestByValue](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1densebase#acb8d5574eff335381e7441ade87700a0) () const | | | | template<typename OtherDerived > | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0f0e34696162b34762b2bf4bd948f90c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0e575eb0ba6cc6bc5f347872abd8509d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &s) | | | | Derived & | [operator=](classeigen_1_1densebase#a5281dadff89f46eef719b38e5d073a8f) (const [DenseBase](classeigen_1_1densebase) &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#ab66155169d20c035e80d521a8b918e97) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1densebase#a03f71699bc26ca2ee4e42ec4538862d7) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) () const | | | | template<typename Func > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [redux](classeigen_1_1densebase#a63ce1e4fab36bff43bbadcdd06a67724) (const Func &func) const | | | | template<int RowFactor, int ColFactor> | | const [Replicate](classeigen_1_1replicate)< Derived, RowFactor, ColFactor > | [replicate](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) () const | | | | const [Replicate](classeigen_1_1replicate)< Derived, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [replicate](classeigen_1_1densebase#afae2d5e36f1158d1b1681dac3cdbd58e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowFactor, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colFactor) const | | | | void | [resize](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | [ReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) () | | | | [ConstReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a9e2f3ac4019184abf95ca0e1a8d82866) () const | | | | void | [reverseInPlace](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) () | | | | [RowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) () | | | | [ConstRowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc) () const | | | | template<typename ThenDerived , typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, ElseDerived > | [select](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | template<typename ThenDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > | [select](classeigen_1_1densebase#a57ef09a843004095f84c198dd145641b) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const | | | | template<typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > | [select](classeigen_1_1densebase#a9e8e78c75887d4539071a0b7a61ca103) (const typename ElseDerived::Scalar &thenScalar, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | Derived & | [setConstant](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) | | | | Derived & | [setOnes](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) () | | | | Derived & | [setRandom](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) () | | | | Derived & | [setZero](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) () | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) () const | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#af9e7e4305fdb7781f2b2f05fa801f21e) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#a44e25adc6da9cd1d79f4c5bd7c1819cb) ([PlainObjectBase](classeigen_1_1plainobjectbase)< OtherDerived > &other) | | | | [TransposeReturnType](classeigen_1_1transpose) | [transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) () const | | | | void | [transposeInPlace](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) () | | | | CoeffReturnType | [value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) () const | | | | template<typename Visitor > | | void | [visit](classeigen_1_1densebase#a4225b90fcc74f18dd479b401124b3841) (Visitor &func) const | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#af1bac522aee4402639189f387592000b) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a4e94e17926e1cf597deb2928e779cef6) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#abb333f6f10467f6f8d7b59c213dea49e) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a63bc5874eb4e320e54eb079b43b49d22) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae66b7d18b2a85f3139b703126974c900) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#adc8286576b31e11f056057be666a0ec8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a0171eee1d9e582d1ac7ec0f18f5f615a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae6ba07bad9e3026afe54806fdefe32bb) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#aa2040f14e60fed1a4a68ca7f042e1bbf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Scalar & | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) () | | | | Scalar & | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) () | | | | Scalar & | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8) () | | | | Scalar & | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73) () | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | static const IdentityReturnType | [Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f) () | | | | static const IdentityReturnType | [Identity](classeigen_1_1matrixbase#acf33ce20ef03ead47cb3dbcd5f416ede) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const BasisReturnType | [Unit](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | | static const BasisReturnType | [Unit](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i) | | | | static const BasisReturnType | [UnitW](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) () | | | | static const BasisReturnType | [UnitX](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d) () | | | | static const BasisReturnType | [UnitY](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc) () | | | | static const BasisReturnType | [UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0) () | | | | Static Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#aed89b5cc6e3b7d9d5bd63aed245ccd6d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a1fdd3189ae3a41d250593334d82210cf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a5dc65501accd02c30f7c1840c2a30a41) (const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const CustomNullaryOp &func) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101) () | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a8b2a51018a73a766f5b91aef3487f013) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#ab710a58e4a80fbcb2594242372c8fe56) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) () | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#a7eb5f974a8f0b67eac7080db1da0e308) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761) () | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ae41a9b5050ed27d9e93c82c9c8622cd3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ac22f79b812fa564061042407f2ba8f5b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | | | --- | | | | Public Types inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | enum | { [RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab) , [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) , [SizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da25cb495affdbd796198462b8ef06be91) , [MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306) , [MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) , [MaxSizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da3a459062d39cb34452518f5f201161d2) , [IsVectorAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da1156955c8099c5072934b74c72654ed0) , [NumDimensions](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da4d4548a01ba37a6c2031a3c1f0a37d34) , [Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) , [IsRowMajor](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da406b6af91d61d348ba1c9764bdd66008) , **InnerSizeAtCompileTime** , **InnerStrideAtCompileTime** , **OuterStrideAtCompileTime** } | | | | typedef random\_access\_iterator\_type | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | | | | typedef random\_access\_iterator\_type | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | | | | typedef [Array](classeigen_1_1array)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) | | | | typedef [Matrix](classeigen_1_1matrix)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e) | | | | typedef internal::conditional< internal::is\_same< typename internal::traits< Derived >::XprKind, [MatrixXpr](structeigen_1_1matrixxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e), [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) >::type | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | The plain matrix or array type corresponding to this expression. [More...](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | [StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | The type used to store indices. [More...](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | | typedef [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [value\_type](classeigen_1_1densebase#a9276182dab8236c33f1e7abf491d504d) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | | [DenseBase](classeigen_1_1densebase#aa284042d0e1b0ad9b6a00db7fd2d9f7f) () | | | | Related Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | template<typename Derived > | | std::ostream & | [operator<<](classeigen_1_1densebase#a3806d3f42de165878dace160e6aba40a) (std::ostream &s, const [DenseBase](classeigen_1_1densebase)< Derived > &m) | | | acosh() ------- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::acosh | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::acosh . Returns an expression of the matrix inverse hyperbolic cosine of `*this`. adjoint() --------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::AdjointReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::adjoint | | inline | Returns an expression of the adjoint (i.e. conjugate transpose) of \*this. Example: ``` Matrix2cf m = [Matrix2cf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the 2x2 complex matrix m:" << endl << m << endl; cout << "Here is the adjoint of m:" << endl << m.adjoint() << endl; ``` Output: ``` Here is the 2x2 complex matrix m: (-0.211,0.68) (-0.605,0.823) (0.597,0.566) (0.536,-0.33) Here is the adjoint of m: (-0.211,-0.68) (0.597,-0.566) (-0.605,-0.823) (0.536,0.33) ``` Warning If you want to replace a matrix by its own adjoint, do **NOT** do this: ``` m = m.adjoint(); // bug!!! caused by aliasing effect ``` Instead, use the [adjointInPlace()](classeigen_1_1matrixbase#a51c5982c1f64e45a939515b701fa6f4a) method: ``` m.adjointInPlace(); ``` which gives [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") good opportunities for optimization, or alternatively you can also do: ``` m = m.adjoint().eval(); ``` See also [adjointInPlace()](classeigen_1_1matrixbase#a51c5982c1f64e45a939515b701fa6f4a), [transpose()](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c), conjugate(), class [Transpose](classeigen_1_1transpose "Expression of the transpose of a matrix."), class internal::scalar\_conjugate\_op adjointInPlace() ---------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::adjointInPlace | | inline | This is the "in place" version of [adjoint()](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb): it replaces `*this` by its own transpose. Thus, doing ``` m.adjointInPlace(); ``` has the same effect on m as doing ``` m = m.adjoint().eval(); ``` and is faster and also safer because in the latter line of code, forgetting the [eval()](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) results in a bug caused by aliasing. Notice however that this method is only useful if you want to replace a matrix by its own adjoint. If you just need the adjoint of a matrix, use [adjoint()](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb). Note if the matrix is not square, then `*this` must be a resizable matrix. This excludes (non-square) fixed-size matrices, block-expressions and maps. See also [transpose()](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c), [adjoint()](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb), [transposeInPlace()](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) applyHouseholderOnTheLeft() --------------------------- template<typename Derived > template<typename EssentialPart > | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::applyHouseholderOnTheLeft | ( | const EssentialPart & | *essential*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *tau*, | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \* | *workspace* | | | ) | | | Apply the elementary reflector H given by \( H = I - tau v v^\*\) with \( v^T = [1 essential^T] \) from the left to a vector or matrix. On input: Parameters | | | | --- | --- | | essential | the essential part of the vector `v` | | tau | the scaling factor of the Householder transformation | | workspace | a pointer to working space with at least this->[cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) entries | See also [MatrixBase::makeHouseholder()](classeigen_1_1matrixbase#a13291e900f7e81ddc6e5b8802f82092b), [MatrixBase::makeHouseholderInPlace()](classeigen_1_1matrixbase#aebf4bac7dffe2685ab93734fb776e817), [MatrixBase::applyHouseholderOnTheRight()](classeigen_1_1matrixbase#ab3e52262b41fa40e194dda245e0f9675) applyHouseholderOnTheRight() ---------------------------- template<typename Derived > template<typename EssentialPart > | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::applyHouseholderOnTheRight | ( | const EssentialPart & | *essential*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *tau*, | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \* | *workspace* | | | ) | | | Apply the elementary reflector H given by \( H = I - tau v v^\*\) with \( v^T = [1 essential^T] \) from the right to a vector or matrix. On input: Parameters | | | | --- | --- | | essential | the essential part of the vector `v` | | tau | the scaling factor of the Householder transformation | | workspace | a pointer to working space with at least this->[rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) entries | See also [MatrixBase::makeHouseholder()](classeigen_1_1matrixbase#a13291e900f7e81ddc6e5b8802f82092b), [MatrixBase::makeHouseholderInPlace()](classeigen_1_1matrixbase#aebf4bac7dffe2685ab93734fb776e817), [MatrixBase::applyHouseholderOnTheLeft()](classeigen_1_1matrixbase#a8f2c8059ef3f04cfa0c73b4c012db855) applyOnTheLeft() [1/2] ---------------------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::applyOnTheLeft | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by *other* \* `*this`. Example: ``` Matrix3f A = [Matrix3f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,3), B; B << 0,1,0, 0,0,1, 1,0,0; cout << "At start, A = " << endl << A << endl; A.applyOnTheLeft(B); cout << "After applyOnTheLeft, A = " << endl << A << endl; ``` Output: ``` At start, A = 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 After applyOnTheLeft, A = -0.211 0.823 0.536 0.566 -0.605 -0.444 0.68 0.597 -0.33 ``` applyOnTheLeft() [2/2] ---------------------- template<typename Derived > template<typename OtherScalar > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::applyOnTheLeft | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *p*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *q*, | | | | const [JacobiRotation](classeigen_1_1jacobirotation)< OtherScalar > & | *j* | | | ) | | | | inline | This is defined in the Jacobi module. ``` #include <Eigen/Jacobi> ``` Applies the rotation in the plane *j* to the rows *p* and *q* of `*this`, i.e., it computes B = J \* B, with \( B = \left ( \begin{array}{cc} \text{\*this.row}(p) \\ \text{\*this.row}(q) \end{array} \right ) \). See also class [JacobiRotation](classeigen_1_1jacobirotation "Rotation given by a cosine-sine pair."), [MatrixBase::applyOnTheRight()](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462), internal::apply\_rotation\_in\_the\_plane() applyOnTheRight() ----------------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::applyOnTheRight | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` \* *other*. It is equivalent to [MatrixBase::operator\*=()](classeigen_1_1matrixbase#a3783b6168995ca117a1c19fea3630ac4). Example: ``` Matrix3f A = [Matrix3f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,3), B; B << 0,1,0, 0,0,1, 1,0,0; cout << "At start, A = " << endl << A << endl; A *= B; cout << "After A \*= B, A = " << endl << A << endl; A.applyOnTheRight(B); // equivalent to A \*= B cout << "After applyOnTheRight, A = " << endl << A << endl; ``` Output: ``` At start, A = 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 After A *= B, A = -0.33 0.68 0.597 0.536 -0.211 0.823 -0.444 0.566 -0.605 After applyOnTheRight, A = 0.597 -0.33 0.68 0.823 0.536 -0.211 -0.605 -0.444 0.566 ``` array() [1/2] ------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ArrayWrapper](classeigen_1_1arraywrapper)<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::array | ( | | ) | | | inline | Returns an [Array](classeigen_1_1arraybase) expression of this matrix See also [ArrayBase::matrix()](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) array() [2/2] ------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [ArrayWrapper](classeigen_1_1arraywrapper)<const Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::array | ( | | ) | const | | inline | Returns a const [Array](classeigen_1_1arraybase) expression of this matrix See also [ArrayBase::matrix()](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) asDiagonal() ------------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [DiagonalWrapper](classeigen_1_1diagonalwrapper)< const Derived > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::asDiagonal | | inline | Returns a pseudo-expression of a diagonal matrix with \*this as vector of diagonal coefficients This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. Example: ``` cout << Matrix3i(Vector3i(2,5,6).[asDiagonal](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0)()) << endl; ``` Output: ``` 2 0 0 0 5 0 0 0 6 ``` See also class [DiagonalWrapper](classeigen_1_1diagonalwrapper "Expression of a diagonal matrix."), class [DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage."), [diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3), [isDiagonal()](classeigen_1_1matrixbase#a97027ea54c8cd1ddb1c578fee5cedc67) asinh() ------- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::asinh | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic sine use ArrayBase::asinh . Returns an expression of the matrix inverse hyperbolic sine of `*this`. atanh() ------- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::atanh | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise inverse hyperbolic cosine use ArrayBase::atanh . Returns an expression of the matrix inverse hyperbolic cosine of `*this`. bdcSvd() -------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [BDCSVD](classeigen_1_1bdcsvd)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::bdcSvd | ( | unsigned int | *computationOptions* = `0` | ) | const | | inline | This is defined in the SVD module. ``` #include <Eigen/SVD> ``` Returns the singular value decomposition of `*this` computed by Divide & Conquer algorithm See also class [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD") blueNorm() ---------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [NumTraits](structeigen_1_1numtraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::blueNorm | | inline | Returns the *l2* norm of `*this` using the Blue's algorithm. A Portable Fortran Program to Find the Euclidean Norm of a Vector, ACM TOMS, Vol 4, Issue 1, 1978. For architecture/scalar types without vectorization, this version is much faster than [stableNorm()](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1). Otherwise the [stableNorm()](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1) is faster. See also [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975), [stableNorm()](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1), [hypotNorm()](classeigen_1_1matrixbase#a32222d3b6677e6cdf0b801463f329b72) colPivHouseholderQr() --------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::colPivHouseholderQr | | inline | Returns the column-pivoting Householder QR decomposition of `*this`. See also class [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting.") completeOrthogonalDecomposition() --------------------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::completeOrthogonalDecomposition | | inline | Returns the complete orthogonal decomposition of `*this`. See also class [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition "Complete orthogonal decomposition (COD) of a matrix.") computeInverseAndDetWithCheck() ------------------------------- template<typename Derived > template<typename ResultType > | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::computeInverseAndDetWithCheck | ( | ResultType & | *inverse*, | | | | typename ResultType::Scalar & | *determinant*, | | | | bool & | *invertible*, | | | | const RealScalar & | *absDeterminantThreshold* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | | | ) | | const | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Computation of matrix inverse and determinant, with invertibility check. This is only for fixed-size square matrices of size up to 4x4. Notice that it will trigger a copy of input matrix when trying to do the inverse in place. Parameters | | | | --- | --- | | inverse | Reference to the matrix in which to store the inverse. | | determinant | Reference to the variable in which to store the determinant. | | invertible | Reference to the bool variable in which to store whether the matrix is invertible. | | absDeterminantThreshold | Optional parameter controlling the invertibility check. The matrix will be declared invertible if the absolute value of its determinant is greater than this threshold. | Example: ``` Matrix3d m = [Matrix3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf); bool invertible; double [determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061); m.computeInverseAndDetWithCheck([inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf),[determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061),invertible); cout << "Its determinant is " << [determinant](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) << endl; if(invertible) { cout << "It is invertible, and its inverse is:" << endl << [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) << endl; } else { cout << "It is not invertible." << endl; } ``` Output: ``` Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Its determinant is 0.209 It is invertible, and its inverse is: -0.199 2.23 2.84 1.01 -0.555 -1.42 -1.62 3.59 3.29 ``` See also [inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), [computeInverseWithCheck()](classeigen_1_1matrixbase#a116f3b50d2af7dbdf7473e517a5b8b0f) computeInverseWithCheck() ------------------------- template<typename Derived > template<typename ResultType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::computeInverseWithCheck | ( | ResultType & | *inverse*, | | | | bool & | *invertible*, | | | | const RealScalar & | *absDeterminantThreshold* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | | | ) | | const | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Computation of matrix inverse, with invertibility check. This is only for fixed-size square matrices of size up to 4x4. Notice that it will trigger a copy of input matrix when trying to do the inverse in place. Parameters | | | | --- | --- | | inverse | Reference to the matrix in which to store the inverse. | | invertible | Reference to the bool variable in which to store whether the matrix is invertible. | | absDeterminantThreshold | Optional parameter controlling the invertibility check. The matrix will be declared invertible if the absolute value of its determinant is greater than this threshold. | Example: ``` Matrix3d m = [Matrix3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf); bool invertible; m.computeInverseWithCheck([inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf),invertible); if(invertible) { cout << "It is invertible, and its inverse is:" << endl << [inverse](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf) << endl; } else { cout << "It is not invertible." << endl; } ``` Output: ``` Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 It is invertible, and its inverse is: -0.199 2.23 2.84 1.01 -0.555 -1.42 -1.62 3.59 3.29 ``` See also [inverse()](classeigen_1_1matrixbase#a7712eb69e8ea3c8f7b8da1c44dbdeebf), [computeInverseAndDetWithCheck()](classeigen_1_1matrixbase#a7baaf2fdec0191a2166cf9fd84a2dcb2) cos() ----- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::cos | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise cosine use ArrayBase::cos . Returns an expression of the matrix cosine of `*this`. cosh() ------ template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::cosh | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic cosine use ArrayBase::cosh . Returns an expression of the matrix hyperbolic cosine of `*this`. determinant() ------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::determinant | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Returns the determinant of this matrix diagonal() [1/4] ---------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template DiagonalIndexReturnType< Index\_ >::Type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::diagonal | | inline | Returns an expression of the main diagonal of the matrix `*this` `*this` is not required to be square. Example: ``` Matrix3i m = [Matrix3i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the main diagonal of m:" << endl << m.diagonal() << endl; ``` Output: ``` Here is the matrix m: 7 6 -3 -2 9 6 6 -6 -5 Here are the coefficients on the main diagonal of m: 7 9 -5 ``` See also class [Diagonal](classeigen_1_1diagonal "Expression of a diagonal/subdiagonal/superdiagonal in a matrix.") Returns an expression of the *DiagIndex-th* sub or super diagonal of the matrix `*this` `*this` is not required to be square. The template parameter *DiagIndex* represent a super diagonal if *DiagIndex* > 0 and a sub diagonal otherwise. *DiagIndex* == 0 is equivalent to the main diagonal. Example: ``` Matrix4i m = [Matrix4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl << m.diagonal<1>().[transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c)() << endl << m.diagonal<-2>().[transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c)() << endl; ``` Output: ``` Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m: 9 1 9 6 6 ``` See also [MatrixBase::diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3), class [Diagonal](classeigen_1_1diagonal "Expression of a diagonal/subdiagonal/superdiagonal in a matrix.") diagonal() [2/4] ---------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::template ConstDiagonalIndexReturnType< Index\_ >::Type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::diagonal | | inline | This is the const version of [diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3). This is the const version of [diagonal<int>()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3). diagonal() [3/4] ---------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::[DiagonalDynamicIndexReturnType](classeigen_1_1diagonal) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::diagonal | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *index* | ) | | | inline | Returns an expression of the *DiagIndex-th* sub or super diagonal of the matrix `*this` `*this` is not required to be square. The template parameter *DiagIndex* represent a super diagonal if *DiagIndex* > 0 and a sub diagonal otherwise. *DiagIndex* == 0 is equivalent to the main diagonal. Example: ``` Matrix4i m = [Matrix4i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl << m.diagonal(1).transpose() << endl << m.diagonal(-2).transpose() << endl; ``` Output: ``` Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m: 9 1 9 6 6 ``` See also [MatrixBase::diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3), class [Diagonal](classeigen_1_1diagonal "Expression of a diagonal/subdiagonal/superdiagonal in a matrix.") diagonal() [4/4] ---------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::[ConstDiagonalDynamicIndexReturnType](classeigen_1_1diagonal) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::diagonal | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *index* | ) | const | | inline | This is the const version of [diagonal(Index)](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7). diagonalSize() -------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::diagonalSize | ( | | ) | const | | inline | Returns the size of the main diagonal, which is min([rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2),[cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)). See also [rows()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [cols()](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), [SizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da25cb495affdbd796198462b8ef06be91). dot() ----- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [ScalarBinaryOpTraits](structeigen_1_1scalarbinaryoptraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), typename internal::traits< OtherDerived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::ReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::dot | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | Returns the dot product of \*this with other. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. Note If the scalar type is complex numbers, then this function returns the hermitian (sesquilinear) dot product, conjugate-linear in the first variable and linear in the second variable. See also [squaredNorm()](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a), [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) eigenvalues() ------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::EigenvaluesReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::eigenvalues | | inline | Computes the eigenvalues of a matrix. Returns Column vector containing the eigenvalues. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` This function computes the eigenvalues with the help of the [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices.") class (for real matrices) or the [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") class (for complex matrices). The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The [SelfAdjointView](classeigen_1_1selfadjointview "Expression of a selfadjoint matrix from a triangular part of a dense matrix.") class provides a better algorithm for selfadjoint matrices. Example: ``` MatrixXd ones = [MatrixXd::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); VectorXcd eivals = ones.eigenvalues(); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl; ``` Output: ``` The eigenvalues of the 3x3 matrix of ones are: (-5.31e-17,0) (3,0) (0,0) ``` See also [EigenSolver::eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix."), [ComplexEigenSolver::eigenvalues()](classeigen_1_1complexeigensolver#a10c25c7620e7faedcd39991cce3a757b "Returns the eigenvalues of given matrix."), [SelfAdjointView::eigenvalues()](classeigen_1_1selfadjointview#ad4f34424b4ea12de9bbc5623cb938b4f "Computes the eigenvalues of a matrix.") exp() ----- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixExponentialReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::exp | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise exponential use ArrayBase::exp . Returns an expression of the matrix exponential of `*this`. forceAlignedAccess() [1/2] -------------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< Derived > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::forceAlignedAccess | | inline | Returns an expression of \*this with forced aligned access See also forceAlignedAccessIf(), class [ForceAlignedAccess](classeigen_1_1forcealignedaccess "Enforce aligned packet loads and stores regardless of what is requested.") forceAlignedAccess() [2/2] -------------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [ForceAlignedAccess](classeigen_1_1forcealignedaccess)< Derived > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::forceAlignedAccess | | inline | Returns an expression of \*this with forced aligned access See also forceAlignedAccessIf(),class [ForceAlignedAccess](classeigen_1_1forcealignedaccess "Enforce aligned packet loads and stores regardless of what is requested.") forceAlignedAccessIf() [1/2] ---------------------------- template<typename Derived > template<bool Enable> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::conditional<Enable,[ForceAlignedAccess](classeigen_1_1forcealignedaccess)<Derived>,Derived&>::type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::forceAlignedAccessIf | ( | | ) | | | inline | Returns an expression of \*this with forced aligned access if *Enable* is true. See also [forceAlignedAccess()](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699), class [ForceAlignedAccess](classeigen_1_1forcealignedaccess "Enforce aligned packet loads and stores regardless of what is requested.") forceAlignedAccessIf() [2/2] ---------------------------- template<typename Derived > template<bool Enable> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::add\_const\_on\_value\_type<typename internal::conditional<Enable,[ForceAlignedAccess](classeigen_1_1forcealignedaccess)<Derived>,Derived&>::type>::type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::forceAlignedAccessIf | ( | | ) | const | | inline | Returns an expression of \*this with forced aligned access if *Enable* is true. See also [forceAlignedAccess()](classeigen_1_1matrixbase#afdaf810ac1708ca6d6ecdcfac1e06699), class [ForceAlignedAccess](classeigen_1_1forcealignedaccess "Enforce aligned packet loads and stores regardless of what is requested.") fullPivHouseholderQr() ---------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::fullPivHouseholderQr | | inline | Returns the full-pivoting Householder QR decomposition of `*this`. See also class [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") fullPivLu() ----------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [FullPivLU](classeigen_1_1fullpivlu)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::fullPivLu | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Returns the full-pivoting LU decomposition of `*this`. See also class [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features.") householderQr() --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [HouseholderQR](classeigen_1_1householderqr)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::householderQr | | inline | Returns the Householder QR decomposition of `*this`. See also class [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix.") hypotNorm() ----------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [NumTraits](structeigen_1_1numtraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::hypotNorm | | inline | Returns the *l2* norm of `*this` avoiding undeflow and overflow. This version use a concatenation of hypot() calls, and it is very slow. See also [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975), [stableNorm()](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1) Identity() [1/2] ---------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::IdentityReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::Identity | | inlinestatic | Returns an expression of the identity matrix (not necessarily square). This variant is only for fixed-size [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") types. For dynamic-size types, you need to use the variant taking size arguments. Example: ``` cout << Matrix<double, 3, 4>::Identity() << endl; ``` Output: ``` 1 0 0 0 0 1 0 0 0 0 1 0 ``` See also [Identity(Index,Index)](classeigen_1_1matrixbase#acf33ce20ef03ead47cb3dbcd5f416ede), [setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683), [isIdentity()](classeigen_1_1matrixbase#a4ccbd8dfa06e9d47b9bf84711f8b9d40) Identity() [2/2] ---------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::IdentityReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::Identity | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inlinestatic | Returns an expression of the identity matrix (not necessarily square). The parameters *rows* and *cols* are the number of rows and of columns of the returned matrix. Must be compatible with this [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") type. This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass *rows* and *cols* as arguments, so [Identity()](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f) should be used instead. Example: ``` cout << [MatrixXd::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(4, 3) << endl; ``` Output: ``` 1 0 0 0 1 0 0 0 1 0 0 0 ``` See also [Identity()](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f), [setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683), [isIdentity()](classeigen_1_1matrixbase#a4ccbd8dfa06e9d47b9bf84711f8b9d40) inverse() --------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [Inverse](classeigen_1_1inverse)< Derived > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::inverse | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Returns the matrix inverse of this matrix. For small fixed sizes up to 4x4, this method uses cofactors. In the general case, this method uses class [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features."). Note This matrix must be invertible, otherwise the result is undefined. If you need an invertibility check, do the following: * for fixed sizes up to 4x4, use [computeInverseAndDetWithCheck()](classeigen_1_1matrixbase#a7baaf2fdec0191a2166cf9fd84a2dcb2). * for the general case, use class [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features."). Example: ``` Matrix3d m = [Matrix3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Its inverse is:" << endl << m.inverse() << endl; ``` Output: ``` Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Its inverse is: -0.199 2.23 2.84 1.01 -0.555 -1.42 -1.62 3.59 3.29 ``` See also [computeInverseAndDetWithCheck()](classeigen_1_1matrixbase#a7baaf2fdec0191a2166cf9fd84a2dcb2) isDiagonal() ------------ template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::isDiagonal | ( | const RealScalar & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | ) | const | Returns true if \*this is approximately equal to a diagonal matrix, within the precision given by *prec*. Example: ``` Matrix3d m = 10000 * [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(); m(0,2) = 1; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isDiagonal() returns: " << m.isDiagonal() << endl; cout << "m.isDiagonal(1e-3) returns: " << m.isDiagonal(1e-3) << endl; ``` Output: ``` Here's the matrix m: 1e+04 0 1 0 1e+04 0 0 0 1e+04 m.isDiagonal() returns: 0 m.isDiagonal(1e-3) returns: 1 ``` See also [asDiagonal()](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0) isIdentity() ------------ template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::isIdentity | ( | const RealScalar & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | ) | const | Returns true if \*this is approximately equal to the identity matrix (not necessarily square), within the precision given by *prec*. Example: ``` Matrix3d m = [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isIdentity() returns: " << m.isIdentity() << endl; cout << "m.isIdentity(1e-3) returns: " << m.isIdentity(1e-3) << endl; ``` Output: ``` Here's the matrix m: 1 0 0.0001 0 1 0 0 0 1 m.isIdentity() returns: 0 m.isIdentity(1e-3) returns: 1 ``` See also class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor."), [Identity()](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f), [Identity(Index,Index)](classeigen_1_1matrixbase#acf33ce20ef03ead47cb3dbcd5f416ede), [setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683) isLowerTriangular() ------------------- template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::isLowerTriangular | ( | const RealScalar & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | ) | const | Returns true if \*this is approximately equal to a lower triangular matrix, within the precision given by *prec*. See also [isUpperTriangular()](classeigen_1_1matrixbase#aae3ec1660bb4ac584220481c54ab4a64) isOrthogonal() -------------- template<typename Derived > template<typename OtherDerived > | | | | | | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::isOrthogonal | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other*, | | | | const RealScalar & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | | | ) | | const | Returns true if \*this is approximately orthogonal to *other*, within the precision given by *prec*. Example: ``` Vector3d v(1,0,0); Vector3d [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad)(1e-4,0,1); cout << "Here's the vector v:" << endl << v << endl; cout << "Here's the vector w:" << endl << [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) << endl; cout << "v.isOrthogonal(w) returns: " << v.isOrthogonal([w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad)) << endl; cout << "v.isOrthogonal(w,1e-3) returns: " << v.isOrthogonal([w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad),1e-3) << endl; ``` Output: ``` Here's the vector v: 1 0 0 Here's the vector w: 0.0001 0 1 v.isOrthogonal(w) returns: 0 v.isOrthogonal(w,1e-3) returns: 1 ``` isUnitary() ----------- template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::isUnitary | ( | const RealScalar & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | ) | const | Returns true if \*this is approximately an unitary matrix, within the precision given by *prec*. In the case where the *Scalar* type is real numbers, a unitary matrix is an orthogonal matrix, whence the name. Note This can be used to check whether a family of vectors forms an orthonormal basis. Indeed, `m.isUnitary()` returns true if and only if the columns (equivalently, the rows) of m form an orthonormal basis. Example: ``` Matrix3d m = [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isUnitary() returns: " << m.isUnitary() << endl; cout << "m.isUnitary(1e-3) returns: " << m.isUnitary(1e-3) << endl; ``` Output: ``` Here's the matrix m: 1 0 0.0001 0 1 0 0 0 1 m.isUnitary() returns: 0 m.isUnitary(1e-3) returns: 1 ``` isUpperTriangular() ------------------- template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::isUpperTriangular | ( | const RealScalar & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)>::dummy_precision()` | ) | const | Returns true if \*this is approximately equal to an upper triangular matrix, within the precision given by *prec*. See also [isLowerTriangular()](classeigen_1_1matrixbase#a1e96c42d79a56f0a6ade30ce031e17eb) jacobiSvd() ----------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [JacobiSVD](classeigen_1_1jacobisvd)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::jacobiSvd | ( | unsigned int | *computationOptions* = `0` | ) | const | | inline | This is defined in the SVD module. ``` #include <Eigen/SVD> ``` Returns the singular value decomposition of `*this` computed by two-sided Jacobi transformations. See also class [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") lazyProduct() ------------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Product](classeigen_1_1product)< Derived, OtherDerived, LazyProduct > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::lazyProduct | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | Returns an expression of the matrix product of `*this` and *other* without implicit evaluation. The returned product will behave like any other expressions: the coefficients of the product will be computed once at a time as requested. This might be useful in some extremely rare cases when only a small and no coherent fraction of the result's coefficients have to be computed. Warning This version of the matrix product can be much much slower. So use it only if you know what you are doing and that you measured a true speed improvement. See also operator\*(const MatrixBase&) ldlt() ------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [LDLT](classeigen_1_1ldlt)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::ldlt | | inline | This is defined in the Cholesky module. ``` #include <Eigen/Cholesky> ``` Returns the Cholesky decomposition with full pivoting without square root of `*this` See also [SelfAdjointView::ldlt()](classeigen_1_1selfadjointview#a644155eef17b37c95d85b9f65bb49ac4) llt() ----- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [LLT](classeigen_1_1llt)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::llt | | inline | This is defined in the Cholesky module. ``` #include <Eigen/Cholesky> ``` Returns the [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") decomposition of `*this` See also [SelfAdjointView::llt()](classeigen_1_1selfadjointview#a405e810491642a7f7b785f2ad6f93619) log() ----- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixLogarithmReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::log | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise logarithm use ArrayBase::log . Returns an expression of the matrix logarithm of `*this`. lpNorm() -------- template<typename Derived > template<int p> | | | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::RealScalar [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::lpNorm | Returns the **coefficient-wise** \( \ell^p \) norm of `*this`, that is, returns the p-th root of the sum of the p-th powers of the absolute values of the coefficients of `*this`. If *p* is the special value *[Eigen::Infinity](namespaceeigen#a7951593b031e13d90223c83d022ce99e)*, this function returns the \( \ell^\infty \) norm, that is the maximum of the absolute values of the coefficients of `*this`. In all cases, if `*this` is empty, then the value 0 is returned. Note For matrices, this function does not compute the [operator-norm](https://en.wikipedia.org/wiki/Operator_norm). That is, if `*this` is a matrix, then its coefficients are interpreted as a 1D vector. Nonetheless, you can easily compute the 1-norm and \(\infty\)-norm matrix operator norms using [partial reductions](group__tutorialreductionsvisitorsbroadcasting#TutorialReductionsVisitorsBroadcastingReductionsNorm) . See also [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975) lu() ---- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [PartialPivLU](classeigen_1_1partialpivlu)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::lu | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Synonym of [partialPivLu()](classeigen_1_1matrixbase#a6199d8aaf26c1b8ac3097fdfa7733a1e). Returns the partial-pivoting LU decomposition of `*this`. See also class [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.") makeHouseholder() ----------------- template<typename Derived > template<typename EssentialPart > | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::makeHouseholder | ( | EssentialPart & | *essential*, | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *tau*, | | | | RealScalar & | *beta* | | | ) | | const | Computes the elementary reflector H such that: \( H \*this = [ beta 0 ... 0]^T \) where the transformation H is: \( H = I - tau v v^\*\) and the vector v is: \( v^T = [1 essential^T] \) On output: Parameters | | | | --- | --- | | essential | the essential part of the vector `v` | | tau | the scaling factor of the Householder transformation | | beta | the result of H \* `*this` | See also [MatrixBase::makeHouseholderInPlace()](classeigen_1_1matrixbase#aebf4bac7dffe2685ab93734fb776e817), [MatrixBase::applyHouseholderOnTheLeft()](classeigen_1_1matrixbase#a8f2c8059ef3f04cfa0c73b4c012db855), [MatrixBase::applyHouseholderOnTheRight()](classeigen_1_1matrixbase#ab3e52262b41fa40e194dda245e0f9675) makeHouseholderInPlace() ------------------------ template<typename Derived > | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::makeHouseholderInPlace | ( | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *tau*, | | | | RealScalar & | *beta* | | | ) | | | Computes the elementary reflector H such that: \( H \*this = [ beta 0 ... 0]^T \) where the transformation H is: \( H = I - tau v v^\*\) and the vector v is: \( v^T = [1 essential^T] \) The essential part of the vector `v` is stored in \*this. On output: Parameters | | | | --- | --- | | tau | the scaling factor of the Householder transformation | | beta | the result of H \* `*this` | See also [MatrixBase::makeHouseholder()](classeigen_1_1matrixbase#a13291e900f7e81ddc6e5b8802f82092b), [MatrixBase::applyHouseholderOnTheLeft()](classeigen_1_1matrixbase#a8f2c8059ef3f04cfa0c73b4c012db855), [MatrixBase::applyHouseholderOnTheRight()](classeigen_1_1matrixbase#ab3e52262b41fa40e194dda245e0f9675) noalias() --------- template<typename Derived > | | | --- | | [NoAlias](classeigen_1_1noalias)< Derived, [MatrixBase](classeigen_1_1matrixbase) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::noalias | Returns a pseudo expression of `*this` with an operator= assuming no aliasing between `*this` and the source expression. More precisely, [noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) allows to bypass the EvalBeforeAssignBit flag. Currently, even though several expressions may alias, only product expressions have this flag. Therefore, [noalias()](classeigen_1_1matrixbase#a2c1085de7645f23f240876388457da0b) is only useful when the source expression contains a matrix product. Here are some examples where noalias is useful: ``` D.noalias() = A * B; D.noalias() += A.transpose() * B; D.noalias() -= 2 * A * B.adjoint(); ``` On the other hand the following example will lead to a **wrong** result: ``` A.noalias() = A * B; ``` because the result matrix A is also an operand of the matrix product. Therefore, there is no alternative than evaluating A \* B in a temporary, that is the default behavior when you write: ``` A = A * B; ``` See also class [NoAlias](classeigen_1_1noalias "Pseudo expression providing an operator = assuming no aliasing.") norm() ------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [NumTraits](structeigen_1_1numtraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::norm | | inline | Returns , for vectors, the *l2* norm of `*this`, and for matrices the Frobenius norm. In both cases, it consists in the square root of the sum of the square of all the matrix entries. For vectors, this is also equals to the square root of the dot product of `*this` with itself. See also [lpNorm()](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35), [dot()](classeigen_1_1matrixbase#adfd32bf5fcf6ee603c924dde9bf7bc39), [squaredNorm()](classeigen_1_1matrixbase#ac8da566526419f9742a6c471bbd87e0a) normalize() ----------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::normalize | | inline | Normalizes the vector, i.e. divides it by its own norm. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. Warning If the input vector is too small (i.e., this->[norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975)==0), then `*this` is left unchanged. See also [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975), [normalized()](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) normalized() ------------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::normalized | | inline | Returns an expression of the quotient of `*this` by its own norm. Warning If the input vector is too small (i.e., this->[norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975)==0), then this function returns a copy of the input. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975), [normalize()](classeigen_1_1matrixbase#ad16303c47ba36f7a41ea264cb26bceb6) operator!=() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator!= | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | Returns true if at least one pair of coefficients of `*this` and *other* are not exactly equal to each other. Warning When using floating point scalar values you probably should rather use a fuzzy comparison such as [isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) See also [isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c), operator== operator\*() [1/2] ------------------ template<typename Derived > template<typename DiagonalDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Product](classeigen_1_1product)< Derived, DiagonalDerived, LazyProduct > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator\* | ( | const DiagonalBase< DiagonalDerived > & | *a\_diagonal* | ) | const | | inline | Returns the diagonal matrix product of `*this` by the diagonal matrix *diagonal*. operator\*() [2/2] ------------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Product](classeigen_1_1product)< Derived, OtherDerived > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | Returns the matrix product of `*this` and *other*. Note If instead of the matrix product you want the coefficient-wise product, see Cwise::operator\*(). See also [lazyProduct()](classeigen_1_1matrixbase#ae0c280b1066c14ed577021f38876527f), operator\*=(const MatrixBase&), Cwise::operator\*() operator\*=() ------------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator\*= | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` \* *other*. Returns a reference to `*this` Example: ``` Matrix3f A = [Matrix3f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,3), B; B << 0,1,0, 0,0,1, 1,0,0; cout << "At start, A = " << endl << A << endl; A *= B; cout << "After A \*= B, A = " << endl << A << endl; A.applyOnTheRight(B); // equivalent to A \*= B cout << "After applyOnTheRight, A = " << endl << A << endl; ``` Output: ``` At start, A = 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 After A *= B, A = -0.33 0.68 0.597 0.536 -0.211 0.823 -0.444 0.566 -0.605 After applyOnTheRight, A = 0.597 -0.33 0.68 0.823 0.536 -0.211 -0.605 -0.444 0.566 ``` operator+=() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator+= | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` + *other*. Returns a reference to `*this` operator-=() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator-= | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | | | inline | replaces `*this` by `*this` - *other*. Returns a reference to `*this` operator=() ----------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator= | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *other* | ) | | | inline | Special case of the template operator=, in order to prevent the compiler from generating a default operator= (issue hit with g++ 4.1) operator==() ------------ template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operator== | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | Returns true if each coefficients of `*this` and *other* are all exactly equal. Warning When using floating point scalar values you probably should rather use a fuzzy comparison such as [isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) See also [isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c), operator!= operatorNorm() -------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::RealScalar [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::operatorNorm | | inline | Computes the L2 operator norm. Returns Operator norm of the matrix. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` This function computes the L2 operator norm of a matrix, which is also known as the spectral norm. The norm of a matrix \( A \) is defined to be \[ \|A\|\_2 = \max\_x \frac{\|Ax\|\_2}{\|x\|\_2} \] where the maximum is over all vectors and the norm on the right is the Euclidean vector norm. The norm equals the largest singular value, which is the square root of the largest eigenvalue of the positive semi-definite matrix \( A^\*A \). The current implementation uses the eigenvalues of \( A^\*A \), as computed by [SelfAdjointView::eigenvalues()](classeigen_1_1selfadjointview#ad4f34424b4ea12de9bbc5623cb938b4f "Computes the eigenvalues of a matrix."), to compute the operator norm of a matrix. The [SelfAdjointView](classeigen_1_1selfadjointview "Expression of a selfadjoint matrix from a triangular part of a dense matrix.") class provides a better algorithm for selfadjoint matrices. Example: ``` MatrixXd ones = [MatrixXd::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); cout << "The operator norm of the 3x3 matrix of ones is " << ones.operatorNorm() << endl; ``` Output: ``` The operator norm of the 3x3 matrix of ones is 3 ``` See also [SelfAdjointView::eigenvalues()](classeigen_1_1selfadjointview#ad4f34424b4ea12de9bbc5623cb938b4f "Computes the eigenvalues of a matrix."), [SelfAdjointView::operatorNorm()](classeigen_1_1selfadjointview#a12a7da482e31ec9c517dca92dd7bae61 "Computes the L2 operator norm.") partialPivLu() -------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [PartialPivLU](classeigen_1_1partialpivlu)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::partialPivLu | | inline | This is defined in the LU module. ``` #include <Eigen/LU> ``` Returns the partial-pivoting LU decomposition of `*this`. See also class [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.") pow() [1/2] ----------- template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | const MatrixPowerReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::pow | ( | const RealScalar & | *p* | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use [ArrayBase::pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) . Returns an expression of the matrix power to `p` of `*this`. pow() [2/2] ----------- template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | const MatrixComplexPowerReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::pow | ( | const std::complex< RealScalar > & | *p* | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise power to `p` use [ArrayBase::pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) . Returns an expression of the matrix power to `p` of `*this`. selfadjointView() [1/2] ----------------------- template<typename Derived > template<unsigned int UpLo> | | | | | | | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)<Derived>::template SelfAdjointViewReturnType<UpLo>::Type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::selfadjointView | ( | | ) | | Returns an expression of a symmetric/self-adjoint view extracted from the upper or lower triangular part of the current matrix The parameter *UpLo* can be either `[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)` or `[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)` Example: ``` Matrix3i m = [Matrix3i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the symmetric matrix extracted from the upper part of m:" << endl << Matrix3i(m.selfadjointView<[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>()) << endl; cout << "Here is the symmetric matrix extracted from the lower part of m:" << endl << Matrix3i(m.selfadjointView<[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>()) << endl; ``` Output: ``` Here is the matrix m: 7 6 -3 -2 9 6 6 -6 -5 Here is the symmetric matrix extracted from the upper part of m: 7 6 -3 6 9 6 -3 6 -5 Here is the symmetric matrix extracted from the lower part of m: 7 -2 6 -2 9 -6 6 -6 -5 ``` See also class [SelfAdjointView](classeigen_1_1selfadjointview "Expression of a selfadjoint matrix from a triangular part of a dense matrix.") selfadjointView() [2/2] ----------------------- template<typename Derived > template<unsigned int UpLo> | | | | | | | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::selfadjointView | ( | | ) | const | This is the const version of MatrixBase::selfadjointView() setIdentity() [1/2] ------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::setIdentity | | inline | Writes the identity expression (not necessarily square) into \*this. Example: ``` Matrix4i m = [Matrix4i::Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761)(); m.block<3,3>(1,0).[setIdentity](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683)(); cout << m << endl; ``` Output: ``` 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 ``` See also class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor."), [Identity()](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f), [Identity(Index,Index)](classeigen_1_1matrixbase#acf33ce20ef03ead47cb3dbcd5f416ede), [isIdentity()](classeigen_1_1matrixbase#a4ccbd8dfa06e9d47b9bf84711f8b9d40) setIdentity() [2/2] ------------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::setIdentity | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inline | Resizes to the given size, and writes the identity expression (not necessarily square) into \*this. Parameters | | | | --- | --- | | rows | the new number of rows | | cols | the new number of columns | Example: ``` MatrixXf m; m.setIdentity(3, 3); cout << m << endl; ``` Output: ``` 1 0 0 0 1 0 0 0 1 ``` See also [MatrixBase::setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683), class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor."), [MatrixBase::Identity()](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f) setUnit() [1/2] --------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::setUnit | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *i* | ) | | | inline | Set the coefficients of `*this` to the i-th unit (basis) vector. Parameters | | | | --- | --- | | i | index of the unique coefficient to be set to 1 | This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683), class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor."), [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539) setUnit() [2/2] --------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Derived & [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::setUnit | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *newSize*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *i* | | | ) | | | | inline | Resizes to the given *newSize*, and writes the i-th unit (basis) vector into \*this. Parameters | | | | --- | --- | | newSize | the new size of the vector | | i | index of the unique coefficient to be set to 1 | This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::setIdentity()](classeigen_1_1matrixbase#a18e969adfdf2db4ac44c47fbdc854683), class [CwiseNullaryOp](classeigen_1_1cwisenullaryop "Generic expression of a matrix where all coefficients are defined by a functor."), [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539) sin() ----- template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::sin | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise sine use ArrayBase::sin . Returns an expression of the matrix sine of `*this`. sinh() ------ template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixFunctionReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::sinh | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise hyperbolic sine use ArrayBase::sinh . Returns an expression of the matrix hyperbolic sine of `*this`. sqrt() ------ template<typename Derived > | | | | | | | --- | --- | --- | --- | --- | | const MatrixSquareRootReturnValue<Derived> [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::sqrt | ( | | ) | const | This function requires the [unsupported MatrixFunctions module](unsupported/group__matrixfunctions__module). To compute the coefficient-wise square root use ArrayBase::sqrt . Returns an expression of the matrix square root of `*this`. squaredNorm() ------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [NumTraits](structeigen_1_1numtraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::squaredNorm | | inline | Returns , for vectors, the squared *l2* norm of `*this`, and for matrices the squared Frobenius norm. In both cases, it consists in the sum of the square of all the matrix entries. For vectors, this is also equals to the dot product of `*this` with itself. See also [dot()](classeigen_1_1matrixbase#adfd32bf5fcf6ee603c924dde9bf7bc39), [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975), [lpNorm()](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35) stableNorm() ------------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [NumTraits](structeigen_1_1numtraits)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::stableNorm | | inline | Returns the *l2* norm of `*this` avoiding underflow and overflow. This version use a blockwise two passes algorithm: 1 - find the absolute largest coefficient `s` 2 - compute \( s \Vert \frac{\*this}{s} \Vert \) in a standard way For architecture/scalar types supporting vectorization, this version is faster than [blueNorm()](classeigen_1_1matrixbase#a3f3faa00163c16824ff03e58a210c74c). Otherwise the [blueNorm()](classeigen_1_1matrixbase#a3f3faa00163c16824ff03e58a210c74c) is much faster. See also [norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975), [blueNorm()](classeigen_1_1matrixbase#a3f3faa00163c16824ff03e58a210c74c), [hypotNorm()](classeigen_1_1matrixbase#a32222d3b6677e6cdf0b801463f329b72) stableNormalize() ----------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | void [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::stableNormalize | | inline | Normalizes the vector while avoid underflow and overflow This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. This method is analogue to the [normalize()](classeigen_1_1matrixbase#ad16303c47ba36f7a41ea264cb26bceb6) method, but it reduces the risk of underflow and overflow when computing the norm. Warning If the input vector is too small (i.e., this->[norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975)==0), then `*this` is left unchanged. See also [stableNorm()](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1), [stableNormalized()](classeigen_1_1matrixbase#a399dca938633b9f8df5ec4beefeccec0), [normalize()](classeigen_1_1matrixbase#ad16303c47ba36f7a41ea264cb26bceb6) stableNormalized() ------------------ template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::stableNormalized | | inline | Returns an expression of the quotient of `*this` by its own norm while avoiding underflow and overflow. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. This method is analogue to the [normalized()](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) method, but it reduces the risk of underflow and overflow when computing the norm. Warning If the input vector is too small (i.e., this->[norm()](classeigen_1_1matrixbase#a196c4ec3c8ffdf5bda45d0f617154975)==0), then this function returns a copy of the input. See also [stableNorm()](classeigen_1_1matrixbase#ab84d3e64f855813b1eea4202c0697dc1), [stableNormalize()](classeigen_1_1matrixbase#a0b1443fa322615379557ade3399a3c3c), [normalized()](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308) trace() ------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::trace | | inline | Returns the trace of `*this`, i.e. the sum of the coefficients on the main diagonal. `*this` can be any matrix, not necessarily square. See also [diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3), [sum()](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) triangularView() [1/2] ---------------------- template<typename Derived > template<unsigned int Mode> | | | | | | | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)<Derived>::template TriangularViewReturnType<Mode>::Type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::triangularView | ( | | ) | | Returns an expression of a triangular view extracted from the current matrix The parameter *Mode* can have the following values: `[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)`, `[StrictlyUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda7b37877e0b9b0df28c9c2b669a633265)`, `[UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad)`, `[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)`, `[StrictlyLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2424988b6fca98be70b595632753ba81)`, `[UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda)`. Example: ``` Matrix3i m = [Matrix3i::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the upper-triangular matrix extracted from m:" << endl << Matrix3i(m.triangularView<[Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>()) << endl; cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl << Matrix3i(m.triangularView<[Eigen::StrictlyUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda7b37877e0b9b0df28c9c2b669a633265)>()) << endl; cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl << Matrix3i(m.triangularView<[Eigen::UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda)>()) << endl; // FIXME need to implement output for triangularViews (Bug 885) ``` Output: ``` Here is the matrix m: 7 6 -3 -2 9 6 6 -6 -5 Here is the upper-triangular matrix extracted from m: 7 6 -3 0 9 6 0 0 -5 Here is the strictly-upper-triangular matrix extracted from m: 0 6 -3 0 0 6 0 0 0 Here is the unit-lower-triangular matrix extracted from m: 1 0 0 -2 1 0 6 -6 1 ``` See also class [TriangularView](classeigen_1_1triangularview "Expression of a triangular part in a matrix.") triangularView() [2/2] ---------------------- template<typename Derived > template<unsigned int Mode> | | | | | | | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)<Derived>::template ConstTriangularViewReturnType<Mode>::Type [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::triangularView | ( | | ) | const | This is the const version of MatrixBase::triangularView() Unit() [1/2] ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::BasisReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::Unit | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *i* | ) | | | inlinestatic | Returns an expression of the i-th unit (basis) vector. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. This variant is for fixed-size vector only. See also [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539), [MatrixBase::UnitX()](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d), [MatrixBase::UnitY()](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc), [MatrixBase::UnitZ()](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0), [MatrixBase::UnitW()](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) Unit() [2/2] ------------ template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::BasisReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::Unit | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *newSize*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *i* | | | ) | | | | inlinestatic | Returns an expression of the i-th unit (basis) vector. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::Unit(Index)](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df), [MatrixBase::UnitX()](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d), [MatrixBase::UnitY()](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc), [MatrixBase::UnitZ()](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0), [MatrixBase::UnitW()](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) UnitW() ------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::BasisReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::UnitW | | inlinestatic | Returns an expression of the W axis unit vector (0,0,0,1) This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539), [MatrixBase::Unit(Index)](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df), [MatrixBase::UnitY()](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc), [MatrixBase::UnitZ()](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0), [MatrixBase::UnitW()](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) UnitX() ------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::BasisReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::UnitX | | inlinestatic | Returns an expression of the X axis unit vector (1{,0}^\*) This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539), [MatrixBase::Unit(Index)](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df), [MatrixBase::UnitY()](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc), [MatrixBase::UnitZ()](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0), [MatrixBase::UnitW()](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) UnitY() ------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::BasisReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::UnitY | | inlinestatic | Returns an expression of the Y axis unit vector (0,1{,0}^\*) This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539), [MatrixBase::Unit(Index)](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df), [MatrixBase::UnitY()](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc), [MatrixBase::UnitZ()](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0), [MatrixBase::UnitW()](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) UnitZ() ------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::BasisReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::UnitZ | | inlinestatic | Returns an expression of the Z axis unit vector (0,0,1{,0}^\*) This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. See also [MatrixBase::Unit(Index,Index)](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539), [MatrixBase::Unit(Index)](classeigen_1_1matrixbase#a9daf6d22d10ed8ae00432b0f641455df), [MatrixBase::UnitY()](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc), [MatrixBase::UnitZ()](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0), [MatrixBase::UnitW()](classeigen_1_1matrixbase#af56ba94e5b0330827003eadd26cfadc2) --- The documentation for this class was generated from the following files:* [MatrixBase.h](https://eigen.tuxfamily.org/dox/MatrixBase_8h_source.html) * [LDLT.h](https://eigen.tuxfamily.org/dox/LDLT_8h_source.html) * [LLT.h](https://eigen.tuxfamily.org/dox/LLT_8h_source.html) * [Assign.h](https://eigen.tuxfamily.org/dox/Assign_8h_source.html) * [CwiseBinaryOp.h](https://eigen.tuxfamily.org/dox/CwiseBinaryOp_8h_source.html) * [CwiseNullaryOp.h](https://eigen.tuxfamily.org/dox/CwiseNullaryOp_8h_source.html) * [Diagonal.h](https://eigen.tuxfamily.org/dox/Diagonal_8h_source.html) * [DiagonalMatrix.h](https://eigen.tuxfamily.org/dox/DiagonalMatrix_8h_source.html) * [DiagonalProduct.h](https://eigen.tuxfamily.org/dox/DiagonalProduct_8h_source.html) * [Dot.h](https://eigen.tuxfamily.org/dox/Dot_8h_source.html) * [ForceAlignedAccess.h](https://eigen.tuxfamily.org/dox/ForceAlignedAccess_8h_source.html) * [GeneralProduct.h](https://eigen.tuxfamily.org/dox/GeneralProduct_8h_source.html) * [NoAlias.h](https://eigen.tuxfamily.org/dox/NoAlias_8h_source.html) * [PermutationMatrix.h](https://eigen.tuxfamily.org/dox/PermutationMatrix_8h_source.html) * [Redux.h](https://eigen.tuxfamily.org/dox/Redux_8h_source.html) * [SelfAdjointView.h](https://eigen.tuxfamily.org/dox/SelfAdjointView_8h_source.html) * [StableNorm.h](https://eigen.tuxfamily.org/dox/StableNorm_8h_source.html) * [Transpose.h](https://eigen.tuxfamily.org/dox/Transpose_8h_source.html) * [TriangularMatrix.h](https://eigen.tuxfamily.org/dox/TriangularMatrix_8h_source.html) * [MatrixBaseEigenvalues.h](https://eigen.tuxfamily.org/dox/MatrixBaseEigenvalues_8h_source.html) * [EulerAngles.h](https://eigen.tuxfamily.org/dox/EulerAngles_8h_source.html) * [Homogeneous.h](https://eigen.tuxfamily.org/dox/Homogeneous_8h_source.html) * [OrthoMethods.h](https://eigen.tuxfamily.org/dox/OrthoMethods_8h_source.html) * [Householder.h](https://eigen.tuxfamily.org/dox/Householder_8h_source.html) * [Jacobi.h](https://eigen.tuxfamily.org/dox/Jacobi_8h_source.html) * [Determinant.h](https://eigen.tuxfamily.org/dox/Determinant_8h_source.html) * [FullPivLU.h](https://eigen.tuxfamily.org/dox/FullPivLU_8h_source.html) * [InverseImpl.h](https://eigen.tuxfamily.org/dox/InverseImpl_8h_source.html) * [PartialPivLU.h](https://eigen.tuxfamily.org/dox/PartialPivLU_8h_source.html) * [ColPivHouseholderQR.h](https://eigen.tuxfamily.org/dox/ColPivHouseholderQR_8h_source.html) * [CompleteOrthogonalDecomposition.h](https://eigen.tuxfamily.org/dox/CompleteOrthogonalDecomposition_8h_source.html) * [FullPivHouseholderQR.h](https://eigen.tuxfamily.org/dox/FullPivHouseholderQR_8h_source.html) * [HouseholderQR.h](https://eigen.tuxfamily.org/dox/HouseholderQR_8h_source.html) * [SparseView.h](https://eigen.tuxfamily.org/dox/SparseView_8h_source.html) * [BDCSVD.h](https://eigen.tuxfamily.org/dox/BDCSVD_8h_source.html) * [JacobiSVD.h](https://eigen.tuxfamily.org/dox/JacobiSVD_8h_source.html)
programming_docs
eigen3 Eigen::SimplicialLDLT Eigen::SimplicialLDLT ===================== ### template<typename \_MatrixType, int \_UpLo, typename \_Ordering> class Eigen::SimplicialLDLT< \_MatrixType, \_UpLo, \_Ordering > A direct sparse [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") Cholesky factorizations without square root. This class provides a LDL^T Cholesky factorizations without square root of sparse matrices that are selfadjoint and positive definite. The factorization allows for solving A.X = B where X and B can be either dense or sparse. In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization such that the factorized matrix is P A P^-1. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | \_UpLo | the triangular part that will be used for the computations. It can be Lower or Upper. Default is Lower. | | \_Ordering | The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<> | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations."), class [AMDOrdering](classeigen_1_1amdordering), class [NaturalOrdering](classeigen_1_1naturalordering) | | | --- | | | | void | [analyzePattern](classeigen_1_1simplicialldlt#aaf7c852056195d05de863362638517b7) (const MatrixType &a) | | | | [SimplicialLDLT](classeigen_1_1simplicialldlt) & | [compute](classeigen_1_1simplicialldlt#a55429e59dbdf16a5696ee28bbf14e44f) (const MatrixType &matrix) | | | | Scalar | [determinant](classeigen_1_1simplicialldlt#aa25042f3b49880f5e487d468ea20b1b7) () const | | | | void | [factorize](classeigen_1_1simplicialldlt#a8cf16bd92a712d36310397972bdef044) (const MatrixType &a) | | | | const MatrixL | [matrixL](classeigen_1_1simplicialldlt#ae8f502eff0c95771115968510e4d9af5) () const | | | | const MatrixU | [matrixU](classeigen_1_1simplicialldlt#ae98ed1c7ce8f9165adf5fb08cbb36b70) () const | | | | | [SimplicialLDLT](classeigen_1_1simplicialldlt#a3f26ae6105ffa36af9b8710e01e5caed) () | | | | | [SimplicialLDLT](classeigen_1_1simplicialldlt#a07cb76aee396862f94c3eedc6d77d908) (const MatrixType &matrix) | | | | const [VectorType](classeigen_1_1matrix) | [vectorD](classeigen_1_1simplicialldlt#abe54532ce80558a0474b11763702107b) () const | | | | Public Member Functions inherited from [Eigen::SimplicialCholeskyBase< SimplicialLDLT< \_MatrixType, \_UpLo, \_Ordering > >](classeigen_1_1simplicialcholeskybase) | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1simplicialcholeskybase#a3ac877f73aaaff670e6ae7554eb02fc8) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1simplicialcholeskybase#a3ac877f73aaaff670e6ae7554eb02fc8) | | | | const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, StorageIndex > & | [permutationP](classeigen_1_1simplicialcholeskybase#aff1480e595a21726beaec9a586a94d5a) () const | | | | const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, StorageIndex > & | [permutationPinv](classeigen_1_1simplicialcholeskybase#a0e23d1f4a88c211be7098faf1cb41674) () const | | | | [SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering > & | [setShift](classeigen_1_1simplicialcholeskybase#a362352f755101faaac59c1ed9d5e3559) (const RealScalar &offset, const RealScalar &scale=1) | | | | | [SimplicialCholeskyBase](classeigen_1_1simplicialcholeskybase#a098baba1dbe07ca3a775c8df1f8a0e71) () | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< SimplicialLDLT< \_MatrixType, \_UpLo, \_Ordering > >](classeigen_1_1sparsesolverbase) | | const [Solve](classeigen_1_1solve)< [SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | const [Solve](classeigen_1_1solve)< [SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | | | | --- | | | | Protected Member Functions inherited from [Eigen::SimplicialCholeskyBase< SimplicialLDLT< \_MatrixType, \_UpLo, \_Ordering > >](classeigen_1_1simplicialcholeskybase) | | void | [compute](classeigen_1_1simplicialcholeskybase#a9a741744dda2261cae26cddf96a35bf0) (const MatrixType &matrix) | | | SimplicialLDLT() [1/2] ---------------------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::[SimplicialLDLT](classeigen_1_1simplicialldlt) | ( | | ) | | | inline | Default constructor SimplicialLDLT() [2/2] ---------------------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::[SimplicialLDLT](classeigen_1_1simplicialldlt) | ( | const MatrixType & | *matrix* | ) | | | inlineexplicit | Constructs and performs the [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") factorization of *matrix* analyzePattern() ---------------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::analyzePattern | ( | const MatrixType & | *a* | ) | | | inline | Performs a symbolic decomposition on the sparcity of *matrix*. This function is particularly useful when solving for several problems having the same structure. See also [factorize()](classeigen_1_1simplicialldlt#a8cf16bd92a712d36310397972bdef044) compute() --------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [SimplicialLDLT](classeigen_1_1simplicialldlt)& [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Computes the sparse Cholesky decomposition of *matrix* determinant() ------------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::determinant | ( | | ) | const | | inline | Returns the determinant of the underlying matrix from the current factorization factorize() ----------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::factorize | ( | const MatrixType & | *a* | ) | | | inline | Performs a numeric decomposition of *matrix* The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed. See also [analyzePattern()](classeigen_1_1simplicialldlt#aaf7c852056195d05de863362638517b7) matrixL() --------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixL [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::matrixL | ( | | ) | const | | inline | Returns an expression of the factor L matrixU() --------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixU [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::matrixU | ( | | ) | const | | inline | Returns an expression of the factor U (= L^\*) vectorD() --------- template<typename \_MatrixType , int \_UpLo, typename \_Ordering > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [VectorType](classeigen_1_1matrix) [Eigen::SimplicialLDLT](classeigen_1_1simplicialldlt)< \_MatrixType, \_UpLo, \_Ordering >::vectorD | ( | | ) | const | | inline | Returns a vector expression of the diagonal D --- The documentation for this class was generated from the following file:* [SimplicialCholesky.h](https://eigen.tuxfamily.org/dox/SimplicialCholesky_8h_source.html) eigen3 Eigen::IncompleteLUT Eigen::IncompleteLUT ==================== ### template<typename \_Scalar, typename \_StorageIndex = int> struct Eigen::IncompleteLUT< \_Scalar, \_StorageIndex >::keep\_diag keeps off-diagonal entries; drops diagonal entries --- The documentation for this struct was generated from the following file:* [IncompleteLUT.h](https://eigen.tuxfamily.org/dox/IncompleteLUT_8h_source.html) eigen3 Eigen::Map Eigen::Map ========== ### template<typename \_Scalar, int \_Options> class Eigen::Map< Quaternion< \_Scalar >, \_Options > Expression of a quaternion from a memory buffer. Template Parameters | | | | --- | --- | | \_Scalar | the type of the [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") coefficients | | \_Options | see class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") | This is a specialization of class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."). This class allows to view a 4 scalar memory buffer as an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") object. See also class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."), class [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), class [QuaternionBase](classeigen_1_1quaternionbase "Base class for quaternion expressions.") | | | --- | | | | | [Map](classeigen_1_1map_3_01quaternion_3_01__scalar_01_4_00_01__options_01_4#a225f365e99258e028ef1ffa0031fab9b) (Scalar \*coeffs) | | | | Public Member Functions inherited from [Eigen::QuaternionBase< Map< Quaternion< \_Scalar >, \_Options > >](classeigen_1_1quaternionbase) | | [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) | [\_transformVector](classeigen_1_1quaternionbase#aabef1f6fc62535f6f85d590108915ee8) (const [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) &v) const | | | | internal::traits< [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [angularDistance](classeigen_1_1quaternionbase#a74f13d7c853484996494c26c633ae02a) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | internal::cast\_return\_type< [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options >, [Quaternion](classeigen_1_1quaternion)< NewScalarType > >::type | [cast](classeigen_1_1quaternionbase#a951d627764be63ca1e8c2c4c7315e43f) () const | | | | internal::traits< [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::Coefficients & | [coeffs](classeigen_1_1quaternionbase#ae61294790c0cc308d3f69690a657672c) () | | | | const internal::traits< [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::Coefficients & | [coeffs](classeigen_1_1quaternionbase#a193e79f616335a0067e3e784c7cf85fa) () const | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [conjugate](classeigen_1_1quaternionbase#a5e63b775d0a93161ce6137ec0a17f6b0) () const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [dot](classeigen_1_1quaternionbase#aa2d22c5b321c9539dd625ca415422236) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [inverse](classeigen_1_1quaternionbase#ab12ee41b3b06adc3062217a795a6a9f5) () const | | | | bool | [isApprox](classeigen_1_1quaternionbase#a64bc41c96a9e99567e0f8409f8f0f680) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) >::dummy\_precision()) const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [norm](classeigen_1_1quaternionbase#aad4b1faef1eabdc7fdd4d305e9881149) () const | | | | void | [normalize](classeigen_1_1quaternionbase#a7a487a8a129b46be562f42044102c1f8) () | | | | [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [normalized](classeigen_1_1quaternionbase#ade799f18b7ec19c02ddae3a4921fa8a0) () const | | | | bool | [operator!=](classeigen_1_1quaternionbase#a530edf22f03853cd07ba829ea0d505dc) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Quaternion](classeigen_1_1quaternion)< typename internal::traits< [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [operator\*](classeigen_1_1quaternionbase#afdf1dc395c1cff6716ec9b80fd15b414) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [operator\*=](classeigen_1_1quaternionbase#afd8ee6b6420fbdd22fab7cd016212441) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &q) | | | | [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [operator=](classeigen_1_1quaternionbase#aa7c114c6e62a37d4fc53b6e82ed78eac) (const [AngleAxisType](classeigen_1_1quaternionbase#aed266c63b10a4028304901d9c8614199) &aa) | | | | [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [operator=](classeigen_1_1quaternionbase#a20a6702c9da3fc2950178d920d0aaf84) (const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &xpr) | | | | bool | [operator==](classeigen_1_1quaternionbase#ad206c9014409c06970884dbfc00e6c3c) (const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > & | [setFromTwoVectors](classeigen_1_1quaternionbase#a7ae84bfbcc9f3f19f10294496a836bee) (const [MatrixBase](classeigen_1_1matrixbase)< Derived1 > &a, const [MatrixBase](classeigen_1_1matrixbase)< Derived2 > &b) | | | | [QuaternionBase](classeigen_1_1quaternionbase) & | [setIdentity](classeigen_1_1quaternionbase#a4695b0f6eebfb217ae2fbd579ceda24a) () | | | | [Quaternion](classeigen_1_1quaternion)< typename internal::traits< [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [slerp](classeigen_1_1quaternionbase#ac840bde67d22f2deca330561c65d144e) (const [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) &t, const [QuaternionBase](classeigen_1_1quaternionbase)< OtherDerived > &other) const | | | | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [squaredNorm](classeigen_1_1quaternionbase#a09730db4ef0b546f5cf29f6b180b3c87) () const | | | | [Matrix3](classeigen_1_1quaternionbase#ac3972e6cb0f56cccbe9e3946a7e494f8) | [toRotationMatrix](classeigen_1_1quaternionbase#a8cf07ab9875baba2eecdd62ff93bfc3f) () const | | | | [VectorBlock](classeigen_1_1vectorblock)< Coefficients, 3 > | [vec](classeigen_1_1quaternionbase#a91f93bde88f52796cfcd92c3594f39e5) () | | | | const [VectorBlock](classeigen_1_1vectorblock)< const Coefficients, 3 > | [vec](classeigen_1_1quaternionbase#ada8bdb403471df23511bdc0f227962ea) () const | | | | NonConstCoeffReturnType | [w](classeigen_1_1quaternionbase#ad884cf20a0b0b92bb63ab3fe9d6d6b7f) () | | | | CoeffReturnType | [w](classeigen_1_1quaternionbase#ab5eae91bedac0afaab0074cec5e535bc) () const | | | | NonConstCoeffReturnType | [x](classeigen_1_1quaternionbase#a8b05bac2a1c099b341396f725e85f3b1) () | | | | CoeffReturnType | [x](classeigen_1_1quaternionbase#afdd8e260d5de861a6136cb9e6ceaa4b4) () const | | | | NonConstCoeffReturnType | [y](classeigen_1_1quaternionbase#a6005245a72520df258d30af6b5448595) () | | | | CoeffReturnType | [y](classeigen_1_1quaternionbase#aad37efca5d9fde3f4cb03a208f38d74f) () const | | | | NonConstCoeffReturnType | [z](classeigen_1_1quaternionbase#a9afed6a7fa4fcdfbe599d7b5b207fc1b) () | | | | CoeffReturnType | [z](classeigen_1_1quaternionbase#a8389b65a61aa3fc76d3ba4bd4a63e529) () const | | | | Public Member Functions inherited from [Eigen::RotationBase< Derived, \_Dim >](classeigen_1_1rotationbase) | | Derived | [inverse](classeigen_1_1rotationbase#a8532fb716ea4267cf8bbdb99e5e54837) () const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [matrix](classeigen_1_1rotationbase#a91b5bdb1c7b90ec7b33107c6f7d3b171) () const | | | | template<typename OtherDerived > | | internal::rotation\_base\_generic\_product\_selector< Derived, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType | [operator\*](classeigen_1_1rotationbase#a09a4757e7aff7a95bebf4fa8a965a4eb) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &e) const | | | | template<int Mode, int Options> | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode > | [operator\*](classeigen_1_1rotationbase#aaca1c3d834e2bc7ebfd046d96cac990c) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode, Options > &t) const | | | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) > | [operator\*](classeigen_1_1rotationbase#a26d0603783666526a98d08bd45d9c751) (const [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim > &t) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [operator\*](classeigen_1_1rotationbase#a05af64a1bc759c5fed4ff7afd1414ba4) (const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > &s) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [toRotationMatrix](classeigen_1_1rotationbase#a94fe3683c867c39d34505932b07e956a) () const | | | | | | --- | | | | Public Types inherited from [Eigen::QuaternionBase< Map< Quaternion< \_Scalar >, \_Options > >](classeigen_1_1quaternionbase) | | typedef [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [AngleAxisType](classeigen_1_1quaternionbase#aed266c63b10a4028304901d9c8614199) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), 3, 3 > | [Matrix3](classeigen_1_1quaternionbase#ac3972e6cb0f56cccbe9e3946a7e494f8) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), 3, 1 > | [Vector3](classeigen_1_1quaternionbase#a974c0529d55983b0b3a6d99a8466f331) | | | | Public Types inherited from [Eigen::RotationBase< Derived, \_Dim >](classeigen_1_1rotationbase) | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Dim > | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | | | | Static Public Member Functions inherited from [Eigen::QuaternionBase< Map< Quaternion< \_Scalar >, \_Options > >](classeigen_1_1quaternionbase) | | static [Quaternion](classeigen_1_1quaternion)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > | [Identity](classeigen_1_1quaternionbase#a6f31a6f98016f186515b3277f4757962) () | | | Map() ----- template<typename \_Scalar , int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< \_Scalar >, \_Options >::[Map](classeigen_1_1map) | ( | Scalar \* | *coeffs* | ) | | | inlineexplicit | Constructs a Mapped [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") object from the pointer *coeffs* The pointer *coeffs* must reference the four coefficients of [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") in the following order: ``` *coeffs == {[x](classeigen_1_1quaternionbase#afdd8e260d5de861a6136cb9e6ceaa4b4), [y](classeigen_1_1quaternionbase#aad37efca5d9fde3f4cb03a208f38d74f), [z](classeigen_1_1quaternionbase#a8389b65a61aa3fc76d3ba4bd4a63e529), [w](classeigen_1_1quaternionbase#ab5eae91bedac0afaab0074cec5e535bc)} ``` If the template parameter \_Options is set to [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8), then the pointer coeffs must be aligned. --- The documentation for this class was generated from the following file:* [Quaternion.h](https://eigen.tuxfamily.org/dox/Quaternion_8h_source.html)
programming_docs
eigen3 Eigen::GeneralizedEigenSolver Eigen::GeneralizedEigenSolver ============================= ### template<typename \_MatrixType> class Eigen::GeneralizedEigenSolver< \_MatrixType > Computes the generalized eigenvalues and eigenvectors of a pair of general matrices. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrices of which we are computing the eigen-decomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. Currently, only real matrices are supported. | The generalized eigenvalues and eigenvectors of a matrix pair \( A \) and \( B \) are scalars \( \lambda \) and vectors \( v \) such that \( Av = \lambda Bv \). If \( D \) is a diagonal matrix with the eigenvalues on the diagonal, and \( V \) is a matrix with the eigenvectors as its columns, then \( A V = B V D \). The matrix \( V \) is almost always invertible, in which case we have \( A = B V D V^{-1} \). This is called the generalized eigen-decomposition. The generalized eigenvalues and eigenvectors of a matrix pair may be complex, even when the matrices are real. Moreover, the generalized eigenvalue might be infinite if the matrix B is singular. To workaround this difficulty, the eigenvalues are provided as a pair of complex \( \alpha \) and real \( \beta \) such that: \( \lambda\_i = \alpha\_i / \beta\_i \). If \( \beta\_i \) is (nearly) zero, then one can consider the well defined left eigenvalue \( \mu = \beta\_i / \alpha\_i\) such that: \( \mu\_i A v\_i = B v\_i \), or even \( \mu\_i u\_i^T A = u\_i^T B \) where \( u\_i \) is called the left eigenvector. Call the function [compute()](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c "Computes generalized eigendecomposition of given matrix.") to compute the generalized eigenvalues and eigenvectors of a given matrix pair. Alternatively, you can use the [GeneralizedEigenSolver(const MatrixType&, const MatrixType&, bool)](classeigen_1_1generalizedeigensolver#a2a3528cbf75f66d3a60af9dc7b12ff65 "Constructor; computes the generalized eigendecomposition of given matrix pair.") constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the [eigenvalues()](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58 "Returns an expression of the computed generalized eigenvalues.") and eigenvectors() functions. Here is an usage example of this class: Example: ``` GeneralizedEigenSolver<MatrixXf> ges; MatrixXf A = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXf B = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); ges.compute(A, B); cout << "The (complex) numerators of the generalzied eigenvalues are: " << ges.alphas().transpose() << endl; cout << "The (real) denominatore of the generalzied eigenvalues are: " << ges.betas().transpose() << endl; cout << "The (complex) generalzied eigenvalues are (alphas./beta): " << ges.eigenvalues().transpose() << endl; ``` Output: ``` The (complex) numerators of the generalzied eigenvalues are: (-0.126,0.569) (-0.126,-0.569) (-0.398,0) (-1.12,0) The (real) denominatore of the generalzied eigenvalues are: -1.56 -1.56 -1.25 0.746 The (complex) generalzied eigenvalues are (alphas./beta): (0.081,-0.365) (0.081,0.365) (0.318,-0) (-1.5,0) ``` See also [MatrixBase::eigenvalues()](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d "Computes the eigenvalues of a matrix."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices."), class [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") | | | --- | | | | typedef std::complex< RealScalar > | [ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7) | | | Complex scalar type for [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247 "Synonym for the template parameter _MatrixType."). [More...](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7) | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7), ColsAtCompileTime, 1, Options &~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxColsAtCompileTime, 1 > | [ComplexVectorType](classeigen_1_1generalizedeigensolver#acfd144329aca76882069da2fc5d53ef5) | | | Type for vector of complex scalar values eigenvalues as returned by [alphas()](classeigen_1_1generalizedeigensolver#a82b1bc41267f46e5c5899d5b084a73bb). [More...](classeigen_1_1generalizedeigensolver#acfd144329aca76882069da2fc5d53ef5) | | | | typedef [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_quotient\_op< [ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7), [Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47) >, [ComplexVectorType](classeigen_1_1generalizedeigensolver#acfd144329aca76882069da2fc5d53ef5), [VectorType](classeigen_1_1generalizedeigensolver#a5aa3d1390c2b0d455c1c9b8b3101b119) > | [EigenvalueType](classeigen_1_1generalizedeigensolver#ad59af178acc401f1bc4e330ef80f286d) | | | Expression type for the eigenvalues as returned by [eigenvalues()](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58 "Returns an expression of the computed generalized eigenvalues."). | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > | [EigenvectorsType](classeigen_1_1generalizedeigensolver#afffec018dbb2d87b4c09b6acecbb79cd) | | | Type for matrix of eigenvectors as returned by eigenvectors(). [More...](classeigen_1_1generalizedeigensolver#afffec018dbb2d87b4c09b6acecbb79cd) | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) | | | | typedef \_MatrixType | [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) | | | Synonym for the template parameter `_MatrixType`. | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47) | | | Scalar type for matrices of type [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247 "Synonym for the template parameter _MatrixType."). | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47), ColsAtCompileTime, 1, Options &~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxColsAtCompileTime, 1 > | [VectorType](classeigen_1_1generalizedeigensolver#a5aa3d1390c2b0d455c1c9b8b3101b119) | | | Type for vector of real scalar values eigenvalues as returned by [betas()](classeigen_1_1generalizedeigensolver#abeaa6f56cee367b83fd09d428462ca0c). [More...](classeigen_1_1generalizedeigensolver#a5aa3d1390c2b0d455c1c9b8b3101b119) | | | | | | --- | | | | [ComplexVectorType](classeigen_1_1generalizedeigensolver#acfd144329aca76882069da2fc5d53ef5) | [alphas](classeigen_1_1generalizedeigensolver#a82b1bc41267f46e5c5899d5b084a73bb) () const | | | | [VectorType](classeigen_1_1generalizedeigensolver#a5aa3d1390c2b0d455c1c9b8b3101b119) | [betas](classeigen_1_1generalizedeigensolver#abeaa6f56cee367b83fd09d428462ca0c) () const | | | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver) & | [compute](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c) (const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) &A, const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) &B, bool computeEigenvectors=true) | | | Computes generalized eigendecomposition of given matrix. [More...](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c) | | | | [EigenvalueType](classeigen_1_1generalizedeigensolver#ad59af178acc401f1bc4e330ef80f286d) | [eigenvalues](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58) () const | | | Returns an expression of the computed generalized eigenvalues. [More...](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58) | | | | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver#ae745f39da43f9df192cc2875d82b4cf1) () | | | Default constructor. [More...](classeigen_1_1generalizedeigensolver#ae745f39da43f9df192cc2875d82b4cf1) | | | | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver#a2a3528cbf75f66d3a60af9dc7b12ff65) (const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) &A, const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) &B, bool computeEigenvectors=true) | | | Constructor; computes the generalized eigendecomposition of given matrix pair. [More...](classeigen_1_1generalizedeigensolver#a2a3528cbf75f66d3a60af9dc7b12ff65) | | | | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver#aab6423ded30275cd4cdd31758c278694) ([Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) size) | | | Default constructor with memory preallocation. [More...](classeigen_1_1generalizedeigensolver#aab6423ded30275cd4cdd31758c278694) | | | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver) & | [setMaxIterations](classeigen_1_1generalizedeigensolver#a2a6f96bd042068cfc0eafba839b424bd) ([Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) maxIters) | | | ComplexScalar ------------- template<typename \_MatrixType > | | | --- | | typedef std::complex<RealScalar> [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7) | Complex scalar type for [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247 "Synonym for the template parameter _MatrixType."). This is `std::complex<Scalar>` if [Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47 "Scalar type for matrices of type MatrixType.") is real (e.g., `float` or `double`) and just `Scalar` if [Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47 "Scalar type for matrices of type MatrixType.") is complex. ComplexVectorType ----------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7), ColsAtCompileTime, 1, Options & ~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxColsAtCompileTime, 1> [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[ComplexVectorType](classeigen_1_1generalizedeigensolver#acfd144329aca76882069da2fc5d53ef5) | Type for vector of complex scalar values eigenvalues as returned by [alphas()](classeigen_1_1generalizedeigensolver#a82b1bc41267f46e5c5899d5b084a73bb). This is a column vector with entries of type [ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7 "Complex scalar type for MatrixType."). The length of the vector is the size of [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247 "Synonym for the template parameter _MatrixType."). EigenvectorsType ---------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[EigenvectorsType](classeigen_1_1generalizedeigensolver#afffec018dbb2d87b4c09b6acecbb79cd) | Type for matrix of eigenvectors as returned by eigenvectors(). This is a square matrix with entries of type [ComplexScalar](classeigen_1_1generalizedeigensolver#abdec07af91db1345bb4c74066e3d0ea7 "Complex scalar type for MatrixType."). The size is the same as the size of [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247 "Synonym for the template parameter _MatrixType."). Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) | **[Deprecated:](deprecated#_deprecated000015)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 VectorType ---------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47), ColsAtCompileTime, 1, Options & ~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxColsAtCompileTime, 1> [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[VectorType](classeigen_1_1generalizedeigensolver#a5aa3d1390c2b0d455c1c9b8b3101b119) | Type for vector of real scalar values eigenvalues as returned by [betas()](classeigen_1_1generalizedeigensolver#abeaa6f56cee367b83fd09d428462ca0c). This is a column vector with entries of type [Scalar](classeigen_1_1generalizedeigensolver#afb318d0b097ff8dd5a7410d31317ca47 "Scalar type for matrices of type MatrixType."). The length of the vector is the size of [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247 "Synonym for the template parameter _MatrixType."). GeneralizedEigenSolver() [1/3] ------------------------------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver) | ( | | ) | | | inline | Default constructor. The default constructor is useful in cases in which the user intends to perform decompositions via EigenSolver::compute(const MatrixType&, bool). See also [compute()](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c "Computes generalized eigendecomposition of given matrix.") for an example. GeneralizedEigenSolver() [2/3] ------------------------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver) | ( | [Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) | *size* | ) | | | inlineexplicit | Default constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem *size*. See also [GeneralizedEigenSolver()](classeigen_1_1generalizedeigensolver#ae745f39da43f9df192cc2875d82b4cf1 "Default constructor.") GeneralizedEigenSolver() [3/3] ------------------------------ template<typename \_MatrixType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::[GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver) | ( | const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) & | *A*, | | | | const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) & | *B*, | | | | bool | *computeEigenvectors* = `true` | | | ) | | | | inline | Constructor; computes the generalized eigendecomposition of given matrix pair. Parameters | | | | | --- | --- | --- | | [in] | A | Square matrix whose eigendecomposition is to be computed. | | [in] | B | Square matrix whose eigendecomposition is to be computed. | | [in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. | This constructor calls [compute()](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c "Computes generalized eigendecomposition of given matrix.") to compute the generalized eigenvalues and eigenvectors. See also [compute()](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c "Computes generalized eigendecomposition of given matrix.") alphas() -------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComplexVectorType](classeigen_1_1generalizedeigensolver#acfd144329aca76882069da2fc5d53ef5) [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::alphas | ( | | ) | const | | inline | Returns A const reference to the vectors containing the alpha values This vector permits to reconstruct the j-th eigenvalues as alphas(i)/betas(j). See also [betas()](classeigen_1_1generalizedeigensolver#abeaa6f56cee367b83fd09d428462ca0c), [eigenvalues()](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58 "Returns an expression of the computed generalized eigenvalues.") betas() ------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [VectorType](classeigen_1_1generalizedeigensolver#a5aa3d1390c2b0d455c1c9b8b3101b119) [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::betas | ( | | ) | const | | inline | Returns A const reference to the vectors containing the beta values This vector permits to reconstruct the j-th eigenvalues as alphas(i)/betas(j). See also [alphas()](classeigen_1_1generalizedeigensolver#a82b1bc41267f46e5c5899d5b084a73bb), [eigenvalues()](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58 "Returns an expression of the computed generalized eigenvalues.") compute() --------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) > & [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) >::compute | ( | const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) & | *A*, | | | | const [MatrixType](classeigen_1_1generalizedeigensolver#a56f4b9823bb9a267de3aaf48428cd247) & | *B*, | | | | bool | *computeEigenvectors* = `true` | | | ) | | | Computes generalized eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | A | Square matrix whose eigendecomposition is to be computed. | | [in] | B | Square matrix whose eigendecomposition is to be computed. | | [in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. | Returns Reference to `*this` This function computes the eigenvalues of the real matrix `matrix`. The [eigenvalues()](classeigen_1_1generalizedeigensolver#a62f01cd78271efd5e39bcb24e0fe1a58 "Returns an expression of the computed generalized eigenvalues.") function can be used to retrieve them. If `computeEigenvectors` is true, then the eigenvectors are also computed and can be retrieved by calling eigenvectors(). The matrix is first reduced to real generalized Schur form using the [RealQZ](classeigen_1_1realqz "Performs a real QZ decomposition of a pair of square matrices.") class. The generalized Schur decomposition is then used to compute the eigenvalues and eigenvectors. The cost of the computation is dominated by the cost of the generalized Schur decomposition. This method reuses of the allocated data in the [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver "Computes the generalized eigenvalues and eigenvectors of a pair of general matrices.") object. eigenvalues() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [EigenvalueType](classeigen_1_1generalizedeigensolver#ad59af178acc401f1bc4e330ef80f286d) [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::eigenvalues | ( | | ) | const | | inline | Returns an expression of the computed generalized eigenvalues. Returns An expression of the column vector containing the eigenvalues. It is a shortcut for ``` this->[alphas](classeigen_1_1generalizedeigensolver#a82b1bc41267f46e5c5899d5b084a73bb)().cwiseQuotient(this->[betas](classeigen_1_1generalizedeigensolver#abeaa6f56cee367b83fd09d428462ca0c)()); ``` Not that betas might contain zeros. It is therefore not recommended to use this function, but rather directly deal with the alphas and betas vectors. Precondition Either the constructor [GeneralizedEigenSolver(const MatrixType&,const MatrixType&,bool)](classeigen_1_1generalizedeigensolver#a2a3528cbf75f66d3a60af9dc7b12ff65 "Constructor; computes the generalized eigendecomposition of given matrix pair.") or the member function [compute(const MatrixType&,const MatrixType&,bool)](classeigen_1_1generalizedeigensolver#a275910b47dfe5f40211dcb59cfd68f3c "Computes generalized eigendecomposition of given matrix.") has been called before. The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are not sorted in any particular order. See also [alphas()](classeigen_1_1generalizedeigensolver#a82b1bc41267f46e5c5899d5b084a73bb), [betas()](classeigen_1_1generalizedeigensolver#abeaa6f56cee367b83fd09d428462ca0c), eigenvectors() setMaxIterations() ------------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)& [Eigen::GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver)< \_MatrixType >::setMaxIterations | ( | [Index](classeigen_1_1generalizedeigensolver#a46a0ff3841059479ec314e56a5645302) | *maxIters* | ) | | | inline | Sets the maximal number of iterations allowed. --- The documentation for this class was generated from the following file:* [GeneralizedEigenSolver.h](https://eigen.tuxfamily.org/dox/GeneralizedEigenSolver_8h_source.html)
programming_docs
eigen3 Eigen::symbolic Eigen::symbolic =============== | | | --- | | | | class | [BaseExpr](classeigen_1_1symbolic_1_1baseexpr) | | | | class | [SymbolExpr](classeigen_1_1symbolic_1_1symbolexpr) | | | | class | [SymbolValue](classeigen_1_1symbolic_1_1symbolvalue) | | | This namespace defines a set of classes and functions to build and evaluate symbolic expressions of scalar type Index. Here is a simple example: ``` // First step, defines symbols: struct x_tag {}; static const symbolic::SymbolExpr<x_tag> x; struct y_tag {}; static const symbolic::SymbolExpr<y_tag> y; struct z_tag {}; static const symbolic::SymbolExpr<z_tag> z; // Defines an expression: auto expr = (x+3)/y+z; // And evaluate it: (c++14) std::cout << expr.eval(x=6,y=3,z=-13) << "\n"; // In c++98/11, only one symbol per expression is supported for now: auto expr98 = (3-x)/2; std::cout << expr98.eval(x=6) << "\n"; ``` It is currently only used internally to define and manipulate the [Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee) and [Eigen::lastp1](group__core__module#ga662ffa801d746b972453080c648765f9) symbols in [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) and [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda). eigen3 Extending/Customizing Eigen Extending/Customizing Eigen =========================== Eigen can be extended in several ways, for instance, by defining global methods, by inserting custom methods within main Eigen's classes through the [plugin](topiccustomizing_plugins) mechanism, by adding support to [custom scalar types](topiccustomizing_customscalar) etc. See below for the respective sub-topics. * [Extending MatrixBase (and other classes)](topiccustomizing_plugins) * [Inheriting from Matrix](topiccustomizing_inheritingmatrix) * [Using custom scalar types](topiccustomizing_customscalar) * [Matrix manipulation via nullary-expressions](topiccustomizing_nullaryexpr) * [Adding a new expression type](topicnewexpressiontype) See also [Preprocessor directives](topicpreprocessordirectives) eigen3 Eigen::Inverse Eigen::Inverse ============== ### template<typename XprType> class Eigen::Inverse< XprType > Expression of the inverse of another expression. Template Parameters | | | | --- | --- | | XprType | the type of the expression we are taking the inverse | This class represents an abstract expression of A.inverse() and most of the time this is the only way it is used. Inherits Eigen::InverseImpl< XprType, internal::traits< XprType >::StorageKind >. --- The documentation for this class was generated from the following file:* [Inverse.h](https://eigen.tuxfamily.org/dox/Inverse_8h_source.html) eigen3 Fixed-size vectorizable Eigen objects Fixed-size vectorizable Eigen objects ===================================== The goal of this page is to explain what we mean by "fixed-size vectorizable". Executive Summary =================== An [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") object is called "fixed-size vectorizable" if it has fixed size and that size is a multiple of 16 bytes. Examples include: * Eigen::Vector2d * Eigen::Vector4d * Eigen::Vector4f * Eigen::Matrix2d * Eigen::Matrix2f * Eigen::Matrix4d * Eigen::Matrix4f * Eigen::Affine3d * Eigen::Affine3f * [Eigen::Quaterniond](group__geometry__module#ga5daab8e66aa480465000308455578830) * [Eigen::Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b) Explanation ============= First, "fixed-size" should be clear: an Eigen object has fixed size if its number of rows and its number of columns are fixed at compile-time. So for example Matrix3f has fixed size, but MatrixXf doesn't (the opposite of fixed-size is dynamic-size). The array of coefficients of a fixed-size Eigen object is a plain "static array", it is not dynamically allocated. For example, the data behind a Matrix4f is just a "float array[16]". Fixed-size objects are typically very small, which means that we want to handle them with zero runtime overhead – both in terms of memory usage and of speed. Now, vectorization works with 128-bit packets (e.g., SSE, AltiVec, NEON), 256-bit packets (e.g., AVX), or 512-bit packets (e.g., AVX512). Moreover, for performance reasons, these packets are most efficiently read and written if they have the same alignment as the packet size, that is 16 bytes, 32 bytes, and 64 bytes respectively. So it turns out that the best way that fixed-size Eigen objects can be vectorized, is if their size is a multiple of 16 bytes (or more). Eigen will then request 16-byte alignment (or more) for these objects, and henceforth rely on these objects being aligned to achieve maximal efficiency. eigen3 Eigen::Reverse Eigen::Reverse ============== ### template<typename MatrixType, int Direction> class Eigen::Reverse< MatrixType, Direction > Expression of the reverse of a vector or matrix. Template Parameters | | | | --- | --- | | MatrixType | the type of the object of which we are taking the reverse | | Direction | defines the direction of the reverse operation, can be Vertical, Horizontal, or BothDirections | This class represents an expression of the reverse of a vector. It is the return type of [MatrixBase::reverse()](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) and [VectorwiseOp::reverse()](classeigen_1_1vectorwiseop#ab8caf5367e2bd636536c8a0e0c89fe15) and most of the time this is the only way it is used. See also [MatrixBase::reverse()](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f), [VectorwiseOp::reverse()](classeigen_1_1vectorwiseop#ab8caf5367e2bd636536c8a0e0c89fe15) Inherits internal::dense\_xpr\_base::type. --- The documentation for this class was generated from the following file:* [Reverse.h](https://eigen.tuxfamily.org/dox/Reverse_8h_source.html) eigen3 Inheriting from Matrix Inheriting from Matrix ====================== Before inheriting from [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), be really, I mean REALLY, sure that using EIGEN\_MATRIX\_PLUGIN is not what you really want (see previous section). If you just need to add few members to [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), this is the way to go. An example of when you actually need to inherit [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), is when you have several layers of heritage such as MyVerySpecificVector1, MyVerySpecificVector2 -> MyVector1 -> [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") and MyVerySpecificVector3, MyVerySpecificVector4 -> MyVector2 -> [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). In order for your object to work within the Eigen framework, you need to define a few members in your inherited class. Here is a minimalistic example: ``` #include <Eigen/Core> #include <iostream> class MyVectorType : public [Eigen::VectorXd](classeigen_1_1matrix) { public: MyVectorType(void):[Eigen](namespaceeigen)::VectorXd() {} // This constructor allows you to construct MyVectorType from Eigen expressions template<typename OtherDerived> MyVectorType(const [Eigen::MatrixBase<OtherDerived>](classeigen_1_1matrixbase)& other) : [Eigen](namespaceeigen)::VectorXd(other) { } // This method allows you to assign Eigen expressions to MyVectorType template<typename OtherDerived> MyVectorType& operator=(const [Eigen::MatrixBase <OtherDerived>](classeigen_1_1matrixbase)& other) { this->[Eigen::VectorXd::operator=](classeigen_1_1matrix#a0b287f226563b8410312bd474b2a1ccc)(other); return *this; } }; int main() { MyVectorType v = MyVectorType::Ones(4); v(2) += 10; v = 2 * v; std::cout << v.transpose() << std::endl; } ``` Output: ``` 2 2 22 2 ``` This is the kind of error you can get if you don't provide those methods ``` error: no match for ‘operator=’ in ‘v = Eigen::operator*( const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1, 0, -0x000000001, 1> >::Scalar&, const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType&) (((const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType&) ((const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType*)(& v))))’ ``` eigen3 Block operations Block operations ================ This page explains the essentials of block operations. A block is a rectangular part of a matrix or array. Blocks expressions can be used both as rvalues and as lvalues. As usual with [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") expressions, this abstraction has zero runtime cost provided that you let your compiler optimize. Using block operations ======================== The most general block operation in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") is called [.block()](group__tutorialblockoperations) . There are two versions, whose syntax is as follows: | **Block** **operation** | Version constructing a dynamic-size block expression | Version constructing a fixed-size block expression | | --- | --- | --- | | Block of size `(p,q)`, starting at `(i,j)` | ``` matrix.block(i,j,p,q); ``` | ``` matrix.block<p,q>(i,j); ``` | As always in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), indices start at 0. Both versions can be used on fixed-size and dynamic-size matrices and arrays. These two expressions are semantically equivalent. The only difference is that the fixed-size version will typically give you faster code if the block size is small, but requires this size to be known at compile time. The following program uses the dynamic-size and fixed-size versions to print the values of several blocks inside a matrix. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; int main() { [Eigen::MatrixXf](classeigen_1_1matrix) m(4,4); m << 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16; cout << "Block in the middle" << endl; cout << m.block<2,2>(1,1) << endl << endl; for (int i = 1; i <= 3; ++i) { cout << "Block of size " << i << "x" << i << endl; cout << m.block(0,0,i,i) << endl << endl; } } ``` | ``` Block in the middle 6 7 10 11 Block of size 1x1 1 Block of size 2x2 1 2 5 6 Block of size 3x3 1 2 3 5 6 7 9 10 11 ``` | In the above example the [.block()](group__tutorialblockoperations) function was employed as a *rvalue*, i.e. it was only read from. However, blocks can also be used as *lvalues*, meaning that you can assign to a block. This is illustrated in the following example. This example also demonstrates blocks in arrays, which works exactly like the above-demonstrated blocks in matrices. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; using namespace [Eigen](namespaceeigen); int main() { Array22f m; m << 1,2, 3,4; Array44f a = [Array44f::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)(0.6); cout << "Here is the array a:" << endl << a << endl << endl; a.block<2,2>(1,1) = m; cout << "Here is now a with m copied into its central 2x2 block:" << endl << a << endl << endl; a.block(0,0,2,3) = a.block(2,1,2,3); cout << "Here is now a with bottom-right 2x3 block copied into top-left 2x3 block:" << endl << a << endl << endl; } ``` | ``` Here is the array a: 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 Here is now a with m copied into its central 2x2 block: 0.6 0.6 0.6 0.6 0.6 1 2 0.6 0.6 3 4 0.6 0.6 0.6 0.6 0.6 Here is now a with bottom-right 2x3 block copied into top-left 2x3 block: 3 4 0.6 0.6 0.6 0.6 0.6 0.6 0.6 3 4 0.6 0.6 0.6 0.6 0.6 ``` | While the [.block()](group__tutorialblockoperations) method can be used for any block operation, there are other methods for special cases, providing more specialized API and/or better performance. On the topic of performance, all what matters is that you give [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") as much information as possible at compile time. For example, if your block is a single whole column in a matrix, using the specialized [.col()](group__tutorialblockoperations) function described below lets [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") know that, which can give it optimization opportunities. The rest of this page describes these specialized methods. Columns and rows ================== Individual columns and rows are special cases of blocks. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") provides methods to easily address them: [.col()](group__tutorialblockoperations) and [.row()](group__tutorialblockoperations). | Block operation | Method | | --- | --- | | ith row [\*](group__tutorialblockoperations) | ``` matrix.row(i); ``` | | jth column [\*](group__tutorialblockoperations) | ``` matrix.col(j); ``` | The argument for `col()` and `row()` is the index of the column or row to be accessed. As always in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), indices start at 0. | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; int main() { [Eigen::MatrixXf](classeigen_1_1matrix) m(3,3); m << 1,2,3, 4,5,6, 7,8,9; cout << "Here is the matrix m:" << endl << m << endl; cout << "2nd Row: " << m.row(1) << endl; m.col(2) += 3 * m.col(0); cout << "After adding 3 times the first column into the third column, the matrix m is:\n"; cout << m << endl; } ``` | ``` Here is the matrix m: 1 2 3 4 5 6 7 8 9 2nd Row: 4 5 6 After adding 3 times the first column into the third column, the matrix m is: 1 2 6 4 5 18 7 8 30 ``` | That example also demonstrates that block expressions (here columns) can be used in arithmetic like any other expression. Corner-related operations =========================== [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") also provides special methods for blocks that are flushed against one of the corners or sides of a matrix or array. For instance, [.topLeftCorner()](group__tutorialblockoperations) can be used to refer to a block in the top-left corner of a matrix. The different possibilities are summarized in the following table: | Block **operation** | Version constructing a dynamic-size block expression | Version constructing a fixed-size block expression | | --- | --- | --- | | Top-left p by q block [\*](group__tutorialblockoperations) | ``` matrix.topLeftCorner(p,q); ``` | ``` matrix.topLeftCorner<p,q>(); ``` | | Bottom-left p by q block [\*](group__tutorialblockoperations) | ``` matrix.bottomLeftCorner(p,q); ``` | ``` matrix.bottomLeftCorner<p,q>(); ``` | | Top-right p by q block [\*](group__tutorialblockoperations) | ``` matrix.topRightCorner(p,q); ``` | ``` matrix.topRightCorner<p,q>(); ``` | | Bottom-right p by q block [\*](group__tutorialblockoperations) | ``` matrix.bottomRightCorner(p,q); ``` | ``` matrix.bottomRightCorner<p,q>(); ``` | | Block containing the first q rows [\*](group__tutorialblockoperations) | ``` matrix.topRows(q); ``` | ``` matrix.topRows<q>(); ``` | | Block containing the last q rows [\*](group__tutorialblockoperations) | ``` matrix.bottomRows(q); ``` | ``` matrix.bottomRows<q>(); ``` | | Block containing the first p columns [\*](group__tutorialblockoperations) | ``` matrix.leftCols(p); ``` | ``` matrix.leftCols<p>(); ``` | | Block containing the last q columns [\*](group__tutorialblockoperations) | ``` matrix.rightCols(q); ``` | ``` matrix.rightCols<q>(); ``` | | Block containing the q columns starting from i [\*](group__tutorialblockoperations) | ``` matrix.middleCols(i,q); ``` | ``` matrix.middleCols<q>(i); ``` | | Block containing the q rows starting from i [\*](group__tutorialblockoperations) | ``` matrix.middleRows(i,q); ``` | ``` matrix.middleRows<q>(i); ``` | Here is a simple example illustrating the use of the operations presented above: | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; int main() { [Eigen::Matrix4f](classeigen_1_1matrix) m; m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12, 13,14,15,16; cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl; cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << endl; m.topLeftCorner(1,3) = m.bottomRightCorner(3,1).[transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c)(); cout << "After assignment, m = " << endl << m << endl; } ``` | ``` m.leftCols(2) = 1 2 5 6 9 10 13 14 m.bottomRows<2>() = 9 10 11 12 13 14 15 16 After assignment, m = 8 12 16 4 5 6 7 8 9 10 11 12 13 14 15 16 ``` | Block operations for vectors ============================== [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") also provides a set of block operations designed specifically for the special case of vectors and one-dimensional arrays: | Block operation | Version constructing a dynamic-size block expression | Version constructing a fixed-size block expression | | --- | --- | --- | | Block containing the first `n` elements [\*](group__tutorialblockoperations) | ``` vector.head(n); ``` | ``` vector.head<n>(); ``` | | Block containing the last `n` elements [\*](group__tutorialblockoperations) | ``` vector.tail(n); ``` | ``` vector.tail<n>(); ``` | | Block containing `n` elements, starting at position `i` [\*](group__tutorialblockoperations) | ``` vector.segment(i,n); ``` | ``` vector.segment<n>(i); ``` | An example is presented below: | Example: | Output: | | --- | --- | | ``` #include <Eigen/Dense> #include <iostream> using namespace std; int main() { [Eigen::ArrayXf](classeigen_1_1array) v(6); v << 1, 2, 3, 4, 5, 6; cout << "v.head(3) =" << endl << v.head(3) << endl << endl; cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl; v.segment(1,4) *= 2; cout << "after 'v.segment(1,4) \*= 2', v =" << endl << v << endl; } ``` | ``` v.head(3) = 1 2 3 v.tail<3>() = 4 5 6 after 'v.segment(1,4) *= 2', v = 1 4 6 8 10 6 ``` | eigen3 Eigen::SparseMapBase Eigen::SparseMapBase ==================== ### template<typename Derived> class Eigen::SparseMapBase< Derived, WriteAccessors > Common base class for writable [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") instance of sparse matrix and vector. class SparseMapBase | | | --- | | | | Scalar & | [coeffRef](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#aa9c42d48b9dd6f947ce3c257fe4bf2ca) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | StorageIndex \* | [innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af5cd1f13dde8578eb9891a4ac4a11977) () | | | | StorageIndex \* | [innerNonZeroPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af877ea4e285a4497f80987fea66f7459) () | | | | StorageIndex \* | [outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a3b74af754254837fc591cd9936688b95) () | | | | Scalar \* | [valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af91648a18729ae8ff29cb1d8751c5655) () | | | | | [~SparseMapBase](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a4dfbcf3ac411885b1710ad04892c984d) () | | | | Public Member Functions inherited from [Eigen::SparseMapBase< Derived, ReadOnlyAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4) | | Scalar | [coeff](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a195e66f79171f78cc22d91fff37e36e3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0fc44f3781a869a3a410edd6691fd899) () const | | | | const StorageIndex \* | [innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#ab044564756f472877b2c1a5706e540e2) () const | | | | const StorageIndex \* | [innerNonZeroPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a2b35a1d701d6c6ea36b2d9f19660a68c) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0df6dba8d71e0fb15b2995510853f83e) () const | | | | bool | [isCompressed](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#aafab4afa7ab2ff89eff049d4c71e2ce4) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a753e975b7b3643d821dc061141786870) () const | | | | const StorageIndex \* | [outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a24c55dd8de4aca30e7c90b69aa5dca6b) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3d6ede19db6d42074ae063bc876231b1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3cdd6cab0abd7ac01925a695fc315d34) () const | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a574ea9371c22eabebdda21c0787312dc) () const | | | | | [~SparseMapBase](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#ab375aedf824909a7f1a6af24ee60d70f) () | | | | Public Member Functions inherited from [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | [Map](classeigen_1_1map)< [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a7cf299e08d2a4f6d6869e631e51b12fe) () | | | | const [Map](classeigen_1_1map)< const [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a101b155485ae59ea1261c4f6040f3dc4) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#aa64818e1aa43015dad01b114b2ab4687) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#a411e972b097e6aef225415a4c2d0a0b5) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#afc056a3895eae1a4c4767252ff04966a) () const | | | | bool | [isCompressed](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsecompressedbase#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a2624d4c2661c582de168246c56e8d71e) () const | | | | Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f44c739398794ea77f310b745cc5627) () const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< Derived >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< Derived, [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)|[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | enum | { [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604) , [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14) , [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) , **MaxRowsAtCompileTime** , **MaxColsAtCompileTime** , **MaxSizeAtCompileTime** , [IsVectorAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a14a3f566ed2a074beddb8aef0223bfdf) , [NumDimensions](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2366131ffcc38bff48a1c7572eb86dd3) , [Flags](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2af043b36fe9e08df0107cf6de496165) , **IsRowMajor** , **InnerSizeAtCompileTime** } | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | | [SparseCompressedBase](classeigen_1_1sparsecompressedbase#af79f020db965367d97eb954fc68d8f99) () | | | ~SparseMapBase() ---------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Eigen::SparseMapBase< Derived, [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) >::~SparseMapBase | ( | | ) | | | inline | Empty destructor coeffRef() ---------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& Eigen::SparseMapBase< Derived, [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) >::coeffRef | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | Returns a non-const reference to the value of the matrix at position *i*, *j* If the element does not exist then it is inserted via the insert(Index,Index) function which itself turns the matrix into a non compressed form if that was not the case. This is a O(log(nnz\_j)) operation (binary search) plus the cost of insert(Index,Index) function if the element does not already exist. innerIndexPtr() --------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | StorageIndex\* Eigen::SparseMapBase< Derived, [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) >::innerIndexPtr | ( | | ) | | | inline | Returns a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af91648a18729ae8ff29cb1d8751c5655), [outerIndexPtr()](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a3b74af754254837fc591cd9936688b95) innerNonZeroPtr() ----------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | StorageIndex\* Eigen::SparseMapBase< Derived, [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) >::innerNonZeroPtr | ( | | ) | | | inline | Returns a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 in compressed mode outerIndexPtr() --------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | StorageIndex\* Eigen::SparseMapBase< Derived, [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) >::outerIndexPtr | ( | | ) | | | inline | Returns a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af91648a18729ae8ff29cb1d8751c5655), [innerIndexPtr()](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af5cd1f13dde8578eb9891a4ac4a11977) valuePtr() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar\* Eigen::SparseMapBase< Derived, [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) >::valuePtr | ( | | ) | | | inline | Returns a const pointer to the array of values. This function is aimed at interoperability with other libraries. See also [innerIndexPtr()](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af5cd1f13dde8578eb9891a4ac4a11977), [outerIndexPtr()](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a3b74af754254837fc591cd9936688b95) --- The documentation for this class was generated from the following file:* [SparseMap.h](https://eigen.tuxfamily.org/dox/SparseMap_8h_source.html)
programming_docs
eigen3 Eigen::FullPivHouseholderQR Eigen::FullPivHouseholderQR =========================== ### template<typename \_MatrixType> class Eigen::FullPivHouseholderQR< \_MatrixType > Householder rank-revealing QR decomposition of a matrix with full pivoting. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the QR decomposition | This class performs a rank-revealing QR decomposition of a matrix **A** into matrices **P**, **P'**, **Q** and **R** such that \[ \mathbf{P} \, \mathbf{A} \, \mathbf{P}' = \mathbf{Q} \, \mathbf{R} \] by using Householder transformations. Here, **P** and **P'** are permutation matrices, **Q** a unitary matrix and **R** an upper triangular matrix. This decomposition performs a very prudent full pivoting in order to be rank-revealing and achieve optimal numerical stability. The trade-off is that it is slower than [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix.") and [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting."). This class supports the [inplace decomposition](group__inplacedecomposition) mechanism. See also [MatrixBase::fullPivHouseholderQr()](classeigen_1_1matrixbase#a863bc0e06b641a089508eabec6835ab2) | | | --- | | | | MatrixType::RealScalar | [absDeterminant](classeigen_1_1fullpivhouseholderqr#a1029e1ccc70bb8669043c5775e7f3b75) () const | | | | const [PermutationType](classeigen_1_1permutationmatrix) & | [colsPermutation](classeigen_1_1fullpivhouseholderqr#abeda6d91e196c13d4dd8b7542fef3e17) () const | | | | template<typename InputType > | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< MatrixType > & | [compute](classeigen_1_1fullpivhouseholderqr#a3745d70b826c12d33b8d34f26a5c96e7) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [dimensionOfKernel](classeigen_1_1fullpivhouseholderqr#a3b5fe5edc66acc01c45b16e728470aa0) () const | | | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr#aeb14b4c1eef33128207b40a00bd0bd08) () | | | Default Constructor. [More...](classeigen_1_1fullpivhouseholderqr#aeb14b4c1eef33128207b40a00bd0bd08) | | | | template<typename InputType > | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr#aeeace3abca6b215025e94c3e098b0a97) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Constructs a QR factorization from a given matrix. [More...](classeigen_1_1fullpivhouseholderqr#aeeace3abca6b215025e94c3e098b0a97) | | | | template<typename InputType > | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr#ac9bdb4f7fa77c1aa16f238592c248e70) ([EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Constructs a QR factorization from a given matrix. [More...](classeigen_1_1fullpivhouseholderqr#ac9bdb4f7fa77c1aa16f238592c248e70) | | | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr#abf722e1dc7241a5d6f76460ef0c87821) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | Default Constructor with memory preallocation. [More...](classeigen_1_1fullpivhouseholderqr#abf722e1dc7241a5d6f76460ef0c87821) | | | | const HCoeffsType & | [hCoeffs](classeigen_1_1fullpivhouseholderqr#a874fcd822871010f7961d9e94f1767e4) () const | | | | const [Inverse](classeigen_1_1inverse)< [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) > | [inverse](classeigen_1_1fullpivhouseholderqr#a352ce66397af06da214ddde343cec6f5) () const | | | | bool | [isInjective](classeigen_1_1fullpivhouseholderqr#a6776788011026b0f63192485a59deaed) () const | | | | bool | [isInvertible](classeigen_1_1fullpivhouseholderqr#aeb1d779ec22ec68a5a28d4235db02ec1) () const | | | | bool | [isSurjective](classeigen_1_1fullpivhouseholderqr#aa3593db4708ce9079b0bdf219b99f57e) () const | | | | MatrixType::RealScalar | [logAbsDeterminant](classeigen_1_1fullpivhouseholderqr#aafde38918912c9b562f44b0fc3b22589) () const | | | | MatrixQReturnType | [matrixQ](classeigen_1_1fullpivhouseholderqr#ad26dd2d3c002939771d2375e4e051c28) (void) const | | | | const MatrixType & | [matrixQR](classeigen_1_1fullpivhouseholderqr#a9c16411e5d8f1fc634a5797018d5aa3e) () const | | | | RealScalar | [maxPivot](classeigen_1_1fullpivhouseholderqr#a7887506237a3bf912aebc9aaa8edacec) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonzeroPivots](classeigen_1_1fullpivhouseholderqr#af1e4d04824084a964c1a6e51db68376f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rank](classeigen_1_1fullpivhouseholderqr#aeae555220f46477818ccc94aca2de770) () const | | | | const [IntDiagSizeVectorType](classeigen_1_1matrix) & | [rowsTranspositions](classeigen_1_1fullpivhouseholderqr#abebbfc0ca6e3dd285a0ad0c907abb093) () const | | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) & | [setThreshold](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602) (const RealScalar &[threshold](classeigen_1_1fullpivhouseholderqr#af7f6ac15ca19c2b9e45dc3eaae58c201)) | | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) & | [setThreshold](classeigen_1_1fullpivhouseholderqr#aaea4bf3dd145e0cddb16e364cca9d887) (Default\_t) | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr), Rhs > | [solve](classeigen_1_1fullpivhouseholderqr#a6f1b0a116c78e642e3d2a100a29d1a4a) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | RealScalar | [threshold](classeigen_1_1fullpivhouseholderqr#af7f6ac15ca19c2b9e45dc3eaae58c201) () const | | | | Public Member Functions inherited from [Eigen::SolverBase< FullPivHouseholderQR< \_MatrixType > >](classeigen_1_1solverbase) | | AdjointReturnType | [adjoint](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) () const | | | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType > & | [derived](classeigen_1_1solverbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType > & | [derived](classeigen_1_1solverbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | const [Solve](classeigen_1_1solve)< [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >, Rhs > | [solve](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | | [SolverBase](classeigen_1_1solverbase#a4d5e5baddfba3790ab1a5f247dcc4dc1) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | FullPivHouseholderQR() [1/4] ---------------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::[FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) | ( | | ) | | | inline | Default Constructor. The default constructor is useful in cases in which the user intends to perform decompositions via FullPivHouseholderQR::compute(const MatrixType&). FullPivHouseholderQR() [2/4] ---------------------------- template<typename \_MatrixType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::[FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inline | Default Constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem *size*. See also [FullPivHouseholderQR()](classeigen_1_1fullpivhouseholderqr#aeb14b4c1eef33128207b40a00bd0bd08 "Default Constructor.") FullPivHouseholderQR() [3/4] ---------------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::[FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inlineexplicit | Constructs a QR factorization from a given matrix. This constructor computes the QR factorization of the matrix *matrix* by calling the method compute(). It is a short cut for: ``` FullPivHouseholderQR<MatrixType> qr(matrix.rows(), matrix.cols()); qr.compute(matrix); ``` See also compute() FullPivHouseholderQR() [4/4] ---------------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::[FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) | ( | [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inlineexplicit | Constructs a QR factorization from a given matrix. This overloaded constructor is provided for [inplace decomposition](group__inplacedecomposition) when `MatrixType` is a [Eigen::Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression."). See also FullPivHouseholderQR(const EigenBase&) absDeterminant() ---------------- template<typename MatrixType > | | | --- | | MatrixType::RealScalar [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< MatrixType >::absDeterminant | Returns the absolute value of the determinant of the matrix of which \*this is the QR decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the QR decomposition has already been computed. Note This is only for square matrices. Warning a determinant can be very big or small, so for matrices of large enough dimension, there is a risk of overflow/underflow. One way to work around that is to use [logAbsDeterminant()](classeigen_1_1fullpivhouseholderqr#aafde38918912c9b562f44b0fc3b22589) instead. See also [logAbsDeterminant()](classeigen_1_1fullpivhouseholderqr#aafde38918912c9b562f44b0fc3b22589), [MatrixBase::determinant()](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) colsPermutation() ----------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [PermutationType](classeigen_1_1permutationmatrix)& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::colsPermutation | ( | | ) | const | | inline | Returns a const reference to the column permutation matrix compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)<MatrixType>& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | Performs the QR factorization of the given matrix *matrix*. The result of the factorization is stored into `*this`, and a reference to `*this` is returned. See also class [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting."), FullPivHouseholderQR(const MatrixType&) dimensionOfKernel() ------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::dimensionOfKernel | ( | | ) | const | | inline | Returns the dimension of the kernel of the matrix of which \*this is the QR decomposition. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). hCoeffs() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const HCoeffsType& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::hCoeffs | ( | | ) | const | | inline | Returns a const reference to the vector of Householder coefficients used to represent the factor `Q`. For advanced uses only. inverse() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Inverse](classeigen_1_1inverse)<[FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)> [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::inverse | ( | | ) | const | | inline | Returns the inverse of the matrix of which \*this is the QR decomposition. Note If this matrix is not invertible, the returned matrix has undefined coefficients. Use [isInvertible()](classeigen_1_1fullpivhouseholderqr#aeb1d779ec22ec68a5a28d4235db02ec1) to first determine whether this matrix is invertible. isInjective() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::isInjective | ( | | ) | const | | inline | Returns true if the matrix of which \*this is the QR decomposition represents an injective linear map, i.e. has trivial kernel; false otherwise. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). isInvertible() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::isInvertible | ( | | ) | const | | inline | Returns true if the matrix of which \*this is the QR decomposition is invertible. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). isSurjective() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::isSurjective | ( | | ) | const | | inline | Returns true if the matrix of which \*this is the QR decomposition represents a surjective linear map; false otherwise. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). logAbsDeterminant() ------------------- template<typename MatrixType > | | | --- | | MatrixType::RealScalar [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< MatrixType >::logAbsDeterminant | Returns the natural log of the absolute value of the determinant of the matrix of which \*this is the QR decomposition. It has only linear complexity (that is, O(n) where n is the dimension of the square matrix) as the QR decomposition has already been computed. Note This is only for square matrices. This method is useful to work around the risk of overflow/underflow that's inherent to determinant computation. See also [absDeterminant()](classeigen_1_1fullpivhouseholderqr#a1029e1ccc70bb8669043c5775e7f3b75), [MatrixBase::determinant()](classeigen_1_1matrixbase#a7ad8f77004bb956b603bb43fd2e3c061) matrixQ() --------- template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< MatrixType >::MatrixQReturnType [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< MatrixType >::matrixQ | ( | void | | ) | const | | inline | Returns Expression object representing the matrix Q matrixQR() ---------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::matrixQR | ( | | ) | const | | inline | Returns a reference to the matrix where the Householder QR decomposition is stored maxPivot() ---------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::maxPivot | ( | | ) | const | | inline | Returns the absolute value of the biggest pivot, i.e. the biggest diagonal coefficient of U. nonzeroPivots() --------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::nonzeroPivots | ( | | ) | const | | inline | Returns the number of nonzero pivots in the QR decomposition. Here nonzero is meant in the exact sense, not in a fuzzy sense. So that notion isn't really intrinsically interesting, but it is still useful when implementing algorithms. See also [rank()](classeigen_1_1fullpivhouseholderqr#aeae555220f46477818ccc94aca2de770) rank() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::rank | ( | | ) | const | | inline | Returns the rank of the matrix of which \*this is the QR decomposition. Note This method has to determine which pivots should be considered nonzero. For that, it uses the threshold value that you can control by calling [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). rowsTranspositions() -------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [IntDiagSizeVectorType](classeigen_1_1matrix)& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::rowsTranspositions | ( | | ) | const | | inline | Returns a const reference to the vector of indices representing the rows transpositions setThreshold() [1/2] -------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::setThreshold | ( | const RealScalar & | *threshold* | ) | | | inline | Allows to prescribe a threshold to be used by certain methods, such as [rank()](classeigen_1_1fullpivhouseholderqr#aeae555220f46477818ccc94aca2de770), who need to determine when pivots are to be considered nonzero. This is not used for the QR decomposition itself. When it needs to get the threshold value, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") calls [threshold()](classeigen_1_1fullpivhouseholderqr#af7f6ac15ca19c2b9e45dc3eaae58c201). By default, this uses a formula to automatically determine a reasonable threshold. Once you have called the present method [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602), your value is used instead. Parameters | | | | --- | --- | | threshold | The new value to use as the threshold. | A pivot will be considered nonzero if its absolute value is strictly greater than \( \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \) where maxpivot is the biggest pivot. If you want to come back to the default behavior, call [setThreshold(Default\_t)](classeigen_1_1fullpivhouseholderqr#aaea4bf3dd145e0cddb16e364cca9d887) setThreshold() [2/2] -------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)& [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::setThreshold | ( | Default\_t | | ) | | | inline | Allows to come back to the default behavior, letting [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") use its default formula for determining the threshold. You should pass the special object Eigen::Default as parameter here. ``` qr.setThreshold(Eigen::Default); ``` See the documentation of [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). solve() ------- template<typename \_MatrixType > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<[FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr), Rhs> [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *b* | ) | const | | inline | This method finds a solution x to the equation Ax=b, where A is the matrix of which `*this` is the QR decomposition. Parameters | | | | --- | --- | | b | the right-hand-side of the equation to solve. | Returns the exact or least-square solution if the rank is greater or equal to the number of columns of A, and an arbitrary solution otherwise. This method just tries to find as good a solution as possible. If you want to check whether a solution exists or if it is accurate, just call this function to get a result and then compute the error of this result, or use [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) directly, for instance like this: ``` bool a_solution_exists = (A*result).isApprox(b, precision); ``` This method avoids dividing by zero, so that the non-existence of a solution doesn't by itself mean that you'll get `inf` or `nan` values. If there exists more than one solution, this method will arbitrarily choose one. Example: ``` Matrix3f m = [Matrix3f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); Matrix3f y = [Matrix3f::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix3f x; x = m.fullPivHouseholderQr().solve(y); assert(y.isApprox(m*x)); cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; ``` Output: ``` Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Here is the matrix y: 0.108 -0.27 0.832 -0.0452 0.0268 0.271 0.258 0.904 0.435 Here is a solution x to the equation mx=y: 0.609 2.68 1.67 -0.231 -1.57 0.0713 0.51 3.51 1.05 ``` threshold() ----------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr)< \_MatrixType >::threshold | ( | | ) | const | | inline | Returns the threshold that will be used by certain methods such as [rank()](classeigen_1_1fullpivhouseholderqr#aeae555220f46477818ccc94aca2de770). See the documentation of [setThreshold(const RealScalar&)](classeigen_1_1fullpivhouseholderqr#a92277e572bf98245891015d12dd2b602). --- The documentation for this class was generated from the following file:* [FullPivHouseholderQR.h](https://eigen.tuxfamily.org/dox/FullPivHouseholderQR_8h_source.html)
programming_docs
eigen3 Eigen::Translation Eigen::Translation ================== ### template<typename \_Scalar, int \_Dim> class Eigen::Translation< \_Scalar, \_Dim > Represents a translation transformation. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the coefficients. | | \_Dim | the dimension of the space, can be a compile time value or Dynamic | Note This class is not aimed to be used to store a translation transformation, but rather to make easier the constructions and updates of [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") objects. See also class [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b), class [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") | | | --- | | | | enum | | | | | typedef [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) > | [AffineTransformType](classeigen_1_1translation#a25c762409320ba9490a0d12c6652bbad) | | | | typedef [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) > | [IsometryTransformType](classeigen_1_1translation#ad3ac890d85420ba78e16dab1983d1a80) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, Dim > | [LinearMatrixType](classeigen_1_1translation#ac5aca3bc67564e96ad550aba971de8b6) | | | | typedef \_Scalar | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, 1 > | [VectorType](classeigen_1_1translation#a339e17dfec5394ae563f62cca0df451f) | | | | | | --- | | | | template<typename NewScalarType > | | internal::cast\_return\_type< [Translation](classeigen_1_1translation), [Translation](classeigen_1_1translation)< NewScalarType, Dim > >::type | [cast](classeigen_1_1translation#a6dda00ac348f3061cd501f2822d0e534) () const | | | | [Translation](classeigen_1_1translation) | [inverse](classeigen_1_1translation#aa72ee6bccce7f26cbef57550308e6aaf) () const | | | | bool | [isApprox](classeigen_1_1translation#a3dfc243795eef9c94bf65f0837f563c8) (const [Translation](classeigen_1_1translation) &other, const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) >::Real &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | [AffineTransformType](classeigen_1_1translation#a25c762409320ba9490a0d12c6652bbad) | [operator\*](classeigen_1_1translation#a2289ae59c8f871d9d9c73ba7eeb035f8) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &linear) const | | | | template<typename Derived > | | internal::enable\_if< Derived::IsVectorAtCompileTime, [VectorType](classeigen_1_1translation#a339e17dfec5394ae563f62cca0df451f) >::type | [operator\*](classeigen_1_1translation#a62a95caa45e0aa178e0b2759c78874b1) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &vec) const | | | | template<typename Derived > | | [IsometryTransformType](classeigen_1_1translation#ad3ac890d85420ba78e16dab1983d1a80) | [operator\*](classeigen_1_1translation#a37840d7fa515418e143593efbd21c6b3) (const [RotationBase](classeigen_1_1rotationbase)< Derived, Dim > &r) const | | | | template<int Mode, int Options> | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, Mode > | [operator\*](classeigen_1_1translation#ac0e625c8d90f899be9c73b77592a003f) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, Mode, Options > &t) const | | | | [Translation](classeigen_1_1translation) | [operator\*](classeigen_1_1translation#aa79f1217e27556e0524260e172a0b081) (const [Translation](classeigen_1_1translation) &other) const | | | | [AffineTransformType](classeigen_1_1translation#a25c762409320ba9490a0d12c6652bbad) | [operator\*](classeigen_1_1translation#a156c8003ff3830756727e805cf98c0ab) (const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) > &other) const | | | | | [Translation](classeigen_1_1translation#a7e74484699e17444c6d660c17117bf7b) () | | | | template<typename OtherScalarType > | | | [Translation](classeigen_1_1translation#a3048c4c2cf095548454aef051af5a036) (const [Translation](classeigen_1_1translation)< OtherScalarType, Dim > &other) | | | | | [Translation](classeigen_1_1translation#aef1fd431ac3f2197a8e33ce6d4163061) (const [VectorType](classeigen_1_1translation#a339e17dfec5394ae563f62cca0df451f) &vector) | | | | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) & | [x](classeigen_1_1translation#afecb7411a94188136c5e08ee3ba6f951) () | | | Returns the x-translation as a reference. | | | | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) | [x](classeigen_1_1translation#a8e30e156676c7be9664e9f09860071dd) () const | | | Returns the x-translation by value. | | | | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) & | [y](classeigen_1_1translation#afebd7c1aec9a5547c50a0ff9a4cb1fe8) () | | | Returns the y-translation as a reference. | | | | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) | [y](classeigen_1_1translation#aa2302dd0093797e913a7f8d58fba8a79) () const | | | Returns the y-translation by value. | | | | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) & | [z](classeigen_1_1translation#a91d0b27ab6a76fc235524bf00f15266c) () | | | Returns the z-translation as a reference. | | | | [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) | [z](classeigen_1_1translation#ac6e9e75f12c67ccd2aa6741a0531af84) () const | | | Returns the z-translation by value. | | | AffineTransformType ------------------- template<typename \_Scalar , int \_Dim> | | | --- | | typedef [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21),Dim,[Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb)> [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[AffineTransformType](classeigen_1_1translation#a25c762409320ba9490a0d12c6652bbad) | corresponding affine transformation type IsometryTransformType --------------------- template<typename \_Scalar , int \_Dim> | | | --- | | typedef [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21),Dim,[Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef)> [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[IsometryTransformType](classeigen_1_1translation#ad3ac890d85420ba78e16dab1983d1a80) | corresponding isometric transformation type LinearMatrixType ---------------- template<typename \_Scalar , int \_Dim> | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21),Dim,Dim> [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[LinearMatrixType](classeigen_1_1translation#ac5aca3bc67564e96ad550aba971de8b6) | corresponding linear transformation matrix type Scalar ------ template<typename \_Scalar , int \_Dim> | | | --- | | typedef \_Scalar [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) | the scalar type of the coefficients VectorType ---------- template<typename \_Scalar , int \_Dim> | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21),Dim,1> [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[VectorType](classeigen_1_1translation#a339e17dfec5394ae563f62cca0df451f) | corresponding vector type anonymous enum -------------- template<typename \_Scalar , int \_Dim> | | | --- | | anonymous enum | dimension of the space Translation() [1/3] ------------------- template<typename \_Scalar , int \_Dim> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[Translation](classeigen_1_1translation) | ( | | ) | | | inline | Default constructor without initialization. Translation() [2/3] ------------------- template<typename \_Scalar , int \_Dim> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[Translation](classeigen_1_1translation) | ( | const [VectorType](classeigen_1_1translation#a339e17dfec5394ae563f62cca0df451f) & | *vector* | ) | | | inlineexplicit | Constructs and initialize the translation transformation from a vector of translation coefficients Translation() [3/3] ------------------- template<typename \_Scalar , int \_Dim> template<typename OtherScalarType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::[Translation](classeigen_1_1translation) | ( | const [Translation](classeigen_1_1translation)< OtherScalarType, Dim > & | *other* | ) | | | inlineexplicit | Copy constructor with scalar type conversion cast() ------ template<typename \_Scalar , int \_Dim> template<typename NewScalarType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::cast\_return\_type<[Translation](classeigen_1_1translation),[Translation](classeigen_1_1translation)<NewScalarType,Dim> >::type [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::cast | ( | | ) | const | | inline | Returns `*this` with scalar type casted to *NewScalarType* Note that if *NewScalarType* is equal to the current scalar type of `*this` then this function smartly returns a const reference to `*this`. inverse() --------- template<typename \_Scalar , int \_Dim> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Translation](classeigen_1_1translation) [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::inverse | ( | | ) | const | | inline | Returns the inverse translation (opposite) isApprox() ---------- template<typename \_Scalar , int \_Dim> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::isApprox | ( | const [Translation](classeigen_1_1translation)< \_Scalar, \_Dim > & | *other*, | | | | const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) >::Real & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21)>::dummy_precision()` | | | ) | | const | | inline | Returns `true` if `*this` is approximately equal to *other*, within the precision determined by *prec*. See also [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) operator\*() [1/6] ------------------ template<typename Scalar , int Dim> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim >::[AffineTransformType](classeigen_1_1translation#a25c762409320ba9490a0d12c6652bbad) [Eigen::Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim >::operator\* | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *linear* | ) | const | | inline | Concatenates a translation and a linear transformation operator\*() [2/6] ------------------ template<typename \_Scalar , int \_Dim> template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | internal::enable\_if<Derived::IsVectorAtCompileTime,[VectorType](classeigen_1_1translation#a339e17dfec5394ae563f62cca0df451f)>::type [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *vec* | ) | const | | inline | Applies translation to vector operator\*() [3/6] ------------------ template<typename \_Scalar , int \_Dim> template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [IsometryTransformType](classeigen_1_1translation#ad3ac890d85420ba78e16dab1983d1a80) [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::operator\* | ( | const [RotationBase](classeigen_1_1rotationbase)< Derived, Dim > & | *r* | ) | const | | inline | Concatenates a translation and a rotation operator\*() [4/6] ------------------ template<typename \_Scalar , int \_Dim> template<int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)<[Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21),Dim,Mode> [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::operator\* | ( | const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim, Mode, Options > & | *t* | ) | const | | inline | Concatenates a translation and a transformation operator\*() [5/6] ------------------ template<typename \_Scalar , int \_Dim> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Translation](classeigen_1_1translation) [Eigen::Translation](classeigen_1_1translation)< \_Scalar, \_Dim >::operator\* | ( | const [Translation](classeigen_1_1translation)< \_Scalar, \_Dim > & | *other* | ) | const | | inline | Concatenates two translation operator\*() [6/6] ------------------ template<typename Scalar , int Dim> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim >::[AffineTransformType](classeigen_1_1translation#a25c762409320ba9490a0d12c6652bbad) [Eigen::Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21), Dim >::operator\* | ( | const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1translation#ad596bf21ced4b902cc242205df486e21) > & | *other* | ) | const | | inline | Concatenates a translation and a uniform scaling --- The documentation for this class was generated from the following file:* [Translation.h](https://eigen.tuxfamily.org/dox/Translation_8h_source.html) eigen3 Eigen::Array Eigen::Array ============ ### template<typename \_Scalar, int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> class Eigen::Array< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > General-purpose arrays with easy API for coefficient-wise operations. The Array class is very similar to the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class. It provides general-purpose one- and two-dimensional arrays. The difference between the Array and the Matrix class is primarily in the API: the API for the Array class provides easy access to coefficient-wise operations, while the API for the Matrix class provides easy access to linear-algebra operations. See documentation of class [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") for detailed information on the template parameters storage layout. This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_ARRAY_PLUGIN`. See also [The Array class and coefficient-wise operations](group__tutorialarrayclass), [The class hierarchy](topicclasshierarchy) | | | --- | | | | | [Array](classeigen_1_1array#ad9f6f2c9890092e12fd3344aa6ffcbd1) () | | | | | [Array](classeigen_1_1array#aa1ef64a2517d538e03b71584369e14bb) (const [Array](classeigen_1_1array) &other) | | | | template<typename OtherDerived > | | | [Array](classeigen_1_1array#a295b8d13170c4512480bc74ef9de4299) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other, typename internal::enable\_if< internal::is\_convertible< typename OtherDerived::Scalar, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), PrivateType >::type=PrivateType()) | | | | template<typename... ArgTypes> | | | [Array](classeigen_1_1array#a3d375f13801bb5db4c3d8eaa5b05aa08) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a1, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a2, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a3, const ArgTypes &... args) | | | | | [Array](classeigen_1_1array#a3b781cdd2aa6fa9421047e6bc29d1bf6) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val1) | | | | | [Array](classeigen_1_1array#ae20df0e99b3a2bcf35f6cf83755a1f80) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val1, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val2) | | | | | [Array](classeigen_1_1array#a00db21a7dd3a6e4df632913204742466) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val1, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val2, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val3) | | | | | [Array](classeigen_1_1array#a60196d3a62e1d19746e011dd1cefdfc5) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | | [Array](classeigen_1_1array#a2c3f6165e88d157195d87c9bc44d9fc0) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | Constructs a fixed-sized array initialized with coefficients starting at *data*. | | | | | [Array](classeigen_1_1array#aa8732ffb15d620d7091e10f963548390) (const std::initializer\_list< std::initializer\_list< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >> &list) | | | Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. [c++11] [More...](classeigen_1_1array#aa8732ffb15d620d7091e10f963548390) | | | | | [Array](classeigen_1_1array#a0b8a25eb8bde16732c95eaad8a8a8b85) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) dim) | | | | | [Array](classeigen_1_1array#a473a6a8fdd69a31312efaf6bdb3fc546) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeff](classeigen_1_1array#ac99d445913f04acc50280ae99dffd9c3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeff](classeigen_1_1array#a954cd075bcd7babb429e3e4b9a418651) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1array#a72e84dc1bb573ad8ecc9109fbbc1b63b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1array#a541526a4f452554785e78bc41287b348) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1array#a992d58b5453e441dcfc80f21c2bfd1d7) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1array#a038a419ccb6e2c55593b27f17626fd62) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) const | | | | [Array](classeigen_1_1array) & | [operator=](classeigen_1_1array#a86cb29d966d548242de713c59e9c9582) (const [Array](classeigen_1_1array) &other) | | | | template<typename OtherDerived > | | [Array](classeigen_1_1array) & | [operator=](classeigen_1_1array#a4bda8f55edb3cb293c6ef3078362455b) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | [Array](classeigen_1_1array) & | [operator=](classeigen_1_1array#a7f91aee7fcdc00e617525189144e94cd) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | [Array](classeigen_1_1array) & | [operator=](classeigen_1_1array#ac32b3b262f92f135766a1b5cf4522b75) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Public Member Functions inherited from [Eigen::PlainObjectBase< Array< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >](classeigen_1_1plainobjectbase) | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeff](classeigen_1_1plainobjectbase#ac99d445913f04acc50280ae99dffd9c3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeff](classeigen_1_1plainobjectbase#a954cd075bcd7babb429e3e4b9a418651) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a72e84dc1bb573ad8ecc9109fbbc1b63b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a541526a4f452554785e78bc41287b348) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a992d58b5453e441dcfc80f21c2bfd1d7) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | [coeffRef](classeigen_1_1plainobjectbase#a038a419ccb6e2c55593b27f17626fd62) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowId, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colId) const | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#a712c25be1652e5a64a00f28c8ed11462) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#a8c9b27a1df4d180b9fb5755bebea2dbd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#a78a42a7c0be768374781f67f40c9ab0d) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | void | [conservativeResize](classeigen_1_1plainobjectbase#afc474a09ec9704629b795d7907fb6c37) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [conservativeResizeLike](classeigen_1_1plainobjectbase#a4ece7540eda6a1ae7d3730397ce72bec) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \* | [data](classeigen_1_1plainobjectbase#ad12a492bcadea9b65ccd9bc8404c01f1) () | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \* | [data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116) () const | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [lazyAssign](classeigen_1_1plainobjectbase#a70fc6030f9ee72fbe0b3adade2a4a2bd) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [operator=](classeigen_1_1plainobjectbase#ad90648194e9fa6a0e1296ba1e4db8787) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1plainobjectbase#ad90648194e9fa6a0e1296ba1e4db8787) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [operator=](classeigen_1_1plainobjectbase#afbf3af8d6195c9b1b2103c2dd1231247) (const [PlainObjectBase](classeigen_1_1plainobjectbase) &other) | | | | void | [resize](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [resize](classeigen_1_1plainobjectbase#ae4bbe4c06c1feb1035573eee7f5c3623) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | void | [resize](classeigen_1_1plainobjectbase#a8bee1e51417bfa386dd54b37f6d9e2fe) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | void | [resize](classeigen_1_1plainobjectbase#a0dd078df3ff8b3833723ce84ce519651) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | void | [resizeLike](classeigen_1_1plainobjectbase#aabf64c98e5415ad39828a83cc5bdac40) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &\_other) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#aac6bc5261783ec3008a51c2654de73e8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#af9996d6a98f45e84a908dc9851c8332e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#a56e04c9e00a84eeb26774842f4a0f6fd) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setConstant](classeigen_1_1plainobjectbase#ae521bf911dfa2823c8056dc9c1776bcd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#acc39eaf7ba22b725c86f1b9b8bb57c3c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#a73ab57abb640bf35e0dbf9dba225a1db) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#af57b7361afefe60e2940802e7ef2ca54) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setZero](classeigen_1_1plainobjectbase#aee6d32f2e6615645b5f1152f99bc8549) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#a8700dc6d8e05436c0b34ae15ca9274a5) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#ad06b9d8ddac261a871c9ff550a925975) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#a3bd80eb3e6779ba362628b1cb62a665e) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setOnes](classeigen_1_1plainobjectbase#ab04727b1a70e7d0b5ce9d004b3349075) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#a5f0f6cc8039ed5ac026cd32ed5bbe6ea) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#a8921e8a7f9a5ea167231d29f8feb8700) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#a66a2a4ffc386ca72214d0ac3161fdc03) (NoChange\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [setRandom](classeigen_1_1plainobjectbase#ae705648096d7e74b32daa82dd297dc54) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, NoChange\_t) | | | | Public Member Functions inherited from [Eigen::ArrayBase< Derived >](classeigen_1_1arraybase) | | [MatrixWrapper](classeigen_1_1matrixwrapper)< Derived > | [matrix](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) () | | | | template<typename OtherDerived > | | Derived & | [operator\*=](classeigen_1_1arraybase#a6a5ff80e9d85106a1c9958219961c21d) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator+=](classeigen_1_1arraybase#a9cc9fdb4d0d6eb80a45107b86aacbfed) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator-=](classeigen_1_1arraybase#aac76a5e5e735b97f955189825cef7e2c) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator/=](classeigen_1_1arraybase#a1717e11dfe9341e9cfba13140cedddce) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | Derived & | [operator=](classeigen_1_1arraybase#a8587d8d893f5225a4511e9d76d9fe3cc) (const [ArrayBase](classeigen_1_1arraybase) &other) | | | | Derived & | [operator=](classeigen_1_1arraybase#a80cacb05b6881fba659efb2377e4fd22) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | bool | [all](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) () const | | | | bool | [allFinite](classeigen_1_1densebase#af1e669fd3aaae50a4870dc1b8f3b8884) () const | | | | bool | [any](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [begin](classeigen_1_1densebase#a57591454af931f9dffa71c9da28d5641) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [begin](classeigen_1_1densebase#ad9368ce70b06167ec5fc19398d329f5e) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cbegin](classeigen_1_1densebase#ae9a3dfd9b826ba3103de0128576fb15b) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cend](classeigen_1_1densebase#aeb3b76f02986c2af2521d07164b5ffde) () const | | | | [ColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) () | | | | [ConstColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [count](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [end](classeigen_1_1densebase#ae71d079e16d91360d10066b316b48485) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [end](classeigen_1_1densebase#ab34773522e43bfb02e9cf652d7b5dd60) () const | | | | EvalReturnType | [eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) () const | | | | void | [fill](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | template<unsigned int Added, unsigned int Removed> | | EIGEN\_DEPRECATED const Derived & | [flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const | | | | const [WithFormat](classeigen_1_1withformat)< Derived > | [format](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) (const [IOFormat](structeigen_1_1ioformat) &fmt) const | | | | bool | [hasNaN](classeigen_1_1densebase#ab13d158c900560d3e1b25d85d2d33dd6) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1densebase#a58ca41d9635a8ab3c5a268ef3f7f0d75) () const | | | | template<typename OtherDerived > | | bool | [isApprox](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isApproxToConstant](classeigen_1_1densebase#af9b150d48bc5e4366887ccb466e40c6b) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isConstant](classeigen_1_1densebase#a1ca84e4179b3e5081ed11d89bbd9e74f) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#a3c4db0c6dd974fa88bbb58b2cf3d5664) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename Derived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#adfca6ff4e473f68fbbeabbd03b7504a9) (const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &other, const RealScalar &prec) const | | | | bool | [isOnes](classeigen_1_1densebase#aa56d6b4477cd3c92a9cf42f4b96e47c2) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isZero](classeigen_1_1densebase#af36014ec300f53a65083057ed4e89822) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED Derived & | [lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#aced8ffda52ff061b6586ace2657ebf30) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) (IndexType \*row, IndexType \*col) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7) () const | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#ac9265f4f91430b9cc75d63fb6865bb29) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) (IndexType \*row, IndexType \*col) const | | | | const [NestByValue](classeigen_1_1nestbyvalue)< Derived > | [nestByValue](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1densebase#acb8d5574eff335381e7441ade87700a0) () const | | | | template<typename OtherDerived > | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0f0e34696162b34762b2bf4bd948f90c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0e575eb0ba6cc6bc5f347872abd8509d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &s) | | | | Derived & | [operator=](classeigen_1_1densebase#a5281dadff89f46eef719b38e5d073a8f) (const [DenseBase](classeigen_1_1densebase) &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#ab66155169d20c035e80d521a8b918e97) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1densebase#a03f71699bc26ca2ee4e42ec4538862d7) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) () const | | | | template<typename Func > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [redux](classeigen_1_1densebase#a63ce1e4fab36bff43bbadcdd06a67724) (const Func &func) const | | | | template<int RowFactor, int ColFactor> | | const [Replicate](classeigen_1_1replicate)< Derived, RowFactor, ColFactor > | [replicate](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) () const | | | | const [Replicate](classeigen_1_1replicate)< Derived, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [replicate](classeigen_1_1densebase#afae2d5e36f1158d1b1681dac3cdbd58e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowFactor, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colFactor) const | | | | void | [resize](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | [ReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) () | | | | [ConstReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a9e2f3ac4019184abf95ca0e1a8d82866) () const | | | | void | [reverseInPlace](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) () | | | | [RowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) () | | | | [ConstRowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc) () const | | | | template<typename ThenDerived , typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, ElseDerived > | [select](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | template<typename ThenDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > | [select](classeigen_1_1densebase#a57ef09a843004095f84c198dd145641b) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const | | | | template<typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > | [select](classeigen_1_1densebase#a9e8e78c75887d4539071a0b7a61ca103) (const typename ElseDerived::Scalar &thenScalar, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | Derived & | [setConstant](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) | | | | Derived & | [setOnes](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) () | | | | Derived & | [setRandom](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) () | | | | Derived & | [setZero](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) () | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) () const | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#af9e7e4305fdb7781f2b2f05fa801f21e) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#a44e25adc6da9cd1d79f4c5bd7c1819cb) ([PlainObjectBase](classeigen_1_1plainobjectbase)< OtherDerived > &other) | | | | [TransposeReturnType](classeigen_1_1transpose) | [transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) () const | | | | void | [transposeInPlace](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) () | | | | CoeffReturnType | [value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) () const | | | | template<typename Visitor > | | void | [visit](classeigen_1_1densebase#a4225b90fcc74f18dd479b401124b3841) (Visitor &func) const | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#af1bac522aee4402639189f387592000b) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a4e94e17926e1cf597deb2928e779cef6) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#abb333f6f10467f6f8d7b59c213dea49e) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a63bc5874eb4e320e54eb079b43b49d22) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae66b7d18b2a85f3139b703126974c900) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#adc8286576b31e11f056057be666a0ec8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a0171eee1d9e582d1ac7ec0f18f5f615a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae6ba07bad9e3026afe54806fdefe32bb) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#aa2040f14e60fed1a4a68ca7f042e1bbf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Scalar & | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) () | | | | Scalar & | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) () | | | | Scalar & | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8) () | | | | Scalar & | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73) () | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | enum | { [RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab) , [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) , [SizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da25cb495affdbd796198462b8ef06be91) , [MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306) , [MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) , [MaxSizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da3a459062d39cb34452518f5f201161d2) , [IsVectorAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da1156955c8099c5072934b74c72654ed0) , [NumDimensions](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da4d4548a01ba37a6c2031a3c1f0a37d34) , [Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) , [IsRowMajor](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da406b6af91d61d348ba1c9764bdd66008) , **InnerSizeAtCompileTime** , **InnerStrideAtCompileTime** , **OuterStrideAtCompileTime** } | | | | typedef random\_access\_iterator\_type | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | | | | typedef random\_access\_iterator\_type | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | | | | typedef [Array](classeigen_1_1array)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) | | | | typedef [Matrix](classeigen_1_1matrix)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e) | | | | typedef internal::conditional< internal::is\_same< typename internal::traits< Derived >::XprKind, [MatrixXpr](structeigen_1_1matrixxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e), [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) >::type | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | The plain matrix or array type corresponding to this expression. [More...](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | [StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | The type used to store indices. [More...](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | | typedef [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [value\_type](classeigen_1_1densebase#a9276182dab8236c33f1e7abf491d504d) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Static Public Member Functions inherited from [Eigen::PlainObjectBase< Array< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >](classeigen_1_1plainobjectbase) | | static [ConstMapType](classeigen_1_1map) | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [MapType](classeigen_1_1map) | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [ConstMapType](classeigen_1_1map) | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [MapType](classeigen_1_1map) | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [ConstMapType](classeigen_1_1map) | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static [MapType](classeigen_1_1map) | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static StridedConstMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **Map** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static [ConstAlignedMapType](classeigen_1_1map) | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [AlignedMapType](classeigen_1_1map) | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | static [ConstAlignedMapType](classeigen_1_1map) | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [AlignedMapType](classeigen_1_1map) | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static [ConstAlignedMapType](classeigen_1_1map) | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static [AlignedMapType](classeigen_1_1map) | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | static StridedConstAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedConstAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | static StridedAlignedMapType< [Stride](classeigen_1_1stride)< Outer, Inner > >::type | **MapAligned** ([Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, const [Stride](classeigen_1_1stride)< Outer, Inner > &stride) | | | | Static Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#aed89b5cc6e3b7d9d5bd63aed245ccd6d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a1fdd3189ae3a41d250593334d82210cf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a5dc65501accd02c30f7c1840c2a30a41) (const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const CustomNullaryOp &func) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101) () | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a8b2a51018a73a766f5b91aef3487f013) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#ab710a58e4a80fbcb2594242372c8fe56) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) () | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#a7eb5f974a8f0b67eac7080db1da0e308) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761) () | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ae41a9b5050ed27d9e93c82c9c8622cd3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ac22f79b812fa564061042407f2ba8f5b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | Protected Member Functions inherited from [Eigen::PlainObjectBase< Array< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >](classeigen_1_1plainobjectbase) | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a73dca0493df0fe4f8e518e379a80cbdd) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a8fa7e42fd02b266ac54d57cdc735e83d) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a520234520136dffad88301a507da4fa5) (const [PlainObjectBase](classeigen_1_1plainobjectbase) &other) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a281044f167c388339c2d704e5d292fa5) (const ReturnByValue< OtherDerived > &other) | | | Copy constructor with in-place evaluation. | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#a5b6ba62bc9d263390e81a77a44f23dd9) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a0, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a1, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a2, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &a3, const ArgTypes &... args) | | | Construct a row of column vector with fixed size from an arbitrary number of coefficients. [c++11] [More...](classeigen_1_1plainobjectbase#a5b6ba62bc9d263390e81a77a44f23dd9) | | | | | [PlainObjectBase](classeigen_1_1plainobjectbase#ab6cde095b242924b47479662b16d78b9) (const std::initializer\_list< std::initializer\_list< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >> &list) | | | Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer lists [c++11] | | | | void | **\_resize\_to\_match** (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | [\_set](classeigen_1_1plainobjectbase#a09c4b519ee4c635144581e9fe03b6174) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | Copies the value of the expression *other* into `*this` with automatic resizing. [More...](classeigen_1_1plainobjectbase#a09c4b519ee4c635144581e9fe03b6174) | | | | [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | **\_set\_noalias** (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | void | **\_init2** ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols, typename internal::enable\_if< Base::SizeAtCompileTime!=2, T0 >::type \*=0) | | | | void | **\_init2** (const T0 &val0, const T1 &val1, typename internal::enable\_if< Base::SizeAtCompileTime==2, T0 >::type \*=0) | | | | void | **\_init2** (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val0, const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val1, typename internal::enable\_if<(!internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< T0, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< T1, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&Base::SizeAtCompileTime==2, T1 >::type \*=0) | | | | void | **\_init1** ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), typename internal::enable\_if<(Base::SizeAtCompileTime!=1||!internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&((!internal::is\_same< typename internal::traits< [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >::XprKind, [ArrayXpr](structeigen_1_1arrayxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)||Base::SizeAtCompileTime==Dynamic)), T >::type \*=0) | | | | void | **\_init1** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, typename internal::enable\_if< Base::SizeAtCompileTime==1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T >::type \*=0) | | | | void | **\_init1** (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val0, typename internal::enable\_if<(!internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), T >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&Base::SizeAtCompileTime==1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T \* >::type \*=0) | | | | void | **\_init1** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) \*[data](classeigen_1_1plainobjectbase#ac54123f62de4c46a9107ff53890b6116)) | | | | void | **\_init1** (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | void | **\_init1** (const [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > &other) | | | | void | **\_init1** (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | | void | **\_init1** (const ReturnByValue< OtherDerived > &other) | | | | void | **\_init1** (const [RotationBase](classeigen_1_1rotationbase)< OtherDerived, [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) > &r) | | | | void | **\_init1** (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &val0, typename internal::enable\_if< Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) &&internal::is\_same< typename internal::traits< [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >::XprKind, [ArrayXpr](structeigen_1_1arrayxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T >::type \*=0) | | | | void | **\_init1** (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) &val0, typename internal::enable\_if<(!internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&(internal::is\_same< [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02), T >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) &&Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is\_convertible< T, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) &&internal::is\_same< typename internal::traits< [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > >::XprKind, [ArrayXpr](structeigen_1_1arrayxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), T \* >::type \*=0) | | | | Protected Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | | [DenseBase](classeigen_1_1densebase#aa284042d0e1b0ad9b6a00db7fd2d9f7f) () | | | | Related Functions inherited from [Eigen::ArrayBase< Derived >](classeigen_1_1arraybase) | | template<typename Derived , typename ExponentDerived > | | const [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_pow\_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const Derived, const ExponentDerived > | [pow](classeigen_1_1arraybase#acb769e1ab1d809abb77c7ab98021ad81) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Eigen::ArrayBase](classeigen_1_1arraybase)< ExponentDerived > &exponents) | | | | template<typename Derived , typename ScalarExponent > | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< Derived::Scalar, ScalarExponent >, Derived, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< ScalarExponent > > | [pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const ScalarExponent &exponent) | | | | template<typename Scalar , typename Derived > | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), Derived::Scalar >, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >, Derived > | [pow](classeigen_1_1arraybase#acb7a6224d50620991d1fb9888b8be6e6) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000)) | | | | Related Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | template<typename Derived > | | std::ostream & | [operator<<](classeigen_1_1densebase#a3806d3f42de165878dace160e6aba40a) (std::ostream &s, const [DenseBase](classeigen_1_1densebase)< Derived > &m) | | | Array() [1/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | | ) | | | inline | Default constructor. For fixed-size matrices, does nothing. For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix is called a null matrix. This constructor is the unique way to create null matrices: resizing a matrix to 0 is not supported. See also [resize(Index,Index)](classeigen_1_1plainobjectbase#a9fd0703bd7bfe89d6dc80e2ce87c312a) Array() [2/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename... ArgTypes> | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a0*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a1*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a2*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *a3*, | | | | const ArgTypes &... | *args* | | | ) | | | | inline | Example: ``` Array<int, 1, 6> a(1, 2, 3, 4, 5, 6); Array<int, 3, 1> b {1, 2, 3}; cout << a << "\n\n" << b << endl; ``` Output: ``` 1 2 3 4 5 6 1 2 3 ``` See also [Array(const std::initializer\_list<std::initializer\_list<Scalar>>&)](classeigen_1_1array#aa8732ffb15d620d7091e10f963548390 "Constructs an array and initializes it from the coefficients given as initializer-lists grouped by ro...") [Array(const Scalar&)](classeigen_1_1array#a60196d3a62e1d19746e011dd1cefdfc5), [Array(const Scalar&,const Scalar&)](classeigen_1_1array#a3b781cdd2aa6fa9421047e6bc29d1bf6) Array() [3/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const std::initializer\_list< std::initializer\_list< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >> & | *list* | ) | | | inline | Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. [c++11] In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: Example: ``` ArrayXXi a { {1, 2, 3}, {3, 4, 5} }; cout << a << endl; ``` Output: ``` 1 2 3 3 4 5 ``` Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. In the case of a compile-time column 1D array, implicit transposition from a single row is allowed. Therefore `Array<int,Dynamic,1>{{1,2,3,4,5}}` is legal and the more verbose syntax `Array<int,Dynamic,1>{{1},{2},{3},{4},{5}}` can be avoided: Example: ``` Array<int, Dynamic, 1> v {{1, 2, 3, 4, 5}}; cout << v << endl; ``` Output: ``` 1 2 3 4 5 ``` In the case of fixed-sized arrays, the initializer list sizes must exactly match the array sizes, and implicit transposition is allowed for compile-time 1D arrays only. See also [Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)](classeigen_1_1array#a3d375f13801bb5db4c3d8eaa5b05aa08) Array() [4/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *dim* | ) | | | inlineexplicit | Constructs a vector or row-vector with given dimension. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. Note that this is only useful for dynamic-size vectors. For fixed-size vectors, it is redundant to pass the dimension here, so it makes more sense to use the default constructor [Array()](classeigen_1_1array#ad9f6f2c9890092e12fd3344aa6ffcbd1) instead. Array() [5/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *value* | ) | | constructs an initialized 1x1 [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") with the given coefficient See also const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args Array() [6/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | constructs an uninitialized array with *rows* rows and *cols* columns. This is useful for dynamic-size arrays. For fixed-size arrays, it is redundant to pass these parameters, so one should use the default constructor [Array()](classeigen_1_1array#ad9f6f2c9890092e12fd3344aa6ffcbd1) instead. Array() [7/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val0*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val1* | | | ) | | | constructs an initialized 2D vector with given coefficients See also [Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)](classeigen_1_1array#a3d375f13801bb5db4c3d8eaa5b05aa08) Array() [8/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val0*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val1*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val2* | | | ) | | | | inline | constructs an initialized 3D vector with given coefficients See also [Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)](classeigen_1_1array#a3d375f13801bb5db4c3d8eaa5b05aa08) Array() [9/11] -------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val0*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val1*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val2*, | | | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *val3* | | | ) | | | | inline | constructs an initialized 4D vector with given coefficients See also [Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)](classeigen_1_1array#a3d375f13801bb5db4c3d8eaa5b05aa08) Array() [10/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | *other* | ) | | | inline | Copy constructor Array() [11/11] --------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::[Array](classeigen_1_1array) | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other*, | | | | typename internal::enable\_if< internal::is\_convertible< typename OtherDerived::Scalar, [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), PrivateType >::type | = `PrivateType()` | | | ) | | | | inline | See also MatrixBase::operator=(const EigenBase<OtherDerived>&) coeff() [1/2] ------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | --- | --- | --- | | | | | --- | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)& [Eigen::PlainObjectBase](classeigen_1_1plainobjectbase)< Derived >::coeff | | inline | This is an overloaded version of [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. See [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) for details. coeff() [2/2] ------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | --- | --- | --- | | | | | --- | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)& [Eigen::PlainObjectBase](classeigen_1_1plainobjectbase)< Derived >::coeff | | inline | This is an overloaded version of [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. See [DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) for details. coeffRef() [1/4] ---------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | --- | --- | --- | | | | | --- | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)& [Eigen::PlainObjectBase](classeigen_1_1plainobjectbase)< Derived >::coeffRef | | inline | This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details. coeffRef() [2/4] ---------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | --- | --- | --- | | | | | --- | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)& [Eigen::PlainObjectBase](classeigen_1_1plainobjectbase)< Derived >::coeffRef | | inline | This is the const version of [coeffRef(Index)](classeigen_1_1plainobjectbase#a72e84dc1bb573ad8ecc9109fbbc1b63b) which is thus synonym of coeff(Index). It is provided for convenience. coeffRef() [3/4] ---------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | --- | --- | --- | | | | | --- | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)& [Eigen::PlainObjectBase](classeigen_1_1plainobjectbase)< Derived >::coeffRef | | inline | This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details. coeffRef() [4/4] ---------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | --- | --- | --- | | | | | --- | | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2)& [Eigen::PlainObjectBase](classeigen_1_1plainobjectbase)< Derived >::coeffRef | | inline | This is the const version of [coeffRef(Index,Index)](classeigen_1_1plainobjectbase#a992d58b5453e441dcfc80f21c2bfd1d7) which is thus synonym of coeff(Index,Index). It is provided for convenience. operator=() [1/4] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Array](classeigen_1_1array)& [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols > & | *other* | ) | | | inline | This is a special case of the templated operator=. Its purpose is to prevent a default operator= from hiding the templated operator=. operator=() [2/4] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Array](classeigen_1_1array)& [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [DenseBase](classeigen_1_1densebase)< OtherDerived > & | *other* | ) | | | inline | Copies the value of the expression *other* into `*this` with automatic resizing. \*this might be resized to match the dimensions of *other*. If \*this was a null matrix (not already initialized), it will be initialized. Note that copying a row-vector into a vector (and conversely) is allowed. The resizing, if any, is then done in the appropriate way so that row-vectors remain row-vectors and vectors remain vectors. operator=() [3/4] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Array](classeigen_1_1array)& [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > & | *other* | ) | | | inline | The usage of using [Base::operator=](classeigen_1_1plainobjectbase#afbf3af8d6195c9b1b2103c2dd1231247); fails on MSVC. Since the code below is working with GCC and MSVC, we skipped the usage of 'using'. This should be done only for operator=. operator=() [4/4] ----------------- template<typename \_Scalar , int \_Rows, int \_Cols, int \_Options, int \_MaxRows, int \_MaxCols> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Array](classeigen_1_1array)& [Eigen::Array](classeigen_1_1array)< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >::operator= | ( | const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) & | *value* | ) | | | inline | Set all the entries to *value*. See also [DenseBase::setConstant()](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559), [DenseBase::fill()](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) --- The documentation for this class was generated from the following file:* [Array.h](https://eigen.tuxfamily.org/dox/Array_8h_source.html)
programming_docs
eigen3 Eigen::LeastSquaresConjugateGradient Eigen::LeastSquaresConjugateGradient ==================================== ### template<typename \_MatrixType, typename \_Preconditioner> class Eigen::LeastSquaresConjugateGradient< \_MatrixType, \_Preconditioner > A conjugate gradient solver for sparse (or dense) least-square problems. This class allows to solve for A x = b linear problems using an iterative conjugate gradient algorithm. The matrix A can be non symmetric and rectangular, but the matrix A' A should be positive-definite to guaranty stability. Otherwise, the [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices.") or [SparseQR](classeigen_1_1sparseqr "Sparse left-looking QR factorization with numerical column pivoting.") classes might be preferable. The matrix A and the vectors x and b can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix A, can be a dense or a sparse matrix. | | \_Preconditioner | the type of the preconditioner. Default is [LeastSquareDiagonalPreconditioner](classeigen_1_1leastsquarediagonalpreconditioner "Jacobi preconditioner for LeastSquaresConjugateGradient.") | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . The maximal number of iterations and tolerance value can be controlled via the [setMaxIterations()](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) and [setTolerance()](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance. This class can be used as the direct solver classes. Here is a typical usage example: ``` int m=1000000, n = 10000; VectorXd x(n), b(m); SparseMatrix<double> A(m,n); // fill A and b LeastSquaresConjugateGradient<SparseMatrix<double> > lscg; lscg.compute(A); x = lscg.solve(b); std::cout << "#iterations: " << lscg.iterations() << std::endl; std::cout << "estimated error: " << lscg.error() << std::endl; // update b, and solve again x = lscg.solve(b); ``` By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the [solveWithGuess()](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) method. See also class [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems."), [SparseLU](classeigen_1_1sparselu "Sparse supernodal LU factorization for general matrices."), [SparseQR](classeigen_1_1sparseqr "Sparse left-looking QR factorization with numerical column pivoting.") | | | --- | | | | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient#ace69f423fcc1f8960d0e2de0667447c9) () | | | | template<typename MatrixDerived > | | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient#a91c4f2edc20f93cee9b721165937fb99) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | Public Member Functions inherited from [Eigen::IterativeSolverBase< LeastSquaresConjugateGradient< \_MatrixType, \_Preconditioner > >](classeigen_1_1iterativesolverbase) | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner > & | [analyzePattern](classeigen_1_1iterativesolverbase#a3f684fb41019ca04d97ddc08a0d8be2e) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner > & | [compute](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | RealScalar | [error](classeigen_1_1iterativesolverbase#a117c241af3fb1141ad0916a3cf3157ec) () const | | | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner > & | [factorize](classeigen_1_1iterativesolverbase#a1374b141721629983cd8276b4b87fc58) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1iterativesolverbase#a0d6b459433a316b4f12d48e5c80d61fe) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [iterations](classeigen_1_1iterativesolverbase#ae778dd098bd5e6655625b20b1e9f15da) () const | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a0922f2be45082690d7734aa6732fc493) () | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a3c68fe3cd929ea1ff8a0d4cbcd65ebad) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [maxIterations](classeigen_1_1iterativesolverbase#a168a74c8dceb6233b220031fdd756ba0) () const | | | | Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a5e88f2a323a2900205cf807af94f8051) () | | | | const Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a709a056e17c49b5272e4971bc376cbe4) () const | | | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner > & | [setMaxIterations](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) maxIters) | | | | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner > & | [setTolerance](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) (const RealScalar &[tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62)) | | | | const [SolveWithGuess](classeigen_1_1solvewithguess)< [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner >, Rhs, Guess > | [solveWithGuess](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b, const Guess &x0) const | | | | RealScalar | [tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62) () const | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | LeastSquaresConjugateGradient() [1/2] ------------------------------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner >::[LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient) | ( | | ) | | | inline | Default constructor. LeastSquaresConjugateGradient() [2/2] ------------------------------------- template<typename \_MatrixType , typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient)< \_MatrixType, \_Preconditioner >::[LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient) | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. --- The documentation for this class was generated from the following file:* [LeastSquareConjugateGradient.h](https://eigen.tuxfamily.org/dox/LeastSquareConjugateGradient_8h_source.html) eigen3 Eigen::CholmodSimplicialLLT Eigen::CholmodSimplicialLLT =========================== ### template<typename \_MatrixType, int \_UpLo = Lower> class Eigen::CholmodSimplicialLLT< \_MatrixType, \_UpLo > A simplicial direct Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on Cholmod. This class allows to solve for A.X = B sparse linear problems via a simplicial LL^T Cholesky factorization using the Cholmod library. This simplicial variant is equivalent to [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s built-in [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") class. Therefore, it has little practical interest. The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices X and B can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | \_UpLo | the triangular part that will be used for the computations. It can be Lower or Upper. Default is Lower. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. Warning Only double precision real and complex scalar types are supported by Cholmod. See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [CholmodSupernodalLLT](classeigen_1_1cholmodsupernodalllt "A supernodal Cholesky (LLT) factorization and solver based on Cholmod."), class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") | | | --- | | | | Public Member Functions inherited from [Eigen::CholmodBase< \_MatrixType, Lower, CholmodSimplicialLLT< \_MatrixType, Lower > >](classeigen_1_1cholmodbase) | | void | [analyzePattern](classeigen_1_1cholmodbase#a5ac967e9f4ccfc43ca9e610b89232c24) (const MatrixType &matrix) | | | | cholmod\_common & | [cholmod](classeigen_1_1cholmodbase#a6a85bf52d6aa480240a64f277d7f96c6) () | | | | [CholmodSimplicialLLT](classeigen_1_1cholmodsimplicialllt)< \_MatrixType, Lower > & | [compute](classeigen_1_1cholmodbase#abaf5be01b1e3035a4de0b19f5b63549e) (const MatrixType &matrix) | | | | Scalar | [determinant](classeigen_1_1cholmodbase#ab4ffb4a9735ad7e81a01d5789ce96547) () const | | | | void | [factorize](classeigen_1_1cholmodbase#a5bd9c9ec4d1c15f202a6c66b5e9ef37b) (const MatrixType &matrix) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1cholmodbase#ada4cc43c64767d186fcb8997440cc753) | | | | Scalar | [logDeterminant](classeigen_1_1cholmodbase#a597f7839a39604af18a8741a0d8c46bf) () const | | | | [CholmodSimplicialLLT](classeigen_1_1cholmodsimplicialllt)< \_MatrixType, Lower > & | [setShift](classeigen_1_1cholmodbase#a886fc102723ca7bde4ac7162dfd72f5d) (const RealScalar &offset) | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | --- The documentation for this class was generated from the following file:* [CholmodSupport.h](https://eigen.tuxfamily.org/dox/CholmodSupport_8h_source.html) eigen3 Eigen::SolverBase Eigen::SolverBase ================= ### template<typename Derived> class Eigen::SolverBase< Derived > A base class for matrix decomposition and solvers. Template Parameters | | | | --- | --- | | Derived | the actual type of the decomposition/solver. | Any matrix decomposition inheriting this base class provide the following API: ``` MatrixType A, b, x; DecompositionType dec(A); x = dec.solve(b); // solve A \* x = b x = dec.transpose().solve(b); // solve A^T \* x = b x = dec.adjoint().solve(b); // solve A' \* x = b ``` Warning Currently, any other usage of [transpose()](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) and [adjoint()](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) are not supported and will produce compilation errors. See also class [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features."), class [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features."), class [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix."), class [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting."), class [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting."), class [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition "Complete orthogonal decomposition (COD) of a matrix."), class [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features."), class [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting."), class [SVDBase](classeigen_1_1svdbase "Base class of SVD algorithms.") | | | --- | | | | AdjointReturnType | [adjoint](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5) () const | | | | Derived & | [derived](classeigen_1_1solverbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1solverbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | | [SolverBase](classeigen_1_1solverbase#a4d5e5baddfba3790ab1a5f247dcc4dc1) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | SolverBase() ------------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SolverBase](classeigen_1_1solverbase)< Derived >::[SolverBase](classeigen_1_1solverbase) | ( | | ) | | | inline | Default constructor adjoint() --------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | AdjointReturnType [Eigen::SolverBase](classeigen_1_1solverbase)< Derived >::adjoint | ( | | ) | const | | inline | Returns an expression of the adjoint of the factored matrix A typical usage is to solve for the adjoint problem A' x = b: ``` x = dec.adjoint().solve(b); ``` For real scalar types, this function is equivalent to [transpose()](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c). See also [transpose()](classeigen_1_1solverbase#a732e75b5132bb4db3775916927b0e86c), [solve()](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) derived() [1/2] --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | Derived& [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::derived | | inline | Returns a reference to the derived object derived() [2/2] --------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const Derived& [Eigen::EigenBase](structeigen_1_1eigenbase)< Derived >::derived | | inline | Returns a const reference to the derived object solve() ------- template<typename Derived > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<Derived, Rhs> [Eigen::SolverBase](classeigen_1_1solverbase)< Derived >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *b* | ) | const | | inline | Returns an expression of the solution x of \( A x = b \) using the current decomposition of A. transpose() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ConstTransposeReturnType](classeigen_1_1diagonal) [Eigen::SolverBase](classeigen_1_1solverbase)< Derived >::transpose | ( | | ) | const | | inline | Returns an expression of the transposed of the factored matrix. A typical usage is to solve for the transposed problem A^T x = b: ``` x = dec.transpose().solve(b); ``` See also [adjoint()](classeigen_1_1solverbase#a05a3686a89888681c8e0c2bcab6d1ce5), [solve()](classeigen_1_1solverbase#a7fd647d110487799205df6f99547879d) --- The documentation for this class was generated from the following file:* [SolverBase.h](https://eigen.tuxfamily.org/dox/SolverBase_8h_source.html) eigen3 SuiteSparseQR module SuiteSparseQR module ==================== This module provides an interface to the SPQR library, which is part of the [suitesparse](http://www.suitesparse.com) package. ``` #include <Eigen/SPQRSupport> ``` In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules | | | --- | | | | class | [Eigen::SPQR< \_MatrixType >](classeigen_1_1spqr) | | | [Sparse](structeigen_1_1sparse) QR factorization based on SuiteSparseQR library. [More...](classeigen_1_1spqr#details) | | |
programming_docs
eigen3 Eigen::SparseMapBase Eigen::SparseMapBase ==================== ### template<typename Derived> class Eigen::SparseMapBase< Derived, ReadOnlyAccessors > Common base class for [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") instance of sparse matrix and vector. class SparseMapBase | | | --- | | | | Scalar | [coeff](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a195e66f79171f78cc22d91fff37e36e3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0fc44f3781a869a3a410edd6691fd899) () const | | | | const StorageIndex \* | [innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#ab044564756f472877b2c1a5706e540e2) () const | | | | const StorageIndex \* | [innerNonZeroPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a2b35a1d701d6c6ea36b2d9f19660a68c) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0df6dba8d71e0fb15b2995510853f83e) () const | | | | bool | [isCompressed](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#aafab4afa7ab2ff89eff049d4c71e2ce4) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a753e975b7b3643d821dc061141786870) () const | | | | const StorageIndex \* | [outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a24c55dd8de4aca30e7c90b69aa5dca6b) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3d6ede19db6d42074ae063bc876231b1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3cdd6cab0abd7ac01925a695fc315d34) () const | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a574ea9371c22eabebdda21c0787312dc) () const | | | | | [~SparseMapBase](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#ab375aedf824909a7f1a6af24ee60d70f) () | | | | Public Member Functions inherited from [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | [Map](classeigen_1_1map)< [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a7cf299e08d2a4f6d6869e631e51b12fe) () | | | | const [Map](classeigen_1_1map)< const [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a101b155485ae59ea1261c4f6040f3dc4) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#aa64818e1aa43015dad01b114b2ab4687) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#a411e972b097e6aef225415a4c2d0a0b5) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#afc056a3895eae1a4c4767252ff04966a) () const | | | | bool | [isCompressed](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsecompressedbase#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a2624d4c2661c582de168246c56e8d71e) () const | | | | Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f44c739398794ea77f310b745cc5627) () const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< Derived >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< Derived, [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)|[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | enum | { [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604) , [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14) , [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) , **MaxRowsAtCompileTime** , **MaxColsAtCompileTime** , **MaxSizeAtCompileTime** , [IsVectorAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a14a3f566ed2a074beddb8aef0223bfdf) , [NumDimensions](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2366131ffcc38bff48a1c7572eb86dd3) , [Flags](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2af043b36fe9e08df0107cf6de496165) , **IsRowMajor** , **InnerSizeAtCompileTime** } | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | | [SparseCompressedBase](classeigen_1_1sparsecompressedbase#af79f020db965367d97eb954fc68d8f99) () | | | ~SparseMapBase() ---------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::~SparseMapBase | ( | | ) | | | inline | Empty destructor coeff() ------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::coeff | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | const | | inline | Returns the value of the matrix at position *i*, *j* This function returns Scalar(0) if the element is an explicit *zero* cols() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::cols | ( | void | | ) | const | | inline | Returns the number of columns. See also [rows()](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3cdd6cab0abd7ac01925a695fc315d34) innerIndexPtr() --------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const StorageIndex\* Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::innerIndexPtr | ( | | ) | const | | inline | Returns a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [outerIndexPtr()](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) innerNonZeroPtr() ----------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const StorageIndex\* Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::innerNonZeroPtr | ( | | ) | const | | inline | Returns a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 in compressed mode innerSize() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::innerSize | ( | | ) | const | | inline | Returns the size of the inner dimension according to the storage order, i.e., the number of rows for a columns major matrix, and the number of cols otherwise isCompressed() -------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | bool Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::isCompressed | ( | | ) | const | | inline | Returns whether `*this` is in compressed form. nonZeros() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::nonZeros | ( | | ) | const | | inline | Returns the number of non zero coefficients outerIndexPtr() --------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const StorageIndex\* Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::outerIndexPtr | ( | | ) | const | | inline | Returns a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95), [innerIndexPtr()](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) outerSize() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::outerSize | ( | | ) | const | | inline | Returns the size of the storage major dimension, i.e., the number of columns for a columns major matrix, and the number of rows otherwise rows() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::rows | ( | void | | ) | const | | inline | Returns the number of rows. See also [cols()](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0fc44f3781a869a3a410edd6691fd899) valuePtr() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Scalar\* Eigen::SparseMapBase< Derived, [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) >::valuePtr | ( | | ) | const | | inline | Returns a const pointer to the array of values. This function is aimed at interoperability with other libraries. See also [innerIndexPtr()](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a), [outerIndexPtr()](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) --- The documentation for this class was generated from the following file:* [SparseMap.h](https://eigen.tuxfamily.org/dox/SparseMap_8h_source.html) eigen3 Eigen::SparseSolverBase Eigen::SparseSolverBase ======================= ### template<typename Derived> class Eigen::SparseSolverBase< Derived > A base class for sparse solvers. Template Parameters | | | | --- | --- | | Derived | the actual type of the solver. | | | | --- | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | SparseSolverBase() ------------------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SparseSolverBase](classeigen_1_1sparsesolverbase)< Derived >::[SparseSolverBase](classeigen_1_1sparsesolverbase) | ( | | ) | | | inline | Default constructor solve() [1/2] ------------- template<typename Derived > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<Derived, Rhs> [Eigen::SparseSolverBase](classeigen_1_1sparsesolverbase)< Derived >::solve | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *b* | ) | const | | inline | Returns an expression of the solution x of \( A x = b \) using the current decomposition of A. See also compute() solve() [2/2] ------------- template<typename Derived > template<typename Rhs > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Solve](classeigen_1_1solve)<Derived, Rhs> [Eigen::SparseSolverBase](classeigen_1_1sparsesolverbase)< Derived >::solve | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > & | *b* | ) | const | | inline | Returns an expression of the solution x of \( A x = b \) using the current decomposition of A. See also compute() --- The documentation for this class was generated from the following file:* [SparseSolverBase.h](https://eigen.tuxfamily.org/dox/SparseSolverBase_8h_source.html)
programming_docs
eigen3 Preprocessor directives Preprocessor directives ======================= You can control some aspects of Eigen by defining the preprocessor tokens using `#define`. These macros should be defined before any Eigen headers are included. Often they are best set in the project options. This page lists the preprocessor tokens recognized by Eigen. Macros with major effects =========================== These macros have a major effect and typically break the API (Application Programming Interface) and/or the ABI (Application Binary Interface). This can be rather dangerous: if parts of your program are compiled with one option, and other parts (or libraries that you use) are compiled with another option, your program may fail to link or exhibit subtle bugs. Nevertheless, these options can be useful for people who know what they are doing. * **EIGEN2\_SUPPORT** and **EIGEN2\_SUPPORT\_STAGEnn\_xxx** are disabled starting from the 3.3 release. Defining one of these will raise a compile-error. If you need to compile Eigen2 code, [check this site](http://eigen.tuxfamily.org/index.php?title=Eigen2). * **EIGEN\_DEFAULT\_DENSE\_INDEX\_TYPE** - the type for column and row indices in matrices, vectors and array ([DenseBase::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02 "The interface type of indices.")). Set to `std::ptrdiff_t` by default. * **EIGEN\_DEFAULT\_IO\_FORMAT** - the [IOFormat](structeigen_1_1ioformat "Stores a set of parameters controlling the way matrices are printed.") to use when printing a matrix if no IOFormat is specified. Defaults to the IOFormat constructed by the default constructor [IOFormat::IOFormat()](structeigen_1_1ioformat#acdcc91702d45c714b11ba42db5beddb5). * **EIGEN\_INITIALIZE\_MATRICES\_BY\_ZERO** - if defined, all entries of newly constructed matrices and arrays are initialized to zero, as are new entries in matrices and arrays after resizing. Not defined by default. Warning The unary (resp. binary) constructor of `1x1` (resp. `2x1` or `1x2`) fixed size matrices is always interpreted as an initialization constructor where the argument(s) are the coefficient values and not the sizes. For instance, ``` Vector2d v(2,1); ``` will create a vector with coeficients [2,1], and **not** a `2x1` vector initialized with zeros (i.e., [0,0]). If such cases might occur, then it is recommended to use the default constructor with a explicit call to resize: ``` Matrix<?,SizeAtCompileTime,1> v; v.resize(size); Matrix<?,RowsAtCompileTime,ColsAtCompileTime> m; m.resize(rows,cols); ``` * **EIGEN\_INITIALIZE\_MATRICES\_BY\_NAN** - if defined, all entries of newly constructed matrices and arrays are initialized to NaN, as are new entries in matrices and arrays after resizing. This option is especially useful for debugging purpose, though a memory tool like [valgrind](http://valgrind.org/) is preferable. Not defined by default. Warning See the documentation of `EIGEN_INITIALIZE_MATRICES_BY_ZERO` for a discussion on a limitations of these macros when applied to `1x1`, `1x2`, and `2x1` fixed-size matrices. * **EIGEN\_NO\_AUTOMATIC\_RESIZING** - if defined, the matrices (or arrays) on both sides of an assignment `a = b` have to be of the same size; otherwise, Eigen automatically resizes `a` so that it is of the correct size. Not defined by default. C++ standard features ======================= By default, Eigen strive to automatically detect and enable language features at compile-time based on the information provided by the compiler. * **EIGEN\_MAX\_CPP\_VER** - disables usage of C++ features requiring a version greater than EIGEN\_MAX\_CPP\_VER. Possible values are: 03, 11, 14, 17, etc. If not defined (the default), Eigen enables all features supported by the compiler. Individual features can be explicitly enabled or disabled by defining the following token to 0 or 1 respectively. For instance, one might limit the C++ version to C++03 by defining EIGEN\_MAX\_CPP\_VER=03, but still enable C99 math functions by defining EIGEN\_HAS\_C99\_MATH=1. * **EIGEN\_HAS\_C99\_MATH** - controls the usage of C99 math functions such as erf, erfc, lgamma, etc. Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_HAS\_CXX11\_MATH** - controls the implementation of some functions such as round, logp1, isinf, isnan, etc. Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_HAS\_RVALUE\_REFERENCES** - defines whether rvalue references are supported Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_HAS\_STD\_RESULT\_OF** - defines whether std::result\_of is supported Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_HAS\_VARIADIC\_TEMPLATES** - defines whether variadic templates are supported Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_HAS\_CONSTEXPR** - defines whether relaxed const expression are supported Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<14. * **EIGEN\_HAS\_CXX11\_CONTAINERS** - defines whether STL's containers follows C++11 specifications Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_HAS\_CXX11\_NOEXCEPT** - defines whether noexcept is supported Automatic detection disabled if EIGEN\_MAX\_CPP\_VER<11. * **EIGEN\_NO\_IO** - Disables any usage and support for `<iostreams>`. Assertions ============ The Eigen library contains many assertions to guard against programming errors, both at compile time and at run time. However, these assertions do cost time and can thus be turned off. * **EIGEN\_NO\_DEBUG** - disables Eigen's assertions if defined. Not defined by default, unless the `NDEBUG` macro is defined (this is a standard C++ macro which disables all asserts). * **EIGEN\_NO\_STATIC\_ASSERT** - if defined, compile-time static assertions are replaced by runtime assertions; this saves compilation time. Not defined by default. * **eigen\_assert** - macro with one argument that is used inside Eigen for assertions. By default, it is basically defined to be `assert`, which aborts the program if the assertion is violated. Redefine this macro if you want to do something else, like throwing an exception. * **EIGEN\_MPL2\_ONLY** - disable non MPL2 compatible features, or in other words disable the features which are still under the LGPL. Alignment, vectorization and performance tweaking =================================================== * **`EIGEN_MALLOC_ALREADY_ALIGNED` -** Can be set to 0 or 1 to tell whether default system `malloc` already returns aligned buffers. In not defined, then this information is automatically deduced from the compiler and system preprocessor tokens. * **`EIGEN_MAX_ALIGN_BYTES` -** Must be a power of two, or 0. Defines an upper bound on the memory boundary in bytes on which dynamically and statically allocated data may be aligned by Eigen. If not defined, a default value is automatically computed based on architecture, compiler, and OS. This option is typically used to enforce binary compatibility between code/libraries compiled with different SIMD options. For instance, one may compile AVX code and enforce ABI compatibility with existing SSE code by defining `EIGEN_MAX_ALIGN_BYTES=16`. In the other way round, since by default AVX implies 32 bytes alignment for best performance, one can compile SSE code to be ABI compatible with AVX code by defining `EIGEN_MAX_ALIGN_BYTES=32`. * **`EIGEN_MAX_STATIC_ALIGN_BYTES` -** Same as `EIGEN_MAX_ALIGN_BYTES` but for statically allocated data only. By default, if only `EIGEN_MAX_ALIGN_BYTES` is defined, then `EIGEN_MAX_STATIC_ALIGN_BYTES` == `EIGEN_MAX_ALIGN_BYTES`, otherwise a default value is automatically computed based on architecture, compiler, and OS (can be smaller than the default value of EIGEN\_MAX\_ALIGN\_BYTES on architectures that do not support stack alignment). Let us emphasize that `EIGEN_MAX_*_ALIGN_BYTES` define only a diserable upper bound. In practice data is aligned to largest power-of-two common divisor of `EIGEN_MAX_STATIC_ALIGN_BYTES` and the size of the data, such that memory is not wasted. * **`EIGEN_DONT_PARALLELIZE` -** if defined, this disables multi-threading. This is only relevant if you enabled OpenMP. See [Eigen and multi-threading](topicmultithreading) for details. * **`EIGEN_DONT_VECTORIZE` -** disables explicit vectorization when defined. Not defined by default, unless alignment is disabled by Eigen's platform test or the user defining `EIGEN_DONT_ALIGN`. * **`EIGEN_UNALIGNED_VECTORIZE` -** disables/enables vectorization with unaligned stores. Default is 1 (enabled). If set to 0 (disabled), then expression for which the destination cannot be aligned are not vectorized (e.g., unaligned small fixed size vectors or matrices) * **`EIGEN_FAST_MATH` -** enables some optimizations which might affect the accuracy of the result. This currently enables the SSE vectorization of [sin()](namespaceeigen#ae6e8ad270ff41c088d7651567594f796) and [cos()](namespaceeigen#ad01d50a42869218f1d54af13f71517a6), and speedups [sqrt()](namespaceeigen#af4f536e8ea56702e63088efb3706d1f0) for single precision. Defined to 1 by default. Define it to 0 to disable. * **`EIGEN_UNROLLING_LIMIT` -** defines the size of a loop to enable meta unrolling. Set it to zero to disable unrolling. The size of a loop here is expressed in Eigen's own notion of "number of FLOPS", it does not correspond to the number of iterations or the number of instructions. The default is value 110. * **`EIGEN_STACK_ALLOCATION_LIMIT` -** defines the maximum bytes for a buffer to be allocated on the stack. For internal temporary buffers, dynamic memory allocation is employed as a fall back. For fixed-size matrices or arrays, exceeding this threshold raises a compile time assertion. Use 0 to set no limit. Default is 128 KB. * **`EIGEN_NO_CUDA` -** disables CUDA support when defined. Might be useful in .cu files for which [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") is used on the host only, and never called from device code. * **`EIGEN_STRONG_INLINE` -** This macro is used to qualify critical functions and methods that we expect the compiler to inline. By default it is defined to `__forceinline` for MSVC and ICC, and to `inline` for other compilers. A tipical usage is to define it to `inline` for MSVC users wanting faster compilation times, at the risk of performance degradations in some rare cases for which MSVC inliner fails to do a good job. * **`EIGEN_DEFAULT_L1_CACHE_SIZE` -** Sets the default L1 cache size that is used in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s GEBP kernel when the correct cache size cannot be determined at runtime. * **`EIGEN_DEFAULT_L2_CACHE_SIZE` -** Sets the default L2 cache size that is used in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s GEBP kernel when the correct cache size cannot be determined at runtime. * **`EIGEN_DEFAULT_L3_CACHE_SIZE` -** Sets the default L3 cache size that is used in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s GEBP kernel when the correct cache size cannot be determined at runtime. * `EIGEN_DONT_ALIGN` - Deprecated, it is a synonym for `EIGEN_MAX_ALIGN_BYTES=0`. It disables alignment completely. Eigen will not try to align its objects and does not expect that any objects passed to it are aligned. This will turn off vectorization if **`EIGEN_UNALIGNED_VECTORIZE=1`.** Not defined by default. * `EIGEN_DONT_ALIGN_STATICALLY` - Deprecated, it is a synonym for `EIGEN_MAX_STATIC_ALIGN_BYTES=0`. It disables alignment of arrays on the stack. Not defined by default, unless `EIGEN_DONT_ALIGN` is defined. Plugins ========= It is possible to add new methods to many fundamental classes in Eigen by writing a plugin. As explained in the section [Extending MatrixBase (and other classes)](topiccustomizing_plugins), the plugin is specified by defining a `EIGEN_xxx_PLUGIN` macro. The following macros are supported; none of them are defined by default. * **EIGEN\_ARRAY\_PLUGIN** - filename of plugin for extending the [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") class. * **EIGEN\_ARRAYBASE\_PLUGIN** - filename of plugin for extending the [ArrayBase](classeigen_1_1arraybase "Base class for all 1D and 2D array, and related expressions.") class. * **EIGEN\_CWISE\_PLUGIN** - filename of plugin for extending the Cwise class. * **EIGEN\_DENSEBASE\_PLUGIN** - filename of plugin for extending the [DenseBase](classeigen_1_1densebase "Base class for all dense matrices, vectors, and arrays.") class. * **EIGEN\_DYNAMICSPARSEMATRIX\_PLUGIN** - filename of plugin for extending the DynamicSparseMatrix class. * **EIGEN\_FUNCTORS\_PLUGIN** - filename of plugin for adding new functors and specializations of functor\_traits. * **EIGEN\_MAPBASE\_PLUGIN** - filename of plugin for extending the MapBase class. * **EIGEN\_MATRIX\_PLUGIN** - filename of plugin for extending the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class. * **EIGEN\_MATRIXBASE\_PLUGIN** - filename of plugin for extending the [MatrixBase](classeigen_1_1matrixbase "Base class for all dense matrices, vectors, and expressions.") class. * **EIGEN\_PLAINOBJECTBASE\_PLUGIN** - filename of plugin for extending the [PlainObjectBase](classeigen_1_1plainobjectbase "Dense storage base class for matrices and arrays.") class. * **EIGEN\_QUATERNION\_PLUGIN** - filename of plugin for extending the [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") class. * **EIGEN\_QUATERNIONBASE\_PLUGIN** - filename of plugin for extending the [QuaternionBase](classeigen_1_1quaternionbase "Base class for quaternion expressions.") class. * **EIGEN\_SPARSEMATRIX\_PLUGIN** - filename of plugin for extending the [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation.") class. * **EIGEN\_SPARSEMATRIXBASE\_PLUGIN** - filename of plugin for extending the [SparseMatrixBase](classeigen_1_1sparsematrixbase "Base class of any sparse matrices or sparse expressions.") class. * **EIGEN\_SPARSEVECTOR\_PLUGIN** - filename of plugin for extending the [SparseVector](classeigen_1_1sparsevector "a sparse vector class") class. * **EIGEN\_TRANSFORM\_PLUGIN** - filename of plugin for extending the [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") class. * **EIGEN\_VECTORWISEOP\_PLUGIN** - filename of plugin for extending the [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations.") class. Macros for Eigen developers ============================= These macros are mainly meant for people developing Eigen and for testing purposes. Even though, they might be useful for power users and the curious for debugging and testing purpose, they **should** **not** **be** **used** by real-word code. * **EIGEN\_DEFAULT\_TO\_ROW\_MAJOR** - when defined, the default storage order for matrices becomes row-major instead of column-major. Not defined by default. * **EIGEN\_INTERNAL\_DEBUGGING** - if defined, enables assertions in Eigen's internal routines. This is useful for debugging Eigen itself. Not defined by default. * **EIGEN\_NO\_MALLOC** - if defined, any request from inside the Eigen to allocate memory from the heap results in an assertion failure. This is useful to check that some routine does not allocate memory dynamically. Not defined by default. * **EIGEN\_RUNTIME\_NO\_MALLOC** - if defined, a new switch is introduced which can be turned on and off by calling `set_is_malloc_allowed(bool)`. If malloc is not allowed and Eigen tries to allocate memory dynamically anyway, an assertion failure results. Not defined by default. eigen3 Eigen::NumTraits Eigen::NumTraits ================ ### template<typename T> class Eigen::NumTraits< T > Holds information about the various numeric (i.e. scalar) types allowed by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). Template Parameters | | | | --- | --- | | T | the numeric type at hand | This class stores enums, typedefs and static methods giving information about a numeric type. The provided data consists of: * A typedef `Real`, giving the "real part" type of *T*. If *T* is already real, then `Real` is just a typedef to *T*. If *T* is `std::complex<U>` then `Real` is a typedef to *U*. * A typedef `NonInteger`, giving the type that should be used for operations producing non-integral values, such as quotients, square roots, etc. If *T* is a floating-point type, then this typedef just gives *T* again. Note however that many [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") functions such as internal::sqrt simply refuse to take integers. Outside of a few cases, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") doesn't do automatic type promotion. Thus, this typedef is only intended as a helper for code that needs to explicitly promote types. * A typedef `Literal` giving the type to use for numeric literals such as "2" or "0.5". For instance, for `std::complex<U>`, Literal is defined as `U`. Of course, this type must be fully compatible with *T*. In doubt, just use *T* here. * A typedef *Nested* giving the type to use to nest a value inside of the expression tree. If you don't know what this means, just use *T* here. * An enum value *IsComplex*. It is equal to 1 if *T* is a `std::complex` type, and to 0 otherwise. * An enum value *IsInteger*. It is equal to `1` if *T* is an integer type such as `int`, and to `0` otherwise. * Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. Stay vague here. No need to do architecture-specific stuff. If you don't know what this means, just use `[Eigen::HugeCost](namespaceeigen#a3163430a1c13173faffde69016b48aaf)`. * An enum value *IsSigned*. It is equal to `1` if *T* is a signed type and to 0 if *T* is unsigned. * An enum value *RequireInitialization*. It is equal to `1` if the constructor of the numeric type *T* must be called, and to 0 if it is safe not to call it. Default is 0 if *T* is an arithmetic type, and 1 otherwise. * An epsilon() function which, unlike [std::numeric\_limits::epsilon()](http://en.cppreference.com/w/cpp/types/numeric_limits/epsilon), it returns a *Real* instead of a *T*. * A dummy\_precision() function returning a weak epsilon value. It is mainly used as a default value by the fuzzy comparison operators. * highest() and lowest() functions returning the highest and lowest possible values respectively. * digits() function returning the number of radix digits (non-sign digits for integers, mantissa for floating-point). This is the analogue of [std::numeric\_limits<T>::digits](http://en.cppreference.com/w/cpp/types/numeric_limits/digits) which is used as the default implementation if specialized. * digits10() function returning the number of decimal digits that can be represented without change. This is the analogue of [std::numeric\_limits<T>::digits10](http://en.cppreference.com/w/cpp/types/numeric_limits/digits10) which is used as the default implementation if specialized. * min\_exponent() and max\_exponent() functions returning the highest and lowest possible values, respectively, such that the radix raised to the power exponent-1 is a normalized floating-point number. These are equivalent to [std::numeric\_limits<T>::min\_exponent](http://en.cppreference.com/w/cpp/types/numeric_limits/min_exponent)/ [std::numeric\_limits<T>::max\_exponent](http://en.cppreference.com/w/cpp/types/numeric_limits/max_exponent). * infinity() function returning a representation of positive infinity, if available. * quiet\_NaN function returning a non-signaling "not-a-number", if available. Inherits Eigen::GenericNumTraits< T >. --- The documentation for this class was generated from the following file:* [NumTraits.h](https://eigen.tuxfamily.org/dox/NumTraits_8h_source.html)
programming_docs
eigen3 Slicing and Indexing Slicing and Indexing ==================== This page presents the numerous possibilities offered by `operator()` to index sub-set of rows and columns. This API has been introduced in Eigen 3.4. It supports all the feature proposed by the [block API](group__tutorialblockoperations) , and much more. In particular, it supports **slicing** that consists in taking a set of rows, columns, or elements, uniformly spaced within a matrix or indexed from an array of indices. Overview ========== All the aforementioned operations are handled through the generic DenseBase::operator()(const RowIndices&, const ColIndices&) method. Each argument can be: * An integer indexing a single row or column, including symbolic indices. * The symbol [Eigen::all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14) representing the whole set of respective rows or columns in increasing order. * An [ArithmeticSequence](classeigen_1_1arithmeticsequence) as constructed by the [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969), [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda), or [Eigen::lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77) functions. * Any 1D vector/array of integers including Eigen's vector/array, expressions, std::vector, std::array, as well as plain C arrays: `int[N]`. More generally, it can accepts any object exposing the following two member functions: ``` <integral type> operator[](<integral type>) const; <integral type> size() const; ``` where `<integral type>` stands for any integer type compatible with [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde "The Index type as used for the API.") (i.e. `std::ptrdiff_t`). Basic slicing =============== Taking a set of rows, columns, or elements, uniformly spaced within a matrix or vector is achieved through the [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) or [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) functions where "seq" stands for arithmetic sequence. Their signatures are summarized below: | function | description | example | | --- | --- | --- | | ``` [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(firstIdx,lastIdx) ``` | represents the sequence of integers ranging from `firstIdx` to `lastIdx` | ``` [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(2,5) <=> {2,3,4,5} ``` | | ``` [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(firstIdx,lastIdx,incr) ``` | same but using the increment `incr` to advance from one index to the next | ``` [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(2,8,2) <=> {2,4,6,8} ``` | | ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(firstIdx,size) ``` | represents the sequence of `size` integers starting from `firstIdx` | ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(2,5) <=> {2,3,4,5,6} ``` | | ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(firstIdx,size,incr) ``` | same but using the increment `incr` to advance from one index to the next | ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(2,3,3) <=> {2,5,8} ``` | The `firstIdx` and `lastIdx` parameters can also be defined with the help of the [Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee) symbol representing the index of the last row, column or element of the underlying matrix/vector once the arithmetic sequence is passed to it through operator(). Here are some examples for a 2D array/matrix `A` and a 1D array/vector `v`. | Intent | Code | Block-API equivalence | | --- | --- | --- | | Bottom-left corner starting at row `i` with `n` columns | ``` A([seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(i,[last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)), [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(0,n)) ``` | ``` A.bottomLeftCorner(A.rows()-i,n) ``` | | Block starting at `i`,j having `m` rows, and `n` columns | ``` A([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(i,m), [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(i,n) ``` | ``` A.block(i,j,m,n) ``` | | Block starting at `i0`,j0 and ending at `i1`,j1 | ``` A([seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(i0,i1), [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(j0,j1) ``` | ``` A.block(i0,j0,i1-i0+1,j1-j0+1) ``` | | Even columns of A | ``` A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14), [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(0,[last](group__core__module#ga2dd8b20d08336af23947e054a17415ee),2)) ``` | | | First `n` odd rows A | ``` A([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(1,n,2), [all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)) ``` | | | The last past one column | ``` A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14), [last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-1) ``` | ``` A.col(A.cols()-2) ``` | | The middle row | ``` A([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)/2,[all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)) ``` | ``` A.row((A.rows()-1)/2) ``` | | Last elements of v starting at i | ``` v([seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(i,[last](group__core__module#ga2dd8b20d08336af23947e054a17415ee))) ``` | ``` v.tail(v.size()-i) ``` | | Last `n` elements of v | ``` v([seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)+1-n,[last](group__core__module#ga2dd8b20d08336af23947e054a17415ee))) ``` | ``` v.tail(n) ``` | As seen in the last exemple, referencing the *last n* elements (or rows/columns) is a bit cumbersome to write. This becomes even more tricky and error prone with a non-default increment. Here comes [Eigen::lastN(size)](namespaceeigen#a5564b99b116c725ef571f1a2f859acb1) , and [Eigen::lastN(size,incr)](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77) : | Intent | Code | Block-API equivalence | | --- | --- | --- | | Last `n` elements of v | ``` v([lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(n)) ``` | ``` v.tail(n) ``` | | Bottom-right corner of A of size `m` times `n` | ``` v([lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(m), [lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(n)) ``` | ``` A.bottomRightCorner(m,n) ``` | | Bottom-right corner of A of size `m` times `n` | ``` v([lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(m), [lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(n)) ``` | ``` A.bottomRightCorner(m,n) ``` | | Last `n` columns taking 1 column over 3 | ``` A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14), [lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(n,3)) ``` | | Compile time size and increment ================================= In terms of performance, Eigen and the compiler can take advantage of compile-time size and increment. To this end, you can enforce compile-time parameters using [Eigen::fix<val>](group__core__module#gac01f234bce100e39e6928fdc470e5194). Such compile-time value can be combined with the [Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee) symbol: ``` v([seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-fix<7>, [last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-fix<2>)) ``` In this example Eigen knowns at compile-time that the returned expression has 6 elements. It is equivalent to: ``` v([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-7, fix<6>)) ``` We can revisit the *even columns of A* example as follows: ``` A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14), [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(0,[last](group__core__module#ga2dd8b20d08336af23947e054a17415ee),fix<2>)) ``` Reverse order =============== Row/column indices can also be enumerated in decreasing order using a negative increment. For instance, one over two columns of A from the column 20 to 10: ``` A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14), [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(20, 10, fix<-2>)) ``` The last `n` rows starting from the last one: ``` A([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee), n, fix<-1>), [all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)) ``` You can also use the ArithmeticSequence::reverse() method to reverse its order. The previous example can thus also be written as: ``` A([lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(n).reverse(), [all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14)) ``` Array of indices ================== The generic `operator()` can also takes as input an arbitrary list of row or column indices stored as either an `ArrayXi`, a `std::vector<int>`, `std::array<int,N>`, etc. | Example: | Output: | | --- | --- | | ``` std::vector<int> ind{4,2,5,5,3}; MatrixXi A = [MatrixXi::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,6); cout << "Initial matrix A:\n" << A << "\n\n"; cout << "A(all,ind):\n" << A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14),ind) << "\n\n"; ``` | ``` Initial matrix A: 7 9 -5 -3 3 -10 -2 -6 1 0 5 -5 6 -3 0 9 -8 -8 6 6 3 9 2 6 A(all,ind): 3 -5 -10 -10 -3 5 1 -5 -5 0 -8 0 -8 -8 9 2 3 6 6 9 ``` | You can also directly pass a static array: | Example: | Output: | | --- | --- | | ``` #if EIGEN\_HAS\_STATIC\_ARRAY\_TEMPLATE MatrixXi A = [MatrixXi::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,6); cout << "Initial matrix A:\n" << A << "\n\n"; cout << "A(all,{4,2,5,5,3}):\n" << A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14),{4,2,5,5,3}) << "\n\n"; #endif ``` | ``` Initial matrix A: 7 9 -5 -3 3 -10 -2 -6 1 0 5 -5 6 -3 0 9 -8 -8 6 6 3 9 2 6 A(all,{4,2,5,5,3}): 3 -5 -10 -10 -3 5 1 -5 -5 0 -8 0 -8 -8 9 2 3 6 6 9 ``` | or expressions: | Example: | Output: | | --- | --- | | ``` ArrayXi ind(5); ind<<4,2,5,5,3; MatrixXi A = [MatrixXi::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,6); cout << "Initial matrix A:\n" << A << "\n\n"; cout << "A(all,ind-1):\n" << A([all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14),ind-1) << "\n\n"; ``` | ``` Initial matrix A: 7 9 -5 -3 3 -10 -2 -6 1 0 5 -5 6 -3 0 9 -8 -8 6 6 3 9 2 6 A(all,ind-1): -3 9 3 3 -5 0 -6 5 5 1 9 -3 -8 -8 0 9 6 2 2 3 ``` | When passing an object with a compile-time size such as `Array4i`, `std::array<int,N>`, or a static array, then the returned expression also exhibit compile-time dimensions. Custom index list =================== More generally, `operator()` can accept as inputs any object `ind` of type `T` compatible with: ``` [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) s = ind.size(); or [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) s = size(ind); [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i; i = ind[i]; ``` This means you can easily build your own fancy sequence generator and pass it to `operator()`. Here is an exemple enlarging a given matrix while padding the additional first rows and columns through repetition: | Example: | Output: | | --- | --- | | ``` struct pad { [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) size() const { return out_size; } [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) operator[] ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) const { return std::max<Index>(0,i-(out_size-in_size)); } [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) in_size, out_size; }; Matrix3i A; A.reshaped() = [VectorXi::LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d)(9,1,9); cout << "Initial matrix A:\n" << A << "\n\n"; MatrixXi B(5,5); B = A(pad{3,5}, pad{3,5}); cout << "A(pad{3,N}, pad{3,N}):\n" << B << "\n\n"; ``` | ``` Initial matrix A: 1 4 7 2 5 8 3 6 9 A(pad{3,N}, pad{3,N}): 1 1 1 4 7 1 1 1 4 7 1 1 1 4 7 2 2 2 5 8 3 3 3 6 9 ``` | eigen3 Core module Core module =========== This is the main module of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") providing dense matrix and vector support (both fixed and dynamic size) with all the features corresponding to a BLAS library and much more... ``` #include <Eigen/Core> ``` | | | --- | | | | | [Global array typedefs](group__arraytypedefs) | | | | | [Global matrix typedefs](group__matrixtypedefs) | | | | | [Flags](group__flags) | | | | | [Enumerations](group__enums) | | | | | | --- | | | | class | [Eigen::aligned\_allocator< T >](classeigen_1_1aligned__allocator) | | | STL compatible allocator to use with types requiring a non standrad alignment. [More...](classeigen_1_1aligned__allocator#details) | | | | class | [Eigen::ArithmeticSequence< FirstType, SizeType, IncrType >](classeigen_1_1arithmeticsequence) | | | | class | [Eigen::Array< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >](classeigen_1_1array) | | | General-purpose arrays with easy API for coefficient-wise operations. [More...](classeigen_1_1array#details) | | | | class | [Eigen::ArrayBase< Derived >](classeigen_1_1arraybase) | | | Base class for all 1D and 2D array, and related expressions. [More...](classeigen_1_1arraybase#details) | | | | class | [Eigen::ArrayWrapper< ExpressionType >](classeigen_1_1arraywrapper) | | | Expression of a mathematical vector or matrix as an array object. [More...](classeigen_1_1arraywrapper#details) | | | | class | [Eigen::symbolic::BaseExpr< Derived >](classeigen_1_1symbolic_1_1baseexpr) | | | | class | [Eigen::Block< XprType, BlockRows, BlockCols, InnerPanel >](classeigen_1_1block) | | | Expression of a fixed-size or dynamic-size block. [More...](classeigen_1_1block#details) | | | | class | [Eigen::CommaInitializer< XprType >](structeigen_1_1commainitializer) | | | Helper class used by the comma initializer operator. [More...](structeigen_1_1commainitializer#details) | | | | class | [Eigen::CwiseBinaryOp< BinaryOp, LhsType, RhsType >](classeigen_1_1cwisebinaryop) | | | Generic expression where a coefficient-wise binary operator is applied to two expressions. [More...](classeigen_1_1cwisebinaryop#details) | | | | class | [Eigen::CwiseNullaryOp< NullaryOp, PlainObjectType >](classeigen_1_1cwisenullaryop) | | | Generic expression of a matrix where all coefficients are defined by a functor. [More...](classeigen_1_1cwisenullaryop#details) | | | | class | [Eigen::CwiseTernaryOp< TernaryOp, Arg1Type, Arg2Type, Arg3Type >](classeigen_1_1cwiseternaryop) | | | Generic expression where a coefficient-wise ternary operator is applied to two expressions. [More...](classeigen_1_1cwiseternaryop#details) | | | | class | [Eigen::CwiseUnaryOp< UnaryOp, XprType >](classeigen_1_1cwiseunaryop) | | | Generic expression where a coefficient-wise unary operator is applied to an expression. [More...](classeigen_1_1cwiseunaryop#details) | | | | class | [Eigen::CwiseUnaryView< ViewOp, MatrixType >](classeigen_1_1cwiseunaryview) | | | Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector. [More...](classeigen_1_1cwiseunaryview#details) | | | | class | [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | | Base class for all dense matrices, vectors, and arrays. [More...](classeigen_1_1densebase#details) | | | | class | [Eigen::DenseCoeffsBase< Derived, DirectAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4) | | | Base class providing direct read-only coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#details) | | | | class | [Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | | Base class providing direct read/write coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#details) | | | | class | [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | | Base class providing read-only coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#details) | | | | class | [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | | Base class providing read/write coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#details) | | | | class | [Eigen::Diagonal< MatrixType, \_DiagIndex >](classeigen_1_1diagonal) | | | Expression of a diagonal/subdiagonal/superdiagonal in a matrix. [More...](classeigen_1_1diagonal#details) | | | | class | [Eigen::DiagonalMatrix< \_Scalar, SizeAtCompileTime, MaxSizeAtCompileTime >](classeigen_1_1diagonalmatrix) | | | Represents a diagonal matrix with its storage. [More...](classeigen_1_1diagonalmatrix#details) | | | | class | [Eigen::DiagonalWrapper< \_DiagonalVectorType >](classeigen_1_1diagonalwrapper) | | | Expression of a diagonal matrix. [More...](classeigen_1_1diagonalwrapper#details) | | | | class | [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | | | class | [Eigen::ForceAlignedAccess< ExpressionType >](classeigen_1_1forcealignedaccess) | | | Enforce aligned packet loads and stores regardless of what is requested. [More...](classeigen_1_1forcealignedaccess#details) | | | | class | [Eigen::IndexedView< XprType, RowIndices, ColIndices >](classeigen_1_1indexedview) | | | Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices. [More...](classeigen_1_1indexedview#details) | | | | class | [Eigen::IOFormat](structeigen_1_1ioformat) | | | Stores a set of parameters controlling the way matrices are printed. [More...](structeigen_1_1ioformat#details) | | | | class | [Eigen::Map< PlainObjectType, MapOptions, StrideType >](classeigen_1_1map) | | | A matrix or vector expression mapping an existing array of data. [More...](classeigen_1_1map#details) | | | | class | [Eigen::MapBase< Derived, ReadOnlyAccessors >](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4) | | | Base class for dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") expression with direct access. [More...](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#details) | | | | class | [Eigen::MapBase< Derived, WriteAccessors >](classeigen_1_1mapbase_3_01derived_00_01writeaccessors_01_4) | | | Base class for non-const dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") expression with direct access. [More...](classeigen_1_1mapbase_3_01derived_00_01writeaccessors_01_4#details) | | | | class | [Eigen::Matrix< \_Scalar, \_Rows, \_Cols, \_Options, \_MaxRows, \_MaxCols >](classeigen_1_1matrix) | | | The matrix class, also used for vectors and row-vectors. [More...](classeigen_1_1matrix#details) | | | | class | [Eigen::MatrixBase< Derived >](classeigen_1_1matrixbase) | | | Base class for all dense matrices, vectors, and expressions. [More...](classeigen_1_1matrixbase#details) | | | | class | [Eigen::MatrixWrapper< ExpressionType >](classeigen_1_1matrixwrapper) | | | Expression of an array as a mathematical vector or matrix. [More...](classeigen_1_1matrixwrapper#details) | | | | class | [Eigen::NestByValue< ExpressionType >](classeigen_1_1nestbyvalue) | | | Expression which must be nested by value. [More...](classeigen_1_1nestbyvalue#details) | | | | class | [Eigen::NoAlias< ExpressionType, StorageBase >](classeigen_1_1noalias) | | | Pseudo expression providing an operator = assuming no aliasing. [More...](classeigen_1_1noalias#details) | | | | class | [Eigen::NumTraits< T >](structeigen_1_1numtraits) | | | Holds information about the various numeric (i.e. scalar) types allowed by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). [More...](structeigen_1_1numtraits#details) | | | | class | [Eigen::PartialReduxExpr< MatrixType, MemberOp, Direction >](classeigen_1_1partialreduxexpr) | | | Generic expression of a partially reduxed matrix. [More...](classeigen_1_1partialreduxexpr#details) | | | | class | [Eigen::PermutationBase< Derived >](classeigen_1_1permutationbase) | | | Base class for permutations. [More...](classeigen_1_1permutationbase#details) | | | | class | [Eigen::PermutationMatrix< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >](classeigen_1_1permutationmatrix) | | | Permutation matrix. [More...](classeigen_1_1permutationmatrix#details) | | | | class | [Eigen::PermutationWrapper< \_IndicesType >](classeigen_1_1permutationwrapper) | | | Class to view a vector of integers as a permutation matrix. [More...](classeigen_1_1permutationwrapper#details) | | | | class | [Eigen::PlainObjectBase< Derived >](classeigen_1_1plainobjectbase) | | | Dense storage base class for matrices and arrays. [More...](classeigen_1_1plainobjectbase#details) | | | | class | [Eigen::Product< \_Lhs, \_Rhs, Option >](classeigen_1_1product) | | | Expression of the product of two arbitrary matrices or vectors. [More...](classeigen_1_1product#details) | | | | class | [Eigen::Ref< PlainObjectType, Options, StrideType >](classeigen_1_1ref) | | | A matrix or vector expression mapping an existing expression. [More...](classeigen_1_1ref#details) | | | | class | [Eigen::Replicate< MatrixType, RowFactor, ColFactor >](classeigen_1_1replicate) | | | Expression of the multiple replication of a matrix or vector. [More...](classeigen_1_1replicate#details) | | | | class | [Eigen::Reshaped< XprType, Rows, Cols, Order >](classeigen_1_1reshaped) | | | Expression of a fixed-size or dynamic-size reshape. [More...](classeigen_1_1reshaped#details) | | | | class | [Eigen::Reverse< MatrixType, Direction >](classeigen_1_1reverse) | | | Expression of the reverse of a vector or matrix. [More...](classeigen_1_1reverse#details) | | | | class | [Eigen::ScalarBinaryOpTraits< ScalarA, ScalarB, BinaryOp >](structeigen_1_1scalarbinaryoptraits) | | | Determines whether the given binary operation of two numeric types is allowed and what the scalar return type is. [More...](structeigen_1_1scalarbinaryoptraits#details) | | | | class | [Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >](classeigen_1_1select) | | | Expression of a coefficient wise version of the C++ ternary operator ?: [More...](classeigen_1_1select#details) | | | | class | [Eigen::SelfAdjointView< \_MatrixType, UpLo >](classeigen_1_1selfadjointview) | | | Expression of a selfadjoint matrix from a triangular part of a dense matrix. [More...](classeigen_1_1selfadjointview#details) | | | | class | [Eigen::Solve< Decomposition, RhsType >](classeigen_1_1solve) | | | Pseudo expression representing a solving operation. [More...](classeigen_1_1solve#details) | | | | class | [Eigen::Stride< \_OuterStrideAtCompileTime, \_InnerStrideAtCompileTime >](classeigen_1_1stride) | | | Holds strides information for [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."). [More...](classeigen_1_1stride#details) | | | | class | [Eigen::Transpose< MatrixType >](classeigen_1_1transpose) | | | Expression of the transpose of a matrix. [More...](classeigen_1_1transpose#details) | | | | class | [Eigen::Transpositions< SizeAtCompileTime, MaxSizeAtCompileTime, \_StorageIndex >](classeigen_1_1transpositions) | | | Represents a sequence of transpositions (row/column interchange) [More...](classeigen_1_1transpositions#details) | | | | class | [Eigen::TriangularBase< Derived >](classeigen_1_1triangularbase) | | | Base class for triangular part in a matrix. [More...](classeigen_1_1triangularbase#details) | | | | class | [Eigen::TriangularView< \_MatrixType, \_Mode >](classeigen_1_1triangularview) | | | Expression of a triangular part in a matrix. [More...](classeigen_1_1triangularview#details) | | | | class | [Eigen::TriangularViewImpl< \_MatrixType, \_Mode, Dense >](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4) | | | Base class for a triangular part in a **dense** matrix. [More...](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#details) | | | | class | [Eigen::VectorBlock< VectorType, Size >](classeigen_1_1vectorblock) | | | Expression of a fixed-size or dynamic-size sub-vector. [More...](classeigen_1_1vectorblock#details) | | | | class | [Eigen::VectorwiseOp< ExpressionType, Direction >](classeigen_1_1vectorwiseop) | | | Pseudo expression providing broadcasting and partial reduction operations. [More...](classeigen_1_1vectorwiseop#details) | | | | class | [Eigen::WithFormat< ExpressionType >](classeigen_1_1withformat) | | | Pseudo expression providing matrix output with given format. [More...](classeigen_1_1withformat#details) | | | | | | --- | | | | template<int N> | | static const auto | [Eigen::fix](group__core__module#gac01f234bce100e39e6928fdc470e5194) () | | | | template<int N> | | static const auto | [Eigen::fix](group__core__module#ga3ce50da8ca83238949c06afce1a4f3c7) (int val) | | | | | | --- | | | | static const Eigen::internal::all\_t | [Eigen::all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14) | | | | static const [symbolic::SymbolExpr](classeigen_1_1symbolic_1_1symbolexpr)< internal::symbolic\_last\_tag > | [Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee) | | | | static const auto | [Eigen::lastp1](group__core__module#ga662ffa801d746b972453080c648765f9) | | | fix() [1/2] ----------- template<int N> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Eigen::fix< N > | ( | | ) | | | static | This *identifier* permits to construct an object embedding a compile-time integer `N`. Template Parameters | | | | --- | --- | | N | the compile-time integer value | It is typically used in conjunction with the [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) and [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) functions to pass compile-time values to them: ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(10,fix<4>,fix<-3>) // <=> [10 7 4 1] ``` See also the function [fix(int)](group__core__module#ga3ce50da8ca83238949c06afce1a4f3c7) to pass both a compile-time and runtime value. In c++14, it is implemented as: ``` template<int N> static const internal::FixedInt<N> [fix](group__core__module#gac01f234bce100e39e6928fdc470e5194){}; ``` where internal::FixedInt<N> is an internal template class similar to [`std::integral_constant`](http://en.cppreference.com/w/cpp/types/integral_constant) `<int,N>` Here, `fix<N>` is thus an object of type `internal::FixedInt<N>`. In c++98/11, it is implemented as a function: ``` template<int N> inline internal::FixedInt<N> [fix](group__core__module#gac01f234bce100e39e6928fdc470e5194)(); ``` Here internal::FixedInt<N> is thus a pointer to function. If for some reason you want a true object in c++98 then you can write: ``` fix<N>() ``` which is also valid in c++14. See also [fix<N>(int)](group__core__module#ga3ce50da8ca83238949c06afce1a4f3c7), [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969), [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) fix() [2/2] ----------- template<int N> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Eigen::fix< N > | ( | int | *val* | ) | | | static | This function returns an object embedding both a compile-time integer `N`, and a fallback runtime value *val*. Template Parameters | | | | --- | --- | | N | the compile-time integer value | Parameters | | | | --- | --- | | val | the fallback runtime integer value | This function is a more general version of the [fix](group__core__module#gac01f234bce100e39e6928fdc470e5194) identifier/function that can be used in template code where the compile-time value could turn out to actually mean "undefined at compile-time". For positive integers such as a size or a dimension, this case is identified by [Eigen::Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), whereas runtime signed integers (e.g., an increment/stride) are identified as [Eigen::DynamicIndex](namespaceeigen#a73c597189a4a99127175e8167c456fff). In such a case, the runtime value *val* will be used as a fallback. A typical use case would be: ``` template<typename Derived> void foo(const MatrixBase<Derived> &mat) { const int N = Derived::RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) : Derived::RowsAtCompileTime/2; const int n = mat.rows()/2; ... mat( [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(0,fix<N>(n) ) ...; } ``` In this example, the function [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) knows that the second argument is expected to be a size. If the passed compile-time value N equals [Eigen::Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), then the proxy object returned by fix will be dissmissed, and converted to an [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde "The Index type as used for the API.") of value `n`. Otherwise, the runtime-value `n` will be dissmissed, and the returned [ArithmeticSequence](classeigen_1_1arithmeticsequence) will be of the exact same type as `seqN(0,fix<N>)` . See also [fix](group__core__module#gac01f234bce100e39e6928fdc470e5194), [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda), class [ArithmeticSequence](classeigen_1_1arithmeticsequence) all --- | | | | | --- | --- | --- | | | | | --- | | Eigen::all | | static | Can be used as a parameter to DenseBase::operator()(const RowIndices&, const ColIndices&) to index all rows or columns last ---- | | | | | --- | --- | --- | | | | | --- | | Eigen::last | | static | Can be used as a parameter to [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) and [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) functions to symbolically reference the last element/row/columns of the underlying vector or matrix once passed to DenseBase::operator()(const RowIndices&, const ColIndices&). This symbolic placeholder supports standard arithmetic operations. A typical usage example would be: ``` using namespace [Eigen](namespaceeigen); using [Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee); VectorXd v(n); v([seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)(2,[last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-2)).setOnes(); ``` See also end lastp1 ------ | | | | | --- | --- | --- | | | | | --- | | Eigen::lastp1 | | static | Can be used as a parameter to [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) and [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) functions to symbolically reference the last+1 element/row/columns of the underlying vector or matrix once passed to DenseBase::operator()(const RowIndices&, const ColIndices&). This symbolic placeholder supports standard arithmetic operations. It is essentially an alias to last+fix<1>. See also [last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)
programming_docs
eigen3 Eigen::Select Eigen::Select ============= ### template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType> class Eigen::Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType > Expression of a coefficient wise version of the C++ ternary operator ?: Parameters | | | | --- | --- | | ConditionMatrixType | the type of the *condition* expression which must be a boolean matrix | | ThenMatrixType | the type of the *then* expression | | ElseMatrixType | the type of the *else* expression | This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. It is the return type of [DenseBase::select()](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) and most of the time this is the only way it is used. See also [DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) Inherits internal::dense\_xpr\_base::type, and Eigen::internal::no\_assignment\_operator. --- The documentation for this class was generated from the following file:* [Select.h](https://eigen.tuxfamily.org/dox/Select_8h_source.html) eigen3 Eigen::SparseMatrix Eigen::SparseMatrix =================== ### template<typename \_Scalar, int \_Options, typename \_StorageIndex> class Eigen::SparseMatrix< \_Scalar, \_Options, \_StorageIndex > A versatible sparse matrix representation. This class implements a more versatile variants of the common *compressed* row/column storage format. Each colmun's (resp. row) non zeros are stored as a pair of value with associated row (resp. colmiun) index. All the non zeros are stored in a single large buffer. Unlike the *compressed* format, there might be extra space in between the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero can be done with limited memory reallocation and copies. A call to the function [makeCompressed()](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd) turns the matrix into the standard *compressed* format compatible with many library. More details on this storage sceheme are given in the [manual pages](group__tutorialsparse). Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e. the type of the coefficients | | \_Options | Union of bit flags controlling the storage scheme. Currently the only possibility is ColMajor or RowMajor. The default is 0 which means column-major. | | \_StorageIndex | the type of the indices. It has to be a **signed** type (e.g., short, int, std::ptrdiff\_t). Default is `int`. | Warning In Eigen 3.2, the undocumented type `[SparseMatrix::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02 "The interface type of indices.")` was improperly defined as the storage index type (e.g., int), whereas it is now (starting from Eigen 3.3) deprecated and always defined as [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde "The Index type as used for the API."). Codes making use of `[SparseMatrix::Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02 "The interface type of indices.")`, might thus likely have to be changed to use `[SparseMatrix::StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)` instead. This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_SPARSEMATRIX_PLUGIN`. | | | --- | | | | Scalar | [coeff](classeigen_1_1sparsematrix#a54adf6aa526045f37e67e352da8fd105) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) const | | | | Scalar & | [coeffRef](classeigen_1_1sparsematrix#a013197b3f598968ff37ed8c97087f1ef) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [cols](classeigen_1_1sparsematrix#aa391750e3c530227e4a5c3c52e959975) () const | | | | void | [conservativeResize](classeigen_1_1sparsematrix#a9dc538b2c1fe9027ba58f31ee83b2ff1) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [rows](classeigen_1_1sparsematrix#a62e61bb861eee306d5b069ce652b5aa5), [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [cols](classeigen_1_1sparsematrix#aa391750e3c530227e4a5c3c52e959975)) | | | | [DiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1sparsematrix#af83005640c2771ebd69f98848720ee52) () | | | | const [ConstDiagonalReturnType](classeigen_1_1diagonal) | [diagonal](classeigen_1_1sparsematrix#a4423486f9fd64cbac7be06c748b37e0a) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsematrix#a8e9ef5d399d36fdd860ad05cb7a31455) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsematrix#ae7b804bd39745156d20ca1611a296b67) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsematrix#a00efb5c30c29bbc826d156d97e60d870) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsematrix#a218204b051a24f579c394454786eeda0) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [innerSize](classeigen_1_1sparsematrix#a0f42824d4a06ee1d1f6afbc4551c5896) () const | | | | Scalar & | [insert](classeigen_1_1sparsematrix#aae45e3b5fec7f6a0cdd10eec7c6d3666) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) | | | | bool | [isCompressed](classeigen_1_1sparsematrix#a837934b33a80fe996ff20500373d3a61) () const | | | | void | [makeCompressed](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd) () | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [nonZeros](classeigen_1_1sparsematrix#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsematrix#a9451af2795c1a5b97678272475e41422) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsematrix#a75506964d86d6badb32d0b4917acf2e2) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [outerSize](classeigen_1_1sparsematrix#a4e5f706cfae14d2eaec1ea1e234905f1) () const | | | | template<typename KeepFunc > | | void | [prune](classeigen_1_1sparsematrix#a0e5f8cc59ee57207f0cff6b142bcdd0d) (const KeepFunc &keep=KeepFunc()) | | | | void | [prune](classeigen_1_1sparsematrix#a08af03b2fc6c371c8be4fcd62509288c) (const Scalar &reference, const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< RealScalar >::dummy\_precision()) | | | | template<class SizesType > | | void | [reserve](classeigen_1_1sparsematrix#ac2b219eb36fbab0bfae535cfbfc74a76) (const SizesType &reserveSizes) | | | | void | [reserve](classeigen_1_1sparsematrix#a1518e58ac49bed0e2385b722a034f7d3) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) reserveSize) | | | | void | [resize](classeigen_1_1sparsematrix#af88551f30202341b7cc24cfadabdec5c) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [rows](classeigen_1_1sparsematrix#a62e61bb861eee306d5b069ce652b5aa5), [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [cols](classeigen_1_1sparsematrix#aa391750e3c530227e4a5c3c52e959975)) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [rows](classeigen_1_1sparsematrix#a62e61bb861eee306d5b069ce652b5aa5) () const | | | | template<typename InputIterators > | | void | [setFromTriplets](classeigen_1_1sparsematrix#acc35051d698e3973f1de5b9b78dbe345) (const InputIterators &begin, const InputIterators &end) | | | | template<typename InputIterators , typename DupFunctor > | | void | [setFromTriplets](classeigen_1_1sparsematrix#ad3eee2d3d2a9843cd095c0207f781e7e) (const InputIterators &begin, const InputIterators &end, DupFunctor dup\_func) | | | | void | [setIdentity](classeigen_1_1sparsematrix#a89013d2aa58413672c90932607a0d6f0) () | | | | void | [setZero](classeigen_1_1sparsematrix#ad3c7416090f913e8685523cb3ab7c2f7) () | | | | | [SparseMatrix](classeigen_1_1sparsematrix#a68087ee333c9614ea28850ec52069079) () | | | | template<typename OtherDerived > | | | [SparseMatrix](classeigen_1_1sparsematrix#a1c6fde42fd40e6f753b60f71e8fd88aa) (const DiagonalBase< OtherDerived > &other) | | | Copy constructor with in-place evaluation. | | | | template<typename OtherDerived > | | | [SparseMatrix](classeigen_1_1sparsematrix#a4e328e4686980219c2b4d2a932670ab0) (const ReturnByValue< OtherDerived > &other) | | | Copy constructor with in-place evaluation. | | | | | [SparseMatrix](classeigen_1_1sparsematrix#af0fa64cdba1f30353aac937a31db33f3) (const [SparseMatrix](classeigen_1_1sparsematrix) &other) | | | | template<typename OtherDerived > | | | [SparseMatrix](classeigen_1_1sparsematrix#a501a50f0d7d58dc4c1d990cd912f581f) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) | | | | template<typename OtherDerived , unsigned int UpLo> | | | [SparseMatrix](classeigen_1_1sparsematrix#aa755e8ba4ec4a2e39ebdb658228364e5) (const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< OtherDerived, UpLo > &other) | | | | | [SparseMatrix](classeigen_1_1sparsematrix#a6abf1015a0243be97648e106a17b01ea) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [rows](classeigen_1_1sparsematrix#a62e61bb861eee306d5b069ce652b5aa5), [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [cols](classeigen_1_1sparsematrix#aa391750e3c530227e4a5c3c52e959975)) | | | | Scalar | [sum](classeigen_1_1sparsematrix#a0700cd0b8658962d742fa51a5e594a2f) () const | | | | void | [swap](classeigen_1_1sparsematrix#ae9b9ad3524f87276511397d988b7a607) ([SparseMatrix](classeigen_1_1sparsematrix) &other) | | | | void | [uncompress](classeigen_1_1sparsematrix#a7e560ebda035e992d2c99875cc7c3af3) () | | | | Scalar \* | [valuePtr](classeigen_1_1sparsematrix#ac2684952b14b5c9b0f68ae3bb8c517a6) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsematrix#a9d4354d3f4d121d764bbed33cac05329) () const | | | | | [~SparseMatrix](classeigen_1_1sparsematrix#a36835ee4f8e5f273087910ec8063a4f6) () | | | | Public Member Functions inherited from [Eigen::SparseCompressedBase< SparseMatrix< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsecompressedbase) | | [Map](classeigen_1_1map)< [Array](classeigen_1_1array)< Scalar, Dynamic, 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a7cf299e08d2a4f6d6869e631e51b12fe) () | | | | const [Map](classeigen_1_1map)< const [Array](classeigen_1_1array)< Scalar, Dynamic, 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a101b155485ae59ea1261c4f6040f3dc4) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#aa64818e1aa43015dad01b114b2ab4687) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#a411e972b097e6aef225415a4c2d0a0b5) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#afc056a3895eae1a4c4767252ff04966a) () const | | | | bool | [isCompressed](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsecompressedbase#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a2624d4c2661c582de168246c56e8d71e) () const | | | | Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f44c739398794ea77f310b745cc5627) () const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< SparseMatrix< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | const [Product](classeigen_1_1product)< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >, Upper|Lower > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< Dynamic, Dynamic, [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< SparseMatrix< \_Scalar, \_Options, \_StorageIndex > >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< SparseMatrix< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsematrixbase) | | typedef internal::traits< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< SparseMatrix< \_Scalar, \_Options, \_StorageIndex > >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SparseCompressedBase< SparseMatrix< \_Scalar, \_Options, \_StorageIndex > >](classeigen_1_1sparsecompressedbase) | | | [SparseCompressedBase](classeigen_1_1sparsecompressedbase#af79f020db965367d97eb954fc68d8f99) () | | | SparseMatrix() [1/5] -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[SparseMatrix](classeigen_1_1sparsematrix) | ( | | ) | | | inline | Default constructor yielding an empty `0` `x` `0` matrix SparseMatrix() [2/5] -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[SparseMatrix](classeigen_1_1sparsematrix) | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *cols* | | | ) | | | | inline | Constructs a *rows* `x` *cols* empty matrix SparseMatrix() [3/5] -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[SparseMatrix](classeigen_1_1sparsematrix) | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > & | *other* | ) | | | inline | Constructs a sparse matrix from the sparse expression *other* SparseMatrix() [4/5] -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > template<typename OtherDerived , unsigned int UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[SparseMatrix](classeigen_1_1sparsematrix) | ( | const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< OtherDerived, UpLo > & | *other* | ) | | | inline | Constructs a sparse matrix from the sparse selfadjoint view *other* SparseMatrix() [5/5] -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[SparseMatrix](classeigen_1_1sparsematrix) | ( | const [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > & | *other* | ) | | | inline | Copy constructor (it performs a deep copy) ~SparseMatrix() --------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::~[SparseMatrix](classeigen_1_1sparsematrix) | ( | | ) | | | inline | Destructor coeff() ------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::coeff | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *row*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *col* | | | ) | | const | | inline | Returns the value of the matrix at position *i*, *j* This function returns Scalar(0) if the element is an explicit *zero* coeffRef() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::coeffRef | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *row*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *col* | | | ) | | | | inline | Returns a non-const reference to the value of the matrix at position *i*, *j* If the element does not exist then it is inserted via the [insert(Index,Index)](classeigen_1_1sparsematrix#aae45e3b5fec7f6a0cdd10eec7c6d3666) function which itself turns the matrix into a non compressed form if that was not the case. This is a O(log(nnz\_j)) operation (binary search) plus the cost of [insert(Index,Index)](classeigen_1_1sparsematrix#aae45e3b5fec7f6a0cdd10eec7c6d3666) function if the element does not already exist. cols() ------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::cols | ( | void | | ) | const | | inline | Returns the number of columns of the matrix conservativeResize() -------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::conservativeResize | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *cols* | | | ) | | | | inline | Resizes the matrix to a *rows* x *cols* matrix leaving old values untouched. If the sizes of the matrix are decreased, then the matrix is turned to **uncompressed-mode** and the storage of the out of bounds coefficients is kept and reserved. Call [makeCompressed()](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd) to pack the entries and squeeze extra memory. See also [reserve()](classeigen_1_1sparsematrix#a1518e58ac49bed0e2385b722a034f7d3), [setZero()](classeigen_1_1sparsematrix#ad3c7416090f913e8685523cb3ab7c2f7), [makeCompressed()](classeigen_1_1sparsematrix#a5ff54ffc10296f9466dc81fa888733fd) diagonal() [1/2] ---------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [DiagonalReturnType](classeigen_1_1diagonal) [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::diagonal | ( | | ) | | | inline | Returns a read-write expression of the diagonal coefficients. Warning If the diagonal entries are written, then all diagonal entries **must** already exist, otherwise an assertion will be raised. diagonal() [2/2] ---------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [ConstDiagonalReturnType](classeigen_1_1diagonal) [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::diagonal | ( | | ) | const | | inline | Returns a const expression of the diagonal coefficients. innerIndexPtr() [1/2] --------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::innerIndexPtr | ( | | ) | | | inline | Returns a non-const pointer to the array of inner indices. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsematrix#ac2684952b14b5c9b0f68ae3bb8c517a6), [outerIndexPtr()](classeigen_1_1sparsematrix#a9451af2795c1a5b97678272475e41422) innerIndexPtr() [2/2] --------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::innerIndexPtr | ( | | ) | const | | inline | Returns a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsematrix#ac2684952b14b5c9b0f68ae3bb8c517a6), [outerIndexPtr()](classeigen_1_1sparsematrix#a9451af2795c1a5b97678272475e41422) innerNonZeroPtr() [1/2] ----------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::innerNonZeroPtr | ( | | ) | | | inline | Returns a non-const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 in compressed mode innerNonZeroPtr() [2/2] ----------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::innerNonZeroPtr | ( | | ) | const | | inline | Returns a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries. Warning it returns the null pointer 0 in compressed mode innerSize() ----------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::innerSize | ( | | ) | const | | inline | Returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) insert() -------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | --- | --- | --- | --- | | [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::Scalar & [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::insert | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *row*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *col* | | | ) | | | Returns a reference to a novel non zero coefficient with coordinates *row* x *col*. The non zero coefficient must **not** already exist. If the matrix `*this` is in compressed mode, then `*this` is turned into uncompressed mode while reserving room for 2 x this->[innerSize()](classeigen_1_1sparsematrix#a0f42824d4a06ee1d1f6afbc4551c5896) non zeros if [reserve(Index)](classeigen_1_1sparsematrix#a1518e58ac49bed0e2385b722a034f7d3) has not been called earlier. In this case, the insertion procedure is optimized for a *sequential* insertion mode where elements are assumed to be inserted by increasing outer-indices. If that's not the case, then it is strongly recommended to either use a triplet-list to assemble the matrix, or to first call [reserve(const SizesType &)](classeigen_1_1sparsematrix#ac2b219eb36fbab0bfae535cfbfc74a76) to reserve the appropriate number of non-zero elements per inner vector. Assuming memory has been appropriately reserved, this function performs a sorted insertion in O(1) if the elements of each inner vector are inserted in increasing inner index order, and in O(nnz\_j) for a random insertion. isCompressed() -------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | --- | --- | --- | | | | | --- | | bool [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::isCompressed | | inline | Returns whether `*this` is in compressed form. makeCompressed() ---------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::makeCompressed | ( | | ) | | | inline | Turns the matrix into the *compressed* format. nonZeros() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | --- | --- | --- | | | | | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SparseCompressedBase](classeigen_1_1sparsecompressedbase)< Derived >::nonZeros | | inline | Returns the number of non zero coefficients outerIndexPtr() [1/2] --------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::outerIndexPtr | ( | | ) | | | inline | Returns a non-const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsematrix#ac2684952b14b5c9b0f68ae3bb8c517a6), [innerIndexPtr()](classeigen_1_1sparsematrix#a8e9ef5d399d36fdd860ad05cb7a31455) outerIndexPtr() [2/2] --------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed)\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::outerIndexPtr | ( | | ) | const | | inline | Returns a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries. See also [valuePtr()](classeigen_1_1sparsematrix#ac2684952b14b5c9b0f68ae3bb8c517a6), [innerIndexPtr()](classeigen_1_1sparsematrix#a8e9ef5d399d36fdd860ad05cb7a31455) outerSize() ----------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::outerSize | ( | | ) | const | | inline | Returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) prune() [1/2] ------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > template<typename KeepFunc > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::prune | ( | const KeepFunc & | *keep* = `KeepFunc()` | ) | | | inline | Turns the matrix into compressed format, and suppresses all nonzeros which do not satisfy the predicate *keep*. The functor type *KeepFunc* must implement the following function: ``` bool operator() (const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02)& row, const [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02)& col, const Scalar& value) const; ``` See also prune(Scalar,RealScalar) prune() [2/2] ------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::prune | ( | const Scalar & | *reference*, | | | | const RealScalar & | *epsilon* = `[NumTraits](structeigen_1_1numtraits)<RealScalar>::dummy_precision()` | | | ) | | | | inline | Suppresses all nonzeros which are **much** **smaller** **than** *reference* under the tolerance *epsilon* reserve() [1/2] --------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > template<class SizesType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::reserve | ( | const SizesType & | *reserveSizes* | ) | | | inline | Preallocates *reserveSize*[`j`] non zeros for each column (resp. row) `j`. This function turns the matrix in non-compressed mode. The type `SizesType` must expose the following interface: ``` typedef [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7); const [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7)& operator[](i) const; ``` for `i` in the [0,this->[outerSize()](classeigen_1_1sparsematrix#a4e5f706cfae14d2eaec1ea1e234905f1)[ range. Typical choices include std::vector<int>, Eigen::VectorXi, [Eigen::VectorXi::Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd), etc. reserve() [2/2] --------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::reserve | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *reserveSize* | ) | | | inline | Preallocates *reserveSize* non zeros. Precondition: the matrix must be in compressed mode. resize() -------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::resize | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *rows*, | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *cols* | | | ) | | | | inline | Resizes the matrix to a *rows* x *cols* matrix and initializes it to zero. This function does not free the currently allocated memory. To release as much as memory as possible, call ``` mat.data().squeeze(); ``` after resizing it. See also [reserve()](classeigen_1_1sparsematrix#a1518e58ac49bed0e2385b722a034f7d3), [setZero()](classeigen_1_1sparsematrix#ad3c7416090f913e8685523cb3ab7c2f7) rows() ------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::rows | ( | void | | ) | const | | inline | Returns the number of rows of the matrix setFromTriplets() [1/2] ----------------------- template<typename Scalar , int \_Options, typename \_StorageIndex > template<typename InputIterators > | | | | | | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< Scalar, \_Options, \_StorageIndex >::setFromTriplets | ( | const InputIterators & | *begin*, | | | | const InputIterators & | *end* | | | ) | | | Fill the matrix `*this` with the list of *triplets* defined by the iterator range *begin* - *end*. A *triplet* is a tuple (i,j,value) defining a non-zero element. The input list of triplets does not have to be sorted, and can contains duplicated elements. In any case, the result is a **sorted** and **compressed** sparse matrix where the duplicates have been summed up. This is a *O(n)* operation, with *n* the number of triplet elements. The initial contents of `*this` is destroyed. The matrix `*this` must be properly resized beforehand using the [SparseMatrix(Index,Index)](classeigen_1_1sparsematrix#a6abf1015a0243be97648e106a17b01ea) constructor, or the [resize(Index,Index)](classeigen_1_1sparsematrix#af88551f30202341b7cc24cfadabdec5c) method. The sizes are not extracted from the triplet list. The *InputIterators* value\_type must provide the following interface: ``` Scalar value() const; // the value Scalar row() const; // the row index i Scalar col() const; // the column index j ``` See for instance the [Eigen::Triplet](classeigen_1_1triplet "A small structure to hold a non zero as a triplet (i,j,value).") template class. Here is a typical usage example: ``` typedef Triplet<double> T; std::vector<T> tripletList; tripletList.reserve(estimation_of_entries); for(...) { // ... tripletList.push_back(T(i,j,v_ij)); } SparseMatrixType m([rows](classeigen_1_1sparsematrix#a62e61bb861eee306d5b069ce652b5aa5),[cols](classeigen_1_1sparsematrix#aa391750e3c530227e4a5c3c52e959975)); m.setFromTriplets(tripletList.begin(), tripletList.end()); // m is ready to go! ``` Warning The list of triplets is read multiple times (at least twice). Therefore, it is not recommended to define an abstract iterator over a complex data-structure that would be expensive to evaluate. The triplets should rather be explicitly stored into a std::vector for instance. setFromTriplets() [2/2] ----------------------- template<typename Scalar , int \_Options, typename \_StorageIndex > template<typename InputIterators , typename DupFunctor > | | | | | | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< Scalar, \_Options, \_StorageIndex >::setFromTriplets | ( | const InputIterators & | *begin*, | | | | const InputIterators & | *end*, | | | | DupFunctor | *dup\_func* | | | ) | | | The same as setFromTriplets but when duplicates are met the functor *dup\_func* is applied: ``` value = dup_func(OldValue, NewValue) ``` Here is a C++11 example keeping the latest entry only: ``` mat.setFromTriplets(triplets.begin(), triplets.end(), [] (const Scalar&,const Scalar &b) { return b; }); ``` setIdentity() ------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::setIdentity | ( | | ) | | | inline | Sets \*this to the identity matrix. This function also turns the matrix into compressed mode, and drop any reserved memory. setZero() --------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::setZero | ( | | ) | | | inline | Removes all non zeros but keep allocated memory This function does not free the currently allocated memory. To release as much as memory as possible, call ``` mat.data().squeeze(); ``` after resizing it. See also [resize(Index,Index)](classeigen_1_1sparsematrix#af88551f30202341b7cc24cfadabdec5c), data() sum() ----- template<typename \_Scalar , int \_Options, typename \_Index > | | | --- | | internal::traits< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_Index > >::Scalar [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_Index >::sum | Overloaded for performance swap() ------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::swap | ( | [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > & | *other* | ) | | | inline | Swaps the content of two sparse matrices of the same type. This is a fast operation that simply swaps the underlying pointers and parameters. uncompress() ------------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::uncompress | ( | | ) | | | inline | Turns the matrix into the uncompressed mode valuePtr() [1/2] ---------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::valuePtr | ( | | ) | | | inline | Returns a non-const pointer to the array of values. This function is aimed at interoperability with other libraries. See also [innerIndexPtr()](classeigen_1_1sparsematrix#a8e9ef5d399d36fdd860ad05cb7a31455), [outerIndexPtr()](classeigen_1_1sparsematrix#a9451af2795c1a5b97678272475e41422) valuePtr() [2/2] ---------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Scalar\* [Eigen::SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex >::valuePtr | ( | | ) | const | | inline | Returns a const pointer to the array of values. This function is aimed at interoperability with other libraries. See also [innerIndexPtr()](classeigen_1_1sparsematrix#a8e9ef5d399d36fdd860ad05cb7a31455), [outerIndexPtr()](classeigen_1_1sparsematrix#a9451af2795c1a5b97678272475e41422) --- The documentation for this class was generated from the following files:* [SparseMatrix.h](https://eigen.tuxfamily.org/dox/SparseMatrix_8h_source.html) * [SparseRedux.h](https://eigen.tuxfamily.org/dox/SparseRedux_8h_source.html)
programming_docs
eigen3 Eigen::indexing Eigen::indexing =============== The sole purpose of this namespace is to be able to import all functions and symbols that are expected to be used within operator() for indexing and slicing. If you already imported the whole [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") namespace: ``` using namespace [Eigen](namespaceeigen); ``` then you are already all set. Otherwise, if you don't want/cannot import the whole [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") namespace, the following line: ``` using namespace [Eigen::indexing](namespaceeigen_1_1indexing); ``` is equivalent to: ``` using [Eigen::all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14); using [Eigen::seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969); using [Eigen::seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda); using [Eigen::lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77); // c++11 only using [Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee); using [Eigen::lastp1](group__core__module#ga662ffa801d746b972453080c648765f9); using [Eigen::fix](group__core__module#gac01f234bce100e39e6928fdc470e5194); ``` eigen3 Eigen::BiCGSTAB Eigen::BiCGSTAB =============== ### template<typename \_MatrixType, typename \_Preconditioner> class Eigen::BiCGSTAB< \_MatrixType, \_Preconditioner > A bi conjugate gradient stabilized solver for sparse square problems. This class allows to solve for A.x = b sparse linear problems using a bi conjugate gradient stabilized algorithm. The vectors x and b can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, can be a dense or a sparse matrix. | | \_Preconditioner | the type of the preconditioner. Default is [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.") | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . The maximal number of iterations and tolerance value can be controlled via the [setMaxIterations()](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) and [setTolerance()](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance. The tolerance corresponds to the relative residual error: |Ax-b|/|b| **Performance:** when using sparse matrices, best performance is achied for a row-major sparse matrix format. Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled. See [Eigen and multi-threading](topicmultithreading) for details. This class can be used as the direct solver classes. Here is a typical usage example: ``` int n = 10000; VectorXd x(n), b(n); SparseMatrix<double> A(n,n); /\* ... fill A and b ... \*/ BiCGSTAB<SparseMatrix<double> > solver; solver.compute(A); x = solver.solve(b); std::cout << "#iterations: " << solver.iterations() << std::endl; std::cout << "estimated error: " << solver.error() << std::endl; /\* ... update b ... \*/ x = solver.solve(b); // solve again ``` By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the [solveWithGuess()](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) method. [BiCGSTAB](classeigen_1_1bicgstab "A bi conjugate gradient stabilized solver for sparse square problems.") can also be used in a matrix-free context, see the following [example](group__matrixfreesolverexample) . See also class [SimplicialCholesky](classeigen_1_1simplicialcholesky), [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries."), [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix.") | | | --- | | | | | [BiCGSTAB](classeigen_1_1bicgstab#ae1a0df6ef6e947256c3cb83ce7df7eda) () | | | | template<typename MatrixDerived > | | | [BiCGSTAB](classeigen_1_1bicgstab#a5842afd9566e254bc727de1fd7f46362) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | Public Member Functions inherited from [Eigen::IterativeSolverBase< BiCGSTAB< \_MatrixType, \_Preconditioner > >](classeigen_1_1iterativesolverbase) | | [BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner > & | [analyzePattern](classeigen_1_1iterativesolverbase#a3f684fb41019ca04d97ddc08a0d8be2e) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner > & | [compute](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | RealScalar | [error](classeigen_1_1iterativesolverbase#a117c241af3fb1141ad0916a3cf3157ec) () const | | | | [BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner > & | [factorize](classeigen_1_1iterativesolverbase#a1374b141721629983cd8276b4b87fc58) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1iterativesolverbase#a0d6b459433a316b4f12d48e5c80d61fe) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [iterations](classeigen_1_1iterativesolverbase#ae778dd098bd5e6655625b20b1e9f15da) () const | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a0922f2be45082690d7734aa6732fc493) () | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a3c68fe3cd929ea1ff8a0d4cbcd65ebad) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [maxIterations](classeigen_1_1iterativesolverbase#a168a74c8dceb6233b220031fdd756ba0) () const | | | | Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a5e88f2a323a2900205cf807af94f8051) () | | | | const Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a709a056e17c49b5272e4971bc376cbe4) () const | | | | [BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner > & | [setMaxIterations](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) maxIters) | | | | [BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner > & | [setTolerance](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) (const RealScalar &[tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62)) | | | | const [SolveWithGuess](classeigen_1_1solvewithguess)< [BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner >, Rhs, Guess > | [solveWithGuess](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b, const Guess &x0) const | | | | RealScalar | [tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62) () const | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | BiCGSTAB() [1/2] ---------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner >::[BiCGSTAB](classeigen_1_1bicgstab) | ( | | ) | | | inline | Default constructor. BiCGSTAB() [2/2] ---------------- template<typename \_MatrixType , typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::BiCGSTAB](classeigen_1_1bicgstab)< \_MatrixType, \_Preconditioner >::[BiCGSTAB](classeigen_1_1bicgstab) | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. --- The documentation for this class was generated from the following file:* [BiCGSTAB.h](https://eigen.tuxfamily.org/dox/BiCGSTAB_8h_source.html) eigen3 Eigen::PermutationStorage Eigen::PermutationStorage ========================= The type used to identify a permutation storage. --- The documentation for this struct was generated from the following file:* [Constants.h](https://eigen.tuxfamily.org/dox/Constants_8h_source.html) eigen3 Inplace matrix decompositions Inplace matrix decompositions ============================= Starting from Eigen 3.3, the LU, Cholesky, and QR decompositions can operate *inplace*, that is, directly within the given input matrix. This feature is especially useful when dealing with huge matrices, and or when the available memory is very limited (embedded systems). To this end, the respective decomposition class must be instantiated with a Ref<> matrix type, and the decomposition object must be constructed with the input matrix as argument. As an example, let us consider an inplace LU decomposition with partial pivoting. Let's start with the basic inclusions, and declaration of a 2x2 matrix `A:` | code | output | | --- | --- | | ``` #include <iostream> #include <Eigen/Dense> using namespace std; using namespace [Eigen](namespaceeigen); int main() { MatrixXd A(2,2); A << 2, -1, 1, 3; cout << "Here is the input matrix A before decomposition:\n" << A << endl; ``` | ``` Here is the input matrix A before decomposition: 2 -1 1 3 ``` | No surprise here! Then, let's declare our inplace LU object `lu`, and check the content of the matrix `A:` | | | | --- | --- | | ``` PartialPivLU<Ref<MatrixXd> > lu(A); cout << "Here is the input matrix A after decomposition:\n" << A << endl; ``` | ``` Here is the input matrix A after decomposition: 2 -1 0.5 3.5 ``` | Here, the `lu` object computes and stores the `L` and `U` factors within the memory held by the matrix `A`. The coefficients of `A` have thus been destroyed during the factorization, and replaced by the L and U factors as one can verify: | | | | --- | --- | | ``` cout << "Here is the matrix storing the L and U factors:\n" << lu.matrixLU() << endl; ``` | ``` Here is the matrix storing the L and U factors: 2 -1 0.5 3.5 ``` | Then, one can use the `lu` object as usual, for instance to solve the Ax=b problem: | | | | --- | --- | | ``` MatrixXd A0(2,2); A0 << 2, -1, 1, 3; VectorXd b(2); b << 1, 2; VectorXd x = lu.solve(b); cout << "Residual: " << (A0 * x - b).norm() << endl; ``` | ``` Residual: 0 ``` | Here, since the content of the original matrix `A` has been lost, we had to declared a new matrix `A0` to verify the result. Since the memory is shared between `A` and `lu`, modifying the matrix `A` will make `lu` invalid. This can easily be verified by modifying the content of `A` and trying to solve the initial problem again: | | | | --- | --- | | ``` A << 3, 4, -2, 1; x = lu.solve(b); cout << "Residual: " << (A0 * x - b).norm() << endl; ``` | ``` Residual: 15.8114 ``` | Note that there is no shared pointer under the hood, it is the **responsibility** **of** **the** **user** to keep the input matrix `A` in life as long as `lu` is living. If one wants to update the factorization with the modified A, one has to call the compute method as usual: | | | | --- | --- | | ``` A0 = A; // save A lu.compute(A); x = lu.solve(b); cout << "Residual: " << (A0 * x - b).norm() << endl; ``` | ``` Residual: 0 ``` | Note that calling compute does not change the memory which is referenced by the `lu` object. Therefore, if the compute method is called with another matrix `A1` different than `A`, then the content of `A1` won't be modified. This is still the content of `A` that will be used to store the L and U factors of the matrix `A1`. This can easily be verified as follows: | | | | --- | --- | | ``` MatrixXd A1(2,2); A1 << 5,-2,3,4; lu.compute(A1); cout << "Here is the input matrix A1 after decomposition:\n" << A1 << endl; ``` | ``` Here is the input matrix A1 after decomposition: 5 -2 3 4 ``` | The matrix `A1` is unchanged, and one can thus solve A1\*x=b, and directly check the residual without any copy of `A1:` | | | | --- | --- | | ``` x = lu.solve(b); cout << "Residual: " << (A1 * x - b).norm() << endl; ``` | ``` Residual: 2.48253e-16 ``` | Here is the list of matrix decompositions supporting this inplace mechanism: * class [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") * class [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") * class [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.") * class [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features.") * class [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix.") * class [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting.") * class [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") * class [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition "Complete orthogonal decomposition (COD) of a matrix.") eigen3 Eigen::PartialReduxExpr Eigen::PartialReduxExpr ======================= ### template<typename MatrixType, typename MemberOp, int Direction> class Eigen::PartialReduxExpr< MatrixType, MemberOp, Direction > Generic expression of a partially reduxed matrix. Template Parameters | | | | --- | --- | | MatrixType | the type of the matrix we are applying the redux operation | | MemberOp | type of the member functor | | Direction | indicates the direction of the redux ([Vertical](group__enums#ggad49a7b3738e273eb00932271b36127f7ae2efac6e74ecab5e3b0b1561c5ddf83e) or [Horizontal](group__enums#ggad49a7b3738e273eb00932271b36127f7a961c62410157b64033839488f4d7f7e4)) | This class represents an expression of a partial redux operator of a matrix. It is the return type of some [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations.") functions, and most of the time this is the only way it is used. See also class [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations.") Inherits internal::dense\_xpr\_base::type, and Eigen::internal::no\_assignment\_operator. --- The documentation for this class was generated from the following file:* [VectorwiseOp.h](https://eigen.tuxfamily.org/dox/VectorwiseOp_8h_source.html) eigen3 Flags Flags ===== These are the possible bits which can be OR'ed to constitute the flags of a matrix or expression. It is important to note that these flags are a purely compile-time notion. They are a compile-time property of an expression type, implemented as enum's. They are not stored in memory at runtime, and they do not incur any runtime overhead. See also [MatrixBase::Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) | | | --- | | | | const unsigned int | [Eigen::ActualPacketAccessBit](group__flags#ga020f88dc24a123b9afbd756c4b220db2) | | | | EIGEN\_DEPRECATED const unsigned int | [Eigen::AlignedBit](group__flags#gac5795adacd266512a26890973503ed88) | | | | const unsigned int | [Eigen::CompressedAccessBit](group__flags#gaed0244284da47a2b8661261431173caf) | | | | const unsigned int | [Eigen::DirectAccessBit](group__flags#gabf1e9d0516a933445a4c307ad8f14915) | | | | EIGEN\_DEPRECATED const unsigned int | [Eigen::EvalBeforeAssigningBit](group__flags#ga0972b20dc004d13984e642b3bd12532e) | | | | const unsigned int | [Eigen::EvalBeforeNestingBit](group__flags#gaa34e83bae46a8eeae4e69ebe3aaecbed) | | | | const unsigned int | [Eigen::LinearAccessBit](group__flags#ga4b983a15d57cd55806df618ac544d09e) | | | | const unsigned int | [Eigen::LvalueBit](group__flags#gae2c323957f20dfdc6cb8f44428eaec1a) | | | | const unsigned int | [Eigen::NoPreferredStorageOrderBit](group__flags#ga3c186ad80ddcf5e2ed3d7ee31cca1860) | | | | const unsigned int | [Eigen::PacketAccessBit](group__flags#ga1a306a438e1ab074e8be59512e887b9f) | | | | const unsigned int | [Eigen::RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) | | | ActualPacketAccessBit --------------------- | | | --- | | const unsigned int Eigen::ActualPacketAccessBit | If vectorization is enabled (EIGEN\_VECTORIZE is defined) this constant is set to the value *PacketAccessBit*. If vectorization is not enabled (EIGEN\_VECTORIZE is not defined) this constant is set to the value 0. AlignedBit ---------- | | | --- | | EIGEN\_DEPRECATED const unsigned int Eigen::AlignedBit | **[Deprecated:](deprecated#_deprecated000009)** means the first coefficient packet is guaranteed to be aligned. An expression cannot have the AlignedBit without the PacketAccessBit flag. In other words, this means we are allow to perform an aligned packet access to the first element regardless of the expression kind: ``` expression.packet<[Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)>(0); ``` CompressedAccessBit ------------------- | | | --- | | const unsigned int Eigen::CompressedAccessBit | Means that the underlying coefficients can be accessed through pointers to the sparse (un)compressed storage format, that is, the expression provides: ``` inline const Scalar* valuePtr() const; inline const [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde)* innerIndexPtr() const; inline const [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde)* outerIndexPtr() const; inline const [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde)* innerNonZeroPtr() const; ``` DirectAccessBit --------------- | | | --- | | const unsigned int Eigen::DirectAccessBit | Means that the underlying array of coefficients can be directly accessed as a plain strided array. The memory layout of the array of coefficients must be exactly the natural one suggested by rows(), cols(), outerStride(), innerStride(), and the RowMajorBit. This rules out expressions such as [Diagonal](classeigen_1_1diagonal "Expression of a diagonal/subdiagonal/superdiagonal in a matrix."), whose coefficients, though referencable, do not have such a regular memory layout. See the comment on LvalueBit for an explanation of how LvalueBit and DirectAccessBit are mutually orthogonal. EvalBeforeAssigningBit ---------------------- | | | --- | | EIGEN\_DEPRECATED const unsigned int Eigen::EvalBeforeAssigningBit | **[Deprecated:](deprecated#_deprecated000008)** means the expression should be evaluated before any assignment EvalBeforeNestingBit -------------------- | | | --- | | const unsigned int Eigen::EvalBeforeNestingBit | means the expression should be evaluated by the calling expression LinearAccessBit --------------- | | | --- | | const unsigned int Eigen::LinearAccessBit | Short version: means the expression can be seen as 1D vector. Long version: means that one can access the coefficients of this expression by coeff(int), and coeffRef(int) in the case of a lvalue expression. These index-based access methods are guaranteed to not have to do any runtime computation of a (row, col)-pair from the index, so that it is guaranteed that whenever it is available, index-based access is at least as fast as (row,col)-based access. Expressions for which that isn't possible don't have the LinearAccessBit. If both PacketAccessBit and LinearAccessBit are set, then the packets of this expression can be accessed by packet(int), and writePacket(int) in the case of a lvalue expression. Typically, all vector expressions have the LinearAccessBit, but there is one exception: [Product](classeigen_1_1product "Expression of the product of two arbitrary matrices or vectors.") expressions don't have it, because it would be troublesome for vectorization, even when the [Product](classeigen_1_1product "Expression of the product of two arbitrary matrices or vectors.") is a vector expression. Thus, vector [Product](classeigen_1_1product "Expression of the product of two arbitrary matrices or vectors.") expressions allow index-based coefficient access but not index-based packet access, so they don't have the LinearAccessBit. LvalueBit --------- | | | --- | | const unsigned int Eigen::LvalueBit | Means the expression has a coeffRef() method, i.e. is writable as its individual coefficients are directly addressable. This rules out read-only expressions. Note that DirectAccessBit and LvalueBit are mutually orthogonal, as there are examples of expression having one but note the other: * writable expressions that don't have a very simple memory layout as a strided array, have LvalueBit but not DirectAccessBit * Map-to-const expressions, for example Map<const Matrix>, have DirectAccessBit but not LvalueBit Expressions having LvalueBit also have their coeff() method returning a const reference instead of returning a new value. NoPreferredStorageOrderBit -------------------------- | | | --- | | const unsigned int Eigen::NoPreferredStorageOrderBit | for an expression, this means that the storage order can be either row-major or column-major. The precise choice will be decided at evaluation time or when combined with other expressions. See also [RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762), [Storage orders](group__topicstorageorders) PacketAccessBit --------------- | | | --- | | const unsigned int Eigen::PacketAccessBit | Short version: means the expression might be vectorized Long version: means that the coefficients can be handled by packets and start at a memory location whose alignment meets the requirements of the present CPU architecture for optimized packet access. In the fixed-size case, there is the additional condition that it be possible to access all the coefficients by packets (this implies the requirement that the size be a multiple of 16 bytes, and that any nontrivial strides don't break the alignment). In the dynamic-size case, there is no such condition on the total size and strides, so it might not be possible to access all coeffs by packets. Note This bit can be set regardless of whether vectorization is actually enabled. To check for actual vectorizability, see *ActualPacketAccessBit*. RowMajorBit ----------- | | | --- | | const unsigned int Eigen::RowMajorBit | for a matrix, this means that the storage order is row-major. If this bit is not set, the storage order is column-major. For an expression, this determines the storage order of the matrix created by evaluation of that expression. See also [Storage orders](group__topicstorageorders)
programming_docs
eigen3 Eigen::aligned_allocator Eigen::aligned\_allocator ========================= ### template<class T> class Eigen::aligned\_allocator< T > STL compatible allocator to use with types requiring a non standrad alignment. The memory is aligned as for dynamically aligned matrix/array types such as MatrixXd. By default, it will thus provide at least 16 bytes alignment and more in following cases: * 32 bytes alignment if AVX is enabled. * 64 bytes alignment if AVX512 is enabled. This can be controlled using the `EIGEN_MAX_ALIGN_BYTES` macro as documented [there](topicpreprocessordirectives#TopicPreprocessorDirectivesPerformance) . Example: ``` // Matrix4f requires 16 bytes alignment: std::map< int, Matrix4f, std::less<int>, aligned_allocator<std::pair<const int, Matrix4f> > > my_map_mat4; // Vector3f does not require 16 bytes alignment, no need to use Eigen's allocator: std::map< int, Vector3f > my_map_vec3; ``` See also [Using STL Containers with Eigen](group__topicstlcontainers). Inherits std::allocator< T >. --- The documentation for this class was generated from the following file:* [Memory.h](https://eigen.tuxfamily.org/dox/Memory_8h_source.html) eigen3 OrderingMethods module OrderingMethods module ====================== This module is currently for internal use only It defines various built-in and external ordering methods for sparse matrices. They are typically used to reduce the number of elements during the sparse matrix decomposition ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features."), LU, QR). Precisely, in a preprocessing step, a permutation matrix P is computed using those ordering methods and applied to the columns of the matrix. Using for instance the sparse Cholesky decomposition, it is expected that the nonzeros elements in LLT(A\*P) will be much smaller than that in LLT(A). Usage : ``` #include <Eigen/OrderingMethods> ``` A simple usage is as a template parameter in the sparse decomposition classes : ``` SparseLU<MatrixType, COLAMDOrdering<int> > solver; ``` ``` SparseQR<MatrixType, COLAMDOrdering<int> > solver; ``` It is possible as well to call directly a particular ordering method for your own purpose, ``` AMDOrdering<int> ordering; PermutationMatrix<Dynamic, Dynamic, int> perm; SparseMatrix<double> A; //Fill the matrix ... ordering(A, perm); // Call AMD ``` Note Some of these methods (like AMD or METIS), need the sparsity pattern of the input matrix to be symmetric. When the matrix is structurally unsymmetric, [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") computes internally the pattern of \(A^T\*A\) before calling the method. If your matrix is already symmetric (at leat in structure), you can avoid that by calling the method with a [SelfAdjointView](classeigen_1_1selfadjointview "Expression of a selfadjoint matrix from a triangular part of a dense matrix.") type. ``` // Call the ordering on the pattern of the lower triangular matrix A ordering(A.selfadjointView<[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749)>(), perm); ``` | | | --- | | | | class | [Eigen::AMDOrdering< StorageIndex >](classeigen_1_1amdordering) | | | | class | [Eigen::COLAMDOrdering< StorageIndex >](classeigen_1_1colamdordering) | | | | class | [Eigen::NaturalOrdering< StorageIndex >](classeigen_1_1naturalordering) | | | eigen3 SparseCholesky module SparseCholesky module ===================== This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. Those decompositions are accessible via the following classes: * SimplicialLLt, * SimplicialLDLt Such problems can also be solved using the [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems.") solver from the IterativeLinearSolvers module. ``` #include <Eigen/SparseCholesky> ``` | | | --- | | | | class | [Eigen::SimplicialCholesky< \_MatrixType, \_UpLo, \_Ordering >](classeigen_1_1simplicialcholesky) | | | | class | [Eigen::SimplicialCholeskyBase< Derived >](classeigen_1_1simplicialcholeskybase) | | | A base class for direct sparse Cholesky factorizations. [More...](classeigen_1_1simplicialcholeskybase#details) | | | | class | [Eigen::SimplicialLDLT< \_MatrixType, \_UpLo, \_Ordering >](classeigen_1_1simplicialldlt) | | | A direct sparse [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") Cholesky factorizations without square root. [More...](classeigen_1_1simplicialldlt#details) | | | | class | [Eigen::SimplicialLLT< \_MatrixType, \_UpLo, \_Ordering >](classeigen_1_1simplicialllt) | | | A direct sparse [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") Cholesky factorizations. [More...](classeigen_1_1simplicialllt#details) | | | eigen3 Eigen::HessenbergDecomposition Eigen::HessenbergDecomposition ============================== ### template<typename \_MatrixType> class Eigen::HessenbergDecomposition< \_MatrixType > Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the Hessenberg decomposition | This class performs an Hessenberg decomposition of a matrix \( A \). In the real case, the Hessenberg decomposition consists of an orthogonal matrix \( Q \) and a Hessenberg matrix \( H \) such that \( A = Q H Q^T \). An orthogonal matrix is a matrix whose inverse equals its transpose ( \( Q^{-1} = Q^T \)). A Hessenberg matrix has zeros below the subdiagonal, so it is almost upper triangular. The Hessenberg decomposition of a complex matrix is \( A = Q H Q^\* \) with \( Q \) unitary (that is, \( Q^{-1} = Q^\* \)). Call the function [compute()](classeigen_1_1hessenbergdecomposition#a239a6fd42c57aab3c0b048c47fde3004 "Computes Hessenberg decomposition of given matrix.") to compute the Hessenberg decomposition of a given matrix. Alternatively, you can use the HessenbergDecomposition(const MatrixType&) constructor which computes the Hessenberg decomposition at construction time. Once the decomposition is computed, you can use the [matrixH()](classeigen_1_1hessenbergdecomposition#a8e781d2e22a2304647bcf0ae913cc8ea "Constructs the Hessenberg matrix H in the decomposition.") and [matrixQ()](classeigen_1_1hessenbergdecomposition#a346441e4902a58d43d698ac3da6ff791 "Reconstructs the orthogonal matrix Q in the decomposition.") functions to construct the matrices H and Q in the decomposition. The documentation for [matrixH()](classeigen_1_1hessenbergdecomposition#a8e781d2e22a2304647bcf0ae913cc8ea "Constructs the Hessenberg matrix H in the decomposition.") contains an example of the typical use of this class. See also class [ComplexSchur](classeigen_1_1complexschur "Performs a complex Schur decomposition of a real or complex square matrix."), class [Tridiagonalization](classeigen_1_1tridiagonalization "Tridiagonal decomposition of a selfadjoint matrix."), [QR Module](group__qr__module) | | | --- | | | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1hessenbergdecomposition#a9420c36226cae7d92da8308a3f97ac2f), SizeMinusOne, 1, Options &~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxSizeMinusOne, 1 > | [CoeffVectorType](classeigen_1_1hessenbergdecomposition#a567f99f3770365777b67bf9832b6fac1) | | | Type for vector of Householder coefficients. [More...](classeigen_1_1hessenbergdecomposition#a567f99f3770365777b67bf9832b6fac1) | | | | typedef [HouseholderSequence](classeigen_1_1householdersequence)< [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f), typename internal::remove\_all< typename CoeffVectorType::ConjugateReturnType >::type > | [HouseholderSequenceType](classeigen_1_1hessenbergdecomposition#a7c1188cd5d8f550c8941df75a50a7d08) | | | Return type of [matrixQ()](classeigen_1_1hessenbergdecomposition#a346441e4902a58d43d698ac3da6ff791 "Reconstructs the orthogonal matrix Q in the decomposition.") | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1hessenbergdecomposition#a8e287ac222f53e2c8ce82faa43e95ac6) | | | | typedef \_MatrixType | [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f) | | | Synonym for the template parameter `_MatrixType`. | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1hessenbergdecomposition#a9420c36226cae7d92da8308a3f97ac2f) | | | Scalar type for matrices of type [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f "Synonym for the template parameter _MatrixType."). | | | | | | --- | | | | template<typename InputType > | | [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition) & | [compute](classeigen_1_1hessenbergdecomposition#a239a6fd42c57aab3c0b048c47fde3004) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Computes Hessenberg decomposition of given matrix. [More...](classeigen_1_1hessenbergdecomposition#a239a6fd42c57aab3c0b048c47fde3004) | | | | template<typename InputType > | | | [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition#acd22602a3e3e5a02f79990ba1e445dc9) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix) | | | Constructor; computes Hessenberg decomposition of given matrix. [More...](classeigen_1_1hessenbergdecomposition#acd22602a3e3e5a02f79990ba1e445dc9) | | | | | [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition#aee1724cb6418ede1a8b9045036a5a319) ([Index](classeigen_1_1hessenbergdecomposition#a8e287ac222f53e2c8ce82faa43e95ac6) size=Size==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 2 :Size) | | | Default constructor; the decomposition will be computed later. [More...](classeigen_1_1hessenbergdecomposition#aee1724cb6418ede1a8b9045036a5a319) | | | | const [CoeffVectorType](classeigen_1_1hessenbergdecomposition#a567f99f3770365777b67bf9832b6fac1) & | [householderCoefficients](classeigen_1_1hessenbergdecomposition#a65fa81ce79d956baa59a30a6d82f8a84) () const | | | Returns the Householder coefficients. [More...](classeigen_1_1hessenbergdecomposition#a65fa81ce79d956baa59a30a6d82f8a84) | | | | MatrixHReturnType | [matrixH](classeigen_1_1hessenbergdecomposition#a8e781d2e22a2304647bcf0ae913cc8ea) () const | | | Constructs the Hessenberg matrix H in the decomposition. [More...](classeigen_1_1hessenbergdecomposition#a8e781d2e22a2304647bcf0ae913cc8ea) | | | | [HouseholderSequenceType](classeigen_1_1hessenbergdecomposition#a7c1188cd5d8f550c8941df75a50a7d08) | [matrixQ](classeigen_1_1hessenbergdecomposition#a346441e4902a58d43d698ac3da6ff791) () const | | | Reconstructs the orthogonal matrix Q in the decomposition. [More...](classeigen_1_1hessenbergdecomposition#a346441e4902a58d43d698ac3da6ff791) | | | | const [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f) & | [packedMatrix](classeigen_1_1hessenbergdecomposition#a1f72b7612fd4edc5a6f31005e433e1dd) () const | | | Returns the internal representation of the decomposition. [More...](classeigen_1_1hessenbergdecomposition#a1f72b7612fd4edc5a6f31005e433e1dd) | | | CoeffVectorType --------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[Scalar](classeigen_1_1hessenbergdecomposition#a9420c36226cae7d92da8308a3f97ac2f), SizeMinusOne, 1, Options & ~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxSizeMinusOne, 1> [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::[CoeffVectorType](classeigen_1_1hessenbergdecomposition#a567f99f3770365777b67bf9832b6fac1) | Type for vector of Householder coefficients. This is column vector with entries of type [Scalar](classeigen_1_1hessenbergdecomposition#a9420c36226cae7d92da8308a3f97ac2f "Scalar type for matrices of type MatrixType."). The length of the vector is one less than the size of [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f "Synonym for the template parameter _MatrixType."), if it is a fixed-side type. Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::[Index](classeigen_1_1hessenbergdecomposition#a8e287ac222f53e2c8ce82faa43e95ac6) | **[Deprecated:](deprecated#_deprecated000016)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 HessenbergDecomposition() [1/2] ------------------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::[HessenbergDecomposition](classeigen_1_1hessenbergdecomposition) | ( | [Index](classeigen_1_1hessenbergdecomposition#a8e287ac222f53e2c8ce82faa43e95ac6) | *size* = `Size==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 2 : Size` | ) | | | inlineexplicit | Default constructor; the decomposition will be computed later. Parameters | | | | | --- | --- | --- | | [in] | size | The size of the matrix whose Hessenberg decomposition will be computed. | The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1hessenbergdecomposition#a239a6fd42c57aab3c0b048c47fde3004 "Computes Hessenberg decomposition of given matrix."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1hessenbergdecomposition#a239a6fd42c57aab3c0b048c47fde3004 "Computes Hessenberg decomposition of given matrix.") for an example. HessenbergDecomposition() [2/2] ------------------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::[HessenbergDecomposition](classeigen_1_1hessenbergdecomposition) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inlineexplicit | Constructor; computes Hessenberg decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose Hessenberg decomposition is to be computed. | This constructor calls [compute()](classeigen_1_1hessenbergdecomposition#a239a6fd42c57aab3c0b048c47fde3004 "Computes Hessenberg decomposition of given matrix.") to compute the Hessenberg decomposition. See also [matrixH()](classeigen_1_1hessenbergdecomposition#a8e781d2e22a2304647bcf0ae913cc8ea "Constructs the Hessenberg matrix H in the decomposition.") for an example. compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)& [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix* | ) | | | inline | Computes Hessenberg decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose Hessenberg decomposition is to be computed. | Returns Reference to `*this` The Hessenberg decomposition is computed by bringing the columns of the matrix successively in the required form using Householder reflections (see, e.g., Algorithm 7.4.2 in Golub & Van Loan, *Matrix Computations*). The cost is \( 10n^3/3 \) flops, where \( n \) denotes the size of the given matrix. This method reuses of the allocated data in the [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.") object. Example: ``` MatrixXcf A = [MatrixXcf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); HessenbergDecomposition<MatrixXcf> hd(4); hd.compute(A); cout << "The matrix H in the decomposition of A is:" << endl << hd.matrixH() << endl; hd.compute(2*A); // re-use hd to compute and store decomposition of 2A cout << "The matrix H in the decomposition of 2A is:" << endl << hd.matrixH() << endl; ``` Output: ``` The matrix H in the decomposition of A is: (-0.211,0.68) (0.346,0.216) (-0.688,0.00979) (0.0451,0.584) (-1.45,0) (-0.0574,-0.0123) (-0.196,0.385) (0.395,0.389) (0,0) (1.68,0) (-0.397,-0.552) (0.156,-0.241) (0,0) (0,0) (1.56,0) (0.876,-0.423) The matrix H in the decomposition of 2A is: (-0.422,1.36) (0.691,0.431) (-1.38,0.0196) (0.0902,1.17) (-2.91,0) (-0.115,-0.0246) (-0.392,0.77) (0.791,0.777) (0,0) (3.36,0) (-0.795,-1.1) (0.311,-0.482) (0,0) (0,0) (3.12,0) (1.75,-0.846) ``` householderCoefficients() ------------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [CoeffVectorType](classeigen_1_1hessenbergdecomposition#a567f99f3770365777b67bf9832b6fac1)& [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::householderCoefficients | ( | | ) | const | | inline | Returns the Householder coefficients. Returns a const reference to the vector of Householder coefficients Precondition Either the constructor HessenbergDecomposition(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the Hessenberg decomposition of a matrix. The Householder coefficients allow the reconstruction of the matrix \( Q \) in the Hessenberg decomposition from the packed data. See also [packedMatrix()](classeigen_1_1hessenbergdecomposition#a1f72b7612fd4edc5a6f31005e433e1dd "Returns the internal representation of the decomposition."), [Householder module](group__householder__module) matrixH() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | MatrixHReturnType [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::matrixH | ( | | ) | const | | inline | Constructs the Hessenberg matrix H in the decomposition. Returns expression object representing the matrix H Precondition Either the constructor HessenbergDecomposition(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the Hessenberg decomposition of a matrix. The object returned by this function constructs the Hessenberg matrix H when it is assigned to a matrix or otherwise evaluated. The matrix H is constructed from the packed matrix as returned by [packedMatrix()](classeigen_1_1hessenbergdecomposition#a1f72b7612fd4edc5a6f31005e433e1dd "Returns the internal representation of the decomposition."): The upper part (including the subdiagonal) of the packed matrix contains the matrix H. It may sometimes be better to directly use the packed matrix instead of constructing the matrix H. Example: ``` Matrix4f A = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); cout << "Here is a random 4x4 matrix:" << endl << A << endl; HessenbergDecomposition<MatrixXf> hessOfA(A); MatrixXf H = hessOfA.matrixH(); cout << "The Hessenberg matrix H is:" << endl << H << endl; MatrixXf Q = hessOfA.matrixQ(); cout << "The orthogonal matrix Q is:" << endl << Q << endl; cout << "Q H Q^T is:" << endl << Q * H * Q.transpose() << endl; ``` Output: ``` Here is a random 4x4 matrix: 0.68 0.823 -0.444 -0.27 -0.211 -0.605 0.108 0.0268 0.566 -0.33 -0.0452 0.904 0.597 0.536 0.258 0.832 The Hessenberg matrix H is: 0.68 -0.691 -0.645 0.235 0.849 0.836 -0.419 0.794 0 -0.469 -0.547 -0.0731 0 0 -0.559 -0.107 The orthogonal matrix Q is: 1 0 0 0 0 -0.249 -0.958 0.144 0 0.667 -0.277 -0.692 0 0.703 -0.0761 0.707 Q H Q^T is: 0.68 0.823 -0.444 -0.27 -0.211 -0.605 0.108 0.0268 0.566 -0.33 -0.0452 0.904 0.597 0.536 0.258 0.832 ``` See also [matrixQ()](classeigen_1_1hessenbergdecomposition#a346441e4902a58d43d698ac3da6ff791 "Reconstructs the orthogonal matrix Q in the decomposition."), [packedMatrix()](classeigen_1_1hessenbergdecomposition#a1f72b7612fd4edc5a6f31005e433e1dd "Returns the internal representation of the decomposition.") matrixQ() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [HouseholderSequenceType](classeigen_1_1hessenbergdecomposition#a7c1188cd5d8f550c8941df75a50a7d08) [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::matrixQ | ( | | ) | const | | inline | Reconstructs the orthogonal matrix Q in the decomposition. Returns object representing the matrix Q Precondition Either the constructor HessenbergDecomposition(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the Hessenberg decomposition of a matrix. This function returns a light-weight object of template class [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size."). You can either apply it directly to a matrix or you can convert it to a matrix of type [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f "Synonym for the template parameter _MatrixType."). See also [matrixH()](classeigen_1_1hessenbergdecomposition#a8e781d2e22a2304647bcf0ae913cc8ea "Constructs the Hessenberg matrix H in the decomposition.") for an example, class [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size.") packedMatrix() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [MatrixType](classeigen_1_1hessenbergdecomposition#a93a611350a7db9d1da18f2c828ecea9f)& [Eigen::HessenbergDecomposition](classeigen_1_1hessenbergdecomposition)< \_MatrixType >::packedMatrix | ( | | ) | const | | inline | Returns the internal representation of the decomposition. Returns a const reference to a matrix with the internal representation of the decomposition. Precondition Either the constructor HessenbergDecomposition(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the Hessenberg decomposition of a matrix. The returned matrix contains the following information: * the upper part and lower sub-diagonal represent the Hessenberg matrix H * the rest of the lower part contains the Householder vectors that, combined with Householder coefficients returned by [householderCoefficients()](classeigen_1_1hessenbergdecomposition#a65fa81ce79d956baa59a30a6d82f8a84 "Returns the Householder coefficients."), allows to reconstruct the matrix Q as \( Q = H\_{N-1} \ldots H\_1 H\_0 \). Here, the matrices \( H\_i \) are the Householder transformations \( H\_i = (I - h\_i v\_i v\_i^T) \) where \( h\_i \) is the \( i \)th Householder coefficient and \( v\_i \) is the Householder vector defined by \( v\_i = [ 0, \ldots, 0, 1, M(i+2,i), \ldots, M(N-1,i) ]^T \) with M the matrix returned by this function. See LAPACK for further details on this packed storage. Example: ``` Matrix4d A = [Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); cout << "Here is a random 4x4 matrix:" << endl << A << endl; HessenbergDecomposition<Matrix4d> hessOfA(A); Matrix4d pm = hessOfA.packedMatrix(); cout << "The packed matrix M is:" << endl << pm << endl; cout << "The upper Hessenberg part corresponds to the matrix H, which is:" << endl << hessOfA.matrixH() << endl; Vector3d hc = hessOfA.householderCoefficients(); cout << "The vector of Householder coefficients is:" << endl << hc << endl; ``` Output: ``` Here is a random 4x4 matrix: 0.68 0.823 -0.444 -0.27 -0.211 -0.605 0.108 0.0268 0.566 -0.33 -0.0452 0.904 0.597 0.536 0.258 0.832 The packed matrix M is: 0.68 -0.691 -0.645 0.235 0.849 0.836 -0.419 0.794 -0.534 -0.469 -0.547 -0.0731 -0.563 0.344 -0.559 -0.107 The upper Hessenberg part corresponds to the matrix H, which is: 0.68 -0.691 -0.645 0.235 0.849 0.836 -0.419 0.794 0 -0.469 -0.547 -0.0731 0 0 -0.559 -0.107 The vector of Householder coefficients is: 1.25 1.79 0 ``` See also [householderCoefficients()](classeigen_1_1hessenbergdecomposition#a65fa81ce79d956baa59a30a6d82f8a84 "Returns the Householder coefficients.") --- The documentation for this class was generated from the following file:* [HessenbergDecomposition.h](https://eigen.tuxfamily.org/dox/HessenbergDecomposition_8h_source.html)
programming_docs
eigen3 Enumerations Enumerations ============ Various enumerations used in Eigen. Many of these are used as template parameters. | | | --- | | | | enum | [Eigen::AccessorLevels](group__enums#ga9f93eac38eb83deb0e8dbd42ddf11d5d) { [Eigen::ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) , [Eigen::WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) , [Eigen::DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) , [Eigen::DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) } | | | | enum | [Eigen::AlignmentType](group__enums#ga45fe06e29902b7a2773de05ba27b47a1) { [Eigen::Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686) , [Eigen::Aligned8](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a9d99d7a9ff1da5c949bec22733bfba14) , [Eigen::Aligned16](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ad0b140cd97bc74365b51843d28379655) , [Eigen::Aligned32](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a8a380b1cd0c3e5a6cceac06f8235157a) , [Eigen::Aligned64](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a2639cfa1e8faac751556bc0009fe95a4) , [Eigen::Aligned128](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a60057da2408e499b5656244d0b26cc20) , **AlignedMask** , [Eigen::Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) , **AlignedMax** } | | | | enum | [Eigen::ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) { [Eigen::Success](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea671a2aeb0f527802806a441d58a80fcf) , [Eigen::NumericalIssue](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea1c6e20706575a629b27a105f07f1883b) , [Eigen::NoConvergence](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea6a68dfb88a8336108a30588bdf356c57) , [Eigen::InvalidInput](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea580b2a3cafe585691e789f768fb729bf) } | | | | enum | [Eigen::DecompositionOptions](group__enums#gae3e239fb70022eb8747994cf5d68b4a9) { } | | | | enum | [Eigen::DirectionType](group__enums#gad49a7b3738e273eb00932271b36127f7) { [Eigen::Vertical](group__enums#ggad49a7b3738e273eb00932271b36127f7ae2efac6e74ecab5e3b0b1561c5ddf83e) , [Eigen::Horizontal](group__enums#ggad49a7b3738e273eb00932271b36127f7a961c62410157b64033839488f4d7f7e4) , [Eigen::BothDirections](group__enums#ggad49a7b3738e273eb00932271b36127f7a04fefd61992e941d509a57bc44c59794) } | | | | enum | [Eigen::NaNPropagationOptions](group__enums#ga7f4e3f96895bdb325eab1a0b651e211f) { [Eigen::PropagateFast](group__enums#gga7f4e3f96895bdb325eab1a0b651e211fa917fa8982b7eb0cbb440d38ee50e0b9c) , [Eigen::PropagateNaN](group__enums#gga7f4e3f96895bdb325eab1a0b651e211fa1d414f9966ecba69cd840b8def472c4a) , [Eigen::PropagateNumbers](group__enums#gga7f4e3f96895bdb325eab1a0b651e211fa5bfaff916ad4913fd04fe2e92c5c32ae) } | | | | enum | [Eigen::QRPreconditioners](group__enums#ga46eba0d5c621f590b8cf1b53af31d56e) { [Eigen::NoQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56ea2e95bc818f975b19def01e93d240dece) , [Eigen::HouseholderQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56ea9c660eb3336bf8c77ce9d081ca07cbdd) , [Eigen::ColPivHouseholderQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56eabd2e2f4875c5b4b6e602a433d90c4e5e) , [Eigen::FullPivHouseholderQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56eabd745dcaff7019c5f918c68809e5ea50) } | | | | enum | [Eigen::SideType](group__enums#gac22de43beeac7a78b384f99bed5cee0b) { [Eigen::OnTheLeft](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba21b30a61e9cb10c967aec17567804007) , [Eigen::OnTheRight](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba329fc3a54ceb2b6e0e73b400998b8a82) } | | | | enum | [Eigen::StorageOptions](group__enums#gaacded1a18ae58b0f554751f6cdf9eb13) { [Eigen::ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62) , [Eigen::RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) , [Eigen::AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea) , [Eigen::DontAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a56908522e51443a0aa0567f879c2e78a) } | | | | enum | [Eigen::TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) { [Eigen::Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) , [Eigen::Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) , [Eigen::AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490) , [Eigen::Projective](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0f7338b8672884554e8642bce9e44183) } | | | | enum | [Eigen::UpLoType](group__enums#ga39e3366ff5554d731e7dc8bb642f83cd) { [Eigen::Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) , [Eigen::Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1) , [Eigen::UnitDiag](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2ef430bff6cc12c2d1e0ef01b95f7ff3) , [Eigen::ZeroDiag](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdac4dc554a61510151ddd5bafaf6040223) , [Eigen::UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda) , [Eigen::UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad) , [Eigen::StrictlyLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2424988b6fca98be70b595632753ba81) , [Eigen::StrictlyUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda7b37877e0b9b0df28c9c2b669a633265) , [Eigen::SelfAdjoint](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdacf9ccb2016f8b9c0f3268f05a1e75821) , [Eigen::Symmetric](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdad5381b2d1c8973a08303c94e7da02333) } | | | AccessorLevels -------------- | | | --- | | enum [Eigen::AccessorLevels](group__enums#ga9f93eac38eb83deb0e8dbd42ddf11d5d) | Used as template parameter in DenseCoeffBase and MapBase to indicate which accessors should be provided. | Enumerator | | --- | | ReadOnlyAccessors | Read-only access via a member function. | | WriteAccessors | Read/write access via member functions. | | DirectAccessors | Direct read-only access to the coefficients. | | DirectWriteAccessors | Direct read/write access to the coefficients. | AlignmentType ------------- | | | --- | | enum [Eigen::AlignmentType](group__enums#ga45fe06e29902b7a2773de05ba27b47a1) | Enum for indicating whether a buffer is aligned or not. | Enumerator | | --- | | Unaligned | Data pointer has no specific alignment. | | Aligned8 | Data pointer is aligned on a 8 bytes boundary. | | Aligned16 | Data pointer is aligned on a 16 bytes boundary. | | Aligned32 | Data pointer is aligned on a 32 bytes boundary. | | Aligned64 | Data pointer is aligned on a 64 bytes boundary. | | Aligned128 | Data pointer is aligned on a 128 bytes boundary. | | Aligned | **[Deprecated:](deprecated#_deprecated000010)** Synonym for Aligned16. | ComputationInfo --------------- | | | --- | | enum [Eigen::ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | Enum for reporting the status of a computation. | Enumerator | | --- | | Success | Computation was successful. | | NumericalIssue | The provided data did not satisfy the prerequisites. | | NoConvergence | Iterative procedure did not converge. | | InvalidInput | The inputs are invalid, or the algorithm has been improperly called. When assertions are enabled, such errors trigger an assert. | DecompositionOptions -------------------- | | | --- | | enum [Eigen::DecompositionOptions](group__enums#gae3e239fb70022eb8747994cf5d68b4a9) | Enum with options to give to various decompositions. | Enumerator | | --- | | ComputeFullU | Used in [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") to indicate that the square matrix U is to be computed. | | ComputeThinU | Used in [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") to indicate that the thin matrix U is to be computed. | | ComputeFullV | Used in [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") to indicate that the square matrix V is to be computed. | | ComputeThinV | Used in [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") to indicate that the thin matrix V is to be computed. | | EigenvaluesOnly | Used in [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") and [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.") to specify that only the eigenvalues are to be computed and not the eigenvectors. | | ComputeEigenvectors | Used in [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") and [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.") to specify that both the eigenvalues and the eigenvectors are to be computed. | | Ax\_lBx | Used in [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.") to indicate that it should solve the generalized eigenproblem \( Ax = \lambda B x \). | | ABx\_lx | Used in [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.") to indicate that it should solve the generalized eigenproblem \( ABx = \lambda x \). | | BAx\_lx | Used in [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.") to indicate that it should solve the generalized eigenproblem \( BAx = \lambda x \). | DirectionType ------------- | | | --- | | enum [Eigen::DirectionType](group__enums#gad49a7b3738e273eb00932271b36127f7) | Enum containing possible values for the `Direction` parameter of [Reverse](classeigen_1_1reverse "Expression of the reverse of a vector or matrix."), [PartialReduxExpr](classeigen_1_1partialreduxexpr "Generic expression of a partially reduxed matrix.") and [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations."). | Enumerator | | --- | | Vertical | For [Reverse](classeigen_1_1reverse "Expression of the reverse of a vector or matrix."), all columns are reversed; for [PartialReduxExpr](classeigen_1_1partialreduxexpr "Generic expression of a partially reduxed matrix.") and [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations."), act on columns. | | Horizontal | For [Reverse](classeigen_1_1reverse "Expression of the reverse of a vector or matrix."), all rows are reversed; for [PartialReduxExpr](classeigen_1_1partialreduxexpr "Generic expression of a partially reduxed matrix.") and [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations."), act on rows. | | BothDirections | For [Reverse](classeigen_1_1reverse "Expression of the reverse of a vector or matrix."), both rows and columns are reversed; not used for [PartialReduxExpr](classeigen_1_1partialreduxexpr "Generic expression of a partially reduxed matrix.") and [VectorwiseOp](classeigen_1_1vectorwiseop "Pseudo expression providing broadcasting and partial reduction operations."). | NaNPropagationOptions --------------------- | | | --- | | enum [Eigen::NaNPropagationOptions](group__enums#ga7f4e3f96895bdb325eab1a0b651e211f) | Enum for specifying NaN-propagation behavior, e.g. for coeff-wise min/max. | Enumerator | | --- | | PropagateFast | Implementation defined behavior if NaNs are present. | | PropagateNaN | Always propagate NaNs. | | PropagateNumbers | Always propagate not-NaNs. | QRPreconditioners ----------------- | | | --- | | enum [Eigen::QRPreconditioners](group__enums#ga46eba0d5c621f590b8cf1b53af31d56e) | Possible values for the `QRPreconditioner` template parameter of [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix."). | Enumerator | | --- | | NoQRPreconditioner | Do not specify what is to be done if the SVD of a non-square matrix is asked for. | | HouseholderQRPreconditioner | Use a QR decomposition without pivoting as the first step. | | ColPivHouseholderQRPreconditioner | Use a QR decomposition with column pivoting as the first step. | | FullPivHouseholderQRPreconditioner | Use a QR decomposition with full pivoting as the first step. | SideType -------- | | | --- | | enum [Eigen::SideType](group__enums#gac22de43beeac7a78b384f99bed5cee0b) | Enum for specifying whether to apply or solve on the left or right. | Enumerator | | --- | | OnTheLeft | Apply transformation on the left. | | OnTheRight | Apply transformation on the right. | StorageOptions -------------- | | | --- | | enum [Eigen::StorageOptions](group__enums#gaacded1a18ae58b0f554751f6cdf9eb13) | Enum containing possible values for the `_Options` template parameter of [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."), [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") and BandMatrix. | Enumerator | | --- | | ColMajor | Storage order is column major (see [Storage orders](group__topicstorageorders)). | | RowMajor | Storage order is row major (see [Storage orders](group__topicstorageorders)). | | AutoAlign | Align the matrix itself if it is vectorizable fixed-size | | DontAlign | Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated, may still be requested to be aligned) | TransformTraits --------------- | | | --- | | enum [Eigen::TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) | Enum used to specify how a particular transformation is stored in a matrix. See also [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space."), [Hyperplane::transform()](classeigen_1_1hyperplane#ae89b4a512bfb4acbf6192b37c89d1552). | Enumerator | | --- | | Isometry | Transformation is an isometry. | | Affine | Transformation is an affine transformation stored as a (Dim+1)^2 matrix whose last row is assumed to be [0 ... 0 1]. | | AffineCompact | Transformation is an affine transformation stored as a (Dim) x (Dim+1) matrix. | | Projective | Transformation is a general projective transformation stored as a (Dim+1)^2 matrix. | UpLoType -------- | | | --- | | enum [Eigen::UpLoType](group__enums#ga39e3366ff5554d731e7dc8bb642f83cd) | Enum containing possible values for the `Mode` or `UpLo` parameter of MatrixBase::selfadjointView() and MatrixBase::triangularView(), and selfadjoint solvers. | Enumerator | | --- | | Lower | View matrix as a lower triangular matrix. | | Upper | View matrix as an upper triangular matrix. | | UnitDiag | Matrix has ones on the diagonal; to be used in combination with [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) or [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1). | | ZeroDiag | Matrix has zeros on the diagonal; to be used in combination with [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) or [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1). | | UnitLower | View matrix as a lower triangular matrix with ones on the diagonal. | | UnitUpper | View matrix as an upper triangular matrix with ones on the diagonal. | | StrictlyLower | View matrix as a lower triangular matrix with zeros on the diagonal. | | StrictlyUpper | View matrix as an upper triangular matrix with zeros on the diagonal. | | SelfAdjoint | Used in BandMatrix and [SelfAdjointView](classeigen_1_1selfadjointview "Expression of a selfadjoint matrix from a triangular part of a dense matrix.") to indicate that the matrix is self-adjoint. | | Symmetric | Used to support symmetric, non-selfadjoint, complex matrices. | eigen3 Eigen::LeastSquareDiagonalPreconditioner Eigen::LeastSquareDiagonalPreconditioner ======================================== ### template<typename \_Scalar> class Eigen::LeastSquareDiagonalPreconditioner< \_Scalar > Jacobi preconditioner for [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems."). This class allows to approximately solve for A' A x = A' b problems assuming A' A is a diagonal matrix. In other words, this preconditioner neglects all off diagonal entries and, in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s language, solves for: ``` (A.adjoint() * A).diagonal().asDiagonal() * x = b ``` Template Parameters | | | | --- | --- | | \_Scalar | the type of the scalar. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . The diagonal entries are pre-inverted and stored into a dense vector. See also class [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems."), class [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.") --- The documentation for this class was generated from the following file:* [BasicPreconditioners.h](https://eigen.tuxfamily.org/dox/BasicPreconditioners_8h_source.html) eigen3 Eigen and multi-threading Eigen and multi-threading ========================= Make Eigen run in parallel ============================ Some Eigen's algorithms can exploit the multiple cores present in your hardware. To this end, it is enough to enable OpenMP on your compiler, for instance: * GCC: `-fopenmp` * ICC: `-openmp` * MSVC: check the respective option in the build properties. You can control the number of threads that will be used using either the OpenMP API or Eigen's API using the following priority: ``` OMP_NUM_THREADS=n ./my_program omp_set_num_threads(n); Eigen::setNbThreads(n); ``` Unless `setNbThreads` has been called, Eigen uses the number of threads specified by OpenMP. You can restore this behavior by calling `setNbThreads(0);`. You can query the number of threads that will be used with: ``` n = Eigen::nbThreads( ); ``` You can disable Eigen's multi threading at compile time by defining the [EIGEN\_DONT\_PARALLELIZE](topicpreprocessordirectives#TopicPreprocessorDirectivesPerformance) preprocessor token. Currently, the following algorithms can make use of multi-threading: * general dense matrix - matrix products * [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.") * row-major-sparse \* dense vector/matrix products * [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems.") with `Lower|Upper` as the `UpLo` template parameter. * [BiCGSTAB](classeigen_1_1bicgstab "A bi conjugate gradient stabilized solver for sparse square problems.") with a row-major sparse matrix format. * [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems.") Warning On most OS it is **very important** to limit the number of threads to the number of physical cores, otherwise significant slowdowns are expected, especially for operations involving dense matrices. Indeed, the principle of hyper-threading is to run multiple threads (in most cases 2) on a single core in an interleaved manner. However, Eigen's matrix-matrix product kernel is fully optimized and already exploits nearly 100% of the CPU capacity. Consequently, there is no room for running multiple such threads on a single core, and the performance would drops significantly because of cache pollution and other sources of overheads. At this stage of reading you're probably wondering why Eigen does not limit itself to the number of physical cores? This is simply because OpenMP does not allow to know the number of physical cores, and thus Eigen will launch as many threads as *cores* reported by OpenMP. Using Eigen in a multi-threaded application ============================================= In the case your own application is multithreaded, and multiple threads make calls to Eigen, then you have to initialize Eigen by calling the following routine **before** creating the threads: ``` #include <Eigen/Core> int main(int argc, char** argv) { Eigen::initParallel(); ... } ``` Note With Eigen 3.3, and a fully C++11 compliant compiler (i.e., [thread-safe static local variable initialization](http://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables)), then calling `initParallel()` is optional. Warning Note that all functions generating random matrices are **not** re-entrant nor thread-safe. Those include [DenseBase::Random()](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19), and [DenseBase::setRandom()](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) despite a call to `Eigen::initParallel()`. This is because these functions are based on `std::rand` which is not re-entrant. For thread-safe random generator, we recommend the use of c++11 random generators ([example](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ) or `boost::random`. In the case your application is parallelized with OpenMP, you might want to disable Eigen's own parallelization as detailed in the previous section. Warning Using OpenMP with custom scalar types that might throw exceptions can lead to unexpected behaviour in the event of throwing.
programming_docs
eigen3 Eigen::PardisoLLT Eigen::PardisoLLT ================= ### template<typename MatrixType, int \_UpLo> class Eigen::PardisoLLT< MatrixType, \_UpLo > A sparse direct Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PARDISO library. This class allows to solve for A.X = B sparse linear problems via a LL^T Cholesky factorization using the Intel MKL PARDISO library. The sparse matrix A must be selfajoint and positive definite. The vectors or matrices X and B can be either dense or sparse. By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set: ``` solver.pardisoParameterArray()[59] = 1; ``` Template Parameters | | | | --- | --- | | MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | UpLo | can be any bitwise combination of Upper, Lower. The default is Upper, meaning only the upper triangular part has to be used. Upper|Lower can be used to tell both triangular parts can be used as input. | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") Inherits Eigen::PardisoImpl< Derived >. --- The documentation for this class was generated from the following file:* [PardisoSupport.h](https://eigen.tuxfamily.org/dox/PardisoSupport_8h_source.html) eigen3 Catalogue of dense decompositions Catalogue of dense decompositions ================================= This page presents a catalogue of the dense matrix decompositions offered by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). For an introduction on linear solvers and decompositions, check this [page](group__tutoriallinearalgebra) . To get an overview of the true relative speed of the different decompositions, check this [benchmark](group__densedecompositionbenchmark) . Catalogue of decompositions offered by Eigen ============================================== | | Generic information, not Eigen-specific | Eigen-specific | | --- | --- | --- | | Decomposition | Requirements on the matrix | Speed | Algorithm reliability and accuracy | Rank-revealing | Allows to compute (besides linear solving) | Linear solver provided by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") | Maturity of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s implementation | Optimizations | | [PartialPivLU](classeigen_1_1partialpivlu "LU decomposition of a matrix with partial pivoting, and related features.") | Invertible | Fast | Depends on condition number | - | - | Yes | Excellent | Blocking, Implicit MT | | [FullPivLU](classeigen_1_1fullpivlu "LU decomposition of a matrix with complete pivoting, and related features.") | - | Slow | Proven | Yes | - | Yes | Excellent | - | | [HouseholderQR](classeigen_1_1householderqr "Householder QR decomposition of a matrix.") | - | Fast | Depends on condition number | - | Orthogonalization | Yes | Excellent | Blocking | | [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting.") | - | Fast | Good | Yes | Orthogonalization | Yes | Excellent | *-* | | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") | - | Slow | Proven | Yes | Orthogonalization | Yes | Average | - | | [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition "Complete orthogonal decomposition (COD) of a matrix.") | - | Fast | Good | Yes | Orthogonalization | Yes | Excellent | *-* | | [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") | Positive definite | Very fast | Depends on condition number | - | - | Yes | Excellent | Blocking | | [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") | Positive or negative semidefinite[1](#note1) | Very fast | Good | - | - | Yes | Excellent | *Soon: blocking* | | Singular values and eigenvalues decompositions | | [BDCSVD](classeigen_1_1bdcsvd "class Bidiagonal Divide and Conquer SVD") (divide & conquer) | - | One of the fastest SVD algorithms | Excellent | Yes | Singular values/vectors, least squares | Yes (and does least squares) | Excellent | Blocked bidiagonalization | | [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") (two-sided) | - | Slow (but fast for small matrices) | Proven[3](#note3) | Yes | Singular values/vectors, least squares | Yes (and does least squares) | Excellent | R-SVD | | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") | Self-adjoint | Fast-average[2](#note2) | Good | Yes | Eigenvalues/vectors | - | Excellent | *Closed forms for 2x2 and 3x3* | | [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") | Square | Slow-very slow[2](#note2) | Depends on condition number | Yes | Eigenvalues/vectors | - | Average | - | | [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices.") | Square and real | Average-slow[2](#note2) | Depends on condition number | Yes | Eigenvalues/vectors | - | Average | - | | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver "Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.") | Square | Fast-average[2](#note2) | Depends on condition number | - | Generalized eigenvalues/vectors | - | Good | - | | Helper decompositions | | [RealSchur](classeigen_1_1realschur "Performs a real Schur decomposition of a square matrix.") | Square and real | Average-slow[2](#note2) | Depends on condition number | Yes | - | - | Average | - | | [ComplexSchur](classeigen_1_1complexschur "Performs a complex Schur decomposition of a real or complex square matrix.") | Square | Slow-very slow[2](#note2) | Depends on condition number | Yes | - | - | Average | - | | [Tridiagonalization](classeigen_1_1tridiagonalization "Tridiagonal decomposition of a selfadjoint matrix.") | Self-adjoint | Fast | Good | - | - | - | Good | *Soon: blocking* | | [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.") | Square | Average | Good | - | - | - | Good | *Soon: blocking* | **Notes:** * **1**: There exist two variants of the [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") algorithm. [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s one produces a pure diagonal D matrix, and therefore it cannot handle indefinite matrices, unlike Lapack's one which produces a block diagonal D matrix. * **2**: Eigenvalues, SVD and Schur decompositions rely on iterative algorithms. Their convergence speed depends on how well the eigenvalues are separated. * **3**: Our [JacobiSVD](classeigen_1_1jacobisvd "Two-sided Jacobi SVD decomposition of a rectangular matrix.") is two-sided, making for proven and optimal precision for square matrices. For non-square matrices, we have to use a QR preconditioner first. The default choice, [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with column-pivoting."), is already very reliable, but if you want it to be proven, use [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr "Householder rank-revealing QR decomposition of a matrix with full pivoting.") instead. Terminology ============= **Selfadjoint** For a real matrix, selfadjoint is a synonym for symmetric. For a complex matrix, selfadjoint is a synonym for *hermitian*. More generally, a matrix \( A \) is selfadjoint if and only if it is equal to its adjoint \( A^\* \). The adjoint is also called the *conjugate* *transpose*. **Positive/negative definite** A selfadjoint matrix \( A \) is positive definite if \( v^\* A v > 0 \) for any non zero vector \( v \). In the same vein, it is negative definite if \( v^\* A v < 0 \) for any non zero vector \( v \) **Positive/negative semidefinite** A selfadjoint matrix \( A \) is positive semi-definite if \( v^\* A v \ge 0 \) for any non zero vector \( v \). In the same vein, it is negative semi-definite if \( v^\* A v \le 0 \) for any non zero vector \( v \) **Blocking** Means the algorithm can work per block, whence guaranteeing a good scaling of the performance for large matrices. **Implicit Multi Threading (MT)** Means the algorithm can take advantage of multicore processors via OpenMP. "Implicit" means the algortihm itself is not parallelized, but that it relies on parallelized matrix-matrix product routines. **Explicit Multi Threading (MT)** Means the algorithm is explicitly parallelized to take advantage of multicore processors via OpenMP. **Meta-unroller** Means the algorithm is automatically and explicitly unrolled for very small fixed size matrices. eigen3 Eigen::Hyperplane Eigen::Hyperplane ================= ### template<typename \_Scalar, int \_AmbientDim, int \_Options> class Eigen::Hyperplane< \_Scalar, \_AmbientDim, \_Options > A hyperplane. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` A hyperplane is an affine subspace of dimension n-1 in a space of dimension n. For example, a hyperplane in a plane is a line; a hyperplane in 3-space is a plane. Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the coefficients | | \_AmbientDim | the dimension of the ambient space, can be a compile time value or Dynamic. Notice that the dimension of the hyperplane is \_AmbientDim-1. | This class represents an hyperplane as the zero set of the implicit equation \( n \cdot x + d = 0 \) where \( n \) is a unit normal vector of the plane (linear part) and \( d \) is the distance (offset) to the origin. | | | --- | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) | | | | | | --- | | | | Scalar | [absDistance](classeigen_1_1hyperplane#a28eabcf0c7607a5091743abac91a8fc8) (const [VectorType](classeigen_1_1matrix) &p) const | | | | template<typename NewScalarType > | | internal::cast\_return\_type< [Hyperplane](classeigen_1_1hyperplane), [Hyperplane](classeigen_1_1hyperplane)< NewScalarType, AmbientDimAtCompileTime, Options > >::type | [cast](classeigen_1_1hyperplane#acfeb7c6af0d9cedb04a4a4268948f015) () const | | | | [Coefficients](classeigen_1_1matrix) & | [coeffs](classeigen_1_1hyperplane#ab484a0fbbb43e22812b6211d878cddd4) () | | | | const [Coefficients](classeigen_1_1matrix) & | [coeffs](classeigen_1_1hyperplane#a4a051414928ebb5803036b69aad597ca) () const | | | | [Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) | [dim](classeigen_1_1hyperplane#a23de6500e87586f5ca9904fe5315b51d) () const | | | | | [Hyperplane](classeigen_1_1hyperplane#aa19ee87ada63fa6576bf61517424b1b3) () | | | | template<typename OtherScalarType , int OtherOptions> | | | [Hyperplane](classeigen_1_1hyperplane#ae03c337cae9fd43396f92b9e97e600b1) (const [Hyperplane](classeigen_1_1hyperplane)< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > &other) | | | | | [Hyperplane](classeigen_1_1hyperplane#ad05d941675fd03b46dd1029f2f0c95ea) (const [ParametrizedLine](classeigen_1_1parametrizedline)< Scalar, AmbientDimAtCompileTime > &parametrized) | | | | | [Hyperplane](classeigen_1_1hyperplane#a76a1ed93c5f7e3a9aba4f029809d6ebc) (const [VectorType](classeigen_1_1matrix) &n, const Scalar &d) | | | | | [Hyperplane](classeigen_1_1hyperplane#a0f9ca82a2cf12753da3a007e128631f8) (const [VectorType](classeigen_1_1matrix) &n, const [VectorType](classeigen_1_1matrix) &e) | | | | | [Hyperplane](classeigen_1_1hyperplane#a75aebf8b553ea33a193ea94583a7f830) ([Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) \_dim) | | | | [VectorType](classeigen_1_1matrix) | [intersection](classeigen_1_1hyperplane#a308d9231ca5a0ebffde94fb13fd9916a) (const [Hyperplane](classeigen_1_1hyperplane) &other) const | | | | template<int OtherOptions> | | bool | [isApprox](classeigen_1_1hyperplane#ad5f22e31d700adf1144eecda45075494) (const [Hyperplane](classeigen_1_1hyperplane)< Scalar, AmbientDimAtCompileTime, OtherOptions > &other, const typename [NumTraits](structeigen_1_1numtraits)< Scalar >::Real &prec=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [NormalReturnType](classeigen_1_1block) | [normal](classeigen_1_1hyperplane#a567f2d13d5c9835f2884c329185e4c63) () | | | | [ConstNormalReturnType](classeigen_1_1block) | [normal](classeigen_1_1hyperplane#abe6786725d6aae2e6ef6981395aeac46) () const | | | | void | [normalize](classeigen_1_1hyperplane#ae090309b1a932e07a983ff7dd84a3120) (void) | | | | Scalar & | [offset](classeigen_1_1hyperplane#a4a9fae414234e9513194b69a878a4225) () | | | | const Scalar & | [offset](classeigen_1_1hyperplane#a7451d5993c7b87e2ff358e0aa3a06175) () const | | | | [VectorType](classeigen_1_1matrix) | [projection](classeigen_1_1hyperplane#a855dec52efed47121fc5cd47fdf808f7) (const [VectorType](classeigen_1_1matrix) &p) const | | | | Scalar | [signedDistance](classeigen_1_1hyperplane#abe362349d10c5852b007958c5e1152eb) (const [VectorType](classeigen_1_1matrix) &p) const | | | | template<typename XprType > | | [Hyperplane](classeigen_1_1hyperplane) & | [transform](classeigen_1_1hyperplane#ae89b4a512bfb4acbf6192b37c89d1552) (const [MatrixBase](classeigen_1_1matrixbase)< XprType > &mat, [TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) traits=[Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb)) | | | | template<int TrOptions> | | [Hyperplane](classeigen_1_1hyperplane) & | [transform](classeigen_1_1hyperplane#ae07794d268e45fd513a17c49b9a6ec81) (const [Transform](classeigen_1_1transform)< Scalar, AmbientDimAtCompileTime, [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb), TrOptions > &t, [TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) traits=[Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb)) | | | | | | --- | | | | static [Hyperplane](classeigen_1_1hyperplane) | [Through](classeigen_1_1hyperplane#a7ae0bb22aa49175b46ed58010b8d5221) (const [VectorType](classeigen_1_1matrix) &p0, const [VectorType](classeigen_1_1matrix) &p1) | | | | static [Hyperplane](classeigen_1_1hyperplane) | [Through](classeigen_1_1hyperplane#a23f225bb36b10ce116ca97d2ca7aa345) (const [VectorType](classeigen_1_1matrix) &p0, const [VectorType](classeigen_1_1matrix) &p1, const [VectorType](classeigen_1_1matrix) &p2) | | | Index ----- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) | **[Deprecated:](deprecated#_deprecated000024)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 Hyperplane() [1/6] ------------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Hyperplane](classeigen_1_1hyperplane) | ( | | ) | | | inline | Default constructor without initialization Hyperplane() [2/6] ------------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Hyperplane](classeigen_1_1hyperplane) | ( | [Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) | *\_dim* | ) | | | inlineexplicit | Constructs a dynamic-size hyperplane with *\_dim* the dimension of the ambient space Hyperplane() [3/6] ------------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Hyperplane](classeigen_1_1hyperplane) | ( | const [VectorType](classeigen_1_1matrix) & | *n*, | | | | const [VectorType](classeigen_1_1matrix) & | *e* | | | ) | | | | inline | Construct a plane from its normal *n* and a point *e* onto the plane. Warning the vector normal is assumed to be normalized. Hyperplane() [4/6] ------------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Hyperplane](classeigen_1_1hyperplane) | ( | const [VectorType](classeigen_1_1matrix) & | *n*, | | | | const Scalar & | *d* | | | ) | | | | inline | Constructs a plane from its normal *n* and distance to the origin *d* such that the algebraic equation of the plane is \( n \cdot x + d = 0 \). Warning the vector normal is assumed to be normalized. Hyperplane() [5/6] ------------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Hyperplane](classeigen_1_1hyperplane) | ( | const [ParametrizedLine](classeigen_1_1parametrizedline)< Scalar, AmbientDimAtCompileTime > & | *parametrized* | ) | | | inlineexplicit | Constructs a hyperplane passing through the parametrized line *parametrized*. If the dimension of the ambient space is greater than 2, then there isn't uniqueness, so an arbitrary choice is made. Hyperplane() [6/6] ------------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> template<typename OtherScalarType , int OtherOptions> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::[Hyperplane](classeigen_1_1hyperplane) | ( | const [Hyperplane](classeigen_1_1hyperplane)< OtherScalarType, AmbientDimAtCompileTime, OtherOptions > & | *other* | ) | | | inlineexplicit | Copy constructor with scalar type conversion absDistance() ------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Scalar [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::absDistance | ( | const [VectorType](classeigen_1_1matrix) & | *p* | ) | const | | inline | Returns the absolute distance between the plane `*this` and a point *p*. See also [signedDistance()](classeigen_1_1hyperplane#abe362349d10c5852b007958c5e1152eb) cast() ------ template<typename \_Scalar , int \_AmbientDim, int \_Options> template<typename NewScalarType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::cast\_return\_type<[Hyperplane](classeigen_1_1hyperplane), [Hyperplane](classeigen_1_1hyperplane)<NewScalarType,AmbientDimAtCompileTime,Options> >::type [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::cast | ( | | ) | const | | inline | Returns `*this` with scalar type casted to *NewScalarType* Note that if *NewScalarType* is equal to the current scalar type of `*this` then this function smartly returns a const reference to `*this`. coeffs() [1/2] -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Coefficients](classeigen_1_1matrix)& [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::coeffs | ( | | ) | | | inline | Returns a non-constant reference to the coefficients c\_i of the plane equation: \( c\_0\*x\_0 + ... + c\_{d-1}\*x\_{d-1} + c\_d = 0 \) coeffs() [2/2] -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Coefficients](classeigen_1_1matrix)& [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::coeffs | ( | | ) | const | | inline | Returns a constant reference to the coefficients c\_i of the plane equation: \( c\_0\*x\_0 + ... + c\_{d-1}\*x\_{d-1} + c\_d = 0 \) dim() ----- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](classeigen_1_1hyperplane#a58d2307d16128a0026021374e9e10465) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::dim | ( | | ) | const | | inline | Returns the dimension in which the plane holds intersection() -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [VectorType](classeigen_1_1matrix) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::intersection | ( | const [Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options > & | *other* | ) | const | | inline | Returns the intersection of \*this with *other*. Warning The ambient space must be a plane, i.e. have dimension 2, so that `*this` and *other* are lines. Note If *other* is approximately parallel to \*this, this method will return any point on \*this. isApprox() ---------- template<typename \_Scalar , int \_AmbientDim, int \_Options> template<int OtherOptions> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::isApprox | ( | const [Hyperplane](classeigen_1_1hyperplane)< Scalar, AmbientDimAtCompileTime, OtherOptions > & | *other*, | | | | const typename [NumTraits](structeigen_1_1numtraits)< Scalar >::Real & | *prec* = `[NumTraits](structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Returns `true` if `*this` is approximately equal to *other*, within the precision determined by *prec*. See also [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) normal() [1/2] -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [NormalReturnType](classeigen_1_1block) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::normal | ( | | ) | | | inline | Returns a non-constant reference to the unit normal vector of the plane, which corresponds to the linear part of the implicit equation. normal() [2/2] -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ConstNormalReturnType](classeigen_1_1block) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::normal | ( | | ) | const | | inline | Returns a constant reference to the unit normal vector of the plane, which corresponds to the linear part of the implicit equation. normalize() ----------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::normalize | ( | void | | ) | | | inline | normalizes `*this` offset() [1/2] -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Scalar& [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::offset | ( | | ) | | | inline | Returns a non-constant reference to the distance to the origin, which is also the constant part of the implicit equation offset() [2/2] -------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Scalar& [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::offset | ( | | ) | const | | inline | Returns the distance to the origin, which is also the "constant term" of the implicit equation Warning the vector normal is assumed to be normalized. projection() ------------ template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [VectorType](classeigen_1_1matrix) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::projection | ( | const [VectorType](classeigen_1_1matrix) & | *p* | ) | const | | inline | Returns the projection of a point *p* onto the plane `*this`. signedDistance() ---------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Scalar [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::signedDistance | ( | const [VectorType](classeigen_1_1matrix) & | *p* | ) | const | | inline | Returns the signed distance between the plane `*this` and a point *p*. See also [absDistance()](classeigen_1_1hyperplane#a28eabcf0c7607a5091743abac91a8fc8) Through() [1/2] --------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | static [Hyperplane](classeigen_1_1hyperplane) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::Through | ( | const [VectorType](classeigen_1_1matrix) & | *p0*, | | | | const [VectorType](classeigen_1_1matrix) & | *p1* | | | ) | | | | inlinestatic | Constructs a hyperplane passing through the two points. If the dimension of the ambient space is greater than 2, then there isn't uniqueness, so an arbitrary choice is made. Through() [2/2] --------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | static [Hyperplane](classeigen_1_1hyperplane) [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::Through | ( | const [VectorType](classeigen_1_1matrix) & | *p0*, | | | | const [VectorType](classeigen_1_1matrix) & | *p1*, | | | | const [VectorType](classeigen_1_1matrix) & | *p2* | | | ) | | | | inlinestatic | Constructs a hyperplane passing through the three points. The dimension of the ambient space is required to be exactly 3. transform() [1/2] ----------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> template<typename XprType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Hyperplane](classeigen_1_1hyperplane)& [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::transform | ( | const [MatrixBase](classeigen_1_1matrixbase)< XprType > & | *mat*, | | | | [TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) | *traits* = `[Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb)` | | | ) | | | | inline | Applies the transformation matrix *mat* to `*this` and returns a reference to `*this`. Parameters | | | | --- | --- | | mat | the Dim x Dim transformation matrix | | traits | specifies whether the matrix *mat* represents an [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) or a more generic [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) transformation. The default is [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb). | transform() [2/2] ----------------- template<typename \_Scalar , int \_AmbientDim, int \_Options> template<int TrOptions> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Hyperplane](classeigen_1_1hyperplane)& [Eigen::Hyperplane](classeigen_1_1hyperplane)< \_Scalar, \_AmbientDim, \_Options >::transform | ( | const [Transform](classeigen_1_1transform)< Scalar, AmbientDimAtCompileTime, [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb), TrOptions > & | *t*, | | | | [TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) | *traits* = `[Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb)` | | | ) | | | | inline | Applies the transformation *t* to `*this` and returns a reference to `*this`. Parameters | | | | --- | --- | | t | the transformation of dimension Dim | | traits | specifies whether the transformation *t* represents an [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) or a more generic [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) transformation. The default is [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb). Other kind of transformations are not supported. | --- The documentation for this class was generated from the following file:* [Hyperplane.h](https://eigen.tuxfamily.org/dox/Hyperplane_8h_source.html)
programming_docs
eigen3 Eigen::Dense Eigen::Dense ============ The type used to identify a dense storage. --- The documentation for this struct was generated from the following file:* [Constants.h](https://eigen.tuxfamily.org/dox/Constants_8h_source.html) eigen3 Eigen::Diagonal Eigen::Diagonal =============== ### template<typename MatrixType, int \_DiagIndex> class Eigen::Diagonal< MatrixType, \_DiagIndex > Expression of a diagonal/subdiagonal/superdiagonal in a matrix. Parameters | | | | --- | --- | | MatrixType | the type of the object in which we are taking a sub/main/super diagonal | | DiagIndex | the index of the sub/super diagonal. The default is 0 and it means the main diagonal. A positive value means a superdiagonal, a negative value means a subdiagonal. You can also use DynamicIndex so the index can be set at runtime. | The matrix is not required to be square. This class represents an expression of the main diagonal, or any sub/super diagonal of a square matrix. It is the return type of [MatrixBase::diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3) and [MatrixBase::diagonal(Index)](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7) and most of the time this is the only way it is used. See also [MatrixBase::diagonal()](classeigen_1_1matrixbase#ab5768147536273eb2dbdfa389cfd26a3), [MatrixBase::diagonal(Index)](classeigen_1_1matrixbase#a8a13d4b8efbd7797ee8efd3dd988a7f7) Inherits internal::dense\_xpr\_base::type. --- The documentation for this class was generated from the following file:* [Diagonal.h](https://eigen.tuxfamily.org/dox/Diagonal_8h_source.html) eigen3 SparseQR module SparseQR module =============== Provides QR decomposition for sparse matrices. This module provides a simplicial version of the left-looking [Sparse](structeigen_1_1sparse) QR decomposition. The columns of the input matrix should be reordered to limit the fill-in during the decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. See the [OrderingMethods](group__orderingmethods__module) module for the list of built-in and external ordering methods. ``` #include <Eigen/SparseQR> ``` | | | --- | | | | class | [Eigen::SparseQR< \_MatrixType, \_OrderingType >](classeigen_1_1sparseqr) | | | [Sparse](structeigen_1_1sparse) left-looking QR factorization with numerical column pivoting. [More...](classeigen_1_1sparseqr#details) | | | eigen3 Eigen::EigenSolver Eigen::EigenSolver ================== ### template<typename \_MatrixType> class Eigen::EigenSolver< \_MatrixType > Computes eigenvalues and eigenvectors of general matrices. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. Currently, only real matrices are supported. | The eigenvalues and eigenvectors of a matrix \( A \) are scalars \( \lambda \) and vectors \( v \) such that \( Av = \lambda v \). If \( D \) is a diagonal matrix with the eigenvalues on the diagonal, and \( V \) is a matrix with the eigenvectors as its columns, then \( A V = V D \). The matrix \( V \) is almost always invertible, in which case we have \( A = V D V^{-1} \). This is called the eigendecomposition. The eigenvalues and eigenvectors of a matrix may be complex, even when the matrix is real. However, we can choose real matrices \( V \) and \( D \) satisfying \( A V = V D \), just like the eigendecomposition, if the matrix \( D \) is not required to be diagonal, but if it is allowed to have blocks of the form \[ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \] (where \( u \) and \( v \) are real numbers) on the diagonal. These blocks correspond to complex eigenvalue pairs \( u \pm iv \). We call this variant of the eigendecomposition the pseudo-eigendecomposition. Call the function [compute()](classeigen_1_1eigensolver#a38d032b75b3e75640e3db42e7ab20c24 "Computes eigendecomposition of given matrix.") to compute the eigenvalues and eigenvectors of a given matrix. Alternatively, you can use the EigenSolver(const MatrixType&, bool) constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix.") and [eigenvectors()](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7 "Returns the eigenvectors of given matrix.") functions. The [pseudoEigenvalueMatrix()](classeigen_1_1eigensolver#a4979eafe0aeef06b19ada7fa5e19db17 "Returns the block-diagonal matrix in the pseudo-eigendecomposition.") and [pseudoEigenvectors()](classeigen_1_1eigensolver#a4e796226f06e1f7347cf03a38755a155 "Returns the pseudo-eigenvectors of given matrix.") methods allow the construction of the pseudo-eigendecomposition. The documentation for EigenSolver(const MatrixType&, bool) contains an example of the typical use of this class. Note The implementation is adapted from [JAMA](http://math.nist.gov/javanumerics/jama/) (public domain). Their code is based on EISPACK. See also [MatrixBase::eigenvalues()](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d "Computes the eigenvalues of a matrix."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices."), class [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver "Computes eigenvalues and eigenvectors of selfadjoint matrices.") | | | --- | | | | typedef std::complex< RealScalar > | [ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed) | | | Complex scalar type for [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b "Synonym for the template parameter _MatrixType."). [More...](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed) | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed), ColsAtCompileTime, 1, Options &~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxColsAtCompileTime, 1 > | [EigenvalueType](classeigen_1_1eigensolver#adc446bcb60572758fa64515f2825db62) | | | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix."). [More...](classeigen_1_1eigensolver#adc446bcb60572758fa64515f2825db62) | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > | [EigenvectorsType](classeigen_1_1eigensolver#aa140354e2f7d5ce34c6488c39e19f2c2) | | | Type for matrix of eigenvectors as returned by [eigenvectors()](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7 "Returns the eigenvectors of given matrix."). [More...](classeigen_1_1eigensolver#aa140354e2f7d5ce34c6488c39e19f2c2) | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) | | | | typedef \_MatrixType | [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) | | | Synonym for the template parameter `_MatrixType`. | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1eigensolver#a017d49fe0d59874b70a2fcf35e5aa373) | | | Scalar type for matrices of type [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b "Synonym for the template parameter _MatrixType."). | | | | | | --- | | | | template<typename InputType > | | [EigenSolver](classeigen_1_1eigensolver) & | [compute](classeigen_1_1eigensolver#a38d032b75b3e75640e3db42e7ab20c24) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeEigenvectors=true) | | | Computes eigendecomposition of given matrix. [More...](classeigen_1_1eigensolver#a38d032b75b3e75640e3db42e7ab20c24) | | | | | [EigenSolver](classeigen_1_1eigensolver#a3af22d721a6401365881b2ef252d26aa) () | | | Default constructor. [More...](classeigen_1_1eigensolver#a3af22d721a6401365881b2ef252d26aa) | | | | template<typename InputType > | | | [EigenSolver](classeigen_1_1eigensolver#a7e8ab3d89ea525af5f27f1a8e805fae1) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeEigenvectors=true) | | | Constructor; computes eigendecomposition of given matrix. [More...](classeigen_1_1eigensolver#a7e8ab3d89ea525af5f27f1a8e805fae1) | | | | | [EigenSolver](classeigen_1_1eigensolver#aa4edf56ecc178b277b75c13a2ca1089f) ([Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) size) | | | Default constructor with memory preallocation. [More...](classeigen_1_1eigensolver#aa4edf56ecc178b277b75c13a2ca1089f) | | | | const [EigenvalueType](classeigen_1_1eigensolver#adc446bcb60572758fa64515f2825db62) & | [eigenvalues](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97) () const | | | Returns the eigenvalues of given matrix. [More...](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97) | | | | [EigenvectorsType](classeigen_1_1eigensolver#aa140354e2f7d5ce34c6488c39e19f2c2) | [eigenvectors](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7) () const | | | Returns the eigenvectors of given matrix. [More...](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7) | | | | [Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) | [getMaxIterations](classeigen_1_1eigensolver#aa7668af4bcb47cd92cfe10640589d88f) () | | | Returns the maximum number of iterations. | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1eigensolver#ac4af54fadc33abcdd1778c87bfbf005b) () const | | | | [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) | [pseudoEigenvalueMatrix](classeigen_1_1eigensolver#a4979eafe0aeef06b19ada7fa5e19db17) () const | | | Returns the block-diagonal matrix in the pseudo-eigendecomposition. [More...](classeigen_1_1eigensolver#a4979eafe0aeef06b19ada7fa5e19db17) | | | | const [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) & | [pseudoEigenvectors](classeigen_1_1eigensolver#a4e796226f06e1f7347cf03a38755a155) () const | | | Returns the pseudo-eigenvectors of given matrix. [More...](classeigen_1_1eigensolver#a4e796226f06e1f7347cf03a38755a155) | | | | [EigenSolver](classeigen_1_1eigensolver) & | [setMaxIterations](classeigen_1_1eigensolver#a6cff220aadfd8d8c1366b915ddefd164) ([Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) maxIters) | | | Sets the maximum number of iterations allowed. | | | ComplexScalar ------------- template<typename \_MatrixType > | | | --- | | typedef std::complex<RealScalar> [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed) | Complex scalar type for [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b "Synonym for the template parameter _MatrixType."). This is `std::complex<Scalar>` if [Scalar](classeigen_1_1eigensolver#a017d49fe0d59874b70a2fcf35e5aa373 "Scalar type for matrices of type MatrixType.") is real (e.g., `float` or `double`) and just `Scalar` if [Scalar](classeigen_1_1eigensolver#a017d49fe0d59874b70a2fcf35e5aa373 "Scalar type for matrices of type MatrixType.") is complex. EigenvalueType -------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed), ColsAtCompileTime, 1, Options & ~[RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), MaxColsAtCompileTime, 1> [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[EigenvalueType](classeigen_1_1eigensolver#adc446bcb60572758fa64515f2825db62) | Type for vector of eigenvalues as returned by [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix."). This is a column vector with entries of type [ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed "Complex scalar type for MatrixType."). The length of the vector is the size of [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b "Synonym for the template parameter _MatrixType."). EigenvectorsType ---------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[EigenvectorsType](classeigen_1_1eigensolver#aa140354e2f7d5ce34c6488c39e19f2c2) | Type for matrix of eigenvectors as returned by [eigenvectors()](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7 "Returns the eigenvectors of given matrix."). This is a square matrix with entries of type [ComplexScalar](classeigen_1_1eigensolver#a4d0b2a773357d0a6ec98e026f04002ed "Complex scalar type for MatrixType."). The size is the same as the size of [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b "Synonym for the template parameter _MatrixType."). Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) | **[Deprecated:](deprecated#_deprecated000014)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 EigenSolver() [1/3] ------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[EigenSolver](classeigen_1_1eigensolver) | ( | | ) | | | inline | Default constructor. The default constructor is useful in cases in which the user intends to perform decompositions via EigenSolver::compute(const MatrixType&, bool). See also [compute()](classeigen_1_1eigensolver#a38d032b75b3e75640e3db42e7ab20c24 "Computes eigendecomposition of given matrix.") for an example. EigenSolver() [2/3] ------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[EigenSolver](classeigen_1_1eigensolver) | ( | [Index](classeigen_1_1eigensolver#a5bff6a6bc0efac67d52c60c2c3deb9ee) | *size* | ) | | | inlineexplicit | Default constructor with memory preallocation. Like the default constructor but with preallocation of the internal data according to the specified problem *size*. See also [EigenSolver()](classeigen_1_1eigensolver#a3af22d721a6401365881b2ef252d26aa "Default constructor.") EigenSolver() [3/3] ------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::[EigenSolver](classeigen_1_1eigensolver) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeEigenvectors* = `true` | | | ) | | | | inlineexplicit | Constructor; computes eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose eigendecomposition is to be computed. | | [in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. | This constructor calls [compute()](classeigen_1_1eigensolver#a38d032b75b3e75640e3db42e7ab20c24 "Computes eigendecomposition of given matrix.") to compute the eigenvalues and eigenvectors. Example: ``` MatrixXd A = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; EigenSolver<MatrixXd> es(A); cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl; cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl; complex<double> lambda = es.eigenvalues()[0]; cout << "Consider the first eigenvalue, lambda = " << lambda << endl; VectorXcd v = es.eigenvectors().col(0); cout << "If v is the corresponding eigenvector, then lambda \* v = " << endl << lambda * v << endl; cout << "... and A \* v = " << endl << A.cast<complex<double> >() * v << endl << endl; MatrixXcd D = es.eigenvalues().asDiagonal(); MatrixXcd V = es.eigenvectors(); cout << "Finally, V \* D \* V^(-1) = " << endl << V * D * V.inverse() << endl; ``` Output: ``` Here is a random 6x6 matrix, A: 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 The eigenvalues of A are: (0.049,1.06) (0.049,-1.06) (0.967,0) (0.353,0) (0.618,0.129) (0.618,-0.129) The matrix of eigenvectors, V, is: (-0.292,-0.454) (-0.292,0.454) (-0.0607,0) (-0.733,0) (0.59,-0.121) (0.59,0.121) (0.134,-0.104) (0.134,0.104) (-0.799,0) (0.136,0) (0.334,0.368) (0.334,-0.368) (-0.422,-0.18) (-0.422,0.18) (0.192,0) (0.0563,0) (-0.335,-0.143) (-0.335,0.143) (-0.589,0.0274) (-0.589,-0.0274) (-0.0788,0) (-0.627,0) (0.322,-0.155) (0.322,0.155) (-0.248,0.132) (-0.248,-0.132) (0.401,0) (0.218,0) (-0.335,-0.0761) (-0.335,0.0761) (0.105,0.18) (0.105,-0.18) (-0.392,0) (-0.00564,0) (-0.0324,0.103) (-0.0324,-0.103) Consider the first eigenvalue, lambda = (0.049,1.06) If v is the corresponding eigenvector, then lambda * v = (0.466,-0.331) (0.117,0.137) (0.17,-0.456) (-0.0578,-0.622) (-0.152,-0.256) (-0.186,0.12) ... and A * v = (0.466,-0.331) (0.117,0.137) (0.17,-0.456) (-0.0578,-0.622) (-0.152,-0.256) (-0.186,0.12) Finally, V * D * V^(-1) = (0.68,-4.44e-16) (-0.33,-5.55e-17) (-0.27,-1.11e-16) (-0.717,-4.44e-16) (-0.687,8.88e-16) (0.0259,0) (-0.211,2.22e-16) (0.536,1.91e-17) (0.0268,0) (0.214,0) (-0.198,1.33e-15) (0.678,0) (0.566,2.22e-16) (-0.444,-1.53e-16) (0.904,-2.22e-16) (-0.967,-1.11e-16) (-0.74,4.44e-16) (0.225,2.22e-16) (0.597,-2.22e-16) (0.108,-2.78e-16) (0.832,-2.22e-16) (-0.514,-1.11e-16) (-0.782,0) (-0.408,-2.22e-16) (0.823,-2.22e-16) (-0.0452,-1.67e-16) (0.271,0) (-0.726,1.11e-16) (0.998,-8.88e-16) (0.275,4.44e-16) (-0.605,2.91e-16) (0.258,-6.94e-18) (0.435,-6.94e-17) (0.608,1.39e-17) (-0.563,5.27e-16) (0.0486,7.11e-17) ``` See also [compute()](classeigen_1_1eigensolver#a38d032b75b3e75640e3db42e7ab20c24 "Computes eigendecomposition of given matrix.") compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | --- | --- | --- | --- | | [EigenSolver](classeigen_1_1eigensolver)& [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeEigenvectors* = `true` | | | ) | | | Computes eigendecomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose eigendecomposition is to be computed. | | [in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. | Returns Reference to `*this` This function computes the eigenvalues of the real matrix `matrix`. The [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix.") function can be used to retrieve them. If `computeEigenvectors` is true, then the eigenvectors are also computed and can be retrieved by calling [eigenvectors()](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7 "Returns the eigenvectors of given matrix."). The matrix is first reduced to real Schur form using the [RealSchur](classeigen_1_1realschur "Performs a real Schur decomposition of a square matrix.") class. The Schur decomposition is then used to compute the eigenvalues and eigenvectors. The cost of the computation is dominated by the cost of the Schur decomposition, which is very approximately \( 25n^3 \) (where \( n \) is the size of the matrix) if `computeEigenvectors` is true, and \( 10n^3 \) if `computeEigenvectors` is false. This method reuses of the allocated data in the [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices.") object. Example: ``` EigenSolver<MatrixXf> es; MatrixXf A = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); es.compute(A, /\* computeEigenvectors = \*/ false); cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; es.compute(A + [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(4,4), false); // re-use es to compute eigenvalues of A+I cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; ``` Output: ``` The eigenvalues of A are: (0.755,0.528) (0.755,-0.528) (-0.323,0.0965) (-0.323,-0.0965) The eigenvalues of A+I are: (1.75,0.528) (1.75,-0.528) (0.677,0.0965) (0.677,-0.0965) ``` eigenvalues() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [EigenvalueType](classeigen_1_1eigensolver#adc446bcb60572758fa64515f2825db62)& [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::eigenvalues | ( | | ) | const | | inline | Returns the eigenvalues of given matrix. Returns A const reference to the column vector containing the eigenvalues. Precondition Either the constructor EigenSolver(const MatrixType&,bool) or the member function compute(const MatrixType&, bool) has been called before. The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are not sorted in any particular order. Example: ``` MatrixXd ones = [MatrixXd::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); EigenSolver<MatrixXd> es(ones, false); cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << es.eigenvalues() << endl; ``` Output: ``` The eigenvalues of the 3x3 matrix of ones are: (-5.31e-17,0) (3,0) (0,0) ``` See also [eigenvectors()](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7 "Returns the eigenvectors of given matrix."), [pseudoEigenvalueMatrix()](classeigen_1_1eigensolver#a4979eafe0aeef06b19ada7fa5e19db17 "Returns the block-diagonal matrix in the pseudo-eigendecomposition."), [MatrixBase::eigenvalues()](classeigen_1_1matrixbase#a30430fa3d5b4e74d312fd4f502ac984d "Computes the eigenvalues of a matrix.") eigenvectors() -------------- template<typename MatrixType > | | | --- | | [EigenSolver](classeigen_1_1eigensolver)< [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) >::[EigenvectorsType](classeigen_1_1eigensolver#aa140354e2f7d5ce34c6488c39e19f2c2) [Eigen::EigenSolver](classeigen_1_1eigensolver)< [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) >::eigenvectors | Returns the eigenvectors of given matrix. Returns Matrix whose columns are the (possibly complex) eigenvectors. Precondition Either the constructor EigenSolver(const MatrixType&,bool) or the member function compute(const MatrixType&, bool) has been called before, and `computeEigenvectors` was set to true (the default). Column \( k \) of the returned matrix is an eigenvector corresponding to eigenvalue number \( k \) as returned by [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix."). The eigenvectors are normalized to have (Euclidean) norm equal to one. The matrix returned by this function is the matrix \( V \) in the eigendecomposition \( A = V D V^{-1} \), if it exists. Example: ``` MatrixXd ones = [MatrixXd::Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101)(3,3); EigenSolver<MatrixXd> es(ones); cout << "The first eigenvector of the 3x3 matrix of ones is:" << endl << es.eigenvectors().col(0) << endl; ``` Output: ``` The first eigenvector of the 3x3 matrix of ones is: (-0.816,0) (0.408,0) (0.408,0) ``` See also [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix."), [pseudoEigenvectors()](classeigen_1_1eigensolver#a4e796226f06e1f7347cf03a38755a155 "Returns the pseudo-eigenvectors of given matrix.") info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::info | ( | | ) | const | | inline | Returns NumericalIssue if the input contains INF or NaN values or overflow occurred. Returns Success otherwise. pseudoEigenvalueMatrix() ------------------------ template<typename MatrixType > | | | --- | | [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) [Eigen::EigenSolver](classeigen_1_1eigensolver)< [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b) >::pseudoEigenvalueMatrix | Returns the block-diagonal matrix in the pseudo-eigendecomposition. Returns A block-diagonal matrix. Precondition Either the constructor EigenSolver(const MatrixType&,bool) or the member function compute(const MatrixType&, bool) has been called before. The matrix \( D \) returned by this function is real and block-diagonal. The blocks on the diagonal are either 1-by-1 or 2-by-2 blocks of the form \( \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \). These blocks are not sorted in any particular order. The matrix \( D \) and the matrix \( V \) returned by [pseudoEigenvectors()](classeigen_1_1eigensolver#a4e796226f06e1f7347cf03a38755a155 "Returns the pseudo-eigenvectors of given matrix.") satisfy \( AV = VD \). See also [pseudoEigenvectors()](classeigen_1_1eigensolver#a4e796226f06e1f7347cf03a38755a155 "Returns the pseudo-eigenvectors of given matrix.") for an example, [eigenvalues()](classeigen_1_1eigensolver#a114189009e42f5e03372a7a3dfa33b97 "Returns the eigenvalues of given matrix.") pseudoEigenvectors() -------------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [MatrixType](classeigen_1_1eigensolver#a83acd180404ddaac8a678fa65a6b632b)& [Eigen::EigenSolver](classeigen_1_1eigensolver)< \_MatrixType >::pseudoEigenvectors | ( | | ) | const | | inline | Returns the pseudo-eigenvectors of given matrix. Returns Const reference to matrix whose columns are the pseudo-eigenvectors. Precondition Either the constructor EigenSolver(const MatrixType&,bool) or the member function compute(const MatrixType&, bool) has been called before, and `computeEigenvectors` was set to true (the default). The real matrix \( V \) returned by this function and the block-diagonal matrix \( D \) returned by [pseudoEigenvalueMatrix()](classeigen_1_1eigensolver#a4979eafe0aeef06b19ada7fa5e19db17 "Returns the block-diagonal matrix in the pseudo-eigendecomposition.") satisfy \( AV = VD \). Example: ``` MatrixXd A = [MatrixXd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; EigenSolver<MatrixXd> es(A); MatrixXd D = es.pseudoEigenvalueMatrix(); MatrixXd V = es.pseudoEigenvectors(); cout << "The pseudo-eigenvalue matrix D is:" << endl << D << endl; cout << "The pseudo-eigenvector matrix V is:" << endl << V << endl; cout << "Finally, V \* D \* V^(-1) = " << endl << V * D * V.inverse() << endl; ``` Output: ``` Here is a random 6x6 matrix, A: 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 The pseudo-eigenvalue matrix D is: 0.049 1.06 0 0 0 0 -1.06 0.049 0 0 0 0 0 0 0.967 0 0 0 0 0 0 0.353 0 0 0 0 0 0 0.618 0.129 0 0 0 0 -0.129 0.618 The pseudo-eigenvector matrix V is: -0.571 -0.888 -0.066 -1.13 17.2 -3.53 0.263 -0.204 -0.869 0.21 9.73 10.7 -0.827 -0.352 0.209 0.0871 -9.74 -4.17 -1.15 0.0535 -0.0857 -0.971 9.36 -4.52 -0.485 0.258 0.436 0.337 -9.74 -2.21 0.206 0.353 -0.426 -0.00873 -0.944 2.98 Finally, V * D * V^(-1) = 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 ``` See also [pseudoEigenvalueMatrix()](classeigen_1_1eigensolver#a4979eafe0aeef06b19ada7fa5e19db17 "Returns the block-diagonal matrix in the pseudo-eigendecomposition."), [eigenvectors()](classeigen_1_1eigensolver#a66288022802172e3ee059283b26201d7 "Returns the eigenvectors of given matrix.") --- The documentation for this class was generated from the following file:* [EigenSolver.h](https://eigen.tuxfamily.org/dox/EigenSolver_8h_source.html)
programming_docs
eigen3 Eigen::AngleAxis Eigen::AngleAxis ================ ### template<typename \_Scalar> class Eigen::AngleAxis< \_Scalar > Represents a 3D rotation as a rotation angle around an arbitrary 3D axis. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the coefficients. | Warning When setting up an [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.") object, the axis vector **must** **be** **normalized**. The following two typedefs are provided for convenience: * `AngleAxisf` for `float` * `AngleAxisd` for `double` Combined with [MatrixBase::Unit](classeigen_1_1matrixbase#ac7a03a61014f37ddd2fe61ebac0c9539){X,Y,Z}, [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.") can be used to easily mimic Euler-angles. Here is an example: ``` Matrix3f m; m = [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(0.25*M_PI, [Vector3f::UnitX](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d)()) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(0.5*M_PI, [Vector3f::UnitY](classeigen_1_1matrixbase#a00850083489e20249b1d05b394fc5efc)()) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(0.33*M_PI, [Vector3f::UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0)()); cout << m << endl << "is unitary: " << m.isUnitary() << endl; ``` Output: ``` 1.19e-07 0 1 0.969 -0.249 0 0.249 0.969 1.19e-07 is unitary: 1 ``` Note This class is not aimed to be used to store a rotation transformation, but rather to make easier the creation of other rotation ([Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), rotation [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.")) and transformation objects. See also class [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations."), class [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space."), [MatrixBase::UnitX()](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d) | | | --- | | | | typedef \_Scalar | [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) | | | | Public Types inherited from [Eigen::RotationBase< AngleAxis< \_Scalar >, 3 >](classeigen_1_1rotationbase) | | typedef [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Dim > | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | | | | typedef internal::traits< [AngleAxis](classeigen_1_1angleaxis)< \_Scalar > >::[Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) | | | | | | --- | | | | [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) & | [angle](classeigen_1_1angleaxis#a5bcd8f21aa18b629e2b5c64d03caeb96) () | | | | [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) | [angle](classeigen_1_1angleaxis#a5c9671c47a3b26c2b585042f42426d7e) () const | | | | | [AngleAxis](classeigen_1_1angleaxis#a08752eea5e7762f2585fbd8136dc7b4b) () | | | | template<typename OtherScalarType > | | | [AngleAxis](classeigen_1_1angleaxis#a7c6bdf26fc162c6423d7cff097a9a00e) (const [AngleAxis](classeigen_1_1angleaxis)< OtherScalarType > &other) | | | | template<typename Derived > | | | [AngleAxis](classeigen_1_1angleaxis#a2e6eee34f611e4c762fdd4e4bc5935e6) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &m) | | | | template<typename QuatDerived > | | | [AngleAxis](classeigen_1_1angleaxis#af3476809863b6a0dfe17f49a3dcc6530) (const [QuaternionBase](classeigen_1_1quaternionbase)< QuatDerived > &q) | | | | template<typename Derived > | | | [AngleAxis](classeigen_1_1angleaxis#ab58bae23f0af86d66d8aa1dc5c1dbe39) (const [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) &[angle](classeigen_1_1angleaxis#a5c9671c47a3b26c2b585042f42426d7e), const [MatrixBase](classeigen_1_1matrixbase)< Derived > &[axis](classeigen_1_1angleaxis#aeb281dd2ac2332c876da30ee708f15fe)) | | | | [Vector3](classeigen_1_1matrix) & | [axis](classeigen_1_1angleaxis#a6fe6a68ebe395dd43953592813cdeee5) () | | | | const [Vector3](classeigen_1_1matrix) & | [axis](classeigen_1_1angleaxis#aeb281dd2ac2332c876da30ee708f15fe) () const | | | | template<typename NewScalarType > | | internal::cast\_return\_type< [AngleAxis](classeigen_1_1angleaxis), [AngleAxis](classeigen_1_1angleaxis)< NewScalarType > >::type | [cast](classeigen_1_1angleaxis#a566d3231bd0e209469ab8ee37aada6a4) () const | | | | template<typename Derived > | | [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) > & | [fromRotationMatrix](classeigen_1_1angleaxis#a2e35689645f69ba886df1a0a14b76ffe) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &mat) | | | Sets `*this` from a 3x3 rotation matrix. | | | | [AngleAxis](classeigen_1_1angleaxis) | [inverse](classeigen_1_1angleaxis#af01cf54d9e86fe12b41a4b7f70d06c2b) () const | | | | bool | [isApprox](classeigen_1_1angleaxis#ac0f2fe0856dedd6f46891a70ec9f402d) (const [AngleAxis](classeigen_1_1angleaxis) &other, const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) >::Real &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) >::dummy\_precision()) const | | | | [QuaternionType](classeigen_1_1quaternion) | [operator\*](classeigen_1_1angleaxis#ad0a428546d0ff7ed06cca4c4a1e4522a) (const [AngleAxis](classeigen_1_1angleaxis) &other) const | | | | [QuaternionType](classeigen_1_1quaternion) | [operator\*](classeigen_1_1angleaxis#a36fa315e0326beacbf249b56fcd0596e) (const [QuaternionType](classeigen_1_1quaternion) &other) const | | | | template<typename Derived > | | [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) > & | [operator=](classeigen_1_1angleaxis#a61747e22cfd8bd36456de2deed877fca) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &mat) | | | | template<typename QuatDerived > | | [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) > & | [operator=](classeigen_1_1angleaxis#aa79ba9655d1b8fe12d75082902cea88b) (const [QuaternionBase](classeigen_1_1quaternionbase)< QuatDerived > &q) | | | | [Matrix3](classeigen_1_1matrix) | [toRotationMatrix](classeigen_1_1angleaxis#ad333c1b13aa0fa01d7fab30f18d2cd46) (void) const | | | | Public Member Functions inherited from [Eigen::RotationBase< AngleAxis< \_Scalar >, 3 >](classeigen_1_1rotationbase) | | [AngleAxis](classeigen_1_1angleaxis)< \_Scalar > | [inverse](classeigen_1_1rotationbase#a8532fb716ea4267cf8bbdb99e5e54837) () const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [matrix](classeigen_1_1rotationbase#a91b5bdb1c7b90ec7b33107c6f7d3b171) () const | | | | internal::rotation\_base\_generic\_product\_selector< [AngleAxis](classeigen_1_1angleaxis)< \_Scalar >, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType | [operator\*](classeigen_1_1rotationbase#a09a4757e7aff7a95bebf4fa8a965a4eb) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &e) const | | | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode > | [operator\*](classeigen_1_1rotationbase#aaca1c3d834e2bc7ebfd046d96cac990c) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Mode, Options > &t) const | | | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim, Isometry > | [operator\*](classeigen_1_1rotationbase#a26d0603783666526a98d08bd45d9c751) (const [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4), Dim > &t) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [operator\*](classeigen_1_1rotationbase#a05af64a1bc759c5fed4ff7afd1414ba4) (const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1rotationbase#af9b43eac462d7aa70b018efd49c13ef4) > &s) const | | | | [RotationMatrixType](classeigen_1_1rotationbase#a83602509674c9d635551998460342951) | [toRotationMatrix](classeigen_1_1rotationbase#a94fe3683c867c39d34505932b07e956a) () const | | | Scalar ------ template<typename \_Scalar > | | | --- | | typedef \_Scalar [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::[Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) | the scalar type of the coefficients AngleAxis() [1/5] ----------------- template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::[AngleAxis](classeigen_1_1angleaxis) | ( | | ) | | | inline | Default constructor without initialization. AngleAxis() [2/5] ----------------- template<typename \_Scalar > template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::[AngleAxis](classeigen_1_1angleaxis) | ( | const [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) & | *angle*, | | | | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *axis* | | | ) | | | | inline | Constructs and initialize the angle-axis rotation from an *angle* in radian and an *axis* which **must** **be** **normalized**. Warning If the *axis* vector is not normalized, then the angle-axis object represents an invalid rotation. AngleAxis() [3/5] ----------------- template<typename \_Scalar > template<typename QuatDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::[AngleAxis](classeigen_1_1angleaxis) | ( | const [QuaternionBase](classeigen_1_1quaternionbase)< QuatDerived > & | *q* | ) | | | inlineexplicit | Constructs and initialize the angle-axis rotation from a quaternion *q*. This function implicitly normalizes the quaternion *q*. AngleAxis() [4/5] ----------------- template<typename \_Scalar > template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::[AngleAxis](classeigen_1_1angleaxis) | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *m* | ) | | | inlineexplicit | Constructs and initialize the angle-axis rotation from a 3x3 rotation matrix. AngleAxis() [5/5] ----------------- template<typename \_Scalar > template<typename OtherScalarType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::[AngleAxis](classeigen_1_1angleaxis) | ( | const [AngleAxis](classeigen_1_1angleaxis)< OtherScalarType > & | *other* | ) | | | inlineexplicit | Copy constructor with scalar type conversion angle() [1/2] ------------- template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8)& [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::angle | ( | | ) | | | inline | Returns a read-write reference to the stored angle in radian angle() [2/2] ------------- template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::angle | ( | | ) | const | | inline | Returns the value of the rotation angle in radian axis() [1/2] ------------ template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Vector3](classeigen_1_1matrix)& [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::axis | ( | | ) | | | inline | Returns a read-write reference to the stored rotation axis. Warning The rotation axis must remain a **unit** vector. axis() [2/2] ------------ template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Vector3](classeigen_1_1matrix)& [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::axis | ( | | ) | const | | inline | Returns the rotation axis cast() ------ template<typename \_Scalar > template<typename NewScalarType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::cast\_return\_type<[AngleAxis](classeigen_1_1angleaxis),[AngleAxis](classeigen_1_1angleaxis)<NewScalarType> >::type [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::cast | ( | | ) | const | | inline | Returns `*this` with scalar type casted to *NewScalarType* Note that if *NewScalarType* is equal to the current scalar type of `*this` then this function smartly returns a const reference to `*this`. inverse() --------- template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [AngleAxis](classeigen_1_1angleaxis) [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::inverse | ( | | ) | const | | inline | Returns the inverse rotation, i.e., an angle-axis with opposite rotation angle isApprox() ---------- template<typename \_Scalar > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::isApprox | ( | const [AngleAxis](classeigen_1_1angleaxis)< \_Scalar > & | *other*, | | | | const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) >::Real & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8)>::dummy_precision()` | | | ) | | const | | inline | Returns `true` if `*this` is approximately equal to *other*, within the precision determined by *prec*. See also [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) operator\*() [1/2] ------------------ template<typename \_Scalar > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [QuaternionType](classeigen_1_1quaternion) [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::operator\* | ( | const [AngleAxis](classeigen_1_1angleaxis)< \_Scalar > & | *other* | ) | const | | inline | Concatenates two rotations operator\*() [2/2] ------------------ template<typename \_Scalar > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [QuaternionType](classeigen_1_1quaternion) [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::operator\* | ( | const [QuaternionType](classeigen_1_1quaternion) & | *other* | ) | const | | inline | Concatenates two rotations operator=() [1/2] ----------------- template<typename \_Scalar > template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [AngleAxis](classeigen_1_1angleaxis)<[Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8)>& [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::operator= | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *mat* | ) | | Set `*this` from a 3x3 rotation matrix *mat*. operator=() [2/2] ----------------- template<typename \_Scalar > template<typename QuatDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | [AngleAxis](classeigen_1_1angleaxis)<[Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8)>& [Eigen::AngleAxis](classeigen_1_1angleaxis)< \_Scalar >::operator= | ( | const [QuaternionBase](classeigen_1_1quaternionbase)< QuatDerived > & | *q* | ) | | Set `*this` from a **unit** quaternion. The resulting axis is normalized, and the computed angle is in the [0,pi] range. This function implicitly normalizes the quaternion *q*. toRotationMatrix() ------------------ template<typename Scalar > | | | | | | | | --- | --- | --- | --- | --- | --- | | [AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) >::[Matrix3](classeigen_1_1matrix) [Eigen::AngleAxis](classeigen_1_1angleaxis)< [Scalar](classeigen_1_1angleaxis#acd9b10692d7d726b28670e4d3a282fe8) >::toRotationMatrix | ( | void | | ) | const | Constructs and Returns an equivalent 3x3 rotation matrix. --- The documentation for this class was generated from the following file:* [AngleAxis.h](https://eigen.tuxfamily.org/dox/AngleAxis_8h_source.html) eigen3 Eigen::HouseholderSequence Eigen::HouseholderSequence ========================== ### template<typename VectorsType, typename CoeffsType, int Side> class Eigen::HouseholderSequence< VectorsType, CoeffsType, Side > Sequence of Householder reflections acting on subspaces with decreasing size. This is defined in the Householder module. ``` #include <Eigen/Householder> ``` Template Parameters | | | | --- | --- | | VectorsType | type of matrix containing the Householder vectors | | CoeffsType | type of vector containing the Householder coefficients | | Side | either OnTheLeft (the default) or OnTheRight | This class represents a product sequence of Householder reflections where the first Householder reflection acts on the whole space, the second Householder reflection leaves the one-dimensional subspace spanned by the first unit vector invariant, the third Householder reflection leaves the two-dimensional subspace spanned by the first two unit vectors invariant, and so on up to the last reflection which leaves all but one dimensions invariant and acts only on the last dimension. Such sequences of Householder reflections are used in several algorithms to zero out certain parts of a matrix. Indeed, the methods [HessenbergDecomposition::matrixQ()](classeigen_1_1hessenbergdecomposition#a346441e4902a58d43d698ac3da6ff791 "Reconstructs the orthogonal matrix Q in the decomposition."), [Tridiagonalization::matrixQ()](classeigen_1_1tridiagonalization#a000f7392eda930576ffd2af1fae54af2 "Returns the unitary matrix Q in the decomposition."), [HouseholderQR::householderQ()](classeigen_1_1householderqr#affd506c10ef2d25f56e7b1f9f25ff885), and [ColPivHouseholderQR::householderQ()](classeigen_1_1colpivhouseholderqr#a28ab9d8916ca609c5469c4c192fbfa28) all return a HouseholderSequence. More precisely, the class HouseholderSequence represents an \( n \times n \) matrix \( H \) of the form \( H = \prod\_{i=0}^{n-1} H\_i \) where the i-th Householder reflection is \( H\_i = I - h\_i v\_i v\_i^\* \). The i-th Householder coefficient \( h\_i \) is a scalar and the i-th Householder vector \( v\_i \) is a vector of the form \[ v\_i = [\underbrace{0, \ldots, 0}\_{i-1\mbox{ zeros}}, 1, \underbrace{\*, \ldots,\*}\_{n-i\mbox{ arbitrary entries}} ]. \] The last \( n-i \) entries of \( v\_i \) are called the essential part of the Householder vector. Typical usages are listed below, where H is a [HouseholderSequence](classeigen_1_1householdersequence "Sequence of Householder reflections acting on subspaces with decreasing size."): ``` A.applyOnTheRight(H); // A = A \* H A.applyOnTheLeft(H); // A = H \* A A.applyOnTheRight(H.adjoint()); // A = A \* H^\* A.applyOnTheLeft(H.adjoint()); // A = H^\* \* A MatrixXd Q = H; // conversion to a dense matrix ``` In addition to the adjoint, you can also apply the inverse (=adjoint), the transpose, and the conjugate operators. See the documentation for [HouseholderSequence(const VectorsType&, const CoeffsType&)](classeigen_1_1householdersequence#af6aeede87ed8dac452f4fa8b4f45c3f2 "Constructor.") for an example. See also [MatrixBase::applyOnTheLeft()](classeigen_1_1matrixbase#a3a08ad41e81d8ad4a37b5d5c7490e765), [MatrixBase::applyOnTheRight()](classeigen_1_1matrixbase#a45d91752925d2757fc8058a293b15462) | | | --- | | | | [AdjointReturnType](classeigen_1_1householdersequence) | [adjoint](classeigen_1_1householdersequence#af3967dc6ea7a3671224a4b4a9776a329) () const | | | Adjoint (conjugate transpose) of the Householder sequence. | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1householdersequence#a35475457c973a66539417b61449cbf5a) () const EIGEN\_NOEXCEPT | | | Number of columns of transformation viewed as a matrix. [More...](classeigen_1_1householdersequence#a35475457c973a66539417b61449cbf5a) | | | | [ConjugateReturnType](classeigen_1_1householdersequence) | [conjugate](classeigen_1_1householdersequence#ac71fa85a4f177b0aeb1026752aea5590) () const | | | Complex conjugate of the Householder sequence. | | | | template<bool Cond> | | internal::conditional< Cond, [ConjugateReturnType](classeigen_1_1householdersequence), [ConstHouseholderSequence](classeigen_1_1householdersequence) >::type | [conjugateIf](classeigen_1_1householdersequence#afe117fafd579da0371861bec910599a3) () const | | | | const [EssentialVectorType](classeigen_1_1block) | [essentialVector](classeigen_1_1householdersequence#ac91cf37b0cbea9e504c89e021fd289ba) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) k) const | | | Essential part of a Householder vector. [More...](classeigen_1_1householdersequence#ac91cf37b0cbea9e504c89e021fd289ba) | | | | | [HouseholderSequence](classeigen_1_1householdersequence#aa4b1b93fff4d5c79342974d9d2a9eec8) (const [HouseholderSequence](classeigen_1_1householdersequence) &other) | | | Copy constructor. | | | | | [HouseholderSequence](classeigen_1_1householdersequence#af6aeede87ed8dac452f4fa8b4f45c3f2) (const VectorsType &v, const CoeffsType &h) | | | Constructor. [More...](classeigen_1_1householdersequence#af6aeede87ed8dac452f4fa8b4f45c3f2) | | | | [AdjointReturnType](classeigen_1_1householdersequence) | [inverse](classeigen_1_1householdersequence#a02014cb7359500d5bd51b6f8ee4d34fc) () const | | | [Inverse](classeigen_1_1inverse "Expression of the inverse of another expression.") of the Householder sequence (equals the adjoint). | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [length](classeigen_1_1householdersequence#ac62fad812f3893f237378fe70e55bf66) () const | | | Returns the length of the Householder sequence. | | | | template<typename OtherDerived > | | internal::matrix\_type\_times\_scalar\_type< Scalar, OtherDerived >::Type | [operator\*](classeigen_1_1householdersequence#ac57e5a22f1646e04a4f8b4cba3825928) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | Computes the product of a Householder sequence with a matrix. [More...](classeigen_1_1householdersequence#ac57e5a22f1646e04a4f8b4cba3825928) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1householdersequence#ac0bef8081be2c21062c1ae015bd1c1c0) () const EIGEN\_NOEXCEPT | | | Number of rows of transformation viewed as a matrix. [More...](classeigen_1_1householdersequence#ac0bef8081be2c21062c1ae015bd1c1c0) | | | | [HouseholderSequence](classeigen_1_1householdersequence) & | [setLength](classeigen_1_1householdersequence#a30cc06d5b2ca4b7dcf5fcd53313d25fc) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [length](classeigen_1_1householdersequence#ac62fad812f3893f237378fe70e55bf66)) | | | Sets the length of the Householder sequence. [More...](classeigen_1_1householdersequence#a30cc06d5b2ca4b7dcf5fcd53313d25fc) | | | | [HouseholderSequence](classeigen_1_1householdersequence) & | [setShift](classeigen_1_1householdersequence#a2d8d996ce1085fd977850988735739f0) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [shift](classeigen_1_1householdersequence#a34482bfad5563fd8a8a4264db76ac917)) | | | Sets the shift of the Householder sequence. [More...](classeigen_1_1householdersequence#a2d8d996ce1085fd977850988735739f0) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [shift](classeigen_1_1householdersequence#a34482bfad5563fd8a8a4264db76ac917) () const | | | Returns the shift of the Householder sequence. | | | | [TransposeReturnType](classeigen_1_1householdersequence) | [transpose](classeigen_1_1householdersequence#ae0959abb2cfa16c9df2e5782e721811c) () const | | | Transpose of the Householder sequence. | | | | Public Member Functions inherited from [Eigen::EigenBase< HouseholderSequence< VectorsType, CoeffsType, Side > >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side > & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side > & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< HouseholderSequence< VectorsType, CoeffsType, Side > >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | HouseholderSequence() --------------------- template<typename VectorsType , typename CoeffsType , int Side> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::[HouseholderSequence](classeigen_1_1householdersequence) | ( | const VectorsType & | *v*, | | | | const CoeffsType & | *h* | | | ) | | | | inline | Constructor. Parameters | | | | | --- | --- | --- | | [in] | v | Matrix containing the essential parts of the Householder vectors | | [in] | h | Vector containing the Householder coefficients | Constructs the Householder sequence with coefficients given by `h` and vectors given by `v`. The i-th Householder coefficient \( h\_i \) is given by `h(i)` and the essential part of the i-th Householder vector \( v\_i \) is given by `v(k,i)` with `k` > `i` (the subdiagonal part of the i-th column). If `v` has fewer columns than rows, then the Householder sequence contains as many Householder reflections as there are columns. Note The HouseholderSequence object stores `v` and `h` by reference. Example: ``` Matrix3d v = [Matrix3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "The matrix v is:" << endl; cout << v << endl; Vector3d v0(1, v(1,0), v(2,0)); cout << "The first Householder vector is: v\_0 = " << v0.transpose() << endl; Vector3d v1(0, 1, v(2,1)); cout << "The second Householder vector is: v\_1 = " << v1.transpose() << endl; Vector3d v2(0, 0, 1); cout << "The third Householder vector is: v\_2 = " << v2.transpose() << endl; Vector3d h = [Vector3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); cout << "The Householder coefficients are: h = " << h.transpose() << endl; Matrix3d H0 = [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)() - h(0) * v0 * v0.adjoint(); cout << "The first Householder reflection is represented by H\_0 = " << endl; cout << H0 << endl; Matrix3d H1 = [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)() - h(1) * v1 * v1.adjoint(); cout << "The second Householder reflection is represented by H\_1 = " << endl; cout << H1 << endl; Matrix3d H2 = [Matrix3d::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)() - h(2) * v2 * v2.adjoint(); cout << "The third Householder reflection is represented by H\_2 = " << endl; cout << H2 << endl; cout << "Their product is H\_0 H\_1 H\_2 = " << endl; cout << H0 * H1 * H2 << endl; HouseholderSequence<Matrix3d, Vector3d> hhSeq(v, h); Matrix3d hhSeqAsMatrix(hhSeq); cout << "If we construct a HouseholderSequence from v and h" << endl; cout << "and convert it to a matrix, we get:" << endl; cout << hhSeqAsMatrix << endl; ``` Output: ``` The matrix v is: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 The first Householder vector is: v_0 = 1 -0.211 0.566 The second Householder vector is: v_1 = 0 1 -0.605 The third Householder vector is: v_2 = 0 0 1 The Householder coefficients are: h = 0.108 -0.0452 0.258 The first Householder reflection is represented by H_0 = 0.892 0.0228 -0.0611 0.0228 0.995 0.0129 -0.0611 0.0129 0.965 The second Householder reflection is represented by H_1 = 1 0 0 0 1.05 -0.0273 0 -0.0273 1.02 The third Householder reflection is represented by H_2 = 1 0 0 0 1 0 0 0 0.742 Their product is H_0 H_1 H_2 = 0.892 0.0255 -0.0466 0.0228 1.04 -0.0105 -0.0611 -0.0129 0.728 If we construct a HouseholderSequence from v and h and convert it to a matrix, we get: 0.892 0.0255 -0.0466 0.0228 1.04 -0.0105 -0.0611 -0.0129 0.728 ``` See also [setLength()](classeigen_1_1householdersequence#a30cc06d5b2ca4b7dcf5fcd53313d25fc "Sets the length of the Householder sequence."), [setShift()](classeigen_1_1householdersequence#a2d8d996ce1085fd977850988735739f0 "Sets the shift of the Householder sequence.") cols() ------ template<typename VectorsType , typename CoeffsType , int Side> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::cols | ( | void | | ) | const | | inline | Number of columns of transformation viewed as a matrix. Returns Number of columns This equals the dimension of the space that the transformation acts on. conjugateIf() ------------- template<typename VectorsType , typename CoeffsType , int Side> template<bool Cond> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::conditional<Cond,[ConjugateReturnType](classeigen_1_1householdersequence),[ConstHouseholderSequence](classeigen_1_1householdersequence)>::type [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::conjugateIf | ( | | ) | const | | inline | Returns an expression of the complex conjugate of `*this` if Cond==true, returns `*this` otherwise. essentialVector() ----------------- template<typename VectorsType , typename CoeffsType , int Side> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [EssentialVectorType](classeigen_1_1block) [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::essentialVector | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *k* | ) | const | | inline | Essential part of a Householder vector. Parameters | | | | | --- | --- | --- | | [in] | k | Index of Householder reflection | Returns Vector containing non-trivial entries of k-th Householder vector This function returns the essential part of the Householder vector \( v\_i \). This is a vector of length \( n-i \) containing the last \( n-i \) entries of the vector \[ v\_i = [\underbrace{0, \ldots, 0}\_{i-1\mbox{ zeros}}, 1, \underbrace{\*, \ldots,\*}\_{n-i\mbox{ arbitrary entries}} ]. \] The index \( i \) equals `k` + [shift()](classeigen_1_1householdersequence#a34482bfad5563fd8a8a4264db76ac917 "Returns the shift of the Householder sequence."), corresponding to the k-th column of the matrix `v` passed to the constructor. See also [setShift()](classeigen_1_1householdersequence#a2d8d996ce1085fd977850988735739f0 "Sets the shift of the Householder sequence."), [shift()](classeigen_1_1householdersequence#a34482bfad5563fd8a8a4264db76ac917 "Returns the shift of the Householder sequence.") operator\*() ------------ template<typename VectorsType , typename CoeffsType , int Side> template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | internal::matrix\_type\_times\_scalar\_type<Scalar, OtherDerived>::Type [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | Computes the product of a Householder sequence with a matrix. Parameters | | | | | --- | --- | --- | | [in] | other | Matrix being multiplied. | Returns Expression object representing the product. This function computes \( HM \) where \( H \) is the Householder sequence represented by `*this` and \( M \) is the matrix `other`. rows() ------ template<typename VectorsType , typename CoeffsType , int Side> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::rows | ( | void | | ) | const | | inline | Number of rows of transformation viewed as a matrix. Returns Number of rows This equals the dimension of the space that the transformation acts on. setLength() ----------- template<typename VectorsType , typename CoeffsType , int Side> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [HouseholderSequence](classeigen_1_1householdersequence)& [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::setLength | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *length* | ) | | | inline | Sets the length of the Householder sequence. Parameters | | | | | --- | --- | --- | | [in] | length | New value for the length. | By default, the length \( n \) of the Householder sequence \( H = H\_0 H\_1 \ldots H\_{n-1} \) is set to the number of columns of the matrix `v` passed to the constructor, or the number of rows if that is smaller. After this function is called, the length equals `length`. See also [length()](classeigen_1_1householdersequence#ac62fad812f3893f237378fe70e55bf66 "Returns the length of the Householder sequence.") setShift() ---------- template<typename VectorsType , typename CoeffsType , int Side> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [HouseholderSequence](classeigen_1_1householdersequence)& [Eigen::HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side >::setShift | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *shift* | ) | | | inline | Sets the shift of the Householder sequence. Parameters | | | | | --- | --- | --- | | [in] | shift | New value for the shift. | By default, a HouseholderSequence object represents \( H = H\_0 H\_1 \ldots H\_{n-1} \) and the i-th column of the matrix `v` passed to the constructor corresponds to the i-th Householder reflection. After this function is called, the object represents \( H = H\_{\mathrm{shift}} H\_{\mathrm{shift}+1} \ldots H\_{n-1} \) and the i-th column of `v` corresponds to the (shift+i)-th Householder reflection. See also [shift()](classeigen_1_1householdersequence#a34482bfad5563fd8a8a4264db76ac917 "Returns the shift of the Householder sequence.") --- The documentation for this class was generated from the following file:* [HouseholderSequence.h](https://eigen.tuxfamily.org/dox/HouseholderSequence_8h_source.html)
programming_docs
eigen3 Eigen::AMDOrdering Eigen::AMDOrdering ================== ### template<typename StorageIndex> class Eigen::AMDOrdering< StorageIndex > Functor computing the *approximate* *minimum* *degree* ordering If the matrix is not structurally symmetric, an ordering of A^T+A is computed Template Parameters | | | | --- | --- | | StorageIndex | The type of indices of the matrix | See also [COLAMDOrdering](classeigen_1_1colamdordering) | | | --- | | | | template<typename MatrixType > | | void | [operator()](classeigen_1_1amdordering#afce433557abcba9e49fa81581a58fa51) (const MatrixType &mat, [PermutationType](classeigen_1_1permutationmatrix) &perm) | | | | template<typename SrcType , unsigned int SrcUpLo> | | void | [operator()](classeigen_1_1amdordering#a7f3fd7224b084f0f5655c97ea8eb6466) (const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< SrcType, SrcUpLo > &mat, [PermutationType](classeigen_1_1permutationmatrix) &perm) | | | operator()() [1/2] ------------------ template<typename StorageIndex > template<typename MatrixType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::AMDOrdering](classeigen_1_1amdordering)< StorageIndex >::operator() | ( | const MatrixType & | *mat*, | | | | [PermutationType](classeigen_1_1permutationmatrix) & | *perm* | | | ) | | | | inline | Compute the permutation vector from a sparse matrix This routine is much faster if the input matrix is column-major operator()() [2/2] ------------------ template<typename StorageIndex > template<typename SrcType , unsigned int SrcUpLo> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::AMDOrdering](classeigen_1_1amdordering)< StorageIndex >::operator() | ( | const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< SrcType, SrcUpLo > & | *mat*, | | | | [PermutationType](classeigen_1_1permutationmatrix) & | *perm* | | | ) | | | | inline | Compute the permutation with a selfadjoint matrix --- The documentation for this class was generated from the following file:* [Ordering.h](https://eigen.tuxfamily.org/dox/Ordering_8h_source.html) eigen3 Eigen::ArrayWrapper Eigen::ArrayWrapper =================== ### template<typename ExpressionType> class Eigen::ArrayWrapper< ExpressionType > Expression of a mathematical vector or matrix as an array object. This class is the return type of [MatrixBase::array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497), and most of the time this is the only way it is use. See also [MatrixBase::array()](classeigen_1_1matrixbase#a354c33eec32ceb4193d002f4d41c0497), class [MatrixWrapper](classeigen_1_1matrixwrapper "Expression of an array as a mathematical vector or matrix.") | | | --- | | | | void | [resize](classeigen_1_1arraywrapper#a1dff702690e4d5795b3d08c5c6c1d082) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1arraywrapper#a1c5e643b7dc161066754e0812d57c4f1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | Public Member Functions inherited from [Eigen::ArrayBase< ArrayWrapper< ExpressionType > >](classeigen_1_1arraybase) | | [MatrixWrapper](classeigen_1_1matrixwrapper)< [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > > | [matrix](classeigen_1_1arraybase#af01e9ea8087e390af8af453bbe4c276c) () | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > & | [operator\*=](classeigen_1_1arraybase#a6a5ff80e9d85106a1c9958219961c21d) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > & | [operator+=](classeigen_1_1arraybase#a9cc9fdb4d0d6eb80a45107b86aacbfed) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > & | [operator-=](classeigen_1_1arraybase#aac76a5e5e735b97f955189825cef7e2c) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > & | [operator/=](classeigen_1_1arraybase#a1717e11dfe9341e9cfba13140cedddce) (const [ArrayBase](classeigen_1_1arraybase)< OtherDerived > &other) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > & | [operator=](classeigen_1_1arraybase#a8587d8d893f5225a4511e9d76d9fe3cc) (const [ArrayBase](classeigen_1_1arraybase) &other) | | | | [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > & | [operator=](classeigen_1_1arraybase#a80cacb05b6881fba659efb2377e4fd22) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | bool | [all](classeigen_1_1densebase#ae42ab60296c120e9f45ce3b44e1761a4) () const | | | | bool | [allFinite](classeigen_1_1densebase#af1e669fd3aaae50a4870dc1b8f3b8884) () const | | | | bool | [any](classeigen_1_1densebase#abfbf4cb72dd577e62fbe035b1c53e695) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [begin](classeigen_1_1densebase#a57591454af931f9dffa71c9da28d5641) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [begin](classeigen_1_1densebase#ad9368ce70b06167ec5fc19398d329f5e) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cbegin](classeigen_1_1densebase#ae9a3dfd9b826ba3103de0128576fb15b) () const | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [cend](classeigen_1_1densebase#aeb3b76f02986c2af2521d07164b5ffde) () const | | | | [ColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a1c0e1b6067ec1de6cb8799da55aa7d30) () | | | | [ConstColwiseReturnType](classeigen_1_1vectorwiseop) | [colwise](classeigen_1_1densebase#a58837c81de446efbdb58da07b73a63c1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [count](classeigen_1_1densebase#a229be090c665b9bf7d1fcdfd1ab6e0c1) () const | | | | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | [end](classeigen_1_1densebase#ae71d079e16d91360d10066b316b48485) () | | | | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | [end](classeigen_1_1densebase#ab34773522e43bfb02e9cf652d7b5dd60) () const | | | | EvalReturnType | [eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b) () const | | | | void | [fill](classeigen_1_1densebase#a9be169c308801411aa24be93d30930bf) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | template<unsigned int Added, unsigned int Removed> | | EIGEN\_DEPRECATED const Derived & | [flagged](classeigen_1_1densebase#a9b3f75f76ae40439be870258e80c7346) () const | | | | const [WithFormat](classeigen_1_1withformat)< Derived > | [format](classeigen_1_1densebase#ab231f1a6057f28d4244145e12c9fc0c7) (const [IOFormat](structeigen_1_1ioformat) &fmt) const | | | | bool | [hasNaN](classeigen_1_1densebase#ab13d158c900560d3e1b25d85d2d33dd6) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1densebase#a58ca41d9635a8ab3c5a268ef3f7f0d75) () const | | | | template<typename OtherDerived > | | bool | [isApprox](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isApproxToConstant](classeigen_1_1densebase#af9b150d48bc5e4366887ccb466e40c6b) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isConstant](classeigen_1_1densebase#a1ca84e4179b3e5081ed11d89bbd9e74f) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#a3c4db0c6dd974fa88bbb58b2cf3d5664) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other, const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename Derived > | | bool | [isMuchSmallerThan](classeigen_1_1densebase#adfca6ff4e473f68fbbeabbd03b7504a9) (const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::Real &other, const RealScalar &prec) const | | | | bool | [isOnes](classeigen_1_1densebase#aa56d6b4477cd3c92a9cf42f4b96e47c2) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | bool | [isZero](classeigen_1_1densebase#af36014ec300f53a65083057ed4e89822) (const RealScalar &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >::dummy\_precision()) const | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED Derived & | [lazyAssign](classeigen_1_1densebase#a6bc6c096e3bfc726f28315daecd21b3f) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a7e6987d106f1cca3ac6ab36d288cc8e1) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#aced8ffda52ff061b6586ace2657ebf30) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [maxCoeff](classeigen_1_1densebase#a3780b7a9cd184d0b4f3ea797eba9e2b3) (IndexType \*row, IndexType \*col) const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [mean](classeigen_1_1densebase#a21ac6c0419a72ad7a88ea0bc189017d7) () const | | | | template<int NaNPropagation> | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#a0739f9c868c331031c7810e21838dcb2) () const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#ac9265f4f91430b9cc75d63fb6865bb29) (IndexType \*index) const | | | | template<int NaNPropagation, typename IndexType > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [minCoeff](classeigen_1_1densebase#aa28152ba4a42b2d112e5fec5469ec4c1) (IndexType \*row, IndexType \*col) const | | | | const [NestByValue](classeigen_1_1nestbyvalue)< Derived > | [nestByValue](classeigen_1_1densebase#a3e2761e2b6da74dba1d17b40cc918bf7) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1densebase#acb8d5574eff335381e7441ade87700a0) () const | | | | template<typename OtherDerived > | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0f0e34696162b34762b2bf4bd948f90c) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | [CommaInitializer](structeigen_1_1commainitializer)< Derived > | [operator<<](classeigen_1_1densebase#a0e575eb0ba6cc6bc5f347872abd8509d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &s) | | | | Derived & | [operator=](classeigen_1_1densebase#a5281dadff89f46eef719b38e5d073a8f) (const [DenseBase](classeigen_1_1densebase) &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#ab66155169d20c035e80d521a8b918e97) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | Derived & | [operator=](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) (const [EigenBase](structeigen_1_1eigenbase)< OtherDerived > &other) | | | Copies the generic expression *other* into \*this. [More...](classeigen_1_1densebase#a58915510693d64164e567bd762e1032f) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1densebase#a03f71699bc26ca2ee4e42ec4538862d7) () const | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [prod](classeigen_1_1densebase#af119d9a4efe5a15cd83c1ccdf01b3a4f) () const | | | | template<typename Func > | | internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [redux](classeigen_1_1densebase#a63ce1e4fab36bff43bbadcdd06a67724) (const Func &func) const | | | | template<int RowFactor, int ColFactor> | | const [Replicate](classeigen_1_1replicate)< Derived, RowFactor, ColFactor > | [replicate](classeigen_1_1densebase#a60dadfe80b813d808e91e4521c722a8e) () const | | | | const [Replicate](classeigen_1_1replicate)< Derived, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [replicate](classeigen_1_1densebase#afae2d5e36f1158d1b1681dac3cdbd58e) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rowFactor, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) colFactor) const | | | | void | [resize](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | void | [resize](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | [ReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a38ea394036d8b096abf322469c80198f) () | | | | [ConstReverseReturnType](classeigen_1_1reverse) | [reverse](classeigen_1_1densebase#a9e2f3ac4019184abf95ca0e1a8d82866) () const | | | | void | [reverseInPlace](classeigen_1_1densebase#adb8045155ea45f7961fc2a5170e1d921) () | | | | [RowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#a6daa3a3156ca0e0722bf78638e1c7f28) () | | | | [ConstRowwiseReturnType](classeigen_1_1vectorwiseop) | [rowwise](classeigen_1_1densebase#aa1cabd3404528fe8cec4bab43d74bffc) () const | | | | template<typename ThenDerived , typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, ElseDerived > | [select](classeigen_1_1densebase#a65e78cfcbc9852e6923bebff4323ddca) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | template<typename ThenDerived > | | const [Select](classeigen_1_1select)< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > | [select](classeigen_1_1densebase#a57ef09a843004095f84c198dd145641b) (const [DenseBase](classeigen_1_1densebase)< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const | | | | template<typename ElseDerived > | | const [Select](classeigen_1_1select)< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > | [select](classeigen_1_1densebase#a9e8e78c75887d4539071a0b7a61ca103) (const typename ElseDerived::Scalar &thenScalar, const [DenseBase](classeigen_1_1densebase)< ElseDerived > &elseMatrix) const | | | | Derived & | [setConstant](classeigen_1_1densebase#ac2f1e50d1f567da38da1d2f07c5ab559) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aeb023532476d3f14c457367e0eb5f3f1) | | | | Derived & | [setLinSpaced](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#a5d1ce9e801fa502e02b9b8cd9141ad0a) | | | | Derived & | [setOnes](classeigen_1_1densebase#a250ef1b827e748f3f898fb2e55cb96e2) () | | | | Derived & | [setRandom](classeigen_1_1densebase#ac476e5852129ba32beaa1a8a3d7ee0db) () | | | | Derived & | [setZero](classeigen_1_1densebase#af230a143de50695d2d1fae93db7e4dcb) () | | | | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [sum](classeigen_1_1densebase#addd7080d5c202795820e361768d0140c) () const | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#af9e7e4305fdb7781f2b2f05fa801f21e) (const [DenseBase](classeigen_1_1densebase)< OtherDerived > &other) | | | | template<typename OtherDerived > | | void | [swap](classeigen_1_1densebase#a44e25adc6da9cd1d79f4c5bd7c1819cb) ([PlainObjectBase](classeigen_1_1plainobjectbase)< OtherDerived > &other) | | | | [TransposeReturnType](classeigen_1_1transpose) | [transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) () | | | | [ConstTransposeReturnType](classeigen_1_1diagonal) | [transpose](classeigen_1_1densebase#a38c0b074cf93fc194bf91141287cee3f) () const | | | | void | [transposeInPlace](classeigen_1_1densebase#ac501bd942994af7a95d95bee7a16ad2a) () | | | | CoeffReturnType | [value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0) () const | | | | template<typename Visitor > | | void | [visit](classeigen_1_1densebase#a4225b90fcc74f18dd479b401124b3841) (Visitor &func) const | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [colStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#af1bac522aee4402639189f387592000b) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a4e94e17926e1cf597deb2928e779cef6) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#abb333f6f10467f6f8d7b59c213dea49e) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rowStride](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a63bc5874eb4e320e54eb079b43b49d22) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae66b7d18b2a85f3139b703126974c900) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [coeffRef](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#adc8286576b31e11f056057be666a0ec8) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a0171eee1d9e582d1ac7ec0f18f5f615a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | Scalar & | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae6ba07bad9e3026afe54806fdefe32bb) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#aa2040f14e60fed1a4a68ca7f042e1bbf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | Scalar & | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad) () | | | | Scalar & | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000) () | | | | Scalar & | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#afeaa80359bf0c1311f91cdd74a2042a8) () | | | | Scalar & | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#a858151a06b8c0ff407232d84e695dd73) () | | | | Public Member Functions inherited from [Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#aa7231d519967c37b4f98002d80756bda) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af9fadc22d12e48c82745dad534a1671a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | CoeffReturnType | [operator()](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ab3dbba4a15d0fe90185d2900e5ef0fd1) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | CoeffReturnType | [operator[]](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a496672306836589fa04a6ab33cb0cf2a) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) index) const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | CoeffReturnType | [w](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a926f52a94f038db63c6b9103f98dcf0f) () const | | | | CoeffReturnType | [x](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a189c80109e76752b598d60dfcdab329e) () const | | | | CoeffReturnType | [y](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a0c6d6904a37805ce47a3238fbd735963) () const | | | | CoeffReturnType | [z](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#a7c60c97282d4a0f8bca16ef75e231ddb) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | enum | { [RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab) , [ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441) , [SizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da25cb495affdbd796198462b8ef06be91) , [MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306) , [MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) , [MaxSizeAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da3a459062d39cb34452518f5f201161d2) , [IsVectorAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da1156955c8099c5072934b74c72654ed0) , [NumDimensions](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da4d4548a01ba37a6c2031a3c1f0a37d34) , [Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) , [IsRowMajor](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da406b6af91d61d348ba1c9764bdd66008) , **InnerSizeAtCompileTime** , **InnerStrideAtCompileTime** , **OuterStrideAtCompileTime** } | | | | typedef random\_access\_iterator\_type | [const\_iterator](classeigen_1_1densebase#a306d9418d4b34874e9005d961c490cd2) | | | | typedef random\_access\_iterator\_type | [iterator](classeigen_1_1densebase#af5130902770642a1a057a99c397d357d) | | | | typedef [Array](classeigen_1_1array)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) | | | | typedef [Matrix](classeigen_1_1matrix)< typename internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), internal::traits< Derived >::[RowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dadb37c78ebbf15aa20b65c3b70415a1ab), internal::traits< Derived >::[ColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da787f85fd67ee5985917eb2cef6e70441), [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)|(internal::traits< Derived >::[Flags](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5da7392c9b2ad41ba3c16fdc5306c04d581) &[RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) ? [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) :[ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)), internal::traits< Derived >::[MaxRowsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dad2baadea085372837b0e80dc93be1306), internal::traits< Derived >::[MaxColsAtCompileTime](classeigen_1_1densebase#a0632b818dc6bddab3ed1dd0ff4ec4e5dacc3a41000cf1d29dd1a320b2a09d2a65) > | [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e) | | | | typedef internal::conditional< internal::is\_same< typename internal::traits< Derived >::XprKind, [MatrixXpr](structeigen_1_1matrixxpr) >::[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0), [PlainMatrix](classeigen_1_1densebase#aa301ef39d63443e9ef0b84f47350116e), [PlainArray](classeigen_1_1densebase#a65328b7d6fc10a26ff6cd5801a6a44eb) >::type | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | The plain matrix or array type corresponding to this expression. [More...](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | | | | typedef internal::traits< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | [StorageIndex](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | The type used to store indices. [More...](classeigen_1_1densebase#a2d1aba3f6c414715d830f760913c7e00) | | | | typedef [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) | [value\_type](classeigen_1_1densebase#a9276182dab8236c33f1e7abf491d504d) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Static Public Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#aed89b5cc6e3b7d9d5bd63aed245ccd6d) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const ConstantReturnType | [Constant](classeigen_1_1densebase#a1fdd3189ae3a41d250593334d82210cf) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[value](classeigen_1_1densebase#a8515f719046aa4851e385661f45595b0)) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#ad8098aa5971139a5585e623dddbea860) | | | | static const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | Sets a linearly spaced vector. [More...](classeigen_1_1densebase#aaef589c1dbd7fad93f97bd3fa1b1e768) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#ac8cfbd436a8c9fc50defee5946451176) (Sequential\_t, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | static EIGEN\_DEPRECATED const RandomAccessLinSpacedReturnType | [LinSpaced](classeigen_1_1densebase#a1c6d1dbfeb9f6491173a83eb44e14c1d) (Sequential\_t, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &low, const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &high) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a5dc65501accd02c30f7c1840c2a30a41) (const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a3340c9b997f5b53a0131cf927f93b54c) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), const CustomNullaryOp &func) | | | | template<typename CustomNullaryOp > | | static const [CwiseNullaryOp](classeigen_1_1cwisenullaryop)< CustomNullaryOp, [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) > | [NullaryExpr](classeigen_1_1densebase#a9752ee59976a4b4aad860ad1a9093e7f) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9), const CustomNullaryOp &func) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a2755cb4023f7376880523626a8e05101) () | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#a8b2a51018a73a766f5b91aef3487f013) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Ones](classeigen_1_1densebase#ab710a58e4a80fbcb2594242372c8fe56) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19) () | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#ae97f8d9d08f969c733c8144be6225756) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const [RandomReturnType](classeigen_1_1cwisenullaryop) | [Random](classeigen_1_1densebase#a7eb5f974a8f0b67eac7080db1da0e308) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#a422ddeef58bedc7bddb1d4357688d761) () | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ae41a9b5050ed27d9e93c82c9c8622cd3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe)) | | | | static const ConstantReturnType | [Zero](classeigen_1_1densebase#ac22f79b812fa564061042407f2ba8f5b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)) | | | | Protected Member Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | | [DenseBase](classeigen_1_1densebase#aa284042d0e1b0ad9b6a00db7fd2d9f7f) () | | | | Related Functions inherited from [Eigen::ArrayBase< ArrayWrapper< ExpressionType > >](classeigen_1_1arraybase) | | const [Eigen::CwiseBinaryOp](classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_pow\_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType >, const ExponentDerived > | [pow](classeigen_1_1arraybase#acb769e1ab1d809abb77c7ab98021ad81) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Eigen::ArrayBase](classeigen_1_1arraybase)< ExponentDerived > &exponents) | | | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< Derived::Scalar, ScalarExponent >, [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType >, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< ScalarExponent > > | [pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const ScalarExponent &exponent) | | | | const [CwiseBinaryOp](classeigen_1_1cwisebinaryop)< internal::scalar\_pow\_op< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), Derived::Scalar >, [Constant](classeigen_1_1densebase#a68a7ece6c5629d1e9447a321fcb14ccd)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) >, [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > > | [pow](classeigen_1_1arraybase#acb7a6224d50620991d1fb9888b8be6e6) (const [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2) &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000), const [Eigen::ArrayBase](classeigen_1_1arraybase)< [ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType > > &[x](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af163a982f5a7ad7e5c3336990b3d7000)) | | | | Related Functions inherited from [Eigen::DenseBase< Derived >](classeigen_1_1densebase) | | template<typename Derived > | | std::ostream & | [operator<<](classeigen_1_1densebase#a3806d3f42de165878dace160e6aba40a) (std::ostream &s, const [DenseBase](classeigen_1_1densebase)< Derived > &m) | | | resize() [1/2] -------------- template<typename ExpressionType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType >::resize | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *newSize* | ) | | | inline | Forwards the resizing request to the nested expression See also [DenseBase::resize(Index)](classeigen_1_1densebase#a2ec5bac4e1ab95808808ef50ccf4cb39) resize() [2/2] -------------- template<typename ExpressionType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::ArrayWrapper](classeigen_1_1arraywrapper)< ExpressionType >::resize | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inline | Forwards the resizing request to the nested expression See also [DenseBase::resize(Index,Index)](classeigen_1_1densebase#a25e2b4887b47b1f2346857d1931efa0f) --- The documentation for this class was generated from the following file:* [ArrayWrapper.h](https://eigen.tuxfamily.org/dox/ArrayWrapper_8h_source.html)
programming_docs
eigen3 Eigen::PermutationWrapper Eigen::PermutationWrapper ========================= ### template<typename \_IndicesType> class Eigen::PermutationWrapper< \_IndicesType > Class to view a vector of integers as a permutation matrix. Template Parameters | | | | --- | --- | | \_IndicesType | the type of the vector of integer (can be any compatible expression) | This class allows to view any vector expression of integers as a permutation matrix. See also class [PermutationBase](classeigen_1_1permutationbase "Base class for permutations."), class [PermutationMatrix](classeigen_1_1permutationmatrix "Permutation matrix.") | | | --- | | | | const internal::remove\_all< typename IndicesType::Nested >::type & | [indices](classeigen_1_1permutationwrapper#a88ae93cc14c136b2eec4a286b4c10c34) () const | | | | Public Member Functions inherited from [Eigen::PermutationBase< PermutationWrapper< \_IndicesType > >](classeigen_1_1permutationbase) | | [PermutationWrapper](classeigen_1_1permutationwrapper)< \_IndicesType > & | [applyTranspositionOnTheLeft](classeigen_1_1permutationbase#a4e3455bf12b56123e38a8220c6b508dc) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) j) | | | | [PermutationWrapper](classeigen_1_1permutationwrapper)< \_IndicesType > & | [applyTranspositionOnTheRight](classeigen_1_1permutationbase#a5f98da0712570d0c4b12f61839ae4193) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) i, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) j) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1permutationbase#a26961ef6cfef586d412054ee5a20d430) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [determinant](classeigen_1_1permutationbase#a1fc7a5823544700c2e0795e87f9c6d09) () const | | | | IndicesType & | [indices](classeigen_1_1permutationbase#a16fa3afafdf703399d62c80f950802f1) () | | | | const IndicesType & | [indices](classeigen_1_1permutationbase#adec727546b6882ecaa57e76d084951c5) () const | | | | InverseReturnType | [inverse](classeigen_1_1permutationbase#adb9af427f317202366c2832876064eb3) () const | | | | PlainPermutationType | [operator\*](classeigen_1_1permutationbase#a865e88989a76b7e92f39bad5250b89c4) (const InverseImpl< Other, [PermutationStorage](structeigen_1_1permutationstorage) > &other) const | | | | PlainPermutationType | [operator\*](classeigen_1_1permutationbase#ae81574e059f6b9b7de2ea747fd346a1b) (const [PermutationBase](classeigen_1_1permutationbase)< Other > &other) const | | | | [PermutationWrapper](classeigen_1_1permutationwrapper)< \_IndicesType > & | [operator=](classeigen_1_1permutationbase#a8e15540549c5a4e2d5b3b426fef8fbcf) (const [PermutationBase](classeigen_1_1permutationbase)< OtherDerived > &other) | | | | [PermutationWrapper](classeigen_1_1permutationwrapper)< \_IndicesType > & | [operator=](classeigen_1_1permutationbase#acaa7cce9ea62c811cec12e86dbb2f0de) (const TranspositionsBase< OtherDerived > &tr) | | | | void | [resize](classeigen_1_1permutationbase#a0e0fda6e84d69e02432e4770359bb532) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1permutationbase#acd7ed28ee514287f933de8467768925b) () const | | | | void | [setIdentity](classeigen_1_1permutationbase#a6805bb75fd7966ea71895c24ff196444) () | | | | void | [setIdentity](classeigen_1_1permutationbase#a830a80511a61634ef437795916f7f8da) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) newSize) | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1permutationbase#a2216f9ce7b453ac39c46ff0323daeac9) () const | | | | DenseMatrixType | [toDenseMatrix](classeigen_1_1permutationbase#addfa91a2c2c69c76159f1091368a505f) () const | | | | InverseReturnType | [transpose](classeigen_1_1permutationbase#a05805e9f4182eec3f6632e1c765b5ffe) () const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | indices() --------- template<typename \_IndicesType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::remove\_all<typename IndicesType::Nested>::type& [Eigen::PermutationWrapper](classeigen_1_1permutationwrapper)< \_IndicesType >::indices | ( | | ) | const | | inline | const version of [indices()](classeigen_1_1permutationbase#a16fa3afafdf703399d62c80f950802f1). --- The documentation for this class was generated from the following file:* [PermutationMatrix.h](https://eigen.tuxfamily.org/dox/PermutationMatrix_8h_source.html) eigen3 IterativeLinearSolvers module IterativeLinearSolvers module ============================= This module currently provides iterative methods to solve problems of the form `A` `x` = `b`, where `A` is a squared matrix, usually very large and sparse. Those solvers are accessible via the following classes: * [ConjugateGradient](classeigen_1_1conjugategradient "A conjugate gradient solver for sparse (or dense) self-adjoint problems.") for selfadjoint (hermitian) matrices, * [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems.") for rectangular least-square problems, * [BiCGSTAB](classeigen_1_1bicgstab "A bi conjugate gradient stabilized solver for sparse square problems.") for general square matrices. These iterative solvers are associated with some preconditioners: * [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix.") - not really useful * [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries.") - also called Jacobi preconditioner, work very well on diagonal dominant matrices. * [IncompleteLUT](classeigen_1_1incompletelut "Incomplete LU factorization with dual-threshold strategy.") - incomplete LU factorization with dual thresholding Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. ``` #include <Eigen/IterativeLinearSolvers> ``` | | | --- | | | | class | [Eigen::BiCGSTAB< \_MatrixType, \_Preconditioner >](classeigen_1_1bicgstab) | | | A bi conjugate gradient stabilized solver for sparse square problems. [More...](classeigen_1_1bicgstab#details) | | | | class | [Eigen::ConjugateGradient< \_MatrixType, \_UpLo, \_Preconditioner >](classeigen_1_1conjugategradient) | | | A conjugate gradient solver for sparse (or dense) self-adjoint problems. [More...](classeigen_1_1conjugategradient#details) | | | | class | [Eigen::DiagonalPreconditioner< \_Scalar >](classeigen_1_1diagonalpreconditioner) | | | A preconditioner based on the digonal entries. [More...](classeigen_1_1diagonalpreconditioner#details) | | | | class | [Eigen::IdentityPreconditioner](classeigen_1_1identitypreconditioner) | | | A naive preconditioner which approximates any matrix as the identity matrix. [More...](classeigen_1_1identitypreconditioner#details) | | | | class | [Eigen::IncompleteLUT< \_Scalar, \_StorageIndex >](classeigen_1_1incompletelut) | | | Incomplete LU factorization with dual-threshold strategy. [More...](classeigen_1_1incompletelut#details) | | | | class | [Eigen::IterativeSolverBase< Derived >](classeigen_1_1iterativesolverbase) | | | Base class for linear iterative solvers. [More...](classeigen_1_1iterativesolverbase#details) | | | | class | [Eigen::LeastSquareDiagonalPreconditioner< \_Scalar >](classeigen_1_1leastsquarediagonalpreconditioner) | | | Jacobi preconditioner for [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems."). [More...](classeigen_1_1leastsquarediagonalpreconditioner#details) | | | | class | [Eigen::LeastSquaresConjugateGradient< \_MatrixType, \_Preconditioner >](classeigen_1_1leastsquaresconjugategradient) | | | A conjugate gradient solver for sparse (or dense) least-square problems. [More...](classeigen_1_1leastsquaresconjugategradient#details) | | | | class | [Eigen::SolveWithGuess< Decomposition, RhsType, GuessType >](classeigen_1_1solvewithguess) | | | Pseudo expression representing a solving operation. [More...](classeigen_1_1solvewithguess#details) | | | eigen3 Geometry module Geometry module =============== This module provides support for: * fixed-size homogeneous transformations * translation, scaling, 2D and 3D rotations * [quaternions](classeigen_1_1quaternion) * cross products ([MatrixBase::cross](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28), [MatrixBase::cross3](group__geometry__module#gabde56e2a0baba550815a0b05139e4d42)) * orthognal vector generation ([MatrixBase::unitOrthogonal](group__geometry__module#gaa0dc2c32a9379eeb2b4c4a05c1a6fe52)) * some linear components: [parametrized-lines](classeigen_1_1parametrizedline) and [hyperplanes](classeigen_1_1hyperplane) * [axis aligned bounding boxes](classeigen_1_1alignedbox) * [least-square transformation fitting](group__geometry__module#gab3f5a82a24490b936f8694cf8fef8e60) ``` #include <Eigen/Geometry> ``` | | | --- | | | | | [Global aligned box typedefs](group__alignedboxtypedefs) | | | | | | --- | | | | class | [Eigen::AlignedBox< \_Scalar, \_AmbientDim >](classeigen_1_1alignedbox) | | | An axis aligned box. [More...](classeigen_1_1alignedbox#details) | | | | class | [Eigen::AngleAxis< \_Scalar >](classeigen_1_1angleaxis) | | | Represents a 3D rotation as a rotation angle around an arbitrary 3D axis. [More...](classeigen_1_1angleaxis#details) | | | | class | [Eigen::Homogeneous< MatrixType, \_Direction >](classeigen_1_1homogeneous) | | | Expression of one (or a set of) homogeneous vector(s) [More...](classeigen_1_1homogeneous#details) | | | | class | [Eigen::Hyperplane< \_Scalar, \_AmbientDim, \_Options >](classeigen_1_1hyperplane) | | | A hyperplane. [More...](classeigen_1_1hyperplane#details) | | | | class | [Eigen::Map< const Quaternion< \_Scalar >, \_Options >](classeigen_1_1map_3_01const_01quaternion_3_01__scalar_01_4_00_01__options_01_4) | | | [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") expression mapping a constant memory buffer. [More...](classeigen_1_1map_3_01const_01quaternion_3_01__scalar_01_4_00_01__options_01_4#details) | | | | class | [Eigen::Map< Quaternion< \_Scalar >, \_Options >](classeigen_1_1map_3_01quaternion_3_01__scalar_01_4_00_01__options_01_4) | | | Expression of a quaternion from a memory buffer. [More...](classeigen_1_1map_3_01quaternion_3_01__scalar_01_4_00_01__options_01_4#details) | | | | class | [Eigen::ParametrizedLine< \_Scalar, \_AmbientDim, \_Options >](classeigen_1_1parametrizedline) | | | A parametrized line. [More...](classeigen_1_1parametrizedline#details) | | | | class | [Eigen::Quaternion< \_Scalar, \_Options >](classeigen_1_1quaternion) | | | The quaternion class used to represent 3D orientations and rotations. [More...](classeigen_1_1quaternion#details) | | | | class | [Eigen::QuaternionBase< Derived >](classeigen_1_1quaternionbase) | | | Base class for quaternion expressions. [More...](classeigen_1_1quaternionbase#details) | | | | class | [Eigen::Rotation2D< \_Scalar >](classeigen_1_1rotation2d) | | | Represents a rotation/orientation in a 2 dimensional space. [More...](classeigen_1_1rotation2d#details) | | | | class | [Eigen::Transform< \_Scalar, \_Dim, \_Mode, \_Options >](classeigen_1_1transform) | | | Represents an homogeneous transformation in a N dimensional space. [More...](classeigen_1_1transform#details) | | | | class | [Eigen::Translation< \_Scalar, \_Dim >](classeigen_1_1translation) | | | Represents a translation transformation. [More...](classeigen_1_1translation#details) | | | | class | [Eigen::UniformScaling< \_Scalar >](classeigen_1_1uniformscaling) | | | Represents a generic uniform scaling transformation. [More...](classeigen_1_1uniformscaling#details) | | | | | | --- | | | | typedef [AngleAxis](classeigen_1_1angleaxis)< double > | [Eigen::AngleAxisd](group__geometry__module#gaed936d6e9192d97f00a9608081fa9b64) | | | | typedef [AngleAxis](classeigen_1_1angleaxis)< float > | [Eigen::AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf) | | | | typedef [Quaternion](classeigen_1_1quaternion)< double > | [Eigen::Quaterniond](group__geometry__module#ga5daab8e66aa480465000308455578830) | | | | typedef [Quaternion](classeigen_1_1quaternion)< float > | [Eigen::Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< double >, [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) > | [Eigen::QuaternionMapAlignedd](group__geometry__module#ga4289f38cc6ecf302e07d2365abc6a902) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< float >, [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) > | [Eigen::QuaternionMapAlignedf](group__geometry__module#gadaf7f3ee984d9828ca94d66355f0b226) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< double >, 0 > | [Eigen::QuaternionMapd](group__geometry__module#ga89412d1dcf23537e5990dfb3089ace76) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< float >, 0 > | [Eigen::QuaternionMapf](group__geometry__module#ga867ff508ac860bdf7cab3b8a8fc1048d) | | | | typedef [Rotation2D](classeigen_1_1rotation2d)< double > | [Eigen::Rotation2Dd](group__geometry__module#gab7af1ccdfb6c865c27fe1fd6bd9e759f) | | | | typedef [Rotation2D](classeigen_1_1rotation2d)< float > | [Eigen::Rotation2Df](group__geometry__module#ga35e2cace3ada497794734edb8bc33b6e) | | | | | | --- | | | | template<typename OtherDerived > | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [Eigen::MatrixBase< Derived >::cross](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | const CrossReturnType | [Eigen::VectorwiseOp< ExpressionType, Direction >::cross](group__geometry__module#ga2fe1a2a012ce0ab0e8da6af134073039) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | template<typename OtherDerived > | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [Eigen::MatrixBase< Derived >::cross3](group__geometry__module#gabde56e2a0baba550815a0b05139e4d42) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other) const | | | | [Matrix](classeigen_1_1matrix)< [Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), 3, 1 > | [Eigen::MatrixBase< Derived >::eulerAngles](group__geometry__module#ga17994d2e81b723295f5bc3b1f862ed3b) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a0, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a1, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) a2) const | | | | const HNormalizedReturnType | [Eigen::MatrixBase< Derived >::hnormalized](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) () const | | | homogeneous normalization [More...](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19) | | | | const [HNormalizedReturnType](classeigen_1_1cwisebinaryop) | [Eigen::VectorwiseOp< ExpressionType, Direction >::hnormalized](group__geometry__module#ga1f220045efa302626c287088b63b6ba9) () const | | | column or row-wise homogeneous normalization [More...](group__geometry__module#ga1f220045efa302626c287088b63b6ba9) | | | | [HomogeneousReturnType](classeigen_1_1homogeneous) | [Eigen::MatrixBase< Derived >::homogeneous](group__geometry__module#gaf3229c2d3669e983075ab91f7f480cb1) () const | | | | [HomogeneousReturnType](classeigen_1_1homogeneous) | [Eigen::VectorwiseOp< ExpressionType, Direction >::homogeneous](group__geometry__module#gaf99305a3d7432318236df7b80022df37) () const | | | | template<typename Derived , typename OtherDerived > | | internal::umeyama\_transform\_matrix\_type< Derived, OtherDerived >::type | [Eigen::umeyama](group__geometry__module#gab3f5a82a24490b936f8694cf8fef8e60) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &src, const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &dst, bool with\_scaling=true) | | | Returns the transformation between two point sets. [More...](group__geometry__module#gab3f5a82a24490b936f8694cf8fef8e60) | | | | [PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) | [Eigen::MatrixBase< Derived >::unitOrthogonal](group__geometry__module#gaa0dc2c32a9379eeb2b4c4a05c1a6fe52) (void) const | | | AngleAxisd ---------- | | | --- | | typedef [AngleAxis](classeigen_1_1angleaxis)<double> [Eigen::AngleAxisd](group__geometry__module#gaed936d6e9192d97f00a9608081fa9b64) | double precision angle-axis type AngleAxisf ---------- | | | --- | | typedef [AngleAxis](classeigen_1_1angleaxis)<float> [Eigen::AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf) | single precision angle-axis type Quaterniond ----------- | | | --- | | typedef [Quaternion](classeigen_1_1quaternion)<double> [Eigen::Quaterniond](group__geometry__module#ga5daab8e66aa480465000308455578830) | double precision quaternion type Quaternionf ----------- | | | --- | | typedef [Quaternion](classeigen_1_1quaternion)<float> [Eigen::Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b) | single precision quaternion type QuaternionMapAlignedd --------------------- | | | --- | | typedef [Map](classeigen_1_1map)<[Quaternion](classeigen_1_1quaternion)<double>, [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)> [Eigen::QuaternionMapAlignedd](group__geometry__module#ga4289f38cc6ecf302e07d2365abc6a902) | [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") a 16-byte aligned array of double precision scalars as a quaternion QuaternionMapAlignedf --------------------- | | | --- | | typedef [Map](classeigen_1_1map)<[Quaternion](classeigen_1_1quaternion)<float>, [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8)> [Eigen::QuaternionMapAlignedf](group__geometry__module#gadaf7f3ee984d9828ca94d66355f0b226) | [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") a 16-byte aligned array of single precision scalars as a quaternion QuaternionMapd -------------- | | | --- | | typedef [Map](classeigen_1_1map)<[Quaternion](classeigen_1_1quaternion)<double>, 0> [Eigen::QuaternionMapd](group__geometry__module#ga89412d1dcf23537e5990dfb3089ace76) | [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") an unaligned array of double precision scalars as a quaternion QuaternionMapf -------------- | | | --- | | typedef [Map](classeigen_1_1map)<[Quaternion](classeigen_1_1quaternion)<float>, 0> [Eigen::QuaternionMapf](group__geometry__module#ga867ff508ac860bdf7cab3b8a8fc1048d) | [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") an unaligned array of single precision scalars as a quaternion Rotation2Dd ----------- | | | --- | | typedef [Rotation2D](classeigen_1_1rotation2d)<double> [Eigen::Rotation2Dd](group__geometry__module#gab7af1ccdfb6c865c27fe1fd6bd9e759f) | double precision 2D rotation type Rotation2Df ----------- | | | --- | | typedef [Rotation2D](classeigen_1_1rotation2d)<float> [Eigen::Rotation2Df](group__geometry__module#ga35e2cace3ada497794734edb8bc33b6e) | single precision 2D rotation type cross() [1/2] ------------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::cross | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns the cross product of `*this` and *other* Here is a very good explanation of cross-product: <http://xkcd.com/199/> With complex numbers, the cross product is implemented as \( (\mathbf{a}+i\mathbf{b}) \times (\mathbf{c}+i\mathbf{d}) = (\mathbf{a} \times \mathbf{c} - \mathbf{b} \times \mathbf{d}) - i(\mathbf{a} \times \mathbf{d} - \mathbf{b} \times \mathbf{c})\) See also [MatrixBase::cross3()](group__geometry__module#gabde56e2a0baba550815a0b05139e4d42) cross() [2/2] ------------- template<typename ExpressionType , int Direction> template<typename OtherDerived > | | | | | | | | --- | --- | --- | --- | --- | --- | | const [VectorwiseOp](classeigen_1_1vectorwiseop)< ExpressionType, Direction >::CrossReturnType [Eigen::VectorwiseOp](classeigen_1_1vectorwiseop)< ExpressionType, Direction >::cross | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns a matrix expression of the cross product of each column or row of the referenced expression with the *other* vector. The referenced matrix must have one dimension equal to 3. The result matrix has the same dimensions than the referenced one. See also [MatrixBase::cross()](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) cross3() -------- template<typename Derived > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::cross3 | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other* | ) | const | | inline | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns the cross product of `*this` and *other* using only the x, y, and z coefficients The size of `*this` and *other* must be four. This function is especially useful when using 4D vectors instead of 3D ones to get advantage of SSE/AltiVec vectorization. See also [MatrixBase::cross()](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28) eulerAngles() ------------- template<typename Derived > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Matrix](classeigen_1_1matrix)< typename [MatrixBase](classeigen_1_1matrixbase)< Derived >::[Scalar](classeigen_1_1densebase#a5feed465b3a8e60c47e73ecce83e39a2), 3, 1 > [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::eulerAngles | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *a0*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *a1*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *a2* | | | ) | | const | | inline | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns the Euler-angles of the rotation matrix `*this` using the convention defined by the triplet (*a0*,*a1*,*a2*) Each of the three parameters *a0*,*a1*,*a2* represents the respective rotation axis as an integer in {0,1,2}. For instance, in: ``` Vector3f ea = mat.eulerAngles(2, 0, 2); ``` "2" represents the z axis and "0" the x axis, etc. The returned angles are such that we have the following equality: ``` mat == [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(ea[0], [Vector3f::UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0)()) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(ea[1], [Vector3f::UnitX](classeigen_1_1matrixbase#a8a555b7cf626cced54670b98668c4e6d)()) * [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf)(ea[2], [Vector3f::UnitZ](classeigen_1_1matrixbase#aabdcdeff1c822a5465fcbe1f78e5afe0)()); ``` This corresponds to the right-multiply conventions (with right hand side frames). The returned angles are in the ranges [0:pi]x[-pi:pi]x[-pi:pi]. See also class [AngleAxis](classeigen_1_1angleaxis "Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.") hnormalized() [1/2] ------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | const [MatrixBase](classeigen_1_1matrixbase)< Derived >::HNormalizedReturnType [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::hnormalized | | inline | homogeneous normalization This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns a vector expression of the N-1 first coefficients of `*this` divided by that last coefficient. This can be used to convert homogeneous coordinates to affine coordinates. It is essentially a shortcut for: ``` this->head(this->[size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)()-1)/this->[coeff](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#af51b00cc45490ad698239ab6a8b94393)(this->[size](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ae106171b6fefd3f7af108a8283de36c9)()-1); ``` Example: ``` Vector4d v = [Vector4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(); Projective3d P([Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)()); cout << "v = " << v.transpose() << "]^T" << endl; cout << "v.hnormalized() = " << v.hnormalized().transpose() << "]^T" << endl; cout << "P\*v = " << (P*v).[transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c)() << "]^T" << endl; cout << "(P\*v).hnormalized() = " << (P*v).[hnormalized](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19)().transpose() << "]^T" << endl; ``` Output: ``` v = 0.68 -0.211 0.566 0.597]^T v.hnormalized() = 1.14 -0.354 0.949]^T P*v = 0.663 -0.16 -0.13 0.91]^T (P*v).hnormalized() = 0.729 -0.176 -0.143]^T ``` See also [VectorwiseOp::hnormalized()](group__geometry__module#ga1f220045efa302626c287088b63b6ba9 "column or row-wise homogeneous normalization") hnormalized() [2/2] ------------------- template<typename ExpressionType , int Direction> | | | | | --- | --- | --- | | | | | --- | | const [VectorwiseOp](classeigen_1_1vectorwiseop)< ExpressionType, Direction >::[HNormalizedReturnType](classeigen_1_1cwisebinaryop) [Eigen::VectorwiseOp](classeigen_1_1vectorwiseop)< ExpressionType, Direction >::hnormalized | | inline | column or row-wise homogeneous normalization This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns an expression of the first N-1 coefficients of each column (or row) of `*this` divided by the last coefficient of each column (or row). This can be used to convert homogeneous coordinates to affine coordinates. It is conceptually equivalent to calling [MatrixBase::hnormalized()](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19 "homogeneous normalization") to each column (or row) of `*this`. Example: ``` Matrix4Xd M = [Matrix4Xd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,5); Projective3d P([Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)()); cout << "The matrix M is:" << endl << M << endl << endl; cout << "M.colwise().hnormalized():" << endl << M.colwise().hnormalized() << endl << endl; cout << "P\*M:" << endl << P*M << endl << endl; cout << "(P\*M).colwise().hnormalized():" << endl << (P*M).colwise().hnormalized() << endl << endl; ``` Output: ``` The matrix M is: 0.68 0.823 -0.444 -0.27 0.271 -0.211 -0.605 0.108 0.0268 0.435 0.566 -0.33 -0.0452 0.904 -0.717 0.597 0.536 0.258 0.832 0.214 M.colwise().hnormalized(): 1.14 1.53 -1.72 -0.325 1.27 -0.354 -1.13 0.419 0.0322 2.03 0.949 -0.614 -0.175 1.09 -3.35 P*M: 0.186 -0.589 0.369 1.33 -1.23 -0.871 -0.337 0.127 -0.715 0.091 -0.158 -0.0104 0.312 0.429 -0.478 0.992 0.777 -0.373 0.468 -0.651 (P*M).colwise().hnormalized(): 0.188 -0.759 -0.989 2.85 1.89 -0.877 -0.433 -0.342 -1.53 -0.14 -0.16 -0.0134 -0.837 0.915 0.735 ``` See also [MatrixBase::hnormalized()](group__geometry__module#gadc0e3dd3510cb5a6e70aca9aab1cbf19 "homogeneous normalization") homogeneous() [1/2] ------------------- template<typename Derived > | | | | | --- | --- | --- | | | | | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::[HomogeneousReturnType](classeigen_1_1homogeneous) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::homogeneous | | inline | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns a vector expression that is one longer than the vector argument, with the value 1 symbolically appended as the last coefficient. This can be used to convert affine coordinates to homogeneous coordinates. This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column. Example: ``` Vector3d v = [Vector3d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(), [w](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#af683e04b3926aaf4091581ca24ca09ad); Projective3d P([Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)()); cout << "v = [" << v.transpose() << "]^T" << endl; cout << "h.homogeneous() = [" << v.homogeneous().transpose() << "]^T" << endl; cout << "(P \* v.homogeneous()) = [" << (P * v.homogeneous()).[transpose](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c)() << "]^T" << endl; cout << "(P \* v.homogeneous()).hnormalized() = [" << (P * v.homogeneous()).[eval](classeigen_1_1densebase#aa73e57a2f0f7cfcb4ad4d55ea0b6414b)().hnormalized().transpose() << "]^T" << endl; ``` Output: ``` v = [ 0.68 -0.211 0.566]^T h.homogeneous() = [ 0.68 -0.211 0.566 1]^T (P * v.homogeneous()) = [ 1.27 0.772 0.0154 -0.419]^T (P * v.homogeneous()).hnormalized() = [ -3.03 -1.84 -0.0367]^T ``` See also [VectorwiseOp::homogeneous()](group__geometry__module#gaf99305a3d7432318236df7b80022df37), class [Homogeneous](classeigen_1_1homogeneous "Expression of one (or a set of) homogeneous vector(s)") homogeneous() [2/2] ------------------- template<typename ExpressionType , int Direction> | | | | | --- | --- | --- | | | | | --- | | [Homogeneous](classeigen_1_1homogeneous)< ExpressionType, Direction > [Eigen::VectorwiseOp](classeigen_1_1vectorwiseop)< ExpressionType, Direction >::homogeneous | | inline | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns an expression where the value 1 is symbolically appended as the final coefficient to each column (or row) of the matrix. This can be used to convert affine coordinates to homogeneous coordinates. Example: ``` Matrix3Xd M = [Matrix3Xd::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(3,5); Projective3d P([Matrix4d::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)()); cout << "The matrix M is:" << endl << M << endl << endl; cout << "M.colwise().homogeneous():" << endl << M.colwise().homogeneous() << endl << endl; cout << "P \* M.colwise().homogeneous():" << endl << P * M.colwise().homogeneous() << endl << endl; cout << "P \* M.colwise().homogeneous().hnormalized(): " << endl << (P * M.colwise().homogeneous()).colwise().hnormalized() << endl << endl; ``` Output: ``` The matrix M is: 0.68 0.597 -0.33 0.108 -0.27 -0.211 0.823 0.536 -0.0452 0.0268 0.566 -0.605 -0.444 0.258 0.904 M.colwise().homogeneous(): 0.68 0.597 -0.33 0.108 -0.27 -0.211 0.823 0.536 -0.0452 0.0268 0.566 -0.605 -0.444 0.258 0.904 1 1 1 1 1 P * M.colwise().homogeneous(): 0.0832 -0.477 -1.21 -0.545 -0.452 0.998 0.779 0.695 0.894 0.277 -0.271 -0.608 -0.895 -0.544 -0.874 -0.728 -0.551 0.202 -0.21 -0.469 P * M.colwise().homogeneous().hnormalized(): -0.114 0.866 -6 2.6 0.962 -1.37 -1.41 3.44 -4.27 -0.591 0.373 1.1 -4.43 2.6 1.86 ``` See also [MatrixBase::homogeneous()](group__geometry__module#gaf3229c2d3669e983075ab91f7f480cb1), class [Homogeneous](classeigen_1_1homogeneous "Expression of one (or a set of) homogeneous vector(s)") umeyama() --------- template<typename Derived , typename OtherDerived > | | | | | | --- | --- | --- | --- | | internal::umeyama\_transform\_matrix\_type<Derived, OtherDerived>::type Eigen::umeyama | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *src*, | | | | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *dst*, | | | | bool | *with\_scaling* = `true` | | | ) | | | Returns the transformation between two point sets. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` The algorithm is based on: "Least-squares estimation of transformation parameters between two point patterns", Shinji Umeyama, PAMI 1991, DOI: 10.1109/34.88573 It estimates parameters \( c, \mathbf{R}, \) and \( \mathbf{t} \) such that \begin{align\*} \frac{1}{n} \sum\_{i=1}^n \vert\vert y\_i - (c\mathbf{R}x\_i + \mathbf{t}) \vert\vert\_2^2 \end{align\*} is minimized. The algorithm is based on the analysis of the covariance matrix \( \Sigma\_{\mathbf{x}\mathbf{y}} \in \mathbb{R}^{d \times d} \) of the input point sets \( \mathbf{x} \) and \( \mathbf{y} \) where \(d\) is corresponding to the dimension (which is typically small). The analysis is involving the SVD having a complexity of \(O(d^3)\) though the actual computational effort lies in the covariance matrix computation which has an asymptotic lower bound of \(O(dm)\) when the input point sets have dimension \(d \times m\). Currently the method is working only for floating point matrices. Parameters | | | | --- | --- | | src | Source points \( \mathbf{x} = \left( x\_1, \hdots, x\_n \right) \). | | dst | Destination points \( \mathbf{y} = \left( y\_1, \hdots, y\_n \right) \). | | with\_scaling | Sets \( c=1 \) when `false` is passed. | Returns The homogeneous transformation \begin{align\*} T = \begin{bmatrix} c\mathbf{R} & \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix} \end{align\*} minimizing the residual above. This transformation is always returned as an [Eigen::Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). unitOrthogonal() ---------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [MatrixBase](classeigen_1_1matrixbase)< Derived >::[PlainObject](classeigen_1_1densebase#aae45af9b5aca5a9caae98fd201f47cc4) [Eigen::MatrixBase](classeigen_1_1matrixbase)< Derived >::unitOrthogonal | ( | void | | ) | const | | inline | This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Returns a unit vector which is orthogonal to `*this` The size of `*this` must be at least 2. If the size is exactly 2, then the returned vector is a counter clock wise rotation of `*this`, i.e., (-y,x).[normalized()](classeigen_1_1matrixbase#a5cf2fd4c57e59604fd4116158fd34308). See also [cross()](group__geometry__module#ga0024b44eca99cb7135887c2aaf319d28)
programming_docs
eigen3 Catalog of coefficient-wise math functions Catalog of coefficient-wise math functions ========================================== This table presents a catalog of the coefficient-wise math functions supported by Eigen. In this table, `a`, `b`, refer to [Array](classeigen_1_1array "General-purpose arrays with easy API for coefficient-wise operations.") objects or expressions, and `m` refers to a linear algebra Matrix/Vector object. Standard scalar types are abbreviated as follows: * `int:` `i32` * `float:` `f` * `double:` `d` * `std::complex<float>`: `cf` * `std::complex<double>`: `cd` For each row, the first column list the equivalent calls for arrays, and matrices when supported. Of course, all functions are available for matrices by first casting it as an array: `m.array()`. The third column gives some hints in the underlying scalar implementation. In most cases, Eigen does not implement itself the math function but relies on the STL for standard scalar types, or user-provided functions for custom scalar types. For instance, some simply calls the respective function of the STL while preserving [argument-dependent lookup](http://en.cppreference.com/w/cpp/language/adl) for custom types. The following: ``` using std::foo; foo(a[i]); ``` means that the STL's function `std::foo` will be potentially called if it is compatible with the underlying scalar type. If not, then the user must ensure that an overload of the function foo is available for the given scalar type (usually defined in the same namespace as the given scalar type). This also means that, unless specified, if the function `std::foo` is available only in some recent c++ versions (e.g., c++11), then the respective Eigen's function/method will be usable on standard types only if the compiler support the required c++ version. | API | Description | Default scalar implementation | SIMD | | --- | --- | --- | --- | | | | Basic operations | | a.[abs](group__coeffwisemathfunctions)(); [abs](namespaceeigen#ae27242789e7e62a8c42579b79be59b1a)(a); m.[cwiseAbs](group__coeffwisemathfunctions)(); | absolute value ( \( |a\_i| \)) | using [std::abs](http://en.cppreference.com/w/cpp/numeric/math/fabs); abs(a[i]); | SSE2, AVX (i32,f,d) | | a.[inverse](group__coeffwisemathfunctions)(); [inverse](namespaceeigen#ae9de9064c3b832ee804c0e0957e80334)(a); m.[cwiseInverse](group__coeffwisemathfunctions)(); | inverse value ( \( 1/a\_i \)) | 1/a[i]; | All engines (f,d,fc,fd) | | a.[conjugate](group__coeffwisemathfunctions)(); [conj](namespaceeigen#ab84f39a06a18e1ebb23f8be80345b79d)(a); m.[conjugate](group__coeffwisemathfunctions)(); | [complex conjugate](https://en.wikipedia.org/wiki/Complex_conjugate) ( \( \bar{a\_i} \)), no-op for real | using [std::conj](http://en.cppreference.com/w/cpp/numeric/complex/conj); conj(a[i]); | All engines (fc,fd) | | a.[arg](group__coeffwisemathfunctions)(); [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1)(a); m.[cwiseArg](group__coeffwisemathfunctions)(); | phase angle of complex number | using [std::arg](http://en.cppreference.com/w/cpp/numeric/complex/arg); arg(a[i]); | All engines (fc,fd) | | Exponential functions | | a.[exp](group__coeffwisemathfunctions)(); [exp](namespaceeigen#ae491aecf7dab66ac7e11008c5766694d)(a); | \( e \) raised to the given power ( \( e^{a\_i} \)) | using [std::exp](http://en.cppreference.com/w/cpp/numeric/math/exp); exp(a[i]); | SSE2, AVX (f,d) | | a.[log](group__coeffwisemathfunctions)(); [log](namespaceeigen#ae8bb75ba4f5f30a7571146dbfa653c6d)(a); | natural (base \( e \)) logarithm ( \( \ln({a\_i}) \)) | using [std::log](http://en.cppreference.com/w/cpp/numeric/math/log); log(a[i]); | SSE2, AVX (f) | | a.[log1p](group__coeffwisemathfunctions)(); [log1p](namespaceeigen#ac5c8a2cded6b59628f2de04f24d2fff4)(a); | natural (base \( e \)) logarithm of 1 plus the given number ( \( \ln({1+a\_i}) \)) | built-in generic implementation based on `log`, plus `using` [`std::log1p`](http://en.cppreference.com/w/cpp/numeric/math/log1p) ; [c++11] | | | a.[log10](group__coeffwisemathfunctions)(); [log10](namespaceeigen#a25256faeec3ffd0f3615a0e1e45dfb14)(a); | base 10 logarithm ( \( \log\_{10}({a\_i}) \)) | using [std::log10](http://en.cppreference.com/w/cpp/numeric/math/log10); log10(a[i]); | | | Power functions | | a.[pow](classeigen_1_1arraybase#a5df3d99d47747b72d61f235c9fb925e3)(b); [pow](classeigen_1_1arraybase#acb769e1ab1d809abb77c7ab98021ad81)(a,b); | raises a number to the given power ( \( a\_i ^ {b\_i} \)) `a` and `b` can be either an array or scalar. | using [std::pow](http://en.cppreference.com/w/cpp/numeric/math/pow); pow(a[i],b[i]); (plus builtin for integer types) | | | a.[sqrt](group__coeffwisemathfunctions)(); [sqrt](namespaceeigen#af4f536e8ea56702e63088efb3706d1f0)(a); m.[cwiseSqrt](group__coeffwisemathfunctions)(); | computes square root ( \( \sqrt a\_i \)) | using [std::sqrt](http://en.cppreference.com/w/cpp/numeric/math/sqrt); sqrt(a[i]); | SSE2, AVX (f,d) | | a.[rsqrt](group__coeffwisemathfunctions)(); [rsqrt](namespaceeigen#a6374a6a9e972e9358d7ab3fced32d7d5)(a); | [reciprocal square root](https://en.wikipedia.org/wiki/Fast_inverse_square_root) ( \( 1/{\sqrt a\_i} \)) | using [std::sqrt](http://en.cppreference.com/w/cpp/numeric/math/sqrt); 1/sqrt(a[i]); | SSE2, AVX, AltiVec, ZVector (f,d) (approx + 1 Newton iteration) | | a.[square](group__coeffwisemathfunctions)(); [square](namespaceeigen#af28ef8cae3b37bcf1b47910cd6f20d4c)(a); | computes square power ( \( a\_i^2 \)) | a[i]\*a[i] | All (i32,f,d,cf,cd) | | a.[cube](group__coeffwisemathfunctions)(); [cube](namespaceeigen#ae04fac7e3068f05c3f01982554a21d80)(a); | computes cubic power ( \( a\_i^3 \)) | a[i]\*a[i]\*a[i] | All (i32,f,d,cf,cd) | | a.[abs2](group__coeffwisemathfunctions)(); [abs2](namespaceeigen#a54cc34b64b4935307efc06d56cd531df)(a); m.[cwiseAbs2](group__coeffwisemathfunctions)(); | computes the squared absolute value ( \( |a\_i|^2 \)) | real: a[i]\*a[i] complex: real(a[i])\*real(a[i]) + imag(a[i])\*imag(a[i]) | All (i32,f,d) | | Trigonometric functions | | a.[sin](group__coeffwisemathfunctions)(); [sin](namespaceeigen#ae6e8ad270ff41c088d7651567594f796)(a); | computes sine | using [std::sin](http://en.cppreference.com/w/cpp/numeric/math/sin); sin(a[i]); | SSE2, AVX (f) | | a.[cos](group__coeffwisemathfunctions)(); [cos](namespaceeigen#ad01d50a42869218f1d54af13f71517a6)(a); | computes cosine | using [std::cos](http://en.cppreference.com/w/cpp/numeric/math/cos); cos(a[i]); | SSE2, AVX (f) | | a.[tan](group__coeffwisemathfunctions)(); [tan](namespaceeigen#a3bc116a6243f38c22f851581aa7b521a)(a); | computes tangent | using [std::tan](http://en.cppreference.com/w/cpp/numeric/math/tan); tan(a[i]); | | | a.[asin](group__coeffwisemathfunctions)(); [asin](namespaceeigen#a6c5c246b877ac331495d21e7a5d51616)(a); | computes arc sine ( \( \sin^{-1} a\_i \)) | using [std::asin](http://en.cppreference.com/w/cpp/numeric/math/asin); asin(a[i]); | | | a.[acos](group__coeffwisemathfunctions)(); [acos](namespaceeigen#a3fe3a136370fefae062591304c6a7ebd)(a); | computes arc cosine ( \( \cos^{-1} a\_i \)) | using [std::acos](http://en.cppreference.com/w/cpp/numeric/math/acos); acos(a[i]); | | | a.[atan](group__coeffwisemathfunctions)(); [atan](namespaceeigen#a230744e17147d12e8ef3f2fc3796f64f)(a); | computes arc tangent ( \( \tan^{-1} a\_i \)) | using [std::atan](http://en.cppreference.com/w/cpp/numeric/math/atan); atan(a[i]); | | | Hyperbolic functions | | a.[sinh](group__coeffwisemathfunctions)(); [sinh](namespaceeigen#af284ce359b6efd4b594a9f8a1f5e5d96)(a); | computes hyperbolic sine | using [std::sinh](http://en.cppreference.com/w/cpp/numeric/math/sinh); sinh(a[i]); | | | a.[cohs](group__coeffwisemathfunctions)(); [cosh](namespaceeigen#a34b99a26a2a1e7ff985a5ace16eedfcb)(a); | computes hyperbolic cosine | using [std::cosh](http://en.cppreference.com/w/cpp/numeric/math/cosh); cosh(a[i]); | | | a.[tanh](group__coeffwisemathfunctions)(); [tanh](namespaceeigen#a0110c233d357169fd58fdf5656992a98)(a); | computes hyperbolic tangent | using [std::tanh](http://en.cppreference.com/w/cpp/numeric/math/tanh); tanh(a[i]); | | | a.[asinh](group__coeffwisemathfunctions)(); [asinh](namespaceeigen#a727dd851cc82a62574145bc5abdc7aed)(a); | computes inverse hyperbolic sine | using [std::asinh](http://en.cppreference.com/w/cpp/numeric/math/asinh); asinh(a[i]); | | | a.[cohs](group__coeffwisemathfunctions)(); [acosh](namespaceeigen#a97676fabe9a7466cc2ccb6a2d0f83471)(a); | computes hyperbolic cosine | using [std::acosh](http://en.cppreference.com/w/cpp/numeric/math/acosh); acosh(a[i]); | | | a.[atanh](group__coeffwisemathfunctions)(); [atanh](namespaceeigen#a45d37a9f1c784eb8ab61ed24f07f436f)(a); | computes hyperbolic tangent | using [std::atanh](http://en.cppreference.com/w/cpp/numeric/math/atanh); atanh(a[i]); | | | Nearest integer floating point operations | | a.[ceil](group__coeffwisemathfunctions)(); [ceil](namespaceeigen#aa73e38be0689a463ae14141b9cf89c35)(a); | nearest integer not less than the given value | using [std::ceil](http://en.cppreference.com/w/cpp/numeric/math/ceil); ceil(a[i]); | SSE4,AVX,ZVector (f,d) | | a.[floor](group__coeffwisemathfunctions)(); [floor](namespaceeigen#abf03d773a87830bc7fde51bcd94c89a0)(a); | nearest integer not greater than the given value | using [std::floor](http://en.cppreference.com/w/cpp/numeric/math/floor); floor(a[i]); | SSE4,AVX,ZVector (f,d) | | a.[round](group__coeffwisemathfunctions)(); [round](namespaceeigen#ad9eaa98e8016ef17024a18a2f3e5bef3)(a); | nearest integer, rounding away from zero in halfway cases | built-in generic implementation based on `floor` and `ceil`, plus `using` [`std::round`](http://en.cppreference.com/w/cpp/numeric/math/round) ; [c++11] | SSE4,AVX,ZVector (f,d) | | a.[rint](group__coeffwisemathfunctions)(); [rint](namespaceeigen#a0211fe61b9e390dfd8ca213fe9c7fca3)(a); | nearest integer, rounding to nearest even in halfway cases | built-in generic implementation using [`std::rint`](http://en.cppreference.com/w/cpp/numeric/math/rint) ; [c++11] or [`rintf`](http://en.cppreference.com/w/c/numeric/math/rint) ; | SSE4,AVX (f,d) | | Floating point manipulation functions | | Classification and comparison | | a.[isFinite](group__coeffwisemathfunctions)(); [isfinite](namespaceeigen#aba24ec81dec745a00b7f33adead89811)(a); | checks if the given number has finite value | built-in generic implementation, plus `using` [`std::isfinite`](http://en.cppreference.com/w/cpp/numeric/math/isfinite) ; [c++11] | | | a.[isInf](group__coeffwisemathfunctions)(); [isinf](namespaceeigen#a1f1103712e337c4c96a05f949637a4c8)(a); | checks if the given number is infinite | built-in generic implementation, plus `using` [`std::isinf`](http://en.cppreference.com/w/cpp/numeric/math/isinf) ; [c++11] | | | a.[isNaN](group__coeffwisemathfunctions)(); [isnan](namespaceeigen#a99adfc5178f3fd5488304284388b2a10)(a); | checks if the given number is not a number | built-in generic implementation, plus `using` [`std::isnan`](http://en.cppreference.com/w/cpp/numeric/math/isnan) ; [c++11] | | | Error and gamma functions | | Require `#include` `<unsupported/Eigen/SpecialFunctions>` | | a.[erf](group__coeffwisemathfunctions)(); [erf](namespaceeigen#ac336e0eba2b12dca8b01da1a006566c3)(a); | error function | using [std::erf](http://en.cppreference.com/w/cpp/numeric/math/erf); [c++11] erf(a[i]); | | | a.[erfc](group__coeffwisemathfunctions)(); [erfc](namespaceeigen#a17bcfbd19ed883ecf581f06ac1eeeb8c)(a); | complementary error function | using [std::erfc](http://en.cppreference.com/w/cpp/numeric/math/erfc); [c++11] erfc(a[i]); | | | a.[lgamma](group__coeffwisemathfunctions)(); [lgamma](namespaceeigen#ac2e6331628bb1989b7be6d7e42827649)(a); | natural logarithm of the gamma function | using [std::lgamma](http://en.cppreference.com/w/cpp/numeric/math/lgamma); [c++11] lgamma(a[i]); | | | a.[digamma](group__coeffwisemathfunctions)(); [digamma](namespaceeigen#af40db84b3db19fe25fe2f77c429420e5)(a); | [logarithmic derivative of the gamma function](https://en.wikipedia.org/wiki/Digamma_function) | built-in for float and double | | | [igamma](group__coeffwisemathfunctions)(a,x); | [lower incomplete gamma integral](https://en.wikipedia.org/wiki/Incomplete_gamma_function) \( \gamma(a\_i,x\_i)= \frac{1}{|a\_i|} \int\_{0}^{x\_i}e^{\text{-}t} t^{a\_i-1} \mathrm{d} t \) | built-in for float and double, but requires [c++11] | | | [igammac](group__coeffwisemathfunctions)(a,x); | [upper incomplete gamma integral](https://en.wikipedia.org/wiki/Incomplete_gamma_function) \( \Gamma(a\_i,x\_i) = \frac{1}{|a\_i|} \int\_{x\_i}^{\infty}e^{\text{-}t} t^{a\_i-1} \mathrm{d} t \) | built-in for float and double, but requires [c++11] | | | Special functions | | Require `#include` `<unsupported/Eigen/SpecialFunctions>` | | [polygamma](group__coeffwisemathfunctions)(n,x); | [n-th derivative of digamma at x](https://en.wikipedia.org/wiki/Polygamma_function) | built-in generic based on [`lgamma`](#cwisetable_lgamma) , [`digamma`](#cwisetable_digamma) and [`zeta`](#cwisetable_zeta) . | | | [betainc](group__coeffwisemathfunctions)(a,b,x); | [Incomplete beta function](https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function) | built-in for float and double, but requires [c++11] | | | [zeta](group__coeffwisemathfunctions)(a,b); a.[zeta](group__coeffwisemathfunctions)(b); | [Hurwitz zeta function](https://en.wikipedia.org/wiki/Hurwitz_zeta_function) \( \zeta(a\_i,b\_i)=\sum\_{k=0}^{\infty}(b\_i+k)^{\text{-}a\_i} \) | built-in for float and double | | | a.[ndtri](group__coeffwisemathfunctions)(); [ndtri](namespaceeigen#ab7ed113a2dd4a4342c72b550faea308d)(a); | [Inverse](classeigen_1_1inverse "Expression of the inverse of another expression.") of the CDF of the Normal distribution function | built-in for float and double | | | | eigen3 Eigen::SolverStorage Eigen::SolverStorage ==================== The type used to identify a general solver (factored) storage. --- The documentation for this struct was generated from the following file:* [Constants.h](https://eigen.tuxfamily.org/dox/Constants_8h_source.html) eigen3 Eigen::Transpose Eigen::Transpose ================ ### template<typename MatrixType> class Eigen::Transpose< MatrixType > Expression of the transpose of a matrix. Template Parameters | | | | --- | --- | | MatrixType | the type of the object of which we are taking the transpose | This class represents an expression of the transpose of a matrix. It is the return type of [MatrixBase::transpose()](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c) and [MatrixBase::adjoint()](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) and most of the time this is the only way it is used. See also [MatrixBase::transpose()](classeigen_1_1densebase#ac8952c19644a4ac7e41bea45c19b909c), [MatrixBase::adjoint()](classeigen_1_1matrixbase#afacca1f88da57e5cd87dd07c8ff926bb) Inherits Eigen::TransposeImpl< MatrixType, internal::traits< MatrixType >::StorageKind >. | | | --- | | | | internal::remove\_reference< MatrixTypeNested >::type & | [nestedExpression](classeigen_1_1transpose#abf80ae3ec4c4fdee79ba5ef8fd0298d3) () | | | | const internal::remove\_all< MatrixTypeNested >::type & | [nestedExpression](classeigen_1_1transpose#a2c3b67044dd52dc3233494234899189f) () const | | | nestedExpression() [1/2] ------------------------ template<typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | internal::remove\_reference<MatrixTypeNested>::type& [Eigen::Transpose](classeigen_1_1transpose)< MatrixType >::nestedExpression | ( | | ) | | | inline | Returns the nested expression nestedExpression() [2/2] ------------------------ template<typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::remove\_all<MatrixTypeNested>::type& [Eigen::Transpose](classeigen_1_1transpose)< MatrixType >::nestedExpression | ( | | ) | const | | inline | Returns the nested expression --- The documentation for this class was generated from the following file:* [Transpose.h](https://eigen.tuxfamily.org/dox/Transpose_8h_source.html) eigen3 Global aligned box typedefs Global aligned box typedefs =========================== [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") defines several typedef shortcuts for most common aligned box types. The general patterns are the following: `AlignedBoxSizeType` where `Size` can be `1`, `2`,`3`,`4` for fixed size boxes or `X` for dynamic size, and where `Type` can be `i` for integer, `f` for float, `d` for double. For example, `AlignedBox3d` is a fixed-size 3x3 aligned box type of doubles, and `AlignedBoxXf` is a dynamic-size aligned box of floats. See also class [AlignedBox](classeigen_1_1alignedbox "An axis aligned box.") eigen3 Eigen Eigen ===== Namespace containing all symbols from the Eigen library. [More...](namespaceeigen#details) | | | --- | | | | | [indexing](namespaceeigen_1_1indexing) | | | | | [symbolic](namespaceeigen_1_1symbolic) | | | | | | --- | | | | class | [aligned\_allocator](classeigen_1_1aligned__allocator) | | | STL compatible allocator to use with types requiring a non standrad alignment. [More...](classeigen_1_1aligned__allocator#details) | | | | class | [AlignedBox](classeigen_1_1alignedbox) | | | An axis aligned box. [More...](classeigen_1_1alignedbox#details) | | | | class | [AMDOrdering](classeigen_1_1amdordering) | | | | class | [AngleAxis](classeigen_1_1angleaxis) | | | Represents a 3D rotation as a rotation angle around an arbitrary 3D axis. [More...](classeigen_1_1angleaxis#details) | | | | class | [ArithmeticSequence](classeigen_1_1arithmeticsequence) | | | | class | [Array](classeigen_1_1array) | | | General-purpose arrays with easy API for coefficient-wise operations. [More...](classeigen_1_1array#details) | | | | class | [ArrayBase](classeigen_1_1arraybase) | | | Base class for all 1D and 2D array, and related expressions. [More...](classeigen_1_1arraybase#details) | | | | class | [ArrayWrapper](classeigen_1_1arraywrapper) | | | Expression of a mathematical vector or matrix as an array object. [More...](classeigen_1_1arraywrapper#details) | | | | struct | [ArrayXpr](structeigen_1_1arrayxpr) | | | | class | [BDCSVD](classeigen_1_1bdcsvd) | | | class Bidiagonal Divide and Conquer SVD [More...](classeigen_1_1bdcsvd#details) | | | | class | [BiCGSTAB](classeigen_1_1bicgstab) | | | A bi conjugate gradient stabilized solver for sparse square problems. [More...](classeigen_1_1bicgstab#details) | | | | class | [Block](classeigen_1_1block) | | | Expression of a fixed-size or dynamic-size block. [More...](classeigen_1_1block#details) | | | | class | [BlockImpl< XprType, BlockRows, BlockCols, InnerPanel, Sparse >](classeigen_1_1blockimpl_3_01xprtype_00_01blockrows_00_01blockcols_00_01innerpanel_00_01sparse_01_4) | | | | class | [CholmodBase](classeigen_1_1cholmodbase) | | | The base class for the direct Cholesky factorization of Cholmod. [More...](classeigen_1_1cholmodbase#details) | | | | class | [CholmodDecomposition](classeigen_1_1cholmoddecomposition) | | | A general Cholesky factorization and solver based on Cholmod. [More...](classeigen_1_1cholmoddecomposition#details) | | | | class | [CholmodSimplicialLDLT](classeigen_1_1cholmodsimplicialldlt) | | | A simplicial direct Cholesky ([LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.")) factorization and solver based on Cholmod. [More...](classeigen_1_1cholmodsimplicialldlt#details) | | | | class | [CholmodSimplicialLLT](classeigen_1_1cholmodsimplicialllt) | | | A simplicial direct Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on Cholmod. [More...](classeigen_1_1cholmodsimplicialllt#details) | | | | class | [CholmodSupernodalLLT](classeigen_1_1cholmodsupernodalllt) | | | A supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on Cholmod. [More...](classeigen_1_1cholmodsupernodalllt#details) | | | | class | [COLAMDOrdering](classeigen_1_1colamdordering) | | | | class | [ColPivHouseholderQR](classeigen_1_1colpivhouseholderqr) | | | Householder rank-revealing QR decomposition of a matrix with column-pivoting. [More...](classeigen_1_1colpivhouseholderqr#details) | | | | class | [CommaInitializer](structeigen_1_1commainitializer) | | | Helper class used by the comma initializer operator. [More...](structeigen_1_1commainitializer#details) | | | | class | [CompleteOrthogonalDecomposition](classeigen_1_1completeorthogonaldecomposition) | | | Complete orthogonal decomposition (COD) of a matrix. [More...](classeigen_1_1completeorthogonaldecomposition#details) | | | | class | [ComplexEigenSolver](classeigen_1_1complexeigensolver) | | | Computes eigenvalues and eigenvectors of general complex matrices. [More...](classeigen_1_1complexeigensolver#details) | | | | class | [ComplexSchur](classeigen_1_1complexschur) | | | Performs a complex Schur decomposition of a real or complex square matrix. [More...](classeigen_1_1complexschur#details) | | | | class | [ConjugateGradient](classeigen_1_1conjugategradient) | | | A conjugate gradient solver for sparse (or dense) self-adjoint problems. [More...](classeigen_1_1conjugategradient#details) | | | | class | [CwiseBinaryOp](classeigen_1_1cwisebinaryop) | | | Generic expression where a coefficient-wise binary operator is applied to two expressions. [More...](classeigen_1_1cwisebinaryop#details) | | | | class | [CwiseNullaryOp](classeigen_1_1cwisenullaryop) | | | Generic expression of a matrix where all coefficients are defined by a functor. [More...](classeigen_1_1cwisenullaryop#details) | | | | class | [CwiseTernaryOp](classeigen_1_1cwiseternaryop) | | | Generic expression where a coefficient-wise ternary operator is applied to two expressions. [More...](classeigen_1_1cwiseternaryop#details) | | | | class | [CwiseUnaryOp](classeigen_1_1cwiseunaryop) | | | Generic expression where a coefficient-wise unary operator is applied to an expression. [More...](classeigen_1_1cwiseunaryop#details) | | | | class | [CwiseUnaryView](classeigen_1_1cwiseunaryview) | | | Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector. [More...](classeigen_1_1cwiseunaryview#details) | | | | struct | [Dense](structeigen_1_1dense) | | | | class | [DenseBase](classeigen_1_1densebase) | | | Base class for all dense matrices, vectors, and arrays. [More...](classeigen_1_1densebase#details) | | | | class | [DenseCoeffsBase< Derived, DirectAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4) | | | Base class providing direct read-only coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4#details) | | | | class | [DenseCoeffsBase< Derived, DirectWriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | | Base class providing direct read/write coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#details) | | | | class | [DenseCoeffsBase< Derived, ReadOnlyAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | | Base class providing read-only coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4#details) | | | | class | [DenseCoeffsBase< Derived, WriteAccessors >](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | | Base class providing read/write coefficient access to matrices and arrays. [More...](classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4#details) | | | | class | [Diagonal](classeigen_1_1diagonal) | | | Expression of a diagonal/subdiagonal/superdiagonal in a matrix. [More...](classeigen_1_1diagonal#details) | | | | class | [DiagonalMatrix](classeigen_1_1diagonalmatrix) | | | Represents a diagonal matrix with its storage. [More...](classeigen_1_1diagonalmatrix#details) | | | | class | [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner) | | | A preconditioner based on the digonal entries. [More...](classeigen_1_1diagonalpreconditioner#details) | | | | class | [DiagonalWrapper](classeigen_1_1diagonalwrapper) | | | Expression of a diagonal matrix. [More...](classeigen_1_1diagonalwrapper#details) | | | | class | [EigenBase](structeigen_1_1eigenbase) | | | | class | [EigenSolver](classeigen_1_1eigensolver) | | | Computes eigenvalues and eigenvectors of general matrices. [More...](classeigen_1_1eigensolver#details) | | | | class | [ForceAlignedAccess](classeigen_1_1forcealignedaccess) | | | Enforce aligned packet loads and stores regardless of what is requested. [More...](classeigen_1_1forcealignedaccess#details) | | | | class | [FullPivHouseholderQR](classeigen_1_1fullpivhouseholderqr) | | | Householder rank-revealing QR decomposition of a matrix with full pivoting. [More...](classeigen_1_1fullpivhouseholderqr#details) | | | | class | [FullPivLU](classeigen_1_1fullpivlu) | | | LU decomposition of a matrix with complete pivoting, and related features. [More...](classeigen_1_1fullpivlu#details) | | | | class | [GeneralizedEigenSolver](classeigen_1_1generalizedeigensolver) | | | Computes the generalized eigenvalues and eigenvectors of a pair of general matrices. [More...](classeigen_1_1generalizedeigensolver#details) | | | | class | [GeneralizedSelfAdjointEigenSolver](classeigen_1_1generalizedselfadjointeigensolver) | | | Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem. [More...](classeigen_1_1generalizedselfadjointeigensolver#details) | | | | class | [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition) | | | Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation. [More...](classeigen_1_1hessenbergdecomposition#details) | | | | class | [Homogeneous](classeigen_1_1homogeneous) | | | Expression of one (or a set of) homogeneous vector(s) [More...](classeigen_1_1homogeneous#details) | | | | class | [HouseholderQR](classeigen_1_1householderqr) | | | Householder QR decomposition of a matrix. [More...](classeigen_1_1householderqr#details) | | | | class | [HouseholderSequence](classeigen_1_1householdersequence) | | | Sequence of Householder reflections acting on subspaces with decreasing size. [More...](classeigen_1_1householdersequence#details) | | | | class | [Hyperplane](classeigen_1_1hyperplane) | | | A hyperplane. [More...](classeigen_1_1hyperplane#details) | | | | class | [IdentityPreconditioner](classeigen_1_1identitypreconditioner) | | | A naive preconditioner which approximates any matrix as the identity matrix. [More...](classeigen_1_1identitypreconditioner#details) | | | | class | [IncompleteCholesky](classeigen_1_1incompletecholesky) | | | Modified Incomplete Cholesky with dual threshold. [More...](classeigen_1_1incompletecholesky#details) | | | | class | [IncompleteLUT](classeigen_1_1incompletelut) | | | Incomplete LU factorization with dual-threshold strategy. [More...](classeigen_1_1incompletelut#details) | | | | class | [IndexedView](classeigen_1_1indexedview) | | | Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices. [More...](classeigen_1_1indexedview#details) | | | | class | [InnerStride](classeigen_1_1innerstride) | | | Convenience specialization of [Stride](classeigen_1_1stride "Holds strides information for Map.") to specify only an inner stride See class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for some examples. [More...](classeigen_1_1innerstride#details) | | | | class | [Inverse](classeigen_1_1inverse) | | | Expression of the inverse of another expression. [More...](classeigen_1_1inverse#details) | | | | class | [IOFormat](structeigen_1_1ioformat) | | | Stores a set of parameters controlling the way matrices are printed. [More...](structeigen_1_1ioformat#details) | | | | class | [IterativeSolverBase](classeigen_1_1iterativesolverbase) | | | Base class for linear iterative solvers. [More...](classeigen_1_1iterativesolverbase#details) | | | | class | [JacobiRotation](classeigen_1_1jacobirotation) | | | Rotation given by a cosine-sine pair. [More...](classeigen_1_1jacobirotation#details) | | | | class | [JacobiSVD](classeigen_1_1jacobisvd) | | | Two-sided Jacobi SVD decomposition of a rectangular matrix. [More...](classeigen_1_1jacobisvd#details) | | | | class | [LDLT](classeigen_1_1ldlt) | | | Robust Cholesky decomposition of a matrix with pivoting. [More...](classeigen_1_1ldlt#details) | | | | class | [LeastSquareDiagonalPreconditioner](classeigen_1_1leastsquarediagonalpreconditioner) | | | Jacobi preconditioner for [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient "A conjugate gradient solver for sparse (or dense) least-square problems."). [More...](classeigen_1_1leastsquarediagonalpreconditioner#details) | | | | class | [LeastSquaresConjugateGradient](classeigen_1_1leastsquaresconjugategradient) | | | A conjugate gradient solver for sparse (or dense) least-square problems. [More...](classeigen_1_1leastsquaresconjugategradient#details) | | | | class | [LLT](classeigen_1_1llt) | | | Standard Cholesky decomposition (LL^T) of a matrix and associated features. [More...](classeigen_1_1llt#details) | | | | class | [Map](classeigen_1_1map) | | | A matrix or vector expression mapping an existing array of data. [More...](classeigen_1_1map#details) | | | | class | [Map< const Quaternion< \_Scalar >, \_Options >](classeigen_1_1map_3_01const_01quaternion_3_01__scalar_01_4_00_01__options_01_4) | | | [Quaternion](classeigen_1_1quaternion "The quaternion class used to represent 3D orientations and rotations.") expression mapping a constant memory buffer. [More...](classeigen_1_1map_3_01const_01quaternion_3_01__scalar_01_4_00_01__options_01_4#details) | | | | class | [Map< Quaternion< \_Scalar >, \_Options >](classeigen_1_1map_3_01quaternion_3_01__scalar_01_4_00_01__options_01_4) | | | Expression of a quaternion from a memory buffer. [More...](classeigen_1_1map_3_01quaternion_3_01__scalar_01_4_00_01__options_01_4#details) | | | | class | [Map< SparseMatrixType >](classeigen_1_1map_3_01sparsematrixtype_01_4) | | | Specialization of class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for SparseMatrix-like storage. [More...](classeigen_1_1map_3_01sparsematrixtype_01_4#details) | | | | class | [MapBase< Derived, ReadOnlyAccessors >](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4) | | | Base class for dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") expression with direct access. [More...](classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4#details) | | | | class | [MapBase< Derived, WriteAccessors >](classeigen_1_1mapbase_3_01derived_00_01writeaccessors_01_4) | | | Base class for non-const dense [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Block](classeigen_1_1block "Expression of a fixed-size or dynamic-size block.") expression with direct access. [More...](classeigen_1_1mapbase_3_01derived_00_01writeaccessors_01_4#details) | | | | class | [MappedSparseMatrix](classeigen_1_1mappedsparsematrix) | | | [Sparse](structeigen_1_1sparse) matrix. [More...](classeigen_1_1mappedsparsematrix#details) | | | | class | [Matrix](classeigen_1_1matrix) | | | The matrix class, also used for vectors and row-vectors. [More...](classeigen_1_1matrix#details) | | | | class | [MatrixBase](classeigen_1_1matrixbase) | | | Base class for all dense matrices, vectors, and expressions. [More...](classeigen_1_1matrixbase#details) | | | | class | [MatrixWrapper](classeigen_1_1matrixwrapper) | | | Expression of an array as a mathematical vector or matrix. [More...](classeigen_1_1matrixwrapper#details) | | | | struct | [MatrixXpr](structeigen_1_1matrixxpr) | | | | class | [MetisOrdering](classeigen_1_1metisordering) | | | | class | [NaturalOrdering](classeigen_1_1naturalordering) | | | | class | [NestByValue](classeigen_1_1nestbyvalue) | | | Expression which must be nested by value. [More...](classeigen_1_1nestbyvalue#details) | | | | class | [NoAlias](classeigen_1_1noalias) | | | Pseudo expression providing an operator = assuming no aliasing. [More...](classeigen_1_1noalias#details) | | | | class | [NumTraits](structeigen_1_1numtraits) | | | Holds information about the various numeric (i.e. scalar) types allowed by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). [More...](structeigen_1_1numtraits#details) | | | | class | [OuterStride](classeigen_1_1outerstride) | | | Convenience specialization of [Stride](classeigen_1_1stride "Holds strides information for Map.") to specify only an outer stride See class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for some examples. [More...](classeigen_1_1outerstride#details) | | | | class | [ParametrizedLine](classeigen_1_1parametrizedline) | | | A parametrized line. [More...](classeigen_1_1parametrizedline#details) | | | | class | [PardisoLDLT](classeigen_1_1pardisoldlt) | | | A sparse direct Cholesky ([LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.")) factorization and solver based on the PARDISO library. [More...](classeigen_1_1pardisoldlt#details) | | | | class | [PardisoLLT](classeigen_1_1pardisollt) | | | A sparse direct Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PARDISO library. [More...](classeigen_1_1pardisollt#details) | | | | class | [PardisoLU](classeigen_1_1pardisolu) | | | A sparse direct LU factorization and solver based on the PARDISO library. [More...](classeigen_1_1pardisolu#details) | | | | class | [PartialPivLU](classeigen_1_1partialpivlu) | | | LU decomposition of a matrix with partial pivoting, and related features. [More...](classeigen_1_1partialpivlu#details) | | | | class | [PartialReduxExpr](classeigen_1_1partialreduxexpr) | | | Generic expression of a partially reduxed matrix. [More...](classeigen_1_1partialreduxexpr#details) | | | | class | [PastixLDLT](classeigen_1_1pastixldlt) | | | A sparse direct supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PaStiX library. [More...](classeigen_1_1pastixldlt#details) | | | | class | [PastixLLT](classeigen_1_1pastixllt) | | | A sparse direct supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PaStiX library. [More...](classeigen_1_1pastixllt#details) | | | | class | [PastixLU](classeigen_1_1pastixlu) | | | Interface to the PaStix solver. [More...](classeigen_1_1pastixlu#details) | | | | class | [PermutationBase](classeigen_1_1permutationbase) | | | Base class for permutations. [More...](classeigen_1_1permutationbase#details) | | | | class | [PermutationMatrix](classeigen_1_1permutationmatrix) | | | Permutation matrix. [More...](classeigen_1_1permutationmatrix#details) | | | | struct | [PermutationStorage](structeigen_1_1permutationstorage) | | | | class | [PermutationWrapper](classeigen_1_1permutationwrapper) | | | Class to view a vector of integers as a permutation matrix. [More...](classeigen_1_1permutationwrapper#details) | | | | class | [PlainObjectBase](classeigen_1_1plainobjectbase) | | | Dense storage base class for matrices and arrays. [More...](classeigen_1_1plainobjectbase#details) | | | | class | [Product](classeigen_1_1product) | | | Expression of the product of two arbitrary matrices or vectors. [More...](classeigen_1_1product#details) | | | | class | [Quaternion](classeigen_1_1quaternion) | | | The quaternion class used to represent 3D orientations and rotations. [More...](classeigen_1_1quaternion#details) | | | | class | [QuaternionBase](classeigen_1_1quaternionbase) | | | Base class for quaternion expressions. [More...](classeigen_1_1quaternionbase#details) | | | | class | [RealQZ](classeigen_1_1realqz) | | | Performs a real QZ decomposition of a pair of square matrices. [More...](classeigen_1_1realqz#details) | | | | class | [RealSchur](classeigen_1_1realschur) | | | Performs a real Schur decomposition of a square matrix. [More...](classeigen_1_1realschur#details) | | | | class | [Ref](classeigen_1_1ref) | | | A matrix or vector expression mapping an existing expression. [More...](classeigen_1_1ref#details) | | | | class | [Ref< SparseMatrixType, Options >](classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4) | | | A sparse matrix expression referencing an existing sparse expression. [More...](classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4#details) | | | | class | [Ref< SparseVectorType >](classeigen_1_1ref_3_01sparsevectortype_01_4) | | | A sparse vector expression referencing an existing sparse vector expression. [More...](classeigen_1_1ref_3_01sparsevectortype_01_4#details) | | | | class | [Replicate](classeigen_1_1replicate) | | | Expression of the multiple replication of a matrix or vector. [More...](classeigen_1_1replicate#details) | | | | class | [Reshaped](classeigen_1_1reshaped) | | | Expression of a fixed-size or dynamic-size reshape. [More...](classeigen_1_1reshaped#details) | | | | class | [Reverse](classeigen_1_1reverse) | | | Expression of the reverse of a vector or matrix. [More...](classeigen_1_1reverse#details) | | | | class | [Rotation2D](classeigen_1_1rotation2d) | | | Represents a rotation/orientation in a 2 dimensional space. [More...](classeigen_1_1rotation2d#details) | | | | class | [RotationBase](classeigen_1_1rotationbase) | | | Common base class for compact rotation representations. [More...](classeigen_1_1rotationbase#details) | | | | class | [ScalarBinaryOpTraits](structeigen_1_1scalarbinaryoptraits) | | | Determines whether the given binary operation of two numeric types is allowed and what the scalar return type is. [More...](structeigen_1_1scalarbinaryoptraits#details) | | | | class | [Select](classeigen_1_1select) | | | Expression of a coefficient wise version of the C++ ternary operator ?: [More...](classeigen_1_1select#details) | | | | class | [SelfAdjointEigenSolver](classeigen_1_1selfadjointeigensolver) | | | Computes eigenvalues and eigenvectors of selfadjoint matrices. [More...](classeigen_1_1selfadjointeigensolver#details) | | | | class | [SelfAdjointView](classeigen_1_1selfadjointview) | | | Expression of a selfadjoint matrix from a triangular part of a dense matrix. [More...](classeigen_1_1selfadjointview#details) | | | | class | [SimplicialCholesky](classeigen_1_1simplicialcholesky) | | | | class | [SimplicialCholeskyBase](classeigen_1_1simplicialcholeskybase) | | | A base class for direct sparse Cholesky factorizations. [More...](classeigen_1_1simplicialcholeskybase#details) | | | | class | [SimplicialLDLT](classeigen_1_1simplicialldlt) | | | A direct sparse [LDLT](classeigen_1_1ldlt "Robust Cholesky decomposition of a matrix with pivoting.") Cholesky factorizations without square root. [More...](classeigen_1_1simplicialldlt#details) | | | | class | [SimplicialLLT](classeigen_1_1simplicialllt) | | | A direct sparse [LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.") Cholesky factorizations. [More...](classeigen_1_1simplicialllt#details) | | | | class | [Solve](classeigen_1_1solve) | | | Pseudo expression representing a solving operation. [More...](classeigen_1_1solve#details) | | | | class | [SolverBase](classeigen_1_1solverbase) | | | A base class for matrix decomposition and solvers. [More...](classeigen_1_1solverbase#details) | | | | struct | [SolverStorage](structeigen_1_1solverstorage) | | | | class | [SolveWithGuess](classeigen_1_1solvewithguess) | | | Pseudo expression representing a solving operation. [More...](classeigen_1_1solvewithguess#details) | | | | struct | [Sparse](structeigen_1_1sparse) | | | | class | [SparseCompressedBase](classeigen_1_1sparsecompressedbase) | | | Common base class for sparse [compressed]-{row|column}-storage format. [More...](classeigen_1_1sparsecompressedbase#details) | | | | class | [SparseLU](classeigen_1_1sparselu) | | | [Sparse](structeigen_1_1sparse) supernodal LU factorization for general matrices. [More...](classeigen_1_1sparselu#details) | | | | class | [SparseMapBase< Derived, ReadOnlyAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4) | | | Common base class for [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") instance of sparse matrix and vector. [More...](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#details) | | | | class | [SparseMapBase< Derived, WriteAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4) | | | Common base class for writable [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") and [Ref](classeigen_1_1ref "A matrix or vector expression mapping an existing expression.") instance of sparse matrix and vector. [More...](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#details) | | | | class | [SparseMatrix](classeigen_1_1sparsematrix) | | | A versatible sparse matrix representation. [More...](classeigen_1_1sparsematrix#details) | | | | class | [SparseMatrixBase](classeigen_1_1sparsematrixbase) | | | Base class of any sparse matrices or sparse expressions. [More...](classeigen_1_1sparsematrixbase#details) | | | | class | [SparseQR](classeigen_1_1sparseqr) | | | [Sparse](structeigen_1_1sparse) left-looking QR factorization with numerical column pivoting. [More...](classeigen_1_1sparseqr#details) | | | | class | [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview) | | | Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix. [More...](classeigen_1_1sparseselfadjointview#details) | | | | class | [SparseSolverBase](classeigen_1_1sparsesolverbase) | | | A base class for sparse solvers. [More...](classeigen_1_1sparsesolverbase#details) | | | | class | [SparseVector](classeigen_1_1sparsevector) | | | a sparse vector class [More...](classeigen_1_1sparsevector#details) | | | | class | [SparseView](classeigen_1_1sparseview) | | | Expression of a dense or sparse matrix with zero or too small values removed. [More...](classeigen_1_1sparseview#details) | | | | class | [SPQR](classeigen_1_1spqr) | | | [Sparse](structeigen_1_1sparse) QR factorization based on SuiteSparseQR library. [More...](classeigen_1_1spqr#details) | | | | class | [Stride](classeigen_1_1stride) | | | Holds strides information for [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."). [More...](classeigen_1_1stride#details) | | | | class | [SuperILU](classeigen_1_1superilu) | | | A sparse direct **incomplete** LU factorization and solver based on the [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") library. [More...](classeigen_1_1superilu#details) | | | | class | [SuperLU](classeigen_1_1superlu) | | | A sparse direct LU factorization and solver based on the [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library.") library. [More...](classeigen_1_1superlu#details) | | | | class | [SuperLUBase](classeigen_1_1superlubase) | | | The base class for the direct and incomplete LU factorization of [SuperLU](classeigen_1_1superlu "A sparse direct LU factorization and solver based on the SuperLU library."). [More...](classeigen_1_1superlubase#details) | | | | class | [SVDBase](classeigen_1_1svdbase) | | | Base class of SVD algorithms. [More...](classeigen_1_1svdbase#details) | | | | class | [Transform](classeigen_1_1transform) | | | Represents an homogeneous transformation in a N dimensional space. [More...](classeigen_1_1transform#details) | | | | class | [Translation](classeigen_1_1translation) | | | Represents a translation transformation. [More...](classeigen_1_1translation#details) | | | | class | [Transpose](classeigen_1_1transpose) | | | Expression of the transpose of a matrix. [More...](classeigen_1_1transpose#details) | | | | class | [Transpositions](classeigen_1_1transpositions) | | | Represents a sequence of transpositions (row/column interchange) [More...](classeigen_1_1transpositions#details) | | | | struct | [TranspositionsStorage](structeigen_1_1transpositionsstorage) | | | | class | [TriangularBase](classeigen_1_1triangularbase) | | | Base class for triangular part in a matrix. [More...](classeigen_1_1triangularbase#details) | | | | class | [TriangularView](classeigen_1_1triangularview) | | | Expression of a triangular part in a matrix. [More...](classeigen_1_1triangularview#details) | | | | class | [TriangularViewImpl< \_MatrixType, \_Mode, Dense >](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4) | | | Base class for a triangular part in a **dense** matrix. [More...](classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4#details) | | | | class | [TriangularViewImpl< MatrixType, Mode, Sparse >](classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4) | | | Base class for a triangular part in a **sparse** matrix. [More...](classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4#details) | | | | class | [Tridiagonalization](classeigen_1_1tridiagonalization) | | | Tridiagonal decomposition of a selfadjoint matrix. [More...](classeigen_1_1tridiagonalization#details) | | | | class | [Triplet](classeigen_1_1triplet) | | | A small structure to hold a non zero as a triplet (i,j,value). [More...](classeigen_1_1triplet#details) | | | | class | [UmfPackLU](classeigen_1_1umfpacklu) | | | A sparse LU factorization and solver based on UmfPack. [More...](classeigen_1_1umfpacklu#details) | | | | class | [UniformScaling](classeigen_1_1uniformscaling) | | | Represents a generic uniform scaling transformation. [More...](classeigen_1_1uniformscaling#details) | | | | class | [VectorBlock](classeigen_1_1vectorblock) | | | Expression of a fixed-size or dynamic-size sub-vector. [More...](classeigen_1_1vectorblock#details) | | | | class | [VectorwiseOp](classeigen_1_1vectorwiseop) | | | Pseudo expression providing broadcasting and partial reduction operations. [More...](classeigen_1_1vectorwiseop#details) | | | | class | [WithFormat](classeigen_1_1withformat) | | | Pseudo expression providing matrix output with given format. [More...](classeigen_1_1withformat#details) | | | | | | --- | | | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)< double, 2 > | [AlignedScaling2d](namespaceeigen#af8975289b8134a5021e806029516e82c) | | | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)< float, 2 > | [AlignedScaling2f](namespaceeigen#af2440178a1f5f6abef6ee0231bc49184) | | | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)< double, 3 > | [AlignedScaling3d](namespaceeigen#a0aff001d5740f13797c9acd4e3276673) | | | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)< float, 3 > | [AlignedScaling3f](namespaceeigen#a45caf8b0e6da378885f4ae3f06c5cde3) | | | | typedef [AngleAxis](classeigen_1_1angleaxis)< double > | [AngleAxisd](group__geometry__module#gaed936d6e9192d97f00a9608081fa9b64) | | | | typedef [AngleAxis](classeigen_1_1angleaxis)< float > | [AngleAxisf](group__geometry__module#gad823b9c674644b14d950fbfe165dfdbf) | | | | template<typename Type > | | using | [Array2](group__arraytypedefs#ga27e36e9e1da10f2c17d69bbfa7ead870) = [Array](classeigen_1_1array)< Type, 2, 1 > | | | [c++11] | | | | template<typename Type > | | using | [Array22](group__arraytypedefs#gad5e10990863f064300d78e80b4537a0b) = [Array](classeigen_1_1array)< Type, 2, 2 > | | | [c++11] | | | | template<typename Type > | | using | [Array2X](group__arraytypedefs#ga995df558b61646d505b9feabd30a28d0) = [Array](classeigen_1_1array)< Type, 2, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [Array3](group__arraytypedefs#ga7ca781ec91d7b715d226d5057d50b250) = [Array](classeigen_1_1array)< Type, 3, 1 > | | | [c++11] | | | | template<typename Type > | | using | [Array33](group__arraytypedefs#gafb8560ef95ce6a7284131d91da82cf8a) = [Array](classeigen_1_1array)< Type, 3, 3 > | | | [c++11] | | | | template<typename Type > | | using | [Array3X](group__arraytypedefs#gaf24f8bd443138027dd02599e7c58ef60) = [Array](classeigen_1_1array)< Type, 3, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [Array4](group__arraytypedefs#ga2b5e91e45a496f9893059ab4f298a9ee) = [Array](classeigen_1_1array)< Type, 4, 1 > | | | [c++11] | | | | template<typename Type > | | using | [Array44](group__arraytypedefs#gabcb97c1d614be824fd355ca29632e30f) = [Array](classeigen_1_1array)< Type, 4, 4 > | | | [c++11] | | | | template<typename Type > | | using | [Array4X](group__arraytypedefs#gaab59985198663295e89134835783bd0d) = [Array](classeigen_1_1array)< Type, 4, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [ArrayX](group__arraytypedefs#ga9f9db3ea1c9715a30ed77c6cd434bbd3) = [Array](classeigen_1_1array)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > | | | [c++11] | | | | template<typename Type > | | using | [ArrayX2](group__arraytypedefs#ga273e82d1306290af7e02aeb75a831fca) = [Array](classeigen_1_1array)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 2 > | | | [c++11] | | | | template<typename Type > | | using | [ArrayX3](group__arraytypedefs#ga428c78ad433d2f285650ccee8fc0f29f) = [Array](classeigen_1_1array)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 3 > | | | [c++11] | | | | template<typename Type > | | using | [ArrayX4](group__arraytypedefs#gaad02550dee7a18c7a74941be73de327d) = [Array](classeigen_1_1array)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 4 > | | | [c++11] | | | | template<typename Type > | | using | [ArrayXX](group__arraytypedefs#ga6a3ca2b2a8694c17ed25ac03cafdaa04) = [Array](classeigen_1_1array)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | typedef EIGEN\_DEFAULT\_DENSE\_INDEX\_TYPE | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | | | The Index type as used for the API. [More...](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | | | | template<typename Type > | | using | [Matrix2](group__matrixtypedefs#ga73a2c673745de956e66d30ad61fd4a7e) = [Matrix](classeigen_1_1matrix)< Type, 2, 2 > | | | [c++11] | | | | template<typename Type > | | using | [Matrix2X](group__matrixtypedefs#ga9fc5afaeb88d6cd4f2503dd6127b1ba8) = [Matrix](classeigen_1_1matrix)< Type, 2, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [Matrix3](group__matrixtypedefs#ga6d61b8a0039eeb04e6faf382b8635a7a) = [Matrix](classeigen_1_1matrix)< Type, 3, 3 > | | | [c++11] | | | | template<typename Type > | | using | [Matrix3X](group__matrixtypedefs#gab22d239b05eafe7ac235325d454e7530) = [Matrix](classeigen_1_1matrix)< Type, 3, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [Matrix4](group__matrixtypedefs#ga946841161df693bb792644ba410aa0f0) = [Matrix](classeigen_1_1matrix)< Type, 4, 4 > | | | [c++11] | | | | template<typename Type > | | using | [Matrix4X](group__matrixtypedefs#ga93eea03ee4428402191f86ef2239975e) = [Matrix](classeigen_1_1matrix)< Type, 4, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [MatrixX](group__matrixtypedefs#ga8a779d79defc9f822fa6ff5869c2ba6b) = [Matrix](classeigen_1_1matrix)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type > | | using | [MatrixX2](group__matrixtypedefs#ga1d162ebb520e589b3a5a5f4024aa3ae4) = [Matrix](classeigen_1_1matrix)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 2 > | | | [c++11] | | | | template<typename Type > | | using | [MatrixX3](group__matrixtypedefs#gacdb4b32de62bf47373eec29612b73657) = [Matrix](classeigen_1_1matrix)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 3 > | | | [c++11] | | | | template<typename Type > | | using | [MatrixX4](group__matrixtypedefs#gabe35b438cb4f39d72092d1fbb16153b8) = [Matrix](classeigen_1_1matrix)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 4 > | | | [c++11] | | | | typedef [Quaternion](classeigen_1_1quaternion)< double > | [Quaterniond](group__geometry__module#ga5daab8e66aa480465000308455578830) | | | | typedef [Quaternion](classeigen_1_1quaternion)< float > | [Quaternionf](group__geometry__module#ga66aa915a26d698c60ed206818c3e4c9b) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< double >, [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) > | [QuaternionMapAlignedd](group__geometry__module#ga4289f38cc6ecf302e07d2365abc6a902) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< float >, [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) > | [QuaternionMapAlignedf](group__geometry__module#gadaf7f3ee984d9828ca94d66355f0b226) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< double >, 0 > | [QuaternionMapd](group__geometry__module#ga89412d1dcf23537e5990dfb3089ace76) | | | | typedef [Map](classeigen_1_1map)< [Quaternion](classeigen_1_1quaternion)< float >, 0 > | [QuaternionMapf](group__geometry__module#ga867ff508ac860bdf7cab3b8a8fc1048d) | | | | typedef [Rotation2D](classeigen_1_1rotation2d)< double > | [Rotation2Dd](group__geometry__module#gab7af1ccdfb6c865c27fe1fd6bd9e759f) | | | | typedef [Rotation2D](classeigen_1_1rotation2d)< float > | [Rotation2Df](group__geometry__module#ga35e2cace3ada497794734edb8bc33b6e) | | | | template<typename Type , int Size> | | using | [RowVector](group__matrixtypedefs#ga181118570e7a0bb1cf3366180061f14f) = [Matrix](classeigen_1_1matrix)< Type, 1, Size > | | | [c++11] | | | | template<typename Type > | | using | [RowVector2](group__matrixtypedefs#gafbd00706e87859d2f0ad68b54e825809) = [Matrix](classeigen_1_1matrix)< Type, 1, 2 > | | | [c++11] | | | | template<typename Type > | | using | [RowVector3](group__matrixtypedefs#gaaedec7d966e8dafd1611d106333bf461) = [Matrix](classeigen_1_1matrix)< Type, 1, 3 > | | | [c++11] | | | | template<typename Type > | | using | [RowVector4](group__matrixtypedefs#gafb7f5975c1c3be1237e7f0bf589c6add) = [Matrix](classeigen_1_1matrix)< Type, 1, 4 > | | | [c++11] | | | | template<typename Type > | | using | [RowVectorX](group__matrixtypedefs#gacbfe7eb9c070bcb75ef42aec7a6fbafe) = [Matrix](classeigen_1_1matrix)< Type, 1, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | | | [c++11] | | | | template<typename Type , int Size> | | using | [Vector](group__matrixtypedefs#ga2623c0d4641dda067fbdb9a009ef0c91) = [Matrix](classeigen_1_1matrix)< Type, Size, 1 > | | | [c++11] | | | | template<typename Type > | | using | [Vector2](group__matrixtypedefs#ga5c7551c08d7b0ca055e4abdc37b05a80) = [Matrix](classeigen_1_1matrix)< Type, 2, 1 > | | | [c++11] | | | | template<typename Type > | | using | [Vector3](group__matrixtypedefs#ga0af1f95a68328299e1e9b273e4934c7a) = [Matrix](classeigen_1_1matrix)< Type, 3, 1 > | | | [c++11] | | | | template<typename Type > | | using | [Vector4](group__matrixtypedefs#ga299db30993dd4e9ca74c7691ad32d50b) = [Matrix](classeigen_1_1matrix)< Type, 4, 1 > | | | [c++11] | | | | template<typename Type > | | using | [VectorX](group__matrixtypedefs#ga7e589e92f0ae4929f5540a578cfd2bac) = [Matrix](classeigen_1_1matrix)< Type, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > | | | [c++11] | | | | | | --- | | | | enum | { [StandardCompressedFormat](namespaceeigen#aaec054b156d7e5de1d19a4b2c125ce6aabd3632507a3697fb48c77eff79851a74) } | | | | enum | [AccessorLevels](group__enums#ga9f93eac38eb83deb0e8dbd42ddf11d5d) { [ReadOnlyAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5daa1f2b0e6a668b11f2958940965d2b572) , [WriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dabcadf08230fb1a5ef7b3195745d3a458) , [DirectAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5da50108ad00095928de06228470ceab09e) , [DirectWriteAccessors](group__enums#gga9f93eac38eb83deb0e8dbd42ddf11d5dacbe59d09ba2fdf8eac127bff1a1f0234) } | | | | enum | [AlignmentType](group__enums#ga45fe06e29902b7a2773de05ba27b47a1) { [Unaligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a4e19dd09d5ff42295ba1d72d12a46686) , [Aligned8](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a9d99d7a9ff1da5c949bec22733bfba14) , [Aligned16](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ad0b140cd97bc74365b51843d28379655) , [Aligned32](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a8a380b1cd0c3e5a6cceac06f8235157a) , [Aligned64](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a2639cfa1e8faac751556bc0009fe95a4) , [Aligned128](group__enums#gga45fe06e29902b7a2773de05ba27b47a1a60057da2408e499b5656244d0b26cc20) , **AlignedMask** , [Aligned](group__enums#gga45fe06e29902b7a2773de05ba27b47a1ae12d0f8f869c40c76128260af2242bc8) , **AlignedMax** } | | | | enum | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) { [Success](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea671a2aeb0f527802806a441d58a80fcf) , [NumericalIssue](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea1c6e20706575a629b27a105f07f1883b) , [NoConvergence](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea6a68dfb88a8336108a30588bdf356c57) , [InvalidInput](group__enums#gga85fad7b87587764e5cf6b513a9e0ee5ea580b2a3cafe585691e789f768fb729bf) } | | | | enum | [DecompositionOptions](group__enums#gae3e239fb70022eb8747994cf5d68b4a9) { } | | | | enum | [DirectionType](group__enums#gad49a7b3738e273eb00932271b36127f7) { [Vertical](group__enums#ggad49a7b3738e273eb00932271b36127f7ae2efac6e74ecab5e3b0b1561c5ddf83e) , [Horizontal](group__enums#ggad49a7b3738e273eb00932271b36127f7a961c62410157b64033839488f4d7f7e4) , [BothDirections](group__enums#ggad49a7b3738e273eb00932271b36127f7a04fefd61992e941d509a57bc44c59794) } | | | | enum | [NaNPropagationOptions](group__enums#ga7f4e3f96895bdb325eab1a0b651e211f) { [PropagateFast](group__enums#gga7f4e3f96895bdb325eab1a0b651e211fa917fa8982b7eb0cbb440d38ee50e0b9c) , [PropagateNaN](group__enums#gga7f4e3f96895bdb325eab1a0b651e211fa1d414f9966ecba69cd840b8def472c4a) , [PropagateNumbers](group__enums#gga7f4e3f96895bdb325eab1a0b651e211fa5bfaff916ad4913fd04fe2e92c5c32ae) } | | | | enum | [QRPreconditioners](group__enums#ga46eba0d5c621f590b8cf1b53af31d56e) { [NoQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56ea2e95bc818f975b19def01e93d240dece) , [HouseholderQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56ea9c660eb3336bf8c77ce9d081ca07cbdd) , [ColPivHouseholderQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56eabd2e2f4875c5b4b6e602a433d90c4e5e) , [FullPivHouseholderQRPreconditioner](group__enums#gga46eba0d5c621f590b8cf1b53af31d56eabd745dcaff7019c5f918c68809e5ea50) } | | | | enum | [SideType](group__enums#gac22de43beeac7a78b384f99bed5cee0b) { [OnTheLeft](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba21b30a61e9cb10c967aec17567804007) , [OnTheRight](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba329fc3a54ceb2b6e0e73b400998b8a82) } | | | | enum | [StorageOptions](group__enums#gaacded1a18ae58b0f554751f6cdf9eb13) { [ColMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62) , [RowMajor](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f) , [AutoAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea) , [DontAlign](group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a56908522e51443a0aa0567f879c2e78a) } | | | | enum | [TransformTraits](group__enums#gaee59a86102f150923b0cac6d4ff05107) { [Isometry](group__enums#ggaee59a86102f150923b0cac6d4ff05107a84413028615d2d718bafd2dfb93dafef) , [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) , [AffineCompact](group__enums#ggaee59a86102f150923b0cac6d4ff05107a8192e8fdb2ec3ec46d92956cc83ef490) , [Projective](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0f7338b8672884554e8642bce9e44183) } | | | | enum | [UpLoType](group__enums#ga39e3366ff5554d731e7dc8bb642f83cd) { [Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) , [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1) , [UnitDiag](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2ef430bff6cc12c2d1e0ef01b95f7ff3) , [ZeroDiag](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdac4dc554a61510151ddd5bafaf6040223) , [UnitLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda8f40b928c10a71ba03e5f75ad2a72fda) , [UnitUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdadd28224d7ea92689930be73c1b50b0ad) , [StrictlyLower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda2424988b6fca98be70b595632753ba81) , [StrictlyUpper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cda7b37877e0b9b0df28c9c2b669a633265) , [SelfAdjoint](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdacf9ccb2016f8b9c0f3268f05a1e75821) , [Symmetric](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdad5381b2d1c8973a08303c94e7da02333) } | | | | | | --- | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_abs\_op< typename Derived::Scalar >, const Derived > | [abs](namespaceeigen#ae27242789e7e62a8c42579b79be59b1a) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_abs2\_op< typename Derived::Scalar >, const Derived > | [abs2](namespaceeigen#a54cc34b64b4935307efc06d56cd531df) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_acos\_op< typename Derived::Scalar >, const Derived > | [acos](namespaceeigen#a3fe3a136370fefae062591304c6a7ebd) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_acosh\_op< typename Derived::Scalar >, const Derived > | [acosh](namespaceeigen#a97676fabe9a7466cc2ccb6a2d0f83471) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_arg\_op< typename Derived::Scalar >, const Derived > | [arg](namespaceeigen#aa539408a09481d35961e11ee78793db1) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_asin\_op< typename Derived::Scalar >, const Derived > | [asin](namespaceeigen#a6c5c246b877ac331495d21e7a5d51616) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_asinh\_op< typename Derived::Scalar >, const Derived > | [asinh](namespaceeigen#a727dd851cc82a62574145bc5abdc7aed) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_atan\_op< typename Derived::Scalar >, const Derived > | [atan](namespaceeigen#a230744e17147d12e8ef3f2fc3796f64f) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_atanh\_op< typename Derived::Scalar >, const Derived > | [atanh](namespaceeigen#a45d37a9f1c784eb8ab61ed24f07f436f) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_ceil\_op< typename Derived::Scalar >, const Derived > | [ceil](namespaceeigen#aa73e38be0689a463ae14141b9cf89c35) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_conjugate\_op< typename Derived::Scalar >, const Derived > | [conj](namespaceeigen#ab84f39a06a18e1ebb23f8be80345b79d) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_cos\_op< typename Derived::Scalar >, const Derived > | [cos](namespaceeigen#ad01d50a42869218f1d54af13f71517a6) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_cosh\_op< typename Derived::Scalar >, const Derived > | [cosh](namespaceeigen#a34b99a26a2a1e7ff985a5ace16eedfcb) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_cube\_op< typename Derived::Scalar >, const Derived > | [cube](namespaceeigen#ae04fac7e3068f05c3f01982554a21d80) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_digamma\_op< typename Derived::Scalar >, const Derived > | [digamma](namespaceeigen#af40db84b3db19fe25fe2f77c429420e5) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_erf\_op< typename Derived::Scalar >, const Derived > | [erf](namespaceeigen#ac336e0eba2b12dca8b01da1a006566c3) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_erfc\_op< typename Derived::Scalar >, const Derived > | [erfc](namespaceeigen#a17bcfbd19ed883ecf581f06ac1eeeb8c) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_exp\_op< typename Derived::Scalar >, const Derived > | [exp](namespaceeigen#ae491aecf7dab66ac7e11008c5766694d) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_expm1\_op< typename Derived::Scalar >, const Derived > | [expm1](namespaceeigen#ae7cb2544e4e745bc0067fe793e3f2f81) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<int N> | | static const auto | [fix](group__core__module#gac01f234bce100e39e6928fdc470e5194) () | | | | template<int N> | | static const auto | [fix](group__core__module#ga3ce50da8ca83238949c06afce1a4f3c7) (int val) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_floor\_op< typename Derived::Scalar >, const Derived > | [floor](namespaceeigen#abf03d773a87830bc7fde51bcd94c89a0) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename VectorsType , typename CoeffsType > | | [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType > | [householderSequence](group__householder__module#ga5f2b3f80cdf7ae96609e4a8d2e55e371) (const VectorsType &v, const CoeffsType &h) | | | Convenience function for constructing a Householder sequence. [More...](group__householder__module#ga5f2b3f80cdf7ae96609e4a8d2e55e371) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_imag\_op< typename Derived::Scalar >, const Derived > | [imag](namespaceeigen#a04d60a3c8a266f63c08e03615c1985c9) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_inverse\_op< typename Derived::Scalar >, const Derived > | [inverse](namespaceeigen#ae9de9064c3b832ee804c0e0957e80334) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_isfinite\_op< typename Derived::Scalar >, const Derived > | [isfinite](namespaceeigen#aba24ec81dec745a00b7f33adead89811) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_isinf\_op< typename Derived::Scalar >, const Derived > | [isinf](namespaceeigen#a1f1103712e337c4c96a05f949637a4c8) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_isnan\_op< typename Derived::Scalar >, const Derived > | [isnan](namespaceeigen#a99adfc5178f3fd5488304284388b2a10) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | int | [klu\_solve](group__klusupport__module#gad6d0ed07a6ee97fcef4fe3bce6a674d4) (klu\_symbolic \*Symbolic, klu\_numeric \*Numeric, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) ldim, [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) nrhs, double B[], klu\_common \*Common, double) | | | A sparse LU factorization and solver based on KLU. [More...](group__klusupport__module#gad6d0ed07a6ee97fcef4fe3bce6a674d4) | | | | template<typename SizeType > | | auto | [lastN](namespaceeigen#a5564b99b116c725ef571f1a2f859acb1) (SizeType size) -> decltype([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)+[fix](group__core__module#gac01f234bce100e39e6928fdc470e5194)< 1 >() -size, size)) | | | | template<typename SizeType , typename IncrType > | | auto | [lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77) (SizeType size, IncrType incr) -> decltype([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-(size-[fix](group__core__module#gac01f234bce100e39e6928fdc470e5194)< 1 >()) \*incr, size, incr)) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_lgamma\_op< typename Derived::Scalar >, const Derived > | [lgamma](namespaceeigen#ac2e6331628bb1989b7be6d7e42827649) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_log\_op< typename Derived::Scalar >, const Derived > | [log](namespaceeigen#ae8bb75ba4f5f30a7571146dbfa653c6d) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_log10\_op< typename Derived::Scalar >, const Derived > | [log10](namespaceeigen#a25256faeec3ffd0f3615a0e1e45dfb14) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_log1p\_op< typename Derived::Scalar >, const Derived > | [log1p](namespaceeigen#ac5c8a2cded6b59628f2de04f24d2fff4) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_log2\_op< typename Derived::Scalar >, const Derived > | [log2](namespaceeigen#ad2d0241ffaaa3b0b04ec70b59ab066d4) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_logistic\_op< typename Derived::Scalar >, const Derived > | [logistic](namespaceeigen#adb0b668da3480346f2fc81f229b570a6) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_ndtri\_op< typename Derived::Scalar >, const Derived > | [ndtri](namespaceeigen#ab7ed113a2dd4a4342c72b550faea308d) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename SparseDerived , typename PermutationType > | | const [Product](classeigen_1_1product)< [Inverse](classeigen_1_1inverse)< PermutationType >, SparseDerived, AliasFreeProduct > | [operator\*](namespaceeigen#ad225313de8037d40c2d26c17edf1a9fd) (const InverseImpl< PermutationType, [PermutationStorage](structeigen_1_1permutationstorage) > &tperm, const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > &matrix) | | | | template<typename MatrixDerived , typename PermutationDerived > | | const [Product](classeigen_1_1product)< MatrixDerived, PermutationDerived, AliasFreeProduct > | [operator\*](namespaceeigen#a9723b3ff0f2c99fe1081e3eb14380d4c) (const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &matrix, const [PermutationBase](classeigen_1_1permutationbase)< PermutationDerived > &permutation) | | | | template<typename MatrixDerived , typename TranspositionsDerived > | | const [Product](classeigen_1_1product)< MatrixDerived, TranspositionsDerived, AliasFreeProduct > | [operator\*](namespaceeigen#a06ca1e6b1a30b4dd0f2633664fe4d956) (const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &matrix, const TranspositionsBase< TranspositionsDerived > &transpositions) | | | | template<typename OtherDerived , typename VectorsType , typename CoeffsType , int Side> | | internal::matrix\_type\_times\_scalar\_type< typename VectorsType::Scalar, OtherDerived >::Type | [operator\*](namespaceeigen#a634bfd5e206a2e77f799b4c3956ea49e) (const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &other, const [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side > &h) | | | Computes the product of a matrix with a Householder sequence. [More...](namespaceeigen#a634bfd5e206a2e77f799b4c3956ea49e) | | | | template<typename SparseDerived , typename PermDerived > | | const [Product](classeigen_1_1product)< PermDerived, SparseDerived, AliasFreeProduct > | [operator\*](namespaceeigen#a02fbb1bbd915b899b34a56a3cd64c438) (const [PermutationBase](classeigen_1_1permutationbase)< PermDerived > &perm, const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > &matrix) | | | | template<typename PermutationDerived , typename MatrixDerived > | | const [Product](classeigen_1_1product)< PermutationDerived, MatrixDerived, AliasFreeProduct > | [operator\*](namespaceeigen#a4d2abe28092f8070e971494c7e0b507a) (const [PermutationBase](classeigen_1_1permutationbase)< PermutationDerived > &permutation, const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &matrix) | | | | template<typename SparseDerived , typename PermutationType > | | const [Product](classeigen_1_1product)< SparseDerived, [Inverse](classeigen_1_1inverse)< PermutationType >, AliasFreeProduct > | [operator\*](namespaceeigen#a8b7051d2f98498d619044089949f931d) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > &matrix, const InverseImpl< PermutationType, [PermutationStorage](structeigen_1_1permutationstorage) > &tperm) | | | | template<typename SparseDerived , typename PermDerived > | | const [Product](classeigen_1_1product)< SparseDerived, PermDerived, AliasFreeProduct > | [operator\*](namespaceeigen#a429958a0e6bd27168f3935d3100c55cf) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > &matrix, const [PermutationBase](classeigen_1_1permutationbase)< PermDerived > &perm) | | | | template<typename TranspositionsDerived , typename MatrixDerived > | | const [Product](classeigen_1_1product)< TranspositionsDerived, MatrixDerived, AliasFreeProduct > | [operator\*](namespaceeigen#a02b783ce2d2464d4f4a0bc0d1dc494f0) (const TranspositionsBase< TranspositionsDerived > &transpositions, const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > &matrix) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_real\_op< typename Derived::Scalar >, const Derived > | [real](namespaceeigen#ac74dc920119b1eba45e9218d9f402afc) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename VectorsType , typename CoeffsType > | | [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, [OnTheRight](group__enums#ggac22de43beeac7a78b384f99bed5cee0ba329fc3a54ceb2b6e0e73b400998b8a82) > | [rightHouseholderSequence](group__householder__module#ga897ebce658762148f706f73a05525e89) (const VectorsType &v, const CoeffsType &h) | | | Convenience function for constructing a Householder sequence. [More...](group__householder__module#ga897ebce658762148f706f73a05525e89) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_rint\_op< typename Derived::Scalar >, const Derived > | [rint](namespaceeigen#a0211fe61b9e390dfd8ca213fe9c7fca3) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_round\_op< typename Derived::Scalar >, const Derived > | [round](namespaceeigen#ad9eaa98e8016ef17024a18a2f3e5bef3) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_rsqrt\_op< typename Derived::Scalar >, const Derived > | [rsqrt](namespaceeigen#a6374a6a9e972e9358d7ab3fced32d7d5) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [DiagonalWrapper](classeigen_1_1diagonalwrapper)< const Derived > | [Scaling](namespaceeigen#a109425bca2048c3df19249c04e73715c) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &coeffs) | | | | template<typename Scalar > | | [DiagonalMatrix](classeigen_1_1diagonalmatrix)< Scalar, 2 > | [Scaling](namespaceeigen#aafd4d881e7a6c2a68c1db03e261c767b) (const Scalar &sx, const Scalar &sy) | | | | template<typename Scalar > | | [DiagonalMatrix](classeigen_1_1diagonalmatrix)< Scalar, 3 > | [Scaling](namespaceeigen#a162d759175d7c5214f33fefb30862815) (const Scalar &sx, const Scalar &sy, const Scalar &sz) | | | | template<typename RealScalar > | | [UniformScaling](classeigen_1_1uniformscaling)< std::complex< RealScalar > > | [Scaling](namespaceeigen#a76386154f2cdb77190759744830422d1) (const std::complex< RealScalar > &s) | | | | [UniformScaling](classeigen_1_1uniformscaling)< double > | [Scaling](namespaceeigen#ad2e71727718ca788680b3aa9eb485f98) (double s) | | | | [UniformScaling](classeigen_1_1uniformscaling)< float > | [Scaling](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b) (float s) | | | | template<typename FirstType , typename LastType > | | auto | [seq](namespaceeigen#ad87fbafd4a91f5c1ed6a768987a1b74d) (FirstType f, LastType l) | | | | template<typename FirstType , typename LastType , typename IncrType > | | auto | [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969) (FirstType f, LastType l, IncrType incr) | | | | template<typename FirstType , typename SizeType > | | [ArithmeticSequence](classeigen_1_1arithmeticsequence)< typename internal::cleanup\_index\_type< FirstType >::type, typename internal::cleanup\_index\_type< SizeType >::type > | [seqN](namespaceeigen#ade9f918902511b83512a8e6dde5cad7a) (FirstType first, SizeType size) | | | | template<typename FirstType , typename SizeType , typename IncrType > | | [ArithmeticSequence](classeigen_1_1arithmeticsequence)< typename internal::cleanup\_index\_type< FirstType >::type, typename internal::cleanup\_index\_type< SizeType >::type, typename internal::cleanup\_seq\_incr< IncrType >::type > | [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda) (FirstType first, SizeType size, IncrType incr) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_sign\_op< typename Derived::Scalar >, const Derived > | [sign](namespaceeigen#a831e88e0403a42d0dfb328d8acd3e56f) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_sin\_op< typename Derived::Scalar >, const Derived > | [sin](namespaceeigen#ae6e8ad270ff41c088d7651567594f796) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_sinh\_op< typename Derived::Scalar >, const Derived > | [sinh](namespaceeigen#af284ce359b6efd4b594a9f8a1f5e5d96) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_sqrt\_op< typename Derived::Scalar >, const Derived > | [sqrt](namespaceeigen#af4f536e8ea56702e63088efb3706d1f0) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_square\_op< typename Derived::Scalar >, const Derived > | [square](namespaceeigen#af28ef8cae3b37bcf1b47910cd6f20d4c) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_tan\_op< typename Derived::Scalar >, const Derived > | [tan](namespaceeigen#a3bc116a6243f38c22f851581aa7b521a) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_tanh\_op< typename Derived::Scalar >, const Derived > | [tanh](namespaceeigen#a0110c233d357169fd58fdf5656992a98) (const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived , typename OtherDerived > | | internal::umeyama\_transform\_matrix\_type< Derived, OtherDerived >::type | [umeyama](group__geometry__module#gab3f5a82a24490b936f8694cf8fef8e60) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &src, const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > &dst, bool with\_scaling=true) | | | Returns the transformation between two point sets. [More...](group__geometry__module#gab3f5a82a24490b936f8694cf8fef8e60) | | | | template<typename \_Scalar , int \_Options, typename \_Index , unsigned int UpLo> | | cholmod\_sparse | [viewAsCholmod](namespaceeigen#afacb818b18280e2e1ab73836ab74cab5) (const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< const [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_Index >, UpLo > &mat) | | | | template<typename Derived > | | cholmod\_dense | [viewAsCholmod](namespaceeigen#a92fe7b595099051fa1d1c443641a6de3) ([MatrixBase](classeigen_1_1matrixbase)< Derived > &mat) | | | | template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | cholmod\_sparse | [viewAsCholmod](namespaceeigen#ac9fb9e40cfc9ddbdc7da84ee01bb7545) ([Ref](classeigen_1_1ref)< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > > mat) | | | | template<typename Scalar , int Flags, typename StorageIndex > | | [MappedSparseMatrix](classeigen_1_1mappedsparsematrix)< Scalar, Flags, StorageIndex > | [viewAsEigen](namespaceeigen#aad43574b96b756041bd8037c4b61e0d9) (cholmod\_sparse &cm) | | | | | | --- | | | | const unsigned int | [ActualPacketAccessBit](group__flags#ga020f88dc24a123b9afbd756c4b220db2) | | | | EIGEN\_DEPRECATED const unsigned int | [AlignedBit](group__flags#gac5795adacd266512a26890973503ed88) | | | | static const Eigen::internal::all\_t | [all](group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14) | | | | const unsigned int | [CompressedAccessBit](group__flags#gaed0244284da47a2b8661261431173caf) | | | | const unsigned int | [DirectAccessBit](group__flags#gabf1e9d0516a933445a4c307ad8f14915) | | | | const int | [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) | | | | const int | [DynamicIndex](namespaceeigen#a73c597189a4a99127175e8167c456fff) | | | | EIGEN\_DEPRECATED const unsigned int | [EvalBeforeAssigningBit](group__flags#ga0972b20dc004d13984e642b3bd12532e) | | | | const unsigned int | [EvalBeforeNestingBit](group__flags#gaa34e83bae46a8eeae4e69ebe3aaecbed) | | | | const int | [HugeCost](namespaceeigen#a3163430a1c13173faffde69016b48aaf) | | | | const int | [Infinity](namespaceeigen#a7951593b031e13d90223c83d022ce99e) | | | | static const [symbolic::SymbolExpr](classeigen_1_1symbolic_1_1symbolexpr)< internal::symbolic\_last\_tag > | [last](group__core__module#ga2dd8b20d08336af23947e054a17415ee) | | | | static const auto | [lastp1](group__core__module#ga662ffa801d746b972453080c648765f9) | | | | const unsigned int | [LinearAccessBit](group__flags#ga4b983a15d57cd55806df618ac544d09e) | | | | const unsigned int | [LvalueBit](group__flags#gae2c323957f20dfdc6cb8f44428eaec1a) | | | | const unsigned int | [NoPreferredStorageOrderBit](group__flags#ga3c186ad80ddcf5e2ed3d7ee31cca1860) | | | | const unsigned int | [PacketAccessBit](group__flags#ga1a306a438e1ab074e8be59512e887b9f) | | | | const unsigned int | [RowMajorBit](group__flags#gae4f56c2a60bbe4bd2e44c5b19cbe8762) | | | | const int | [UndefinedIncr](namespaceeigen#a06808a853a9baa38b23a5368e7491abd) | | | Namespace containing all symbols from the Eigen library. AlignedScaling2d ---------------- | | | --- | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)<double,2> [Eigen::AlignedScaling2d](namespaceeigen#af8975289b8134a5021e806029516e82c) | **[Deprecated:](deprecated#_deprecated000028)** AlignedScaling2f ---------------- | | | --- | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)<float, 2> [Eigen::AlignedScaling2f](namespaceeigen#af2440178a1f5f6abef6ee0231bc49184) | **[Deprecated:](deprecated#_deprecated000027)** AlignedScaling3d ---------------- | | | --- | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)<double,3> [Eigen::AlignedScaling3d](namespaceeigen#a0aff001d5740f13797c9acd4e3276673) | **[Deprecated:](deprecated#_deprecated000030)** AlignedScaling3f ---------------- | | | --- | | typedef [DiagonalMatrix](classeigen_1_1diagonalmatrix)<float, 3> [Eigen::AlignedScaling3f](namespaceeigen#a45caf8b0e6da378885f4ae3f06c5cde3) | **[Deprecated:](deprecated#_deprecated000029)** Index ----- | | | --- | | typedef EIGEN\_DEFAULT\_DENSE\_INDEX\_TYPE [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | The Index type as used for the API. To change this, `#define` the preprocessor symbol `EIGEN_DEFAULT_DENSE_INDEX_TYPE`. See also [Preprocessor directives](topicpreprocessordirectives), StorageIndex. anonymous enum -------------- | | | --- | | anonymous enum | | Enumerator | | --- | | StandardCompressedFormat | used by Ref<SparseMatrix> to specify whether the input storage must be in standard compressed form | abs() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_abs\_op <typename Derived::Scalar>, const Derived> Eigen::abs | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise absolute value of *x* See also ArrayBase::abs , MatrixBase::cwiseAbs [Math functions](group__coeffwisemathfunctions#cwisetable_abs), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") abs2() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_abs2\_op <typename Derived::Scalar>, const Derived> Eigen::abs2 | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise squared absolute value of *x* See also ArrayBase::abs2 , MatrixBase::cwiseAbs2 [Math functions](group__coeffwisemathfunctions#cwisetable_abs2), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") acos() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_acos\_op <typename Derived::Scalar>, const Derived> Eigen::acos | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise arc-consine of *x* See also ArrayBase::acos [Math functions](group__coeffwisemathfunctions#cwisetable_acos), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") acosh() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_acosh\_op <typename Derived::Scalar>, const Derived> Eigen::acosh | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise inverse hyperbolic cosine of *x* See also ArrayBase::acosh [Math functions](group__coeffwisemathfunctions#cwisetable_acosh), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") arg() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_arg\_op <typename Derived::Scalar>, const Derived> Eigen::arg | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise complex argument of *x* See also ArrayBase::arg , MatrixBase::cwiseArg [Math functions](group__coeffwisemathfunctions#cwisetable_arg), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") asin() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_asin\_op <typename Derived::Scalar>, const Derived> Eigen::asin | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise arc-sine of *x* See also ArrayBase::asin [Math functions](group__coeffwisemathfunctions#cwisetable_asin), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") asinh() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_asinh\_op <typename Derived::Scalar>, const Derived> Eigen::asinh | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise inverse hyperbolic sine of *x* See also ArrayBase::asinh [Math functions](group__coeffwisemathfunctions#cwisetable_asinh), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") atan() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_atan\_op <typename Derived::Scalar>, const Derived> Eigen::atan | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise arc-tangent of *x* See also ArrayBase::atan [Math functions](group__coeffwisemathfunctions#cwisetable_atan), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") atanh() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_atanh\_op <typename Derived::Scalar>, const Derived> Eigen::atanh | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise inverse hyperbolic tangent of *x* See also ArrayBase::atanh [Math functions](group__coeffwisemathfunctions#cwisetable_atanh), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") ceil() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_ceil\_op <typename Derived::Scalar>, const Derived> Eigen::ceil | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise nearest integer not less than the giben value of *x* See also [Eigen::floor](namespaceeigen#abf03d773a87830bc7fde51bcd94c89a0) , ArrayBase::ceil [Math functions](group__coeffwisemathfunctions#cwisetable_ceil), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") conj() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_conjugate\_op <typename Derived::Scalar>, const Derived> Eigen::conj | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise complex conjugate of *x* See also ArrayBase::conjugate [Math functions](group__coeffwisemathfunctions#cwisetable_conj), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") cos() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_cos\_op <typename Derived::Scalar>, const Derived> Eigen::cos | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise cosine of *x* See also ArrayBase::cos [Math functions](group__coeffwisemathfunctions#cwisetable_cos), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") cosh() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_cosh\_op <typename Derived::Scalar>, const Derived> Eigen::cosh | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise hyperbolic cosine of *x* See also ArrayBase::cosh [Math functions](group__coeffwisemathfunctions#cwisetable_cosh), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") cube() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_cube\_op <typename Derived::Scalar>, const Derived> Eigen::cube | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise cube (power 3) of *x* See also Eigen::pow , ArrayBase::cube [Math functions](group__coeffwisemathfunctions#cwisetable_cube), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") digamma() --------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_digamma\_op <typename Derived::Scalar>, const Derived> Eigen::digamma | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise derivative of lgamma of *x* See also ArrayBase::digamma [Math functions](group__coeffwisemathfunctions#cwisetable_digamma), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") erf() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_erf\_op <typename Derived::Scalar>, const Derived> Eigen::erf | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise error function of *x* See also ArrayBase::erf [Math functions](group__coeffwisemathfunctions#cwisetable_erf), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") erfc() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_erfc\_op <typename Derived::Scalar>, const Derived> Eigen::erfc | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise complement error function of *x* See also ArrayBase::erfc [Math functions](group__coeffwisemathfunctions#cwisetable_erfc), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") exp() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_exp\_op <typename Derived::Scalar>, const Derived> Eigen::exp | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise exponential of *x* See also ArrayBase::exp [Math functions](group__coeffwisemathfunctions#cwisetable_exp), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") expm1() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_expm1\_op <typename Derived::Scalar>, const Derived> Eigen::expm1 | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise exponential of a value minus 1 of *x* See also ArrayBase::expm1 [Math functions](group__coeffwisemathfunctions#cwisetable_expm1), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") floor() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_floor\_op <typename Derived::Scalar>, const Derived> Eigen::floor | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise nearest integer not greater than the giben value of *x* See also [Eigen::ceil](namespaceeigen#aa73e38be0689a463ae14141b9cf89c35) , ArrayBase::floor [Math functions](group__coeffwisemathfunctions#cwisetable_floor), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") imag() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_imag\_op <typename Derived::Scalar>, const Derived> Eigen::imag | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise imaginary part of *x* See also ArrayBase::imag [Math functions](group__coeffwisemathfunctions#cwisetable_imag), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") inverse() --------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_inverse\_op <typename Derived::Scalar>, const Derived> Eigen::inverse | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise inverse of *x* See also ArrayBase::inverse [Math functions](group__coeffwisemathfunctions#cwisetable_inverse), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") isfinite() ---------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_isfinite\_op <typename Derived::Scalar>, const Derived> Eigen::isfinite | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise finite value test of *x* See also [Eigen::isinf](namespaceeigen#a1f1103712e337c4c96a05f949637a4c8) , [Eigen::isnan](namespaceeigen#a99adfc5178f3fd5488304284388b2a10) , ArrayBase::isfinite [Math functions](group__coeffwisemathfunctions#cwisetable_isfinite), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") isinf() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_isinf\_op <typename Derived::Scalar>, const Derived> Eigen::isinf | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise infinite value test of *x* See also [Eigen::isnan](namespaceeigen#a99adfc5178f3fd5488304284388b2a10) , [Eigen::isfinite](namespaceeigen#aba24ec81dec745a00b7f33adead89811) , ArrayBase::isinf [Math functions](group__coeffwisemathfunctions#cwisetable_isinf), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") isnan() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_isnan\_op <typename Derived::Scalar>, const Derived> Eigen::isnan | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise not-a-number test of *x* See also [Eigen::isinf](namespaceeigen#a1f1103712e337c4c96a05f949637a4c8) , [Eigen::isfinite](namespaceeigen#aba24ec81dec745a00b7f33adead89811) , ArrayBase::isnan [Math functions](group__coeffwisemathfunctions#cwisetable_isnan), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") lastN() [1/2] ------------- template<typename SizeType > | | | | | | | | --- | --- | --- | --- | --- | --- | | auto Eigen::lastN | ( | SizeType | *size* | ) | -> decltype([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)+[fix](group__core__module#gac01f234bce100e39e6928fdc470e5194)<1>()-size, size)) | [c++11] Returns a symbolic [ArithmeticSequence](classeigen_1_1arithmeticsequence) representing the last *size* elements with a unit increment. It is a shortcut for: ``` [seq](namespaceeigen#a0c04400203ca9b414e13c9c721399969)([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)+fix<1>-size, [last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)) ``` See also [lastN](namespaceeigen#acc01e5c7293dd3af76e79ae68cc87f77)(SizeType,IncrType, [seqN(FirstType,SizeType)](namespaceeigen#ade9f918902511b83512a8e6dde5cad7a), [seq(FirstType,LastType)](namespaceeigen#ad87fbafd4a91f5c1ed6a768987a1b74d) lastN() [2/2] ------------- template<typename SizeType , typename IncrType > | | | | | | --- | --- | --- | --- | | auto Eigen::lastN | ( | SizeType | *size*, | | | | IncrType | *incr* | | | ) | | -> decltype([seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([Eigen::last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-(size-[fix](group__core__module#gac01f234bce100e39e6928fdc470e5194)<1>())\*incr, size, incr)) | [c++11] Returns a symbolic [ArithmeticSequence](classeigen_1_1arithmeticsequence) representing the last *size* elements with increment *incr*. It is a shortcut for: ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)([last](group__core__module#ga2dd8b20d08336af23947e054a17415ee)-(size-fix<1>)*incr, size, incr) ``` See also [lastN(SizeType)](namespaceeigen#a5564b99b116c725ef571f1a2f859acb1), [seqN(FirstType,SizeType)](namespaceeigen#ade9f918902511b83512a8e6dde5cad7a), [seq(FirstType,LastType,IncrType)](namespaceeigen#a0c04400203ca9b414e13c9c721399969) lgamma() -------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_lgamma\_op <typename Derived::Scalar>, const Derived> Eigen::lgamma | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise natural logarithm of the gamma function of *x* See also ArrayBase::lgamma [Math functions](group__coeffwisemathfunctions#cwisetable_lgamma), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") log() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_log\_op <typename Derived::Scalar>, const Derived> Eigen::log | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise natural logarithm of *x* See also [Eigen::log10](namespaceeigen#a25256faeec3ffd0f3615a0e1e45dfb14) , ArrayBase::log [Math functions](group__coeffwisemathfunctions#cwisetable_log), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") log10() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_log10\_op <typename Derived::Scalar>, const Derived> Eigen::log10 | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise base 10 logarithm of *x* See also [Eigen::log](namespaceeigen#ae8bb75ba4f5f30a7571146dbfa653c6d) , ArrayBase::log10 [Math functions](group__coeffwisemathfunctions#cwisetable_log10), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") log1p() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_log1p\_op <typename Derived::Scalar>, const Derived> Eigen::log1p | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise natural logarithm of 1 plus the value of *x* See also ArrayBase::log1p [Math functions](group__coeffwisemathfunctions#cwisetable_log1p), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") log2() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_log2\_op <typename Derived::Scalar>, const Derived> Eigen::log2 | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise base 2 logarithm of *x* See also [Eigen::log](namespaceeigen#ae8bb75ba4f5f30a7571146dbfa653c6d) , ArrayBase::log2 [Math functions](group__coeffwisemathfunctions#cwisetable_log2), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") logistic() ---------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_logistic\_op <typename Derived::Scalar>, const Derived> Eigen::logistic | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise logistic function of *x* See also ArrayBase::logistic [Math functions](group__coeffwisemathfunctions#cwisetable_logistic), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") ndtri() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_ndtri\_op <typename Derived::Scalar>, const Derived> Eigen::ndtri | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise inverse normal distribution function of *x* See also ArrayBase::ndtri [Math functions](group__coeffwisemathfunctions#cwisetable_ndtri), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") operator\*() [1/9] ------------------ template<typename SparseDerived , typename PermutationType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<[Inverse](classeigen_1_1inverse)<PermutationType>, SparseDerived, AliasFreeProduct> Eigen::operator\* | ( | const InverseImpl< PermutationType, [PermutationStorage](structeigen_1_1permutationstorage) > & | *tperm*, | | | | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > & | *matrix* | | | ) | | | | inline | Returns the matrix with the inverse permutation applied to the rows. operator\*() [2/9] ------------------ template<typename MatrixDerived , typename PermutationDerived > | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<MatrixDerived, PermutationDerived, AliasFreeProduct> Eigen::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > & | *matrix*, | | | | const [PermutationBase](classeigen_1_1permutationbase)< PermutationDerived > & | *permutation* | | | ) | | | Returns the matrix with the permutation applied to the columns. operator\*() [3/9] ------------------ template<typename MatrixDerived , typename TranspositionsDerived > | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<MatrixDerived, TranspositionsDerived, AliasFreeProduct> Eigen::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > & | *matrix*, | | | | const TranspositionsBase< TranspositionsDerived > & | *transpositions* | | | ) | | | Returns the *matrix* with the *transpositions* applied to the columns. operator\*() [4/9] ------------------ template<typename OtherDerived , typename VectorsType , typename CoeffsType , int Side> | | | | | | --- | --- | --- | --- | | internal::matrix\_type\_times\_scalar\_type<typename VectorsType::Scalar,OtherDerived>::Type Eigen::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< OtherDerived > & | *other*, | | | | const [HouseholderSequence](classeigen_1_1householdersequence)< VectorsType, CoeffsType, Side > & | *h* | | | ) | | | Computes the product of a matrix with a Householder sequence. Parameters | | | | | --- | --- | --- | | [in] | other | Matrix being multiplied. | | [in] | h | HouseholderSequence being multiplied. | Returns Expression object representing the product. This function computes \( MH \) where \( M \) is the matrix `other` and \( H \) is the Householder sequence represented by `h`. operator\*() [5/9] ------------------ template<typename SparseDerived , typename PermDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<PermDerived, SparseDerived, AliasFreeProduct> Eigen::operator\* | ( | const [PermutationBase](classeigen_1_1permutationbase)< PermDerived > & | *perm*, | | | | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > & | *matrix* | | | ) | | | | inline | Returns the matrix with the permutation applied to the rows operator\*() [6/9] ------------------ template<typename PermutationDerived , typename MatrixDerived > | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<PermutationDerived, MatrixDerived, AliasFreeProduct> Eigen::operator\* | ( | const [PermutationBase](classeigen_1_1permutationbase)< PermutationDerived > & | *permutation*, | | | | const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > & | *matrix* | | | ) | | | Returns the matrix with the permutation applied to the rows. operator\*() [7/9] ------------------ template<typename SparseDerived , typename PermutationType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<SparseDerived, [Inverse](classeigen_1_1inverse)<PermutationType>, AliasFreeProduct> Eigen::operator\* | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > & | *matrix*, | | | | const InverseImpl< PermutationType, [PermutationStorage](structeigen_1_1permutationstorage) > & | *tperm* | | | ) | | | | inline | Returns the matrix with the inverse permutation applied to the columns. operator\*() [8/9] ------------------ template<typename SparseDerived , typename PermDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<SparseDerived, PermDerived, AliasFreeProduct> Eigen::operator\* | ( | const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< SparseDerived > & | *matrix*, | | | | const [PermutationBase](classeigen_1_1permutationbase)< PermDerived > & | *perm* | | | ) | | | | inline | Returns the matrix with the permutation applied to the columns operator\*() [9/9] ------------------ template<typename TranspositionsDerived , typename MatrixDerived > | | | | | | --- | --- | --- | --- | | const [Product](classeigen_1_1product)<TranspositionsDerived, MatrixDerived, AliasFreeProduct> Eigen::operator\* | ( | const TranspositionsBase< TranspositionsDerived > & | *transpositions*, | | | | const [MatrixBase](classeigen_1_1matrixbase)< MatrixDerived > & | *matrix* | | | ) | | | Returns the *matrix* with the *transpositions* applied to the rows. real() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_real\_op <typename Derived::Scalar>, const Derived> Eigen::real | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise real part of *x* See also ArrayBase::real [Math functions](group__coeffwisemathfunctions#cwisetable_real), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") rint() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_rint\_op <typename Derived::Scalar>, const Derived> Eigen::rint | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise nearest integer of *x* See also [Eigen::floor](namespaceeigen#abf03d773a87830bc7fde51bcd94c89a0) , [Eigen::ceil](namespaceeigen#aa73e38be0689a463ae14141b9cf89c35) , ArrayBase::round [Math functions](group__coeffwisemathfunctions#cwisetable_rint), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") round() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_round\_op <typename Derived::Scalar>, const Derived> Eigen::round | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise nearest integer of *x* See also [Eigen::floor](namespaceeigen#abf03d773a87830bc7fde51bcd94c89a0) , [Eigen::ceil](namespaceeigen#aa73e38be0689a463ae14141b9cf89c35) , ArrayBase::round [Math functions](group__coeffwisemathfunctions#cwisetable_round), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") rsqrt() ------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_rsqrt\_op <typename Derived::Scalar>, const Derived> Eigen::rsqrt | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise reciprocal square root of *x* See also ArrayBase::rsqrt [Math functions](group__coeffwisemathfunctions#cwisetable_rsqrt), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") Scaling() [1/6] --------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [DiagonalWrapper](classeigen_1_1diagonalwrapper)<const Derived> Eigen::Scaling | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *coeffs* | ) | | | inline | Constructs an axis aligned scaling expression from vector expression *coeffs* This is an alias for coeffs.asDiagonal() Scaling() [2/6] --------------- template<typename Scalar > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [DiagonalMatrix](classeigen_1_1diagonalmatrix)<Scalar,2> Eigen::Scaling | ( | const Scalar & | *sx*, | | | | const Scalar & | *sy* | | | ) | | | | inline | Constructs a 2D axis aligned scaling Scaling() [3/6] --------------- template<typename Scalar > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [DiagonalMatrix](classeigen_1_1diagonalmatrix)<Scalar,3> Eigen::Scaling | ( | const Scalar & | *sx*, | | | | const Scalar & | *sy*, | | | | const Scalar & | *sz* | | | ) | | | | inline | Constructs a 3D axis aligned scaling Scaling() [4/6] --------------- template<typename RealScalar > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [UniformScaling](classeigen_1_1uniformscaling)<std::complex<RealScalar> > Eigen::Scaling | ( | const std::complex< RealScalar > & | *s* | ) | | | inline | Constructs a uniform scaling from scale factor *s* Scaling() [5/6] --------------- | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [UniformScaling](classeigen_1_1uniformscaling)<double> Eigen::Scaling | ( | double | *s* | ) | | | inline | Constructs a uniform scaling from scale factor *s* Scaling() [6/6] --------------- | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [UniformScaling](classeigen_1_1uniformscaling)<float> Eigen::Scaling | ( | float | *s* | ) | | | inline | Constructs a uniform scaling from scale factor *s* seq() [1/2] ----------- template<typename FirstType , typename LastType > | | | | | | --- | --- | --- | --- | | auto Eigen::seq | ( | FirstType | *f*, | | | | LastType | *l* | | | ) | | | Returns an [ArithmeticSequence](classeigen_1_1arithmeticsequence) starting at *f*, up (or down) to *l*, and unit increment It is essentially an alias to: ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(f,l-f+1); ``` See also [seqN(FirstType,SizeType)](namespaceeigen#ade9f918902511b83512a8e6dde5cad7a), [seq(FirstType,LastType,IncrType)](namespaceeigen#a0c04400203ca9b414e13c9c721399969) seq() [2/2] ----------- template<typename FirstType , typename LastType , typename IncrType > | | | | | | --- | --- | --- | --- | | auto Eigen::seq | ( | FirstType | *f*, | | | | LastType | *l*, | | | | IncrType | *incr* | | | ) | | | Returns an [ArithmeticSequence](classeigen_1_1arithmeticsequence) starting at *f*, up (or down) to *l*, and with positive (or negative) increment *incr* It is essentially an alias to: ``` [seqN](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda)(f, (l-f+incr)/incr, incr); ``` See also [seqN(FirstType,SizeType,IncrType)](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda), [seq(FirstType,LastType)](namespaceeigen#ad87fbafd4a91f5c1ed6a768987a1b74d) seqN() [1/2] ------------ template<typename FirstType , typename SizeType > | | | | | | --- | --- | --- | --- | | [ArithmeticSequence](classeigen_1_1arithmeticsequence)<typename internal::cleanup\_index\_type<FirstType>::type,typename internal::cleanup\_index\_type<SizeType>::type > Eigen::seqN | ( | FirstType | *first*, | | | | SizeType | *size* | | | ) | | | Returns an [ArithmeticSequence](classeigen_1_1arithmeticsequence) starting at *first*, of length *size*, and unit increment See also [seqN(FirstType,SizeType,IncrType)](namespaceeigen#a3a3c346d2a61d1e8e86e6fb4cf57fbda), [seq(FirstType,LastType)](namespaceeigen#ad87fbafd4a91f5c1ed6a768987a1b74d) seqN() [2/2] ------------ template<typename FirstType , typename SizeType , typename IncrType > | | | | | | --- | --- | --- | --- | | [ArithmeticSequence](classeigen_1_1arithmeticsequence)< typename internal::cleanup\_index\_type< FirstType >::type, typename internal::cleanup\_index\_type< SizeType >::type, typename internal::cleanup\_seq\_incr< IncrType >::type > Eigen::seqN | ( | FirstType | *first*, | | | | SizeType | *size*, | | | | IncrType | *incr* | | | ) | | | Returns an [ArithmeticSequence](classeigen_1_1arithmeticsequence) starting at *first*, of length *size*, and increment *incr* See also [seqN(FirstType,SizeType)](namespaceeigen#ade9f918902511b83512a8e6dde5cad7a), [seq(FirstType,LastType,IncrType)](namespaceeigen#a0c04400203ca9b414e13c9c721399969) sign() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_sign\_op <typename Derived::Scalar>, const Derived> Eigen::sign | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise sign (or 0) of *x* See also ArrayBase::sign [Math functions](group__coeffwisemathfunctions#cwisetable_sign), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") sin() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_sin\_op <typename Derived::Scalar>, const Derived> Eigen::sin | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise sine of *x* See also ArrayBase::sin [Math functions](group__coeffwisemathfunctions#cwisetable_sin), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") sinh() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_sinh\_op <typename Derived::Scalar>, const Derived> Eigen::sinh | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise hyperbolic sine of *x* See also ArrayBase::sinh [Math functions](group__coeffwisemathfunctions#cwisetable_sinh), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") sqrt() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_sqrt\_op <typename Derived::Scalar>, const Derived> Eigen::sqrt | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise square root of *x* See also ArrayBase::sqrt , MatrixBase::cwiseSqrt [Math functions](group__coeffwisemathfunctions#cwisetable_sqrt), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") square() -------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_square\_op <typename Derived::Scalar>, const Derived> Eigen::square | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise square (power 2) of *x* See also [Eigen::abs2](namespaceeigen#a54cc34b64b4935307efc06d56cd531df) , Eigen::pow , ArrayBase::square [Math functions](group__coeffwisemathfunctions#cwisetable_square), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") tan() ----- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_tan\_op <typename Derived::Scalar>, const Derived> Eigen::tan | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise tangent of *x* See also ArrayBase::tan [Math functions](group__coeffwisemathfunctions#cwisetable_tan), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") tanh() ------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](classeigen_1_1cwiseunaryop)<Eigen::internal:: scalar\_tanh\_op <typename Derived::Scalar>, const Derived> Eigen::tanh | ( | const [Eigen::ArrayBase](classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise hyperbolic tangent of *x* See also ArrayBase::tanh [Math functions](group__coeffwisemathfunctions#cwisetable_tanh), class [CwiseUnaryOp](classeigen_1_1cwiseunaryop "Generic expression where a coefficient-wise unary operator is applied to an expression.") viewAsCholmod() [1/3] --------------------- template<typename \_Scalar , int \_Options, typename \_Index , unsigned int UpLo> | | | | | | | | --- | --- | --- | --- | --- | --- | | cholmod\_sparse Eigen::viewAsCholmod | ( | const [SparseSelfAdjointView](classeigen_1_1sparseselfadjointview)< const [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_Index >, UpLo > & | *mat* | ) | | Returns a view of the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") sparse matrix *mat* as Cholmod sparse matrix. The data are not copied but shared. viewAsCholmod() [2/3] --------------------- template<typename Derived > | | | | | | | | --- | --- | --- | --- | --- | --- | | cholmod\_dense Eigen::viewAsCholmod | ( | [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *mat* | ) | | Returns a view of the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") **dense** matrix *mat* as Cholmod dense matrix. The data are not copied but shared. viewAsCholmod() [3/3] --------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | --- | --- | --- | --- | --- | --- | | cholmod\_sparse Eigen::viewAsCholmod | ( | [Ref](classeigen_1_1ref)< [SparseMatrix](classeigen_1_1sparsematrix)< \_Scalar, \_Options, \_StorageIndex > > | *mat* | ) | | Wraps the [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") sparse matrix *mat* into a Cholmod sparse matrix object. Note that the data are shared. viewAsEigen() ------------- template<typename Scalar , int Flags, typename StorageIndex > | | | | | | | | --- | --- | --- | --- | --- | --- | | [MappedSparseMatrix](classeigen_1_1mappedsparsematrix)<Scalar,Flags,StorageIndex> Eigen::viewAsEigen | ( | cholmod\_sparse & | *cm* | ) | | Returns a view of the Cholmod sparse matrix *cm* as an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") sparse matrix. The data are not copied but shared. Dynamic ------- | | | --- | | const int Eigen::Dynamic | This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable. Changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors."). DynamicIndex ------------ | | | --- | | const int Eigen::DynamicIndex | This value means that a signed quantity (e.g., a signed index) is not known at compile-time, and that instead its value has to be specified at runtime. HugeCost -------- | | | --- | | const int Eigen::HugeCost | This value means that the cost to evaluate an expression coefficient is either very expensive or cannot be known at compile time. This value has to be positive to (1) simplify cost computation, and (2) allow to distinguish between a very expensive and very very expensive expressions. It thus must also be large enough to make sure unrolling won't happen and that sub expressions will be evaluated, but not too large to avoid overflow. Infinity -------- | | | --- | | const int Eigen::Infinity | This value means +Infinity; it is currently used only as the p parameter to [MatrixBase::lpNorm<int>()](classeigen_1_1matrixbase#a72586ab059e889e7d2894ff227747e35). The value Infinity there means the L-infinity norm. UndefinedIncr ------------- | | | --- | | const int Eigen::UndefinedIncr | This value means that the increment to go from one value to another in a sequence is not constant for each step.
programming_docs
eigen3 Eigen::Map Eigen::Map ========== ### template<typename SparseMatrixType> class Eigen::Map< SparseMatrixType > Specialization of class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") for SparseMatrix-like storage. Template Parameters | | | | --- | --- | | SparseMatrixType | the equivalent sparse matrix type of the referenced data, it must be a template instance of class [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation."). | See also class [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data."), class [SparseMatrix](classeigen_1_1sparsematrix "A versatible sparse matrix representation."), class [Ref<SparseMatrixType,Options>](classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4 "A sparse matrix expression referencing an existing sparse expression.") | | | --- | | | | | [Map](classeigen_1_1map_3_01sparsematrixtype_01_4#a3afd7ca5fb61494e9195a1e318078028) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3cdd6cab0abd7ac01925a695fc315d34), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0fc44f3781a869a3a410edd6691fd899), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) nnz, const StorageIndex \*[outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a3b74af754254837fc591cd9936688b95), const StorageIndex \*[innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af5cd1f13dde8578eb9891a4ac4a11977), const Scalar \*[valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af91648a18729ae8ff29cb1d8751c5655), const StorageIndex \*innerNonZerosPtr=0) | | | | | [Map](classeigen_1_1map_3_01sparsematrixtype_01_4#aeecd1e0e97eeae254ad97cdf5bde9ec2) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [rows](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3cdd6cab0abd7ac01925a695fc315d34), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [cols](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0fc44f3781a869a3a410edd6691fd899), [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) nnz, StorageIndex \*[outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a3b74af754254837fc591cd9936688b95), StorageIndex \*[innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af5cd1f13dde8578eb9891a4ac4a11977), Scalar \*[valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af91648a18729ae8ff29cb1d8751c5655), StorageIndex \*innerNonZerosPtr=0) | | | | | [~Map](classeigen_1_1map_3_01sparsematrixtype_01_4#aefb5ce85ff8508d6a035b1b72158ca83) () | | | | Public Member Functions inherited from [Eigen::SparseMapBase< Derived, WriteAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4) | | Scalar & | [coeffRef](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#aa9c42d48b9dd6f947ce3c257fe4bf2ca) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | StorageIndex \* | [innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af5cd1f13dde8578eb9891a4ac4a11977) () | | | | StorageIndex \* | [innerNonZeroPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af877ea4e285a4497f80987fea66f7459) () | | | | StorageIndex \* | [outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a3b74af754254837fc591cd9936688b95) () | | | | Scalar \* | [valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#af91648a18729ae8ff29cb1d8751c5655) () | | | | | [~SparseMapBase](classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4#a4dfbcf3ac411885b1710ad04892c984d) () | | | | Public Member Functions inherited from [Eigen::SparseMapBase< Derived, ReadOnlyAccessors >](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4) | | Scalar | [coeff](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a195e66f79171f78cc22d91fff37e36e3) ([Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0fc44f3781a869a3a410edd6691fd899) () const | | | | const StorageIndex \* | [innerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#ab044564756f472877b2c1a5706e540e2) () const | | | | const StorageIndex \* | [innerNonZeroPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a2b35a1d701d6c6ea36b2d9f19660a68c) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a0df6dba8d71e0fb15b2995510853f83e) () const | | | | bool | [isCompressed](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#aafab4afa7ab2ff89eff049d4c71e2ce4) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a753e975b7b3643d821dc061141786870) () const | | | | const StorageIndex \* | [outerIndexPtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a24c55dd8de4aca30e7c90b69aa5dca6b) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3d6ede19db6d42074ae063bc876231b1) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a3cdd6cab0abd7ac01925a695fc315d34) () const | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#a574ea9371c22eabebdda21c0787312dc) () const | | | | | [~SparseMapBase](classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4#ab375aedf824909a7f1a6af24ee60d70f) () | | | | Public Member Functions inherited from [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | [Map](classeigen_1_1map)< [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a7cf299e08d2a4f6d6869e631e51b12fe) () | | | | const [Map](classeigen_1_1map)< const [Array](classeigen_1_1array)< Scalar, [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), 1 > > | [coeffs](classeigen_1_1sparsecompressedbase#a101b155485ae59ea1261c4f6040f3dc4) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#a197111c1289644f1ea38fe683ccdd82a) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerIndexPtr](classeigen_1_1sparsecompressedbase#aa64818e1aa43015dad01b114b2ab4687) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#a411e972b097e6aef225415a4c2d0a0b5) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [innerNonZeroPtr](classeigen_1_1sparsecompressedbase#afc056a3895eae1a4c4767252ff04966a) () const | | | | bool | [isCompressed](classeigen_1_1sparsecompressedbase#a837934b33a80fe996ff20500373d3a61) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1sparsecompressedbase#a03de8b3da2c142ce8698a76123b3e7d3) () const | | | | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a53a82f962686e18c8dc07a4b9a85ed7b) () | | | | const [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) \* | [outerIndexPtr](classeigen_1_1sparsecompressedbase#a2624d4c2661c582de168246c56e8d71e) () const | | | | Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f12f72d14b6c277d09be9f5ce2eab95) () | | | | const Scalar \* | [valuePtr](classeigen_1_1sparsecompressedbase#a0f44c739398794ea77f310b745cc5627) () const | | | | Public Member Functions inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1sparsematrixbase#aca7ce296424ef6e478ab0fb19547a7ee) () const | | | | const internal::eval< Derived >::type | [eval](classeigen_1_1sparsematrixbase#a761bd872a06b59632fcff7b7807a77ce) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1sparsematrixbase#a180fcba1ccf3cdf3252a263bc1de7a1d) () const | | | | bool | [isVector](classeigen_1_1sparsematrixbase#a7eedffa867031f649fd0fb9cc23ce4be) () const | | | | template<typename OtherDerived > | | const [Product](classeigen_1_1product)< Derived, OtherDerived, AliasFreeProduct > | [operator\*](classeigen_1_1sparsematrixbase#a9d4d71b3f34389e6fc01f2b86e43f7a4) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< OtherDerived > &other) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1sparsematrixbase#ac86cc88a4cfef21db6b64ec0ab4c8f0a) () const | | | | const [SparseView](classeigen_1_1sparseview)< Derived > | [pruned](classeigen_1_1sparsematrixbase#ac8d0414b56d9d620ce9a698c1b281e5d) (const Scalar &reference=Scalar(0), const RealScalar &epsilon=[NumTraits](structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1sparsematrixbase#a1944e9fa9ce7937bfc3a87b2cb94371f) () const | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1sparsematrixbase#a124bc57921775eb9aa2dfd9727e23472) () const | | | | SparseSymmetricPermutationProduct< Derived, [Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)|[Lower](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdaf581029282d421eee5aae14238c6f749) > | [twistedBy](classeigen_1_1sparsematrixbase#a51d4898bd6a57cc3ba543a39b102423e) (const [PermutationMatrix](classeigen_1_1permutationmatrix)< [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) > &perm) const | | | | Public Member Functions inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](structeigen_1_1eigenbase#a2d768a9877f5f69f49432d447b552bfe) () const EIGEN\_NOEXCEPT | | | | Derived & | [derived](structeigen_1_1eigenbase#a1fbabe7f12bcbfba3b9a448b1f5e46fa) () | | | | const Derived & | [derived](structeigen_1_1eigenbase#afd4f3f1c57b7594b96a7e30f2974ea2e) () const | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](structeigen_1_1eigenbase#ac22eb0695d00edd7d4a3b2d0a98b81c2) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](structeigen_1_1eigenbase#ae106171b6fefd3f7af108a8283de36c9) () const EIGEN\_NOEXCEPT | | | | | | --- | | | | Public Types inherited from [Eigen::SparseMatrixBase< Derived >](classeigen_1_1sparsematrixbase) | | enum | { [RowsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a456cda7b9d938e57194036a41d634604) , [ColsAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a27ba349f075d026c1f51d1ec69aa5b14) , [SizeAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5aa5022cfa2bb53129883e9b7b8abd3d68) , **MaxRowsAtCompileTime** , **MaxColsAtCompileTime** , **MaxSizeAtCompileTime** , [IsVectorAtCompileTime](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a14a3f566ed2a074beddb8aef0223bfdf) , [NumDimensions](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2366131ffcc38bff48a1c7572eb86dd3) , [Flags](classeigen_1_1sparsematrixbase#aa4d1477f2022b209706daba8722556b5a2af043b36fe9e08df0107cf6de496165) , **IsRowMajor** , **InnerSizeAtCompileTime** } | | | | typedef internal::traits< Derived >::[StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | [StorageIndex](classeigen_1_1sparsematrixbase#a0b540ba724726ebe953f8c0df06081ed) | | | | typedef Scalar | [value\_type](classeigen_1_1sparsematrixbase#ac254d3b61718ebc2136d27bac043dcb7) | | | | Public Types inherited from [Eigen::EigenBase< Derived >](structeigen_1_1eigenbase) | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | The interface type of indices. [More...](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | | | Protected Member Functions inherited from [Eigen::SparseCompressedBase< Derived >](classeigen_1_1sparsecompressedbase) | | | [SparseCompressedBase](classeigen_1_1sparsecompressedbase#af79f020db965367d97eb954fc68d8f99) () | | | Map() [1/2] ----------- template<typename SparseMatrixType > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< SparseMatrixType >::[Map](classeigen_1_1map) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *nnz*, | | | | StorageIndex \* | *outerIndexPtr*, | | | | StorageIndex \* | *innerIndexPtr*, | | | | Scalar \* | *valuePtr*, | | | | StorageIndex \* | *innerNonZerosPtr* = `0` | | | ) | | | | inline | Constructs a read-write [Map](classeigen_1_1map "A matrix or vector expression mapping an existing array of data.") to a sparse matrix of size *rows* x *cols*, containing *nnz* non-zero coefficients, stored as a sparse format as defined by the pointers *outerIndexPtr*, *innerIndexPtr*, and *valuePtr*. If the optional parameter *innerNonZerosPtr* is the null pointer, then a standard compressed format is assumed. This constructor is available only if `SparseMatrixType` is non-const. More details on the expected storage schemes are given in the [manual pages](group__tutorialsparse). Map() [2/2] ----------- template<typename SparseMatrixType > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< SparseMatrixType >::[Map](classeigen_1_1map) | ( | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols*, | | | | [Index](structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *nnz*, | | | | const StorageIndex \* | *outerIndexPtr*, | | | | const StorageIndex \* | *innerIndexPtr*, | | | | const Scalar \* | *valuePtr*, | | | | const StorageIndex \* | *innerNonZerosPtr* = `0` | | | ) | | | | inline | This is the const version of the above constructor. This constructor is available only if `SparseMatrixType` is const, e.g.: ``` Map<const SparseMatrix<double> > ``` ~Map() ------ template<typename SparseMatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::Map](classeigen_1_1map)< SparseMatrixType >::~[Map](classeigen_1_1map) | ( | | ) | | | inline | Empty destructor --- The documentation for this class was generated from the following file:* [SparseMap.h](https://eigen.tuxfamily.org/dox/SparseMap_8h_source.html) eigen3 Eigen::PastixLLT Eigen::PastixLLT ================ ### template<typename \_MatrixType, int \_UpLo> class Eigen::PastixLLT< \_MatrixType, \_UpLo > A sparse direct supernodal Cholesky ([LLT](classeigen_1_1llt "Standard Cholesky decomposition (LL^T) of a matrix and associated features.")) factorization and solver based on the PaStiX library. This class is used to solve the linear systems A.X = B via a LL^T supernodal Cholesky factorization available in the PaStiX library. The matrix A should be symmetric and positive definite WARNING Selfadjoint complex matrices are not supported in the current version of PaStiX The vectors or matrices X and B can be either dense or sparse Template Parameters | | | | --- | --- | | MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> | | UpLo | The part of the matrix to use : Lower or Upper. The default is Lower as required by PaStiX | This class follows the [sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept) . See also [Sparse solver concept](group__topicsparsesystems#TutorialSparseSolverConcept), class [SimplicialLLT](classeigen_1_1simplicialllt "A direct sparse LLT Cholesky factorizations.") Inherits Eigen::PastixBase< Derived >. | | | --- | | | | void | [analyzePattern](classeigen_1_1pastixllt#a671e8444ae2f04db3565e35caa958667) (const MatrixType &matrix) | | | | void | [compute](classeigen_1_1pastixllt#a54fcdef53903851e2d8113a6ed330b5c) (const MatrixType &matrix) | | | | void | [factorize](classeigen_1_1pastixllt#a63dac317804b18a4704a519d7bdfaaff) (const MatrixType &matrix) | | | analyzePattern() ---------------- template<typename \_MatrixType , int \_UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PastixLLT](classeigen_1_1pastixllt)< \_MatrixType, \_UpLo >::analyzePattern | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the LL^T symbolic factorization of `matrix` using its sparsity pattern The result of this operation can be used with successive matrices having the same pattern as `matrix` See also [factorize()](classeigen_1_1pastixllt#a63dac317804b18a4704a519d7bdfaaff) compute() --------- template<typename \_MatrixType , int \_UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PastixLLT](classeigen_1_1pastixllt)< \_MatrixType, \_UpLo >::compute | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the L factor of the LL^T supernodal factorization of `matrix` See also [analyzePattern()](classeigen_1_1pastixllt#a671e8444ae2f04db3565e35caa958667) [factorize()](classeigen_1_1pastixllt#a63dac317804b18a4704a519d7bdfaaff) factorize() ----------- template<typename \_MatrixType , int \_UpLo> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PastixLLT](classeigen_1_1pastixllt)< \_MatrixType, \_UpLo >::factorize | ( | const MatrixType & | *matrix* | ) | | | inline | Compute the LL^T supernodal numerical factorization of `matrix` See also [analyzePattern()](classeigen_1_1pastixllt#a671e8444ae2f04db3565e35caa958667) --- The documentation for this class was generated from the following file:* [PaStiXSupport.h](https://eigen.tuxfamily.org/dox/PaStiXSupport_8h_source.html)
programming_docs
eigen3 Eigen::IterativeSolverBase Eigen::IterativeSolverBase ========================== ### template<typename Derived> class Eigen::IterativeSolverBase< Derived > Base class for linear iterative solvers. See also class [SimplicialCholesky](classeigen_1_1simplicialcholesky), [DiagonalPreconditioner](classeigen_1_1diagonalpreconditioner "A preconditioner based on the digonal entries."), [IdentityPreconditioner](classeigen_1_1identitypreconditioner "A naive preconditioner which approximates any matrix as the identity matrix.") | | | --- | | | | template<typename MatrixDerived > | | Derived & | [analyzePattern](classeigen_1_1iterativesolverbase#a3f684fb41019ca04d97ddc08a0d8be2e) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | template<typename MatrixDerived > | | Derived & | [compute](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | RealScalar | [error](classeigen_1_1iterativesolverbase#a117c241af3fb1141ad0916a3cf3157ec) () const | | | | template<typename MatrixDerived > | | Derived & | [factorize](classeigen_1_1iterativesolverbase#a1374b141721629983cd8276b4b87fc58) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1iterativesolverbase#a0d6b459433a316b4f12d48e5c80d61fe) () const | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [iterations](classeigen_1_1iterativesolverbase#ae778dd098bd5e6655625b20b1e9f15da) () const | | | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a0922f2be45082690d7734aa6732fc493) () | | | | template<typename MatrixDerived > | | | [IterativeSolverBase](classeigen_1_1iterativesolverbase#a3c68fe3cd929ea1ff8a0d4cbcd65ebad) (const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [maxIterations](classeigen_1_1iterativesolverbase#a168a74c8dceb6233b220031fdd756ba0) () const | | | | Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a5e88f2a323a2900205cf807af94f8051) () | | | | const Preconditioner & | [preconditioner](classeigen_1_1iterativesolverbase#a709a056e17c49b5272e4971bc376cbe4) () const | | | | Derived & | [setMaxIterations](classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) ([Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) maxIters) | | | | Derived & | [setTolerance](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) (const RealScalar &[tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62)) | | | | template<typename Rhs , typename Guess > | | const [SolveWithGuess](classeigen_1_1solvewithguess)< Derived, Rhs, Guess > | [solveWithGuess](classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b, const Guess &x0) const | | | | RealScalar | [tolerance](classeigen_1_1iterativesolverbase#acb442c19b5858d6b9be813dd7d36cc62) () const | | | | Public Member Functions inherited from [Eigen::SparseSolverBase< Derived >](classeigen_1_1sparsesolverbase) | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f) (const [MatrixBase](classeigen_1_1matrixbase)< Rhs > &b) const | | | | template<typename Rhs > | | const [Solve](classeigen_1_1solve)< Derived, Rhs > | [solve](classeigen_1_1sparsesolverbase#a3a8d97173b6e2630f484589b3471cfc7) (const [SparseMatrixBase](classeigen_1_1sparsematrixbase)< Rhs > &b) const | | | | | [SparseSolverBase](classeigen_1_1sparsesolverbase#aacd99fa17db475e74d3834767f392f33) () | | | IterativeSolverBase() [1/2] --------------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::[IterativeSolverBase](classeigen_1_1iterativesolverbase) | ( | | ) | | | inline | Default constructor. IterativeSolverBase() [2/2] --------------------------- template<typename Derived > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::[IterativeSolverBase](classeigen_1_1iterativesolverbase) | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. analyzePattern() ---------------- template<typename Derived > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::analyzePattern | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inline | Initializes the iterative solver for the sparsity pattern of the matrix *A* for further solving `Ax=b` problems. Currently, this function mostly calls analyzePattern on the preconditioner. In the future we might, for instance, implement column reordering for faster matrix vector products. compute() --------- template<typename Derived > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inline | Initializes the iterative solver with the matrix *A* for further solving `Ax=b` problems. Currently, this function mostly initializes/computes the preconditioner. In the future we might, for instance, implement column reordering for faster matrix vector products. Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. error() ------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::error | ( | | ) | const | | inline | Returns the tolerance error reached during the last solve. It is a close approximation of the true relative residual error |Ax-b|/|b|. factorize() ----------- template<typename Derived > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::factorize | ( | const [EigenBase](structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inline | Initializes the iterative solver with the numerical values of the matrix *A* for further solving `Ax=b` problems. Currently, this function mostly calls factorize on the preconditioner. Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. info() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::info | ( | | ) | const | | inline | Returns Success if the iterations converged, and NoConvergence otherwise. iterations() ------------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::iterations | ( | | ) | const | | inline | Returns the number of iterations performed during the last solve maxIterations() --------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::maxIterations | ( | | ) | const | | inline | Returns the max number of iterations. It is either the value set by setMaxIterations or, by default, twice the number of columns of the matrix. preconditioner() [1/2] ---------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Preconditioner& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::preconditioner | ( | | ) | | | inline | Returns a read-write reference to the preconditioner for custom configuration. preconditioner() [2/2] ---------------------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const Preconditioner& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::preconditioner | ( | | ) | const | | inline | Returns a read-only reference to the preconditioner. setMaxIterations() ------------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::setMaxIterations | ( | [Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *maxIters* | ) | | | inline | Sets the max number of iterations. Default is twice the number of columns of the matrix. setTolerance() -------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Derived& [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::setTolerance | ( | const RealScalar & | *tolerance* | ) | | | inline | Sets the tolerance threshold used by the stopping criteria. This value is used as an upper bound to the relative residual error: |Ax-b|/|b|. The default value is the machine precision given by NumTraits<Scalar>::epsilon() solveWithGuess() ---------------- template<typename Derived > template<typename Rhs , typename Guess > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [SolveWithGuess](classeigen_1_1solvewithguess)<Derived, Rhs, Guess> [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::solveWithGuess | ( | const [MatrixBase](classeigen_1_1matrixbase)< Rhs > & | *b*, | | | | const Guess & | *x0* | | | ) | | const | | inline | Returns the solution x of \( A x = b \) using the current decomposition of A and *x0* as an initial solution. See also [solve()](classeigen_1_1sparsesolverbase#a4a66e9498b06e3ec4ec36f06b26d4e8f), [compute()](classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) tolerance() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::IterativeSolverBase](classeigen_1_1iterativesolverbase)< Derived >::tolerance | ( | | ) | const | | inline | Returns the tolerance threshold used by the stopping criteria. See also [setTolerance()](classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) --- The documentation for this class was generated from the following file:* [IterativeSolverBase.h](https://eigen.tuxfamily.org/dox/IterativeSolverBase_8h_source.html) eigen3 Eigen::RealQZ Eigen::RealQZ ============= ### template<typename \_MatrixType> class Eigen::RealQZ< \_MatrixType > Performs a real QZ decomposition of a pair of square matrices. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the real QZ decomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | Given a real square matrices A and B, this class computes the real QZ decomposition: \( A = Q S Z \), \( B = Q T Z \) where Q and Z are real orthogonal matrixes, T is upper-triangular matrix, and S is upper quasi-triangular matrix. An orthogonal matrix is a matrix whose inverse is equal to its transpose, \( U^{-1} = U^T \). A quasi-triangular matrix is a block-triangular matrix whose diagonal consists of 1-by-1 blocks and 2-by-2 blocks where further reduction is impossible due to complex eigenvalues. The eigenvalues of the pencil \( A - z B \) can be obtained from 1x1 and 2x2 blocks on the diagonals of S and T. Call the function [compute()](classeigen_1_1realqz#a2b6847964d9f1903193cc3e67c196849 "Computes QZ decomposition of given matrix.") to compute the real QZ decomposition of a given pair of matrices. Alternatively, you can use the [RealQZ(const MatrixType& B, const MatrixType& B, bool computeQZ)](classeigen_1_1realqz#ac6e41c839f8dae31c9a3906ea7540119 "Constructor; computes real QZ decomposition of given matrices.") constructor which computes the real QZ decomposition at construction time. Once the decomposition is computed, you can use the [matrixS()](classeigen_1_1realqz#ad24d7bf534afb55adaef00f00846adaf "Returns matrix S in the QZ decomposition."), [matrixT()](classeigen_1_1realqz#a8dc963d8ea2a17df9d8d718e9e34d06f "Returns matrix S in the QZ decomposition."), [matrixQ()](classeigen_1_1realqz#a212bc2f69ea4eff830fde70e209e40fb "Returns matrix Q in the QZ decomposition.") and [matrixZ()](classeigen_1_1realqz#a19a116383f11423179b4d8f316da6f67 "Returns matrix Z in the QZ decomposition.") functions to retrieve the matrices S, T, Q and Z in the decomposition. If computeQZ==false, some time is saved by not computing matrices Q and Z. Example: ``` MatrixXf A = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); MatrixXf B = [MatrixXf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); RealQZ<MatrixXf> qz(4); // preallocate space for 4x4 matrices qz.compute(A,B); // A = Q S Z, B = Q T Z // print original matrices and result of decomposition cout << "A:\n" << A << "\n" << "B:\n" << B << "\n"; cout << "S:\n" << qz.matrixS() << "\n" << "T:\n" << qz.matrixT() << "\n"; cout << "Q:\n" << qz.matrixQ() << "\n" << "Z:\n" << qz.matrixZ() << "\n"; // verify precision cout << "\nErrors:" << "\n|A-QSZ|: " << (A-qz.matrixQ()*qz.matrixS()*qz.matrixZ()).norm() << ", |B-QTZ|: " << (B-qz.matrixQ()*qz.matrixT()*qz.matrixZ()).norm() << "\n|QQ\* - I|: " << (qz.matrixQ()*qz.matrixQ().adjoint() - [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(4,4)).norm() << ", |ZZ\* - I|: " << (qz.matrixZ()*qz.matrixZ().adjoint() - [MatrixXf::Identity](classeigen_1_1matrixbase#a98bb9a0f705c6dfde85b0bfff31bf88f)(4,4)).norm() << "\n"; ``` Output: ``` A: 0.68 0.823 -0.444 -0.27 -0.211 -0.605 0.108 0.0268 0.566 -0.33 -0.0452 0.904 0.597 0.536 0.258 0.832 B: 0.271 -0.967 -0.687 0.998 0.435 -0.514 -0.198 -0.563 -0.717 -0.726 -0.74 0.0259 0.214 0.608 -0.782 0.678 S: -0.668 1.26 -0.598 0.0941 0.317 -0.27 -0.279 0.64 0 0 -0.398 -0.164 0 0 0 -1.12 T: -1.55 0 0.342 -0.54 0 1.01 -0.457 0.128 0 0 -1.25 0.438 0 0 0 0.746 Q: -0.587 -0.138 0.552 0.576 0.19 -0.208 0.761 -0.585 -0.292 0.918 0.152 -0.223 -0.731 -0.31 -0.306 -0.526 Z: -0.0204 0.213 -0.78 0.588 -0.961 -0.184 -0.14 -0.153 -0.269 0.783 0.462 0.32 -0.0674 -0.555 0.398 0.727 Errors: |A-QSZ|: 1.36e-06, |B-QTZ|: 1.83e-06 |QQ* - I|: 8.18e-07, |ZZ* - I|: 7.36e-07 ``` Note The implementation is based on the algorithm in "Matrix Computations" by Gene H. Golub and Charles F. Van Loan, and a paper "An algorithm for generalized eigenvalue problems" by C.B.Moler and G.W.Stewart. See also class [RealSchur](classeigen_1_1realschur "Performs a real Schur decomposition of a square matrix."), class [ComplexSchur](classeigen_1_1complexschur "Performs a complex Schur decomposition of a real or complex square matrix."), class [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") | | | --- | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) | | | | | | --- | | | | [RealQZ](classeigen_1_1realqz) & | [compute](classeigen_1_1realqz#a2b6847964d9f1903193cc3e67c196849) (const MatrixType &A, const MatrixType &B, bool computeQZ=true) | | | Computes QZ decomposition of given matrix. [More...](classeigen_1_1realqz#a2b6847964d9f1903193cc3e67c196849) | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1realqz#a36bd77afed89f3f5c110a715e69e4c64) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1realqz#a36bd77afed89f3f5c110a715e69e4c64) | | | | [Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) | [iterations](classeigen_1_1realqz#afbecc6d0ab1de42be9db79428da48ab6) () const | | | Returns number of performed QR-like iterations. | | | | const MatrixType & | [matrixQ](classeigen_1_1realqz#a212bc2f69ea4eff830fde70e209e40fb) () const | | | Returns matrix Q in the QZ decomposition. [More...](classeigen_1_1realqz#a212bc2f69ea4eff830fde70e209e40fb) | | | | const MatrixType & | [matrixS](classeigen_1_1realqz#ad24d7bf534afb55adaef00f00846adaf) () const | | | Returns matrix S in the QZ decomposition. [More...](classeigen_1_1realqz#ad24d7bf534afb55adaef00f00846adaf) | | | | const MatrixType & | [matrixT](classeigen_1_1realqz#a8dc963d8ea2a17df9d8d718e9e34d06f) () const | | | Returns matrix S in the QZ decomposition. [More...](classeigen_1_1realqz#a8dc963d8ea2a17df9d8d718e9e34d06f) | | | | const MatrixType & | [matrixZ](classeigen_1_1realqz#a19a116383f11423179b4d8f316da6f67) () const | | | Returns matrix Z in the QZ decomposition. [More...](classeigen_1_1realqz#a19a116383f11423179b4d8f316da6f67) | | | | | [RealQZ](classeigen_1_1realqz#ac6e41c839f8dae31c9a3906ea7540119) (const MatrixType &A, const MatrixType &B, bool computeQZ=true) | | | Constructor; computes real QZ decomposition of given matrices. [More...](classeigen_1_1realqz#ac6e41c839f8dae31c9a3906ea7540119) | | | | | [RealQZ](classeigen_1_1realqz#ad8fb9235870a8361a2fdd8dcc2e80d01) ([Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) size=RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 1 :RowsAtCompileTime) | | | Default constructor. [More...](classeigen_1_1realqz#ad8fb9235870a8361a2fdd8dcc2e80d01) | | | | [RealQZ](classeigen_1_1realqz) & | [setMaxIterations](classeigen_1_1realqz#a30ae65666b1757e4a2b6a28eaec12226) ([Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) maxIters) | | | Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::[Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) | **[Deprecated:](deprecated#_deprecated000017)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 RealQZ() [1/2] -------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::[RealQZ](classeigen_1_1realqz) | ( | [Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) | *size* = `RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 1 : RowsAtCompileTime` | ) | | | inlineexplicit | Default constructor. Parameters | | | | | --- | --- | --- | | [in] | size | Positive integer, size of the matrix whose QZ decomposition will be computed. | The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1realqz#a2b6847964d9f1903193cc3e67c196849 "Computes QZ decomposition of given matrix."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1realqz#a2b6847964d9f1903193cc3e67c196849 "Computes QZ decomposition of given matrix.") for an example. RealQZ() [2/2] -------------- template<typename \_MatrixType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::[RealQZ](classeigen_1_1realqz) | ( | const MatrixType & | *A*, | | | | const MatrixType & | *B*, | | | | bool | *computeQZ* = `true` | | | ) | | | | inline | Constructor; computes real QZ decomposition of given matrices. Parameters | | | | | --- | --- | --- | | [in] | A | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") A. | | [in] | B | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") B. | | [in] | computeQZ | If false, A and Z are not computed. | This constructor calls [compute()](classeigen_1_1realqz#a2b6847964d9f1903193cc3e67c196849 "Computes QZ decomposition of given matrix.") to compute the QZ decomposition. compute() --------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [RealQZ](classeigen_1_1realqz)< MatrixType > & [Eigen::RealQZ](classeigen_1_1realqz)< MatrixType >::compute | ( | const MatrixType & | *A*, | | | | const MatrixType & | *B*, | | | | bool | *computeQZ* = `true` | | | ) | | | Computes QZ decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | A | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") A. | | [in] | B | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") B. | | [in] | computeQZ | If false, A and Z are not computed. | Returns Reference to `*this` info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NoConvergence` otherwise. matrixQ() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::matrixQ | ( | | ) | const | | inline | Returns matrix Q in the QZ decomposition. Returns A const reference to the matrix Q. matrixS() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::matrixS | ( | | ) | const | | inline | Returns matrix S in the QZ decomposition. Returns A const reference to the matrix S. matrixT() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::matrixT | ( | | ) | const | | inline | Returns matrix S in the QZ decomposition. Returns A const reference to the matrix S. matrixZ() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const MatrixType& [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::matrixZ | ( | | ) | const | | inline | Returns matrix Z in the QZ decomposition. Returns A const reference to the matrix Z. setMaxIterations() ------------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [RealQZ](classeigen_1_1realqz)& [Eigen::RealQZ](classeigen_1_1realqz)< \_MatrixType >::setMaxIterations | ( | [Index](classeigen_1_1realqz#a6201e534e901b5f4e66f72c176b534a3) | *maxIters* | ) | | | inline | Sets the maximal number of iterations allowed to converge to one eigenvalue or decouple the problem. --- The documentation for this class was generated from the following file:* [RealQZ.h](https://eigen.tuxfamily.org/dox/RealQZ_8h_source.html)
programming_docs
eigen3 Eigen::UniformScaling Eigen::UniformScaling ===================== ### template<typename \_Scalar> class Eigen::UniformScaling< \_Scalar > Represents a generic uniform scaling transformation. This is defined in the Geometry module. ``` #include <Eigen/Geometry> ``` Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the coefficients. | This class represent a uniform scaling transformation. It is the return type of Scaling(Scalar), and most of the time this is the only way it is used. In particular, this class is not aimed to be used to store a scaling transformation, but rather to make easier the constructions and updates of [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") objects. To represent an axis aligned scaling, use the [DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage.") class. See also [Scaling()](namespaceeigen#a02918175ff75e5df9fd291cf5fc3fd1b), class [DiagonalMatrix](classeigen_1_1diagonalmatrix "Represents a diagonal matrix with its storage."), [MatrixBase::asDiagonal()](classeigen_1_1matrixbase#a14235b62c90f93fe910070b4743782d0), class [Translation](classeigen_1_1translation "Represents a translation transformation."), class [Transform](classeigen_1_1transform "Represents an homogeneous transformation in a N dimensional space.") | | | --- | | | | typedef \_Scalar | [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) | | | | | | --- | | | | template<typename NewScalarType > | | [UniformScaling](classeigen_1_1uniformscaling)< NewScalarType > | [cast](classeigen_1_1uniformscaling#af93a9ee1d6efc102b65a197f3ea3d4cd) () const | | | | [UniformScaling](classeigen_1_1uniformscaling) | [inverse](classeigen_1_1uniformscaling#a60dba22bebe9e2c97cfbc76f85eb1b78) () const | | | | bool | [isApprox](classeigen_1_1uniformscaling#a7f736fdbe43f7bce3d277312efdc315e) (const [UniformScaling](classeigen_1_1uniformscaling) &other, const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) >::Real &prec=[NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) >::dummy\_precision()) const | | | | template<typename Derived > | | Eigen::internal::plain\_matrix\_type< Derived >::type | [operator\*](classeigen_1_1uniformscaling#a8abd57298d10bd620bdfc459d22e8add) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &other) const | | | | template<int Dim, int Mode, int Options> | | internal::uniformscaling\_times\_affine\_returntype< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim, Mode >::type | [operator\*](classeigen_1_1uniformscaling#ad8c9401526e9ade727036b6d255fbdc0) (const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim, Mode, Options > &t) const | | | | template<int Dim> | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim, [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) > | [operator\*](classeigen_1_1uniformscaling#a19c405341f2c861eb0ddfc4f760fecf8) (const [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim > &t) const | | | | [UniformScaling](classeigen_1_1uniformscaling) | [operator\*](classeigen_1_1uniformscaling#af3044cffe5703a1946c33a953b0f9bb6) (const [UniformScaling](classeigen_1_1uniformscaling) &other) const | | | | | [UniformScaling](classeigen_1_1uniformscaling#ab17e233af501c69ff47c0dd16f43cc39) () | | | | | [UniformScaling](classeigen_1_1uniformscaling#a3a3e2fa318eb29c2c4f87e23a8a75144) (const [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) &s) | | | | template<typename OtherScalarType > | | | [UniformScaling](classeigen_1_1uniformscaling#a898cc0c97625ce671d7ea951f6eb2fc4) (const [UniformScaling](classeigen_1_1uniformscaling)< OtherScalarType > &other) | | | | | | --- | | | | (Note that these are not member functions.) | | template<typename Derived , typename Scalar > | | | [operator\*](classeigen_1_1uniformscaling#a8f79e131479dbe709ee1173b1be9a8f0) (const [MatrixBase](classeigen_1_1matrixbase)< Derived > &matrix, const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) > &s) | | | Scalar ------ template<typename \_Scalar > | | | --- | | typedef \_Scalar [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::[Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) | the scalar type of the coefficients UniformScaling() [1/3] ---------------------- template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::[UniformScaling](classeigen_1_1uniformscaling) | ( | | ) | | | inline | Default constructor without initialization. UniformScaling() [2/3] ---------------------- template<typename \_Scalar > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::[UniformScaling](classeigen_1_1uniformscaling) | ( | const [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) & | *s* | ) | | | inlineexplicit | Constructs and initialize a uniform scaling transformation UniformScaling() [3/3] ---------------------- template<typename \_Scalar > template<typename OtherScalarType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::[UniformScaling](classeigen_1_1uniformscaling) | ( | const [UniformScaling](classeigen_1_1uniformscaling)< OtherScalarType > & | *other* | ) | | | inlineexplicit | Copy constructor with scalar type conversion cast() ------ template<typename \_Scalar > template<typename NewScalarType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [UniformScaling](classeigen_1_1uniformscaling)<NewScalarType> [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::cast | ( | | ) | const | | inline | Returns `*this` with scalar type casted to *NewScalarType* Note that if *NewScalarType* is equal to the current scalar type of `*this` then this function smartly returns a const reference to `*this`. inverse() --------- template<typename \_Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [UniformScaling](classeigen_1_1uniformscaling) [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::inverse | ( | | ) | const | | inline | Returns the inverse scaling isApprox() ---------- template<typename \_Scalar > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::isApprox | ( | const [UniformScaling](classeigen_1_1uniformscaling)< \_Scalar > & | *other*, | | | | const typename [NumTraits](structeigen_1_1numtraits)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) >::Real & | *prec* = `[NumTraits](structeigen_1_1numtraits)<[Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283)>::dummy_precision()` | | | ) | | const | | inline | Returns `true` if `*this` is approximately equal to *other*, within the precision determined by *prec*. See also [MatrixBase::isApprox()](classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) operator\*() [1/4] ------------------ template<typename \_Scalar > template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Eigen::internal::plain\_matrix\_type<Derived>::type [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *other* | ) | const | | inline | Concatenates a uniform scaling and a linear transformation matrix operator\*() [2/4] ------------------ template<typename \_Scalar > template<int Dim, int Mode, int Options> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | internal::uniformscaling\_times\_affine\_returntype<[Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283),Dim,Mode>::type [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::operator\* | ( | const [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim, Mode, Options > & | *t* | ) | const | | inline | Concatenates a uniform scaling and an affine transformation operator\*() [3/4] ------------------ template<typename Scalar > template<int Dim> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Transform](classeigen_1_1transform)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim, [Affine](group__enums#ggaee59a86102f150923b0cac6d4ff05107a0872f0a82453aaae40339c33acbb31fb) > [Eigen::UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) >::operator\* | ( | const [Translation](classeigen_1_1translation)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283), Dim > & | *t* | ) | const | | inline | Concatenates a uniform scaling and a translation operator\*() [4/4] ------------------ template<typename \_Scalar > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [UniformScaling](classeigen_1_1uniformscaling) [Eigen::UniformScaling](classeigen_1_1uniformscaling)< \_Scalar >::operator\* | ( | const [UniformScaling](classeigen_1_1uniformscaling)< \_Scalar > & | *other* | ) | const | | inline | Concatenates two uniform scaling operator\*() ------------ template<typename Derived , typename Scalar > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | operator\* | ( | const [MatrixBase](classeigen_1_1matrixbase)< Derived > & | *matrix*, | | | | const [UniformScaling](classeigen_1_1uniformscaling)< [Scalar](classeigen_1_1uniformscaling#a04c4339f58f1210c5d4d34b1bd7ae283) > & | *s* | | | ) | | | | related | Concatenates a linear transformation matrix and a uniform scaling --- The documentation for this class was generated from the following file:* [Scaling.h](https://eigen.tuxfamily.org/dox/Scaling_8h_source.html) eigen3 Eigen::ComplexSchur Eigen::ComplexSchur =================== ### template<typename \_MatrixType> class Eigen::ComplexSchur< \_MatrixType > Performs a complex Schur decomposition of a real or complex square matrix. This is defined in the Eigenvalues module. ``` #include <Eigen/Eigenvalues> ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix of which we are computing the Schur decomposition; this is expected to be an instantiation of the [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") class template. | Given a real or complex square matrix A, this class computes the Schur decomposition: \( A = U T U^\*\) where U is a unitary complex matrix, and T is a complex upper triangular matrix. The diagonal of the matrix T corresponds to the eigenvalues of the matrix A. Call the function [compute()](classeigen_1_1complexschur#a3543d2c286563108cd9ace672bbb1c09 "Computes Schur decomposition of given matrix.") to compute the Schur decomposition of a given matrix. Alternatively, you can use the ComplexSchur(const MatrixType&, bool) constructor which computes the Schur decomposition at construction time. Once the decomposition is computed, you can use the [matrixU()](classeigen_1_1complexschur#afed8177cf9836f032d42bdb6c6bc6e01 "Returns the unitary matrix in the Schur decomposition.") and [matrixT()](classeigen_1_1complexschur#add3ab5ed83f7f2f06b79fa910a2d5684 "Returns the triangular matrix in the Schur decomposition.") functions to retrieve the matrices U and V in the decomposition. Note This code is inspired from Jampack See also class [RealSchur](classeigen_1_1realschur "Performs a real Schur decomposition of a square matrix."), class [EigenSolver](classeigen_1_1eigensolver "Computes eigenvalues and eigenvectors of general matrices."), class [ComplexEigenSolver](classeigen_1_1complexeigensolver "Computes eigenvalues and eigenvectors of general complex matrices.") | | | --- | | | | typedef [Matrix](classeigen_1_1matrix)< [ComplexScalar](classeigen_1_1complexschur#ae1a4713b53f821867fbad617e426832a), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > | [ComplexMatrixType](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0) | | | Type for the matrices in the Schur decomposition. [More...](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0) | | | | typedef std::complex< RealScalar > | [ComplexScalar](classeigen_1_1complexschur#ae1a4713b53f821867fbad617e426832a) | | | Complex scalar type for `_MatrixType`. [More...](classeigen_1_1complexschur#ae1a4713b53f821867fbad617e426832a) | | | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) | | | | typedef MatrixType::Scalar | [Scalar](classeigen_1_1complexschur#a9a8ee9df37ee1f90d0e53103c58683c0) | | | Scalar type for matrices of type `_MatrixType`. | | | | | | --- | | | | template<typename InputType > | | | [ComplexSchur](classeigen_1_1complexschur#a9c92c6e4c33890d2d063c5c8dd22777d) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeU=true) | | | Constructor; computes Schur decomposition of given matrix. [More...](classeigen_1_1complexschur#a9c92c6e4c33890d2d063c5c8dd22777d) | | | | | [ComplexSchur](classeigen_1_1complexschur#ad707d9978dc36b3b15e460c2a83f4093) ([Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) size=RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 1 :RowsAtCompileTime) | | | Default constructor. [More...](classeigen_1_1complexschur#ad707d9978dc36b3b15e460c2a83f4093) | | | | template<typename InputType > | | [ComplexSchur](classeigen_1_1complexschur) & | [compute](classeigen_1_1complexschur#a3543d2c286563108cd9ace672bbb1c09) (const [EigenBase](structeigen_1_1eigenbase)< InputType > &matrix, bool computeU=true) | | | Computes Schur decomposition of given matrix. [More...](classeigen_1_1complexschur#a3543d2c286563108cd9ace672bbb1c09) | | | | template<typename HessMatrixType , typename OrthMatrixType > | | [ComplexSchur](classeigen_1_1complexschur) & | [computeFromHessenberg](classeigen_1_1complexschur#a05dfbf329047aba756a844f8fe2de314) (const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU=true) | | | Compute Schur decomposition from a given Hessenberg matrix. [More...](classeigen_1_1complexschur#a05dfbf329047aba756a844f8fe2de314) | | | | [Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) | [getMaxIterations](classeigen_1_1complexschur#a2fc0b7bc409a49e7cdb7b6edcfff26eb) () | | | Returns the maximum number of iterations. | | | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1complexschur#a8c5ee15fecfd126fc362c3f2fd28f51e) () const | | | Reports whether previous computation was successful. [More...](classeigen_1_1complexschur#a8c5ee15fecfd126fc362c3f2fd28f51e) | | | | const [ComplexMatrixType](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0) & | [matrixT](classeigen_1_1complexschur#add3ab5ed83f7f2f06b79fa910a2d5684) () const | | | Returns the triangular matrix in the Schur decomposition. [More...](classeigen_1_1complexschur#add3ab5ed83f7f2f06b79fa910a2d5684) | | | | const [ComplexMatrixType](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0) & | [matrixU](classeigen_1_1complexschur#afed8177cf9836f032d42bdb6c6bc6e01) () const | | | Returns the unitary matrix in the Schur decomposition. [More...](classeigen_1_1complexschur#afed8177cf9836f032d42bdb6c6bc6e01) | | | | [ComplexSchur](classeigen_1_1complexschur) & | [setMaxIterations](classeigen_1_1complexschur#a6ca227fbd5387f3a625351354b8eec44) ([Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) maxIters) | | | Sets the maximum number of iterations allowed. [More...](classeigen_1_1complexschur#a6ca227fbd5387f3a625351354b8eec44) | | | | | | --- | | | | static const int | [m\_maxIterationsPerRow](classeigen_1_1complexschur#ad37ef6058ce690a1fac4cc524b70cbf0) | | | Maximum number of iterations per row. [More...](classeigen_1_1complexschur#ad37ef6058ce690a1fac4cc524b70cbf0) | | | ComplexMatrixType ----------------- template<typename \_MatrixType > | | | --- | | typedef [Matrix](classeigen_1_1matrix)<[ComplexScalar](classeigen_1_1complexschur#ae1a4713b53f821867fbad617e426832a), RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::[ComplexMatrixType](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0) | Type for the matrices in the Schur decomposition. This is a square matrix with entries of type [ComplexScalar](classeigen_1_1complexschur#ae1a4713b53f821867fbad617e426832a "Complex scalar type for _MatrixType."). The size is the same as the size of `_MatrixType`. ComplexScalar ------------- template<typename \_MatrixType > | | | --- | | typedef std::complex<RealScalar> [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::[ComplexScalar](classeigen_1_1complexschur#ae1a4713b53f821867fbad617e426832a) | Complex scalar type for `_MatrixType`. This is `std::complex<Scalar>` if [Scalar](classeigen_1_1complexschur#a9a8ee9df37ee1f90d0e53103c58683c0 "Scalar type for matrices of type _MatrixType.") is real (e.g., `float` or `double`) and just `Scalar` if [Scalar](classeigen_1_1complexschur#a9a8ee9df37ee1f90d0e53103c58683c0 "Scalar type for matrices of type _MatrixType.") is complex. Index ----- template<typename \_MatrixType > | | | --- | | typedef [Eigen::Index](namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::[Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) | **[Deprecated:](deprecated#_deprecated000013)** since [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") 3.3 ComplexSchur() [1/2] -------------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::[ComplexSchur](classeigen_1_1complexschur) | ( | [Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) | *size* = `RowsAtCompileTime==[Dynamic](namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) ? 1 : RowsAtCompileTime` | ) | | | inlineexplicit | Default constructor. Parameters | | | | | --- | --- | --- | | [in] | size | Positive integer, size of the matrix whose Schur decomposition will be computed. | The default constructor is useful in cases in which the user intends to perform decompositions via [compute()](classeigen_1_1complexschur#a3543d2c286563108cd9ace672bbb1c09 "Computes Schur decomposition of given matrix."). The `size` parameter is only used as a hint. It is not an error to give a wrong `size`, but it may impair performance. See also [compute()](classeigen_1_1complexschur#a3543d2c286563108cd9ace672bbb1c09 "Computes Schur decomposition of given matrix.") for an example. ComplexSchur() [2/2] -------------------- template<typename \_MatrixType > template<typename InputType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::[ComplexSchur](classeigen_1_1complexschur) | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeU* = `true` | | | ) | | | | inlineexplicit | Constructor; computes Schur decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose Schur decomposition is to be computed. | | [in] | computeU | If true, both T and U are computed; if false, only T is computed. | This constructor calls [compute()](classeigen_1_1complexschur#a3543d2c286563108cd9ace672bbb1c09 "Computes Schur decomposition of given matrix.") to compute the Schur decomposition. See also [matrixT()](classeigen_1_1complexschur#add3ab5ed83f7f2f06b79fa910a2d5684 "Returns the triangular matrix in the Schur decomposition.") and [matrixU()](classeigen_1_1complexschur#afed8177cf9836f032d42bdb6c6bc6e01 "Returns the unitary matrix in the Schur decomposition.") for examples. compute() --------- template<typename \_MatrixType > template<typename InputType > | | | | | | --- | --- | --- | --- | | [ComplexSchur](classeigen_1_1complexschur)& [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::compute | ( | const [EigenBase](structeigen_1_1eigenbase)< InputType > & | *matrix*, | | | | bool | *computeU* = `true` | | | ) | | | Computes Schur decomposition of given matrix. Parameters | | | | | --- | --- | --- | | [in] | matrix | Square matrix whose Schur decomposition is to be computed. | | [in] | computeU | If true, both T and U are computed; if false, only T is computed. | Returns Reference to `*this` The Schur decomposition is computed by first reducing the matrix to Hessenberg form using the class [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation."). The Hessenberg matrix is then reduced to triangular form by performing QR iterations with a single shift. The cost of computing the Schur decomposition depends on the number of iterations; as a rough guide, it may be taken on the number of iterations; as a rough guide, it may be taken to be \(25n^3\) complex flops, or \(10n^3\) complex flops if *computeU* is false. Example: ``` MatrixXcf A = [MatrixXcf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); ComplexSchur<MatrixXcf> schur(4); schur.compute(A); cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl; schur.compute(A.inverse()); cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl; ``` Output: ``` The matrix T in the decomposition of A is: (-0.691,-1.63) (0.763,-0.144) (-0.104,-0.836) (-0.462,-0.378) (0,0) (-0.758,1.22) (-0.65,-0.772) (-0.244,0.113) (0,0) (0,0) (0.137,0.505) (0.0687,-0.404) (0,0) (0,0) (0,0) (1.52,-0.402) The matrix T in the decomposition of A^(-1) is: (0.501,-1.84) (-1.01,-0.984) (0.636,1.3) (-0.676,0.352) (0,0) (-0.369,-0.593) (0.0733,0.18) (-0.0658,-0.0263) (0,0) (0,0) (-0.222,0.521) (-0.191,0.121) (0,0) (0,0) (0,0) (0.614,0.162) ``` See also compute(const MatrixType&, bool, Index) computeFromHessenberg() ----------------------- template<typename \_MatrixType > template<typename HessMatrixType , typename OrthMatrixType > | | | | | | --- | --- | --- | --- | | [ComplexSchur](classeigen_1_1complexschur)& [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::computeFromHessenberg | ( | const HessMatrixType & | *matrixH*, | | | | const OrthMatrixType & | *matrixQ*, | | | | bool | *computeU* = `true` | | | ) | | | Compute Schur decomposition from a given Hessenberg matrix. Parameters | | | | | --- | --- | --- | | [in] | matrixH | [Matrix](classeigen_1_1matrix "The matrix class, also used for vectors and row-vectors.") in Hessenberg form H | | [in] | matrixQ | orthogonal matrix Q that transform a matrix A to H : A = Q H Q^T | | | computeU | Computes the matriX U of the Schur vectors | Returns Reference to `*this` This routine assumes that the matrix is already reduced in Hessenberg form matrixH using either the class [HessenbergDecomposition](classeigen_1_1hessenbergdecomposition "Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.") or another mean. It computes the upper quasi-triangular matrix T of the Schur decomposition of H When computeU is true, this routine computes the matrix U such that A = U T U^T = (QZ) T (QZ)^T = Q H Q^T where A is the initial matrix NOTE Q is referenced if computeU is true; so, if the initial orthogonal matrix is not available, the user should give an identity matrix (Q.setIdentity()) See also compute(const MatrixType&, bool) info() ------ template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::info | ( | | ) | const | | inline | Reports whether previous computation was successful. Returns `Success` if computation was successful, `NoConvergence` otherwise. matrixT() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [ComplexMatrixType](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0)& [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::matrixT | ( | | ) | const | | inline | Returns the triangular matrix in the Schur decomposition. Returns A const reference to the matrix T. It is assumed that either the constructor ComplexSchur(const MatrixType& matrix, bool computeU) or the member function compute(const MatrixType& matrix, bool computeU) has been called before to compute the Schur decomposition of a matrix. Note that this function returns a plain square matrix. If you want to reference only the upper triangular part, use: ``` schur.matrixT().triangularView<[Upper](group__enums#gga39e3366ff5554d731e7dc8bb642f83cdafca2ccebb604f171656deb53e8c083c1)>() ``` Example: ``` MatrixXcf A = [MatrixXcf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; ComplexSchur<MatrixXcf> schurOfA(A, false); // false means do not compute U cout << "The triangular matrix T is:" << endl << schurOfA.matrixT() << endl; ``` Output: ``` Here is a random 4x4 matrix, A: (-0.211,0.68) (0.108,-0.444) (0.435,0.271) (-0.198,-0.687) (0.597,0.566) (0.258,-0.0452) (0.214,-0.717) (-0.782,-0.74) (-0.605,0.823) (0.0268,-0.27) (-0.514,-0.967) (-0.563,0.998) (0.536,-0.33) (0.832,0.904) (0.608,-0.726) (0.678,0.0259) The triangular matrix T is: (-0.691,-1.63) (0.763,-0.144) (-0.104,-0.836) (-0.462,-0.378) (0,0) (-0.758,1.22) (-0.65,-0.772) (-0.244,0.113) (0,0) (0,0) (0.137,0.505) (0.0687,-0.404) (0,0) (0,0) (0,0) (1.52,-0.402) ``` matrixU() --------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [ComplexMatrixType](classeigen_1_1complexschur#af61fe57877d51cfb50178f78534042f0)& [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::matrixU | ( | | ) | const | | inline | Returns the unitary matrix in the Schur decomposition. Returns A const reference to the matrix U. It is assumed that either the constructor ComplexSchur(const MatrixType& matrix, bool computeU) or the member function compute(const MatrixType& matrix, bool computeU) has been called before to compute the Schur decomposition of a matrix, and that `computeU` was set to true (the default value). Example: ``` MatrixXcf A = [MatrixXcf::Random](classeigen_1_1densebase#ae814abb451b48ed872819192dc188c19)(4,4); cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl; ComplexSchur<MatrixXcf> schurOfA(A); cout << "The unitary matrix U is:" << endl << schurOfA.matrixU() << endl; ``` Output: ``` Here is a random 4x4 matrix, A: (-0.211,0.68) (0.108,-0.444) (0.435,0.271) (-0.198,-0.687) (0.597,0.566) (0.258,-0.0452) (0.214,-0.717) (-0.782,-0.74) (-0.605,0.823) (0.0268,-0.27) (-0.514,-0.967) (-0.563,0.998) (0.536,-0.33) (0.832,0.904) (0.608,-0.726) (0.678,0.0259) The unitary matrix U is: (-0.122,0.271) (0.354,0.255) (-0.7,0.321) (0.0909,-0.346) (0.247,0.23) (0.435,-0.395) (0.184,-0.38) (0.492,-0.347) (0.859,-0.0877) (0.00469,0.21) (-0.256,0.0163) (0.133,0.355) (-0.116,0.195) (-0.484,-0.432) (-0.183,0.359) (0.559,0.231) ``` setMaxIterations() ------------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [ComplexSchur](classeigen_1_1complexschur)& [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::setMaxIterations | ( | [Index](classeigen_1_1complexschur#a652104d13723a5b1db2937866a034557) | *maxIters* | ) | | | inline | Sets the maximum number of iterations allowed. If not specified by the user, the maximum number of iterations is m\_maxIterationsPerRow times the size of the matrix. m\_maxIterationsPerRow ---------------------- template<typename \_MatrixType > | | | | | --- | --- | --- | | | | | --- | | const int [Eigen::ComplexSchur](classeigen_1_1complexschur)< \_MatrixType >::m\_maxIterationsPerRow | | static | Maximum number of iterations per row. If not otherwise specified, the maximum number of iterations is this number times the size of the matrix. It is currently set to 30. --- The documentation for this class was generated from the following file:* [ComplexSchur.h](https://eigen.tuxfamily.org/dox/ComplexSchur_8h_source.html)
programming_docs
eigen3 Eigen::BlockSparseMatrix Eigen::BlockSparseMatrix ======================== ### template<typename \_Scalar, int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex> class Eigen::BlockSparseMatrix< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex > A versatile sparse matrix representation where each element is a block. This class provides routines to manipulate block sparse matrices stored in a BSR-like representation. There are two main types : 1. All blocks have the same number of rows and columns, called block size in the following. In this case, if this block size is known at compile time, it can be given as a template parameter like ``` BlockSparseMatrix<Scalar, 3, ColMajor> bmat(b_rows, b_cols); ``` Here, bmat is a b\_rows x b\_cols block sparse matrix where each coefficient is a 3x3 dense matrix. If the block size is fixed but will be given at runtime, ``` BlockSparseMatrix<Scalar, Dynamic, ColMajor> bmat(b_rows, b_cols); bmat.setBlockSize(block_size); ``` 2. The second case is for variable-block sparse matrices. Here each block has its own dimensions. The only restriction is that all the blocks in a row (resp. a column) should have the same number of rows (resp. of columns). It is thus required in this case to describe the layout of the matrix by calling setBlockLayout(rowBlocks, colBlocks). In any of the previous case, the matrix can be filled by calling [setFromTriplets()](classeigen_1_1blocksparsematrix#aa148b63f89555f4eed312638abe597eb "Fill values in a matrix from a triplet list."). A regular sparse matrix can be converted to a block sparse matrix and vice versa. It is obviously required to describe the block layout beforehand by calling either [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") for fixed-size blocks or setBlockLayout for variable-size blocks. Template Parameters | | | | --- | --- | | \_Scalar | The Scalar type | | \_BlockAtCompileTime | The block layout option. It takes the following values Dynamic : block size known at runtime a numeric number : fixed-size block known at compile time | | | | --- | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [blockCols](classeigen_1_1blocksparsematrix#a645eb7f708ca89383e0f3fabb30d9e92) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [blockColsIndex](classeigen_1_1blocksparsematrix#a6310ee4a4aa6f3689eaed0395d0db35e) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) bj) const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [blockPtr](classeigen_1_1blocksparsematrix#a16b8ee2d4e92d774bf286e6575fd8369) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) id) const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [blockRows](classeigen_1_1blocksparsematrix#a5f4768ab4e48f7f81cd8a3697d3016e8) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [blockRowsIndex](classeigen_1_1blocksparsematrix#ad43927292bc7b1e53cc98d4559838c96) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) bi) const | | | | | [BlockSparseMatrix](classeigen_1_1blocksparsematrix#a5d0b6ea10540a0968410daf3b1ff99e8) (const [BlockSparseMatrix](classeigen_1_1blocksparsematrix) &other) | | | Copy-constructor. | | | | template<typename MatrixType > | | | [BlockSparseMatrix](classeigen_1_1blocksparsematrix#a1d5e6091b3a85a872f10a02265c3c8c6) (const MatrixType &spmat) | | | Constructor from a sparse matrix. | | | | | [BlockSparseMatrix](classeigen_1_1blocksparsematrix#a319d4ed434693fc09cdb7d71e090bbd8) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) brow, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) bcol) | | | Construct and resize. | | | | [Map](../classeigen_1_1map)< const [BlockScalar](../classeigen_1_1matrix) > | [coeff](classeigen_1_1blocksparsematrix#aa6f4ffb07a0ef2863e7a933676a46abf) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) brow, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) bcol) const | | | | [Ref](../classeigen_1_1ref)< [BlockScalar](../classeigen_1_1matrix) > | [coeffRef](classeigen_1_1blocksparsematrix#af7d43390424f705f281c41a2c07db92f) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) brow, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) bcol) | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1blocksparsematrix#aa689bd28af9a8176d1c793c075aa0a42) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerToBlock](classeigen_1_1blocksparsematrix#a53fd11658531b86986cd2a5fb2ea3d3d) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) inner) const | | | | bool | [isCompressed](classeigen_1_1blocksparsematrix#a3acfdd3edc02e4347402a8d343131b9e) () const | | | for compatibility purposes with the [SparseMatrix](../classeigen_1_1sparsematrix) class | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1blocksparsematrix#a2c0d76392df6669fa66b592ef6b5618a) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZerosBlocks](classeigen_1_1blocksparsematrix#a83d5af142c851196a2178bf9ec532d8c) () const | | | | template<typename MatrixType > | | [BlockSparseMatrix](classeigen_1_1blocksparsematrix) & | [operator=](classeigen_1_1blocksparsematrix#a5c5479fd38867538383e092a1d90db5a) (const MatrixType &spmat) | | | Assignment from a sparse matrix with the same storage order. [More...](classeigen_1_1blocksparsematrix#a5c5479fd38867538383e092a1d90db5a) | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerToBlock](classeigen_1_1blocksparsematrix#a9f83554f7b1309ac7ad88d19ef8d6339) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) outer) const | | | | void | [reserve](classeigen_1_1blocksparsematrix#a2e1814d2fb4d66320ce3ec97303d0648) (const [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) nonzerosblocks) | | | Allocate the internal array of pointers to blocks and their inner indices. [More...](classeigen_1_1blocksparsematrix#a2e1814d2fb4d66320ce3ec97303d0648) | | | | void | [resize](classeigen_1_1blocksparsematrix#ae0b2c5f1f4aa7a2a54dea00bbcef8e0b) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) brow, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) bcol) | | | Set the number of rows and columns blocks. | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1blocksparsematrix#a89c2e0b48b6425c4828a794f4c654796) () const | | | | void | [setBlockLayout](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d) (const VectorXi &rowBlocks, const VectorXi &colBlocks) | | | Set the row and column block layouts,. [More...](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d) | | | | void | [setBlockSize](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) blockSize) | | | set the block size at runtime for fixed-size block layout [More...](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45) | | | | template<typename MatrixType > | | void | [setBlockStructure](classeigen_1_1blocksparsematrix#a40891e477661e68bc870319d1379c7aa) (const MatrixType &blockPattern) | | | Set the nonzero block pattern of the matrix. [More...](classeigen_1_1blocksparsematrix#a40891e477661e68bc870319d1379c7aa) | | | | template<typename InputIterator > | | void | [setFromTriplets](classeigen_1_1blocksparsematrix#aa148b63f89555f4eed312638abe597eb) (const InputIterator &begin, const InputIterator &end) | | | Fill values in a matrix from a triplet list. [More...](classeigen_1_1blocksparsematrix#aa148b63f89555f4eed312638abe597eb) | | | blockCols() ----------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::blockCols | ( | | ) | const | | inline | Returns the number of columns grouped by blocks blockColsIndex() ---------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::blockColsIndex | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *bj* | ) | const | | inline | Returns the starting index of the bj col block blockPtr() ---------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::blockPtr | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *id* | ) | const | | inline | Returns the starting position of the block `id` in the array of values blockRows() ----------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::blockRows | ( | | ) | const | | inline | Returns the number of rows grouped by blocks blockRowsIndex() ---------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::blockRowsIndex | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *bi* | ) | const | | inline | Returns the starting index of the bi row block coeff() ------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Map](../classeigen_1_1map)<const [BlockScalar](../classeigen_1_1matrix)> [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::coeff | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *brow*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *bcol* | | | ) | | const | | inline | Returns the value of the (i,j) block as an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") [Dense](../structeigen_1_1dense) [Matrix](../classeigen_1_1matrix) coeffRef() ---------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Ref](../classeigen_1_1ref)<[BlockScalar](../classeigen_1_1matrix)> [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::coeffRef | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *brow*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *bcol* | | | ) | | | | inline | Returns a reference to the (i,j) block as an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") [Dense](../structeigen_1_1dense) [Matrix](../classeigen_1_1matrix) cols() ------ template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::cols | ( | | ) | const | | inline | Returns the number of cols innerToBlock() -------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::innerToBlock | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *inner* | ) | const | | inline | Returns the block index where inner belongs to nonZeros() ---------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::nonZeros | ( | | ) | const | | inline | Returns the total number of nonzero elements, including eventual explicit zeros in blocks nonZerosBlocks() ---------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::nonZerosBlocks | ( | | ) | const | | inline | Returns the number of nonzero blocks operator=() ----------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [BlockSparseMatrix](classeigen_1_1blocksparsematrix)& [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::operator= | ( | const MatrixType & | *spmat* | ) | | | inline | Assignment from a sparse matrix with the same storage order. Convert from a sparse matrix to block sparse matrix. Warning Before calling this function, tt is necessary to call either [setBlockLayout()](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d "Set the row and column block layouts,.") (matrices with variable-size blocks) or [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") (for fixed-size blocks). outerToBlock() -------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::outerToBlock | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *outer* | ) | const | | inline | Returns the block index where outer belongs to reserve() --------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::reserve | ( | const [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *nonzerosblocks* | ) | | | inline | Allocate the internal array of pointers to blocks and their inner indices. Note For fixed-size blocks, call [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") to set the block. And For variable-size blocks, call [setBlockLayout()](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d "Set the row and column block layouts,.") before using this function Parameters | | | | --- | --- | | nonzerosblocks | Number of nonzero blocks. The total number of nonzeros is is computed in [setBlockLayout()](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d "Set the row and column block layouts,.") for variable-size blocks | See also [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") rows() ------ template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::rows | ( | | ) | const | | inline | Returns the number of rows setBlockLayout() ---------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::setBlockLayout | ( | const VectorXi & | *rowBlocks*, | | | | const VectorXi & | *colBlocks* | | | ) | | | | inline | Set the row and column block layouts,. This function set the size of each row and column block. So this function should be used only for blocks with variable size. Parameters | | | | --- | --- | | rowBlocks | : Number of rows per row block | | colBlocks | : Number of columns per column block | See also [resize()](classeigen_1_1blocksparsematrix#ae0b2c5f1f4aa7a2a54dea00bbcef8e0b "Set the number of rows and columns blocks."), [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") setBlockSize() -------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::setBlockSize | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *blockSize* | ) | | | inline | set the block size at runtime for fixed-size block layout Call this only for fixed-size blocks setBlockStructure() ------------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::setBlockStructure | ( | const MatrixType & | *blockPattern* | ) | | | inline | Set the nonzero block pattern of the matrix. Given a sparse matrix describing the nonzero block pattern, this function prepares the internal pointers for values. After calling this function, any *nonzero* block (bi, bj) can be set with a simple call to coeffRef(bi,bj). Warning Before calling this function, tt is necessary to call either [setBlockLayout()](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d "Set the row and column block layouts,.") (matrices with variable-size blocks) or [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") (for fixed-size blocks). Parameters | | | | --- | --- | | blockPattern | [Sparse](../structeigen_1_1sparse) matrix of boolean elements describing the block structure | See also [setBlockLayout()](classeigen_1_1blocksparsematrix#acad69e4bb5e747db973cacc75c2f4a4d "Set the row and column block layouts,.") [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") setFromTriplets() ----------------- template<typename \_Scalar , int \_BlockAtCompileTime, int \_Options, typename \_StorageIndex > template<typename InputIterator > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::BlockSparseMatrix](classeigen_1_1blocksparsematrix)< \_Scalar, \_BlockAtCompileTime, \_Options, \_StorageIndex >::setFromTriplets | ( | const InputIterator & | *begin*, | | | | const InputIterator & | *end* | | | ) | | | | inline | Fill values in a matrix from a triplet list. Each triplet item has a block stored in an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") dense matrix. The InputIterator class should provide the functions row(), col() and value() Note For fixed-size blocks, call [setBlockSize()](classeigen_1_1blocksparsematrix#a1984d81fa41dc2f4e8f1208f602e7e45 "set the block size at runtime for fixed-size block layout") before this function. FIXME Do not accept duplicates --- The documentation for this class was generated from the following file:* [BlockSparseMatrix.h](https://eigen.tuxfamily.org/dox/unsupported/BlockSparseMatrix_8h_source.html)
programming_docs
eigen3 Eigen::IterationController Eigen::IterationController ========================== Controls the iterations of the iterative solvers. This class has been adapted from the iteration class of GMM++ and ITL libraries. | | | --- | | | | size\_t | [m\_maxiter](classeigen_1_1iterationcontroller#a42f72b0f3d490a6ceaa7bc76a51c1471) | | | Max. number of iterations. | | | | size\_t | [m\_nit](classeigen_1_1iterationcontroller#ac9d122615471416cc827a3d8e8ea15f2) | | | iteration number | | | | int | [m\_noise](classeigen_1_1iterationcontroller#afcff4288066c186967f15defcd833f5d) | | | if noise > 0 iterations are printed | | | | double | [m\_res](classeigen_1_1iterationcontroller#af60d33d2bdd09f3d00fd73ddc91fc1e6) | | | last computed residual | | | | double | [m\_resmax](classeigen_1_1iterationcontroller#a5342235a082ee820516fd593ee1efeac) | | | maximum residual | | | | double | [m\_rhsn](classeigen_1_1iterationcontroller#a43364d62c43861aff44cb0a86c4615a6) | | | Right hand side norm. | | | --- The documentation for this class was generated from the following file:* [IterationController.h](https://eigen.tuxfamily.org/dox/unsupported/IterationController_8h_source.html) eigen3 TensorReduction TensorReduction =============== Tensor reduction class. --- The documentation for this class was generated from the following file:* [TensorReduction.h](https://eigen.tuxfamily.org/dox/unsupported/TensorReduction_8h_source.html) eigen3 Eigen::EulerSystem Eigen::EulerSystem ================== ### template<int \_AlphaAxis, int \_BetaAxis, int \_GammaAxis> class Eigen::EulerSystem< \_AlphaAxis, \_BetaAxis, \_GammaAxis > Represents a fixed Euler rotation system. This meta-class goal is to represent the Euler system in compilation time, for [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles."). You can use this class to get two things: * Build an Euler system, and then pass it as a template parameter to [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles."). * Query some compile time data about an Euler system. (e.g. Whether it's Tait-Bryan) Euler rotation is a set of three rotation on fixed axes. (see [EulerAngles](classeigen_1_1eulerangles)) This meta-class store constantly those signed axes. (see [EulerAxis](group__eulerangles__module#gae614aa7cdd687fb5c421a54f2ce5c361)) ### Types of Euler systems All and only valid 3 dimension Euler rotation over standard signed axes{+X,+Y,+Z,-X,-Y,-Z} are supported: * all axes X, Y, Z in each valid order (see below what order is valid) * rotation over the axis is supported both over the positive and negative directions. * both Tait-Bryan and proper/classic Euler angles (i.e. the opposite). Since [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system.") support both positive and negative directions, you may call this rotation distinction in other names: * *right handed* or *left handed* * *counterclockwise* or *clockwise* Notice all axed combination are valid, and would trigger a static assertion. Same unsigned axes can't be neighbors, e.g. {X,X,Y} is invalid. This yield two and only two classes: * *Tait-Bryan* - all unsigned axes are distinct, e.g. {X,Y,Z} * *proper/classic Euler angles* - The first and the third unsigned axes is equal, and the second is different, e.g. {X,Y,X} ### Intrinsic vs extrinsic Euler systems Only intrinsic Euler systems are supported for simplicity. If you want to use extrinsic Euler systems, just use the equal intrinsic opposite order for axes and angles. I.e axes (A,B,C) becomes (C,B,A), and angles (a,b,c) becomes (c,b,a). ### Convenient user typedefs Convenient typedefs for [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system.") exist (only for positive axes Euler systems), in a form of [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system."){A}{B}{C}, e.g. EulerSystemXYZ. ### Additional reading More information about Euler angles: <https://en.wikipedia.org/wiki/Euler_angles> Template Parameters | | | | --- | --- | | \_AlphaAxis | the first fixed EulerAxis | | \_BetaAxis | the second fixed EulerAxis | | \_GammaAxis | the third fixed EulerAxis | | | | --- | | | | enum | { [AlphaAxisAbs](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa58eb5d1cddcc26fc15f643eab45ce06b) , [BetaAxisAbs](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa6a215356d13cf14b7c48a27117dbc3ba) , [GammaAxisAbs](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa121638032850c0d43438aedfb32e3d4f) , [IsAlphaOpposite](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa44dcc3422221a0284b76970e01f03877) , [IsBetaOpposite](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa940fe9742857e33fa7d036f3a0fff57c) , [IsGammaOpposite](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa3e7e0d4bd2abf4da43c48c3d0ecafbfe) , [IsOdd](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa3e35fba7036026953caf28323e699dc9) , [IsEven](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa5066a58a34a7acfab35b76398d2cd506) , [IsTaitBryan](classeigen_1_1eulersystem#a1df84cc5ba09c5bc1deb24832edfa70aa900def911be74336de5186063de0a21c) } | | | | | | --- | | | | static const int | [AlphaAxis](classeigen_1_1eulersystem#a99fd18091ad6cd5629e9e5d8c223b3f1) | | | | static const int | [BetaAxis](classeigen_1_1eulersystem#a4899578f5c8e0e4e430945b38448e3d0) | | | | static const int | [GammaAxis](classeigen_1_1eulersystem#ace6abcfe0b287329a5b9658b62e16b0d) | | | anonymous enum -------------- template<int \_AlphaAxis, int \_BetaAxis, int \_GammaAxis> | | | --- | | anonymous enum | | Enumerator | | --- | | AlphaAxisAbs | the first rotation axis unsigned | | BetaAxisAbs | the second rotation axis unsigned | | GammaAxisAbs | the third rotation axis unsigned | | IsAlphaOpposite | whether alpha axis is negative | | IsBetaOpposite | whether beta axis is negative | | IsGammaOpposite | whether gamma axis is negative | | IsOdd | whether the Euler system is odd | | IsEven | whether the Euler system is even | | IsTaitBryan | whether the Euler system is Tait-Bryan | AlphaAxis --------- template<int \_AlphaAxis, int \_BetaAxis, int \_GammaAxis> | | | | | --- | --- | --- | | | | | --- | | const int [Eigen::EulerSystem](classeigen_1_1eulersystem)< \_AlphaAxis, \_BetaAxis, \_GammaAxis >::AlphaAxis | | static | The first rotation axis BetaAxis -------- template<int \_AlphaAxis, int \_BetaAxis, int \_GammaAxis> | | | | | --- | --- | --- | | | | | --- | | const int [Eigen::EulerSystem](classeigen_1_1eulersystem)< \_AlphaAxis, \_BetaAxis, \_GammaAxis >::BetaAxis | | static | The second rotation axis GammaAxis --------- template<int \_AlphaAxis, int \_BetaAxis, int \_GammaAxis> | | | | | --- | --- | --- | | | | | --- | | const int [Eigen::EulerSystem](classeigen_1_1eulersystem)< \_AlphaAxis, \_BetaAxis, \_GammaAxis >::GammaAxis | | static | The third rotation axis --- The documentation for this class was generated from the following file:* [EulerSystem.h](https://eigen.tuxfamily.org/dox/unsupported/EulerSystem_8h_source.html) eigen3 Eigen::AlignedVector3 Eigen::AlignedVector3 ===================== ### template<typename \_Scalar> class Eigen::AlignedVector3< \_Scalar > A vectorization friendly 3D vector. This class represents a 3D vector internally using a 4D vector such that vectorization can be seamlessly enabled. Of course, the same result can be achieved by directly using a 4D vector. This class makes this process simpler. --- The documentation for this class was generated from the following file:* AlignedVector3 eigen3 Eigen::MatrixPower Eigen::MatrixPower ================== ### template<typename MatrixType> class Eigen::MatrixPower< MatrixType > Class for computing matrix powers. Template Parameters | | | | --- | --- | | MatrixType | type of the base, expected to be an instantiation of the [Matrix](../classeigen_1_1matrix) class template. | This class is capable of computing real/complex matrices raised to an arbitrary real power. Meanwhile, it saves the result of Schur decomposition if an non-integral power has even been calculated. Therefore, if you want to compute multiple (>= 2) matrix powers for the same matrix, using the class directly is more efficient than calling [MatrixBase::pow()](../classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b). Example: ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { Matrix4cd A = Matrix4cd::Random(); MatrixPower<Matrix4cd> Apow(A); std::cout << "The matrix A is:\n" << A << "\n\n" "A^3.1 is:\n" << Apow(3.1) << "\n\n" "A^3.3 is:\n" << Apow(3.3) << "\n\n" "A^3.7 is:\n" << Apow(3.7) << "\n\n" "A^3.9 is:\n" << Apow(3.9) << std::endl; return 0; } ``` Output: ``` The matrix A is: (-0.211234,0.680375) (0.10794,-0.444451) (0.434594,0.271423) (-0.198111,-0.686642) (0.59688,0.566198) (0.257742,-0.0452059) (0.213938,-0.716795) (-0.782382,-0.740419) (-0.604897,0.823295) (0.0268018,-0.270431) (-0.514226,-0.967399) (-0.563486,0.997849) (0.536459,-0.329554) (0.83239,0.904459) (0.608354,-0.725537) (0.678224,0.0258648) A^3.1 is: (2.80575,-0.607662) (-1.16847,-0.00660555) (-0.760385,1.01461) (-0.38073,-0.106512) (1.4041,-3.61891) (1.00481,0.186263) (-0.163888,0.449419) (-0.388981,-1.22629) (-2.07957,-1.58136) (0.825866,2.25962) (5.09383,0.155736) (0.394308,-1.63034) (-0.818997,0.671026) (2.11069,-0.00768024) (-1.37876,0.140165) (2.50512,-0.854429) A^3.3 is: (2.83571,-0.238717) (-1.48174,-0.0615217) (-0.0544396,1.68092) (-0.292699,-0.621726) (2.0521,-3.58316) (0.87894,0.400548) (0.738072,-0.121242) (-1.07957,-1.63492) (-3.00106,-1.10558) (1.52205,1.92407) (5.29759,-1.83562) (-0.532038,-1.50253) (-0.491353,-0.4145) (2.5761,0.481286) (-1.21994,0.0367069) (2.67112,-1.06331) A^3.7 is: (1.42126,0.33362) (-1.39486,-0.560486) (1.44968,2.47066) (-0.324079,-1.75879) (2.65301,-1.82427) (0.357333,-0.192429) (2.01017,-1.4791) (-2.71518,-2.35892) (-3.98544,0.964861) (2.26033,0.554254) (3.18211,-5.94352) (-2.22888,0.128951) (0.944969,-2.14683) (3.31345,1.66075) (-0.0623743,-0.848324) (2.3897,-1.863) A^3.9 is: (0.0720766,0.378685) (-0.931961,-0.978624) (1.9855,2.34105) (-0.530547,-2.17664) (2.40934,-0.265286) (0.0299975,-1.08827) (1.98974,-2.05886) (-3.45767,-2.50235) (-3.71666,2.3874) (2.054,-0.303) (0.844348,-7.29588) (-2.59136,1.57689) (1.87645,-2.38798) (3.52111,2.10508) (0.799055,-1.6122) (1.93452,-2.44408) ``` Inherits internal::noncopyable. | | | --- | | | | template<typename ResultType > | | void | [compute](classeigen_1_1matrixpower#aa1258393dc13acd6e401e000f99b915f) (ResultType &res, RealScalar p) | | | Compute the matrix power. [More...](classeigen_1_1matrixpower#aa1258393dc13acd6e401e000f99b915f) | | | | | [MatrixPower](classeigen_1_1matrixpower#a5eb445525601510413b53cd347c44716) (const MatrixType &A) | | | Constructor. [More...](classeigen_1_1matrixpower#a5eb445525601510413b53cd347c44716) | | | | const [MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue)< MatrixType > | [operator()](classeigen_1_1matrixpower#a2ad22d156b1a7ff12d6c40a093cd95eb) (RealScalar p) | | | Returns the matrix power. [More...](classeigen_1_1matrixpower#a2ad22d156b1a7ff12d6c40a093cd95eb) | | | MatrixPower() ------------- template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::MatrixPower](classeigen_1_1matrixpower)< MatrixType >::[MatrixPower](classeigen_1_1matrixpower) | ( | const MatrixType & | *A* | ) | | | inlineexplicit | Constructor. Parameters | | | | | --- | --- | --- | | [in] | A | the base of the matrix power. | The class stores a reference to A, so it should not be changed (or destroyed) before evaluation. compute() --------- template<typename MatrixType > template<typename ResultType > | | | | | | --- | --- | --- | --- | | void [Eigen::MatrixPower](classeigen_1_1matrixpower)< MatrixType >::compute | ( | ResultType & | *res*, | | | | RealScalar | *p* | | | ) | | | Compute the matrix power. Parameters | | | | | --- | --- | --- | | [in] | p | exponent, a real scalar. | | [out] | res | \( A^p \) where A is specified in the constructor. | operator()() ------------ template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue)<MatrixType> [Eigen::MatrixPower](classeigen_1_1matrixpower)< MatrixType >::operator() | ( | RealScalar | *p* | ) | | | inline | Returns the matrix power. Parameters | | | | | --- | --- | --- | | [in] | p | exponent, a real scalar. | Returns The expression \( A^p \), where A is specified in the constructor. --- The documentation for this class was generated from the following file:* [MatrixPower.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixPower_8h_source.html) eigen3 Eigen::MINRES Eigen::MINRES ============= ### template<typename \_MatrixType, int \_UpLo, typename \_Preconditioner> class Eigen::MINRES< \_MatrixType, \_UpLo, \_Preconditioner > A minimal residual solver for sparse symmetric problems. This class allows to solve for A.x = b sparse linear problems using the [MINRES](classeigen_1_1minres "A minimal residual solver for sparse symmetric problems.") algorithm of Paige and Saunders (1975). The sparse matrix A must be symmetric (possibly indefinite). The vectors x and b can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, can be a dense or a sparse matrix. | | \_UpLo | the triangular part that will be used for the computations. It can be Lower, Upper, or Lower|Upper in which the full matrix entries will be considered. Default is Lower. | | \_Preconditioner | the type of the preconditioner. Default is [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner) | The maximal number of iterations and tolerance value can be controlled via the [setMaxIterations()](../classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) and [setTolerance()](../classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance. This class can be used as the direct solver classes. Here is a typical usage example: ``` int n = 10000; VectorXd x(n), b(n); SparseMatrix<double> A(n,n); // fill A and b MINRES<SparseMatrix<double> > mr; mr.compute(A); x = mr.solve(b); std::cout << "#iterations: " << mr.iterations() << std::endl; std::cout << "estimated error: " << mr.error() << std::endl; // update b, and solve again x = mr.solve(b); ``` By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the [solveWithGuess()](../classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) method. [MINRES](classeigen_1_1minres "A minimal residual solver for sparse symmetric problems.") can also be used in a matrix-free context, see the following [example](../group__matrixfreesolverexample) . See also class [ConjugateGradient](../classeigen_1_1conjugategradient), [BiCGSTAB](../classeigen_1_1bicgstab), [SimplicialCholesky](../classeigen_1_1simplicialcholesky), [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner), [IdentityPreconditioner](../classeigen_1_1identitypreconditioner) | | | --- | | | | | [MINRES](classeigen_1_1minres#aa519021be1178a99f5f9ec633de9fc09) () | | | | template<typename MatrixDerived > | | | [MINRES](classeigen_1_1minres#a971bc758d11d1795d9e0abd3c958030b) (const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | | [~MINRES](classeigen_1_1minres#a3f40ba58caac8b10ae7df474af93a05b) () | | | MINRES() [1/2] -------------- template<typename \_MatrixType , int \_UpLo, typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::MINRES](classeigen_1_1minres)< \_MatrixType, \_UpLo, \_Preconditioner >::[MINRES](classeigen_1_1minres) | ( | | ) | | | inline | Default constructor. MINRES() [2/2] -------------- template<typename \_MatrixType , int \_UpLo, typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::MINRES](classeigen_1_1minres)< \_MatrixType, \_UpLo, \_Preconditioner >::[MINRES](classeigen_1_1minres) | ( | const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. ~MINRES() --------- template<typename \_MatrixType , int \_UpLo, typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::MINRES](classeigen_1_1minres)< \_MatrixType, \_UpLo, \_Preconditioner >::~[MINRES](classeigen_1_1minres) | ( | | ) | | | inline | Destructor. --- The documentation for this class was generated from the following file:* [MINRES.h](https://eigen.tuxfamily.org/dox/unsupported/MINRES_8h_source.html) eigen3 TensorStriding TensorStriding ============== Tensor striding class. --- The documentation for this class was generated from the following file:* [TensorStriding.h](https://eigen.tuxfamily.org/dox/unsupported/TensorStriding_8h_source.html) eigen3 Eigen::MatrixComplexPowerReturnValue Eigen::MatrixComplexPowerReturnValue ==================================== ### template<typename Derived> class Eigen::MatrixComplexPowerReturnValue< Derived > Proxy for the matrix power of some matrix (expression). Template Parameters | | | | --- | --- | | Derived | type of the base, a matrix (expression). | This class holds the arguments to the matrix power until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of [MatrixBase::pow()](../classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) and related functions and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixComplexPowerReturnValue< Derived > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](classeigen_1_1matrixcomplexpowerreturnvalue#ac7a7947bc6cad6554d31b08b847bc6dd) (ResultType &result) const | | | Compute the matrix power. [More...](classeigen_1_1matrixcomplexpowerreturnvalue#ac7a7947bc6cad6554d31b08b847bc6dd) | | | | | [MatrixComplexPowerReturnValue](classeigen_1_1matrixcomplexpowerreturnvalue#a3e5903e22f70e9deb07c3967ae52fd54) (const Derived &A, const ComplexScalar &p) | | | Constructor. [More...](classeigen_1_1matrixcomplexpowerreturnvalue#a3e5903e22f70e9deb07c3967ae52fd54) | | | MatrixComplexPowerReturnValue() ------------------------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::MatrixComplexPowerReturnValue](classeigen_1_1matrixcomplexpowerreturnvalue)< Derived >::[MatrixComplexPowerReturnValue](classeigen_1_1matrixcomplexpowerreturnvalue) | ( | const Derived & | *A*, | | | | const ComplexScalar & | *p* | | | ) | | | | inline | Constructor. Parameters | | | | | --- | --- | --- | | [in] | A | Matrix (expression), the base of the matrix power. | | [in] | p | complex scalar, the exponent of the matrix power. | evalTo() -------- template<typename Derived > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixComplexPowerReturnValue](classeigen_1_1matrixcomplexpowerreturnvalue)< Derived >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix power. Because `p` is complex, \( A^p \) is simply evaluated as \( \exp(p \log(A)) \). Parameters | | | | | --- | --- | --- | | [out] | result | \( A^p \) where `A` and `p` are as in the constructor. | --- The documentation for this class was generated from the following file:* [MatrixPower.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixPower_8h_source.html)
programming_docs
eigen3 Eigen::TensorBase Eigen::TensorBase ================= ### template<typename Derived, int AccessLevel> class Eigen::TensorBase< Derived, AccessLevel > The tensor base class. This class is the common parent of the [Tensor](classeigen_1_1tensor "The tensor class.") and [TensorMap](classeigen_1_1tensormap "A tensor expression mapping an existing array of data.") class, thus making it possible to use either class interchangeably in expressions. --- The documentation for this class was generated from the following file:* [TensorForwardDeclarations.h](https://eigen.tuxfamily.org/dox/unsupported/TensorForwardDeclarations_8h_source.html) eigen3 TensorShuffling TensorShuffling =============== Tensor shuffling class. --- The documentation for this class was generated from the following file:* [TensorShuffling.h](https://eigen.tuxfamily.org/dox/unsupported/TensorShuffling_8h_source.html) eigen3 Eigen::SkylineMatrixBase Eigen::SkylineMatrixBase ======================== ### template<typename Derived> class Eigen::SkylineMatrixBase< Derived > Base class of any skyline matrices or skyline expressions. Parameters | | | | --- | --- | | Derived | | | | | --- | | | | enum | { [RowsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a38d1bf953af9198ddd3f0e56fc282015) , [ColsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a288f9228ca4a52efa9d3f4edef53a635) , [SizeAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a0c8807124023bf5a3e94bd0a61dcf1b1) , **MaxRowsAtCompileTime** , **MaxColsAtCompileTime** , **MaxSizeAtCompileTime** , [IsVectorAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0af6ae6724ce38083a0032925e68782a43) , [Flags](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a687566e95391ffd9783432d3fee5d655) , [CoeffReadCost](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a30b689b8ac0277eaa3da46fd52702cb9) , **IsRowMajor** } | | | | | | --- | | | | EIGEN\_CONSTEXPR Index | [cols](classeigen_1_1skylinematrixbase#aeed7d90e131bbe98835c2c66c22264c5) () const EIGEN\_NOEXCEPT | | | | const internal::eval< Derived, IsSkyline >::type | [eval](classeigen_1_1skylinematrixbase#a8223cbedd8027149ac7a5e930d89f156) () const | | | | Index | [innerSize](classeigen_1_1skylinematrixbase#a901f2691facc1a0321740300dc7a12d7) () const | | | | Index | [nonZeros](classeigen_1_1skylinematrixbase#aaeda265186dd626052df8580779b7460) () const | | | | Index | [outerSize](classeigen_1_1skylinematrixbase#a63cc4a263d32a8a225e4a42e891b8ac0) () const | | | | EIGEN\_CONSTEXPR Index | [rows](classeigen_1_1skylinematrixbase#ab1bbf8b98d01a166c91c0e98fbaaab5d) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR Index | [size](classeigen_1_1skylinematrixbase#a3b1c3eada36fd4cb23d4feeb696bdc88) () const EIGEN\_NOEXCEPT | | | anonymous enum -------------- template<typename Derived > | | | --- | | anonymous enum | | Enumerator | | --- | | RowsAtCompileTime | The number of rows at compile-time. This is just a copy of the value provided by the *Derived* type. If a value is not known at compile-time, it is set to the *Dynamic* constant. See also [MatrixBase::rows()](../classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [MatrixBase::cols()](../classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), [ColsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a288f9228ca4a52efa9d3f4edef53a635), [SizeAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a0c8807124023bf5a3e94bd0a61dcf1b1) | | ColsAtCompileTime | The number of columns at compile-time. This is just a copy of the value provided by the *Derived* type. If a value is not known at compile-time, it is set to the *Dynamic* constant. See also [MatrixBase::rows()](../classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#ac22eb0695d00edd7d4a3b2d0a98b81c2), [MatrixBase::cols()](../classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4#a2d768a9877f5f69f49432d447b552bfe), [RowsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a38d1bf953af9198ddd3f0e56fc282015), [SizeAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a0c8807124023bf5a3e94bd0a61dcf1b1) | | SizeAtCompileTime | This is equal to the number of coefficients, i.e. the number of rows times the number of columns, or to *Dynamic* if this is not known at compile-time. See also [RowsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a38d1bf953af9198ddd3f0e56fc282015), [ColsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a288f9228ca4a52efa9d3f4edef53a635) | | IsVectorAtCompileTime | This is set to true if either the number of rows or the number of columns is known at compile-time to be equal to 1. Indeed, in that case, we are dealing with a column-vector (if there is only one column) or with a row-vector (if there is only one row). | | Flags | This stores expression [Flags](../group__flags) flags which may or may not be inherited by new expressions constructed from this one. See the [list of flags](../group__flags). | | CoeffReadCost | This is a rough measure of how expensive it is to read one coefficient from this expression. | cols() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR Index [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::cols | ( | | ) | const | | inline | Returns the number of columns. See also [rows()](classeigen_1_1skylinematrixbase#ab1bbf8b98d01a166c91c0e98fbaaab5d), [ColsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a288f9228ca4a52efa9d3f4edef53a635) eval() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const internal::eval<Derived, IsSkyline>::type [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::eval | ( | | ) | const | | inline | Returns the matrix or vector obtained by evaluating this expression. Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy. innerSize() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::innerSize | ( | | ) | const | | inline | Returns the size of the inner dimension according to the storage order, i.e., the number of rows for a columns major matrix, and the number of cols otherwise nonZeros() ---------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::nonZeros | ( | | ) | const | | inline | Returns the number of nonzero coefficients which is in practice the number of stored coefficients. outerSize() ----------- template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::outerSize | ( | | ) | const | | inline | Returns the size of the storage major dimension, i.e., the number of columns for a columns major matrix, and the number of rows otherwise rows() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR Index [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::rows | ( | | ) | const | | inline | Returns the number of rows. See also [cols()](classeigen_1_1skylinematrixbase#aeed7d90e131bbe98835c2c66c22264c5), [RowsAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a38d1bf953af9198ddd3f0e56fc282015) size() ------ template<typename Derived > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_CONSTEXPR Index [Eigen::SkylineMatrixBase](classeigen_1_1skylinematrixbase)< Derived >::size | ( | | ) | const | | inline | Returns the number of coefficients, which is *[rows()](classeigen_1_1skylinematrixbase#ab1bbf8b98d01a166c91c0e98fbaaab5d)\*cols*(). See also [rows()](classeigen_1_1skylinematrixbase#ab1bbf8b98d01a166c91c0e98fbaaab5d), [cols()](classeigen_1_1skylinematrixbase#aeed7d90e131bbe98835c2c66c22264c5), [SizeAtCompileTime](classeigen_1_1skylinematrixbase#a6b62c550e32df9d80b92891b440d28f0a0c8807124023bf5a3e94bd0a61dcf1b1). --- The documentation for this class was generated from the following files:* [SkylineMatrixBase.h](https://eigen.tuxfamily.org/dox/unsupported/SkylineMatrixBase_8h_source.html) * [SkylineProduct.h](https://eigen.tuxfamily.org/dox/unsupported/SkylineProduct_8h_source.html) eigen3 Eigen's unsupported modules Eigen's unsupported modules =========================== This is the API documentation for Eigen's unsupported modules. These modules are contributions from various users. They are provided "as is", without any support. Click on the *Modules* tab at the top of this page to get a list of all unsupported modules. Don't miss the [official Eigen documentation](../index). [SYCL backend for Eigen](sycl_eigen) eigen3 Eigen::TensorEvaluator Eigen::TensorEvaluator ====================== ### template<typename Derived, typename Device> class Eigen::TensorEvaluator< Derived, Device > A cost model used to limit the number of threads used for evaluating tensor expression. The tensor evaluator classes. These classes are responsible for the evaluation of the tensor expression. TODO: add support for more types of expressions, in particular expressions leading to lvalues (slicing, reshaping, etc...) Inherited by Eigen::TensorEvaluator< TensorChippingOp< DimId, ArgType >, Device >, Eigen::TensorEvaluator< TensorConcatenationOp< Axis, LeftArgType, RightArgType >, Device >, Eigen::TensorEvaluator< TensorLayoutSwapOp< ArgType >, Device >, Eigen::TensorEvaluator< TensorRef< Derived >, Device >, Eigen::TensorEvaluator< TensorReshapingOp< NewDimensions, ArgType >, Device >, Eigen::TensorEvaluator< TensorReverseOp< ReverseDimensions, ArgType >, Device >, Eigen::TensorEvaluator< TensorShufflingOp< Shuffle, ArgType >, Device >, Eigen::TensorEvaluator< TensorSlicingOp< StartIndices, Sizes, ArgType >, Device >, Eigen::TensorEvaluator< TensorStridingOp< Strides, ArgType >, Device >, and Eigen::TensorEvaluator< TensorStridingSlicingOp< StartIndices, StopIndices, Strides, ArgType >, Device >. --- The documentation for this class was generated from the following file:* [TensorEvaluator.h](https://eigen.tuxfamily.org/dox/unsupported/TensorEvaluator_8h_source.html) eigen3 Skyline module Skyline module ============== | | | --- | | | | class | [Eigen::SkylineInplaceLU< MatrixType >](classeigen_1_1skylineinplacelu) | | | Inplace LU decomposition of a skyline matrix and associated features. [More...](classeigen_1_1skylineinplacelu#details) | | | | class | [Eigen::SkylineMatrix< \_Scalar, \_Options >](classeigen_1_1skylinematrix) | | | The main skyline matrix class. [More...](classeigen_1_1skylinematrix#details) | | | | class | [Eigen::SkylineMatrixBase< Derived >](classeigen_1_1skylinematrixbase) | | | Base class of any skyline matrices or skyline expressions. [More...](classeigen_1_1skylinematrixbase#details) | | | eigen3 Eigen::MatrixMarketIterator Eigen::MatrixMarketIterator =========================== ### template<typename Scalar> class Eigen::MatrixMarketIterator< Scalar > Iterator to browse matrices from a specified folder. This is used to load all the matrices from a folder. The matrices should be in [Matrix](../classeigen_1_1matrix) Market format It is assumed that the matrices are named as matname.mtx and matname\_SPD.mtx if the matrix is Symmetric and positive definite (or Hermitian) The right hand side vectors are loaded as well, if they exist. They should be named as matname\_b.mtx. Note that the right hand side for a SPD matrix is named as matname\_SPD\_b.mtx Sometimes a reference solution is available. In this case, it should be named as matname\_x.mtx Sample code Template Parameters | | | | --- | --- | | Scalar | The scalar type | | | | --- | | | | [MatrixType](../classeigen_1_1sparsematrix) & | [matrix](classeigen_1_1matrixmarketiterator#ac938961d685306ef5b48d9943f7dcabd) () | | | | [VectorType](../classeigen_1_1matrix) & | [refX](classeigen_1_1matrixmarketiterator#a80f334d9fbbed0d24ba0c32d2bea16bc) () | | | | [VectorType](../classeigen_1_1matrix) & | [rhs](classeigen_1_1matrixmarketiterator#ac141e537f3bc3a3c078a2780a6a956b6) () | | | matrix() -------- template<typename Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [MatrixType](../classeigen_1_1sparsematrix)& [Eigen::MatrixMarketIterator](classeigen_1_1matrixmarketiterator)< Scalar >::matrix | ( | | ) | | | inline | Return the sparse matrix corresponding to the current file refX() ------ template<typename Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [VectorType](../classeigen_1_1matrix)& [Eigen::MatrixMarketIterator](classeigen_1_1matrixmarketiterator)< Scalar >::refX | ( | | ) | | | inline | Return a reference solution If it is not provided and if the right hand side is not available then refX is randomly generated such that A\*refX = b where A and b are the matrix and the rhs. Note that when a rhs is provided, refX is not available rhs() ----- template<typename Scalar > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [VectorType](../classeigen_1_1matrix)& [Eigen::MatrixMarketIterator](classeigen_1_1matrixmarketiterator)< Scalar >::rhs | ( | | ) | | | inline | Return the right hand side corresponding to the current matrix. If the rhs file is not provided, a random rhs is generated --- The documentation for this class was generated from the following file:* [MatrixMarketIterator.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixMarketIterator_8h_source.html) eigen3 Eigen::DGMRES Eigen::DGMRES ============= ### template<typename \_MatrixType, typename \_Preconditioner> class Eigen::DGMRES< \_MatrixType, \_Preconditioner > A Restarted [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") with deflation. This class implements a modification of the [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") solver for sparse linear systems. The basis is built with modified Gram-Schmidt. At each restart, a few approximated eigenvectors corresponding to the smallest eigenvalues are used to build a preconditioner for the next cycle. This preconditioner for deflation can be combined with any other preconditioner, the [IncompleteLUT](../classeigen_1_1incompletelut) for instance. The preconditioner is applied at right of the matrix and the combination is multiplicative. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, can be a dense or a sparse matrix. | | \_Preconditioner | the type of the preconditioner. Default is [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner) Typical usage : ``` SparseMatrix<double> A; VectorXd x, b; //Fill A and b ... DGMRES<SparseMatrix<double> > solver; solver.set_restart(30); // Set restarting value solver.setEigenv(1); // Set the number of eigenvalues to deflate solver.compute(A); x = solver.solve(b); ``` | [DGMRES](classeigen_1_1dgmres "A Restarted GMRES with deflation. This class implements a modification of the GMRES solver for sparse...") can also be used in a matrix-free context, see the following [example](../group__matrixfreesolverexample) . References : [1] D. NUENTSA WAKAM and F. PACULL, Memory Efficient Hybrid Algebraic Solvers for Linear Systems Arising from Compressible Flows, Computers and Fluids, In Press, <https://doi.org/10.1016/j.compfluid.2012.03.023> [2] K. Burrage and J. Erhel, On the performance of various adaptive preconditioned [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") strategies, 5(1998), 101-121. [3] J. Erhel, K. Burrage and B. Pohl, Restarted [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") preconditioned by deflation,J. Computational and Applied Mathematics, 69(1996), 303-318. | | | --- | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [deflSize](classeigen_1_1dgmres#ab80013fc06926d2067b677a021367363) () | | | | | [DGMRES](classeigen_1_1dgmres#a17bd25826b56c39bc7cc4ce8fbf8a848) () | | | | template<typename MatrixDerived > | | | [DGMRES](classeigen_1_1dgmres#a800fcf37c0ac66f76d5c070e4aeae2a7) (const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [restart](classeigen_1_1dgmres#afba35ad9e10dba460a9658075ade4d57) () | | | | void | [set\_restart](classeigen_1_1dgmres#abc4c4e02112c861b122a19a2742319f0) (const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [restart](classeigen_1_1dgmres#afba35ad9e10dba460a9658075ade4d57)) | | | | void | [setEigenv](classeigen_1_1dgmres#ae74eb1faaaf3559bcf73b4d7703ea629) (const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) neig) | | | | void | [setMaxEigenv](classeigen_1_1dgmres#a6e715bd5199a6a4474a9bc9e8481f9bd) (const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) maxNeig) | | | | | | --- | | | | template<typename Rhs , typename Dest > | | void | [dgmres](classeigen_1_1dgmres#a1b06062ec16932d3a20ea4767d9de51d) (const MatrixType &mat, const Rhs &rhs, Dest &x, const Preconditioner &precond) const | | | Perform several cycles of restarted [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") with modified Gram Schmidt,. [More...](classeigen_1_1dgmres#a1b06062ec16932d3a20ea4767d9de51d) | | | | template<typename Dest > | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [dgmresCycle](classeigen_1_1dgmres#ab77d66ef7f84ff15b6bd55fb76619218) (const MatrixType &mat, const Preconditioner &precond, Dest &x, [DenseVector](../classeigen_1_1matrix) &r0, RealScalar &beta, const RealScalar &normRhs, [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) &nbIts) const | | | Perform one restart cycle of [DGMRES](classeigen_1_1dgmres "A Restarted GMRES with deflation. This class implements a modification of the GMRES solver for sparse..."). [More...](classeigen_1_1dgmres#ab77d66ef7f84ff15b6bd55fb76619218) | | | DGMRES() [1/2] -------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::[DGMRES](classeigen_1_1dgmres) | ( | | ) | | | inline | Default constructor. DGMRES() [2/2] -------------- template<typename \_MatrixType , typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::[DGMRES](classeigen_1_1dgmres) | ( | const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. deflSize() ---------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::deflSize | ( | | ) | | | inline | Get the size of the deflation subspace size dgmres() -------- template<typename \_MatrixType , typename \_Preconditioner > template<typename Rhs , typename Dest > | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::dgmres | ( | const MatrixType & | *mat*, | | | | const Rhs & | *rhs*, | | | | Dest & | *x*, | | | | const Preconditioner & | *precond* | | | ) | | const | | protected | Perform several cycles of restarted [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") with modified Gram Schmidt,. A right preconditioner is used combined with deflation. dgmresCycle() ------------- template<typename \_MatrixType , typename \_Preconditioner > template<typename Dest > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::dgmresCycle | ( | const MatrixType & | *mat*, | | | | const Preconditioner & | *precond*, | | | | Dest & | *x*, | | | | [DenseVector](../classeigen_1_1matrix) & | *r0*, | | | | RealScalar & | *beta*, | | | | const RealScalar & | *normRhs*, | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) & | *nbIts* | | | ) | | const | | protected | Perform one restart cycle of [DGMRES](classeigen_1_1dgmres "A Restarted GMRES with deflation. This class implements a modification of the GMRES solver for sparse..."). Parameters | | | | --- | --- | | mat | The coefficient matrix | | precond | The preconditioner | | x | the new approximated solution | | r0 | The initial residual vector | | beta | The norm of the residual computed so far | | normRhs | The norm of the right hand side vector | | nbIts | The number of iterations | restart() --------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::restart | ( | | ) | | | inline | Get the restart value set\_restart() -------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::set\_restart | ( | const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *restart* | ) | | | inline | Set the restart value (default is 30) setEigenv() ----------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::setEigenv | ( | const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *neig* | ) | | | inline | Set the number of eigenvalues to deflate at each restart setMaxEigenv() -------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DGMRES](classeigen_1_1dgmres)< \_MatrixType, \_Preconditioner >::setMaxEigenv | ( | const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *maxNeig* | ) | | | inline | Set the maximum size of the deflation subspace --- The documentation for this class was generated from the following file:* [DGMRES.h](https://eigen.tuxfamily.org/dox/unsupported/DGMRES_8h_source.html)
programming_docs
eigen3 TensorKChippingReshaping TensorKChippingReshaping ======================== A chip is a thin slice, corresponding to a column or a row in a 2-d tensor. --- The documentation for this class was generated from the following file:* [TensorChipping.h](https://eigen.tuxfamily.org/dox/unsupported/TensorChipping_8h_source.html) eigen3 Polynomials module Polynomials module ================== This module provides a QR based polynomial solver. To use this module, add ``` #include <unsupported/Eigen/Polynomials> ``` at the start of your source file. | | | --- | | | | class | [Eigen::PolynomialSolver< \_Scalar, \_Deg >](classeigen_1_1polynomialsolver) | | | A polynomial solver. [More...](classeigen_1_1polynomialsolver#details) | | | | class | [Eigen::PolynomialSolverBase< \_Scalar, \_Deg >](classeigen_1_1polynomialsolverbase) | | | Defined to be inherited by polynomial solvers: it provides convenient methods such as. [More...](classeigen_1_1polynomialsolverbase#details) | | | | | | --- | | | | template<typename Polynomial > | | [NumTraits](../structeigen_1_1numtraits)< typename Polynomial::Scalar >::Real | [Eigen::cauchy\_max\_bound](group__polynomials__module#ga375e3ea1f370fb76dfe0f43a89b95926) (const Polynomial &poly) | | | | template<typename Polynomial > | | [NumTraits](../structeigen_1_1numtraits)< typename Polynomial::Scalar >::Real | [Eigen::cauchy\_min\_bound](group__polynomials__module#gab076afbdba0e9298a541cc4e8cc7506b) (const Polynomial &poly) | | | | template<typename Polynomials , typename T > | | T | [Eigen::poly\_eval](group__polynomials__module#gadb64ffddaa9e83634e3ab0e3fd3664f5) (const Polynomials &poly, const T &x) | | | | template<typename Polynomials , typename T > | | T | [Eigen::poly\_eval\_horner](group__polynomials__module#gaadbf059bc28ce1cf94c57c1454633d40) (const Polynomials &poly, const T &x) | | | | template<typename RootVector , typename Polynomial > | | void | [Eigen::roots\_to\_monicPolynomial](group__polynomials__module#gafbc3648f7ef67db3d5d04454fc1257fd) (const RootVector &rv, Polynomial &poly) | | | cauchy\_max\_bound() -------------------- template<typename Polynomial > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [NumTraits](../structeigen_1_1numtraits)<typename Polynomial::Scalar>::Real Eigen::cauchy\_max\_bound | ( | const Polynomial & | *poly* | ) | | | inline | Returns a maximum bound for the absolute value of any root of the polynomial. Parameters | | | | | --- | --- | --- | | [in] | poly | : the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. \( 1 + 3x^2 \) is stored as a vector \( [ 1, 0, 3 ] \). | Precondition the leading coefficient of the input polynomial poly must be non zero cauchy\_min\_bound() -------------------- template<typename Polynomial > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [NumTraits](../structeigen_1_1numtraits)<typename Polynomial::Scalar>::Real Eigen::cauchy\_min\_bound | ( | const Polynomial & | *poly* | ) | | | inline | Returns a minimum bound for the absolute value of any non zero root of the polynomial. Parameters | | | | | --- | --- | --- | | [in] | poly | : the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. \( 1 + 3x^2 \) is stored as a vector \( [ 1, 0, 3 ] \). | poly\_eval() ------------ template<typename Polynomials , typename T > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | T Eigen::poly\_eval | ( | const Polynomials & | *poly*, | | | | const T & | *x* | | | ) | | | | inline | Returns the evaluation of the polynomial at x using stabilized Horner algorithm. Parameters | | | | | --- | --- | --- | | [in] | poly | : the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. \( 1 + 3x^2 \) is stored as a vector \( [ 1, 0, 3 ] \). | | [in] | x | : the value to evaluate the polynomial at. | poly\_eval\_horner() -------------------- template<typename Polynomials , typename T > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | T Eigen::poly\_eval\_horner | ( | const Polynomials & | *poly*, | | | | const T & | *x* | | | ) | | | | inline | Returns the evaluation of the polynomial at x using Horner algorithm. Parameters | | | | | --- | --- | --- | | [in] | poly | : the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. \( 1 + 3x^2 \) is stored as a vector \( [ 1, 0, 3 ] \). | | [in] | x | : the value to evaluate the polynomial at. | Note for stability: \( |x| \le 1 \) roots\_to\_monicPolynomial() ---------------------------- template<typename RootVector , typename Polynomial > | | | | | | --- | --- | --- | --- | | void Eigen::roots\_to\_monicPolynomial | ( | const RootVector & | *rv*, | | | | Polynomial & | *poly* | | | ) | | | Given the roots of a polynomial compute the coefficients in the monomial basis of the monic polynomial with same roots and minimal degree. If RootVector is a vector of complexes, Polynomial should also be a vector of complexes. Parameters | | | | | --- | --- | --- | | [in] | rv | : a vector containing the roots of a polynomial. | | [out] | poly | : the vector of coefficients of the polynomial ordered by degrees i.e. poly[i] is the coefficient of degree i of the polynomial e.g. \( 3 + x^2 \) is stored as a vector \( [ 3, 0, 1 ] \). | eigen3 TensorPatch TensorPatch =========== Tensor patch class. --- The documentation for this class was generated from the following file:* [TensorPatch.h](https://eigen.tuxfamily.org/dox/unsupported/TensorPatch_8h_source.html) eigen3 Eigen::Tensor Eigen::Tensor ============= ### template<typename Scalar\_, int NumIndices\_, int Options\_, typename IndexType\_> class Eigen::Tensor< Scalar\_, NumIndices\_, Options\_, IndexType\_ > The tensor class. The Tensor class is the work-horse for all *dense* tensors within [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). The Tensor class encompasses only dynamic-size objects so far. The first two template parameters are required: Template Parameters | | | | --- | --- | | Scalar\_ | Numeric type, e.g. float, double, int or `std::complex<float>`. User defined scalar types are supported as well (see [here](../topiccustomizing_customscalar#user_defined_scalars)). | | NumIndices\_ | Number of indices (i.e. rank of the tensor) | The remaining template parameters are optional – in most cases you don't have to worry about them. Template Parameters | | | | --- | --- | | Options\_ | A combination of either **[RowMajor](../group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f)** or **[ColMajor](../group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a0103672ae41005ab03b4176c765afd62)**, and of either **[AutoAlign](../group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13ad0e7f67d40bcde3d41c12849b16ce6ea)** or **[DontAlign](../group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a56908522e51443a0aa0567f879c2e78a)**. The former controls [storage order](../group__topicstorageorders), and defaults to column-major. The latter controls alignment, which is required for vectorization. It defaults to aligning tensors. Note that tensors currently do not support any operations that profit from vectorization. Support for such operations (i.e. adding two tensors etc.) is planned. | You can access elements of tensors using normal subscripting: ``` [Eigen::Tensor<double, 4>](classeigen_1_1tensor) t(10, 10, 10, 10); t(0, 1, 2, 3) = 42.0; ``` This class can be extended with the help of the plugin mechanism described on the page [Extending MatrixBase (and other classes)](../topiccustomizing_plugins) by defining the preprocessor symbol `EIGEN_TENSOR_PLUGIN`. ***Some notes:*** **Relation to other parts of [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."):** The midterm development goal for this class is to have a similar hierarchy as [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") uses for matrices, so that taking blocks or using tensors in expressions is easily possible, including an interface with the vector/matrix code by providing .asMatrix() and .asVector() (or similar) methods for rank 2 and 1 tensors. However, currently, the Tensor class does not provide any of these features and is only available as a stand-alone class that just allows for coefficient access. Also, when fixed-size tensors are implemented, the number of template arguments is likely to change dramatically. [Storage orders](../group__topicstorageorders) | | | --- | | | | void | [resize](classeigen_1_1tensor#ade5949755478e59ad152dd952d6a8636) (const array< Index, NumIndices > &dimensions) | | | | template<typename std::ptrdiff\_t... Indices> | | void | [resize](classeigen_1_1tensor#a903e6654bc86b4abe01ddba12dc17223) (const Sizes< Indices... > &dimensions) | | | | | [Tensor](classeigen_1_1tensor#a9d0f7b1474af9b4e76cb4e544c2bb03c) (const array< Index, NumIndices > &dimensions) | | | Tensor() -------- template<typename Scalar\_ , int NumIndices\_, int Options\_, typename IndexType\_ > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Tensor](classeigen_1_1tensor)< Scalar\_, NumIndices\_, Options\_, IndexType\_ >::[Tensor](classeigen_1_1tensor) | ( | const array< Index, NumIndices > & | *dimensions* | ) | | | inlineexplicit | Normal Dimension resize() [1/2] -------------- template<typename Scalar\_ , int NumIndices\_, int Options\_, typename IndexType\_ > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::Tensor](classeigen_1_1tensor)< Scalar\_, NumIndices\_, Options\_, IndexType\_ >::resize | ( | const array< Index, NumIndices > & | *dimensions* | ) | | | inline | Normal Dimension resize() [2/2] -------------- template<typename Scalar\_ , int NumIndices\_, int Options\_, typename IndexType\_ > template<typename std::ptrdiff\_t... Indices> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::Tensor](classeigen_1_1tensor)< Scalar\_, NumIndices\_, Options\_, IndexType\_ >::resize | ( | const Sizes< Indices... > & | *dimensions* | ) | | | inline | Custom Dimension --- The documentation for this class was generated from the following file:* [Tensor.h](https://eigen.tuxfamily.org/dox/unsupported/Tensor_8h_source.html) eigen3 Eigen::RandomSetter Eigen::RandomSetter =================== ### template<typename SparseMatrixType, template< typename T > class MapTraits = StdMapTraits, int OuterPacketBits = 6> class Eigen::RandomSetter< SparseMatrixType, MapTraits, OuterPacketBits > The [RandomSetter](classeigen_1_1randomsetter "The RandomSetter is a wrapper object allowing to set/update a sparse matrix with random access.") is a wrapper object allowing to set/update a sparse matrix with random access. Template Parameters | | | | --- | --- | | SparseMatrixType | the type of the sparse matrix we are updating | | MapTraits | a traits class representing the map implementation used for the temporary sparse storage. Its default value depends on the system. | | OuterPacketBits | defines the number of rows (or columns) manage by a single map object as a power of two exponent. | This class temporarily represents a sparse matrix object using a generic map implementation allowing for efficient random access. The conversion from the compressed representation to a hash\_map object is performed in the [RandomSetter](classeigen_1_1randomsetter "The RandomSetter is a wrapper object allowing to set/update a sparse matrix with random access.") constructor, while the sparse matrix is updated back at destruction time. This strategy suggest the use of nested blocks as in this example: ``` SparseMatrix<double> m(rows,cols); { RandomSetter<SparseMatrix<double> > w(m); // don't use m but w instead with read/write random access to the coefficients: for(;;) w(rand(),rand()) = rand; } // when w is deleted, the data are copied back to m // and m is ready to use. ``` Since hash\_map objects are not fully sorted, representing a full matrix as a single hash\_map would involve a big and costly sort to update the compressed matrix back. To overcome this issue, a [RandomSetter](classeigen_1_1randomsetter "The RandomSetter is a wrapper object allowing to set/update a sparse matrix with random access.") use multiple hash\_map, each representing 2^OuterPacketBits columns or rows according to the storage order. To reach optimal performance, this value should be adjusted according to the average number of nonzeros per rows/columns. The possible values for the template parameter MapTraits are: * **[StdMapTraits](structeigen_1_1stdmaptraits):** corresponds to std::map. (does not perform very well) * **GnuHashMapTraits:** corresponds to \_\_gnu\_cxx::hash\_map (available only with GCC) * **GoogleDenseHashMapTraits:** corresponds to google::dense\_hash\_map (best efficiency, reasonable memory consumption) * **GoogleSparseHashMapTraits:** corresponds to google::sparse\_hash\_map (best memory consumption, relatively good performance) The default map implementation depends on the availability, and the preferred order is: GoogleSparseHashMapTraits, GnuHashMapTraits, and finally [StdMapTraits](structeigen_1_1stdmaptraits). For performance and memory consumption reasons it is highly recommended to use one of Google's hash\_map implementations. To enable the support for them, you must define EIGEN\_GOOGLEHASH\_SUPPORT. This will include both <google/dense\_hash\_map> and <google/sparse\_hash\_map> for you. See also <https://github.com/sparsehash/sparsehash> | | | --- | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [nonZeros](classeigen_1_1randomsetter#ac34e5cd67e370641c3b48c8a91705046) () const | | | | Scalar & | [operator()](classeigen_1_1randomsetter#a77dcbbc964b42027e00af269a5147c68) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) | | | | | [RandomSetter](classeigen_1_1randomsetter#a62e960bd52cec62a59ebb285f381138f) (SparseMatrixType &target) | | | | | [~RandomSetter](classeigen_1_1randomsetter#a3e4a78672df59ab4dd2799919b431027) () | | | RandomSetter() -------------- template<typename SparseMatrixType , template< typename T > class MapTraits = StdMapTraits, int OuterPacketBits = 6> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::RandomSetter](classeigen_1_1randomsetter)< SparseMatrixType, MapTraits, OuterPacketBits >::[RandomSetter](classeigen_1_1randomsetter) | ( | SparseMatrixType & | *target* | ) | | | inline | Constructs a random setter object from the sparse matrix *target* Note that the initial value of *target* are imported. If you want to re-set a sparse matrix from scratch, then you must set it to zero first using the setZero() function. ~RandomSetter() --------------- template<typename SparseMatrixType , template< typename T > class MapTraits = StdMapTraits, int OuterPacketBits = 6> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::RandomSetter](classeigen_1_1randomsetter)< SparseMatrixType, MapTraits, OuterPacketBits >::~[RandomSetter](classeigen_1_1randomsetter) | ( | | ) | | | inline | Destructor updating back the sparse matrix target nonZeros() ---------- template<typename SparseMatrixType , template< typename T > class MapTraits = StdMapTraits, int OuterPacketBits = 6> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::RandomSetter](classeigen_1_1randomsetter)< SparseMatrixType, MapTraits, OuterPacketBits >::nonZeros | ( | | ) | const | | inline | Returns the number of non zero coefficients Note According to the underlying map/hash\_map implementation, this function might be quite expensive. operator()() ------------ template<typename SparseMatrixType , template< typename T > class MapTraits = StdMapTraits, int OuterPacketBits = 6> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& [Eigen::RandomSetter](classeigen_1_1randomsetter)< SparseMatrixType, MapTraits, OuterPacketBits >::operator() | ( | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *row*, | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *col* | | | ) | | | | inline | Returns a reference to the coefficient at given coordinates *row*, *col* --- The documentation for this class was generated from the following file:* [RandomSetter.h](https://eigen.tuxfamily.org/dox/unsupported/RandomSetter_8h_source.html) eigen3 Tensor Module Tensor Module ============= This module provides a Tensor class for storing arbitrarily indexed objects. ``` #include <Eigen/CXX11/Tensor> ``` Much of the documentation can be found [here](eigen_tensors). | | | --- | | | | class | [Eigen::Tensor< Scalar\_, NumIndices\_, Options\_, IndexType\_ >](classeigen_1_1tensor) | | | The tensor class. [More...](classeigen_1_1tensor#details) | | | | class | [TensorAssign](classtensorassign) | | | The tensor assignment class. [More...](classtensorassign#details) | | | | class | [Eigen::TensorAsyncDevice< ExpressionType, DeviceType, DoneCallback >](classeigen_1_1tensorasyncdevice) | | | Pseudo expression providing an operator = that will evaluate its argument asynchronously on the specified device. Currently only ThreadPoolDevice implements proper asynchronous execution, while the default and GPU devices just run the expression synchronously and call m\_done() on completion.. [More...](classeigen_1_1tensorasyncdevice#details) | | | | class | [Eigen::TensorBase< Derived, AccessLevel >](classeigen_1_1tensorbase) | | | The tensor base class. [More...](classeigen_1_1tensorbase#details) | | | | class | [TensorBroadcasting](classtensorbroadcasting) | | | Tensor broadcasting class. [More...](classtensorbroadcasting#details) | | | | class | [Eigen::TensorConcatenationOp< Axis, LhsXprType, RhsXprType >](classeigen_1_1tensorconcatenationop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") concatenation class. [More...](classeigen_1_1tensorconcatenationop#details) | | | | class | [TensorContraction](classtensorcontraction) | | | Tensor contraction class. [More...](classtensorcontraction#details) | | | | class | [Eigen::TensorConversionOp< TargetType, XprType >](classeigen_1_1tensorconversionop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") conversion class. This class makes it possible to vectorize type casting operations when the number of scalars per packet in the source and the destination type differ. [More...](classeigen_1_1tensorconversionop#details) | | | | class | [TensorConvolution](classtensorconvolution) | | | Tensor convolution class. [More...](classtensorconvolution#details) | | | | class | [Eigen::TensorCustomBinaryOp< CustomBinaryFunc, LhsXprType, RhsXprType >](classeigen_1_1tensorcustombinaryop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") custom class. [More...](classeigen_1_1tensorcustombinaryop#details) | | | | class | [Eigen::TensorCustomUnaryOp< CustomUnaryFunc, XprType >](classeigen_1_1tensorcustomunaryop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") custom class. [More...](classeigen_1_1tensorcustomunaryop#details) | | | | class | [Eigen::TensorDevice< ExpressionType, DeviceType >](classeigen_1_1tensordevice) | | | Pseudo expression providing an operator = that will evaluate its argument on the specified computing 'device' (GPU, thread pool, ...) [More...](classeigen_1_1tensordevice#details) | | | | class | [Eigen::TensorEvaluator< Derived, Device >](structeigen_1_1tensorevaluator) | | | A cost model used to limit the number of threads used for evaluating tensor expression. [More...](structeigen_1_1tensorevaluator#details) | | | | class | [TensorExecutor](classtensorexecutor) | | | The tensor executor class. [More...](classtensorexecutor#details) | | | | class | [TensorExpr](classtensorexpr) | | | Tensor expression classes. [More...](classtensorexpr#details) | | | | class | [TensorFFT](classtensorfft) | | | Tensor FFT class. [More...](classtensorfft#details) | | | | class | [Eigen::TensorFixedSize< Scalar\_, Dimensions\_, Options\_, IndexType >](classeigen_1_1tensorfixedsize) | | | The fixed sized version of the tensor class. [More...](classeigen_1_1tensorfixedsize#details) | | | | class | [TensorForcedEval](classtensorforcedeval) | | | Tensor reshaping class. [More...](classtensorforcedeval#details) | | | | class | [Eigen::TensorGeneratorOp< Generator, XprType >](classeigen_1_1tensorgeneratorop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") generator class. [More...](classeigen_1_1tensorgeneratorop#details) | | | | class | [TensorImagePatch](classtensorimagepatch) | | | Patch extraction specialized for image processing. This assumes that the input has a least 3 dimensions ordered as follow: 1st dimension: channels (of size d) 2nd dimension: rows (of size r) 3rd dimension: columns (of size c) There can be additional dimensions such as time (for video) or batch (for bulk processing after the first 3. Calling the image patch code with patch\_rows and patch\_cols is equivalent to calling the regular patch extraction code with parameters d, patch\_rows, patch\_cols, and 1 for all the additional dimensions. [More...](classtensorimagepatch#details) | | | | class | [TensorIndexTuple](classtensorindextuple) | | | Tensor + Index Tuple class. [More...](classtensorindextuple#details) | | | | class | [TensorInflation](classtensorinflation) | | | Tensor inflation class. [More...](classtensorinflation#details) | | | | class | [TensorKChippingReshaping](classtensorkchippingreshaping) | | | A chip is a thin slice, corresponding to a column or a row in a 2-d tensor. [More...](classtensorkchippingreshaping#details) | | | | class | [TensorLayoutSwap](classtensorlayoutswap) | | | Swap the layout from col-major to row-major, or row-major to col-major, and invert the order of the dimensions. [More...](classtensorlayoutswap#details) | | | | class | [Eigen::TensorMap< PlainObjectType, Options\_, MakePointer\_ >](classeigen_1_1tensormap) | | | A tensor expression mapping an existing array of data. [More...](classeigen_1_1tensormap#details) | | | | class | [TensorPadding](classtensorpadding) | | | Tensor padding class. At the moment only padding with a constant value is supported. [More...](classtensorpadding#details) | | | | class | [TensorPatch](classtensorpatch) | | | Tensor patch class. [More...](classtensorpatch#details) | | | | class | [TensorReduction](classtensorreduction) | | | Tensor reduction class. [More...](classtensorreduction#details) | | | | class | [Eigen::TensorRef< PlainObjectType >](classeigen_1_1tensorref) | | | A reference to a tensor expression The expression will be evaluated lazily (as much as possible). [More...](classeigen_1_1tensorref#details) | | | | class | [TensorReshaping](classtensorreshaping) | | | Tensor reshaping class. [More...](classtensorreshaping#details) | | | | class | [TensorReverse](classtensorreverse) | | | Tensor reverse elements class. [More...](classtensorreverse#details) | | | | class | [TensorScan](classtensorscan) | | | Tensor scan class. [More...](classtensorscan#details) | | | | class | [TensorShuffling](classtensorshuffling) | | | Tensor shuffling class. [More...](classtensorshuffling#details) | | | | class | [TensorSlicing](classtensorslicing) | | | Tensor slicing class. [More...](classtensorslicing#details) | | | | class | [TensorStriding](classtensorstriding) | | | Tensor striding class. [More...](classtensorstriding#details) | | | | class | [TensorTrace](classtensortrace) | | | Tensor Trace class. [More...](classtensortrace#details) | | | | class | [TensorTupleIndex](classtensortupleindex) | | | Converts to Tensor<Tuple<Index, Scalar> > and reduces to Tensor<Index>. [More...](classtensortupleindex#details) | | | | class | [TensorVolumePatch](classtensorvolumepatch) | | | Patch extraction specialized for processing of volumetric data. This assumes that the input has a least 4 dimensions ordered as follows: [More...](classtensorvolumepatch#details) | | |
programming_docs
eigen3 Eigen::KroneckerProductSparse Eigen::KroneckerProductSparse ============================= ### template<typename Lhs, typename Rhs> class Eigen::KroneckerProductSparse< Lhs, Rhs > Kronecker tensor product helper class for sparse matrices. If at least one of the operands is a sparse matrix expression, then this class is returned and evaluates into a sparse matrix. This class is the return value of kroneckerProduct([EigenBase](../structeigen_1_1eigenbase), [EigenBase](../structeigen_1_1eigenbase)). Use the function rather than construct this class directly to avoid specifying template prarameters. Template Parameters | | | | --- | --- | | Lhs | Type of the left-hand side, a matrix expression. | | Rhs | Type of the rignt-hand side, a matrix expression. | | | | --- | | | | template<typename Dest > | | void | [evalTo](classeigen_1_1kroneckerproductsparse#a8b7269c23294765e0965b70b5af2557b) (Dest &dst) const | | | Evaluate the Kronecker tensor product. | | | | | [KroneckerProductSparse](classeigen_1_1kroneckerproductsparse#ac0a69ba844415fbe79e6514f32b41fb5) (const Lhs &A, const Rhs &B) | | | Constructor. | | | | Public Member Functions inherited from [Eigen::KroneckerProductBase< KroneckerProductSparse< Lhs, Rhs > >](classeigen_1_1kroneckerproductbase) | | Scalar | [coeff](classeigen_1_1kroneckerproductbase#a673348e7d9d2a4570aa0bcac33507f7b) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) const | | | | Scalar | [coeff](classeigen_1_1kroneckerproductbase#a0b302d4e55f5a58955e6c645d066928f) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) const | | | | | [KroneckerProductBase](classeigen_1_1kroneckerproductbase#a0cb05eaa978b9fdc0285b48a6e0ecfb1) (const Lhs &A, const Rhs &B) | | | Constructor. | | | --- The documentation for this class was generated from the following file:* [KroneckerTensorProduct.h](https://eigen.tuxfamily.org/dox/unsupported/KroneckerTensorProduct_8h_source.html) eigen3 TensorExecutor TensorExecutor ============== The tensor executor class. This class is responsible for launch the evaluation of the expression on the specified computing device. Template Parameters | | | | --- | --- | | Vectorizable | can use packet math (SSE/AVX/etc... registers and instructions) | | Tiling | can use block based tensor evaluation (see [TensorBlock.h](https://eigen.tuxfamily.org/dox/unsupported/TensorBlock_8h_source.html)) | --- The documentation for this class was generated from the following file:* [TensorExecutor.h](https://eigen.tuxfamily.org/dox/unsupported/TensorExecutor_8h_source.html) eigen3 Eigen::KroneckerProduct Eigen::KroneckerProduct ======================= ### template<typename Lhs, typename Rhs> class Eigen::KroneckerProduct< Lhs, Rhs > Kronecker tensor product helper class for dense matrices. This class is the return value of kroneckerProduct([MatrixBase](../classeigen_1_1matrixbase), [MatrixBase](../classeigen_1_1matrixbase)). Use the function rather than construct this class directly to avoid specifying template prarameters. Template Parameters | | | | --- | --- | | Lhs | Type of the left-hand side, a matrix expression. | | Rhs | Type of the rignt-hand side, a matrix expression. | | | | --- | | | | template<typename Dest > | | void | [evalTo](classeigen_1_1kroneckerproduct#a10f65aca36ed69da354e70b300b5a223) (Dest &dst) const | | | Evaluate the Kronecker tensor product. | | | | | [KroneckerProduct](classeigen_1_1kroneckerproduct#a0b01b6d5ae2413cef8fd91fe7a98a0d7) (const Lhs &A, const Rhs &B) | | | Constructor. | | | | Public Member Functions inherited from [Eigen::KroneckerProductBase< KroneckerProduct< Lhs, Rhs > >](classeigen_1_1kroneckerproductbase) | | Scalar | [coeff](classeigen_1_1kroneckerproductbase#a673348e7d9d2a4570aa0bcac33507f7b) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) const | | | | Scalar | [coeff](classeigen_1_1kroneckerproductbase#a0b302d4e55f5a58955e6c645d066928f) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) const | | | | | [KroneckerProductBase](classeigen_1_1kroneckerproductbase#a0cb05eaa978b9fdc0285b48a6e0ecfb1) (const Lhs &A, const Rhs &B) | | | Constructor. | | | --- The documentation for this class was generated from the following file:* [KroneckerTensorProduct.h](https://eigen.tuxfamily.org/dox/unsupported/KroneckerTensorProduct_8h_source.html) eigen3 TensorSlicing TensorSlicing ============= Tensor slicing class. --- The documentation for this class was generated from the following file:* [TensorMorphing.h](https://eigen.tuxfamily.org/dox/unsupported/TensorMorphing_8h_source.html) eigen3 Eigen::NumericalDiff Eigen::NumericalDiff ==================== ### template<typename \_Functor, NumericalDiffMode mode = Forward> class Eigen::NumericalDiff< \_Functor, mode > This class allows you to add a method [df()](classeigen_1_1numericaldiff#a8fc63f1c3307cc6e61dc4d70c57b5037) to your functor, which will use numerical differentiation to compute an approximate of the derivative for the functor. Of course, if you have an analytical form for the derivative, you should rather implement [df()](classeigen_1_1numericaldiff#a8fc63f1c3307cc6e61dc4d70c57b5037) by yourself. More information on <http://en.wikipedia.org/wiki/Numerical_differentiation> Currently only "Forward" and "Central" scheme are implemented. Inherits \_Functor. | | | --- | | | | int | [df](classeigen_1_1numericaldiff#a8fc63f1c3307cc6e61dc4d70c57b5037) (const InputType &\_x, JacobianType &jac) const | | | df() ---- template<typename \_Functor , NumericalDiffMode mode = Forward> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | int [Eigen::NumericalDiff](classeigen_1_1numericaldiff)< \_Functor, mode >::df | ( | const InputType & | *\_x*, | | | | JacobianType & | *jac* | | | ) | | const | | inline | return the number of evaluation of functor --- The documentation for this class was generated from the following file:* [NumericalDiff.h](https://eigen.tuxfamily.org/dox/unsupported/NumericalDiff_8h_source.html) eigen3 TensorConvolution TensorConvolution ================= Tensor convolution class. --- The documentation for this class was generated from the following files:* [TensorConvolution.h](https://eigen.tuxfamily.org/dox/unsupported/TensorConvolution_8h_source.html) * [TensorConvolutionSycl.h](https://eigen.tuxfamily.org/dox/unsupported/TensorConvolutionSycl_8h_source.html) eigen3 TensorPadding TensorPadding ============= Tensor padding class. At the moment only padding with a constant value is supported. --- The documentation for this class was generated from the following file:* [TensorPadding.h](https://eigen.tuxfamily.org/dox/unsupported/TensorPadding_8h_source.html) eigen3 Eigen::SkylineInplaceLU Eigen::SkylineInplaceLU ======================= ### template<typename MatrixType> class Eigen::SkylineInplaceLU< MatrixType > Inplace LU decomposition of a skyline matrix and associated features. Parameters | | | | --- | --- | | MatrixType | the type of the matrix of which we are computing the LU factorization | | | | --- | | | | void | [compute](classeigen_1_1skylineinplacelu#a590e9a988b2843712a29a541787e6c38) () | | | | int | [flags](classeigen_1_1skylineinplacelu#a5e491f7643c548ac81d3f4a7e432be19) () const | | | | RealScalar | [precision](classeigen_1_1skylineinplacelu#a050bcbe008f2ddeea4f6d5872e0daca5) () const | | | | void | [setFlags](classeigen_1_1skylineinplacelu#afd8013d183aaca495dfd10d819e61aaf) (int f) | | | | void | [setPrecision](classeigen_1_1skylineinplacelu#a1c057a7dec39b8b196d49d7d411ea999) (RealScalar v) | | | | | [SkylineInplaceLU](classeigen_1_1skylineinplacelu#ac76b9384281e73b86b80f770015cf436) (MatrixType &matrix, int [flags](classeigen_1_1skylineinplacelu#a5e491f7643c548ac81d3f4a7e432be19)=0) | | | | template<typename BDerived , typename XDerived > | | bool | [solve](classeigen_1_1skylineinplacelu#a53c846d76559221d2bcf336a2da4d68f) (const [MatrixBase](../classeigen_1_1matrixbase)< BDerived > &b, [MatrixBase](../classeigen_1_1matrixbase)< XDerived > \*x, const int transposed=0) const | | | | bool | [succeeded](classeigen_1_1skylineinplacelu#abd633c27a0a342fb392b6af3ceb800ba) (void) const | | | SkylineInplaceLU() ------------------ template<typename MatrixType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::[SkylineInplaceLU](classeigen_1_1skylineinplacelu) | ( | MatrixType & | *matrix*, | | | | int | *flags* = `0` | | | ) | | | | inline | Creates a LU object and compute the respective factorization of *matrix* using flags *flags*. compute() --------- template<typename MatrixType > | | | --- | | void [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::compute | Computes/re-computes the LU factorization Computes / recomputes the in place LU decomposition of the [SkylineInplaceLU](classeigen_1_1skylineinplacelu "Inplace LU decomposition of a skyline matrix and associated features."). using the default algorithm. flags() ------- template<typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | int [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::flags | ( | | ) | const | | inline | Returns the current flags precision() ----------- template<typename MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::precision | ( | | ) | const | | inline | Returns the current precision. See also [setPrecision()](classeigen_1_1skylineinplacelu#a1c057a7dec39b8b196d49d7d411ea999) setFlags() ---------- template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::setFlags | ( | int | *f* | ) | | | inline | Sets the flags. Possible values are: * CompleteFactorization * IncompleteFactorization * MemoryEfficient * one of the ordering methods * etc... See also [flags()](classeigen_1_1skylineinplacelu#a5e491f7643c548ac81d3f4a7e432be19) setPrecision() -------------- template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::setPrecision | ( | RealScalar | *v* | ) | | | inline | Sets the relative threshold value used to prune zero coefficients during the decomposition. Setting a value greater than zero speeds up computation, and yields to an incomplete factorization with fewer non zero coefficients. Such approximate factors are especially useful to initialize an iterative solver. Note that the exact meaning of this parameter might depends on the actual backend. Moreover, not all backends support this feature. See also [precision()](classeigen_1_1skylineinplacelu#a050bcbe008f2ddeea4f6d5872e0daca5) solve() ------- template<typename MatrixType > template<typename BDerived , typename XDerived > | | | | | | --- | --- | --- | --- | | bool [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::solve | ( | const [MatrixBase](../classeigen_1_1matrixbase)< BDerived > & | *b*, | | | | [MatrixBase](../classeigen_1_1matrixbase)< XDerived > \* | *x*, | | | | const int | *transposed* = `0` | | | ) | | const | Returns the lower triangular matrix L the upper triangular matrix U Computes \*x = U^-1 L^-1 b If *transpose* is set to SvTranspose or SvAdjoint, the solution of the transposed/adjoint system is computed instead. Not all backends implement the solution of the transposed or adjoint system. succeeded() ----------- template<typename MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | bool [Eigen::SkylineInplaceLU](classeigen_1_1skylineinplacelu)< MatrixType >::succeeded | ( | void | | ) | const | | inline | Returns true if the factorization succeeded --- The documentation for this class was generated from the following file:* [SkylineInplaceLU.h](https://eigen.tuxfamily.org/dox/unsupported/SkylineInplaceLU_8h_source.html) eigen3 TensorExpr TensorExpr ========== Tensor expression classes. The TensorCwiseNullaryOp class applies a nullary operators to an expression. This is typically used to generate constants. The TensorCwiseUnaryOp class represents an expression where a unary operator (e.g. cwiseSqrt) is applied to an expression. The TensorCwiseBinaryOp class represents an expression where a binary operator (e.g. addition) is applied to a lhs and a rhs expression. --- The documentation for this class was generated from the following file:* [TensorExpr.h](https://eigen.tuxfamily.org/dox/unsupported/TensorExpr_8h_source.html) eigen3 TensorForcedEval TensorForcedEval ================ Tensor reshaping class. --- The documentation for this class was generated from the following files:* [TensorEvalTo.h](https://eigen.tuxfamily.org/dox/unsupported/TensorEvalTo_8h_source.html) * [TensorForcedEval.h](https://eigen.tuxfamily.org/dox/unsupported/TensorForcedEval_8h_source.html) eigen3 Deprecated List Deprecated List =============== Class [Eigen::DynamicSparseMatrix< \_Scalar, \_Options, \_StorageIndex >](classeigen_1_1dynamicsparsematrix) use a [SparseMatrix](../classeigen_1_1sparsematrix) in an uncompressed mode Member [Eigen::DynamicSparseMatrix< \_Scalar, \_Options, \_StorageIndex >::endFill](classeigen_1_1dynamicsparsematrix#aa806b3dde0a055844110610907b016f3) () use [finalize()](classeigen_1_1dynamicsparsematrix#aa0abc0e4565143f103f0d7373bd4a125) Does nothing. Provided for compatibility with [SparseMatrix](../classeigen_1_1sparsematrix). Member [Eigen::DynamicSparseMatrix< \_Scalar, \_Options, \_StorageIndex >::fill](classeigen_1_1dynamicsparsematrix#a70c8f529b38fd5b7d93d6dfe1a122723) (Index row, Index col) use insert() inserts a nonzero coefficient at given coordinates *row*, *col* and returns its reference assuming that: 1 - the coefficient does not exist yet 2 - this the coefficient with greater inner coordinate for the given outer coordinate. In other words, assuming `*this` is column-major, then there must not exists any nonzero coefficient of coordinates `i` `x` *col* such that `i` >= *row*. Otherwise the matrix is invalid. Member [Eigen::DynamicSparseMatrix< \_Scalar, \_Options, \_StorageIndex >::fillrand](classeigen_1_1dynamicsparsematrix#a6a5eb3c9d153d8ebdf4e0967321108e2) (Index row, Index col) use insert() Like [fill()](classeigen_1_1dynamicsparsematrix#a70c8f529b38fd5b7d93d6dfe1a122723) but with random inner coordinates. Compared to the generic [coeffRef()](classeigen_1_1dynamicsparsematrix#a17093cd39bd0e6ebd6250bc5feb61a0f), the unique limitation is that we assume the coefficient does not exist yet. Member [Eigen::DynamicSparseMatrix< \_Scalar, \_Options, \_StorageIndex >::startFill](classeigen_1_1dynamicsparsematrix#abade0bf46139d8577aa24ead30c76771) (Index reserveSize=1000) Set the matrix to zero and reserve the memory for *reserveSize* nonzero coefficients. eigen3 Eigen::TensorFixedSize Eigen::TensorFixedSize ====================== ### template<typename Scalar\_, typename Dimensions\_, int Options\_, typename IndexType> class Eigen::TensorFixedSize< Scalar\_, Dimensions\_, Options\_, IndexType > The fixed sized version of the tensor class. The fixed sized equivalent of Eigen::Tensor<float, 3> t(3, 5, 7); is [Eigen::TensorFixedSize](classeigen_1_1tensorfixedsize "The fixed sized version of the tensor class.")<float, Sizes<3,5,7>> t; --- The documentation for this class was generated from the following file:* [TensorFixedSize.h](https://eigen.tuxfamily.org/dox/unsupported/TensorFixedSize_8h_source.html) eigen3 Eigen::NumTraits Eigen::NumTraits ================ ``` \defgroup MPRealSupport_Module MPFRC++ Support module \code #include <Eigen/MPRealSupport> \endcode This module provides support for multi precision floating point numbers via the <a href="http://www.holoborodko.com/pavel/mpfr">MPFR C++</a> library which itself is built upon <a href="http://www.mpfr.org/">MPFR</a>/<a href="http://gmplib.org/">GMP</a>. \warning MPFR C++ is licensed under the GPL. You can find a copy of MPFR C++ that is known to be compatible in the unsupported/test/mpreal folder. Here is an example: ``` ``` #include <iostream> #include <Eigen/MPRealSupport> #include <Eigen/LU> using namespace mpfr; using namespace [Eigen](namespaceeigen); int main() { // set precision to 256 bits (double has only 53 bits) mpreal::set_default_prec(256); // Declare matrix and vector types with multi-precision scalar type typedef Matrix<mpreal,Dynamic,Dynamic> MatrixXmp; typedef Matrix<mpreal,Dynamic,1> VectorXmp; MatrixXmp A = MatrixXmp::Random(100,100); VectorXmp b = VectorXmp::Random(100); // Solve Ax=b using LU VectorXmp x = A.lu().solve(b); std::cout << "relative error: " << (A*x - b).norm() / b.norm() << std::endl; return 0; } ``` Inherits GenericNumTraits< mpfr::mpreal >. --- The documentation for this struct was generated from the following file:* MPRealSupport eigen3 Eigen::TensorGeneratorOp Eigen::TensorGeneratorOp ======================== ### template<typename Generator, typename XprType> class Eigen::TensorGeneratorOp< Generator, XprType > [Tensor](classeigen_1_1tensor "The tensor class.") generator class. --- The documentation for this class was generated from the following files:* [TensorForwardDeclarations.h](https://eigen.tuxfamily.org/dox/unsupported/TensorForwardDeclarations_8h_source.html) * [TensorGenerator.h](https://eigen.tuxfamily.org/dox/unsupported/TensorGenerator_8h_source.html) eigen3 TensorTupleIndex TensorTupleIndex ================ Converts to Tensor<Tuple<Index, Scalar> > and reduces to Tensor<Index>. --- The documentation for this class was generated from the following file:* [TensorArgMax.h](https://eigen.tuxfamily.org/dox/unsupported/TensorArgMax_8h_source.html) eigen3 EulerAngles module EulerAngles module ================== This module provides generic euler angles rotation. Euler angles are a way to represent 3D rotation. In order to use this module in your code, include this header: ``` #include <unsupported/Eigen/EulerAngles> ``` See [EulerAngles](classeigen_1_1eulerangles) for more information. | | | --- | | | | class | [Eigen::EulerAngles< \_Scalar, \_System >](classeigen_1_1eulerangles) | | | Represents a rotation in a 3 dimensional space as three Euler angles. [More...](classeigen_1_1eulerangles#details) | | | | class | [Eigen::EulerSystem< \_AlphaAxis, \_BetaAxis, \_GammaAxis >](classeigen_1_1eulersystem) | | | Represents a fixed Euler rotation system. [More...](classeigen_1_1eulersystem#details) | | | | | | --- | | | | enum | [Eigen::EulerAxis](group__eulerangles__module#gae614aa7cdd687fb5c421a54f2ce5c361) { [Eigen::EULER\_X](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361a11e1ea88cbe04a6fc077475d515d0b38) , [Eigen::EULER\_Y](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361aee756a2b63043248f3d83541386c266b) , [Eigen::EULER\_Z](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361a95187b9943820cca5edc4bc96b3c08be) } | | | Representation of a fixed signed rotation axis for EulerSystem. [More...](group__eulerangles__module#gae614aa7cdd687fb5c421a54f2ce5c361) | | | EulerAxis --------- | | | --- | | enum [Eigen::EulerAxis](group__eulerangles__module#gae614aa7cdd687fb5c421a54f2ce5c361) | Representation of a fixed signed rotation axis for [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system."). Values here represent: * The axis of the rotation: X, Y or Z. * The sign (i.e. direction of the rotation along the axis): positive(+) or negative(-) Therefore, this could express all the axes {+X,+Y,+Z,-X,-Y,-Z} For positive axis, use +EULER\_{axis}, and for negative axis use -EULER\_{axis}. | Enumerator | | --- | | EULER\_X | the X axis | | EULER\_Y | the Y axis | | EULER\_Z | the Z axis |
programming_docs
eigen3 Numerical differentiation module Numerical differentiation module ================================ ``` #include <unsupported/Eigen/NumericalDiff> ``` See <http://en.wikipedia.org/wiki/Numerical_differentiation> Warning : this should NOT be confused with automatic differentiation, which is a different method and has its own module in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") : [Auto Diff module](group__autodiff__module). Currently only "Forward" and "Central" schemes are implemented. Those are basic methods, and there exist some more elaborated way of computing such approximates. They are implemented using both proprietary and free software, and usually requires linking to an external library. It is very easy for you to write a functor using such software, and the purpose is quite orthogonal to what we want to achieve with [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). This is why we will not provide wrappers for every great numerical differentiation software that exist, but should rather stick with those basic ones, that still are useful for testing. Also, the [Non linear optimization module](group__nonlinearoptimization__module) needs this in order to provide full features compatibility with the original (c)minpack package. eigen3 TensorVolumePatch TensorVolumePatch ================= Patch extraction specialized for processing of volumetric data. This assumes that the input has a least 4 dimensions ordered as follows: * channels * planes * rows * columns * (optional) additional dimensions such as time or batch size. Calling the volume patch code with patch\_planes, patch\_rows, and patch\_cols is equivalent to calling the regular patch extraction code with parameters d, patch\_planes, patch\_rows, patch\_cols, and 1 for all the additional dimensions. --- The documentation for this class was generated from the following file:* [TensorVolumePatch.h](https://eigen.tuxfamily.org/dox/unsupported/TensorVolumePatch_8h_source.html) eigen3 Eigen::SGroup Eigen::SGroup ============= ### template<typename... Gen> class Eigen::SGroup< Gen > Symmetry group, initialized from template arguments. This class represents a symmetry group whose generators are already known at compile time. It may or may not be resolved at compile time, depending on the estimated size of the group. See also [StaticSGroup](classeigen_1_1staticsgroup "Static symmetry group.") [DynamicSGroup](classeigen_1_1dynamicsgroup "Dynamic symmetry group.") Inherits internal::tensor\_symmetry\_pre\_analysis::root\_type. --- The documentation for this class was generated from the following file:* [Symmetry.h](https://eigen.tuxfamily.org/dox/unsupported/Symmetry_8h_source.html) eigen3 Eigen Tensors Eigen Tensors ============= Tensors are multidimensional arrays of elements. Elements are typically scalars, but more complex types such as strings are also supported. Tensor Classes ================ You can manipulate a tensor with one of the following classes. They all are in the namespace `[Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.").` Class Tensor<data\_type, rank> -------------------------------- This is the class to use to create a tensor and allocate memory for it. The class is templatized with the tensor datatype, such as float or int, and the tensor rank. The rank is the number of dimensions, for example rank 2 is a matrix. Tensors of this class are resizable. For example, if you assign a tensor of a different size to a Tensor, that tensor is resized to match its new value. ### Constructor Tensor<data\_type, rank>(size0, size1, ...) Constructor for a Tensor. The constructor must be passed `rank` integers indicating the sizes of the instance along each of the the `rank` dimensions. ``` // Create a tensor of rank 3 of sizes 2, 3, 4. This tensor owns // memory to hold 24 floating point values (24 = 2 x 3 x 4). Tensor<float, 3> t_3d(2, 3, 4); // Resize t_3d by assigning a tensor of different sizes, but same rank. t_3d = Tensor<float, 3>(3, 4, 3); ``` ### Constructor Tensor<data\_type, rank>(size\_array) Constructor where the sizes for the constructor are specified as an array of values instead of an explicitly list of parameters. The array type to use is `Eigen::array<[Eigen::Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde)>`. The array can be constructed automatically from an initializer list. ``` // Create a tensor of strings of rank 2 with sizes 5, 7. Tensor<string, 2> t_2d({5, 7}); ``` Class TensorFixedSize<data\_type, Sizes<size0, size1, ...>> ------------------------------------------------------------- Class to use for tensors of fixed size, where the size is known at compile time. Fixed sized tensors can provide very fast computations because all their dimensions are known by the compiler. FixedSize tensors are not resizable. If the total number of elements in a fixed size tensor is small enough the tensor data is held onto the stack and does not cause heap allocation and free. ``` // Create a 4 x 3 tensor of floats. TensorFixedSize<float, Sizes<4, 3>> t_4x3; ``` Class TensorMap<Tensor<data\_type, rank>> ------------------------------------------- This is the class to use to create a tensor on top of memory allocated and owned by another part of your code. It allows to view any piece of allocated memory as a Tensor. Instances of this class do not own the memory where the data are stored. A TensorMap is not resizable because it does not own the memory where its data are stored. ### Constructor TensorMap<Tensor<data\_type, rank>>(data, size0, size1, ...) Constructor for a Tensor. The constructor must be passed a pointer to the storage for the data, and "rank" size attributes. The storage has to be large enough to hold all the data. ``` // Map a tensor of ints on top of stack-allocated storage. int storage[128]; // 2 x 4 x 2 x 8 = 128 TensorMap<Tensor<int, 4>> t_4d(storage, 2, 4, 2, 8); // The same storage can be viewed as a different tensor. // You can also pass the sizes as an array. TensorMap<Tensor<int, 2>> t_2d(storage, 16, 8); // You can also map fixed-size tensors. Here we get a 1d view of // the 2d fixed-size tensor. TensorFixedSize<float, Sizes<4, 3>> t_4x3; TensorMap<Tensor<float, 1>> t_12(t_4x3.data(), 12); ``` ### Class TensorRef See Assigning to a TensorRef below. Accessing Tensor Elements =========================== ### <data\_type> tensor(index0, index1...) Return the element at position `(index0, index1...)` in tensor `tensor`. You must pass as many parameters as the rank of `tensor`. The expression can be used as an l-value to set the value of the element at the specified position. The value returned is of the datatype of the tensor. ``` // Set the value of the element at position (0, 1, 0); Tensor<float, 3> t_3d(2, 3, 4); t_3d(0, 1, 0) = 12.0f; // Initialize all elements to random values. for (int i = 0; i < 2; ++i) { for (int j = 0; j < 3; ++j) { for (int k = 0; k < 4; ++k) { t_3d(i, j, k) = ...some random value...; } } } // Print elements of a tensor. for (int i = 0; i < 2; ++i) { LOG(INFO) << t_3d(i, 0, 0); } ``` TensorLayout ============== The tensor library supports 2 layouts: `ColMajor` (the default) and `RowMajor`. Only the default column major layout is currently fully supported, and it is therefore not recommended to attempt to use the row major layout at the moment. The layout of a tensor is optionally specified as part of its type. If not specified explicitly column major is assumed. ``` Tensor<float, 3, ColMajor> col_major; // equivalent to Tensor<float, 3> TensorMap<Tensor<float, 3, RowMajor> > row_major(data, ...); ``` All the arguments to an expression must use the same layout. Attempting to mix different layouts will result in a compilation error. It is possible to change the layout of a tensor or an expression using the `swap_layout()` method. Note that this will also reverse the order of the dimensions. ``` Tensor<float, 2, ColMajor> col_major(2, 4); Tensor<float, 2, RowMajor> row_major(2, 4); Tensor<float, 2> col_major_result = col_major; // ok, layouts match Tensor<float, 2> col_major_result = row_major; // will not compile // Simple layout swap col_major_result = row_major.swap_layout(); eigen_assert(col_major_result.dimension(0) == 4); eigen_assert(col_major_result.dimension(1) == 2); // Swap the layout and preserve the order of the dimensions array<int, 2> shuffle(1, 0); col_major_result = row_major.swap_layout().shuffle(shuffle); eigen_assert(col_major_result.dimension(0) == 2); eigen_assert(col_major_result.dimension(1) == 4); ``` Tensor Operations =================== The [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") Tensor library provides a vast library of operations on Tensors: numerical operations such as addition and multiplication, geometry operations such as slicing and shuffling, etc. These operations are available as methods of the Tensor classes, and in some cases as operator overloads. For example the following code computes the elementwise addition of two tensors: ``` Tensor<float, 3> t1(2, 3, 4); ...set some values in t1... Tensor<float, 3> t2(2, 3, 4); ...set some values in t2... // Set t3 to the element wise sum of t1 and t2 Tensor<float, 3> t3 = t1 + t2; ``` While the code above looks easy enough, it is important to understand that the expression `t1 + t2` is not actually adding the values of the tensors. The expression instead constructs a "tensor operator" object of the class TensorCwiseBinaryOp<scalar\_sum>, which has references to the tensors `t1` and `t2`. This is a small C++ object that knows how to add `t1` and `t2`. It is only when the value of the expression is assigned to the tensor `t3` that the addition is actually performed. Technically, this happens through the overloading of `operator=()` in the Tensor class. This mechanism for computing tensor expressions allows for lazy evaluation and optimizations which are what make the tensor library very fast. Of course, the tensor operators do nest, and the expression `t1 + t2 * 0.3f` is actually represented with the (approximate) tree of operators: ``` TensorCwiseBinaryOp<scalar_sum>(t1, TensorCwiseUnaryOp<scalar_mul>(t2, 0.3f)) ``` Tensor Operations and C++ "auto" ---------------------------------- Because Tensor operations create tensor operators, the C++ `auto` keyword does not have its intuitive meaning. Consider these 2 lines of code: ``` Tensor<float, 3> t3 = t1 + t2; auto t4 = t1 + t2; ``` In the first line we allocate the tensor `t3` and it will contain the result of the addition of `t1` and `t2`. In the second line, `t4` is actually the tree of tensor operators that will compute the addition of `t1` and `t2`. In fact, `t4` is *not* a tensor and you cannot get the values of its elements: ``` Tensor<float, 3> t3 = t1 + t2; cout << t3(0, 0, 0); // OK prints the value of t1(0, 0, 0) + t2(0, 0, 0) auto t4 = t1 + t2; cout << t4(0, 0, 0); // Compilation error! ``` When you use `auto` you do not get a Tensor as a result but instead a non-evaluated expression. So only use `auto` to delay evaluation. Unfortunately, there is no single underlying concrete type for holding non-evaluated expressions, hence you have to use auto in the case when you do want to hold non-evaluated expressions. When you need the results of set of tensor computations you have to assign the result to a Tensor that will be capable of holding onto them. This can be either a normal Tensor, a fixed size Tensor, or a TensorMap on an existing piece of memory. All the following will work: ``` auto t4 = t1 + t2; Tensor<float, 3> result = t4; // Could also be: result(t4); cout << result(0, 0, 0); TensorMap<float, 4> result(<a float* with enough space>, <size0>, ...) = t4; cout << result(0, 0, 0); TensorFixedSize<float, Sizes<size0, ...>> result = t4; cout << result(0, 0, 0); ``` Until you need the results, you can keep the operation around, and even reuse it for additional operations. As long as you keep the expression as an operation, no computation is performed. ``` // One way to compute exp((t1 + t2) * 0.2f); auto t3 = t1 + t2; auto t4 = t3 * 0.2f; auto t5 = t4.exp(); Tensor<float, 3> result = t5; // Another way, exactly as efficient as the previous one: Tensor<float, 3> result = ((t1 + t2) * 0.2f).exp(); ``` Controlling When Expression are Evaluated ------------------------------------------- There are several ways to control when expressions are evaluated: * Assignment to a Tensor, TensorFixedSize, or TensorMap. * Use of the eval() method. * Assignment to a TensorRef. ### Assigning to a Tensor, TensorFixedSize, or TensorMap. The most common way to evaluate an expression is to assign it to a Tensor. In the example below, the `auto` declarations make the intermediate values "Operations", not Tensors, and do not cause the expressions to be evaluated. The assignment to the Tensor `result` causes the evaluation of all the operations. ``` auto t3 = t1 + t2; // t3 is an Operation. auto t4 = t3 * 0.2f; // t4 is an Operation. auto t5 = t4.exp(); // t5 is an Operation. Tensor<float, 3> result = t5; // The operations are evaluated. ``` If you know the ranks and sizes of the Operation value you can assign the Operation to a TensorFixedSize instead of a Tensor, which is a bit more efficient. ``` // We know that the result is a 4x4x2 tensor! TensorFixedSize<float, Sizes<4, 4, 2>> result = t5; ``` Simiarly, assigning an expression to a TensorMap causes its evaluation. Like tensors of type TensorFixedSize, TensorMaps cannot be resized so they have to have the rank and sizes of the expression that are assigned to them. ### Calling eval(). When you compute large composite expressions, you sometimes want to tell [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") that an intermediate value in the expression tree is worth evaluating ahead of time. This is done by inserting a call to the `eval()` method of the expression Operation. ``` // The previous example could have been written: Tensor<float, 3> result = ((t1 + t2) * 0.2f).exp(); // If you want to compute (t1 + t2) once ahead of time you can write: Tensor<float, 3> result = ((t1 + t2).eval() * 0.2f).exp(); ``` Semantically, calling `eval()` is equivalent to materializing the value of the expression in a temporary Tensor of the right size. The code above in effect does: ``` // .eval() knows the size! TensorFixedSize<float, Sizes<4, 4, 2>> tmp = t1 + t2; Tensor<float, 3> result = (tmp * 0.2f).exp(); ``` Note that the return value of `eval()` is itself an Operation, so the following code does not do what you may think: ``` // Here t3 is an evaluation Operation. t3 has not been evaluated yet. auto t3 = (t1 + t2).eval(); // You can use t3 in another expression. Still no evaluation. auto t4 = (t3 * 0.2f).exp(); // The value is evaluated when you assign the Operation to a Tensor, using // an intermediate tensor to represent t3.x Tensor<float, 3> result = t4; ``` While in the examples above calling `eval()` does not make a difference in performance, in other cases it can make a huge difference. In the expression below the `broadcast()` expression causes the `X.maximum()` expression to be evaluated many times: ``` Tensor<...> X ...; Tensor<...> Y = ((X - X.maximum(depth_dim).reshape(dims2d).broadcast(bcast)) * beta).exp(); ``` Inserting a call to `eval()` between the `maximum()` and `reshape()` calls guarantees that maximum() is only computed once and greatly speeds-up execution: ``` Tensor<...> Y = ((X - X.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast)) * beta).exp(); ``` In the other example below, the tensor `Y` is both used in the expression and its assignment. This is an aliasing problem and if the evaluation is not done in the right order Y will be updated incrementally during the evaluation resulting in bogus results: ``` Tensor<...> Y ...; Y = Y / (Y.sum(depth_dim).reshape(dims2d).broadcast(bcast)); ``` Inserting a call to `eval()` between the `sum()` and `reshape()` expressions ensures that the sum is computed before any updates to `Y` are done. ``` Y = Y / (Y.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast)); ``` Note that an eval around the full right hand side expression is not needed because the generated has to compute the i-th value of the right hand side before assigning it to the left hand side. However, if you were assigning the expression value to a shuffle of `Y` then you would need to force an eval for correctness by adding an `eval()` call for the right hand side: ``` Y.shuffle(...) = (Y / (Y.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast))).eval(); ``` ### Assigning to a TensorRef. If you need to access only a few elements from the value of an expression you can avoid materializing the value in a full tensor by using a TensorRef. A TensorRef is a small wrapper class for any [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") Operation. It provides overloads for the `()` operator that let you access individual values in the expression. TensorRef is convenient, because the Operation themselves do not provide a way to access individual elements. ``` // Create a TensorRef for the expression. The expression is not // evaluated yet. TensorRef<Tensor<float, 3> > ref = ((t1 + t2) * 0.2f).exp(); // Use "ref" to access individual elements. The expression is evaluated // on the fly. float at_0 = ref(0, 0, 0); cout << ref(0, 1, 0); ``` Only use TensorRef when you need a subset of the values of the expression. TensorRef only computes the values you access. However note that if you are going to access all the values it will be much faster to materialize the results in a Tensor first. In some cases, if the full Tensor result would be very large, you may save memory by accessing it as a TensorRef. But not always. So don't count on it. Controlling How Expressions Are Evaluated ------------------------------------------- The tensor library provides several implementations of the various operations such as contractions and convolutions. The implementations are optimized for different environments: single threaded on CPU, multi threaded on CPU, or on a GPU using cuda. Additional implementations may be added later. You can choose which implementation to use with the `device()` call. If you do not choose an implementation explicitly the default implementation that uses a single thread on the CPU is used. The default implementation has been optimized for recent Intel CPUs, taking advantage of SSE, AVX, and FMA instructions. Work is ongoing to tune the library on ARM CPUs. Note that you need to pass compiler-dependent flags to enable the use of SSE, AVX, and other instructions. For example, the following code adds two tensors using the default single-threaded CPU implementation: ``` Tensor<float, 2> a(30, 40); Tensor<float, 2> b(30, 40); Tensor<float, 2> c = a + b; ``` To choose a different implementation you have to insert a `device()` call before the assignment of the result. For technical C++ reasons this requires that the Tensor for the result be declared on its own. This means that you have to know the size of the result. ``` Eigen::Tensor<float, 2> c(30, 40); c.device(...) = a + b; ``` The call to `device()` must be the last call on the left of the operator=. You must pass to the `device()` call an [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") device object. There are presently three devices you can use: DefaultDevice, ThreadPoolDevice and GpuDevice. ### Evaluating With the DefaultDevice This is exactly the same as not inserting a `device()` call. ``` DefaultDevice my_device; c.device(my_device) = a + b; ``` ### Evaluating with a Thread Pool ``` // Create the Eigen ThreadPool Eigen::ThreadPool pool(8 /* number of threads in pool */) // Create the Eigen ThreadPoolDevice. Eigen::ThreadPoolDevice my_device(&pool, 4 /* number of threads to use */); // Now just use the device when evaluating expressions. Eigen::Tensor<float, 2> c(30, 50); c.device(my_device) = a.contract(b, dot_product_dims); ``` ### Evaluating On GPU This is presently a bit more complicated than just using a thread pool device. You need to create a GPU device but you also need to explicitly allocate the memory for tensors with cuda. API Reference =============== Datatypes ----------- In the documentation of the tensor methods and Operation we mention datatypes that are tensor-type specific: ### <Tensor-Type>::Dimensions Acts like an array of ints. Has an `int size` attribute, and can be indexed like an array to access individual values. Used to represent the dimensions of a tensor. See `dimensions()`. ### <Tensor-Type>::Index Acts like an `int`. Used for indexing tensors along their dimensions. See `operator()`, `dimension()`, and `size()`. ### <Tensor-Type>::Scalar Represents the datatype of individual tensor elements. For example, for a `Tensor<float>`, `Scalar` is the type `float`. See `setConstant()`. ### <Operation> We use this pseudo type to indicate that a tensor Operation is returned by a method. We indicate in the text the type and dimensions of the tensor that the Operation returns after evaluation. The Operation will have to be evaluated, for example by assigning it to a tensor, before you can access the values of the resulting tensor. You can also access the values through a TensorRef. Built-in Tensor Methods ========================= These are usual C++ methods that act on tensors immediately. They are not Operations which provide delayed evaluation of their results. Unless specified otherwise, all the methods listed below are available on all tensor classes: Tensor, TensorFixedSize, and TensorMap. Metadata ========== int NumDimensions ------------------- Constant value indicating the number of dimensions of a Tensor. This is also known as the tensor "rank". ``` Eigen::Tensor<float, 2> a(3, 4); cout << "Dims " << a.NumDimensions; => Dims 2 ``` Dimensions dimensions() ------------------------- Returns an array-like object representing the dimensions of the tensor. The actual type of the `dimensions()` result is `<Tensor-Type>::``Dimensions`. ``` Eigen::Tensor<float, 2> a(3, 4); const Eigen::Tensor<float, 2>::Dimensions& d = a.dimensions(); cout << "Dim size: " << d.size << ", dim 0: " << d[0] << ", dim 1: " << d[1]; => Dim size: 2, dim 0: 3, dim 1: 4 ``` If you use a C++11 compiler, you can use `auto` to simplify the code: ``` const auto& d = a.dimensions(); cout << "Dim size: " << d.size << ", dim 0: " << d[0] << ", dim 1: " << d[1]; => Dim size: 2, dim 0: 3, dim 1: 4 ``` Index dimension(Index n) -------------------------- Returns the n-th dimension of the tensor. The actual type of the `dimension()` result is `<Tensor-Type>::``Index`, but you can always use it like an int. ``` Eigen::Tensor<float, 2> a(3, 4); int dim1 = a.dimension(1); cout << "Dim 1: " << dim1; => Dim 1: 4 ``` Index size() -------------- Returns the total number of elements in the tensor. This is the product of all the tensor dimensions. The actual type of the `size()` result is `<Tensor-Type>::``Index`, but you can always use it like an int. ``` Eigen::Tensor<float, 2> a(3, 4); cout << "Size: " << a.size(); => Size: 12 ``` Getting Dimensions From An Operation -------------------------------------- A few operations provide `dimensions()` directly, e.g. `TensorReslicingOp`. Most operations defer calculating dimensions until the operation is being evaluated. If you need access to the dimensions of a deferred operation, you can wrap it in a TensorRef (see Assigning to a TensorRef above), which provides `dimensions()` and `dimension()` as above. TensorRef can also wrap the plain Tensor types, so this is a useful idiom in templated contexts where the underlying object could be either a raw Tensor or some deferred operation (e.g. a slice of a Tensor). In this case, the template code can wrap the object in a TensorRef and reason about its dimensionality while remaining agnostic to the underlying type. Constructors ============== Tensor -------- Creates a tensor of the specified size. The number of arguments must be equal to the rank of the tensor. The content of the tensor is not initialized. ``` Eigen::Tensor<float, 2> a(3, 4); cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl; => NumRows: 3 NumCols: 4 ``` TensorFixedSize ----------------- Creates a tensor of the specified size. The number of arguments in the Sizes<> template parameter determines the rank of the tensor. The content of the tensor is not initialized. ``` Eigen::TensorFixedSize<float, Sizes<3, 4>> a; cout << "Rank: " << a.rank() << endl; => Rank: 2 cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl; => NumRows: 3 NumCols: 4 ``` TensorMap ----------- Creates a tensor mapping an existing array of data. The data must not be freed until the TensorMap is discarded, and the size of the data must be large enough to accommodate the coefficients of the tensor. ``` float data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; Eigen::TensorMap<Tensor<float, 2>> a(data, 3, 4); cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl; => NumRows: 3 NumCols: 4 cout << "a(1, 2): " << a(1, 2) << endl; => a(1, 2): 7 ``` Contents Initialization ========================= When a new Tensor or a new TensorFixedSize are created, memory is allocated to hold all the tensor elements, but the memory is not initialized. Similarly, when a new TensorMap is created on top of non-initialized memory the memory its contents are not initialized. You can use one of the methods below to initialize the tensor memory. These have an immediate effect on the tensor and return the tensor itself as a result. These are not tensor Operations which delay evaluation. <Tensor-Type> setConstant(const Scalar& val) ---------------------------------------------- Sets all elements of the tensor to the constant value `val`. `Scalar` is the type of data stored in the tensor. You can pass any value that is convertible to that type. Returns the tensor itself in case you want to chain another call. ``` a.setConstant(12.3f); cout << "Constant: " << endl << a << endl << endl; => Constant: 12.3 12.3 12.3 12.3 12.3 12.3 12.3 12.3 12.3 12.3 12.3 12.3 ``` Note that `setConstant()` can be used on any tensor where the element type has a copy constructor and an `operator=()`: ``` Eigen::Tensor<string, 2> a(2, 3); a.setConstant("yolo"); cout << "String tensor: " << endl << a << endl << endl; => String tensor: yolo yolo yolo yolo yolo yolo ``` <Tensor-Type> setZero() ------------------------- Fills the tensor with zeros. Equivalent to `setConstant(Scalar(0))`. Returns the tensor itself in case you want to chain another call. ``` a.setZero(); cout << "Zeros: " << endl << a << endl << endl; => Zeros: 0 0 0 0 0 0 0 0 0 0 0 0 ``` <Tensor-Type> setValues({..initializer\_list}) ------------------------------------------------ Fills the tensor with explicit values specified in a std::initializer\_list. The type of the initializer list depends on the type and rank of the tensor. If the tensor has rank N, the initializer list must be nested N times. The most deeply nested lists must contains P scalars of the Tensor type where P is the size of the last dimension of the Tensor. For example, for a `TensorFixedSize<float, 2, 3>` the initializer list must contains 2 lists of 3 floats each. `setValues()` returns the tensor itself in case you want to chain another call. ``` Eigen::Tensor<float, 2> a(2, 3); a.setValues({{0.0f, 1.0f, 2.0f}, {3.0f, 4.0f, 5.0f}}); cout << "a" << endl << a << endl << endl; => a 0 1 2 3 4 5 ``` If a list is too short, the corresponding elements of the tensor will not be changed. This is valid at each level of nesting. For example the following code only sets the values of the first row of the tensor. ``` Eigen::Tensor<int, 2> a(2, 3); a.setConstant(1000); a.setValues({{10, 20, 30}}); cout << "a" << endl << a << endl << endl; => a 10 20 30 1000 1000 1000 ``` <Tensor-Type> setRandom() --------------------------- Fills the tensor with random values. Returns the tensor itself in case you want to chain another call. ``` a.setRandom(); cout << "Random: " << endl << a << endl << endl; => Random: 0.680375 0.59688 -0.329554 0.10794 -0.211234 0.823295 0.536459 -0.0452059 0.566198 -0.604897 -0.444451 0.257742 ``` You can customize `setRandom()` by providing your own random number generator as a template argument: ``` a.setRandom<MyRandomGenerator>(); ``` Here, `MyRandomGenerator` must be a struct with the following member functions, where Scalar and Index are the same as `<Tensor-Type>::``Scalar` and `<Tensor-Type>::``Index`. See `struct UniformRandomGenerator` in [TensorFunctors.h](https://eigen.tuxfamily.org/dox/unsupported/TensorFunctors_8h_source.html) for an example. ``` // Custom number generator for use with setRandom(). struct MyRandomGenerator { // Default and copy constructors. Both are needed MyRandomGenerator() { } MyRandomGenerator(const MyRandomGenerator& ) { } // Return a random value to be used. "element_location" is the // location of the entry to set in the tensor, it can typically // be ignored. Scalar operator()(Eigen::DenseIndex element_location, Eigen::DenseIndex /*unused*/ = 0) const { return <randomly generated value of type T>; } // Same as above but generates several numbers at a time. typename internal::packet_traits<Scalar>::type packetOp( Eigen::DenseIndex packet_location, Eigen::DenseIndex /*unused*/ = 0) const { return <a packet of randomly generated values>; } }; ``` You can also use one of the 2 random number generators that are part of the tensor library: * UniformRandomGenerator * NormalRandomGenerator Data Access ============= The Tensor, TensorFixedSize, and TensorRef classes provide the following accessors to access the tensor coefficients: ``` const Scalar& operator()(const array<Index, NumIndices>& indices) const Scalar& operator()(Index firstIndex, IndexTypes... otherIndices) Scalar& operator()(const array<Index, NumIndices>& indices) Scalar& operator()(Index firstIndex, IndexTypes... otherIndices) ``` The number of indices must be equal to the rank of the tensor. Moreover, these accessors are not available on tensor expressions. In order to access the values of a tensor expression, the expression must either be evaluated or wrapped in a TensorRef. Scalar\* data() and const Scalar\* data() const ------------------------------------------------- Returns a pointer to the storage for the tensor. The pointer is const if the tensor was const. This allows direct access to the data. The layout of the data depends on the tensor layout: RowMajor or ColMajor. This access is usually only needed for special cases, for example when mixing [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") Tensor code with other libraries. Scalar is the type of data stored in the tensor. ``` Eigen::Tensor<float, 2> a(3, 4); float* a_data = a.data(); a_data[0] = 123.45f; cout << "a(0, 0): " << a(0, 0); => a(0, 0): 123.45 ``` Tensor Operations =================== All the methods documented below return non evaluated tensor `Operations`. These can be chained: you can apply another Tensor Operation to the value returned by the method. The chain of Operation is evaluated lazily, typically when it is assigned to a tensor. See "Controlling when Expression are Evaluated" for more details about their evaluation. <Operation> constant(const Scalar& val) ----------------------------------------- Returns a tensor of the same type and dimensions as the original tensor but where all elements have the value `val`. This is useful, for example, when you want to add or subtract a constant from a tensor, or multiply every element of a tensor by a scalar. ``` Eigen::Tensor<float, 2> a(2, 3); a.setConstant(1.0f); Eigen::Tensor<float, 2> b = a + a.constant(2.0f); Eigen::Tensor<float, 2> c = b * b.constant(0.2f); cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; cout << "c" << endl << c << endl << endl; => a 1 1 1 1 1 1 b 3 3 3 3 3 3 c 0.6 0.6 0.6 0.6 0.6 0.6 ``` <Operation> random() ---------------------- Returns a tensor of the same type and dimensions as the current tensor but where all elements have random values. This is for example useful to add random values to an existing tensor. The generation of random values can be customized in the same manner as for `setRandom()`. ``` Eigen::Tensor<float, 2> a(2, 3); a.setConstant(1.0f); Eigen::Tensor<float, 2> b = a + a.random(); cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; => a 1 1 1 1 1 1 b 1.68038 1.5662 1.82329 0.788766 1.59688 0.395103 ``` Unary Element Wise Operations =============================== All these operations take a single input tensor as argument and return a tensor of the same type and dimensions as the tensor to which they are applied. The requested operations are applied to each element independently. <Operation> operator-() ------------------------- Returns a tensor of the same type and dimensions as the original tensor containing the opposite values of the original tensor. ``` Eigen::Tensor<float, 2> a(2, 3); a.setConstant(1.0f); Eigen::Tensor<float, 2> b = -a; cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; => a 1 1 1 1 1 1 b -1 -1 -1 -1 -1 -1 ``` <Operation> sqrt() -------------------- Returns a tensor of the same type and dimensions as the original tensor containing the square roots of the original tensor. <Operation> rsqrt() --------------------- Returns a tensor of the same type and dimensions as the original tensor containing the inverse square roots of the original tensor. <Operation> square() ---------------------- Returns a tensor of the same type and dimensions as the original tensor containing the squares of the original tensor values. <Operation> inverse() ----------------------- Returns a tensor of the same type and dimensions as the original tensor containing the inverse of the original tensor values. <Operation> exp() ------------------- Returns a tensor of the same type and dimensions as the original tensor containing the exponential of the original tensor. <Operation> log() ------------------- Returns a tensor of the same type and dimensions as the original tensor containing the natural logarithms of the original tensor. <Operation> abs() ------------------- Returns a tensor of the same type and dimensions as the original tensor containing the absolute values of the original tensor. <Operation> pow(Scalar exponent) ---------------------------------- Returns a tensor of the same type and dimensions as the original tensor containing the coefficients of the original tensor to the power of the exponent. The type of the exponent, Scalar, is always the same as the type of the tensor coefficients. For example, only integer exponents can be used in conjuntion with tensors of integer values. You can use cast() to lift this restriction. For example this computes cubic roots of an int Tensor: ``` Eigen::Tensor<int, 2> a(2, 3); a.setValues({{0, 1, 8}, {27, 64, 125}}); Eigen::Tensor<double, 2> b = a.cast<double>().pow(1.0 / 3.0); cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; => a 0 1 8 27 64 125 b 0 1 2 3 4 5 ``` <Operation> operator \* (Scalar scale) ---------------------------------------- Multiplies all the coefficients of the input tensor by the provided scale. <Operation> cwiseMax(Scalar threshold) ---------------------------------------- TODO <Operation> cwiseMin(Scalar threshold) ---------------------------------------- TODO <Operation> unaryExpr(const CustomUnaryOp& func) -------------------------------------------------- TODO Binary Element Wise Operations ================================ These operations take two input tensors as arguments. The 2 input tensors should be of the same type and dimensions. The result is a tensor of the same dimensions as the tensors to which they are applied, and unless otherwise specified it is also of the same type. The requested operations are applied to each pair of elements independently. <Operation> operator+(const OtherDerived& other) -------------------------------------------------- Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise sums of the inputs. <Operation> operator-(const OtherDerived& other) -------------------------------------------------- Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise differences of the inputs. <Operation> operator\*(const OtherDerived& other) --------------------------------------------------- Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise products of the inputs. <Operation> operator/(const OtherDerived& other) -------------------------------------------------- Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise quotients of the inputs. This operator is not supported for integer types. <Operation> cwiseMax(const OtherDerived& other) ------------------------------------------------- Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise maximums of the inputs. <Operation> cwiseMin(const OtherDerived& other) ------------------------------------------------- Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise mimimums of the inputs. <Operation> Logical operators ------------------------------- The following logical operators are supported as well: * operator&&(const OtherDerived& other) * operator||(const OtherDerived& other) * operator<(const OtherDerived& other) * operator<=(const OtherDerived& other) * operator>(const OtherDerived& other) * operator>=(const OtherDerived& other) * operator==(const OtherDerived& other) * operator!=(const OtherDerived& other) They all return a tensor of boolean values. Selection (select(const ThenDerived& thenTensor, const ElseDerived& elseTensor) ================================================================================= Selection is a coefficient-wise ternary operator that is the tensor equivalent to the if-then-else operation. ``` Tensor<bool, 3> if = ...; Tensor<float, 3> then = ...; Tensor<float, 3> else = ...; Tensor<float, 3> result = if.select(then, else); ``` The 3 arguments must be of the same dimensions, which will also be the dimension of the result. The 'if' tensor must be of type boolean, the 'then' and the 'else' tensor must be of the same type, which will also be the type of the result. Each coefficient in the result is equal to the corresponding coefficient in the 'then' tensor if the corresponding value in the 'if' tensor is true. If not, the resulting coefficient will come from the 'else' tensor. Contraction ============= Tensor *contractions* are a generalization of the matrix product to the multidimensional case. ``` // Create 2 matrices using tensors of rank 2 Eigen::Tensor<int, 2> a(2, 3); a.setValues({{1, 2, 3}, {6, 5, 4}}); Eigen::Tensor<int, 2> b(3, 2); b.setValues({{1, 2}, {4, 5}, {5, 6}}); // Compute the traditional matrix product Eigen::array<Eigen::IndexPair<int>, 1> product_dims = { Eigen::IndexPair<int>(1, 0) }; Eigen::Tensor<int, 2> AB = a.contract(b, product_dims); // Compute the product of the transpose of the matrices Eigen::array<Eigen::IndexPair<int>, 1> transposed_product_dims = { Eigen::IndexPair<int>(0, 1) }; Eigen::Tensor<int, 2> AtBt = a.contract(b, transposed_product_dims); // Contraction to scalar value using a double contraction. // First coordinate of both tensors are contracted as well as both second coordinates, i.e., this computes the sum of the squares of the elements. Eigen::array<Eigen::IndexPair<int>, 2> double_contraction_product_dims = { Eigen::IndexPair<int>(0, 0), Eigen::IndexPair<int>(1, 1) }; Eigen::Tensor<int, 0> AdoubleContractedA = a.contract(a, double_contraction_product_dims); // Extracting the scalar value of the tensor contraction for further usage int value = AdoubleContractedA(0); ``` Reduction Operations ====================== A *Reduction* operation returns a tensor with fewer dimensions than the original tensor. The values in the returned tensor are computed by applying a *reduction operator* to slices of values from the original tensor. You specify the dimensions along which the slices are made. The [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") Tensor library provides a set of predefined reduction operators such as `maximum()` and `sum()` and lets you define additional operators by implementing a few methods from a reductor template. Reduction Dimensions ---------------------- All reduction operations take a single parameter of type `<TensorType>::``Dimensions` which can always be specified as an array of ints. These are called the "reduction dimensions." The values are the indices of the dimensions of the input tensor over which the reduction is done. The parameter can have at most as many element as the rank of the input tensor; each element must be less than the tensor rank, as it indicates one of the dimensions to reduce. Each dimension of the input tensor should occur at most once in the reduction dimensions as the implementation does not remove duplicates. The order of the values in the reduction dimensions does not affect the results, but the code may execute faster if you list the dimensions in increasing order. Example: Reduction along one dimension. ``` // Create a tensor of 2 dimensions Eigen::Tensor<int, 2> a(2, 3); a.setValues({{1, 2, 3}, {6, 5, 4}}); // Reduce it along the second dimension (1)... Eigen::array<int, 1> dims({1 /* dimension to reduce */}); // ...using the "maximum" operator. // The result is a tensor with one dimension. The size of // that dimension is the same as the first (non-reduced) dimension of a. Eigen::Tensor<int, 1> b = a.maximum(dims); cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; => a 1 2 3 6 5 4 b 3 6 ``` Example: Reduction along two dimensions. ``` Eigen::Tensor<float, 3, Eigen::ColMajor> a(2, 3, 4); a.setValues({{{0.0f, 1.0f, 2.0f, 3.0f}, {7.0f, 6.0f, 5.0f, 4.0f}, {8.0f, 9.0f, 10.0f, 11.0f}}, {{12.0f, 13.0f, 14.0f, 15.0f}, {19.0f, 18.0f, 17.0f, 16.0f}, {20.0f, 21.0f, 22.0f, 23.0f}}}); // The tensor a has 3 dimensions. We reduce along the // first 2, resulting in a tensor with a single dimension // of size 4 (the last dimension of a.) // Note that we pass the array of reduction dimensions // directly to the maximum() call. Eigen::Tensor<float, 1, Eigen::ColMajor> b = a.maximum(Eigen::array<int, 2>({0, 1})); cout << "b" << endl << b << endl << endl; => b 20 21 22 23 ``` ### Reduction along all dimensions As a special case, if you pass no parameter to a reduction operation the original tensor is reduced along *all* its dimensions. The result is a scalar, represented as a zero-dimension tensor. ``` Eigen::Tensor<float, 3> a(2, 3, 4); a.setValues({{{0.0f, 1.0f, 2.0f, 3.0f}, {7.0f, 6.0f, 5.0f, 4.0f}, {8.0f, 9.0f, 10.0f, 11.0f}}, {{12.0f, 13.0f, 14.0f, 15.0f}, {19.0f, 18.0f, 17.0f, 16.0f}, {20.0f, 21.0f, 22.0f, 23.0f}}}); // Reduce along all dimensions using the sum() operator. Eigen::Tensor<float, 0> b = a.sum(); cout << "b" << endl << b << endl << endl; => b 276 ``` <Operation> sum(const Dimensions& new\_dims) ---------------------------------------------- <Operation> sum() ------------------- Reduce a tensor using the sum() operator. The resulting values are the sum of the reduced values. <Operation> mean(const Dimensions& new\_dims) ----------------------------------------------- <Operation> mean() -------------------- Reduce a tensor using the mean() operator. The resulting values are the mean of the reduced values. <Operation> maximum(const Dimensions& new\_dims) -------------------------------------------------- <Operation> maximum() ----------------------- Reduce a tensor using the maximum() operator. The resulting values are the largest of the reduced values. <Operation> minimum(const Dimensions& new\_dims) -------------------------------------------------- <Operation> minimum() ----------------------- Reduce a tensor using the minimum() operator. The resulting values are the smallest of the reduced values. <Operation> prod(const Dimensions& new\_dims) ----------------------------------------------- <Operation> prod() -------------------- Reduce a tensor using the prod() operator. The resulting values are the product of the reduced values. <Operation> all(const Dimensions& new\_dims) ---------------------------------------------- <Operation> all() ------------------- Reduce a tensor using the [all()](../group__core__module#ga790ab6c4226ef5f678b9eb532a3eab14) operator. Casts tensor to bool and then checks whether all elements are true. Runs through all elements rather than short-circuiting, so may be significantly inefficient. <Operation> any(const Dimensions& new\_dims) ---------------------------------------------- <Operation> any() ------------------- Reduce a tensor using the any() operator. Casts tensor to bool and then checks whether any element is true. Runs through all elements rather than short-circuiting, so may be significantly inefficient. <Operation> reduce(const Dimensions& new\_dims, const Reducer& reducer) ------------------------------------------------------------------------- Reduce a tensor using a user-defined reduction operator. See `SumReducer` in [TensorFunctors.h](https://eigen.tuxfamily.org/dox/unsupported/TensorFunctors_8h_source.html) for information on how to implement a reduction operator. Trace ======= A *Trace* operation returns a tensor with fewer dimensions than the original tensor. It returns a tensor whose elements are the sum of the elements of the original tensor along the main diagonal for a list of specified dimensions, the "trace dimensions". Similar to the `Reduction Dimensions`, the trace dimensions are passed as an input parameter to the operation, are of type `<TensorType>::``Dimensions` , and have the same requirements when passed as an input parameter. In addition, the trace dimensions must have the same size. Example: Trace along 2 dimensions. ``` // Create a tensor of 3 dimensions Eigen::Tensor<int, 3> a(2, 2, 3); a.setValues({{{1, 2, 3}, {4, 5, 6}}, {{7, 8, 9}, {10, 11, 12}}}); // Specify the dimensions along which the trace will be computed. // In this example, the trace can only be computed along the dimensions // with indices 0 and 1 Eigen::array<int, 2> dims({0, 1}); // The output tensor contains all but the trace dimensions. Tensor<int, 1> a_trace = a.trace(dims); cout << "a_trace:" << endl; cout << a_trace << endl; => a_trace: 11 13 15 ``` <Operation> trace(const Dimensions& new\_dims) ------------------------------------------------ <Operation> trace() --------------------- As a special case, if no parameter is passed to the operation, trace is computed along *all* dimensions of the input tensor. Example: Trace along all dimensions. ``` // Create a tensor of 3 dimensions, with all dimensions having the same size. Eigen::Tensor<int, 3> a(3, 3, 3); a.setValues({{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, {{10, 11, 12}, {13, 14, 15}, {16, 17, 18}}, {{19, 20, 21}, {22, 23, 24}, {25, 26, 27}}}); // Result is a zero dimension tensor Tensor<int, 0> a_trace = a.trace(); cout<<"a_trace:"<<endl; cout<<a_trace<<endl; => a_trace: 42 ``` Scan Operations ================= A *Scan* operation returns a tensor with the same dimensions as the original tensor. The operation performs an inclusive scan along the specified axis, which means it computes a running total along the axis for a given reduction operation. If the reduction operation corresponds to summation, then this computes the prefix sum of the tensor along the given axis. Example: dd a comment to this line ``` // Create a tensor of 2 dimensions Eigen::Tensor<int, 2> a(2, 3); a.setValues({{1, 2, 3}, {4, 5, 6}}); // Scan it along the second dimension (1) using summation Eigen::Tensor<int, 2> b = a.cumsum(1); // The result is a tensor with the same size as the input cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; => a 1 2 3 4 5 6 b 1 3 6 4 9 15 ``` <Operation> cumsum(const Index& axis) --------------------------------------- Perform a scan by summing consecutive entries. <Operation> cumprod(const Index& axis) ---------------------------------------- Perform a scan by multiplying consecutive entries. Convolutions ============== <Operation> convolve(const Kernel& kernel, const Dimensions& dims) -------------------------------------------------------------------- Returns a tensor that is the output of the convolution of the input tensor with the kernel, along the specified dimensions of the input tensor. The dimension size for dimensions of the output tensor which were part of the convolution will be reduced by the formula: output\_dim\_size = input\_dim\_size - kernel\_dim\_size + 1 (requires: input\_dim\_size >= kernel\_dim\_size). The dimension sizes for dimensions that were not part of the convolution will remain the same. Performance of the convolution can depend on the length of the stride(s) of the input tensor dimension(s) along which the convolution is computed (the first dimension has the shortest stride for ColMajor, whereas RowMajor's shortest stride is for the last dimension). ``` // Compute convolution along the second and third dimension. Tensor<float, 4, DataLayout> input(3, 3, 7, 11); Tensor<float, 2, DataLayout> kernel(2, 2); Tensor<float, 4, DataLayout> output(3, 2, 6, 11); input.setRandom(); kernel.setRandom(); Eigen::array<ptrdiff_t, 2> dims({1, 2}); // Specify second and third dimension for convolution. output = input.convolve(kernel, dims); for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { for (int k = 0; k < 6; ++k) { for (int l = 0; l < 11; ++l) { const float result = output(i,j,k,l); const float expected = input(i,j+0,k+0,l) * kernel(0,0) + input(i,j+1,k+0,l) * kernel(1,0) + input(i,j+0,k+1,l) * kernel(0,1) + input(i,j+1,k+1,l) * kernel(1,1); VERIFY_IS_APPROX(result, expected); } } } } ``` Geometrical Operations ======================== These operations return a Tensor with different dimensions than the original Tensor. They can be used to access slices of tensors, see them with different dimensions, or pad tensors with additional data. <Operation> reshape(const Dimensions& new\_dims) -------------------------------------------------- Returns a view of the input tensor that has been reshaped to the specified new dimensions. The argument new\_dims is an array of Index values. The rank of the resulting tensor is equal to the number of elements in new\_dims. The product of all the sizes in the new dimension array must be equal to the number of elements in the input tensor. ``` // Increase the rank of the input tensor by introducing a new dimension // of size 1. Tensor<float, 2> input(7, 11); array<int, 3> three_dims{{7, 11, 1}}; Tensor<float, 3> result = input.reshape(three_dims); // Decrease the rank of the input tensor by merging 2 dimensions; array<int, 1> one_dim{{7 * 11}}; Tensor<float, 1> result = input.reshape(one_dim); ``` This operation does not move any data in the input tensor, so the resulting contents of a reshaped Tensor depend on the data layout of the original Tensor. For example this is what happens when you `reshape()` a 2D ColMajor tensor to one dimension: ``` Eigen::Tensor<float, 2, Eigen::ColMajor> a(2, 3); a.setValues({{0.0f, 100.0f, 200.0f}, {300.0f, 400.0f, 500.0f}}); Eigen::array<Eigen::DenseIndex, 1> one_dim({3 * 2}); Eigen::Tensor<float, 1, Eigen::ColMajor> b = a.reshape(one_dim); cout << "b" << endl << b << endl; => b 0 300 100 400 200 500 ``` This is what happens when the 2D Tensor is RowMajor: ``` Eigen::Tensor<float, 2, Eigen::RowMajor> a(2, 3); a.setValues({{0.0f, 100.0f, 200.0f}, {300.0f, 400.0f, 500.0f}}); Eigen::array<Eigen::DenseIndex, 1> one_dim({3 * 2}); Eigen::Tensor<float, 1, Eigen::RowMajor> b = a.reshape(one_dim); cout << "b" << endl << b << endl; => b 0 100 200 300 400 500 ``` The reshape operation is a lvalue. In other words, it can be used on the left side of the assignment operator. The previous example can be rewritten as follow: ``` Eigen::Tensor<float, 2, Eigen::ColMajor> a(2, 3); a.setValues({{0.0f, 100.0f, 200.0f}, {300.0f, 400.0f, 500.0f}}); Eigen::array<Eigen::DenseIndex, 2> two_dim({2, 3}); Eigen::Tensor<float, 1, Eigen::ColMajor> b(6); b.reshape(two_dim) = a; cout << "b" << endl << b << endl; => b 0 300 100 400 200 500 ``` Note that "b" itself was not reshaped but that instead the assignment is done to the reshape view of b. <Operation> shuffle(const Shuffle& shuffle) --------------------------------------------- Returns a copy of the input tensor whose dimensions have been reordered according to the specified permutation. The argument shuffle is an array of Index values. Its size is the rank of the input tensor. It must contain a permutation of 0, 1, ..., rank - 1. The i-th dimension of the output tensor equals to the size of the shuffle[i]-th dimension of the input tensor. For example: ``` // Shuffle all dimensions to the left by 1. Tensor<float, 3> input(20, 30, 50); // ... set some values in input. Tensor<float, 3> output = input.shuffle({1, 2, 0}) eigen_assert(output.dimension(0) == 30); eigen_assert(output.dimension(1) == 50); eigen_assert(output.dimension(2) == 20); ``` Indices into the output tensor are shuffled accordingly to formulate indices into the input tensor. For example, one can assert in the above code snippet that: ``` eigen_assert(output(3, 7, 11) == input(11, 3, 7)); ``` In general, one can assert that ``` eigen_assert(output(..., indices[shuffle[i]], ...) == input(..., indices[i], ...)) ``` The shuffle operation results in a lvalue, which means that it can be assigned to. In other words, it can be used on the left side of the assignment operator. Let's rewrite the previous example to take advantage of this feature: ``` // Shuffle all dimensions to the left by 1. Tensor<float, 3> input(20, 30, 50); // ... set some values in input. Tensor<float, 3> output(30, 50, 20); output.shuffle({2, 0, 1}) = input; ``` <Operation> stride(const Strides& strides) -------------------------------------------- Returns a view of the input tensor that strides (skips stride-1 elements) along each of the dimensions. The argument strides is an array of Index values. The dimensions of the resulting tensor are ceil(input\_dimensions[i] / strides[i]). For example this is what happens when you `stride()` a 2D tensor: ``` Eigen::Tensor<int, 2> a(4, 3); a.setValues({{0, 100, 200}, {300, 400, 500}, {600, 700, 800}, {900, 1000, 1100}}); Eigen::array<Eigen::DenseIndex, 2> strides({3, 2}); Eigen::Tensor<int, 2> b = a.stride(strides); cout << "b" << endl << b << endl; => b 0 200 900 1100 ``` It is possible to assign a tensor to a stride: Tensor<float, 3> input(20, 30, 50); // ... set some values in input. Tensor<float, 3> output(40, 90, 200); output.stride({2, 3, 4}) = input; <Operation> slice(const StartIndices& offsets, const Sizes& extents) ---------------------------------------------------------------------- Returns a sub-tensor of the given tensor. For each dimension i, the slice is made of the coefficients stored between offset[i] and offset[i] + extents[i] in the input tensor. ``` Eigen::Tensor<int, 2> a(4, 3); a.setValues({{0, 100, 200}, {300, 400, 500}, {600, 700, 800}, {900, 1000, 1100}}); Eigen::array<int, 2> offsets = {1, 0}; Eigen::array<int, 2> extents = {2, 2}; Eigen::Tensor<int, 1> slice = a.slice(offsets, extents); cout << "a" << endl << a << endl; => a 0 100 200 300 400 500 600 700 800 900 1000 1100 cout << "slice" << endl << slice << endl; => slice 300 400 600 700 ``` <Operation> chip(const Index offset, const Index dim) ------------------------------------------------------- A chip is a special kind of slice. It is the subtensor at the given offset in the dimension dim. The returned tensor has one fewer dimension than the input tensor: the dimension dim is removed. For example, a matrix chip would be either a row or a column of the input matrix. ``` Eigen::Tensor<int, 2> a(4, 3); a.setValues({{0, 100, 200}, {300, 400, 500}, {600, 700, 800}, {900, 1000, 1100}}); Eigen::Tensor<int, 1> row_3 = a.chip(2, 0); Eigen::Tensor<int, 1> col_2 = a.chip(1, 1); cout << "a" << endl << a << endl; => a 0 100 200 300 400 500 600 700 800 900 1000 1100 cout << "row_3" << endl << row_3 << endl; => row_3 600 700 800 cout << "col_2" << endl << col_2 << endl; => col_2 100 400 700 1000 ``` It is possible to assign values to a tensor chip since the chip operation is a lvalue. For example: ``` Eigen::Tensor<int, 1> a(3); a.setValues({{100, 200, 300}}); Eigen::Tensor<int, 2> b(2, 3); b.setZero(); b.chip(0, 0) = a; cout << "a" << endl << a << endl; => a 100 200 300 cout << "b" << endl << b << endl; => b 100 200 300 0 0 0 ``` <Operation> reverse(const ReverseDimensions& reverse) ------------------------------------------------------- Returns a view of the input tensor that reverses the order of the coefficients along a subset of the dimensions. The argument reverse is an array of boolean values that indicates whether or not the order of the coefficients should be reversed along each of the dimensions. This operation preserves the dimensions of the input tensor. For example this is what happens when you `reverse()` the first dimension of a 2D tensor: ``` Eigen::Tensor<int, 2> a(4, 3); a.setValues({{0, 100, 200}, {300, 400, 500}, {600, 700, 800}, {900, 1000, 1100}}); Eigen::array<bool, 2> reverse({true, false}); Eigen::Tensor<int, 2> b = a.reverse(reverse); cout << "a" << endl << a << endl << "b" << endl << b << endl; => a 0 100 200 300 400 500 600 700 800 900 1000 1100 b 900 1000 1100 600 700 800 300 400 500 0 100 200 ``` <Operation> broadcast(const Broadcast& broadcast) --------------------------------------------------- Returns a view of the input tensor in which the input is replicated one to many times. The broadcast argument specifies how many copies of the input tensor need to be made in each of the dimensions. ``` Eigen::Tensor<int, 2> a(2, 3); a.setValues({{0, 100, 200}, {300, 400, 500}}); Eigen::array<int, 2> bcast({3, 2}); Eigen::Tensor<int, 2> b = a.broadcast(bcast); cout << "a" << endl << a << endl << "b" << endl << b << endl; => a 0 100 200 300 400 500 b 0 100 200 0 100 200 300 400 500 300 400 500 0 100 200 0 100 200 300 400 500 300 400 500 0 100 200 0 100 200 300 400 500 300 400 500 ``` <Operation> concatenate(const OtherDerived& other, Axis axis) --------------------------------------------------------------- TODO <Operation> pad(const PaddingDimensions& padding) --------------------------------------------------- Returns a view of the input tensor in which the input is padded with zeros. ``` Eigen::Tensor<int, 2> a(2, 3); a.setValues({{0, 100, 200}, {300, 400, 500}}); Eigen::array<pair<int, int>, 2> paddings; paddings[0] = make_pair(0, 1); paddings[1] = make_pair(2, 3); Eigen::Tensor<int, 2> b = a.pad(paddings); cout << "a" << endl << a << endl << "b" << endl << b << endl; => a 0 100 200 300 400 500 b 0 0 0 0 0 0 0 0 0 100 200 0 300 400 500 0 0 0 0 0 0 0 0 0 0 0 0 0 ``` <Operation> extract\_patches(const PatchDims& patch\_dims) ------------------------------------------------------------ Returns a tensor of coefficient patches extracted from the input tensor, where each patch is of dimension specified by 'patch\_dims'. The returned tensor has one greater dimension than the input tensor, which is used to index each patch. The patch index in the output tensor depends on the data layout of the input tensor: the patch index is the last dimension ColMajor layout, and the first dimension in RowMajor layout. For example, given the following input tensor: ``` Eigen::Tensor<float, 2, DataLayout> tensor(3,4); tensor.setValues({{0.0f, 1.0f, 2.0f, 3.0f}, {4.0f, 5.0f, 6.0f, 7.0f}, {8.0f, 9.0f, 10.0f, 11.0f}}); cout << "tensor: " << endl << tensor << endl; => tensor: 0 1 2 3 4 5 6 7 8 9 10 11 ``` Six 2x2 patches can be extracted and indexed using the following code: ``` Eigen::Tensor<float, 3, DataLayout> patch; Eigen::array<ptrdiff_t, 2> patch_dims; patch_dims[0] = 2; patch_dims[1] = 2; patch = tensor.extract_patches(patch_dims); for (int k = 0; k < 6; ++k) { cout << "patch index: " << k << endl; for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { if (DataLayout == ColMajor) { cout << patch(i, j, k) << " "; } else { cout << patch(k, i, j) << " "; } } cout << endl; } } ``` This code results in the following output when the data layout is ColMajor: ``` patch index: 0 0 1 4 5 patch index: 1 4 5 8 9 patch index: 2 1 2 5 6 patch index: 3 5 6 9 10 patch index: 4 2 3 6 7 patch index: 5 6 7 10 11 ``` This code results in the following output when the data layout is RowMajor: (NOTE: the set of patches is the same as in ColMajor, but are indexed differently). ``` patch index: 0 0 1 4 5 patch index: 1 1 2 5 6 patch index: 2 2 3 6 7 patch index: 3 4 5 8 9 patch index: 4 5 6 9 10 patch index: 5 6 7 10 11 ``` <Operation> extract\_image\_patches(const Index patch\_rows, const Index patch\_cols, const Index row\_stride, const Index col\_stride, const PaddingType padding\_type) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Returns a tensor of coefficient image patches extracted from the input tensor, which is expected to have dimensions ordered as follows (depending on the data layout of the input tensor, and the number of additional dimensions 'N'): \*) ColMajor 1st dimension: channels (of size d) 2nd dimension: rows (of size r) 3rd dimension: columns (of size c) 4th-Nth dimension: time (for video) or batch (for bulk processing). \*) RowMajor (reverse order of ColMajor) 1st-Nth dimension: time (for video) or batch (for bulk processing). N+1'th dimension: columns (of size c) N+2'th dimension: rows (of size r) N+3'th dimension: channels (of size d) The returned tensor has one greater dimension than the input tensor, which is used to index each patch. The patch index in the output tensor depends on the data layout of the input tensor: the patch index is the 4'th dimension in ColMajor layout, and the 4'th from the last dimension in RowMajor layout. For example, given the following input tensor with the following dimension sizes: \*) depth: 2 \*) rows: 3 \*) columns: 5 \*) batch: 7 Tensor<float, 4> tensor(2,3,5,7); Tensor<float, 4, RowMajor> tensor\_row\_major = tensor.swap\_layout(); 2x2 image patches can be extracted and indexed using the following code: \*) 2D patch: ColMajor (patch indexed by second-to-last dimension) ``` Tensor<float, 5> twod_patch; twod_patch = tensor.extract_image_patches<2, 2>(); // twod_patch.dimension(0) == 2 // twod_patch.dimension(1) == 2 // twod_patch.dimension(2) == 2 // twod_patch.dimension(3) == 3*5 // twod_patch.dimension(4) == 7 ``` \*) 2D patch: RowMajor (patch indexed by the second dimension) ``` Tensor<float, 5, RowMajor> twod_patch_row_major; twod_patch_row_major = tensor_row_major.extract_image_patches<2, 2>(); // twod_patch_row_major.dimension(0) == 7 // twod_patch_row_major.dimension(1) == 3*5 // twod_patch_row_major.dimension(2) == 2 // twod_patch_row_major.dimension(3) == 2 // twod_patch_row_major.dimension(4) == 2 ``` Special Operations ==================== <Operation> cast<T>() ----------------------- Returns a tensor of type T with the same dimensions as the original tensor. The returned tensor contains the values of the original tensor converted to type T. ``` Eigen::Tensor<float, 2> a(2, 3); Eigen::Tensor<int, 2> b = a.cast<int>(); ``` This can be useful for example if you need to do element-wise division of Tensors of integers. This is not currently supported by the Tensor library but you can easily cast the tensors to floats to do the division: ``` Eigen::Tensor<int, 2> a(2, 3); a.setValues({{0, 1, 2}, {3, 4, 5}}); Eigen::Tensor<int, 2> b = (a.cast<float>() / a.constant(2).cast<float>()).cast<int>(); cout << "a" << endl << a << endl << endl; cout << "b" << endl << b << endl << endl; => a 0 1 2 3 4 5 b 0 0 1 1 2 2 ``` <Operation> eval() -------------------- TODO Representation of scalar values ================================= Scalar values are often represented by tensors of size 1 and rank 0.For example Tensor<T, N>::maximum() currently returns a Tensor<T, 0>. Similarly, the inner product of 2 1d tensors (through contractions) returns a 0d tensor. Limitations ============= * The number of tensor dimensions is currently limited to 250 when using a compiler that supports cxx11. It is limited to only 5 for older compilers. * The IndexList class requires a cxx11 compliant compiler. You can use an array of indices instead if you don't have access to a modern compiler. * On GPUs only floating point values are properly tested and optimized for. * Complex and integer values are known to be broken on GPUs. If you try to use them you'll most likely end up triggering a static assertion failure such as EIGEN\_STATIC\_ASSERT(packetSize > 1, YOU\_MADE\_A\_PROGRAMMING\_MISTAKE)
programming_docs
eigen3 Eigen::SplineTraits Eigen::SplineTraits =================== ### template<typename \_Scalar, int \_Dim, int \_Degree, int \_DerivativeOrder> struct Eigen::SplineTraits< Spline< \_Scalar, \_Dim, \_Degree >, \_DerivativeOrder > Compile-time attributes of the [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") class for fixed degree. The traits class inherits all attributes from the SplineTraits of Dynamic degree. Inherits Eigen::SplineTraits< SplineType, DerivativeOrder >. | | | --- | | | | enum | { [OrderAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a0b33979eab591bb1721c3d19e731bfb3aa546f3e09061b25456cf70107db72ccd) } | | | | enum | { [NumOfDerivativesAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a536651c0156aebbba6f92ab86b9231c8a75a34223007ae974d1c19d653b2abfa3) } | | | | enum | { [DerivativeMemoryLayout](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a2d35c4785da3f3c3054adb4dad1e50fca7e79c844da14c6fa961e112d05e23175) } | | | | typedef [Array](../classeigen_1_1array)< \_Scalar, [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [RowMajor](../group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), [NumOfDerivativesAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a536651c0156aebbba6f92ab86b9231c8a75a34223007ae974d1c19d653b2abfa3), [OrderAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a0b33979eab591bb1721c3d19e731bfb3aa546f3e09061b25456cf70107db72ccd) > | [BasisDerivativeType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a507283e4ba6108e20eae19e805816770) | | | The data type used to store the values of the basis function derivatives. | | | | typedef [Array](../classeigen_1_1array)< \_Scalar, \_Dim, [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [DerivativeMemoryLayout](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a2d35c4785da3f3c3054adb4dad1e50fca7e79c844da14c6fa961e112d05e23175), \_Dim, [NumOfDerivativesAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a536651c0156aebbba6f92ab86b9231c8a75a34223007ae974d1c19d653b2abfa3) > | [DerivativeType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#a5e0a0e3b07c844c84cf164a7f0db9314) | | | The data type used to store the spline's derivative values. | | | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree, int \_DerivativeOrder> | | | --- | | anonymous enum | | Enumerator | | --- | | OrderAtCompileTime | The spline curve's order at compile-time. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree, int \_DerivativeOrder> | | | --- | | anonymous enum | | Enumerator | | --- | | NumOfDerivativesAtCompileTime | The number of derivatives defined for the current spline. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree, int \_DerivativeOrder> | | | --- | | anonymous enum | | Enumerator | | --- | | DerivativeMemoryLayout | The derivative type's memory layout. | --- The documentation for this struct was generated from the following file:* [SplineFwd.h](https://eigen.tuxfamily.org/dox/unsupported/SplineFwd_8h_source.html) eigen3 TensorReverse TensorReverse ============= Tensor reverse elements class. --- The documentation for this class was generated from the following file:* [TensorReverse.h](https://eigen.tuxfamily.org/dox/unsupported/TensorReverse_8h_source.html) eigen3 TensorTrace TensorTrace =========== Tensor Trace class. --- The documentation for this class was generated from the following file:* [TensorTrace.h](https://eigen.tuxfamily.org/dox/unsupported/TensorTrace_8h_source.html) eigen3 TensorFFT TensorFFT ========= Tensor FFT class. TODO: Vectorize the Cooley Tukey and the Bluestein algorithm Add support for multithreaded evaluation Improve the performance on GPU --- The documentation for this class was generated from the following file:* [TensorFFT.h](https://eigen.tuxfamily.org/dox/unsupported/TensorFFT_8h_source.html) eigen3 Eigen::MatrixLogarithmReturnValue Eigen::MatrixLogarithmReturnValue ================================= ### template<typename Derived> class Eigen::MatrixLogarithmReturnValue< Derived > Proxy for the matrix logarithm of some matrix (expression). Template Parameters | | | | --- | --- | | Derived | Type of the argument to the matrix function. | This class holds the argument to the matrix function until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of [MatrixBase::log()](../classeigen_1_1matrixbase#a4dc57b319fc1cf8c9035016e56602a7d) and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixLogarithmReturnValue< Derived > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](classeigen_1_1matrixlogarithmreturnvalue#ac17537a51ce53a44746fabd7a83d29d3) (ResultType &result) const | | | Compute the matrix logarithm. [More...](classeigen_1_1matrixlogarithmreturnvalue#ac17537a51ce53a44746fabd7a83d29d3) | | | | | [MatrixLogarithmReturnValue](classeigen_1_1matrixlogarithmreturnvalue#adfd2417a3d6f671e156b4ab1b92f1837) (const Derived &A) | | | Constructor. [More...](classeigen_1_1matrixlogarithmreturnvalue#adfd2417a3d6f671e156b4ab1b92f1837) | | | MatrixLogarithmReturnValue() ---------------------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::MatrixLogarithmReturnValue](classeigen_1_1matrixlogarithmreturnvalue)< Derived >::[MatrixLogarithmReturnValue](classeigen_1_1matrixlogarithmreturnvalue) | ( | const Derived & | *A* | ) | | | inlineexplicit | Constructor. Parameters | | | | | --- | --- | --- | | [in] | A | Matrix (expression) forming the argument of the matrix logarithm. | evalTo() -------- template<typename Derived > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixLogarithmReturnValue](classeigen_1_1matrixlogarithmreturnvalue)< Derived >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix logarithm. Parameters | | | | | --- | --- | --- | | [out] | result | Logarithm of `A`, where `A` is as specified in the constructor. | --- The documentation for this class was generated from the following file:* [MatrixLogarithm.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixLogarithm_8h_source.html) eigen3 Eigen::StdMapTraits Eigen::StdMapTraits =================== ### template<typename Scalar> struct Eigen::StdMapTraits< Scalar > Represents a std::map See also [RandomSetter](classeigen_1_1randomsetter "The RandomSetter is a wrapper object allowing to set/update a sparse matrix with random access.") --- The documentation for this struct was generated from the following file:* [RandomSetter.h](https://eigen.tuxfamily.org/dox/unsupported/RandomSetter_8h_source.html) eigen3 Eigen::MatrixPowerParenthesesReturnValue Eigen::MatrixPowerParenthesesReturnValue ======================================== ### template<typename MatrixType> class Eigen::MatrixPowerParenthesesReturnValue< MatrixType > Proxy for the matrix power of some matrix. Template Parameters | | | | --- | --- | | MatrixType | type of the base, a matrix. | This class holds the arguments to the matrix power until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of MatrixPower::operator() and related functions and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixPowerParenthesesReturnValue< MatrixType > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](classeigen_1_1matrixpowerparenthesesreturnvalue#af91430ff248b714158cfba4301cc0e2b) (ResultType &result) const | | | Compute the matrix power. [More...](classeigen_1_1matrixpowerparenthesesreturnvalue#af91430ff248b714158cfba4301cc0e2b) | | | | | [MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue#ae3a02d943a31427a6dc8c1f60f3367d7) ([MatrixPower](classeigen_1_1matrixpower)< MatrixType > &pow, RealScalar p) | | | Constructor. [More...](classeigen_1_1matrixpowerparenthesesreturnvalue#ae3a02d943a31427a6dc8c1f60f3367d7) | | | MatrixPowerParenthesesReturnValue() ----------------------------------- template<typename MatrixType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue)< MatrixType >::[MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue) | ( | [MatrixPower](classeigen_1_1matrixpower)< MatrixType > & | *pow*, | | | | RealScalar | *p* | | | ) | | | | inline | Constructor. Parameters | | | | | --- | --- | --- | | [in] | pow | MatrixPower storing the base. | | [in] | p | scalar, the exponent of the matrix power. | evalTo() -------- template<typename MatrixType > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue)< MatrixType >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix power. Parameters | | | | | --- | --- | --- | | [out] | result | | --- The documentation for this class was generated from the following file:* [MatrixPower.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixPower_8h_source.html) eigen3 Eigen::GMRES Eigen::GMRES ============ ### template<typename \_MatrixType, typename \_Preconditioner> class Eigen::GMRES< \_MatrixType, \_Preconditioner > A [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") solver for sparse square problems. This class allows to solve for A.x = b sparse linear problems using a generalized minimal residual method. The vectors x and b can be either dense or sparse. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, can be a dense or a sparse matrix. | | \_Preconditioner | the type of the preconditioner. Default is [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner) | The maximal number of iterations and tolerance value can be controlled via the [setMaxIterations()](../classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) and [setTolerance()](../classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance. This class can be used as the direct solver classes. Here is a typical usage example: ``` int n = 10000; VectorXd x(n), b(n); SparseMatrix<double> A(n,n); // fill A and b GMRES<SparseMatrix<double> > solver(A); x = solver.solve(b); std::cout << "#iterations: " << solver.iterations() << std::endl; std::cout << "estimated error: " << solver.error() << std::endl; // update b, and solve again x = solver.solve(b); ``` By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the [solveWithGuess()](../classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) method. [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") can also be used in a matrix-free context, see the following [example](../group__matrixfreesolverexample) . See also class [SimplicialCholesky](../classeigen_1_1simplicialcholesky), [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner), [IdentityPreconditioner](../classeigen_1_1identitypreconditioner) | | | --- | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | [get\_restart](classeigen_1_1gmres#ade721328e58ace2d4493cbdcbe53ad09) () | | | | | [GMRES](classeigen_1_1gmres#a73153e328dfa402cb3640711289f2985) () | | | | template<typename MatrixDerived > | | | [GMRES](classeigen_1_1gmres#a9ceeeb826c7e60ee948c0d1c0a219607) (const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | void | [set\_restart](classeigen_1_1gmres#ac50d6bbca4a8a275861770feb211900d) (const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) restart) | | | GMRES() [1/2] ------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::GMRES](classeigen_1_1gmres)< \_MatrixType, \_Preconditioner >::[GMRES](classeigen_1_1gmres) | ( | | ) | | | inline | Default constructor. GMRES() [2/2] ------------- template<typename \_MatrixType , typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::GMRES](classeigen_1_1gmres)< \_MatrixType, \_Preconditioner >::[GMRES](classeigen_1_1gmres) | ( | const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. get\_restart() -------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) [Eigen::GMRES](classeigen_1_1gmres)< \_MatrixType, \_Preconditioner >::get\_restart | ( | | ) | | | inline | Get the number of iterations after that a restart is performed. set\_restart() -------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::GMRES](classeigen_1_1gmres)< \_MatrixType, \_Preconditioner >::set\_restart | ( | const [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *restart* | ) | | | inline | Set the number of iterations after that a restart is performed. Parameters | | | | --- | --- | | restart | number of iterations for a restarti, default is 30. | --- The documentation for this class was generated from the following file:* [GMRES.h](https://eigen.tuxfamily.org/dox/unsupported/GMRES_8h_source.html) eigen3 Auto Diff module Auto Diff module ================ This module features forward automatic differentation via a simple templated scalar type wrapper [AutoDiffScalar](classeigen_1_1autodiffscalar "A scalar type replacement with automatic differentiation capability."). Warning : this should NOT be confused with numerical differentiation, which is a different method and has its own module in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") : [Numerical differentiation module](group__numericaldiff__module). ``` #include <unsupported/Eigen/AutoDiff> ``` eigen3 Eigen::SplineTraits Eigen::SplineTraits =================== ### template<typename \_Scalar, int \_Dim, int \_Degree> struct Eigen::SplineTraits< Spline< \_Scalar, \_Dim, \_Degree >, Dynamic > Compile-time attributes of the [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") class for Dynamic degree. | | | --- | | | | enum | { [Dimension](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ac4f7aaf3f2e8ee39cfd6f02e68339b1fa14c4a4e9fe5d03a6ba00511dacf018b3) } | | | | enum | { [Degree](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a41e754a0cd76bf6195c44826c173b6d3a39d70871bb511aeb19f8c5a2501f0eaf) } | | | | enum | { [OrderAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a3ccfc317467e4553efd0dabf1ae673e0a782b4fa82b6dd9b27315743dc4696719) } | | | | enum | { [NumOfDerivativesAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a6bf3fcc0504bfa54bb1d6c4dbff87635a5699cd0a1c022f44b527c079adfc0049) } | | | | enum | { [DerivativeMemoryLayout](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a42214943716b3cf3dbb6c9a35deb9b98a3b107c361982e84a53d02e066743dcdb) } | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [RowMajor](../group__enums#ggaacded1a18ae58b0f554751f6cdf9eb13a77c993a8d9f6efe5c1159fb2ab07dd4f), [NumOfDerivativesAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a6bf3fcc0504bfa54bb1d6c4dbff87635a5699cd0a1c022f44b527c079adfc0049), [OrderAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a3ccfc317467e4553efd0dabf1ae673e0a782b4fa82b6dd9b27315743dc4696719) > | [BasisDerivativeType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a79379499c52489dbf2b0251941f98370) | | | The data type used to store the values of the basis function derivatives. | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), 1, [OrderAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a3ccfc317467e4553efd0dabf1ae673e0a782b4fa82b6dd9b27315743dc4696719) > | [BasisVectorType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a8f6574a4a8281fad62adbde35169bae5) | | | The data type used to store non-zero basis functions. | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), [Dimension](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ac4f7aaf3f2e8ee39cfd6f02e68339b1fa14c4a4e9fe5d03a6ba00511dacf018b3), [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [ControlPointVectorType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ad4a21460926a6186f3b56cec9380e742) | | | The data type representing the spline's control points. | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), [Dimension](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ac4f7aaf3f2e8ee39cfd6f02e68339b1fa14c4a4e9fe5d03a6ba00511dacf018b3), [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2), [DerivativeMemoryLayout](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a42214943716b3cf3dbb6c9a35deb9b98a3b107c361982e84a53d02e066743dcdb), [Dimension](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ac4f7aaf3f2e8ee39cfd6f02e68339b1fa14c4a4e9fe5d03a6ba00511dacf018b3), [NumOfDerivativesAtCompileTime](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a6bf3fcc0504bfa54bb1d6c4dbff87635a5699cd0a1c022f44b527c079adfc0049) > | [DerivativeType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ab8a352bf7e6f02ab6f1864e372868db2) | | | The data type used to store the spline's derivative values. | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), 1, [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [KnotVectorType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a2f5f4e5598c650df3f284c3db0eeafa9) | | | The data type used to store knot vectors. | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), 1, [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) > | [ParameterVectorType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#a61cd43163c3fe6c68cc6c191d210a36f) | | | The data type used to store parameter vectors. | | | | typedef [Array](../classeigen_1_1array)< [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3), [Dimension](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ac4f7aaf3f2e8ee39cfd6f02e68339b1fa14c4a4e9fe5d03a6ba00511dacf018b3), 1 > | [PointType](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#ad479d9b94761b2cf332fda5984301fcf) | | | The point type the spline is representing. | | | | typedef \_Scalar | [Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3) | | | Scalar ------ template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | typedef \_Scalar Eigen::SplineTraits< [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >, [Dynamic](../namespaceeigen#ad81fa7195215a0ce30017dfac309f0b2) >::[Scalar](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#aa440dee6a559821c867c94ee4bbf60f3) | The spline curve's scalar type. anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | Dimension | The spline curve's dimension. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | Degree | The spline curve's degree. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | OrderAtCompileTime | The spline curve's order at compile-time. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | NumOfDerivativesAtCompileTime | The number of derivatives defined for the current spline. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | DerivativeMemoryLayout | The derivative type's memory layout. | --- The documentation for this struct was generated from the following file:* [SplineFwd.h](https://eigen.tuxfamily.org/dox/unsupported/SplineFwd_8h_source.html)
programming_docs
eigen3 Eigen::LevenbergMarquardt Eigen::LevenbergMarquardt ========================= ### template<typename \_FunctorType> class Eigen::LevenbergMarquardt< \_FunctorType > Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquardt algorithm. Check wikipedia for more information. <http://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm> Inherits internal::no\_assignment\_operator. | | | --- | | | | [FVectorType](../classeigen_1_1matrix) & | [diag](classeigen_1_1levenbergmarquardt#a6e237ca1f23cdf5caa98fe23c6bcf464) () | | | | RealScalar | [epsilon](classeigen_1_1levenbergmarquardt#aac799068926ca0bc3387b2dc5c0eb113) () const | | | | RealScalar | [factor](classeigen_1_1levenbergmarquardt#a282e28b8331376b9875429dab1e280ba) () const | | | | RealScalar | [fnorm](classeigen_1_1levenbergmarquardt#ac30c5ce96ac91663b287b2ba7ec7c712) () | | | | RealScalar | [ftol](classeigen_1_1levenbergmarquardt#a957ac071ec775779bb03d10b463ddfbc) () const | | | | [FVectorType](../classeigen_1_1matrix) & | [fvec](classeigen_1_1levenbergmarquardt#a6c296a4a5b91f0ecc398b479a67c242d) () | | | | RealScalar | [gnorm](classeigen_1_1levenbergmarquardt#ab91ec0507fb508a2402ac0dfa15af776) () | | | | RealScalar | [gtol](classeigen_1_1levenbergmarquardt#a18597c537ec7d492ee6d43788178e458) () const | | | | [ComputationInfo](../group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) | [info](classeigen_1_1levenbergmarquardt#ae65bdccd2487989ae9b25f9c2e9dfab9) () const | | | Reports whether the minimization was successful. [More...](classeigen_1_1levenbergmarquardt#ae65bdccd2487989ae9b25f9c2e9dfab9) | | | | Index | [iterations](classeigen_1_1levenbergmarquardt#aeb094683f0abe9c29ee89be0677de744) () | | | | JacobianType & | [jacobian](classeigen_1_1levenbergmarquardt#aaf2179310fdf873483f5d8b46f15da8c) () | | | | RealScalar | [lm\_param](classeigen_1_1levenbergmarquardt#aa8aa0d8c1dab58ac51df999587609e09) (void) | | | | JacobianType & | [matrixR](classeigen_1_1levenbergmarquardt#afd6cd64fdd7ca32cc71a83d91432ea69) () | | | | Index | [maxfev](classeigen_1_1levenbergmarquardt#a495894dde1fedfba97721f6b4a076901) () const | | | | Index | [nfev](classeigen_1_1levenbergmarquardt#ad9563c6abeb33c0aba82e55fd72c64a6) () | | | | Index | [njev](classeigen_1_1levenbergmarquardt#a31bedcc92106ed170fde5750559a62a5) () | | | | [PermutationType](../classeigen_1_1permutationmatrix) | [permutation](classeigen_1_1levenbergmarquardt#a691142ba877e072c58016b4be77e9855) () | | | | void | [resetParameters](classeigen_1_1levenbergmarquardt#a16172a2048058ea0a908213a7b0f8971) () | | | | void | [setEpsilon](classeigen_1_1levenbergmarquardt#a3e13f6631ae59be984ee1ea196899cd7) (RealScalar epsfcn) | | | | void | [setExternalScaling](classeigen_1_1levenbergmarquardt#a4af7d41545ec5908485357493839e6f6) (bool value) | | | | void | [setFactor](classeigen_1_1levenbergmarquardt#a3054eeba042b197ae8d415729770db69) (RealScalar [factor](classeigen_1_1levenbergmarquardt#a282e28b8331376b9875429dab1e280ba)) | | | | void | [setFtol](classeigen_1_1levenbergmarquardt#a09c0852c6a4534b84a16ac5d9c631c12) (RealScalar [ftol](classeigen_1_1levenbergmarquardt#a957ac071ec775779bb03d10b463ddfbc)) | | | | void | [setGtol](classeigen_1_1levenbergmarquardt#ad5610b2353f1ce5e0c7357ed1b215fea) (RealScalar [gtol](classeigen_1_1levenbergmarquardt#a18597c537ec7d492ee6d43788178e458)) | | | | void | [setMaxfev](classeigen_1_1levenbergmarquardt#af072d0f89c44415d8ed284df8b4a634a) (Index [maxfev](classeigen_1_1levenbergmarquardt#a495894dde1fedfba97721f6b4a076901)) | | | | void | [setXtol](classeigen_1_1levenbergmarquardt#a691b571366630f1329d2de7a5e40e7a5) (RealScalar [xtol](classeigen_1_1levenbergmarquardt#a25a7629ea877d8f08670536b3d234897)) | | | | RealScalar | [xtol](classeigen_1_1levenbergmarquardt#a25a7629ea877d8f08670536b3d234897) () const | | | diag() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [FVectorType](../classeigen_1_1matrix)& [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::diag | ( | | ) | | | inline | Returns a reference to the diagonal of the jacobian epsilon() --------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::epsilon | ( | | ) | const | | inline | Returns the error precision factor() -------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::factor | ( | | ) | const | | inline | Returns the step bound for the diagonal shift fnorm() ------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::fnorm | ( | | ) | | | inline | Returns the norm of current vector function ftol() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::ftol | ( | | ) | const | | inline | Returns the tolerance for the norm of the vector function fvec() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [FVectorType](../classeigen_1_1matrix)& [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::fvec | ( | | ) | | | inline | Returns a reference to the current vector function gnorm() ------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::gnorm | ( | | ) | | | inline | Returns the norm of the gradient of the error gtol() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::gtol | ( | | ) | const | | inline | Returns the tolerance for the norm of the gradient of the error vector info() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [ComputationInfo](../group__enums#ga85fad7b87587764e5cf6b513a9e0ee5e) [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::info | ( | | ) | const | | inline | Reports whether the minimization was successful. Returns `Success` if the minimization was successful, `NumericalIssue` if a numerical problem arises during the minimization process, for example during the QR factorization `NoConvergence` if the minimization did not converge after the maximum number of function evaluation allowed `InvalidInput` if the input matrix is invalid iterations() ------------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::iterations | ( | | ) | | | inline | Returns the number of iterations performed jacobian() ---------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | JacobianType& [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::jacobian | ( | | ) | | | inline | Returns a reference to the matrix where the current Jacobian matrix is stored lm\_param() ----------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::lm\_param | ( | void | | ) | | | inline | Returns the [LevenbergMarquardt](classeigen_1_1levenbergmarquardt "Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquar...") parameter matrixR() --------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | JacobianType& [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::matrixR | ( | | ) | | | inline | Returns a reference to the triangular matrix R from the QR of the jacobian matrix. See also [jacobian()](classeigen_1_1levenbergmarquardt#aaf2179310fdf873483f5d8b46f15da8c) maxfev() -------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::maxfev | ( | | ) | const | | inline | Returns the maximum number of function evaluation nfev() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::nfev | ( | | ) | | | inline | Returns the number of functions evaluation njev() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::njev | ( | | ) | | | inline | Returns the number of jacobian evaluation permutation() ------------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [PermutationType](../classeigen_1_1permutationmatrix) [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::permutation | ( | | ) | | | inline | the permutation used in the QR factorization resetParameters() ----------------- template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::resetParameters | ( | | ) | | | inline | Sets the default parameters setEpsilon() ------------ template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setEpsilon | ( | RealScalar | *epsfcn* | ) | | | inline | Sets the error precision setExternalScaling() -------------------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setExternalScaling | ( | bool | *value* | ) | | | inline | Use an external Scaling. If set to true, pass a nonzero diagonal to diag() setFactor() ----------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setFactor | ( | RealScalar | *factor* | ) | | | inline | Sets the step bound for the diagonal shift setFtol() --------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setFtol | ( | RealScalar | *ftol* | ) | | | inline | Sets the tolerance for the norm of the vector function setGtol() --------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setGtol | ( | RealScalar | *gtol* | ) | | | inline | Sets the tolerance for the norm of the gradient of the error vector setMaxfev() ----------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setMaxfev | ( | Index | *maxfev* | ) | | | inline | Sets the maximum number of function evaluation setXtol() --------- template<typename \_FunctorType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::setXtol | ( | RealScalar | *xtol* | ) | | | inline | Sets the tolerance for the norm of the solution vector xtol() ------ template<typename \_FunctorType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | RealScalar [Eigen::LevenbergMarquardt](classeigen_1_1levenbergmarquardt)< \_FunctorType >::xtol | ( | | ) | const | | inline | Returns the tolerance for the norm of the solution vector --- The documentation for this class was generated from the following files:* [LevenbergMarquardt/LevenbergMarquardt.h](https://eigen.tuxfamily.org/dox/unsupported/LevenbergMarquardt_2LevenbergMarquardt_8h_source.html) * [LMonestep.h](https://eigen.tuxfamily.org/dox/unsupported/LMonestep_8h_source.html) eigen3 Eigen::MatrixSquareRootReturnValue Eigen::MatrixSquareRootReturnValue ================================== ### template<typename Derived> class Eigen::MatrixSquareRootReturnValue< Derived > Proxy for the matrix square root of some matrix (expression). Template Parameters | | | | --- | --- | | Derived | Type of the argument to the matrix square root. | This class holds the argument to the matrix square root until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of [MatrixBase::sqrt()](../classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixSquareRootReturnValue< Derived > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](classeigen_1_1matrixsquarerootreturnvalue#a97577165569edcf19429c7748b670e51) (ResultType &result) const | | | Compute the matrix square root. [More...](classeigen_1_1matrixsquarerootreturnvalue#a97577165569edcf19429c7748b670e51) | | | | | [MatrixSquareRootReturnValue](classeigen_1_1matrixsquarerootreturnvalue#aa27fd0e59ff1711a55ee8a4342c035d5) (const Derived &src) | | | Constructor. [More...](classeigen_1_1matrixsquarerootreturnvalue#aa27fd0e59ff1711a55ee8a4342c035d5) | | | MatrixSquareRootReturnValue() ----------------------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::MatrixSquareRootReturnValue](classeigen_1_1matrixsquarerootreturnvalue)< Derived >::[MatrixSquareRootReturnValue](classeigen_1_1matrixsquarerootreturnvalue) | ( | const Derived & | *src* | ) | | | inlineexplicit | Constructor. Parameters | | | | | --- | --- | --- | | [in] | src | Matrix (expression) forming the argument of the matrix square root. | evalTo() -------- template<typename Derived > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixSquareRootReturnValue](classeigen_1_1matrixsquarerootreturnvalue)< Derived >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix square root. Parameters | | | | | --- | --- | --- | | [out] | result | the matrix square root of `src` in the constructor. | --- The documentation for this class was generated from the following file:* [MatrixSquareRoot.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixSquareRoot_8h_source.html) eigen3 Eigen::TensorCustomBinaryOp Eigen::TensorCustomBinaryOp =========================== ### template<typename CustomBinaryFunc, typename LhsXprType, typename RhsXprType> class Eigen::TensorCustomBinaryOp< CustomBinaryFunc, LhsXprType, RhsXprType > [Tensor](classeigen_1_1tensor "The tensor class.") custom class. --- The documentation for this class was generated from the following file:* [TensorCustomOp.h](https://eigen.tuxfamily.org/dox/unsupported/TensorCustomOp_8h_source.html) eigen3 TensorAssign TensorAssign ============ The tensor assignment class. This class is represents the assignment of the values resulting from the evaluation of the rhs expression to the memory locations denoted by the lhs expression. --- The documentation for this class was generated from the following file:* [TensorAssign.h](https://eigen.tuxfamily.org/dox/unsupported/TensorAssign_8h_source.html) eigen3 Eigen::MatrixFunctionReturnValue Eigen::MatrixFunctionReturnValue ================================ ### template<typename Derived> class Eigen::MatrixFunctionReturnValue< Derived > Proxy for the matrix function of some matrix (expression). Template Parameters | | | | --- | --- | | Derived | Type of the argument to the matrix function. | This class holds the argument to the matrix function until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of matrixBase::matrixFunction() and related functions and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixFunctionReturnValue< Derived > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](classeigen_1_1matrixfunctionreturnvalue#a202d594ae254e3ea5420ff95d9f03a67) (ResultType &result) const | | | Compute the matrix function. [More...](classeigen_1_1matrixfunctionreturnvalue#a202d594ae254e3ea5420ff95d9f03a67) | | | | | [MatrixFunctionReturnValue](classeigen_1_1matrixfunctionreturnvalue#af193d7a3e1b4e65dc70e64eb4bc8e17f) (const Derived &A, StemFunction f) | | | Constructor. [More...](classeigen_1_1matrixfunctionreturnvalue#af193d7a3e1b4e65dc70e64eb4bc8e17f) | | | MatrixFunctionReturnValue() --------------------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::MatrixFunctionReturnValue](classeigen_1_1matrixfunctionreturnvalue)< Derived >::[MatrixFunctionReturnValue](classeigen_1_1matrixfunctionreturnvalue) | ( | const Derived & | *A*, | | | | StemFunction | *f* | | | ) | | | | inline | Constructor. Parameters | | | | | --- | --- | --- | | [in] | A | Matrix (expression) forming the argument of the matrix function. | | [in] | f | Stem function for matrix function under consideration. | evalTo() -------- template<typename Derived > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixFunctionReturnValue](classeigen_1_1matrixfunctionreturnvalue)< Derived >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix function. Parameters | | | | | --- | --- | --- | | [out] | result | `f` applied to `A`, where `f` and `A` are as in the constructor. | --- The documentation for this class was generated from the following file:* [MatrixFunction.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixFunction_8h_source.html)
programming_docs
eigen3 Eigen::TensorDevice Eigen::TensorDevice =================== ### template<typename ExpressionType, typename DeviceType> class Eigen::TensorDevice< ExpressionType, DeviceType > Pseudo expression providing an operator = that will evaluate its argument on the specified computing 'device' (GPU, thread pool, ...) Example: C.device(EIGEN\_GPU) = A + B; Todo: operator \*= and /=. --- The documentation for this class was generated from the following file:* [TensorDevice.h](https://eigen.tuxfamily.org/dox/unsupported/TensorDevice_8h_source.html) eigen3 Eigen::TensorCustomUnaryOp Eigen::TensorCustomUnaryOp ========================== ### template<typename CustomUnaryFunc, typename XprType> class Eigen::TensorCustomUnaryOp< CustomUnaryFunc, XprType > [Tensor](classeigen_1_1tensor "The tensor class.") custom class. --- The documentation for this class was generated from the following file:* [TensorCustomOp.h](https://eigen.tuxfamily.org/dox/unsupported/TensorCustomOp_8h_source.html) eigen3 Eigen::KdBVH Eigen::KdBVH ============ ### template<typename \_Scalar, int \_Dim, typename \_Object> class Eigen::KdBVH< \_Scalar, \_Dim, \_Object > A simple bounding volume hierarchy based on [AlignedBox](../classeigen_1_1alignedbox). Parameters | | | | --- | --- | | \_Scalar | The underlying scalar type of the bounding boxes | | \_Dim | The dimension of the space in which the hierarchy lives | | \_Object | The object type that lives in the hierarchy. It must have value semantics. Either bounding\_box(\_Object) must be defined and return an AlignedBox<\_Scalar, \_Dim> or bounding boxes must be provided to the tree initializer. | This class provides a simple (as opposed to optimized) implementation of a bounding volume hierarchy analogous to a Kd-tree. Given a sequence of objects, it computes their bounding boxes, constructs a Kd-tree of their centers and builds a BVH with the structure of that Kd-tree. When the elements of the tree are too expensive to be copied around, it is useful for \_Object to be a pointer. | | | --- | | | | void | [getChildren](classeigen_1_1kdbvh#afa2682bdb56b8fae57d7226ee6675f44) (Index index, VolumeIterator &outVBegin, VolumeIterator &outVEnd, ObjectIterator &outOBegin, ObjectIterator &outOEnd) const | | | | Index | [getRootIndex](classeigen_1_1kdbvh#a8111486ece7980dd8f0d10aff9693d11) () const | | | | const [Volume](../classeigen_1_1alignedbox) & | [getVolume](classeigen_1_1kdbvh#a59e7a2afb19fe7ae919fb95425bd6bf0) (Index index) const | | | | template<typename Iter > | | void | [init](classeigen_1_1kdbvh#a431eed3c2567a854fb350f0b327d3307) (Iter begin, Iter end) | | | | template<typename OIter , typename BIter > | | void | [init](classeigen_1_1kdbvh#a10a9c8f6d596d7a2cd285a3fb3e8c053) (OIter begin, OIter end, BIter boxBegin, BIter boxEnd) | | | | template<typename Iter > | | | [KdBVH](classeigen_1_1kdbvh#a87d240e2d6ac5e87fc2e4ae6e0fe4bdc) (Iter begin, Iter end) | | | | template<typename OIter , typename BIter > | | | [KdBVH](classeigen_1_1kdbvh#a94f781127eeec80a7659b8a625e2fa94) (OIter begin, OIter end, BIter boxBegin, BIter boxEnd) | | | KdBVH() [1/2] ------------- template<typename \_Scalar , int \_Dim, typename \_Object > template<typename Iter > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::[KdBVH](classeigen_1_1kdbvh) | ( | Iter | *begin*, | | | | Iter | *end* | | | ) | | | | inline | Given an iterator range over *Object* references, constructs the BVH. Requires that bounding\_box(Object) return a Volume. KdBVH() [2/2] ------------- template<typename \_Scalar , int \_Dim, typename \_Object > template<typename OIter , typename BIter > | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::[KdBVH](classeigen_1_1kdbvh) | ( | OIter | *begin*, | | | | OIter | *end*, | | | | BIter | *boxBegin*, | | | | BIter | *boxEnd* | | | ) | | | | inline | Given an iterator range over *Object* references and an iterator range over their bounding boxes, constructs the BVH getChildren() ------------- template<typename \_Scalar , int \_Dim, typename \_Object > | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::getChildren | ( | Index | *index*, | | | | VolumeIterator & | *outVBegin*, | | | | VolumeIterator & | *outVEnd*, | | | | ObjectIterator & | *outOBegin*, | | | | ObjectIterator & | *outOEnd* | | | ) | | const | | inline | Given an *index* of a node, on exit, *outVBegin* and *outVEnd* range over the indices of the volume children of the node and *outOBegin* and *outOEnd* range over the object children of the node getRootIndex() -------------- template<typename \_Scalar , int \_Dim, typename \_Object > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | Index [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::getRootIndex | ( | | ) | const | | inline | Returns the index of the root of the hierarchy getVolume() ----------- template<typename \_Scalar , int \_Dim, typename \_Object > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Volume](../classeigen_1_1alignedbox)& [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::getVolume | ( | Index | *index* | ) | const | | inline | Returns the bounding box of the node at *index* init() [1/2] ------------ template<typename \_Scalar , int \_Dim, typename \_Object > template<typename Iter > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::init | ( | Iter | *begin*, | | | | Iter | *end* | | | ) | | | | inline | Given an iterator range over *Object* references, constructs the BVH, overwriting whatever is in there currently. Requires that bounding\_box(Object) return a Volume. init() [2/2] ------------ template<typename \_Scalar , int \_Dim, typename \_Object > template<typename OIter , typename BIter > | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::KdBVH](classeigen_1_1kdbvh)< \_Scalar, \_Dim, \_Object >::init | ( | OIter | *begin*, | | | | OIter | *end*, | | | | BIter | *boxBegin*, | | | | BIter | *boxEnd* | | | ) | | | | inline | Given an iterator range over *Object* references and an iterator range over their bounding boxes, constructs the BVH, overwriting whatever is in there currently. --- The documentation for this class was generated from the following file:* [KdBVH.h](https://eigen.tuxfamily.org/dox/unsupported/KdBVH_8h_source.html) eigen3 TensorInflation TensorInflation =============== Tensor inflation class. --- The documentation for this class was generated from the following file:* [TensorInflation.h](https://eigen.tuxfamily.org/dox/unsupported/TensorInflation_8h_source.html) eigen3 Eigen::TensorConcatenationOp Eigen::TensorConcatenationOp ============================ ### template<typename Axis, typename LhsXprType, typename RhsXprType> class Eigen::TensorConcatenationOp< Axis, LhsXprType, RhsXprType > [Tensor](classeigen_1_1tensor "The tensor class.") concatenation class. --- The documentation for this class was generated from the following file:* [TensorConcatenation.h](https://eigen.tuxfamily.org/dox/unsupported/TensorConcatenation_8h_source.html) eigen3 Eigen::PolynomialSolver Eigen::PolynomialSolver ======================= ### template<typename \_Scalar, int \_Deg> class Eigen::PolynomialSolver< \_Scalar, \_Deg > A polynomial solver. Computes the complex roots of a real polynomial. Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e., the type of the polynomial coefficients | | \_Deg | the degree of the polynomial, can be a compile time value or Dynamic. Notice that the number of polynomial coefficients is \_Deg+1. | This class implements a polynomial solver and provides convenient methods such as * real roots, * greatest, smallest complex roots, * real roots with greatest, smallest absolute real value. * greatest, smallest real roots. WARNING: this polynomial solver is experimental, part of the unsupported [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") modules. Currently a QR algorithm is used to compute the eigenvalues of the companion matrix of the polynomial to compute its roots. This supposes that the complex moduli of the roots are all distinct: e.g. there should be no multiple roots or conjugate roots for instance. With 32bit (float) floating types this problem shows up frequently. However, almost always, correct accuracy is reached even in these cases for 64bit (double) floating types and small polynomial degree (<20). | | | --- | | | | template<typename OtherPolynomial > | | void | [compute](classeigen_1_1polynomialsolver#ac3ceae48528f3798d44c15a025cb03b8) (const OtherPolynomial &poly) | | | | Public Member Functions inherited from [Eigen::PolynomialSolverBase< \_Scalar, \_Deg >](classeigen_1_1polynomialsolverbase) | | const RealScalar & | [absGreatestRealRoot](classeigen_1_1polynomialsolverbase#aa2f003d9662af8c776f1a1c12a9d4210) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RealScalar & | [absSmallestRealRoot](classeigen_1_1polynomialsolverbase#a9316eeb24076bcd4f60ea4d7f3e549eb) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RealScalar & | [greatestRealRoot](classeigen_1_1polynomialsolverbase#a5094b7ccc49918b7c7ae9e2a8c49d4bd) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RootType & | [greatestRoot](classeigen_1_1polynomialsolverbase#a0327769cc88877a79c7c838f03d78384) () const | | | | template<typename Stl\_back\_insertion\_sequence > | | void | [realRoots](classeigen_1_1polynomialsolverbase#a4ea3b29499623832a0ad7b2b3ab05597) (Stl\_back\_insertion\_sequence &bi\_seq, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const [RootsType](../classeigen_1_1matrix) & | [roots](classeigen_1_1polynomialsolverbase#a07bcd5339be5eacdf7e566d07d81bedb) () const | | | | const RealScalar & | [smallestRealRoot](classeigen_1_1polynomialsolverbase#a24b054cdf82a8e9409bea47c3c05c756) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RootType & | [smallestRoot](classeigen_1_1polynomialsolverbase#a64389d0acf586c772fb3d1db47a3f7ef) () const | | | compute() --------- template<typename \_Scalar , int \_Deg> template<typename OtherPolynomial > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::PolynomialSolver](classeigen_1_1polynomialsolver)< \_Scalar, \_Deg >::compute | ( | const OtherPolynomial & | *poly* | ) | | | inline | Computes the complex roots of a new polynomial. --- The documentation for this class was generated from the following file:* [PolynomialSolver.h](https://eigen.tuxfamily.org/dox/unsupported/PolynomialSolver_8h_source.html) eigen3 TensorIndexTuple TensorIndexTuple ================ Tensor + Index Tuple class. --- The documentation for this class was generated from the following file:* [TensorArgMax.h](https://eigen.tuxfamily.org/dox/unsupported/TensorArgMax_8h_source.html) eigen3 Spline and spline fitting module Spline and spline fitting module ================================ This module provides a simple multi-dimensional spline class while offering most basic functionality to fit a spline to point sets. ``` #include <unsupported/Eigen/Splines> ``` | | | --- | | | | class | [Eigen::Spline< \_Scalar, \_Dim, \_Degree >](classeigen_1_1spline) | | | A class representing multi-dimensional spline curves. [More...](classeigen_1_1spline#details) | | | | struct | [Eigen::SplineFitting< SplineType >](structeigen_1_1splinefitting) | | | [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") fitting methods. [More...](structeigen_1_1splinefitting#details) | | | | struct | [Eigen::SplineTraits< Spline< \_Scalar, \_Dim, \_Degree >, \_DerivativeOrder >](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4) | | | Compile-time attributes of the [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") class for fixed degree. [More...](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#details) | | | | struct | [Eigen::SplineTraits< Spline< \_Scalar, \_Dim, \_Degree >, Dynamic >](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4) | | | Compile-time attributes of the [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") class for Dynamic degree. [More...](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#details) | | | | | | --- | | | | template<typename PointArrayType , typename KnotVectorType > | | void | [Eigen::ChordLengths](group__splines__module#ga1b4cbde5d98411405871accf877552d2) (const PointArrayType &pts, KnotVectorType &chord\_lengths) | | | Computes chord length parameters which are required for spline interpolation. [More...](group__splines__module#ga1b4cbde5d98411405871accf877552d2) | | | | template<typename KnotVectorType > | | void | [Eigen::KnotAveraging](group__splines__module#ga9474da5ed68bbd9a6788a999330416d6) (const KnotVectorType &parameters, DenseIndex degree, KnotVectorType &knots) | | | Computes knot averages. [More...](group__splines__module#ga9474da5ed68bbd9a6788a999330416d6) | | | | template<typename KnotVectorType , typename ParameterVectorType , typename IndexArray > | | void | [Eigen::KnotAveragingWithDerivatives](group__splines__module#gae10a6f9b6ab7fb400a2526b6382c533b) (const ParameterVectorType &parameters, const unsigned int degree, const IndexArray &derivativeIndices, KnotVectorType &knots) | | | Computes knot averages when derivative constraints are present. Note that this is a technical interpretation of the referenced article since the algorithm contained therein is incorrect as written. [More...](group__splines__module#gae10a6f9b6ab7fb400a2526b6382c533b) | | | ChordLengths() -------------- template<typename PointArrayType , typename KnotVectorType > | | | | | | --- | --- | --- | --- | | void Eigen::ChordLengths | ( | const PointArrayType & | *pts*, | | | | KnotVectorType & | *chord\_lengths* | | | ) | | | Computes chord length parameters which are required for spline interpolation. Parameters | | | | | --- | --- | --- | | [in] | pts | The data points to which a spline should be fit. | | [out] | chord\_lengths | The resulting chord length vector. | See also Les Piegl and Wayne Tiller, The NURBS book (2nd ed.), 1997, 9.2.1 Global Curve Interpolation to Point Data KnotAveraging() --------------- template<typename KnotVectorType > | | | | | | --- | --- | --- | --- | | void Eigen::KnotAveraging | ( | const KnotVectorType & | *parameters*, | | | | DenseIndex | *degree*, | | | | KnotVectorType & | *knots* | | | ) | | | Computes knot averages. The knots are computed as \begin{align\*} u\_0 & = \hdots = u\_p = 0 \\ u\_{m-p} & = \hdots = u\_{m} = 1 \\ u\_{j+p} & = \frac{1}{p}\sum\_{i=j}^{j+p-1}\bar{u}\_i \quad\quad j=1,\hdots,n-p \end{align\*} where \(p\) is the degree and \(m+1\) the number knots of the desired interpolating spline. Parameters | | | | | --- | --- | --- | | [in] | parameters | The input parameters. During interpolation one for each data point. | | [in] | degree | The spline degree which is used during the interpolation. | | [out] | knots | The output knot vector. | See also Les Piegl and Wayne Tiller, The NURBS book (2nd ed.), 1997, 9.2.1 Global Curve Interpolation to Point Data KnotAveragingWithDerivatives() ------------------------------ template<typename KnotVectorType , typename ParameterVectorType , typename IndexArray > | | | | | | --- | --- | --- | --- | | void Eigen::KnotAveragingWithDerivatives | ( | const ParameterVectorType & | *parameters*, | | | | const unsigned int | *degree*, | | | | const IndexArray & | *derivativeIndices*, | | | | KnotVectorType & | *knots* | | | ) | | | Computes knot averages when derivative constraints are present. Note that this is a technical interpretation of the referenced article since the algorithm contained therein is incorrect as written. Parameters | | | | | --- | --- | --- | | [in] | parameters | The parameters at which the interpolation B-Spline will intersect the given interpolation points. The parameters are assumed to be a non-decreasing sequence. | | [in] | degree | The degree of the interpolating B-Spline. This must be greater than zero. | | [in] | derivativeIndices | The indices corresponding to parameters at which there are derivative constraints. The indices are assumed to be a non-decreasing sequence. | | [out] | knots | The calculated knot vector. These will be returned as a non-decreasing sequence | See also Les A. Piegl, Khairan Rajab, Volha Smarodzinana. 2008. Curve interpolation with directional constraints for engineering design. Engineering with Computers eigen3 TensorLayoutSwap TensorLayoutSwap ================ Swap the layout from col-major to row-major, or row-major to col-major, and invert the order of the dimensions. Beware: the dimensions are reversed by this operation. If you want to preserve the ordering of the dimensions, you need to combine this operation with a shuffle. --- The documentation for this class was generated from the following file:* [TensorLayoutSwap.h](https://eigen.tuxfamily.org/dox/unsupported/TensorLayoutSwap_8h_source.html) eigen3 KroneckerProduct module KroneckerProduct module ======================= This module contains an experimental Kronecker product implementation. ``` #include <Eigen/KroneckerProduct> ``` | | | --- | | | | class | [Eigen::KroneckerProduct< Lhs, Rhs >](classeigen_1_1kroneckerproduct) | | | Kronecker tensor product helper class for dense matrices. [More...](classeigen_1_1kroneckerproduct#details) | | | | class | [Eigen::KroneckerProductBase< Derived >](classeigen_1_1kroneckerproductbase) | | | The base class of dense and sparse Kronecker product. [More...](classeigen_1_1kroneckerproductbase#details) | | | | class | [Eigen::KroneckerProductSparse< Lhs, Rhs >](classeigen_1_1kroneckerproductsparse) | | | Kronecker tensor product helper class for sparse matrices. [More...](classeigen_1_1kroneckerproductsparse#details) | | | | | | --- | | | | template<typename A , typename B > | | [KroneckerProductSparse](classeigen_1_1kroneckerproductsparse)< A, B > | [Eigen::kroneckerProduct](group__kroneckerproduct__module#gaca497f43cc92bcbf6eaff64984a266cc) (const [EigenBase](../structeigen_1_1eigenbase)< A > &a, const [EigenBase](../structeigen_1_1eigenbase)< B > &b) | | | | template<typename A , typename B > | | [KroneckerProduct](classeigen_1_1kroneckerproduct)< A, B > | [Eigen::kroneckerProduct](group__kroneckerproduct__module#gaa8924dffc6cee7aa1e908dc395a7a167) (const [MatrixBase](../classeigen_1_1matrixbase)< A > &a, const [MatrixBase](../classeigen_1_1matrixbase)< B > &b) | | | kroneckerProduct() [1/2] ------------------------ template<typename A , typename B > | | | | | | --- | --- | --- | --- | | [KroneckerProductSparse](classeigen_1_1kroneckerproductsparse)<A,B> Eigen::kroneckerProduct | ( | const [EigenBase](../structeigen_1_1eigenbase)< A > & | *a*, | | | | const [EigenBase](../structeigen_1_1eigenbase)< B > & | *b* | | | ) | | | Computes Kronecker tensor product of two matrices, at least one of which is sparse Warning If you want to replace a matrix by its Kronecker product with some matrix, do **NOT** do this: ``` A = [kroneckerProduct](group__kroneckerproduct__module#gaa8924dffc6cee7aa1e908dc395a7a167)(A,B); // bug!!! caused by aliasing effect ``` instead, use eval() to work around this: ``` A = [kroneckerProduct](group__kroneckerproduct__module#gaa8924dffc6cee7aa1e908dc395a7a167)(A,B).eval(); ``` Parameters | | | | --- | --- | | a | Dense/sparse matrix a | | b | Dense/sparse matrix b | Returns Kronecker tensor product of a and b, stored in a sparse matrix kroneckerProduct() [2/2] ------------------------ template<typename A , typename B > | | | | | | --- | --- | --- | --- | | [KroneckerProduct](classeigen_1_1kroneckerproduct)<A,B> Eigen::kroneckerProduct | ( | const [MatrixBase](../classeigen_1_1matrixbase)< A > & | *a*, | | | | const [MatrixBase](../classeigen_1_1matrixbase)< B > & | *b* | | | ) | | | Computes Kronecker tensor product of two dense matrices Warning If you want to replace a matrix by its Kronecker product with some matrix, do **NOT** do this: ``` A = [kroneckerProduct](group__kroneckerproduct__module#gaa8924dffc6cee7aa1e908dc395a7a167)(A,B); // bug!!! caused by aliasing effect ``` instead, use eval() to work around this: ``` A = [kroneckerProduct](group__kroneckerproduct__module#gaa8924dffc6cee7aa1e908dc395a7a167)(A,B).eval(); ``` Parameters | | | | --- | --- | | a | [Dense](../structeigen_1_1dense) matrix a | | b | [Dense](../structeigen_1_1dense) matrix b | Returns Kronecker tensor product of a and b
programming_docs
eigen3 Eigen::StaticSGroup Eigen::StaticSGroup =================== ### template<typename... Gen> class Eigen::StaticSGroup< Gen > Static symmetry group. This class represents a symmetry group that is known and resolved completely at compile time. Ideally, no run-time penalty is incurred compared to the manual unrolling of the symmetry. ***CAUTION:*** Do not use this class directly for large symmetry groups. The compiler may run into a limit, or segfault or in the very least will take a very, very, very long time to compile the code. Use the [SGroup](classeigen_1_1sgroup "Symmetry group, initialized from template arguments.") class instead if you want a static group. That class contains logic that will automatically select the [DynamicSGroup](classeigen_1_1dynamicsgroup "Dynamic symmetry group.") class instead if the symmetry group becomes too large. (In that case, unrolling may not even be beneficial.) --- The documentation for this class was generated from the following file:* [StaticSymmetry.h](https://eigen.tuxfamily.org/dox/unsupported/StaticSymmetry_8h_source.html) eigen3 Eigen::DynamicSGroup Eigen::DynamicSGroup ==================== Dynamic symmetry group. The DynamicSGroup class represents a symmetry group that need not be known at compile time. It is useful if one wants to support arbitrary run-time defineable symmetries for tensors, but it is also instantiated if a symmetry group is defined at compile time that would be either too large for the compiler to reasonably generate (using templates to calculate this at compile time is very inefficient) or that the compiler could generate the group but that it wouldn't make sense to unroll the loop for setting coefficients anymore. Inherited by Eigen::DynamicSGroupFromTemplateArgs< Gen >. --- The documentation for this class was generated from the following file:* [DynamicSymmetry.h](https://eigen.tuxfamily.org/dox/unsupported/DynamicSymmetry_8h_source.html) eigen3 Eigen::TensorRef Eigen::TensorRef ================ ### template<typename PlainObjectType> class Eigen::TensorRef< PlainObjectType > A reference to a tensor expression The expression will be evaluated lazily (as much as possible). --- The documentation for this class was generated from the following files:* [TensorForwardDeclarations.h](https://eigen.tuxfamily.org/dox/unsupported/TensorForwardDeclarations_8h_source.html) * [TensorRef.h](https://eigen.tuxfamily.org/dox/unsupported/TensorRef_8h_source.html) eigen3 TensorBroadcasting TensorBroadcasting ================== Tensor broadcasting class. --- The documentation for this class was generated from the following file:* [TensorBroadcasting.h](https://eigen.tuxfamily.org/dox/unsupported/TensorBroadcasting_8h_source.html) eigen3 Eigen::DynamicSparseMatrix Eigen::DynamicSparseMatrix ========================== ### template<typename \_Scalar, int \_Options, typename \_StorageIndex> class Eigen::DynamicSparseMatrix< \_Scalar, \_Options, \_StorageIndex > A sparse matrix class designed for matrix assembly purpose. **[Deprecated:](deprecated#_deprecated000001)** use a [SparseMatrix](../classeigen_1_1sparsematrix) in an uncompressed mode Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e. the type of the coefficients | Unlike [SparseMatrix](../classeigen_1_1sparsematrix), this class provides a much higher degree of flexibility. In particular, it allows random read/write accesses in log(rho\*outer\_size) where `rho` is the probability that a coefficient is nonzero and outer\_size is the number of columns if the matrix is column-major and the number of rows otherwise. Internally, the data are stored as a std::vector of compressed vector. The performances of random writes might decrease as the number of nonzeros per inner-vector increase. In practice, we observed very good performance till about 100 nonzeros/vector, and the performance remains relatively good till 500 nonzeros/vectors. See also [SparseMatrix](../classeigen_1_1sparsematrix) | | | --- | | | | Scalar | [coeff](classeigen_1_1dynamicsparsematrix#a64b7d586c6b212dbe912a9ee05c3a85a) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) const | | | | Scalar & | [coeffRef](classeigen_1_1dynamicsparsematrix#a17093cd39bd0e6ebd6250bc5feb61a0f) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_DEPRECATED | [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix#a46a6947fcf115e6b7b731a8e01e7995d) () | | | | template<typename OtherDerived > | | EIGEN\_DEPRECATED | [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix#ab5bd886d79beb30802df0b1508727482) (const [SparseMatrixBase](../classeigen_1_1sparsematrixbase)< OtherDerived > &other) | | | | EIGEN\_DEPRECATED | [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix#ad1c810ff3cfcc97db704d26b9d114f94) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | EIGEN\_DEPRECATED void | [endFill](classeigen_1_1dynamicsparsematrix#aa806b3dde0a055844110610907b016f3) () | | | | EIGEN\_DEPRECATED Scalar & | [fill](classeigen_1_1dynamicsparsematrix#a70c8f529b38fd5b7d93d6dfe1a122723) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | EIGEN\_DEPRECATED Scalar & | [fillrand](classeigen_1_1dynamicsparsematrix#a6a5eb3c9d153d8ebdf4e0967321108e2) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | void | [finalize](classeigen_1_1dynamicsparsematrix#aa0abc0e4565143f103f0d7373bd4a125) () | | | | Scalar & | [insertBack](classeigen_1_1dynamicsparsematrix#a0a556652195b91c09e9f6c4d8b7cc81d) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | Scalar & | [insertBackByOuterInner](classeigen_1_1dynamicsparsematrix#ac97c2463058ae55d7f0ef21c851eb5f3) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) outer, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) inner) | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1dynamicsparsematrix#a473cd00ddc0319327f4c8a6c82ec96cf) () const | | | | void | [prune](classeigen_1_1dynamicsparsematrix#af3b38485a69d03e5c53d9ba57f9ce1d0) (Scalar reference, RealScalar epsilon=[NumTraits](../structeigen_1_1numtraits)< RealScalar >::dummy\_precision()) | | | | void | [resize](classeigen_1_1dynamicsparsematrix#a2d793e836fdb4bf0a85c9cf390e07861) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) rows, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) cols) | | | | EIGEN\_DEPRECATED void | [startFill](classeigen_1_1dynamicsparsematrix#abade0bf46139d8577aa24ead30c76771) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) reserveSize=1000) | | | | void | [startVec](classeigen_1_1dynamicsparsematrix#a294b998a50cc01859425e5e7c23d6108) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02)) | | | | | [~DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix#af0677c8aec1e1dee9f0a389509082a83) () | | | DynamicSparseMatrix() [1/3] --------------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_DEPRECATED [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix) | ( | | ) | | | inline | The class [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix "A sparse matrix class designed for matrix assembly purpose.") is deprecated DynamicSparseMatrix() [2/3] --------------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | EIGEN\_DEPRECATED [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix) | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inline | The class [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix "A sparse matrix class designed for matrix assembly purpose.") is deprecated DynamicSparseMatrix() [3/3] --------------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > template<typename OtherDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_DEPRECATED [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::[DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix) | ( | const [SparseMatrixBase](../classeigen_1_1sparsematrixbase)< OtherDerived > & | *other* | ) | | | inlineexplicit | The class [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix "A sparse matrix class designed for matrix assembly purpose.") is deprecated ~DynamicSparseMatrix() ---------------------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::~[DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix) | ( | | ) | | | inline | Destructor coeff() ------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::coeff | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | const | | inline | Returns the coefficient value at given position *row*, *col* This operation involes a log(rho\*outer\_size) binary search. coeffRef() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::coeffRef | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | Returns a reference to the coefficient value at given position *row*, *col* This operation involes a log(rho\*outer\_size) binary search. If the coefficient does not exist yet, then a sorted insertion into a sequential buffer is performed. endFill() --------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | EIGEN\_DEPRECATED void [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::endFill | ( | | ) | | | inline | **[Deprecated:](deprecated#_deprecated000005)** use [finalize()](classeigen_1_1dynamicsparsematrix#aa0abc0e4565143f103f0d7373bd4a125) Does nothing. Provided for compatibility with [SparseMatrix](../classeigen_1_1sparsematrix). fill() ------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | EIGEN\_DEPRECATED Scalar& [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::fill | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | **[Deprecated:](deprecated#_deprecated000003)** use insert() inserts a nonzero coefficient at given coordinates *row*, *col* and returns its reference assuming that: 1 - the coefficient does not exist yet 2 - this the coefficient with greater inner coordinate for the given outer coordinate. In other words, assuming `*this` is column-major, then there must not exists any nonzero coefficient of coordinates `i` `x` *col* such that `i` >= *row*. Otherwise the matrix is invalid. See also [fillrand()](classeigen_1_1dynamicsparsematrix#a6a5eb3c9d153d8ebdf4e0967321108e2), [coeffRef()](classeigen_1_1dynamicsparsematrix#a17093cd39bd0e6ebd6250bc5feb61a0f) fillrand() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | EIGEN\_DEPRECATED Scalar& [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::fillrand | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | **[Deprecated:](deprecated#_deprecated000004)** use insert() Like [fill()](classeigen_1_1dynamicsparsematrix#a70c8f529b38fd5b7d93d6dfe1a122723) but with random inner coordinates. Compared to the generic [coeffRef()](classeigen_1_1dynamicsparsematrix#a17093cd39bd0e6ebd6250bc5feb61a0f), the unique limitation is that we assume the coefficient does not exist yet. finalize() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::finalize | ( | | ) | | | inline | Does nothing: provided for compatibility with [SparseMatrix](../classeigen_1_1sparsematrix) insertBack() ------------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::insertBack | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | Returns a reference to the non zero coefficient at position *row*, *col* assuming that:* the nonzero does not already exist * the new coefficient is the last one of the given inner vector. See also insert, [insertBackByOuterInner](classeigen_1_1dynamicsparsematrix#ac97c2463058ae55d7f0ef21c851eb5f3) insertBackByOuterInner() ------------------------ template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar& [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::insertBackByOuterInner | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *outer*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *inner* | | | ) | | | | inline | See also [insertBack](classeigen_1_1dynamicsparsematrix#a0a556652195b91c09e9f6c4d8b7cc81d) nonZeros() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::nonZeros | ( | | ) | const | | inline | Returns the number of non zero coefficients prune() ------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::prune | ( | Scalar | *reference*, | | | | RealScalar | *epsilon* = `[NumTraits](../structeigen_1_1numtraits)<RealScalar>::dummy_precision()` | | | ) | | | | inline | Suppress all nonzeros which are smaller than *reference* under the tolerance *epsilon* resize() -------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::resize | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *rows*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *cols* | | | ) | | | | inline | Resize the matrix without preserving the data (the matrix is set to zero) startFill() ----------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | EIGEN\_DEPRECATED void [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::startFill | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *reserveSize* = `1000` | ) | | | inline | **[Deprecated:](deprecated#_deprecated000002)** Set the matrix to zero and reserve the memory for *reserveSize* nonzero coefficients. startVec() ---------- template<typename \_Scalar , int \_Options, typename \_StorageIndex > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix)< \_Scalar, \_Options, \_StorageIndex >::startVec | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | | ) | | | inline | Does nothing: provided for compatibility with [SparseMatrix](../classeigen_1_1sparsematrix) --- The documentation for this class was generated from the following file:* [DynamicSparseMatrix.h](https://eigen.tuxfamily.org/dox/unsupported/DynamicSparseMatrix_8h_source.html)
programming_docs
eigen3 Eigen::SkylineMatrix Eigen::SkylineMatrix ==================== ### template<typename \_Scalar, int \_Options> class Eigen::SkylineMatrix< \_Scalar, \_Options > The main skyline matrix class. This class implements a skyline matrix using the very uncommon storage scheme. Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e. the type of the coefficients | | \_Options | Union of bit flags controlling the storage scheme. Currently the only possibility is RowMajor. The default is 0 which means column-major. | | | | --- | | | | void | [finalize](classeigen_1_1skylinematrix#a1269310d041fb3ca2a980644f3cfe5a2) () | | | | EIGEN\_DONT\_INLINE Scalar & | [insert](classeigen_1_1skylinematrix#a6e2d550f29d0dd59f83aa9d568d92c23) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) row, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) col) | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1skylinematrix#aea6d3b694cef560f15a7d18c1f010604) () const | | | | void | [reserve](classeigen_1_1skylinematrix#aac6da20a87fca9d4cb6b871504497577) ([Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) reserveSize, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) reserveUpperSize, [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) reserveLowerSize) | | | | void | [resize](classeigen_1_1skylinematrix#a918eed5cc583f6d402f0db60c5c5ad52) (size\_t rows, size\_t cols) | | | | void | [setZero](classeigen_1_1skylinematrix#afeb349e5dc4b5d8c107ff067b44438f5) () | | | | Scalar | [sum](classeigen_1_1skylinematrix#a56c9841de52e52744a2d5e6593979154) () const | | | | | [~SkylineMatrix](classeigen_1_1skylinematrix#a456b254a757d26580b2c05fe270eaae7) () | | | | Public Member Functions inherited from [Eigen::SkylineMatrixBase< SkylineMatrix< \_Scalar, \_Options > >](classeigen_1_1skylinematrixbase) | | EIGEN\_CONSTEXPR [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [cols](classeigen_1_1skylinematrixbase#aeed7d90e131bbe98835c2c66c22264c5) () const EIGEN\_NOEXCEPT | | | | const internal::eval< [SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >, IsSkyline >::type | [eval](classeigen_1_1skylinematrixbase#a8223cbedd8027149ac7a5e930d89f156) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [innerSize](classeigen_1_1skylinematrixbase#a901f2691facc1a0321740300dc7a12d7) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [nonZeros](classeigen_1_1skylinematrixbase#aaeda265186dd626052df8580779b7460) () const | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [outerSize](classeigen_1_1skylinematrixbase#a63cc4a263d32a8a225e4a42e891b8ac0) () const | | | | EIGEN\_CONSTEXPR [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [rows](classeigen_1_1skylinematrixbase#ab1bbf8b98d01a166c91c0e98fbaaab5d) () const EIGEN\_NOEXCEPT | | | | EIGEN\_CONSTEXPR [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | [size](classeigen_1_1skylinematrixbase#a3b1c3eada36fd4cb23d4feeb696bdc88) () const EIGEN\_NOEXCEPT | | | | | | --- | | | ~SkylineMatrix() ---------------- template<typename \_Scalar , int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::~[SkylineMatrix](classeigen_1_1skylinematrix) | ( | | ) | | | inline | Destructor finalize() ---------- template<typename \_Scalar , int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::finalize | ( | | ) | | | inline | Must be called after inserting a set of non zero entries. insert() -------- template<typename \_Scalar , int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | EIGEN\_DONT\_INLINE Scalar& [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::insert | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *row*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *col* | | | ) | | | | inline | Returns a reference to a novel non zero coefficient with coordinates *row* x *col*. Warning This function can be extremely slow if the non zero coefficients are not inserted in a coherent order. After an insertion session, you should call the [finalize()](classeigen_1_1skylinematrix#a1269310d041fb3ca2a980644f3cfe5a2) function. nonZeros() ---------- template<typename \_Scalar , int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::nonZeros | ( | | ) | const | | inline | Returns the number of non zero coefficients reserve() --------- template<typename \_Scalar , int \_Options> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::reserve | ( | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *reserveSize*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *reserveUpperSize*, | | | | [Index](../structeigen_1_1eigenbase#a554f30542cc2316add4b1ea0a492ff02) | *reserveLowerSize* | | | ) | | | | inline | Preallocates *reserveSize* non zeros resize() -------- template<typename \_Scalar , int \_Options> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::resize | ( | size\_t | *rows*, | | | | size\_t | *cols* | | | ) | | | | inline | Resizes the matrix to a *rows* x *cols* matrix and initializes it to zero See also resizeNonZeros(Index), [reserve()](classeigen_1_1skylinematrix#aac6da20a87fca9d4cb6b871504497577), [setZero()](classeigen_1_1skylinematrix#afeb349e5dc4b5d8c107ff067b44438f5) setZero() --------- template<typename \_Scalar , int \_Options> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | void [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::setZero | ( | | ) | | | inline | Removes all non zeros sum() ----- template<typename \_Scalar , int \_Options> | | | | | | | --- | --- | --- | --- | --- | | Scalar [Eigen::SkylineMatrix](classeigen_1_1skylinematrix)< \_Scalar, \_Options >::sum | ( | | ) | const | Overloaded for performance --- The documentation for this class was generated from the following file:* [SkylineMatrix.h](https://eigen.tuxfamily.org/dox/unsupported/SkylineMatrix_8h_source.html) eigen3 Eigen::EulerAngles Eigen::EulerAngles ================== ### template<typename \_Scalar, class \_System> class Eigen::EulerAngles< \_Scalar, \_System > Represents a rotation in a 3 dimensional space as three Euler angles. Euler rotation is a set of three rotation of three angles over three fixed axes, defined by the [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system.") given as a template parameter. Here is how intrinsic Euler angles works: * first, rotate the axes system over the alpha axis in angle alpha * then, rotate the axes system over the beta axis(which was rotated in the first stage) in angle beta * then, rotate the axes system over the gamma axis(which was rotated in the two stages above) in angle gamma Note This class support only intrinsic Euler angles for simplicity, see [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system.") how to easily overcome this for extrinsic systems. ### Rotation representation and conversions It has been proved(see Wikipedia link below) that every rotation can be represented by Euler angles, but there is no single representation (e.g. unlike rotation matrices). Therefore, you can convert from [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") rotation and to them (including rotation matrices, which is not called "rotations" by [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") design). Euler angles usually used for: * convenient human representation of rotation, especially in interactive GUI. * gimbal systems and robotics * efficient encoding(i.e. 3 floats only) of rotation for network protocols. However, Euler angles are slow comparing to quaternion or matrices, because their unnatural math definition, although it's simple for human. To overcome this, this class provide easy movement from the math friendly representation to the human friendly representation, and vise-versa. All the user need to do is a safe simple C++ type conversion, and this class take care for the math. Additionally, some axes related computation is done in compile time. #### Euler angles ranges in conversions Rotations representation as [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") are not single (unlike matrices), and even have infinite [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") representations. For example, add or subtract 2\*PI from either angle of [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") and you'll get the same rotation. This is the general reason for infinite representation, but it's not the only general reason for not having a single representation. When converting rotation to [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles."), this class convert it to specific ranges When converting some rotation to [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles."), the rules for ranges are as follow: * If the rotation we converting from is an [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") (even when it represented as [RotationBase](../classeigen_1_1rotationbase) explicitly), angles ranges are **undefined**. * otherwise, alpha and gamma angles will be in the range [-PI, PI]. As for Beta angle: + If the system is Tait-Bryan, the beta angle will be in the range [-PI/2, PI/2]. + otherwise: - If the beta axis is positive, the beta angle will be in the range [0, PI] - If the beta axis is negative, the beta angle will be in the range [-PI, 0] See also [EulerAngles(const MatrixBase<Derived>&)](classeigen_1_1eulerangles#aa7d02f35a984118d4c157a63915bd216) [EulerAngles(const RotationBase<Derived, 3>&)](classeigen_1_1eulerangles#a22539c574d7b6ca4577691f533f60061) ### Convenient user typedefs Convenient typedefs for [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") exist for float and double scalar, in a form of [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles."){A}{B}{C}{scalar}, e.g. EulerAnglesXYZd, EulerAnglesZYZf. Only for positive axes{+x,+y,+z} Euler systems are have convenient typedef. If you need negative axes{-x,-y,-z}, it is recommended to create you own typedef with a word that represent what you need. ### Example ``` #include <unsupported/Eigen/EulerAngles> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { // A common Euler system by many armies around the world, // where the first one is the azimuth(the angle from the north - // the same angle that is show in compass) // and the second one is elevation(the angle from the horizon) // and the third one is roll(the angle between the horizontal body // direction and the plane ground surface) // Keep remembering we're using radian angles here! typedef EulerSystem<-[EULER\_Z](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361a95187b9943820cca5edc4bc96b3c08be), [EULER\_Y](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361aee756a2b63043248f3d83541386c266b), [EULER\_X](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361a11e1ea88cbe04a6fc077475d515d0b38)> MyArmySystem; typedef EulerAngles<double, MyArmySystem> MyArmyAngles; MyArmyAngles vehicleAngles( 3.14/\*PI\*/ / 2, /\* heading to east, notice that this angle is counter-clockwise \*/ -0.3, /\* going down from a mountain \*/ 0.1); /\* slightly rolled to the right \*/ // Some Euler angles representation that our plane use. EulerAnglesZYZd planeAngles(0.78474, 0.5271, -0.513794); MyArmyAngles planeAnglesInMyArmyAngles(planeAngles); std::cout << "vehicle angles(MyArmy): " << vehicleAngles << std::endl; std::cout << "plane angles(ZYZ): " << planeAngles << std::endl; std::cout << "plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl; // Now lets rotate the plane a little bit std::cout << "==========================================================\n"; std::cout << "rotating plane now!\n"; std::cout << "==========================================================\n"; [Quaterniond](../group__geometry__module#ga5daab8e66aa480465000308455578830) planeRotated = [AngleAxisd](../group__geometry__module#gaed936d6e9192d97f00a9608081fa9b64)(-0.342, Vector3d::UnitY()) * planeAngles; planeAngles = planeRotated; planeAnglesInMyArmyAngles = planeRotated; std::cout << "new plane angles(ZYZ): " << planeAngles << std::endl; std::cout << "new plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl; return 0; } ``` Output: ``` vehicle angles(MyArmy): 1.57 -0.3 0.1 plane angles(ZYZ): 0.78474 0.5271 -0.513794 plane angles(MyArmy): -0.206273 0.453463 -0.278617 ========================================================== rotating plane now! ========================================================== new plane angles(ZYZ): 1.44358 0.366507 -1.23637 new plane angles(MyArmy): -0.18648 0.117896 -0.347841 ``` ### Additional reading If you're want to get more idea about how Euler system work in [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") see [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system."). More information about Euler angles: <https://en.wikipedia.org/wiki/Euler_angles> Template Parameters | | | | --- | --- | | \_Scalar | the scalar type, i.e. the type of the angles. | | \_System | the [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system.") to use, which represents the axes of rotation. | | | | --- | | | | typedef [AngleAxis](../classeigen_1_1angleaxis)< [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) > | [AngleAxisType](classeigen_1_1eulerangles#a0bc2416b52b29a213eccad8a43ce61a6) | | | | typedef [Matrix](../classeigen_1_1matrix)< [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac), 3, 3 > | [Matrix3](classeigen_1_1eulerangles#ad0f0ee8240849b0f7d028695849cdbad) | | | | typedef [Quaternion](../classeigen_1_1quaternion)< [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) > | [QuaternionType](classeigen_1_1eulerangles#adf351608cad15e660279f7323e516d3a) | | | | typedef \_Scalar | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) | | | | typedef \_System | [System](classeigen_1_1eulerangles#a17e3dee5fef4af35bbb4e319c2cdc3c1) | | | | typedef [Matrix](../classeigen_1_1matrix)< [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac), 3, 1 > | [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) | | | | | | --- | | | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) & | [alpha](classeigen_1_1eulerangles#a69942a5a9b0c3670e7f2797e84cbde8c) () | | | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) | [alpha](classeigen_1_1eulerangles#a6146f78ee0fb9d9a7d685a4654066825) () const | | | | [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) & | [angles](classeigen_1_1eulerangles#afff76daa2d6a3165a1354c349366fb80) () | | | | const [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) & | [angles](classeigen_1_1eulerangles#a2decf84b5efd265f7251fd32f539a36b) () const | | | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) & | [beta](classeigen_1_1eulerangles#a2db042cfba5486d46fdeb77fecd8e509) () | | | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) | [beta](classeigen_1_1eulerangles#a1bf59f8acaed985964c98c1f59d8f5ab) () const | | | | template<typename NewScalarType > | | [EulerAngles](classeigen_1_1eulerangles)< NewScalarType, [System](classeigen_1_1eulerangles#a17e3dee5fef4af35bbb4e319c2cdc3c1) > | [cast](classeigen_1_1eulerangles#acbabd36b148c07fb3e6a0b346fff066e) () const | | | | | [EulerAngles](classeigen_1_1eulerangles#a47be9344fbd4a5b34df45486cfaf1e2b) () | | | | template<typename Derived > | | | [EulerAngles](classeigen_1_1eulerangles#aa7d02f35a984118d4c157a63915bd216) (const [MatrixBase](../classeigen_1_1matrixbase)< Derived > &other) | | | | template<typename Derived > | | | [EulerAngles](classeigen_1_1eulerangles#a22539c574d7b6ca4577691f533f60061) (const [RotationBase](../classeigen_1_1rotationbase)< Derived, 3 > &rot) | | | | | [EulerAngles](classeigen_1_1eulerangles#a765135b6e5d35248517b4268046840b6) (const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) &[alpha](classeigen_1_1eulerangles#a6146f78ee0fb9d9a7d685a4654066825), const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) &[beta](classeigen_1_1eulerangles#a1bf59f8acaed985964c98c1f59d8f5ab), const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) &[gamma](classeigen_1_1eulerangles#aa75a5f16105d96eedf81bf9f8e789e21)) | | | | | [EulerAngles](classeigen_1_1eulerangles#a4f212a178fd75ac9e53569e7c1d97e84) (const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) \*data) | | | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) & | [gamma](classeigen_1_1eulerangles#a4c6216fa2fca4d5d70d8f44dae4cf88c) () | | | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) | [gamma](classeigen_1_1eulerangles#aa75a5f16105d96eedf81bf9f8e789e21) () const | | | | [EulerAngles](classeigen_1_1eulerangles) | [inverse](classeigen_1_1eulerangles#a1c37cedc590311d6ecaec7215d7c8f2c) () const | | | | bool | [isApprox](classeigen_1_1eulerangles#a8ab2f4cea6fca8cf604b274038218d22) (const [EulerAngles](classeigen_1_1eulerangles) &other, const RealScalar &prec=[NumTraits](../structeigen_1_1numtraits)< [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) >::dummy\_precision()) const | | | | | [operator QuaternionType](classeigen_1_1eulerangles#aa4ccd4b412c3146a9dd58a884eaea42e) () const | | | | [EulerAngles](classeigen_1_1eulerangles) | [operator-](classeigen_1_1eulerangles#a2a30e027e6f3fa275d7403c1c7e613af) () const | | | | template<class Derived > | | [EulerAngles](classeigen_1_1eulerangles) & | [operator=](classeigen_1_1eulerangles#a99446e06ed9cae7f1c8764f6264bbde3) (const [MatrixBase](../classeigen_1_1matrixbase)< Derived > &other) | | | | template<typename Derived > | | [EulerAngles](classeigen_1_1eulerangles) & | [operator=](classeigen_1_1eulerangles#abc2256872ea7e285cb915b8af82b6810) (const [RotationBase](../classeigen_1_1rotationbase)< Derived, 3 > &rot) | | | | [Matrix3](classeigen_1_1eulerangles#ad0f0ee8240849b0f7d028695849cdbad) | [toRotationMatrix](classeigen_1_1eulerangles#a11ec16b3ed918fac62d295012ec4e2ac) () const | | | | | | --- | | | | static [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) | [AlphaAxisVector](classeigen_1_1eulerangles#a33d034ea7e8cac1f4d7c329d741b9a59) () | | | | static [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) | [BetaAxisVector](classeigen_1_1eulerangles#aede24ef1ffc5913f2eb6539c1f1b9dc4) () | | | | static [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) | [GammaAxisVector](classeigen_1_1eulerangles#a77ea78dac1d599353e2a87d95cc6f1d4) () | | | AngleAxisType ------------- template<typename \_Scalar , class \_System > | | | --- | | typedef [AngleAxis](../classeigen_1_1angleaxis)<[Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac)> [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[AngleAxisType](classeigen_1_1eulerangles#a0bc2416b52b29a213eccad8a43ce61a6) | the equivalent angle-axis type Matrix3 ------- template<typename \_Scalar , class \_System > | | | --- | | typedef [Matrix](../classeigen_1_1matrix)<[Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac),3,3> [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[Matrix3](classeigen_1_1eulerangles#ad0f0ee8240849b0f7d028695849cdbad) | the equivalent rotation matrix type QuaternionType -------------- template<typename \_Scalar , class \_System > | | | --- | | typedef [Quaternion](../classeigen_1_1quaternion)<[Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac)> [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[QuaternionType](classeigen_1_1eulerangles#adf351608cad15e660279f7323e516d3a) | the equivalent quaternion type Scalar ------ template<typename \_Scalar , class \_System > | | | --- | | typedef \_Scalar [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) | the scalar type of the angles System ------ template<typename \_Scalar , class \_System > | | | --- | | typedef \_System [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[System](classeigen_1_1eulerangles#a17e3dee5fef4af35bbb4e319c2cdc3c1) | the [EulerSystem](classeigen_1_1eulersystem "Represents a fixed Euler rotation system.") to use, which represents the axes of rotation. Vector3 ------- template<typename \_Scalar , class \_System > | | | --- | | typedef [Matrix](../classeigen_1_1matrix)<[Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac),3,1> [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) | the equivalent 3 dimension vector type EulerAngles() [1/5] ------------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[EulerAngles](classeigen_1_1eulerangles) | ( | | ) | | | inline | Default constructor without initialization. EulerAngles() [2/5] ------------------- template<typename \_Scalar , class \_System > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[EulerAngles](classeigen_1_1eulerangles) | ( | const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) & | *alpha*, | | | | const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) & | *beta*, | | | | const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) & | *gamma* | | | ) | | | | inline | Constructs and initialize an [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") (`alpha`, `beta`, `gamma`). EulerAngles() [3/5] ------------------- template<typename \_Scalar , class \_System > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[EulerAngles](classeigen_1_1eulerangles) | ( | const [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) \* | *data* | ) | | | inlineexplicit | Constructs and initialize an [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") from the array data {alpha, beta, gamma} EulerAngles() [4/5] ------------------- template<typename \_Scalar , class \_System > template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[EulerAngles](classeigen_1_1eulerangles) | ( | const [MatrixBase](../classeigen_1_1matrixbase)< Derived > & | *other* | ) | | | inlineexplicit | Constructs and initializes an [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") from either: * a 3x3 rotation matrix expression(i.e. pure orthogonal matrix with determinant of +1), * a 3D vector expression representing Euler angles. Note If `other` is a 3x3 rotation matrix, the angles range rules will be as follow: Alpha and gamma angles will be in the range [-PI, PI]. As for Beta angle:* If the system is Tait-Bryan, the beta angle will be in the range [-PI/2, PI/2]. * otherwise: + If the beta axis is positive, the beta angle will be in the range [0, PI] + If the beta axis is negative, the beta angle will be in the range [-PI, 0] EulerAngles() [5/5] ------------------- template<typename \_Scalar , class \_System > template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::[EulerAngles](classeigen_1_1eulerangles) | ( | const [RotationBase](../classeigen_1_1rotationbase)< Derived, 3 > & | *rot* | ) | | | inline | Constructs and initialize Euler angles from a rotation `rot`. Note If `rot` is an [EulerAngles](classeigen_1_1eulerangles "Represents a rotation in a 3 dimensional space as three Euler angles.") (even when it represented as [RotationBase](../classeigen_1_1rotationbase) explicitly), angles ranges are **undefined**. Otherwise, alpha and gamma angles will be in the range [-PI, PI]. As for Beta angle:* If the system is Tait-Bryan, the beta angle will be in the range [-PI/2, PI/2]. * otherwise: + If the beta axis is positive, the beta angle will be in the range [0, PI] + If the beta axis is negative, the beta angle will be in the range [-PI, 0] alpha() [1/2] ------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::alpha | ( | | ) | | | inline | Returns A read-write reference to the angle of the first angle. alpha() [2/2] ------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::alpha | ( | | ) | const | | inline | Returns The value of the first angle. AlphaAxisVector() ----------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | static [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::AlphaAxisVector | ( | | ) | | | inlinestatic | Returns the axis vector of the first (alpha) rotation angles() [1/2] -------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::angles | ( | | ) | | | inline | Returns A read-write reference to the angle values stored in a vector (alpha, beta, gamma). angles() [2/2] -------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::angles | ( | | ) | const | | inline | Returns The angle values stored in a vector (alpha, beta, gamma). beta() [1/2] ------------ template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::beta | ( | | ) | | | inline | Returns A read-write reference to the angle of the second angle. beta() [2/2] ------------ template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::beta | ( | | ) | const | | inline | Returns The value of the second angle. BetaAxisVector() ---------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | static [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::BetaAxisVector | ( | | ) | | | inlinestatic | Returns the axis vector of the second (beta) rotation cast() ------ template<typename \_Scalar , class \_System > template<typename NewScalarType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [EulerAngles](classeigen_1_1eulerangles)<NewScalarType, [System](classeigen_1_1eulerangles#a17e3dee5fef4af35bbb4e319c2cdc3c1)> [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::cast | ( | | ) | const | | inline | Returns `*this` with scalar type casted to *NewScalarType* gamma() [1/2] ------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::gamma | ( | | ) | | | inline | Returns A read-write reference to the angle of the third angle. gamma() [2/2] ------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::gamma | ( | | ) | const | | inline | Returns The value of the third angle. GammaAxisVector() ----------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | static [Vector3](classeigen_1_1eulerangles#af0f446aa0f46b3439abedff63fabf39c) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::GammaAxisVector | ( | | ) | | | inlinestatic | Returns the axis vector of the third (gamma) rotation inverse() --------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [EulerAngles](classeigen_1_1eulerangles) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::inverse | ( | | ) | const | | inline | Returns The Euler angles rotation inverse (which is as same as the negative), (-alpha, -beta, -gamma). isApprox() ---------- template<typename \_Scalar , class \_System > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | bool [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::isApprox | ( | const [EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System > & | *other*, | | | | const RealScalar & | *prec* = `[NumTraits](../structeigen_1_1numtraits)<[Scalar](classeigen_1_1eulerangles#a2ab1d433ac9683268446f8905ac31aac)>::dummy_precision()` | | | ) | | const | | inline | Returns `true` if `*this` is approximately equal to *other*, within the precision determined by *prec*. See also [MatrixBase::isApprox()](../classeigen_1_1densebase#ae8443357b808cd393be1b51974213f9c) operator QuaternionType() ------------------------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::operator [QuaternionType](classeigen_1_1eulerangles#adf351608cad15e660279f7323e516d3a) | ( | | ) | const | | inline | Convert the Euler angles to quaternion. operator-() ----------- template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [EulerAngles](classeigen_1_1eulerangles) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::operator- | ( | | ) | const | | inline | Returns The Euler angles rotation negative (which is as same as the inverse), (-alpha, -beta, -gamma). operator=() [1/2] ----------------- template<typename \_Scalar , class \_System > template<class Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [EulerAngles](classeigen_1_1eulerangles)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::operator= | ( | const [MatrixBase](../classeigen_1_1matrixbase)< Derived > & | *other* | ) | | | inline | Set `*this` from either: * a 3x3 rotation matrix expression(i.e. pure orthogonal matrix with determinant of +1), * a 3D vector expression representing Euler angles. See EulerAngles(const MatrixBase<Derived, 3>&) for more information about angles ranges output. operator=() [2/2] ----------------- template<typename \_Scalar , class \_System > template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [EulerAngles](classeigen_1_1eulerangles)& [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::operator= | ( | const [RotationBase](../classeigen_1_1rotationbase)< Derived, 3 > & | *rot* | ) | | | inline | Set `*this` from a rotation. See [EulerAngles(const RotationBase<Derived, 3>&)](classeigen_1_1eulerangles#a22539c574d7b6ca4577691f533f60061) for more information about angles ranges output. toRotationMatrix() ------------------ template<typename \_Scalar , class \_System > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Matrix3](classeigen_1_1eulerangles#ad0f0ee8240849b0f7d028695849cdbad) [Eigen::EulerAngles](classeigen_1_1eulerangles)< \_Scalar, \_System >::toRotationMatrix | ( | | ) | const | | inline | Returns an equivalent 3x3 rotation matrix. --- The documentation for this class was generated from the following file:* [EulerAngles.h](https://eigen.tuxfamily.org/dox/unsupported/EulerAngles_8h_source.html)
programming_docs
eigen3 Eigen::MatrixPowerReturnValue Eigen::MatrixPowerReturnValue ============================= ### template<typename Derived> class Eigen::MatrixPowerReturnValue< Derived > Proxy for the matrix power of some matrix (expression). Template Parameters | | | | --- | --- | | Derived | type of the base, a matrix (expression). | This class holds the arguments to the matrix power until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of [MatrixBase::pow()](../classeigen_1_1matrixbase#a7ae6c25e6a94a60e147741e76203a73b) and related functions and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixPowerReturnValue< Derived > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](classeigen_1_1matrixpowerreturnvalue#a5f15ad16576debad4d4cc0798ff63172) (ResultType &result) const | | | Compute the matrix power. [More...](classeigen_1_1matrixpowerreturnvalue#a5f15ad16576debad4d4cc0798ff63172) | | | | | [MatrixPowerReturnValue](classeigen_1_1matrixpowerreturnvalue#a3067e09b352f967a23bb2a9c50afee88) (const Derived &A, RealScalar p) | | | Constructor. [More...](classeigen_1_1matrixpowerreturnvalue#a3067e09b352f967a23bb2a9c50afee88) | | | MatrixPowerReturnValue() ------------------------ template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::MatrixPowerReturnValue](classeigen_1_1matrixpowerreturnvalue)< Derived >::[MatrixPowerReturnValue](classeigen_1_1matrixpowerreturnvalue) | ( | const Derived & | *A*, | | | | RealScalar | *p* | | | ) | | | | inline | Constructor. Parameters | | | | | --- | --- | --- | | [in] | A | Matrix (expression), the base of the matrix power. | | [in] | p | real scalar, the exponent of the matrix power. | evalTo() -------- template<typename Derived > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixPowerReturnValue](classeigen_1_1matrixpowerreturnvalue)< Derived >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix power. Parameters | | | | | --- | --- | --- | | [out] | result | \( A^p \) where `A` and `p` are as in the constructor. | --- The documentation for this class was generated from the following file:* [MatrixPower.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixPower_8h_source.html) eigen3 Eigen::TensorMap Eigen::TensorMap ================ ### template<typename PlainObjectType, int Options\_, template< class > class MakePointer\_> class Eigen::TensorMap< PlainObjectType, Options\_, MakePointer\_ > A tensor expression mapping an existing array of data. `template <class> class MakePointer_` is added to convert the host pointer to the device pointer. It is added due to the fact that for our device compiler `T*` is not allowed. If we wanted to use the same Evaluator functions we have to convert that type to our pointer `T`. This is done through our `MakePointer_` class. By default the Type in the `MakePointer_<T>` is `T*` . Therefore, by adding the default value, we managed to convert the type and it does not break any existing code as its default value is `T*`. --- The documentation for this class was generated from the following files:* [TensorForwardDeclarations.h](https://eigen.tuxfamily.org/dox/unsupported/TensorForwardDeclarations_8h_source.html) * [TensorMap.h](https://eigen.tuxfamily.org/dox/unsupported/TensorMap_8h_source.html) eigen3 Eigen::TensorAsyncDevice Eigen::TensorAsyncDevice ======================== ### template<typename ExpressionType, typename DeviceType, typename DoneCallback> class Eigen::TensorAsyncDevice< ExpressionType, DeviceType, DoneCallback > Pseudo expression providing an operator = that will evaluate its argument asynchronously on the specified device. Currently only ThreadPoolDevice implements proper asynchronous execution, while the default and GPU devices just run the expression synchronously and call m\_done() on completion.. Example: auto done = []() { ... expression evaluation done ... }; C.device(thread\_pool\_device, std::move(done)) = A + B; --- The documentation for this class was generated from the following file:* [TensorDevice.h](https://eigen.tuxfamily.org/dox/unsupported/TensorDevice_8h_source.html) eigen3 Eigen::IterScaling Eigen::IterScaling ================== ### template<typename \_MatrixType> class Eigen::IterScaling< \_MatrixType > iterative scaling algorithm to equilibrate rows and column norms in matrices This class can be used as a preprocessing tool to accelerate the convergence of iterative methods This feature is useful to limit the pivoting amount during LU/ILU factorization The scaling strategy as presented here preserves the symmetry of the problem NOTE It is assumed that the matrix does not have empty row or column, Example with key steps ``` VectorXd x(n), b(n); SparseMatrix<double> A; // fill A and b; IterScaling<SparseMatrix<double> > scal; // Compute the left and right scaling vectors. The matrix is equilibrated at output scal.computeRef(A); // Scale the right hand side b = scal.LeftScaling().cwiseProduct(b); // Now, solve the equilibrated linear system with any available solver // Scale back the computed solution x = scal.RightScaling().cwiseProduct(x); ``` Template Parameters | | | | --- | --- | | \_MatrixType | the type of the matrix. It should be a real square sparsematrix | References : D. Ruiz and B. Ucar, A Symmetry Preserving Algorithm for [Matrix](../classeigen_1_1matrix) Scaling, INRIA Research report RR-7552 See also [IncompleteLUT](../classeigen_1_1incompletelut) | | | --- | | | | void | [compute](classeigen_1_1iterscaling#a6a76754399fd004b3ac6011e272ffb71) (const MatrixType &mat) | | | | void | [computeRef](classeigen_1_1iterscaling#aeff5ccef2ccb32c6f472a190f8a511af) (MatrixType &mat) | | | | VectorXd & | [LeftScaling](classeigen_1_1iterscaling#ab88d288be912d90a1e597e5dab0bd47b) () | | | | VectorXd & | [RightScaling](classeigen_1_1iterscaling#a617229454935a6a4fda76b8af56c52ea) () | | | | void | [setTolerance](classeigen_1_1iterscaling#acbca5170d8043f40e387bcb6a42f8b71) (double tol) | | | compute() --------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IterScaling](classeigen_1_1iterscaling)< \_MatrixType >::compute | ( | const MatrixType & | *mat* | ) | | | inline | Compute the left and right diagonal matrices to scale the input matrix `mat` FIXME This algorithm will be modified such that the diagonal elements are permuted on the diagonal. See also [LeftScaling()](classeigen_1_1iterscaling#ab88d288be912d90a1e597e5dab0bd47b) [RightScaling()](classeigen_1_1iterscaling#a617229454935a6a4fda76b8af56c52ea) computeRef() ------------ template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IterScaling](classeigen_1_1iterscaling)< \_MatrixType >::computeRef | ( | MatrixType & | *mat* | ) | | | inline | Compute the left and right vectors to scale the vectors the input matrix is scaled with the computed vectors at output See also [compute()](classeigen_1_1iterscaling#a6a76754399fd004b3ac6011e272ffb71) LeftScaling() ------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | VectorXd& [Eigen::IterScaling](classeigen_1_1iterscaling)< \_MatrixType >::LeftScaling | ( | | ) | | | inline | Get the vector to scale the rows of the matrix RightScaling() -------------- template<typename \_MatrixType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | VectorXd& [Eigen::IterScaling](classeigen_1_1iterscaling)< \_MatrixType >::RightScaling | ( | | ) | | | inline | Get the vector to scale the columns of the matrix setTolerance() -------------- template<typename \_MatrixType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IterScaling](classeigen_1_1iterscaling)< \_MatrixType >::setTolerance | ( | double | *tol* | ) | | | inline | Set the tolerance for the convergence of the iterative scaling algorithm --- The documentation for this class was generated from the following file:* [Scaling.h](https://eigen.tuxfamily.org/dox/unsupported/Scaling_8h_source.html) eigen3 Eigen::AutoDiffScalar Eigen::AutoDiffScalar ===================== ### template<typename DerivativeType> class Eigen::AutoDiffScalar< DerivativeType > A scalar type replacement with automatic differentiation capability. Parameters | | | | --- | --- | | DerivativeType | the vector type used to store/represent the derivatives. The base scalar type as well as the number of derivatives to compute are determined from this type. Typical choices include, e.g., `Vector4f` for 4 derivatives, or `VectorXf` if the number of derivatives is not known at compile time, and/or, the number of derivatives is large. Note that DerivativeType can also be a reference (e.g., `VectorXf&`) to wrap a existing vector into an [AutoDiffScalar](classeigen_1_1autodiffscalar "A scalar type replacement with automatic differentiation capability."). Finally, DerivativeType can also be any [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") compatible expression. | This class represents a scalar value while tracking its respective derivatives using [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.")'s expression template mechanism. It supports the following list of global math function: * std::abs, std::sqrt, std::pow, std::exp, std::log, std::sin, std::cos, * internal::abs, internal::sqrt, numext::pow, internal::exp, internal::log, internal::sin, internal::cos, * internal::conj, internal::real, internal::imag, numext::abs2. [AutoDiffScalar](classeigen_1_1autodiffscalar "A scalar type replacement with automatic differentiation capability.") can be used as the scalar type of an [Eigen::Matrix](../classeigen_1_1matrix) object. However, in that case, the expression template mechanism only occurs at the top [Matrix](../classeigen_1_1matrix) level, while derivatives are computed right away. Inherits Eigen::internal::auto\_diff\_special\_op< DerivativeType, !internal::is\_same< internal::traits< internal::remove\_all< DerivativeType >::type >::Scalar, NumTraits< internal::traits< internal::remove\_all< DerivativeType >::type >::Scalar >::Real >::value >. | | | --- | | | | | [AutoDiffScalar](classeigen_1_1autodiffscalar#a0c41ac30584453395197d74637919aef) () | | | | | [AutoDiffScalar](classeigen_1_1autodiffscalar#adbf812d694d82049f27b55fbd6c1fb50) (const Real &value) | | | | | [AutoDiffScalar](classeigen_1_1autodiffscalar#ae6483e33249241b62b9f2506faaf8bbf) (const Scalar &value, const DerType &der) | | | | | [AutoDiffScalar](classeigen_1_1autodiffscalar#ac495df4f841747d994c15970804b0f55) (const Scalar &value, int nbDer, int derNumber) | | | AutoDiffScalar() [1/4] ---------------------- template<typename DerivativeType > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::AutoDiffScalar](classeigen_1_1autodiffscalar)< DerivativeType >::[AutoDiffScalar](classeigen_1_1autodiffscalar) | ( | | ) | | | inline | Default constructor without any initialization. AutoDiffScalar() [2/4] ---------------------- template<typename DerivativeType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::AutoDiffScalar](classeigen_1_1autodiffscalar)< DerivativeType >::[AutoDiffScalar](classeigen_1_1autodiffscalar) | ( | const Scalar & | *value*, | | | | int | *nbDer*, | | | | int | *derNumber* | | | ) | | | | inline | Constructs an active scalar from its *value*, and initializes the *nbDer* derivatives such that it corresponds to the *derNumber* -th variable AutoDiffScalar() [3/4] ---------------------- template<typename DerivativeType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::AutoDiffScalar](classeigen_1_1autodiffscalar)< DerivativeType >::[AutoDiffScalar](classeigen_1_1autodiffscalar) | ( | const Real & | *value* | ) | | | inline | Conversion from a scalar constant to an active scalar. The derivatives are set to zero. AutoDiffScalar() [4/4] ---------------------- template<typename DerivativeType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::AutoDiffScalar](classeigen_1_1autodiffscalar)< DerivativeType >::[AutoDiffScalar](classeigen_1_1autodiffscalar) | ( | const Scalar & | *value*, | | | | const DerType & | *der* | | | ) | | | | inline | Constructs an active scalar from its *value* and derivatives *der* --- The documentation for this class was generated from the following file:* [AutoDiffScalar.h](https://eigen.tuxfamily.org/dox/unsupported/AutoDiffScalar_8h_source.html) eigen3 Eigen::SplineFitting Eigen::SplineFitting ==================== ### template<typename SplineType> struct Eigen::SplineFitting< SplineType > [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") fitting methods. | | | --- | | | | template<typename PointArrayType > | | static SplineType | [Interpolate](structeigen_1_1splinefitting#adc80b6f0dd0dbbea28130fb254626874) (const PointArrayType &pts, DenseIndex degree) | | | Fits an interpolating [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") to the given data points. [More...](structeigen_1_1splinefitting#adc80b6f0dd0dbbea28130fb254626874) | | | | template<typename PointArrayType > | | static SplineType | [Interpolate](structeigen_1_1splinefitting#af08185c8b635283f7c76efe91576cc83) (const PointArrayType &pts, DenseIndex degree, const KnotVectorType &knot\_parameters) | | | Fits an interpolating [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") to the given data points. [More...](structeigen_1_1splinefitting#af08185c8b635283f7c76efe91576cc83) | | | | template<typename PointArrayType , typename IndexArray > | | static SplineType | [InterpolateWithDerivatives](structeigen_1_1splinefitting#a7bd937fdcfa168dbdc27932886a4da9f) (const PointArrayType &points, const PointArrayType &derivatives, const IndexArray &derivativeIndices, const unsigned int degree) | | | Fits an interpolating spline to the given data points and derivatives. [More...](structeigen_1_1splinefitting#a7bd937fdcfa168dbdc27932886a4da9f) | | | | template<typename PointArrayType , typename IndexArray > | | static SplineType | [InterpolateWithDerivatives](structeigen_1_1splinefitting#a0317c97f2b57ccf5dcf077409d51e54d) (const PointArrayType &points, const PointArrayType &derivatives, const IndexArray &derivativeIndices, const unsigned int degree, const ParameterVectorType &parameters) | | | Fits an interpolating spline to the given data points and derivatives. [More...](structeigen_1_1splinefitting#a0317c97f2b57ccf5dcf077409d51e54d) | | | Interpolate() [1/2] ------------------- template<typename SplineType > template<typename PointArrayType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | SplineType [Eigen::SplineFitting](structeigen_1_1splinefitting)< SplineType >::Interpolate | ( | const PointArrayType & | *pts*, | | | | DenseIndex | *degree* | | | ) | | | | static | Fits an interpolating [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") to the given data points. Parameters | | | | --- | --- | | pts | The points for which an interpolating spline will be computed. | | degree | The degree of the interpolating spline. | Returns A spline interpolating the initially provided points. Interpolate() [2/2] ------------------- template<typename SplineType > template<typename PointArrayType > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | SplineType [Eigen::SplineFitting](structeigen_1_1splinefitting)< SplineType >::Interpolate | ( | const PointArrayType & | *pts*, | | | | DenseIndex | *degree*, | | | | const KnotVectorType & | *knot\_parameters* | | | ) | | | | static | Fits an interpolating [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") to the given data points. Parameters | | | | --- | --- | | pts | The points for which an interpolating spline will be computed. | | degree | The degree of the interpolating spline. | | knot\_parameters | The knot parameters for the interpolation. | Returns A spline interpolating the initially provided points. InterpolateWithDerivatives() [1/2] ---------------------------------- template<typename SplineType > template<typename PointArrayType , typename IndexArray > | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | SplineType [Eigen::SplineFitting](structeigen_1_1splinefitting)< SplineType >::InterpolateWithDerivatives | ( | const PointArrayType & | *points*, | | | | const PointArrayType & | *derivatives*, | | | | const IndexArray & | *derivativeIndices*, | | | | const unsigned int | *degree* | | | ) | | | | static | Fits an interpolating spline to the given data points and derivatives. Parameters | | | | --- | --- | | points | The points for which an interpolating spline will be computed. | | derivatives | The desired derivatives of the interpolating spline at interpolation points. | | derivativeIndices | An array indicating which point each derivative belongs to. This must be the same size as *derivatives*. | | degree | The degree of the interpolating spline. | Returns A spline interpolating *points* with *derivatives* at those points. See also Les A. Piegl, Khairan Rajab, Volha Smarodzinana. 2008. Curve interpolation with directional constraints for engineering design. Engineering with Computers InterpolateWithDerivatives() [2/2] ---------------------------------- template<typename SplineType > template<typename PointArrayType , typename IndexArray > | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | SplineType [Eigen::SplineFitting](structeigen_1_1splinefitting)< SplineType >::InterpolateWithDerivatives | ( | const PointArrayType & | *points*, | | | | const PointArrayType & | *derivatives*, | | | | const IndexArray & | *derivativeIndices*, | | | | const unsigned int | *degree*, | | | | const ParameterVectorType & | *parameters* | | | ) | | | | static | Fits an interpolating spline to the given data points and derivatives. Parameters | | | | --- | --- | | points | The points for which an interpolating spline will be computed. | | derivatives | The desired derivatives of the interpolating spline at interpolation points. | | derivativeIndices | An array indicating which point each derivative belongs to. This must be the same size as *derivatives*. | | degree | The degree of the interpolating spline. | | parameters | The parameters corresponding to the interpolation points. | Returns A spline interpolating *points* with *derivatives* at those points. See also Les A. Piegl, Khairan Rajab, Volha Smarodzinana. 2008. Curve interpolation with directional constraints for engineering design. Engineering with Computers --- The documentation for this struct was generated from the following file:* [SplineFitting.h](https://eigen.tuxfamily.org/dox/unsupported/SplineFitting_8h_source.html)
programming_docs
eigen3 Eigen::Spline Eigen::Spline ============= ### template<typename \_Scalar, int \_Dim, int \_Degree> class Eigen::Spline< \_Scalar, \_Dim, \_Degree > A class representing multi-dimensional spline curves. The class represents B-splines with non-uniform knot vectors. Each control point of the B-spline is associated with a basis function \begin{align\*} C(u) & = \sum\_{i=0}^{n}N\_{i,p}(u)P\_i \end{align\*} Template Parameters | | | | --- | --- | | \_Scalar | The underlying data type (typically float or double) | | \_Dim | The curve dimension (e.g. 2 or 3) | | \_Degree | Per default set to Dynamic; could be set to the actual desired degree for optimization purposes (would result in stack allocation of several temporary variables). | | | | --- | | | | enum | { [Dimension](classeigen_1_1spline#addd9e94417775ca7f1ff41e48a4eb594ae0308df454dc12fe04b50909acccc432) } | | | | enum | { [Degree](classeigen_1_1spline#a9a67788e6a956eda63db28893fc09e71aeb9d45bc9095c3065fa5fa2e0ac3e061) } | | | | typedef SplineTraits< [Spline](classeigen_1_1spline) >::[BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) | [BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) | | | The data type used to store the values of the basis function derivatives. | | | | typedef SplineTraits< [Spline](classeigen_1_1spline) >::[BasisVectorType](classeigen_1_1spline#a1d49cef942ea59d85d1711ee32354e6b) | [BasisVectorType](classeigen_1_1spline#a1d49cef942ea59d85d1711ee32354e6b) | | | The data type used to store non-zero basis functions. | | | | typedef SplineTraits< [Spline](classeigen_1_1spline) >::[ControlPointVectorType](classeigen_1_1spline#ac42c673462a98ad1779761bebeb450bf) | [ControlPointVectorType](classeigen_1_1spline#ac42c673462a98ad1779761bebeb450bf) | | | The data type representing the spline's control points. | | | | typedef SplineTraits< [Spline](classeigen_1_1spline) >::[KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) | [KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) | | | The data type used to store knot vectors. | | | | typedef SplineTraits< [Spline](classeigen_1_1spline) >::[ParameterVectorType](classeigen_1_1spline#a04bcc878ef5c8316e8cc60b4cf00d77c) | [ParameterVectorType](classeigen_1_1spline#a04bcc878ef5c8316e8cc60b4cf00d77c) | | | The data type used to store parameter vectors. | | | | typedef SplineTraits< [Spline](classeigen_1_1spline) >::[PointType](classeigen_1_1spline#a9ade8a2f81dae6eedb8845cb080672bd) | [PointType](classeigen_1_1spline#a9ade8a2f81dae6eedb8845cb080672bd) | | | The point type the spline is representing. | | | | typedef \_Scalar | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | | | | | | --- | | | | SplineTraits< [Spline](classeigen_1_1spline) >::[BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) | [basisFunctionDerivatives](classeigen_1_1spline#a17d416e814d1ee957e5b309dc423751f) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, DenseIndex order) const | | | Computes the non-zero spline basis function derivatives up to given order. [More...](classeigen_1_1spline#a17d416e814d1ee957e5b309dc423751f) | | | | template<int DerivativeOrder> | | SplineTraits< [Spline](classeigen_1_1spline), DerivativeOrder >::[BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) | [basisFunctionDerivatives](classeigen_1_1spline#acd36d8b5a4f57eb1d7f27989ac6d54ac) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, DenseIndex order=DerivativeOrder) const | | | Computes the non-zero spline basis function derivatives up to given order. [More...](classeigen_1_1spline#acd36d8b5a4f57eb1d7f27989ac6d54ac) | | | | SplineTraits< [Spline](classeigen_1_1spline) >::[BasisVectorType](classeigen_1_1spline#a1d49cef942ea59d85d1711ee32354e6b) | [basisFunctions](classeigen_1_1spline#afe0997f0bb02a3fac3073016abac04c6) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u) const | | | Computes the non-zero basis functions at the given site. [More...](classeigen_1_1spline#afe0997f0bb02a3fac3073016abac04c6) | | | | const [ControlPointVectorType](classeigen_1_1spline#ac42c673462a98ad1779761bebeb450bf) & | [ctrls](classeigen_1_1spline#a0fc81e475d3a0ba34da1bd97f2e8fbc7) () const | | | Returns the ctrls of the underlying spline. | | | | DenseIndex | [degree](classeigen_1_1spline#a0df23e941ac0f31dcd095a4dd4f4a7ec) () const | | | Returns the spline degree. | | | | SplineTraits< [Spline](classeigen_1_1spline) >::DerivativeType | [derivatives](classeigen_1_1spline#a196730cf190dfa16907db888277e5aed) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, DenseIndex order) const | | | Evaluation of spline derivatives of up-to given order. [More...](classeigen_1_1spline#a196730cf190dfa16907db888277e5aed) | | | | template<int DerivativeOrder> | | SplineTraits< [Spline](classeigen_1_1spline), DerivativeOrder >::DerivativeType | [derivatives](classeigen_1_1spline#a50bcf6c99a95ecab7c475f3ab503ee22) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, DenseIndex order=DerivativeOrder) const | | | Evaluation of spline derivatives of up-to given order. [More...](classeigen_1_1spline#a50bcf6c99a95ecab7c475f3ab503ee22) | | | | const [KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) & | [knots](classeigen_1_1spline#ae3eac8af580ad880d8ad3a259d453aa1) () const | | | Returns the knots of the underlying spline. | | | | [PointType](classeigen_1_1spline#a9ade8a2f81dae6eedb8845cb080672bd) | [operator()](classeigen_1_1spline#a3c7e1838eae4ee7e341ef9d3dbf9ba45) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u) const | | | Returns the spline value at a given site \(u\). [More...](classeigen_1_1spline#a3c7e1838eae4ee7e341ef9d3dbf9ba45) | | | | DenseIndex | [span](classeigen_1_1spline#ab62751802b4cc237aadb0dbf3455df98) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u) const | | | Returns the span within the knot vector in which u is falling. [More...](classeigen_1_1spline#ab62751802b4cc237aadb0dbf3455df98) | | | | | [Spline](classeigen_1_1spline#a25ebf3b3621db98ffe60eba3c0d64025) () | | | Creates a (constant) zero spline. For Splines with dynamic degree, the resulting degree will be 0. | | | | template<typename OtherVectorType , typename OtherArrayType > | | | [Spline](classeigen_1_1spline#ac9dfdbeabf9573642d970e29e92dd2be) (const OtherVectorType &[knots](classeigen_1_1spline#ae3eac8af580ad880d8ad3a259d453aa1), const OtherArrayType &[ctrls](classeigen_1_1spline#a0fc81e475d3a0ba34da1bd97f2e8fbc7)) | | | Creates a spline from a knot vector and control points. [More...](classeigen_1_1spline#ac9dfdbeabf9573642d970e29e92dd2be) | | | | template<int OtherDegree> | | | [Spline](classeigen_1_1spline#a0e6083605acc9f565e8bf4057b3f4bd3) (const [Spline](classeigen_1_1spline)< [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742), [Dimension](classeigen_1_1spline#addd9e94417775ca7f1ff41e48a4eb594ae0308df454dc12fe04b50909acccc432), OtherDegree > &spline) | | | Copy constructor for splines. [More...](classeigen_1_1spline#a0e6083605acc9f565e8bf4057b3f4bd3) | | | | | | --- | | | | static [BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) | [BasisFunctionDerivatives](classeigen_1_1spline#ab5d0d30713ca56dcd33dbb37c262829a) (const [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, const DenseIndex order, const DenseIndex [degree](classeigen_1_1spline#a0df23e941ac0f31dcd095a4dd4f4a7ec), const [KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) &[knots](classeigen_1_1spline#ae3eac8af580ad880d8ad3a259d453aa1)) | | | Computes the non-zero spline basis function derivatives up to given order. [More...](classeigen_1_1spline#ab5d0d30713ca56dcd33dbb37c262829a) | | | | static [BasisVectorType](classeigen_1_1spline#a1d49cef942ea59d85d1711ee32354e6b) | [BasisFunctions](classeigen_1_1spline#aac1839e8a956636d76bec24a4afc27e2) ([Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, DenseIndex [degree](classeigen_1_1spline#a0df23e941ac0f31dcd095a4dd4f4a7ec), const [KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) &[knots](classeigen_1_1spline#ae3eac8af580ad880d8ad3a259d453aa1)) | | | Returns the spline's non-zero basis functions. [More...](classeigen_1_1spline#aac1839e8a956636d76bec24a4afc27e2) | | | | static DenseIndex | [Span](classeigen_1_1spline#aaba7632c61b84194e890696c2b57be1b) (typename SplineTraits< [Spline](classeigen_1_1spline) >::[Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) u, DenseIndex [degree](classeigen_1_1spline#a0df23e941ac0f31dcd095a4dd4f4a7ec), const typename SplineTraits< [Spline](classeigen_1_1spline) >::[KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) &[knots](classeigen_1_1spline#ae3eac8af580ad880d8ad3a259d453aa1)) | | | Computes the span within the provided knot vector in which u is falling. | | | Scalar ------ template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | typedef \_Scalar [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::[Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | The spline curve's scalar type. anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | Dimension | The spline curve's dimension. | anonymous enum -------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | --- | | anonymous enum | | Enumerator | | --- | | Degree | The spline curve's degree. | Spline() [1/2] -------------- template<typename \_Scalar , int \_Dim, int \_Degree> template<typename OtherVectorType , typename OtherArrayType > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::[Spline](classeigen_1_1spline) | ( | const OtherVectorType & | *knots*, | | | | const OtherArrayType & | *ctrls* | | | ) | | | | inline | Creates a spline from a knot vector and control points. Parameters | | | | --- | --- | | knots | The spline's knot vector. | | ctrls | The spline's control point vector. | Spline() [2/2] -------------- template<typename \_Scalar , int \_Dim, int \_Degree> template<int OtherDegree> | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::[Spline](classeigen_1_1spline) | ( | const [Spline](classeigen_1_1spline)< [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742), [Dimension](classeigen_1_1spline#addd9e94417775ca7f1ff41e48a4eb594ae0308df454dc12fe04b50909acccc432), OtherDegree > & | *spline* | ) | | | inline | Copy constructor for splines. Parameters | | | | --- | --- | | spline | The input spline. | BasisFunctionDerivatives() -------------------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | SplineTraits< [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree > >::[BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::BasisFunctionDerivatives | ( | const [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u*, | | | | const DenseIndex | *order*, | | | | const DenseIndex | *degree*, | | | | const [KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) & | *knots* | | | ) | | | | static | Computes the non-zero spline basis function derivatives up to given order. The function computes \begin{align\*} \frac{d^i}{du^i} N\_{i,p}(u), \hdots, \frac{d^i}{du^i} N\_{i+p+1,p}(u) \end{align\*} with i ranging from 0 up to the specified order. Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the non-zero basis function derivatives are computed. | | order | The order up to which the basis function derivatives are computes. | | degree | The degree of the underlying spline | | knots | The underlying spline's knot vector. | basisFunctionDerivatives() [1/2] -------------------------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | --- | --- | --- | --- | | SplineTraits< [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >, DerivativeOrder >::[BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::basisFunctionDerivatives | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u*, | | | | DenseIndex | *order* | | | ) | | const | Computes the non-zero spline basis function derivatives up to given order. The function computes \begin{align\*} \frac{d^i}{du^i} N\_{i,p}(u), \hdots, \frac{d^i}{du^i} N\_{i+p+1,p}(u) \end{align\*} with i ranging from 0 up to the specified order. Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the non-zero basis function derivatives are computed. | | order | The order up to which the basis function derivatives are computes. | basisFunctionDerivatives() [2/2] -------------------------------- template<typename \_Scalar , int \_Dim, int \_Degree> template<int DerivativeOrder> | | | | | | --- | --- | --- | --- | | SplineTraits<[Spline](classeigen_1_1spline),DerivativeOrder>::[BasisDerivativeType](classeigen_1_1spline#a9db0b0108353660cd03524f2e67d6b3c) [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::basisFunctionDerivatives | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u*, | | | | DenseIndex | *order* = `DerivativeOrder` | | | ) | | const | Computes the non-zero spline basis function derivatives up to given order. The function computes \begin{align\*} \frac{d^i}{du^i} N\_{i,p}(u), \hdots, \frac{d^i}{du^i} N\_{i+p+1,p}(u) \end{align\*} with i ranging from 0 up to the specified order. Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the non-zero basis function derivatives are computed. | | order | The order up to which the basis function derivatives are computes. Using the template version of this function is more efficieent since temporary objects are allocated on the stack whenever this is possible. | basisFunctions() ---------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | | | --- | --- | --- | --- | --- | --- | | SplineTraits< [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree > >::[BasisVectorType](classeigen_1_1spline#a1d49cef942ea59d85d1711ee32354e6b) [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::basisFunctions | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u* | ) | const | Computes the non-zero basis functions at the given site. Splines have local support and a point from their image is defined by exactly \(p+1\) control points \(P\_i\) where \(p\) is the spline degree. This function computes the \(p+1\) non-zero basis function values for a given parameter value \(u\). It returns \begin{align\*} N\_{i,p}(u), \hdots, N\_{i+p+1,p}(u) \end{align\*} Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the non-zero basis functions are computed. | BasisFunctions() ---------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::[BasisVectorType](classeigen_1_1spline#a1d49cef942ea59d85d1711ee32354e6b) [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::BasisFunctions | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u*, | | | | DenseIndex | *degree*, | | | | const [KnotVectorType](classeigen_1_1spline#a066f7a8b120316c9068b559f0790e9ec) & | *knots* | | | ) | | | | static | Returns the spline's non-zero basis functions. The function computes and returns \begin{align\*} N\_{i,p}(u), \hdots, N\_{i+p+1,p}(u) \end{align\*} Parameters | | | | --- | --- | | u | The site at which the basis functions are computed. | | degree | The degree of the underlying spline. | | knots | The underlying spline's knot vector. | derivatives() [1/2] ------------------- template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | --- | --- | --- | --- | | SplineTraits< [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >, DerivativeOrder >::DerivativeType [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::derivatives | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u*, | | | | DenseIndex | *order* | | | ) | | const | Evaluation of spline derivatives of up-to given order. The function returns \begin{align\*} \frac{d^i}{du^i}C(u) & = \sum\_{i=0}^{n} \frac{d^i}{du^i} N\_{i,p}(u)P\_i \end{align\*} for i ranging between 0 and order. Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the spline derivative is evaluated. | | order | The order up to which the derivatives are computed. | derivatives() [2/2] ------------------- template<typename \_Scalar , int \_Dim, int \_Degree> template<int DerivativeOrder> | | | | | | --- | --- | --- | --- | | SplineTraits<[Spline](classeigen_1_1spline),DerivativeOrder>::DerivativeType [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::derivatives | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u*, | | | | DenseIndex | *order* = `DerivativeOrder` | | | ) | | const | Evaluation of spline derivatives of up-to given order. The function returns \begin{align\*} \frac{d^i}{du^i}C(u) & = \sum\_{i=0}^{n} \frac{d^i}{du^i} N\_{i,p}(u)P\_i \end{align\*} for i ranging between 0 and order. Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the spline derivative is evaluated. | | order | The order up to which the derivatives are computed. Using the template version of this function is more efficieent since temporary objects are allocated on the stack whenever this is possible. | operator()() ------------ template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | | | --- | --- | --- | --- | --- | --- | | [Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::[PointType](classeigen_1_1spline#a9ade8a2f81dae6eedb8845cb080672bd) [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::operator() | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u* | ) | const | Returns the spline value at a given site \(u\). The function returns \begin{align\*} C(u) & = \sum\_{i=0}^{n}N\_{i,p}P\_i \end{align\*} Parameters | | | | --- | --- | | u | Parameter \(u \in [0;1]\) at which the spline is evaluated. | Returns The spline value at the given location \(u\). span() ------ template<typename \_Scalar , int \_Dim, int \_Degree> | | | | | | | | --- | --- | --- | --- | --- | --- | | DenseIndex [Eigen::Spline](classeigen_1_1spline)< \_Scalar, \_Dim, \_Degree >::span | ( | [Scalar](classeigen_1_1spline#a8cafd78b564825c76fbb3419653d9742) | *u* | ) | const | Returns the span within the knot vector in which u is falling. Parameters | | | | --- | --- | | u | The site for which the span is determined. | --- The documentation for this class was generated from the following file:* [Spline.h](https://eigen.tuxfamily.org/dox/unsupported/Spline_8h_source.html)
programming_docs
eigen3 Eigen::TensorConversionOp Eigen::TensorConversionOp ========================= ### template<typename TargetType, typename XprType> class Eigen::TensorConversionOp< TargetType, XprType > [Tensor](classeigen_1_1tensor "The tensor class.") conversion class. This class makes it possible to vectorize type casting operations when the number of scalars per packet in the source and the destination type differ. --- The documentation for this class was generated from the following file:* [TensorConversion.h](https://eigen.tuxfamily.org/dox/unsupported/TensorConversion_8h_source.html) eigen3 Eigen::MaxSizeVector Eigen::MaxSizeVector ==================== ### template<typename T> class Eigen::MaxSizeVector< T > The [MaxSizeVector](classeigen_1_1maxsizevector "The MaxSizeVector class.") class. The MaxSizeVector provides a subset of std::vector functionality. The goal is to provide basic std::vector operations when using std::vector is not an option (e.g. on GPU or when compiling using FMA/AVX, as this can cause either compilation failures or illegal instruction failures). Beware: The constructors are not API compatible with these of std::vector. --- The documentation for this class was generated from the following file:* [MaxSizeVector.h](https://eigen.tuxfamily.org/dox/unsupported/MaxSizeVector_8h_source.html) eigen3 Eigen::SkylineStorage Eigen::SkylineStorage ===================== ### template<typename Scalar> class Eigen::SkylineStorage< Scalar > Stores a skyline set of values in three structures : The diagonal elements The upper elements The lower elements --- The documentation for this class was generated from the following file:* [SkylineStorage.h](https://eigen.tuxfamily.org/dox/unsupported/SkylineStorage_8h_source.html) eigen3 Eigen SYCL Backend Eigen SYCL Backend ================== Useful information for [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") SYCL Backend: * [Getting Started with Eigen](https://developer.codeplay.com/computecppce/latest/getting-started-with-eigen) * [Options for Building Eigen SYCL](https://developer.codeplay.com/computecppce/latest/options-for-building-eigen-sycl) eigen3 Eigen::IDRS Eigen::IDRS =========== ### template<typename \_MatrixType, typename \_Preconditioner> class Eigen::IDRS< \_MatrixType, \_Preconditioner > The Induced Dimension Reduction method (IDR(s)) is a short-recurrences Krylov method for sparse square problems. This class allows to solve for A.x = b sparse linear problems. The vectors x and b can be either dense or sparse. he Induced Dimension Reduction method, IDR(), is a robust and efficient short-recurrence Krylov subspace method for solving large nonsymmetric systems of linear equations. For indefinite systems IDR(S) outperforms both BiCGStab and BiCGStab(L). Additionally, IDR(S) can handle matrices with complex eigenvalues more efficiently than BiCGStab. Many problems that do not converge for [BiCGSTAB](../classeigen_1_1bicgstab) converge for IDR(s) (for larger values of s). And if both methods converge the convergence for IDR(s) is typically much faster for difficult systems (for example indefinite problems). IDR(s) is a limited memory finite termination method. In exact arithmetic it converges in at most N+N/s iterations, with N the system size. It uses a fixed number of 4+3s vector. In comparison, [BiCGSTAB](../classeigen_1_1bicgstab) terminates in 2N iterations and uses 7 vectors. [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") terminates in at most N iterations, and uses I+3 vectors, with I the number of iterations. Restarting [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") limits the memory consumption, but destroys the finite termination property. Template Parameters | | | | --- | --- | | \_MatrixType | the type of the sparse matrix A, can be a dense or a sparse matrix. | | \_Preconditioner | the type of the preconditioner. Default is [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner) | This class follows the [sparse solver concept](../group__topicsparsesystems#TutorialSparseSolverConcept) . The maximal number of iterations and tolerance value can be controlled via the [setMaxIterations()](../classeigen_1_1iterativesolverbase#af83de7a7d31d9d4bd1fef6222b07335b) and [setTolerance()](../classeigen_1_1iterativesolverbase#ac160a444af8998f93da9aa30e858470d) methods. The defaults are the size of the problem for the maximal number of iterations and NumTraits<Scalar>::epsilon() for the tolerance. The tolerance corresponds to the relative residual error: |Ax-b|/|b| **Performance:** when using sparse matrices, best performance is achied for a row-major sparse matrix format. Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled. See [Eigen and multi-threading](../topicmultithreading) for details. By default the iterations start with x=0 as an initial guess of the solution. One can control the start using the [solveWithGuess()](../classeigen_1_1iterativesolverbase#adcc18d1ab283786dcbb5a3f63f4b4bd8) method. IDR(s) can also be used in a matrix-free context, see the following [example](../group__matrixfreesolverexample) . See also class [SimplicialCholesky](../classeigen_1_1simplicialcholesky), [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner), [IdentityPreconditioner](../classeigen_1_1identitypreconditioner) | | | --- | | | | template<typename Rhs , typename Dest > | | void | [\_solve\_vector\_with\_guess\_impl](classeigen_1_1idrs#aadf6594bebe313ed467e38e34f0f7c3c) (const Rhs &b, Dest &x) const | | | | | [IDRS](classeigen_1_1idrs#a5dbc1f0eeb30242e42a355633dfa810e) () | | | | template<typename MatrixDerived > | | | [IDRS](classeigen_1_1idrs#a36dd53442294df02948d5249d5e947fe) (const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > &A) | | | | void | [setAngle](classeigen_1_1idrs#abdb086e6e62287fea6e7ff19081c66b8) (RealScalar angle) | | | | void | [setResidualUpdate](classeigen_1_1idrs#a4514423c90c591ef914a3698f3d7123b) (bool update) | | | | void | [setS](classeigen_1_1idrs#a3ae67e1f4b29dc8a67978d870b14db8f) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) S) | | | | void | [setSmoothing](classeigen_1_1idrs#a278e3f2df45165436b6cf1169d3ba820) (bool smoothing) | | | IDRS() [1/2] ------------ template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::[IDRS](classeigen_1_1idrs) | ( | | ) | | | inline | Default constructor. IDRS() [2/2] ------------ template<typename \_MatrixType , typename \_Preconditioner > template<typename MatrixDerived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::[IDRS](classeigen_1_1idrs) | ( | const [EigenBase](../structeigen_1_1eigenbase)< MatrixDerived > & | *A* | ) | | | inlineexplicit | Initialize the solver with matrix *A* for further `Ax=b` solving. This constructor is a shortcut for the default constructor followed by a call to [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914). Warning this class stores a reference to the matrix A as well as some precomputed values that depend on it. Therefore, if *A* is changed this class becomes invalid. Call [compute()](../classeigen_1_1iterativesolverbase#a7dfa55c55e82d697bde227696a630914) to update it with the new matrix A, or modify a copy of A. \_solve\_vector\_with\_guess\_impl() ------------------------------------ template<typename \_MatrixType , typename \_Preconditioner > template<typename Rhs , typename Dest > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::\_solve\_vector\_with\_guess\_impl | ( | const Rhs & | *b*, | | | | Dest & | *x* | | | ) | | const | | inline | Loops over the number of columns of b and does the following: 1. sets the tolerence and maxIterations 2. Calls the function that has the core solver routine setAngle() ---------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::setAngle | ( | RealScalar | *angle* | ) | | | inline | The angle must be a real scalar. In IDR(s), a value for the iteration parameter omega must be chosen in every s+1th step. The most natural choice is to select a value to minimize the norm of the next residual. This corresponds to the parameter omega = 0. In practice, this may lead to values of omega that are so small that the other iteration parameters cannot be computed with sufficient accuracy. In such cases it is better to increase the value of omega sufficiently such that a compromise is reached between accurate computations and reduction of the residual norm. The parameter angle =0.7 (”maintaining the convergence strategy”) results in such a compromise. setResidualUpdate() ------------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::setResidualUpdate | ( | bool | *update* | ) | | | inline | The parameter replace is a logical that determines whether a residual replacement strategy is employed to increase the accuracy of the solution. setS() ------ template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::setS | ( | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *S* | ) | | | inline | Sets the parameter S, indicating the dimension of the shadow space. Default is 4 setSmoothing() -------------- template<typename \_MatrixType , typename \_Preconditioner > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::IDRS](classeigen_1_1idrs)< \_MatrixType, \_Preconditioner >::setSmoothing | ( | bool | *smoothing* | ) | | | inline | Switches off and on smoothing. Residual smoothing results in monotonically decreasing residual norms at the expense of two extra vectors of storage and a few extra vector operations. Although monotonic decrease of the residual norms is a desirable property, the rate of convergence of the unsmoothed process and the smoothed process is basically the same. Default is off --- The documentation for this class was generated from the following file:* [IDRS.h](https://eigen.tuxfamily.org/dox/unsupported/IDRS_8h_source.html) eigen3 Eigen::MatrixExponentialReturnValue Eigen::MatrixExponentialReturnValue =================================== ### template<typename Derived> struct Eigen::MatrixExponentialReturnValue< Derived > Proxy for the matrix exponential of some matrix (expression). Template Parameters | | | | --- | --- | | Derived | Type of the argument to the matrix exponential. | This class holds the argument to the matrix exponential until it is assigned or evaluated for some other reason (so the argument should not be changed in the meantime). It is the return type of [MatrixBase::exp()](../classeigen_1_1matrixbase#a70901e189e876f64d7f3fee1dbe942cc) and most of the time this is the only way it is used. Inherits ReturnByValue< MatrixExponentialReturnValue< Derived > >. | | | --- | | | | template<typename ResultType > | | void | [evalTo](structeigen_1_1matrixexponentialreturnvalue#a3dd2c65c7c6cdc41ab17415ee11899a0) (ResultType &result) const | | | Compute the matrix exponential. [More...](structeigen_1_1matrixexponentialreturnvalue#a3dd2c65c7c6cdc41ab17415ee11899a0) | | | | | [MatrixExponentialReturnValue](structeigen_1_1matrixexponentialreturnvalue#a4048419b1ee2befc51564703ba11acab) (const Derived &src) | | | Constructor. [More...](structeigen_1_1matrixexponentialreturnvalue#a4048419b1ee2befc51564703ba11acab) | | | MatrixExponentialReturnValue() ------------------------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | [Eigen::MatrixExponentialReturnValue](structeigen_1_1matrixexponentialreturnvalue)< Derived >::[MatrixExponentialReturnValue](structeigen_1_1matrixexponentialreturnvalue) | ( | const Derived & | *src* | ) | | | inline | Constructor. Parameters | | | | --- | --- | | src | Matrix (expression) forming the argument of the matrix exponential. | evalTo() -------- template<typename Derived > template<typename ResultType > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixExponentialReturnValue](structeigen_1_1matrixexponentialreturnvalue)< Derived >::evalTo | ( | ResultType & | *result* | ) | const | | inline | Compute the matrix exponential. Parameters | | | | --- | --- | | result | the matrix exponential of `src` in the constructor. | --- The documentation for this struct was generated from the following file:* [MatrixExponential.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixExponential_8h_source.html) eigen3 Eigen::KroneckerProductBase Eigen::KroneckerProductBase =========================== ### template<typename Derived> class Eigen::KroneckerProductBase< Derived > The base class of dense and sparse Kronecker product. Template Parameters | | | | --- | --- | | Derived | is the derived type. | Inherits ReturnByValue< Derived >. | | | --- | | | | Scalar | [coeff](classeigen_1_1kroneckerproductbase#a673348e7d9d2a4570aa0bcac33507f7b) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) i) const | | | | Scalar | [coeff](classeigen_1_1kroneckerproductbase#a0b302d4e55f5a58955e6c645d066928f) ([Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) row, [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) col) const | | | | | [KroneckerProductBase](classeigen_1_1kroneckerproductbase#a0cb05eaa978b9fdc0285b48a6e0ecfb1) (const Lhs &A, const Rhs &B) | | | Constructor. | | | coeff() [1/2] ------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | Scalar [Eigen::KroneckerProductBase](classeigen_1_1kroneckerproductbase)< Derived >::coeff | ( | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *i* | ) | const | | inline | This overrides ReturnByValue::coeff because this function is efficient enough. coeff() [2/2] ------------- template<typename Derived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | Scalar [Eigen::KroneckerProductBase](classeigen_1_1kroneckerproductbase)< Derived >::coeff | ( | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *row*, | | | | [Index](../namespaceeigen#a62e77e0933482dafde8fe197d9a2cfde) | *col* | | | ) | | const | | inline | This overrides ReturnByValue::coeff because this function is efficient enough. --- The documentation for this class was generated from the following file:* [KroneckerTensorProduct.h](https://eigen.tuxfamily.org/dox/unsupported/KroneckerTensorProduct_8h_source.html) eigen3 TensorReshaping TensorReshaping =============== Tensor reshaping class. --- The documentation for this class was generated from the following file:* [TensorMorphing.h](https://eigen.tuxfamily.org/dox/unsupported/TensorMorphing_8h_source.html) eigen3 Eigen::PolynomialSolverBase Eigen::PolynomialSolverBase =========================== ### template<typename \_Scalar, int \_Deg> class Eigen::PolynomialSolverBase< \_Scalar, \_Deg > Defined to be inherited by polynomial solvers: it provides convenient methods such as. * real roots, * greatest, smallest complex roots, * real roots with greatest, smallest absolute real value, * greatest, smallest real roots. It stores the set of roots as a vector of complexes. | | | --- | | | | const RealScalar & | [absGreatestRealRoot](classeigen_1_1polynomialsolverbase#aa2f003d9662af8c776f1a1c12a9d4210) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RealScalar & | [absSmallestRealRoot](classeigen_1_1polynomialsolverbase#a9316eeb24076bcd4f60ea4d7f3e549eb) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RealScalar & | [greatestRealRoot](classeigen_1_1polynomialsolverbase#a5094b7ccc49918b7c7ae9e2a8c49d4bd) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RootType & | [greatestRoot](classeigen_1_1polynomialsolverbase#a0327769cc88877a79c7c838f03d78384) () const | | | | template<typename Stl\_back\_insertion\_sequence > | | void | [realRoots](classeigen_1_1polynomialsolverbase#a4ea3b29499623832a0ad7b2b3ab05597) (Stl\_back\_insertion\_sequence &bi\_seq, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const [RootsType](../classeigen_1_1matrix) & | [roots](classeigen_1_1polynomialsolverbase#a07bcd5339be5eacdf7e566d07d81bedb) () const | | | | const RealScalar & | [smallestRealRoot](classeigen_1_1polynomialsolverbase#a24b054cdf82a8e9409bea47c3c05c756) (bool &hasArealRoot, const RealScalar &absImaginaryThreshold=[NumTraits](../structeigen_1_1numtraits)< Scalar >::dummy\_precision()) const | | | | const RootType & | [smallestRoot](classeigen_1_1polynomialsolverbase#a64389d0acf586c772fb3d1db47a3f7ef) () const | | | absGreatestRealRoot() --------------------- template<typename \_Scalar , int \_Deg> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const RealScalar& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::absGreatestRealRoot | ( | bool & | *hasArealRoot*, | | | | const RealScalar & | *absImaginaryThreshold* = `[NumTraits](../structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Returns a real root with greatest absolute magnitude. A real root is defined as the real part of a complex root with absolute imaginary part smallest than absImaginaryThreshold. absImaginaryThreshold takes the dummy\_precision associated with the \_Scalar template parameter of the [PolynomialSolver](classeigen_1_1polynomialsolver "A polynomial solver.") class as the default value. If no real root is found the boolean hasArealRoot is set to false and the real part of the root with smallest absolute imaginary part is returned instead. Parameters | | | | | --- | --- | --- | | [out] | hasArealRoot | : boolean true if a real root is found according to the absImaginaryThreshold criterion, false otherwise. | | [in] | absImaginaryThreshold | : threshold on the absolute imaginary part to decide whether or not a root is real. | absSmallestRealRoot() --------------------- template<typename \_Scalar , int \_Deg> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const RealScalar& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::absSmallestRealRoot | ( | bool & | *hasArealRoot*, | | | | const RealScalar & | *absImaginaryThreshold* = `[NumTraits](../structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Returns a real root with smallest absolute magnitude. A real root is defined as the real part of a complex root with absolute imaginary part smallest than absImaginaryThreshold. absImaginaryThreshold takes the dummy\_precision associated with the \_Scalar template parameter of the [PolynomialSolver](classeigen_1_1polynomialsolver "A polynomial solver.") class as the default value. If no real root is found the boolean hasArealRoot is set to false and the real part of the root with smallest absolute imaginary part is returned instead. Parameters | | | | | --- | --- | --- | | [out] | hasArealRoot | : boolean true if a real root is found according to the absImaginaryThreshold criterion, false otherwise. | | [in] | absImaginaryThreshold | : threshold on the absolute imaginary part to decide whether or not a root is real. | greatestRealRoot() ------------------ template<typename \_Scalar , int \_Deg> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const RealScalar& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::greatestRealRoot | ( | bool & | *hasArealRoot*, | | | | const RealScalar & | *absImaginaryThreshold* = `[NumTraits](../structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Returns the real root with greatest value. A real root is defined as the real part of a complex root with absolute imaginary part smallest than absImaginaryThreshold. absImaginaryThreshold takes the dummy\_precision associated with the \_Scalar template parameter of the [PolynomialSolver](classeigen_1_1polynomialsolver "A polynomial solver.") class as the default value. If no real root is found the boolean hasArealRoot is set to false and the real part of the root with smallest absolute imaginary part is returned instead. Parameters | | | | | --- | --- | --- | | [out] | hasArealRoot | : boolean true if a real root is found according to the absImaginaryThreshold criterion, false otherwise. | | [in] | absImaginaryThreshold | : threshold on the absolute imaginary part to decide whether or not a root is real. | greatestRoot() -------------- template<typename \_Scalar , int \_Deg> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const RootType& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::greatestRoot | ( | | ) | const | | inline | Returns the complex root with greatest norm. realRoots() ----------- template<typename \_Scalar , int \_Deg> template<typename Stl\_back\_insertion\_sequence > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | void [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::realRoots | ( | Stl\_back\_insertion\_sequence & | *bi\_seq*, | | | | const RealScalar & | *absImaginaryThreshold* = `[NumTraits](../structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Clear and fills the back insertion sequence with the real roots of the polynomial i.e. the real part of the complex roots that have an imaginary part which absolute value is smaller than absImaginaryThreshold. absImaginaryThreshold takes the dummy\_precision associated with the \_Scalar template parameter of the [PolynomialSolver](classeigen_1_1polynomialsolver "A polynomial solver.") class as the default value. Parameters | | | | | --- | --- | --- | | [out] | bi\_seq | : the back insertion sequence (stl concept) | | [in] | absImaginaryThreshold | : the maximum bound of the imaginary part of a complex number that is considered as real. | roots() ------- template<typename \_Scalar , int \_Deg> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const [RootsType](../classeigen_1_1matrix)& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::roots | ( | | ) | const | | inline | Returns the complex roots of the polynomial smallestRealRoot() ------------------ template<typename \_Scalar , int \_Deg> | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const RealScalar& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::smallestRealRoot | ( | bool & | *hasArealRoot*, | | | | const RealScalar & | *absImaginaryThreshold* = `[NumTraits](../structeigen_1_1numtraits)<Scalar>::dummy_precision()` | | | ) | | const | | inline | Returns the real root with smallest value. A real root is defined as the real part of a complex root with absolute imaginary part smallest than absImaginaryThreshold. absImaginaryThreshold takes the dummy\_precision associated with the \_Scalar template parameter of the [PolynomialSolver](classeigen_1_1polynomialsolver "A polynomial solver.") class as the default value. If no real root is found the boolean hasArealRoot is set to false and the real part of the root with smallest absolute imaginary part is returned instead. Parameters | | | | | --- | --- | --- | | [out] | hasArealRoot | : boolean true if a real root is found according to the absImaginaryThreshold criterion, false otherwise. | | [in] | absImaginaryThreshold | : threshold on the absolute imaginary part to decide whether or not a root is real. | smallestRoot() -------------- template<typename \_Scalar , int \_Deg> | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | --- | --- | --- | --- | --- | | const RootType& [Eigen::PolynomialSolverBase](classeigen_1_1polynomialsolverbase)< \_Scalar, \_Deg >::smallestRoot | ( | | ) | const | | inline | Returns the complex root with smallest norm. --- The documentation for this class was generated from the following file:* [PolynomialSolver.h](https://eigen.tuxfamily.org/dox/unsupported/PolynomialSolver_8h_source.html)
programming_docs
eigen3 Eigen::HybridNonLinearSolver Eigen::HybridNonLinearSolver ============================ ### template<typename FunctorType, typename Scalar = double> class Eigen::HybridNonLinearSolver< FunctorType, Scalar > Finds a zero of a system of n nonlinear functions in n variables by a modification of the Powell hybrid method ("dogleg"). The user must provide a subroutine which calculates the functions. The Jacobian is either provided by the user, or approximated using a forward-difference method. --- The documentation for this class was generated from the following file:* [HybridNonLinearSolver.h](https://eigen.tuxfamily.org/dox/unsupported/HybridNonLinearSolver_8h_source.html) eigen3 Matrix functions module Matrix functions module ======================= This module aims to provide various methods for the computation of matrix functions. To use this module, add ``` #include <unsupported/Eigen/MatrixFunctions> ``` at the start of your source file. This module defines the following MatrixBase methods. * [MatrixBase::cos()](group__matrixfunctions__module#matrixbase_cos), for computing the matrix cosine * [MatrixBase::cosh()](group__matrixfunctions__module#matrixbase_cosh), for computing the matrix hyperbolic cosine * [MatrixBase::exp()](group__matrixfunctions__module#matrixbase_exp), for computing the matrix exponential * [MatrixBase::log()](group__matrixfunctions__module#matrixbase_log), for computing the matrix logarithm * [MatrixBase::pow()](group__matrixfunctions__module#matrixbase_pow), for computing the matrix power * [MatrixBase::matrixFunction()](group__matrixfunctions__module#matrixbase_matrixfunction), for computing general matrix functions * [MatrixBase::sin()](group__matrixfunctions__module#matrixbase_sin), for computing the matrix sine * [MatrixBase::sinh()](group__matrixfunctions__module#matrixbase_sinh), for computing the matrix hyperbolic sine * [MatrixBase::sqrt()](group__matrixfunctions__module#matrixbase_sqrt), for computing the matrix square root These methods are the main entry points to this module. Matrix functions are defined as follows. Suppose that \( f \) is an entire function (that is, a function on the complex plane that is everywhere complex differentiable). Then its Taylor series \[ f(0) + f'(0) x + \frac{f''(0)}{2} x^2 + \frac{f'''(0)}{3!} x^3 + \cdots \] converges to \( f(x) \). In this case, we can define the matrix function by the same series: \[ f(M) = f(0) + f'(0) M + \frac{f''(0)}{2} M^2 + \frac{f'''(0)}{3!} M^3 + \cdots \] | | | --- | | | | class | [Eigen::MatrixComplexPowerReturnValue< Derived >](classeigen_1_1matrixcomplexpowerreturnvalue) | | | Proxy for the matrix power of some matrix (expression). [More...](classeigen_1_1matrixcomplexpowerreturnvalue#details) | | | | struct | [Eigen::MatrixExponentialReturnValue< Derived >](structeigen_1_1matrixexponentialreturnvalue) | | | Proxy for the matrix exponential of some matrix (expression). [More...](structeigen_1_1matrixexponentialreturnvalue#details) | | | | class | [Eigen::MatrixFunctionReturnValue< Derived >](classeigen_1_1matrixfunctionreturnvalue) | | | Proxy for the matrix function of some matrix (expression). [More...](classeigen_1_1matrixfunctionreturnvalue#details) | | | | class | [Eigen::MatrixLogarithmReturnValue< Derived >](classeigen_1_1matrixlogarithmreturnvalue) | | | Proxy for the matrix logarithm of some matrix (expression). [More...](classeigen_1_1matrixlogarithmreturnvalue#details) | | | | class | [Eigen::MatrixPower< MatrixType >](classeigen_1_1matrixpower) | | | Class for computing matrix powers. [More...](classeigen_1_1matrixpower#details) | | | | class | [Eigen::MatrixPowerAtomic< MatrixType >](classeigen_1_1matrixpoweratomic) | | | Class for computing matrix powers. [More...](classeigen_1_1matrixpoweratomic#details) | | | | class | [Eigen::MatrixPowerParenthesesReturnValue< MatrixType >](classeigen_1_1matrixpowerparenthesesreturnvalue) | | | Proxy for the matrix power of some matrix. [More...](classeigen_1_1matrixpowerparenthesesreturnvalue#details) | | | | class | [Eigen::MatrixPowerReturnValue< Derived >](classeigen_1_1matrixpowerreturnvalue) | | | Proxy for the matrix power of some matrix (expression). [More...](classeigen_1_1matrixpowerreturnvalue#details) | | | | class | [Eigen::MatrixSquareRootReturnValue< Derived >](classeigen_1_1matrixsquarerootreturnvalue) | | | Proxy for the matrix square root of some matrix (expression). [More...](classeigen_1_1matrixsquarerootreturnvalue#details) | | | | | | --- | | | | template<typename MatrixType , typename ResultType > | | void | [Eigen::matrix\_sqrt\_quasi\_triangular](group__matrixfunctions__module#ga2f490197e16df831683018e383e29346) (const MatrixType &[arg](../namespaceeigen#aa539408a09481d35961e11ee78793db1), ResultType &result) | | | Compute matrix square root of quasi-triangular matrix. [More...](group__matrixfunctions__module#ga2f490197e16df831683018e383e29346) | | | | template<typename MatrixType , typename ResultType > | | void | [Eigen::matrix\_sqrt\_triangular](group__matrixfunctions__module#gae51c91f920f6ea4a7f6f72caa1e8249f) (const MatrixType &[arg](../namespaceeigen#aa539408a09481d35961e11ee78793db1), ResultType &result) | | | Compute matrix square root of triangular matrix. [More...](group__matrixfunctions__module#gae51c91f920f6ea4a7f6f72caa1e8249f) | | | MatrixBase methods defined in the MatrixFunctions module ========================================================== The remainder of the page documents the following MatrixBase methods which are defined in the MatrixFunctions module. MatrixBase::cos() ------------------- Compute the matrix cosine. ``` const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cos() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | a square matrix. | Returns expression representing \( \cos(M) \). This function computes the matrix cosine. Use ArrayBase::cos() for computing the entry-wise cosine. The implementation calls [matrixFunction()](group__matrixfunctions__module#matrixbase_matrixfunction) with StdStemFunctions::cos(). See also [sin()](group__matrixfunctions__module#matrixbase_sin) for an example. MatrixBase::cosh() -------------------- Compute the matrix hyberbolic cosine. ``` const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::cosh() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | a square matrix. | Returns expression representing \( \cosh(M) \) This function calls [matrixFunction()](group__matrixfunctions__module#matrixbase_matrixfunction) with StdStemFunctions::cosh(). See also [sinh()](group__matrixfunctions__module#matrixbase_sinh) for an example. MatrixBase::exp() ------------------- Compute the matrix exponential. ``` const MatrixExponentialReturnValue<Derived> MatrixBase<Derived>::exp() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | matrix whose exponential is to be computed. | Returns expression representing the matrix exponential of `M`. The matrix exponential of \( M \) is defined by \[ \exp(M) = \sum\_{k=0}^\infty \frac{M^k}{k!}. \] The matrix exponential can be used to solve linear ordinary differential equations: the solution of \( y' = My \) with the initial condition \( y(0) = y\_0 \) is given by \( y(t) = \exp(M) y\_0 \). The matrix exponential is different from applying the exp function to all the entries in the matrix. Use ArrayBase::exp() if you want to do the latter. The cost of the computation is approximately \( 20 n^3 \) for matrices of size \( n \). The number 20 depends weakly on the norm of the matrix. The matrix exponential is computed using the scaling-and-squaring method combined with Padé approximation. The matrix is first rescaled, then the exponential of the reduced matrix is computed approximant, and then the rescaling is undone by repeated squaring. The degree of the Padé approximant is chosen such that the approximation error is less than the round-off error. However, errors may accumulate during the squaring phase. Details of the algorithm can be found in: Nicholas J. Higham, "The scaling and squaring method for the matrix exponential revisited," *SIAM J. Matrix Anal. Applic.*, **26**:1179–1193, 2005. Example: The following program checks that \[ \exp \left[ \begin{array}{ccc} 0 & \frac14\pi & 0 \\ -\frac14\pi & 0 & 0 \\ 0 & 0 & 0 \end{array} \right] = \left[ \begin{array}{ccc} \frac12\sqrt2 & -\frac12\sqrt2 & 0 \\ \frac12\sqrt2 & \frac12\sqrt2 & 0 \\ 0 & 0 & 1 \end{array} \right]. \] This corresponds to a rotation of \( \frac14\pi \) radians around the z-axis. ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { const double pi = std::acos(-1.0); MatrixXd A(3,3); A << 0, -pi/4, 0, pi/4, 0, 0, 0, 0, 0; std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix exponential of A is:\n" << A.exp() << "\n\n"; } ``` Output: ``` The matrix A is: 0 -0.785398 0 0.785398 0 0 0 0 0 The matrix exponential of A is: 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1 ``` Note `M` has to be a matrix of `float`, `double`, `long double` `complex<float>`, `complex<double>`, or `complex<long double>` . MatrixBase::log() ------------------- Compute the matrix logarithm. ``` const MatrixLogarithmReturnValue<Derived> MatrixBase<Derived>::log() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | invertible matrix whose logarithm is to be computed. | Returns expression representing the matrix logarithm root of `M`. The matrix logarithm of \( M \) is a matrix \( X \) such that \( \exp(X) = M \) where exp denotes the matrix exponential. As for the scalar logarithm, the equation \( \exp(X) = M \) may have multiple solutions; this function returns a matrix whose eigenvalues have imaginary part in the interval \( (-\pi,\pi] \). The matrix logarithm is different from applying the log function to all the entries in the matrix. Use ArrayBase::log() if you want to do the latter. In the real case, the matrix \( M \) should be invertible and it should have no eigenvalues which are real and negative (pairs of complex conjugate eigenvalues are allowed). In the complex case, it only needs to be invertible. This function computes the matrix logarithm using the Schur-Parlett algorithm as implemented by MatrixBase::matrixFunction(). The logarithm of an atomic block is computed by MatrixLogarithmAtomic, which uses direct computation for 1-by-1 and 2-by-2 blocks and an inverse scaling-and-squaring algorithm for bigger blocks, with the square roots computed by MatrixBase::sqrt(). Details of the algorithm can be found in Section 11.6.2 of: Nicholas J. Higham, *Functions of Matrices: Theory and Computation*, SIAM 2008. ISBN 978-0-898716-46-7. Example: The following program checks that \[ \log \left[ \begin{array}{ccc} \frac12\sqrt2 & -\frac12\sqrt2 & 0 \\ \frac12\sqrt2 & \frac12\sqrt2 & 0 \\ 0 & 0 & 1 \end{array} \right] = \left[ \begin{array}{ccc} 0 & \frac14\pi & 0 \\ -\frac14\pi & 0 & 0 \\ 0 & 0 & 0 \end{array} \right]. \] This corresponds to a rotation of \( \frac14\pi \) radians around the z-axis. This is the inverse of the example used in the documentation of [exp()](group__matrixfunctions__module#matrixbase_exp). ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { using std::sqrt; MatrixXd A(3,3); A << 0.5*[sqrt](../namespaceeigen#af4f536e8ea56702e63088efb3706d1f0)(2), -0.5*[sqrt](../namespaceeigen#af4f536e8ea56702e63088efb3706d1f0)(2), 0, 0.5*[sqrt](../namespaceeigen#af4f536e8ea56702e63088efb3706d1f0)(2), 0.5*[sqrt](../namespaceeigen#af4f536e8ea56702e63088efb3706d1f0)(2), 0, 0, 0, 1; std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix logarithm of A is:\n" << A.log() << "\n"; } ``` Output: ``` The matrix A is: 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1 The matrix logarithm of A is: -8.86512e-17 -0.785398 0 0.785398 -8.86512e-17 0 0 0 0 ``` Note `M` has to be a matrix of `float`, `double`, `long double`, `complex<float>`, `complex<double>`, or `complex<long double>`. See also MatrixBase::exp(), MatrixBase::matrixFunction(), class MatrixLogarithmAtomic, MatrixBase::sqrt(). MatrixBase::pow() ------------------- Compute the matrix raised to arbitrary real power. ``` const MatrixPowerReturnValue<Derived> MatrixBase<Derived>::pow(RealScalar p) const ``` Parameters | | | | | --- | --- | --- | | [in] | M | base of the matrix power, should be a square matrix. | | [in] | p | exponent of the matrix power. | The matrix power \( M^p \) is defined as \( \exp(p \log(M)) \), where exp denotes the matrix exponential, and log denotes the matrix logarithm. This is different from raising all the entries in the matrix to the p-th power. Use ArrayBase::pow() if you want to do the latter. If `p` is complex, the scalar type of `M` should be the type of `p` . \( M^p \) simply evaluates into \( \exp(p \log(M)) \). Therefore, the matrix \( M \) should meet the conditions to be an argument of matrix logarithm. If `p` is real, it is casted into the real scalar type of `M`. Then this function computes the matrix power using the Schur-Padé algorithm as implemented by class MatrixPower. The exponent is split into integral part and fractional part, where the fractional part is in the interval \( (-1, 1) \). The main diagonal and the first super-diagonal is directly computed. If `M` is singular with a semisimple zero eigenvalue and `p` is positive, the Schur factor \( T \) is reordered with Givens rotations, i.e. \[ T = \left[ \begin{array}{cc} T\_1 & T\_2 \\ 0 & 0 \end{array} \right] \] where \( T\_1 \) is invertible. Then \( T^p \) is given by \[ T^p = \left[ \begin{array}{cc} T\_1^p & T\_1^{-1} T\_1^p T\_2 \\ 0 & 0 \end{array}. \right] \] Warning Fractional power of a matrix with a non-semisimple zero eigenvalue is not well-defined. We introduce an assertion failure against inaccurate result, e.g. ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> int main() { Eigen::Matrix4d A; A << 0, 0, 2, 3, 0, 0, 4, 5, 0, 0, 6, 7, 0, 0, 8, 9; std::cout << A.pow(0.37) << std::endl; // The 1 makes eigenvalue 0 non-semisimple. A.coeffRef(0, 1) = 1; // This fails if EIGEN\_NO\_DEBUG is undefined. std::cout << A.pow(0.37) << std::endl; return 0; } ``` Details of the algorithm can be found in: Nicholas J. Higham and Lijing Lin, "A Schur-Pad&eacute; algorithm for fractional powers of a matrix," *SIAM J. Matrix Anal. Applic.*, **32(3)**:1056–1078, 2011. Example: The following program checks that \[ \left[ \begin{array}{ccc} \cos1 & -\sin1 & 0 \\ \sin1 & \cos1 & 0 \\ 0 & 0 & 1 \end{array} \right]^{\frac14\pi} = \left[ \begin{array}{ccc} \frac12\sqrt2 & -\frac12\sqrt2 & 0 \\ \frac12\sqrt2 & \frac12\sqrt2 & 0 \\ 0 & 0 & 1 \end{array} \right]. \] This corresponds to \( \frac14\pi \) rotations of 1 radian around the z-axis. ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { const double pi = std::acos(-1.0); Matrix3d A; A << [cos](../namespaceeigen#ad01d50a42869218f1d54af13f71517a6)(1), -[sin](../namespaceeigen#ae6e8ad270ff41c088d7651567594f796)(1), 0, [sin](../namespaceeigen#ae6e8ad270ff41c088d7651567594f796)(1), [cos](../namespaceeigen#ad01d50a42869218f1d54af13f71517a6)(1), 0, 0 , 0 , 1; std::cout << "The matrix A is:\n" << A << "\n\n" "The matrix power A^(pi/4) is:\n" << A.pow(pi/4) << std::endl; return 0; } ``` Output: ``` The matrix A is: 0.540302 -0.841471 0 0.841471 0.540302 0 0 0 1 The matrix power A^(pi/4) is: 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1 ``` MatrixBase::pow() is user-friendly. However, there are some circumstances under which you should use class MatrixPower directly. MatrixPower can save the result of Schur decomposition, so it's better for computing various powers for the same matrix. Example: ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { Matrix4cd A = Matrix4cd::Random(); MatrixPower<Matrix4cd> Apow(A); std::cout << "The matrix A is:\n" << A << "\n\n" "A^3.1 is:\n" << Apow(3.1) << "\n\n" "A^3.3 is:\n" << Apow(3.3) << "\n\n" "A^3.7 is:\n" << Apow(3.7) << "\n\n" "A^3.9 is:\n" << Apow(3.9) << std::endl; return 0; } ``` Output: ``` The matrix A is: (-0.211234,0.680375) (0.10794,-0.444451) (0.434594,0.271423) (-0.198111,-0.686642) (0.59688,0.566198) (0.257742,-0.0452059) (0.213938,-0.716795) (-0.782382,-0.740419) (-0.604897,0.823295) (0.0268018,-0.270431) (-0.514226,-0.967399) (-0.563486,0.997849) (0.536459,-0.329554) (0.83239,0.904459) (0.608354,-0.725537) (0.678224,0.0258648) A^3.1 is: (2.80575,-0.607662) (-1.16847,-0.00660555) (-0.760385,1.01461) (-0.38073,-0.106512) (1.4041,-3.61891) (1.00481,0.186263) (-0.163888,0.449419) (-0.388981,-1.22629) (-2.07957,-1.58136) (0.825866,2.25962) (5.09383,0.155736) (0.394308,-1.63034) (-0.818997,0.671026) (2.11069,-0.00768024) (-1.37876,0.140165) (2.50512,-0.854429) A^3.3 is: (2.83571,-0.238717) (-1.48174,-0.0615217) (-0.0544396,1.68092) (-0.292699,-0.621726) (2.0521,-3.58316) (0.87894,0.400548) (0.738072,-0.121242) (-1.07957,-1.63492) (-3.00106,-1.10558) (1.52205,1.92407) (5.29759,-1.83562) (-0.532038,-1.50253) (-0.491353,-0.4145) (2.5761,0.481286) (-1.21994,0.0367069) (2.67112,-1.06331) A^3.7 is: (1.42126,0.33362) (-1.39486,-0.560486) (1.44968,2.47066) (-0.324079,-1.75879) (2.65301,-1.82427) (0.357333,-0.192429) (2.01017,-1.4791) (-2.71518,-2.35892) (-3.98544,0.964861) (2.26033,0.554254) (3.18211,-5.94352) (-2.22888,0.128951) (0.944969,-2.14683) (3.31345,1.66075) (-0.0623743,-0.848324) (2.3897,-1.863) A^3.9 is: (0.0720766,0.378685) (-0.931961,-0.978624) (1.9855,2.34105) (-0.530547,-2.17664) (2.40934,-0.265286) (0.0299975,-1.08827) (1.98974,-2.05886) (-3.45767,-2.50235) (-3.71666,2.3874) (2.054,-0.303) (0.844348,-7.29588) (-2.59136,1.57689) (1.87645,-2.38798) (3.52111,2.10508) (0.799055,-1.6122) (1.93452,-2.44408) ``` Note `M` has to be a matrix of `float`, `double`, `long double`, `complex<float>`, `complex<double>`, or `complex<long double>` . See also MatrixBase::exp(), MatrixBase::log(), class MatrixPower. MatrixBase::matrixFunction() ------------------------------ Compute a matrix function. ``` const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::matrixFunction(typename internal::stem_function<typename internal::traits<Derived>::Scalar>::type f) const ``` Parameters | | | | | --- | --- | --- | | [in] | M | argument of matrix function, should be a square matrix. | | [in] | f | an entire function; `f(x,n)` should compute the n-th derivative of f at x. | Returns expression representing `f` applied to `M`. Suppose that `M` is a matrix whose entries have type `Scalar`. Then, the second argument, `f`, should be a function with prototype ``` ComplexScalar f(ComplexScalar, int) ``` where `ComplexScalar` = `std::complex<Scalar>` if `Scalar` is real (e.g., `float` or `double`) and `ComplexScalar` = `Scalar` if `Scalar` is complex. The return value of `f(x,n)` should be \( f^{(n)}(x) \), the n-th derivative of f at x. This routine uses the algorithm described in: Philip Davies and Nicholas J. Higham, "A Schur-Parlett algorithm for computing matrix functions", *SIAM J. Matrix Anal. Applic.*, **25**:464–485, 2003. The actual work is done by the MatrixFunction class. Example: The following program checks that \[ \exp \left[ \begin{array}{ccc} 0 & \frac14\pi & 0 \\ -\frac14\pi & 0 & 0 \\ 0 & 0 & 0 \end{array} \right] = \left[ \begin{array}{ccc} \frac12\sqrt2 & -\frac12\sqrt2 & 0 \\ \frac12\sqrt2 & \frac12\sqrt2 & 0 \\ 0 & 0 & 1 \end{array} \right]. \] This corresponds to a rotation of \( \frac14\pi \) radians around the z-axis. This is the same example as used in the documentation of [exp()](group__matrixfunctions__module#matrixbase_exp). ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); std::complex<double> expfn(std::complex<double> x, int) { return std::exp(x); } int main() { const double pi = std::acos(-1.0); MatrixXd A(3,3); A << 0, -pi/4, 0, pi/4, 0, 0, 0, 0, 0; std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix exponential of A is:\n" << A.matrixFunction(expfn) << "\n\n"; } ``` Output: ``` The matrix A is: 0 -0.785398 0 0.785398 0 0 0 0 0 The matrix exponential of A is: 0.707107 -0.707107 0 0.707107 0.707107 0 0 0 1 ``` Note that the function `expfn` is defined for complex numbers `x`, even though the matrix `A` is over the reals. Instead of `expfn`, we could also have used StdStemFunctions::exp: ``` A.matrixFunction(StdStemFunctions<std::complex<double> >::exp, &B); ``` MatrixBase::sin() ------------------- Compute the matrix sine. ``` const MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::sin() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | a square matrix. | Returns expression representing \( \sin(M) \). This function computes the matrix sine. Use ArrayBase::sin() for computing the entry-wise sine. The implementation calls [matrixFunction()](group__matrixfunctions__module#matrixbase_matrixfunction) with StdStemFunctions::sin(). Example: ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { MatrixXd A = MatrixXd::Random(3,3); std::cout << "A = \n" << A << "\n\n"; MatrixXd sinA = A.sin(); std::cout << "sin(A) = \n" << sinA << "\n\n"; MatrixXd cosA = A.cos(); std::cout << "cos(A) = \n" << cosA << "\n\n"; // The matrix functions satisfy sin^2(A) + cos^2(A) = I, // like the scalar functions. std::cout << "sin^2(A) + cos^2(A) = \n" << sinA*sinA + cosA*cosA << "\n\n"; } ``` Output: ``` A = 0.680375 0.59688 -0.329554 -0.211234 0.823295 0.536459 0.566198 -0.604897 -0.444451 sin(A) = 0.679919 0.4579 -0.400612 -0.227278 0.821913 0.5358 0.570141 -0.676728 -0.462398 cos(A) = 0.927728 -0.530361 -0.110482 0.00969246 0.889022 -0.137604 -0.132574 -0.04289 1.16475 sin^2(A) + cos^2(A) = 1 -7.77156e-16 4.71845e-16 -5.55112e-17 1 2.77556e-16 1.66533e-16 -2.08167e-16 1 ``` MatrixBase::sinh() -------------------- Compute the matrix hyperbolic sine. ``` MatrixFunctionReturnValue<Derived> MatrixBase<Derived>::sinh() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | a square matrix. | Returns expression representing \( \sinh(M) \) This function calls [matrixFunction()](group__matrixfunctions__module#matrixbase_matrixfunction) with StdStemFunctions::sinh(). Example: ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { MatrixXf A = MatrixXf::Random(3,3); std::cout << "A = \n" << A << "\n\n"; MatrixXf sinhA = A.sinh(); std::cout << "sinh(A) = \n" << sinhA << "\n\n"; MatrixXf coshA = A.cosh(); std::cout << "cosh(A) = \n" << coshA << "\n\n"; // The matrix functions satisfy cosh^2(A) - sinh^2(A) = I, // like the scalar functions. std::cout << "cosh^2(A) - sinh^2(A) = \n" << coshA*coshA - sinhA*sinhA << "\n\n"; } ``` Output: ``` A = 0.680375 0.59688 -0.329554 -0.211234 0.823295 0.536459 0.566198 -0.604897 -0.444451 sinh(A) = 0.682534 0.739988 -0.256871 -0.194928 0.826512 0.537546 0.562584 -0.53163 -0.425199 cosh(A) = 1.07817 0.567068 0.132125 -0.004186 1.11649 0.135361 0.128891 0.065999 0.851201 cosh^2(A) - sinh^2(A) = 1 1.19209e-07 0 2.10479e-07 1 1.78814e-07 1.19209e-07 2.38419e-07 1 ``` MatrixBase::sqrt() -------------------- Compute the matrix square root. ``` const MatrixSquareRootReturnValue<Derived> MatrixBase<Derived>::sqrt() const ``` Parameters | | | | | --- | --- | --- | | [in] | M | invertible matrix whose square root is to be computed. | Returns expression representing the matrix square root of `M`. The matrix square root of \( M \) is the matrix \( M^{1/2} \) whose square is the original matrix; so if \( S = M^{1/2} \) then \( S^2 = M \). This is different from taking the square root of all the entries in the matrix; use ArrayBase::sqrt() if you want to do the latter. In the **real case**, the matrix \( M \) should be invertible and it should have no eigenvalues which are real and negative (pairs of complex conjugate eigenvalues are allowed). In that case, the matrix has a square root which is also real, and this is the square root computed by this function. The matrix square root is computed by first reducing the matrix to quasi-triangular form with the real Schur decomposition. The square root of the quasi-triangular matrix can then be computed directly. The cost is approximately \( 25 n^3 \) real flops for the real Schur decomposition and \( 3\frac13 n^3 \) real flops for the remainder (though the computation time in practice is likely more than this indicates). Details of the algorithm can be found in: Nicholas J. Highan, "Computing real square roots of a real matrix", *Linear Algebra Appl.*, 88/89:405–430, 1987. If the matrix is **positive-definite symmetric**, then the square root is also positive-definite symmetric. In this case, it is best to use SelfAdjointEigenSolver::operatorSqrt() to compute it. In the **complex case**, the matrix \( M \) should be invertible; this is a restriction of the algorithm. The square root computed by this algorithm is the one whose eigenvalues have an argument in the interval \( (-\frac12\pi, \frac12\pi] \). This is the usual branch cut. The computation is the same as in the real case, except that the complex Schur decomposition is used to reduce the matrix to a triangular matrix. The theoretical cost is the same. Details are in: Åke Björck and Sven Hammarling, "A Schur method for the square root of a matrix", *Linear Algebra Appl.*, 52/53:127–140, 1983. Example: The following program checks that the square root of \[ \left[ \begin{array}{cc} \cos(\frac13\pi) & -\sin(\frac13\pi) \\ \sin(\frac13\pi) & \cos(\frac13\pi) \end{array} \right], \] corresponding to a rotation over 60 degrees, is a rotation over 30 degrees: \[ \left[ \begin{array}{cc} \cos(\frac16\pi) & -\sin(\frac16\pi) \\ \sin(\frac16\pi) & \cos(\frac16\pi) \end{array} \right]. \] ``` #include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace [Eigen](namespaceeigen); int main() { const double pi = std::acos(-1.0); MatrixXd A(2,2); A << [cos](../namespaceeigen#ad01d50a42869218f1d54af13f71517a6)(pi/3), -[sin](../namespaceeigen#ae6e8ad270ff41c088d7651567594f796)(pi/3), [sin](../namespaceeigen#ae6e8ad270ff41c088d7651567594f796)(pi/3), [cos](../namespaceeigen#ad01d50a42869218f1d54af13f71517a6)(pi/3); std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix square root of A is:\n" << A.sqrt() << "\n\n"; std::cout << "The square of the last matrix is:\n" << A.sqrt() * A.sqrt() << "\n"; } ``` Output: ``` The matrix A is: 0.5 -0.866025 0.866025 0.5 The matrix square root of A is: 0.866025 -0.5 0.5 0.866025 The square of the last matrix is: 0.5 -0.866025 0.866025 0.5 ``` See also class RealSchur, class ComplexSchur, class MatrixSquareRoot, SelfAdjointEigenSolver::operatorSqrt(). matrix\_sqrt\_quasi\_triangular() --------------------------------- template<typename MatrixType , typename ResultType > | | | | | | --- | --- | --- | --- | | void Eigen::matrix\_sqrt\_quasi\_triangular | ( | const MatrixType & | *arg*, | | | | ResultType & | *result* | | | ) | | | Compute matrix square root of quasi-triangular matrix. Template Parameters | | | | --- | --- | | MatrixType | type of `arg`, the argument of matrix square root, expected to be an instantiation of the [Matrix](../classeigen_1_1matrix) class template. | | ResultType | type of `result`, where result is to be stored. | Parameters | | | | | --- | --- | --- | | [in] | arg | argument of matrix square root. | | [out] | result | matrix square root of upper Hessenberg part of `arg`. | This function computes the square root of the upper quasi-triangular matrix stored in the upper Hessenberg part of `arg`. Only the upper Hessenberg part of `result` is updated, the rest is not touched. See [MatrixBase::sqrt()](../classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) for details on how this computation is implemented. See also MatrixSquareRoot, MatrixSquareRootQuasiTriangular matrix\_sqrt\_triangular() -------------------------- template<typename MatrixType , typename ResultType > | | | | | | --- | --- | --- | --- | | void Eigen::matrix\_sqrt\_triangular | ( | const MatrixType & | *arg*, | | | | ResultType & | *result* | | | ) | | | Compute matrix square root of triangular matrix. Template Parameters | | | | --- | --- | | MatrixType | type of `arg`, the argument of matrix square root, expected to be an instantiation of the [Matrix](../classeigen_1_1matrix) class template. | | ResultType | type of `result`, where result is to be stored. | Parameters | | | | | --- | --- | --- | | [in] | arg | argument of matrix square root. | | [out] | result | matrix square root of upper triangular part of `arg`. | Only the upper triangular part (including the diagonal) of `result` is updated, the rest is not touched. See [MatrixBase::sqrt()](../classeigen_1_1matrixbase#ad873dca860bd47baeeede8663e161b83) for details on how this computation is implemented. See also MatrixSquareRoot, MatrixSquareRootQuasiTriangular
programming_docs
eigen3 Iterative solvers module Iterative solvers module ======================== This module aims to provide various iterative linear and non linear solver algorithms. It currently provides: * a constrained conjugate gradient * a Householder GMRES implementation * an IDR(s) implementation * a DGMRES implementation * a MINRES implementation ``` #include <unsupported/Eigen/IterativeSolvers> ``` | | | --- | | | | class | [Eigen::DGMRES< \_MatrixType, \_Preconditioner >](classeigen_1_1dgmres) | | | A Restarted [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") with deflation. This class implements a modification of the [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") solver for sparse linear systems. The basis is built with modified Gram-Schmidt. At each restart, a few approximated eigenvectors corresponding to the smallest eigenvalues are used to build a preconditioner for the next cycle. This preconditioner for deflation can be combined with any other preconditioner, the [IncompleteLUT](../classeigen_1_1incompletelut) for instance. The preconditioner is applied at right of the matrix and the combination is multiplicative. [More...](classeigen_1_1dgmres#details) | | | | class | [Eigen::GMRES< \_MatrixType, \_Preconditioner >](classeigen_1_1gmres) | | | A [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") solver for sparse square problems. [More...](classeigen_1_1gmres#details) | | | | class | [Eigen::IDRS< \_MatrixType, \_Preconditioner >](classeigen_1_1idrs) | | | The Induced Dimension Reduction method (IDR(s)) is a short-recurrences Krylov method for sparse square problems. [More...](classeigen_1_1idrs#details) | | | | class | [Eigen::IterationController](classeigen_1_1iterationcontroller) | | | Controls the iterations of the iterative solvers. [More...](classeigen_1_1iterationcontroller#details) | | | | class | [Eigen::MINRES< \_MatrixType, \_UpLo, \_Preconditioner >](classeigen_1_1minres) | | | A minimal residual solver for sparse symmetric problems. [More...](classeigen_1_1minres#details) | | | | | | --- | | | | template<typename TMatrix , typename CMatrix , typename VectorX , typename VectorB , typename VectorF > | | void | [Eigen::internal::constrained\_cg](group__iterativelinearsolvers__module#ga1c2f99746877fd46158af4a6b7dce2f9) (const TMatrix &A, const CMatrix &C, [VectorX](../group__matrixtypedefs#ga7e589e92f0ae4929f5540a578cfd2bac) &x, const VectorB &b, const VectorF &f, [IterationController](classeigen_1_1iterationcontroller) &iter) | | | | template<typename CMatrix , typename CINVMatrix > | | void | [Eigen::internal::pseudo\_inverse](group__iterativelinearsolvers__module#ga58a0ccf0e71d88beeb5dcf72ed0bdd5f) (const CMatrix &C, CINVMatrix &CINV) | | | constrained\_cg() ----------------- template<typename TMatrix , typename CMatrix , typename VectorX , typename VectorB , typename VectorF > | | | | | | --- | --- | --- | --- | | void Eigen::internal::constrained\_cg | ( | const TMatrix & | *A*, | | | | const CMatrix & | *C*, | | | | [VectorX](../group__matrixtypedefs#ga7e589e92f0ae4929f5540a578cfd2bac) & | *x*, | | | | const VectorB & | *b*, | | | | const VectorF & | *f*, | | | | [IterationController](classeigen_1_1iterationcontroller) & | *iter* | | | ) | | | Constrained conjugate gradient Computes the minimum of \( 1/2((Ax).x) - bx \) under the constraint \( Cx \le f \) pseudo\_inverse() ----------------- template<typename CMatrix , typename CINVMatrix > | | | | | | --- | --- | --- | --- | | void Eigen::internal::pseudo\_inverse | ( | const CMatrix & | *C*, | | | | CINVMatrix & | *CINV* | | | ) | | | Compute the pseudo inverse of the non-square matrix C such that \( CINV = (C \* C^T)^{-1} \* C \) based on a conjugate gradient method. This function is internally used by constrained\_cg. eigen3 TensorContraction TensorContraction ================= Tensor contraction class. --- The documentation for this class was generated from the following file:* [TensorContraction.h](https://eigen.tuxfamily.org/dox/unsupported/TensorContraction_8h_source.html) eigen3 TensorScan TensorScan ========== Tensor scan class. --- The documentation for this class was generated from the following file:* [TensorScan.h](https://eigen.tuxfamily.org/dox/unsupported/TensorScan_8h_source.html) eigen3 TensorImagePatch TensorImagePatch ================ Patch extraction specialized for image processing. This assumes that the input has a least 3 dimensions ordered as follow: 1st dimension: channels (of size d) 2nd dimension: rows (of size r) 3rd dimension: columns (of size c) There can be additional dimensions such as time (for video) or batch (for bulk processing after the first 3. Calling the image patch code with patch\_rows and patch\_cols is equivalent to calling the regular patch extraction code with parameters d, patch\_rows, patch\_cols, and 1 for all the additional dimensions. --- The documentation for this class was generated from the following file:* [TensorImagePatch.h](https://eigen.tuxfamily.org/dox/unsupported/TensorImagePatch_8h_source.html) eigen3 Non linear optimization module Non linear optimization module ============================== ``` #include <unsupported/Eigen/NonLinearOptimization> ``` This module provides implementation of two important algorithms in non linear optimization. In both cases, we consider a system of non linear functions. Of course, this should work, and even work very well if those functions are actually linear. But if this is so, you should probably better use other methods more fitted to this special case. One algorithm allows to find a least-squares solution of such a system (Levenberg-Marquardt algorithm) and the second one is used to find a zero for the system (Powell hybrid "dogleg" method). This code is a port of minpack (<http://en.wikipedia.org/wiki/MINPACK>). Minpack is a very famous, old, robust and well renowned package, written in fortran. Those implementations have been carefully tuned, tested, and used for several decades. The original fortran code was automatically translated using f2c (<http://en.wikipedia.org/wiki/F2c>) in C, then c++, and then cleaned by several different authors. The last one of those cleanings being our starting point : <http://devernay.free.fr/hacks/cminpack.html> Finally, we ported this code to [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."), creating classes and API coherent with [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library."). When possible, we switched to [Eigen](namespaceeigen "Namespace containing all symbols from the Eigen library.") implementation, such as most linear algebra (vectors, matrices, stable norms). Doing so, we were very careful to check the tests we setup at the very beginning, which ensure that the same results are found. Tests ======= The tests are placed in the file unsupported/test/NonLinear.cpp. There are two kinds of tests : those that come from examples bundled with cminpack. They guaranty we get the same results as the original algorithms (value for 'x', for the number of evaluations of the function, and for the number of evaluations of the Jacobian if ever). Other tests were added by myself at the very beginning of the process and check the results for Levenberg-Marquardt using the reference data on <http://www.itl.nist.gov/div898/strd/nls/nls_main.shtml>. Since then i've carefully checked that the same results were obtained when modifying the code. Please note that we do not always get the exact same decimals as they do, but this is ok : they use 128bits float, and we do the tests using the C type 'double', which is 64 bits on most platforms (x86 and amd64, at least). I've performed those tests on several other implementations of Levenberg-Marquardt, and (c)minpack performs VERY well compared to those, both in accuracy and speed. The documentation for running the tests is on the wiki <http://eigen.tuxfamily.org/index.php?title=Tests> API: overview of methods ========================== Both algorithms needs a functor computing the Jacobian. It can be computed by hand, using auto-differentiation (see [Auto Diff module](group__autodiff__module)), or using numerical differences (see [Numerical differentiation module](group__numericaldiff__module)). For instance: ``` MyFunc func; NumericalDiff<MyFunc> func_with_num_diff(func); LevenbergMarquardt<NumericalDiff<MyFunc> > lm(func_with_num_diff); ``` For HybridNonLinearSolver, the method solveNumericalDiff() does the above wrapping for you. The methods LevenbergMarquardt.lmder1()/lmdif1()/lmstr1() and HybridNonLinearSolver.hybrj1()/hybrd1() are specific methods from the original minpack package that you probably should NOT use until you are porting a code that was previously using minpack. They just define a 'simple' API with default values for some parameters. All algorithms are provided using two APIs : * one where the user inits the algorithm, and uses '\*OneStep()' as much as he wants : this way the caller have control over the steps * one where the user just calls a method (optimize() or solve()) which will handle the loop: init + loop until a stop condition is met. Those are provided for convenience. As an example, the method LevenbergMarquardt::minimize() is implemented as follow: ``` Status LevenbergMarquardt<FunctorType,Scalar>::minimize(FVectorType &x, const int mode) { Status status = minimizeInit(x, mode); do { status = minimizeOneStep(x, mode); } while (status==Running); return status; } ``` Examples ========== The easiest way to understand how to use this module is by looking at the many examples in the file unsupported/test/NonLinearOptimization.cpp. | | | --- | | | | class | [Eigen::HybridNonLinearSolver< FunctorType, Scalar >](classeigen_1_1hybridnonlinearsolver) | | | Finds a zero of a system of n nonlinear functions in n variables by a modification of the Powell hybrid method ("dogleg"). [More...](classeigen_1_1hybridnonlinearsolver#details) | | | | class | [Eigen::LevenbergMarquardt< \_FunctorType >](classeigen_1_1levenbergmarquardt) | | | Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquardt algorithm. [More...](classeigen_1_1levenbergmarquardt#details) | | | eigen3 Eigen Eigen ===== Namespace containing all symbols from the Eigen library. [More...](namespaceeigen#details) | | | --- | | | | class | [aligned\_allocator](../classeigen_1_1aligned__allocator) | | | | class | [AlignedBox](../classeigen_1_1alignedbox) | | | | class | [AlignedVector3](classeigen_1_1alignedvector3) | | | A vectorization friendly 3D vector. [More...](classeigen_1_1alignedvector3#details) | | | | class | [AMDOrdering](../classeigen_1_1amdordering) | | | | class | [AngleAxis](../classeigen_1_1angleaxis) | | | | class | [ArithmeticSequence](../classeigen_1_1arithmeticsequence) | | | | class | [Array](../classeigen_1_1array) | | | | class | [ArrayBase](../classeigen_1_1arraybase) | | | | class | [ArrayWrapper](../classeigen_1_1arraywrapper) | | | | struct | [ArrayXpr](../structeigen_1_1arrayxpr) | | | | class | [AutoDiffScalar](classeigen_1_1autodiffscalar) | | | A scalar type replacement with automatic differentiation capability. [More...](classeigen_1_1autodiffscalar#details) | | | | class | [BDCSVD](../classeigen_1_1bdcsvd) | | | | class | [BiCGSTAB](../classeigen_1_1bicgstab) | | | | class | [Block](../classeigen_1_1block) | | | | class | [BlockImpl< XprType, BlockRows, BlockCols, InnerPanel, Sparse >](../classeigen_1_1blockimpl_3_01xprtype_00_01blockrows_00_01blockcols_00_01innerpanel_00_01sparse_01_4) | | | | class | [BlockSparseMatrix](classeigen_1_1blocksparsematrix) | | | A versatile sparse matrix representation where each element is a block. [More...](classeigen_1_1blocksparsematrix#details) | | | | class | [CholmodBase](../classeigen_1_1cholmodbase) | | | | class | [CholmodDecomposition](../classeigen_1_1cholmoddecomposition) | | | | class | [CholmodSimplicialLDLT](../classeigen_1_1cholmodsimplicialldlt) | | | | class | [CholmodSimplicialLLT](../classeigen_1_1cholmodsimplicialllt) | | | | class | [CholmodSupernodalLLT](../classeigen_1_1cholmodsupernodalllt) | | | | class | [COLAMDOrdering](../classeigen_1_1colamdordering) | | | | class | [ColPivHouseholderQR](../classeigen_1_1colpivhouseholderqr) | | | | class | [CommaInitializer](../structeigen_1_1commainitializer) | | | | class | [CompleteOrthogonalDecomposition](../classeigen_1_1completeorthogonaldecomposition) | | | | class | [ComplexEigenSolver](../classeigen_1_1complexeigensolver) | | | | class | [ComplexSchur](../classeigen_1_1complexschur) | | | | class | [ConjugateGradient](../classeigen_1_1conjugategradient) | | | | class | [CwiseBinaryOp](../classeigen_1_1cwisebinaryop) | | | | class | [CwiseNullaryOp](../classeigen_1_1cwisenullaryop) | | | | class | [CwiseTernaryOp](../classeigen_1_1cwiseternaryop) | | | | class | [CwiseUnaryOp](../classeigen_1_1cwiseunaryop) | | | | class | [CwiseUnaryView](../classeigen_1_1cwiseunaryview) | | | | struct | [Dense](../structeigen_1_1dense) | | | | class | [DenseBase](../classeigen_1_1densebase) | | | | class | [DenseCoeffsBase< Derived, DirectAccessors >](../classeigen_1_1densecoeffsbase_3_01derived_00_01directaccessors_01_4) | | | | class | [DenseCoeffsBase< Derived, DirectWriteAccessors >](../classeigen_1_1densecoeffsbase_3_01derived_00_01directwriteaccessors_01_4) | | | | class | [DenseCoeffsBase< Derived, ReadOnlyAccessors >](../classeigen_1_1densecoeffsbase_3_01derived_00_01readonlyaccessors_01_4) | | | | class | [DenseCoeffsBase< Derived, WriteAccessors >](../classeigen_1_1densecoeffsbase_3_01derived_00_01writeaccessors_01_4) | | | | class | [DGMRES](classeigen_1_1dgmres) | | | A Restarted [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") with deflation. This class implements a modification of the [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") solver for sparse linear systems. The basis is built with modified Gram-Schmidt. At each restart, a few approximated eigenvectors corresponding to the smallest eigenvalues are used to build a preconditioner for the next cycle. This preconditioner for deflation can be combined with any other preconditioner, the [IncompleteLUT](../classeigen_1_1incompletelut) for instance. The preconditioner is applied at right of the matrix and the combination is multiplicative. [More...](classeigen_1_1dgmres#details) | | | | class | [Diagonal](../classeigen_1_1diagonal) | | | | class | [DiagonalMatrix](../classeigen_1_1diagonalmatrix) | | | | class | [DiagonalPreconditioner](../classeigen_1_1diagonalpreconditioner) | | | | class | [DiagonalWrapper](../classeigen_1_1diagonalwrapper) | | | | class | [DynamicSGroup](classeigen_1_1dynamicsgroup) | | | Dynamic symmetry group. [More...](classeigen_1_1dynamicsgroup#details) | | | | class | [DynamicSparseMatrix](classeigen_1_1dynamicsparsematrix) | | | A sparse matrix class designed for matrix assembly purpose. [More...](classeigen_1_1dynamicsparsematrix#details) | | | | class | [EigenBase](../structeigen_1_1eigenbase) | | | | class | [EigenSolver](../classeigen_1_1eigensolver) | | | | class | [EulerAngles](classeigen_1_1eulerangles) | | | Represents a rotation in a 3 dimensional space as three Euler angles. [More...](classeigen_1_1eulerangles#details) | | | | class | [EulerSystem](classeigen_1_1eulersystem) | | | Represents a fixed Euler rotation system. [More...](classeigen_1_1eulersystem#details) | | | | class | [ForceAlignedAccess](../classeigen_1_1forcealignedaccess) | | | | class | [FullPivHouseholderQR](../classeigen_1_1fullpivhouseholderqr) | | | | class | [FullPivLU](../classeigen_1_1fullpivlu) | | | | class | [GeneralizedEigenSolver](../classeigen_1_1generalizedeigensolver) | | | | class | [GeneralizedSelfAdjointEigenSolver](../classeigen_1_1generalizedselfadjointeigensolver) | | | | class | [GMRES](classeigen_1_1gmres) | | | A [GMRES](classeigen_1_1gmres "A GMRES solver for sparse square problems.") solver for sparse square problems. [More...](classeigen_1_1gmres#details) | | | | class | [HessenbergDecomposition](../classeigen_1_1hessenbergdecomposition) | | | | class | [Homogeneous](../classeigen_1_1homogeneous) | | | | class | [HouseholderQR](../classeigen_1_1householderqr) | | | | class | [HouseholderSequence](../classeigen_1_1householdersequence) | | | | class | [HybridNonLinearSolver](classeigen_1_1hybridnonlinearsolver) | | | Finds a zero of a system of n nonlinear functions in n variables by a modification of the Powell hybrid method ("dogleg"). [More...](classeigen_1_1hybridnonlinearsolver#details) | | | | class | [Hyperplane](../classeigen_1_1hyperplane) | | | | class | [IdentityPreconditioner](../classeigen_1_1identitypreconditioner) | | | | class | [IDRS](classeigen_1_1idrs) | | | The Induced Dimension Reduction method (IDR(s)) is a short-recurrences Krylov method for sparse square problems. [More...](classeigen_1_1idrs#details) | | | | class | [IncompleteCholesky](../classeigen_1_1incompletecholesky) | | | | class | [IncompleteLUT](../classeigen_1_1incompletelut) | | | | class | [IndexedView](../classeigen_1_1indexedview) | | | | class | [InnerStride](../classeigen_1_1innerstride) | | | | class | [Inverse](../classeigen_1_1inverse) | | | | class | [IOFormat](../structeigen_1_1ioformat) | | | | class | [IterationController](classeigen_1_1iterationcontroller) | | | Controls the iterations of the iterative solvers. [More...](classeigen_1_1iterationcontroller#details) | | | | class | [IterativeSolverBase](../classeigen_1_1iterativesolverbase) | | | | class | [IterScaling](classeigen_1_1iterscaling) | | | iterative scaling algorithm to equilibrate rows and column norms in matrices [More...](classeigen_1_1iterscaling#details) | | | | class | [JacobiRotation](../classeigen_1_1jacobirotation) | | | | class | [JacobiSVD](../classeigen_1_1jacobisvd) | | | | class | [KdBVH](classeigen_1_1kdbvh) | | | A simple bounding volume hierarchy based on [AlignedBox](../classeigen_1_1alignedbox). [More...](classeigen_1_1kdbvh#details) | | | | class | [KroneckerProduct](classeigen_1_1kroneckerproduct) | | | Kronecker tensor product helper class for dense matrices. [More...](classeigen_1_1kroneckerproduct#details) | | | | class | [KroneckerProductBase](classeigen_1_1kroneckerproductbase) | | | The base class of dense and sparse Kronecker product. [More...](classeigen_1_1kroneckerproductbase#details) | | | | class | [KroneckerProductSparse](classeigen_1_1kroneckerproductsparse) | | | Kronecker tensor product helper class for sparse matrices. [More...](classeigen_1_1kroneckerproductsparse#details) | | | | class | [LDLT](../classeigen_1_1ldlt) | | | | class | [LeastSquareDiagonalPreconditioner](../classeigen_1_1leastsquarediagonalpreconditioner) | | | | class | [LeastSquaresConjugateGradient](../classeigen_1_1leastsquaresconjugategradient) | | | | class | [LevenbergMarquardt](classeigen_1_1levenbergmarquardt) | | | Performs non linear optimization over a non-linear function, using a variant of the Levenberg Marquardt algorithm. [More...](classeigen_1_1levenbergmarquardt#details) | | | | class | [LLT](../classeigen_1_1llt) | | | | class | [Map](../classeigen_1_1map) | | | | class | [Map< const Quaternion< \_Scalar >, \_Options >](../classeigen_1_1map_3_01const_01quaternion_3_01__scalar_01_4_00_01__options_01_4) | | | | class | [Map< Quaternion< \_Scalar >, \_Options >](../classeigen_1_1map_3_01quaternion_3_01__scalar_01_4_00_01__options_01_4) | | | | class | [Map< SparseMatrixType >](../classeigen_1_1map_3_01sparsematrixtype_01_4) | | | | class | [MapBase< Derived, ReadOnlyAccessors >](../classeigen_1_1mapbase_3_01derived_00_01readonlyaccessors_01_4) | | | | class | [MapBase< Derived, WriteAccessors >](../classeigen_1_1mapbase_3_01derived_00_01writeaccessors_01_4) | | | | class | [MappedSparseMatrix](../classeigen_1_1mappedsparsematrix) | | | | class | [Matrix](../classeigen_1_1matrix) | | | | class | [MatrixBase](../classeigen_1_1matrixbase) | | | | class | [MatrixComplexPowerReturnValue](classeigen_1_1matrixcomplexpowerreturnvalue) | | | Proxy for the matrix power of some matrix (expression). [More...](classeigen_1_1matrixcomplexpowerreturnvalue#details) | | | | struct | [MatrixExponentialReturnValue](structeigen_1_1matrixexponentialreturnvalue) | | | Proxy for the matrix exponential of some matrix (expression). [More...](structeigen_1_1matrixexponentialreturnvalue#details) | | | | class | [MatrixFunctionReturnValue](classeigen_1_1matrixfunctionreturnvalue) | | | Proxy for the matrix function of some matrix (expression). [More...](classeigen_1_1matrixfunctionreturnvalue#details) | | | | class | [MatrixLogarithmReturnValue](classeigen_1_1matrixlogarithmreturnvalue) | | | Proxy for the matrix logarithm of some matrix (expression). [More...](classeigen_1_1matrixlogarithmreturnvalue#details) | | | | class | [MatrixMarketIterator](classeigen_1_1matrixmarketiterator) | | | Iterator to browse matrices from a specified folder. [More...](classeigen_1_1matrixmarketiterator#details) | | | | class | [MatrixPower](classeigen_1_1matrixpower) | | | Class for computing matrix powers. [More...](classeigen_1_1matrixpower#details) | | | | class | [MatrixPowerAtomic](classeigen_1_1matrixpoweratomic) | | | Class for computing matrix powers. [More...](classeigen_1_1matrixpoweratomic#details) | | | | class | [MatrixPowerParenthesesReturnValue](classeigen_1_1matrixpowerparenthesesreturnvalue) | | | Proxy for the matrix power of some matrix. [More...](classeigen_1_1matrixpowerparenthesesreturnvalue#details) | | | | class | [MatrixPowerReturnValue](classeigen_1_1matrixpowerreturnvalue) | | | Proxy for the matrix power of some matrix (expression). [More...](classeigen_1_1matrixpowerreturnvalue#details) | | | | class | [MatrixSquareRootReturnValue](classeigen_1_1matrixsquarerootreturnvalue) | | | Proxy for the matrix square root of some matrix (expression). [More...](classeigen_1_1matrixsquarerootreturnvalue#details) | | | | class | [MatrixWrapper](../classeigen_1_1matrixwrapper) | | | | struct | [MatrixXpr](../structeigen_1_1matrixxpr) | | | | class | [MaxSizeVector](classeigen_1_1maxsizevector) | | | The [MaxSizeVector](classeigen_1_1maxsizevector "The MaxSizeVector class.") class. [More...](classeigen_1_1maxsizevector#details) | | | | class | [MetisOrdering](../classeigen_1_1metisordering) | | | | class | [MINRES](classeigen_1_1minres) | | | A minimal residual solver for sparse symmetric problems. [More...](classeigen_1_1minres#details) | | | | class | [NaturalOrdering](../classeigen_1_1naturalordering) | | | | class | [NestByValue](../classeigen_1_1nestbyvalue) | | | | class | [NoAlias](../classeigen_1_1noalias) | | | | class | [NumericalDiff](classeigen_1_1numericaldiff) | | | | class | [NumTraits](../structeigen_1_1numtraits) | | | | struct | [NumTraits< mpfr::mpreal >](structeigen_1_1numtraits_3_01mpfr_1_1mpreal_01_4) | | | | class | [OuterStride](../classeigen_1_1outerstride) | | | | class | [ParametrizedLine](../classeigen_1_1parametrizedline) | | | | class | [PardisoLDLT](../classeigen_1_1pardisoldlt) | | | | class | [PardisoLLT](../classeigen_1_1pardisollt) | | | | class | [PardisoLU](../classeigen_1_1pardisolu) | | | | class | [PartialPivLU](../classeigen_1_1partialpivlu) | | | | class | [PartialReduxExpr](../classeigen_1_1partialreduxexpr) | | | | class | [PastixLDLT](../classeigen_1_1pastixldlt) | | | | class | [PastixLLT](../classeigen_1_1pastixllt) | | | | class | [PastixLU](../classeigen_1_1pastixlu) | | | | class | [PermutationBase](../classeigen_1_1permutationbase) | | | | class | [PermutationMatrix](../classeigen_1_1permutationmatrix) | | | | struct | [PermutationStorage](../structeigen_1_1permutationstorage) | | | | class | [PermutationWrapper](../classeigen_1_1permutationwrapper) | | | | class | [PlainObjectBase](../classeigen_1_1plainobjectbase) | | | | class | [PolynomialSolver](classeigen_1_1polynomialsolver) | | | A polynomial solver. [More...](classeigen_1_1polynomialsolver#details) | | | | class | [PolynomialSolverBase](classeigen_1_1polynomialsolverbase) | | | Defined to be inherited by polynomial solvers: it provides convenient methods such as. [More...](classeigen_1_1polynomialsolverbase#details) | | | | class | [Product](../classeigen_1_1product) | | | | class | [Quaternion](../classeigen_1_1quaternion) | | | | class | [QuaternionBase](../classeigen_1_1quaternionbase) | | | | class | [RandomSetter](classeigen_1_1randomsetter) | | | The [RandomSetter](classeigen_1_1randomsetter "The RandomSetter is a wrapper object allowing to set/update a sparse matrix with random access.") is a wrapper object allowing to set/update a sparse matrix with random access. [More...](classeigen_1_1randomsetter#details) | | | | class | [RealQZ](../classeigen_1_1realqz) | | | | class | [RealSchur](../classeigen_1_1realschur) | | | | class | [Ref](../classeigen_1_1ref) | | | | class | [Ref< SparseMatrixType, Options >](../classeigen_1_1ref_3_01sparsematrixtype_00_01options_01_4) | | | | class | [Ref< SparseVectorType >](../classeigen_1_1ref_3_01sparsevectortype_01_4) | | | | class | [Replicate](../classeigen_1_1replicate) | | | | class | [Reshaped](../classeigen_1_1reshaped) | | | | class | [Reverse](../classeigen_1_1reverse) | | | | class | [Rotation2D](../classeigen_1_1rotation2d) | | | | class | [RotationBase](../classeigen_1_1rotationbase) | | | | class | [ScalarBinaryOpTraits](../structeigen_1_1scalarbinaryoptraits) | | | | class | [Select](../classeigen_1_1select) | | | | class | [SelfAdjointEigenSolver](../classeigen_1_1selfadjointeigensolver) | | | | class | [SelfAdjointView](../classeigen_1_1selfadjointview) | | | | class | [SGroup](classeigen_1_1sgroup) | | | Symmetry group, initialized from template arguments. [More...](classeigen_1_1sgroup#details) | | | | class | [SimplicialCholesky](../classeigen_1_1simplicialcholesky) | | | | class | [SimplicialCholeskyBase](../classeigen_1_1simplicialcholeskybase) | | | | class | [SimplicialLDLT](../classeigen_1_1simplicialldlt) | | | | class | [SimplicialLLT](../classeigen_1_1simplicialllt) | | | | class | [SkylineInplaceLU](classeigen_1_1skylineinplacelu) | | | Inplace LU decomposition of a skyline matrix and associated features. [More...](classeigen_1_1skylineinplacelu#details) | | | | class | [SkylineMatrix](classeigen_1_1skylinematrix) | | | The main skyline matrix class. [More...](classeigen_1_1skylinematrix#details) | | | | class | [SkylineMatrixBase](classeigen_1_1skylinematrixbase) | | | Base class of any skyline matrices or skyline expressions. [More...](classeigen_1_1skylinematrixbase#details) | | | | class | [SkylineStorage](classeigen_1_1skylinestorage) | | | | class | [Solve](../classeigen_1_1solve) | | | | class | [SolverBase](../classeigen_1_1solverbase) | | | | struct | [SolverStorage](../structeigen_1_1solverstorage) | | | | class | [SolveWithGuess](../classeigen_1_1solvewithguess) | | | | struct | [Sparse](../structeigen_1_1sparse) | | | | class | [SparseCompressedBase](../classeigen_1_1sparsecompressedbase) | | | | class | [SparseLU](../classeigen_1_1sparselu) | | | | class | [SparseMapBase< Derived, ReadOnlyAccessors >](../classeigen_1_1sparsemapbase_3_01derived_00_01readonlyaccessors_01_4) | | | | class | [SparseMapBase< Derived, WriteAccessors >](../classeigen_1_1sparsemapbase_3_01derived_00_01writeaccessors_01_4) | | | | class | [SparseMatrix](../classeigen_1_1sparsematrix) | | | | class | [SparseMatrixBase](../classeigen_1_1sparsematrixbase) | | | | class | [SparseQR](../classeigen_1_1sparseqr) | | | | class | [SparseSelfAdjointView](../classeigen_1_1sparseselfadjointview) | | | | class | [SparseSolverBase](../classeigen_1_1sparsesolverbase) | | | | class | [SparseVector](../classeigen_1_1sparsevector) | | | | class | [SparseView](../classeigen_1_1sparseview) | | | | class | [Spline](classeigen_1_1spline) | | | A class representing multi-dimensional spline curves. [More...](classeigen_1_1spline#details) | | | | struct | [SplineFitting](structeigen_1_1splinefitting) | | | [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") fitting methods. [More...](structeigen_1_1splinefitting#details) | | | | struct | [SplineTraits< Spline< \_Scalar, \_Dim, \_Degree >, \_DerivativeOrder >](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4) | | | Compile-time attributes of the [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") class for fixed degree. [More...](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01__derivativeorder_01_4#details) | | | | struct | [SplineTraits< Spline< \_Scalar, \_Dim, \_Degree >, Dynamic >](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4) | | | Compile-time attributes of the [Spline](classeigen_1_1spline "A class representing multi-dimensional spline curves.") class for Dynamic degree. [More...](structeigen_1_1splinetraits_3_01spline_3_01__scalar_00_01__dim_00_01__degree_01_4_00_01dynamic_01_4#details) | | | | class | [SPQR](../classeigen_1_1spqr) | | | | class | [StaticSGroup](classeigen_1_1staticsgroup) | | | Static symmetry group. [More...](classeigen_1_1staticsgroup#details) | | | | struct | [StdMapTraits](structeigen_1_1stdmaptraits) | | | | class | [Stride](../classeigen_1_1stride) | | | | class | [SuperILU](../classeigen_1_1superilu) | | | | class | [SuperLU](../classeigen_1_1superlu) | | | | class | [SuperLUBase](../classeigen_1_1superlubase) | | | | class | [SVDBase](../classeigen_1_1svdbase) | | | | class | [Tensor](classeigen_1_1tensor) | | | The tensor class. [More...](classeigen_1_1tensor#details) | | | | class | [TensorAsyncDevice](classeigen_1_1tensorasyncdevice) | | | Pseudo expression providing an operator = that will evaluate its argument asynchronously on the specified device. Currently only ThreadPoolDevice implements proper asynchronous execution, while the default and GPU devices just run the expression synchronously and call m\_done() on completion.. [More...](classeigen_1_1tensorasyncdevice#details) | | | | class | [TensorBase](classeigen_1_1tensorbase) | | | The tensor base class. [More...](classeigen_1_1tensorbase#details) | | | | class | [TensorConcatenationOp](classeigen_1_1tensorconcatenationop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") concatenation class. [More...](classeigen_1_1tensorconcatenationop#details) | | | | class | [TensorConversionOp](classeigen_1_1tensorconversionop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") conversion class. This class makes it possible to vectorize type casting operations when the number of scalars per packet in the source and the destination type differ. [More...](classeigen_1_1tensorconversionop#details) | | | | class | [TensorCustomBinaryOp](classeigen_1_1tensorcustombinaryop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") custom class. [More...](classeigen_1_1tensorcustombinaryop#details) | | | | class | [TensorCustomUnaryOp](classeigen_1_1tensorcustomunaryop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") custom class. [More...](classeigen_1_1tensorcustomunaryop#details) | | | | class | [TensorDevice](classeigen_1_1tensordevice) | | | Pseudo expression providing an operator = that will evaluate its argument on the specified computing 'device' (GPU, thread pool, ...) [More...](classeigen_1_1tensordevice#details) | | | | class | [TensorEvaluator](structeigen_1_1tensorevaluator) | | | A cost model used to limit the number of threads used for evaluating tensor expression. [More...](structeigen_1_1tensorevaluator#details) | | | | class | [TensorFixedSize](classeigen_1_1tensorfixedsize) | | | The fixed sized version of the tensor class. [More...](classeigen_1_1tensorfixedsize#details) | | | | class | [TensorGeneratorOp](classeigen_1_1tensorgeneratorop) | | | [Tensor](classeigen_1_1tensor "The tensor class.") generator class. [More...](classeigen_1_1tensorgeneratorop#details) | | | | class | [TensorMap](classeigen_1_1tensormap) | | | A tensor expression mapping an existing array of data. [More...](classeigen_1_1tensormap#details) | | | | class | [TensorRef](classeigen_1_1tensorref) | | | A reference to a tensor expression The expression will be evaluated lazily (as much as possible). [More...](classeigen_1_1tensorref#details) | | | | class | [Transform](../classeigen_1_1transform) | | | | class | [Translation](../classeigen_1_1translation) | | | | class | [Transpose](../classeigen_1_1transpose) | | | | class | [Transpositions](../classeigen_1_1transpositions) | | | | struct | [TranspositionsStorage](../structeigen_1_1transpositionsstorage) | | | | class | [TriangularBase](../classeigen_1_1triangularbase) | | | | class | [TriangularView](../classeigen_1_1triangularview) | | | | class | [TriangularViewImpl< \_MatrixType, \_Mode, Dense >](../classeigen_1_1triangularviewimpl_3_01__matrixtype_00_01__mode_00_01dense_01_4) | | | | class | [TriangularViewImpl< MatrixType, Mode, Sparse >](../classeigen_1_1triangularviewimpl_3_01matrixtype_00_01mode_00_01sparse_01_4) | | | | class | [Tridiagonalization](../classeigen_1_1tridiagonalization) | | | | class | [Triplet](../classeigen_1_1triplet) | | | | class | [UmfPackLU](../classeigen_1_1umfpacklu) | | | | class | [UniformScaling](../classeigen_1_1uniformscaling) | | | | class | [VectorBlock](../classeigen_1_1vectorblock) | | | | class | [VectorwiseOp](../classeigen_1_1vectorwiseop) | | | | class | [WithFormat](../classeigen_1_1withformat) | | | | | | --- | | | | typedef [Spline](classeigen_1_1spline)< double, 2 > | [Spline2d](namespaceeigen#aa04df76fa4fc7d93538c28bbbd838507) | | | 2D double B-spline with dynamic degree. | | | | typedef [Spline](classeigen_1_1spline)< float, 2 > | [Spline2f](namespaceeigen#a1709ceddcb1e899317ac4bdb9682807f) | | | 2D float B-spline with dynamic degree. | | | | typedef [Spline](classeigen_1_1spline)< double, 3 > | [Spline3d](namespaceeigen#a34dfede40d5b8f3b2443ff20d891f455) | | | 3D double B-spline with dynamic degree. | | | | typedef [Spline](classeigen_1_1spline)< float, 3 > | [Spline3f](namespaceeigen#a612e989f65acc6abc1593909f901e455) | | | 3D float B-spline with dynamic degree. | | | | | | --- | | | | enum | [EulerAxis](group__eulerangles__module#gae614aa7cdd687fb5c421a54f2ce5c361) { [EULER\_X](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361a11e1ea88cbe04a6fc077475d515d0b38) , [EULER\_Y](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361aee756a2b63043248f3d83541386c266b) , [EULER\_Z](group__eulerangles__module#ggae614aa7cdd687fb5c421a54f2ce5c361a95187b9943820cca5edc4bc96b3c08be) } | | | Representation of a fixed signed rotation axis for EulerSystem. [More...](group__eulerangles__module#gae614aa7cdd687fb5c421a54f2ce5c361) | | | | | | --- | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i0\_op< typename Derived::Scalar >, const Derived > | [bessel\_i0](namespaceeigen#ab0c429bb38ce58964b561fb9d6c9377a) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i0e\_op< typename Derived::Scalar >, const Derived > | [bessel\_i0e](namespaceeigen#aef13ab56dea757bfb7bd3e220ac478d5) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i1\_op< typename Derived::Scalar >, const Derived > | [bessel\_i1](namespaceeigen#ae35e1cabdc81f3783219186a7e658a2b) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i1e\_op< typename Derived::Scalar >, const Derived > | [bessel\_i1e](namespaceeigen#ae52c524c4108c6265e9543468da42e28) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_j0\_op< typename Derived::Scalar >, const Derived > | [bessel\_j0](namespaceeigen#a65acfc33a2b6140a09af67e45928e037) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_j1\_op< typename Derived::Scalar >, const Derived > | [bessel\_j1](namespaceeigen#a4079ddbfe44e3a865cdb600353f371ab) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k0\_op< typename Derived::Scalar >, const Derived > | [bessel\_k0](namespaceeigen#a4664123a5ae23d981410d7dc5cd86970) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k0e\_op< typename Derived::Scalar >, const Derived > | [bessel\_k0e](namespaceeigen#a9cc57448af6eda4fa72f34be7cc72da5) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k1\_op< typename Derived::Scalar >, const Derived > | [bessel\_k1](namespaceeigen#a76e76fa84ed24785bf32665a48157bf1) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k1e\_op< typename Derived::Scalar >, const Derived > | [bessel\_k1e](namespaceeigen#af9e044c2baa913adea597c4d497a3315) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_y0\_op< typename Derived::Scalar >, const Derived > | [bessel\_y0](namespaceeigen#aad0c42bfd8d5b4169a542206b460b2d0) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename Derived > | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_y1\_op< typename Derived::Scalar >, const Derived > | [bessel\_y1](namespaceeigen#a60d76185793d52703fa01d83d5b46615) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &x) | | | | template<typename ADerived , typename BDerived , typename XDerived > | | const TensorCwiseTernaryOp< internal::scalar\_betainc\_op< typename XDerived::Scalar >, const ADerived, const BDerived, const XDerived > | [betainc](namespaceeigen#a6d7e9b581a1fc3ca3c8aff6a0a69f523) (const ADerived &a, const BDerived &b, const XDerived &x) | | | | template<typename ArgADerived , typename ArgBDerived , typename ArgXDerived > | | const [Eigen::CwiseTernaryOp](../classeigen_1_1cwiseternaryop)< Eigen::internal::scalar\_betainc\_op< typename ArgXDerived::Scalar >, const ArgADerived, const ArgBDerived, const ArgXDerived > | [betainc](namespaceeigen#ac58db11132cd34e57ad819f3e77ff60c) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ArgADerived > &a, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ArgBDerived > &b, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ArgXDerived > &x) | | | | template<typename BVH , typename Intersector > | | void | [BVIntersect](namespaceeigen#a07d8e283f082c972338f3fc4f644b2a9) (const BVH &tree, Intersector &intersector) | | | | template<typename BVH1 , typename BVH2 , typename Intersector > | | void | [BVIntersect](namespaceeigen#ac3b8047a3ee05b5e6fec4668197a9a43) (const BVH1 &tree1, const BVH2 &tree2, Intersector &intersector) | | | | template<typename BVH , typename Minimizer > | | Minimizer::Scalar | [BVMinimize](namespaceeigen#adcbe73ac1482eacab0e18ee32c25508e) (const BVH &tree, Minimizer &minimizer) | | | | template<typename BVH1 , typename BVH2 , typename Minimizer > | | Minimizer::Scalar | [BVMinimize](namespaceeigen#a915f6adc8b195c94a83c35de6a842556) (const BVH1 &tree1, const BVH2 &tree2, Minimizer &minimizer) | | | | template<typename Polynomial > | | [NumTraits](../structeigen_1_1numtraits)< typename Polynomial::Scalar >::Real | [cauchy\_max\_bound](group__polynomials__module#ga375e3ea1f370fb76dfe0f43a89b95926) (const Polynomial &poly) | | | | template<typename Polynomial > | | [NumTraits](../structeigen_1_1numtraits)< typename Polynomial::Scalar >::Real | [cauchy\_min\_bound](group__polynomials__module#gab076afbdba0e9298a541cc4e8cc7506b) (const Polynomial &poly) | | | | template<typename PointArrayType , typename KnotVectorType > | | void | [ChordLengths](group__splines__module#ga1b4cbde5d98411405871accf877552d2) (const PointArrayType &pts, KnotVectorType &chord\_lengths) | | | Computes chord length parameters which are required for spline interpolation. [More...](group__splines__module#ga1b4cbde5d98411405871accf877552d2) | | | | template<typename AlphaDerived , typename SampleDerived > | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_gamma\_sample\_der\_alpha\_op< typename AlphaDerived::Scalar >, const AlphaDerived, const SampleDerived > | [gamma\_sample\_der\_alpha](namespaceeigen#afd81653604859fe8e5b09552a7a800c9) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< AlphaDerived > &alpha, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< SampleDerived > &sample) | | | | template<typename Derived , typename ExponentDerived > | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_igamma\_op< typename Derived::Scalar >, const Derived, const ExponentDerived > | [igamma](namespaceeigen#a6e89509c5ff1af076baea462520f231c) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &a, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ExponentDerived > &x) | | | | template<typename Derived , typename ExponentDerived > | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_igamma\_der\_a\_op< typename Derived::Scalar >, const Derived, const ExponentDerived > | [igamma\_der\_a](namespaceeigen#ad0b09518c9ef2376690af1b346f77ff1) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &a, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ExponentDerived > &x) | | | | template<typename Derived , typename ExponentDerived > | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_igammac\_op< typename Derived::Scalar >, const Derived, const ExponentDerived > | [igammac](namespaceeigen#a2b1593c0c3f9d1673ae5980ae03e75f1) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > &a, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ExponentDerived > &x) | | | | template<typename KnotVectorType > | | void | [KnotAveraging](group__splines__module#ga9474da5ed68bbd9a6788a999330416d6) (const KnotVectorType &parameters, DenseIndex degree, KnotVectorType &knots) | | | Computes knot averages. [More...](group__splines__module#ga9474da5ed68bbd9a6788a999330416d6) | | | | template<typename KnotVectorType , typename ParameterVectorType , typename IndexArray > | | void | [KnotAveragingWithDerivatives](group__splines__module#gae10a6f9b6ab7fb400a2526b6382c533b) (const ParameterVectorType &parameters, const unsigned int degree, const IndexArray &derivativeIndices, KnotVectorType &knots) | | | Computes knot averages when derivative constraints are present. Note that this is a technical interpretation of the referenced article since the algorithm contained therein is incorrect as written. [More...](group__splines__module#gae10a6f9b6ab7fb400a2526b6382c533b) | | | | template<typename A , typename B > | | [KroneckerProductSparse](classeigen_1_1kroneckerproductsparse)< A, B > | [kroneckerProduct](group__kroneckerproduct__module#gaca497f43cc92bcbf6eaff64984a266cc) (const [EigenBase](../structeigen_1_1eigenbase)< A > &a, const [EigenBase](../structeigen_1_1eigenbase)< B > &b) | | | | template<typename A , typename B > | | [KroneckerProduct](classeigen_1_1kroneckerproduct)< A, B > | [kroneckerProduct](group__kroneckerproduct__module#gaa8924dffc6cee7aa1e908dc395a7a167) (const [MatrixBase](../classeigen_1_1matrixbase)< A > &a, const [MatrixBase](../classeigen_1_1matrixbase)< B > &b) | | | | template<typename MatrixType , typename ResultType > | | void | [matrix\_sqrt\_quasi\_triangular](group__matrixfunctions__module#ga2f490197e16df831683018e383e29346) (const MatrixType &[arg](../namespaceeigen#aa539408a09481d35961e11ee78793db1), ResultType &result) | | | Compute matrix square root of quasi-triangular matrix. [More...](group__matrixfunctions__module#ga2f490197e16df831683018e383e29346) | | | | template<typename MatrixType , typename ResultType > | | void | [matrix\_sqrt\_triangular](group__matrixfunctions__module#gae51c91f920f6ea4a7f6f72caa1e8249f) (const MatrixType &[arg](../namespaceeigen#aa539408a09481d35961e11ee78793db1), ResultType &result) | | | Compute matrix square root of triangular matrix. [More...](group__matrixfunctions__module#gae51c91f920f6ea4a7f6f72caa1e8249f) | | | | template<typename Polynomials , typename T > | | T | [poly\_eval](group__polynomials__module#gadb64ffddaa9e83634e3ab0e3fd3664f5) (const Polynomials &poly, const T &x) | | | | template<typename Polynomials , typename T > | | T | [poly\_eval\_horner](group__polynomials__module#gaadbf059bc28ce1cf94c57c1454633d40) (const Polynomials &poly, const T &x) | | | | template<typename DerivedN , typename DerivedX > | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_polygamma\_op< typename DerivedX::Scalar >, const DerivedN, const DerivedX > | [polygamma](namespaceeigen#a7ec2455c3a3bb4b0c1401b25a8480361) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedN > &n, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedX > &x) | | | | template<typename RootVector , typename Polynomial > | | void | [roots\_to\_monicPolynomial](group__polynomials__module#gafbc3648f7ef67db3d5d04454fc1257fd) (const RootVector &rv, Polynomial &poly) | | | | template<typename DerivedX , typename DerivedQ > | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)< Eigen::internal::scalar\_zeta\_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > | [zeta](namespaceeigen#ade7c45ba55113cf0c89e33972f3da434) (const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedX > &x, const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedQ > &q) | | | Namespace containing all symbols from the Eigen library. bessel\_i0() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i0\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_i0 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise i0(*x*) to the given arrays. It returns the modified Bessel function of the first kind of order zero. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of i0(T) for any scalar type T to be supported. See also ArrayBase::bessel\_i0() bessel\_i0e() ------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i0e\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_i0e | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise i0e(*x*) to the given arrays. It returns the exponentially scaled modified Bessel function of the first kind of order zero. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of i0e(T) for any scalar type T to be supported. See also ArrayBase::bessel\_i0e() bessel\_i1() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i1\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_i1 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise i1(*x*) to the given arrays. It returns the modified Bessel function of the first kind of order one. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of i1(T) for any scalar type T to be supported. See also ArrayBase::bessel\_i1() bessel\_i1e() ------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_i1e\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_i1e | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise i1e(*x*) to the given arrays. It returns the exponentially scaled modified Bessel function of the first kind of order one. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of i1e(T) for any scalar type T to be supported. See also ArrayBase::bessel\_i1e() bessel\_j0() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_j0\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_j0 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise j0(*x*) to the given arrays. It returns the Bessel function of the first kind of order zero. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of j0(T) for any scalar type T to be supported. See also ArrayBase::bessel\_j0() bessel\_j1() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_j1\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_j1 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise j1(*x*) to the given arrays. It returns the modified Bessel function of the first kind of order one. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of j1(T) for any scalar type T to be supported. See also ArrayBase::bessel\_j1() bessel\_k0() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k0\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_k0 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise k0(*x*) to the given arrays. It returns the modified Bessel function of the second kind of order zero. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of k0(T) for any scalar type T to be supported. See also ArrayBase::bessel\_k0() bessel\_k0e() ------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k0e\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_k0e | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise k0e(*x*) to the given arrays. It returns the exponentially scaled modified Bessel function of the second kind of order zero. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of k0e(T) for any scalar type T to be supported. See also ArrayBase::bessel\_k0e() bessel\_k1() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k1\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_k1 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise k1(*x*) to the given arrays. It returns the modified Bessel function of the second kind of order one. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of k1(T) for any scalar type T to be supported. See also ArrayBase::bessel\_k1() bessel\_k1e() ------------- template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_k1e\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_k1e | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise k1e(*x*) to the given arrays. It returns the exponentially scaled modified Bessel function of the second kind of order one. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of k1e(T) for any scalar type T to be supported. See also ArrayBase::bessel\_k1e() bessel\_y0() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_y0\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_y0 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise y0(*x*) to the given arrays. It returns the Bessel function of the second kind of order zero. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of y0(T) for any scalar type T to be supported. See also ArrayBase::bessel\_y0() bessel\_y1() ------------ template<typename Derived > | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | | | --- | --- | --- | --- | --- | --- | | const [Eigen::CwiseUnaryOp](../classeigen_1_1cwiseunaryop)< Eigen::internal::scalar\_bessel\_y1\_op<typename Derived::Scalar>, const Derived> Eigen::bessel\_y1 | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *x* | ) | | | inline | Returns an expression of the coefficient-wise y1(*x*) to the given arrays. It returns the Bessel function of the second kind of order one. Parameters | | | | --- | --- | | x | is the argument | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of y1(T) for any scalar type T to be supported. See also ArrayBase::bessel\_y1() betainc() [1/2] --------------- template<typename ADerived , typename BDerived , typename XDerived > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const TensorCwiseTernaryOp<internal::scalar\_betainc\_op<typename XDerived::Scalar>, const ADerived, const BDerived, const XDerived> Eigen::betainc | ( | const ADerived & | *a*, | | | | const BDerived & | *b*, | | | | const XDerived & | *x* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise betainc(*x*, *a*, *b*) to the given tensors. This function computes the regularized incomplete beta function (integral). betainc() [2/2] --------------- template<typename ArgADerived , typename ArgBDerived , typename ArgXDerived > | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseTernaryOp](../classeigen_1_1cwiseternaryop)<Eigen::internal::scalar\_betainc\_op<typename ArgXDerived::Scalar>, const ArgADerived, const ArgBDerived, const ArgXDerived> Eigen::betainc | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ArgADerived > & | *a*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ArgBDerived > & | *b*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ArgXDerived > & | *x* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise betainc(*x*, *a*, *b*) to the given arrays. This function computes the regularized incomplete beta function (integral). Note This function supports only float and double scalar types in c++11 mode. To support other scalar types, or float/double in non c++11 mode, the user has to provide implementations of betainc(T,T,T) for any scalar type T to be supported. See also [Eigen::betainc()](namespaceeigen#a6d7e9b581a1fc3ca3c8aff6a0a69f523), [Eigen::lgamma()](../namespaceeigen#ac2e6331628bb1989b7be6d7e42827649) BVIntersect() [1/2] ------------------- template<typename BVH , typename Intersector > | | | | | | --- | --- | --- | --- | | void Eigen::BVIntersect | ( | const BVH & | *tree*, | | | | Intersector & | *intersector* | | | ) | | | Given a BVH, runs the query encapsulated by *intersector*. The Intersector type must provide the following members: ``` bool intersectVolume(const BVH::Volume &volume) //returns true if volume intersects the query bool intersectObject(const BVH::Object &object) //returns true if the search should terminate immediately ``` BVIntersect() [2/2] ------------------- template<typename BVH1 , typename BVH2 , typename Intersector > | | | | | | --- | --- | --- | --- | | void Eigen::BVIntersect | ( | const BVH1 & | *tree1*, | | | | const BVH2 & | *tree2*, | | | | Intersector & | *intersector* | | | ) | | | Given two BVH's, runs the query on their Cartesian product encapsulated by *intersector*. The Intersector type must provide the following members: ``` bool intersectVolumeVolume(const BVH1::Volume &v1, const BVH2::Volume &v2) //returns true if product of volumes intersects the query bool intersectVolumeObject(const BVH1::Volume &v1, const BVH2::Object &o2) //returns true if the volume-object product intersects the query bool intersectObjectVolume(const BVH1::Object &o1, const BVH2::Volume &v2) //returns true if the volume-object product intersects the query bool intersectObjectObject(const BVH1::Object &o1, const BVH2::Object &o2) //returns true if the search should terminate immediately ``` BVMinimize() [1/2] ------------------ template<typename BVH , typename Minimizer > | | | | | | --- | --- | --- | --- | | Minimizer::Scalar Eigen::BVMinimize | ( | const BVH & | *tree*, | | | | Minimizer & | *minimizer* | | | ) | | | Given a BVH, runs the query encapsulated by *minimizer*. Returns the minimum value. The Minimizer type must provide the following members: ``` typedef Scalar //the numeric type of what is being minimized--not necessarily the Scalar type of the BVH (if it has one) Scalar minimumOnVolume(const BVH::Volume &volume) Scalar minimumOnObject(const BVH::Object &object) ``` BVMinimize() [2/2] ------------------ template<typename BVH1 , typename BVH2 , typename Minimizer > | | | | | | --- | --- | --- | --- | | Minimizer::Scalar Eigen::BVMinimize | ( | const BVH1 & | *tree1*, | | | | const BVH2 & | *tree2*, | | | | Minimizer & | *minimizer* | | | ) | | | Given two BVH's, runs the query on their cartesian product encapsulated by *minimizer*. Returns the minimum value. The Minimizer type must provide the following members: ``` typedef Scalar //the numeric type of what is being minimized--not necessarily the Scalar type of the BVH (if it has one) Scalar minimumOnVolumeVolume(const BVH1::Volume &v1, const BVH2::Volume &v2) Scalar minimumOnVolumeObject(const BVH1::Volume &v1, const BVH2::Object &o2) Scalar minimumOnObjectVolume(const BVH1::Object &o1, const BVH2::Volume &v2) Scalar minimumOnObjectObject(const BVH1::Object &o1, const BVH2::Object &o2) ``` gamma\_sample\_der\_alpha() --------------------------- template<typename AlphaDerived , typename SampleDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)<Eigen::internal::scalar\_gamma\_sample\_der\_alpha\_op<typename AlphaDerived::Scalar>, const AlphaDerived, const SampleDerived> Eigen::gamma\_sample\_der\_alpha | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< AlphaDerived > & | *alpha*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< SampleDerived > & | *sample* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise gamma\_sample\_der\_alpha(*alpha*, *sample*) to the given arrays. This function computes the coefficient-wise derivative of the sample of a Gamma(alpha, 1) random variable with respect to the parameter alpha. Note This function supports only float and double scalar types in c++11 mode. To support other scalar types, or float/double in non c++11 mode, the user has to provide implementations of gamma\_sample\_der\_alpha(T,T) for any scalar type T to be supported. See also [Eigen::igamma()](namespaceeigen#a6e89509c5ff1af076baea462520f231c), [Eigen::lgamma()](../namespaceeigen#ac2e6331628bb1989b7be6d7e42827649) igamma() -------- template<typename Derived , typename ExponentDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)<Eigen::internal::scalar\_igamma\_op<typename Derived::Scalar>, const Derived, const ExponentDerived> Eigen::igamma | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *a*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ExponentDerived > & | *x* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise igamma(*a*, *x*) to the given arrays. This function computes the coefficient-wise incomplete gamma function. Note This function supports only float and double scalar types in c++11 mode. To support other scalar types, or float/double in non c++11 mode, the user has to provide implementations of igammac(T,T) for any scalar type T to be supported. See also [Eigen::igammac()](namespaceeigen#a2b1593c0c3f9d1673ae5980ae03e75f1), [Eigen::lgamma()](../namespaceeigen#ac2e6331628bb1989b7be6d7e42827649) igamma\_der\_a() ---------------- template<typename Derived , typename ExponentDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)<Eigen::internal::scalar\_igamma\_der\_a\_op<typename Derived::Scalar>, const Derived, const ExponentDerived> Eigen::igamma\_der\_a | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *a*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ExponentDerived > & | *x* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise igamma\_der\_a(*a*, *x*) to the given arrays. This function computes the coefficient-wise derivative of the incomplete gamma function with respect to the parameter a. Note This function supports only float and double scalar types in c++11 mode. To support other scalar types, or float/double in non c++11 mode, the user has to provide implementations of igamma\_der\_a(T,T) for any scalar type T to be supported. See also [Eigen::igamma()](namespaceeigen#a6e89509c5ff1af076baea462520f231c), [Eigen::lgamma()](../namespaceeigen#ac2e6331628bb1989b7be6d7e42827649) igammac() --------- template<typename Derived , typename ExponentDerived > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)<Eigen::internal::scalar\_igammac\_op<typename Derived::Scalar>, const Derived, const ExponentDerived> Eigen::igammac | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< Derived > & | *a*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< ExponentDerived > & | *x* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise igammac(*a*, *x*) to the given arrays. This function computes the coefficient-wise complementary incomplete gamma function. Note This function supports only float and double scalar types in c++11 mode. To support other scalar types, or float/double in non c++11 mode, the user has to provide implementations of igammac(T,T) for any scalar type T to be supported. See also [Eigen::igamma()](namespaceeigen#a6e89509c5ff1af076baea462520f231c), [Eigen::lgamma()](../namespaceeigen#ac2e6331628bb1989b7be6d7e42827649) polygamma() ----------- template<typename DerivedN , typename DerivedX > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)<Eigen::internal::scalar\_polygamma\_op<typename DerivedX::Scalar>, const DerivedN, const DerivedX> Eigen::polygamma | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedN > & | *n*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedX > & | *x* | | | ) | | | | inline | [c++11] Returns an expression of the coefficient-wise polygamma(*n*, *x*) to the given arrays. It returns the *n* -th derivative of the digamma(psi) evaluated at `x`. Note This function supports only float and double scalar types in c++11 mode. To support other scalar types, or float/double in non c++11 mode, the user has to provide implementations of polygamma(T,T) for any scalar type T to be supported. See also [Eigen::digamma()](../namespaceeigen#af40db84b3db19fe25fe2f77c429420e5) zeta() ------ template<typename DerivedX , typename DerivedQ > | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | | | | | | --- | --- | --- | --- | | const [Eigen::CwiseBinaryOp](../classeigen_1_1cwisebinaryop)<Eigen::internal::scalar\_zeta\_op<typename DerivedX::Scalar>, const DerivedX, const DerivedQ> Eigen::zeta | ( | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedX > & | *x*, | | | | const [Eigen::ArrayBase](../classeigen_1_1arraybase)< DerivedQ > & | *q* | | | ) | | | | inline | Returns an expression of the coefficient-wise zeta(*x*, *q*) to the given arrays. It returns the Riemann zeta function of two arguments *x* and *q:* Parameters | | | | --- | --- | | x | is the exponent, it must be > 1 | | q | is the shift, it must be > 0 | Note This function supports only float and double scalar types. To support other scalar types, the user has to provide implementations of zeta(T,T) for any scalar type T to be supported. See also ArrayBase::zeta()
programming_docs
eigen3 Eigen::MatrixPowerAtomic Eigen::MatrixPowerAtomic ======================== ### template<typename MatrixType> class Eigen::MatrixPowerAtomic< MatrixType > Class for computing matrix powers. Template Parameters | | | | --- | --- | | MatrixType | type of the base, expected to be an instantiation of the [Matrix](../classeigen_1_1matrix) class template. | This class is capable of computing triangular real/complex matrices raised to a power in the interval \( (-1, 1) \). Note Currently this class is only used by [MatrixPower](classeigen_1_1matrixpower "Class for computing matrix powers."). One may insist that this be nested into [MatrixPower](classeigen_1_1matrixpower "Class for computing matrix powers."). This class is here to facilitate future development of triangular matrix functions. Inherits internal::noncopyable. | | | --- | | | | void | [compute](classeigen_1_1matrixpoweratomic#ac3cdfb54a5b60079d068784534cbc174) ([ResultType](../classeigen_1_1block) &res) const | | | Compute the matrix power. [More...](classeigen_1_1matrixpoweratomic#ac3cdfb54a5b60079d068784534cbc174) | | | | | [MatrixPowerAtomic](classeigen_1_1matrixpoweratomic#ac0ec5f8d6c203cd9b53e2c95e01037d4) (const MatrixType &T, RealScalar p) | | | Constructor. [More...](classeigen_1_1matrixpoweratomic#ac0ec5f8d6c203cd9b53e2c95e01037d4) | | | MatrixPowerAtomic() ------------------- template<typename MatrixType > | | | | | | --- | --- | --- | --- | | [Eigen::MatrixPowerAtomic](classeigen_1_1matrixpoweratomic)< MatrixType >::[MatrixPowerAtomic](classeigen_1_1matrixpoweratomic) | ( | const MatrixType & | *T*, | | | | RealScalar | *p* | | | ) | | | Constructor. Parameters | | | | | --- | --- | --- | | [in] | T | the base of the matrix power. | | [in] | p | the exponent of the matrix power, should be in \( (-1, 1) \). | The class stores a reference to T, so it should not be changed (or destroyed) before evaluation. Only the upper triangular part of T is read. compute() --------- template<typename MatrixType > | | | | | | | | --- | --- | --- | --- | --- | --- | | void [Eigen::MatrixPowerAtomic](classeigen_1_1matrixpoweratomic)< MatrixType >::compute | ( | [ResultType](../classeigen_1_1block) & | *res* | ) | const | Compute the matrix power. Parameters | | | | | --- | --- | --- | | [out] | res | \( A^p \) where A and p are specified in the constructor. | --- The documentation for this class was generated from the following file:* [MatrixPower.h](https://eigen.tuxfamily.org/dox/unsupported/MatrixPower_8h_source.html) c C23 C23 === The next generation of the C standard. See: [The current IS schedule for C23](https://open-std.org/JTC1/SC22/WG14/www/docs/n2984.pdf). Obsolete --------- ### Removed * Old-style function [declarations](language/function_declaration "c/language/function declaration") and [definitions](language/function_definition "c/language/function definition") * Representations for [signed integers](language/arithmetic_types "c/language/arithmetic types") other than two's complement * Permission that `u`/`U`-prefixed [character constants](language/character_constant "c/language/character constant") and [string literals](language/string_literal "c/language/string literal") may be not UTF-16/32 * Mixed wide [string literal](language/string_literal "c/language/string literal") concatenation * Support for calling [`realloc()`](memory/realloc "c/memory/realloc") with zero size (the behavior becomes undefined) * [`__alignof_is_defined`](types "c/types") and [`__alignas_is_defined`](types "c/types") ### Deprecated * Old feature-test macros + [`__STDC_IEC_559__`](preprocessor/replace "c/preprocessor/replace") + [`__STDC_IEC_559_COMPLEX__`](preprocessor/replace "c/preprocessor/replace") * [`_Noreturn`](language/_noreturn "c/language/ Noreturn") function specifier * [`_Noreturn`](language/attributes/noreturn "c/language/attributes/noreturn") attribute token * `[asctime()](chrono/asctime "c/chrono/asctime")` * `[ctime()](chrono/ctime "c/chrono/ctime")` * [`DECIMAL_DIG`](types/limits "c/types/limits") * Definition of following numeric limit macros in `<math.h>` (they should be used via `<limits.h>`) + [`INFINITY`](numeric/math "c/numeric/math") + [`DEC_INFINITY`](numeric/math "c/numeric/math") + [`NAN`](numeric/math "c/numeric/math") + [`DEC_NAN`](numeric/math "c/numeric/math") * [`__bool_true_false_are_defined`](types "c/types") New language features ---------------------- * [Decimal floating-point types](language/arithmetic_types "c/language/arithmetic types") ([`_Decimal32`](keyword/_decimal32 "c/keyword/ Decimal32"), [`_Decimal64`](keyword/_decimal64 "c/keyword/ Decimal64"), and [`_Decimal128`](keyword/_decimal128 "c/keyword/ Decimal128")) * [Bit-precise integers](language/arithmetic_types "c/language/arithmetic types") ([`_BitInt(N)`](https://en.cppreference.com/mwiki/index.php?title=c/keyword/_BitInt(N)&action=edit&redlink=1 "c/keyword/ BitInt(N) (page does not exist)")) * [Binary integer constants](language/integer_constant "c/language/integer constant") * [`u8` character constants](language/character_constant "c/language/character constant") * Type change of [`u8` string literals](language/string_literal "c/language/string literal") * Digit separator `'` * Empty [initializer](language/initialization "c/language/initialization") `= {}` * [Attributes](language/attributes "c/language/attributes") + `[[[deprecated](language/attributes/deprecated "c/language/attributes/deprecated")]]` + `[[[fallthrough](language/attributes/fallthrough "c/language/attributes/fallthrough")]]` + `[[[maybe\_unused](language/attributes/maybe_unused "c/language/attributes/maybe unused")]]` + `[[[nodiscard](language/attributes/nodiscard "c/language/attributes/nodiscard")]]` + `[[[noreturn](language/attributes/noreturn "c/language/attributes/noreturn")]]` * Unnamed parameters in [function definitions](language/function_definition "c/language/function definition") * Identical cvr-qualifications for [array types](language/array "c/language/array") and their element types * Single-argument [`_Static_assert`](language/_static_assert "c/language/ Static assert") * [Labels](language/goto "c/language/goto") followed by declarations and `}` * [`nullptr`](https://en.cppreference.com/mwiki/index.php?title=c/keyword/nullptr&action=edit&redlink=1 "c/keyword/nullptr (page does not exist)") constant and the associated [`nullptr_t`](https://en.cppreference.com/mwiki/index.php?title=nullptr_t&action=edit&redlink=1 "nullptr t (page does not exist)") type * [`true`](https://en.cppreference.com/mwiki/index.php?title=true&action=edit&redlink=1 "true (page does not exist)") and [`false`](https://en.cppreference.com/mwiki/index.php?title=false&action=edit&redlink=1 "false (page does not exist)") become keywords (may be predefined macros for compatibility reasons) * New preprocessor directives + [`#elifdef`](preprocessor/conditional "c/preprocessor/conditional") + [`#elifndef`](preprocessor/conditional "c/preprocessor/conditional") + [`#warning`](preprocessor/error "c/preprocessor/error") + `#embed` * Pragmas for rounding direction + `STDC` [`FENV_ROUND`](preprocessor/impl "c/preprocessor/impl") + `STDC` [`FENV_DEC_ROUND`](preprocessor/impl "c/preprocessor/impl") ### Feature test macros for optional features * [`__STDC_IEC_60559_BFP__`](preprocessor/replace "c/preprocessor/replace") + Indicates IEEE-754 binary floating-point arithmetic and required math functions are supported. This macro supersedes [`__STDC_IEC_559__`](preprocessor/replace "c/preprocessor/replace"). * [`__STDC_IEC_60559_DFP__`](preprocessor/replace "c/preprocessor/replace") + Indicates IEEE-754 decimal floating-point arithmetic and required math functions are supported. * [`__STDC_IEC_60559_COMPLEX__`](preprocessor/replace "c/preprocessor/replace") + Indicates IEEE-754 complex arithmetic and required math functions are supported. This macro supersedes [`__STDC_IEC_559_COMPLEX__`](preprocessor/replace "c/preprocessor/replace"). New library features --------------------- * Extended binary floating-point math functions * Decimal floating-point math functions + -`d*N*` variants for existing and new floating-point math functions + [`quantizedN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/quantize&action=edit&redlink=1 "c/numeric/math/quantize (page does not exist)") + [`samequantumdN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/samequantum&action=edit&redlink=1 "c/numeric/math/samequantum (page does not exist)") + [`quantumdN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/quantum&action=edit&redlink=1 "c/numeric/math/quantum (page does not exist)") + [`llquantexpdN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/llquantexp&action=edit&redlink=1 "c/numeric/math/llquantexp (page does not exist)") + [`encodedecdN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/encodedec&action=edit&redlink=1 "c/numeric/math/encodedec (page does not exist)") + [`decodedecdN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/decodedec&action=edit&redlink=1 "c/numeric/math/decodedec (page does not exist)") + [`encodebindN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/encodebin&action=edit&redlink=1 "c/numeric/math/encodebin (page does not exist)") + [`decodebindN()`](https://en.cppreference.com/mwiki/index.php?title=c/numeric/math/decodebin&action=edit&redlink=1 "c/numeric/math/decodebin (page does not exist)") * [Floating-point formatting functions](https://en.cppreference.com/mwiki/index.php?title=c/string/byte/strfromf&action=edit&redlink=1 "c/string/byte/strfromf (page does not exist)") * Library support for UTF-8 + `char8_t` type alias + [`mbrtoc8()`](string/multibyte/mbrtoc8 "c/string/multibyte/mbrtoc8") + [`c8rtomb()`](string/multibyte/c8rtomb "c/string/multibyte/c8rtomb") + [`atomic_char8_t`](thread "c/thread") type alias + [`ATOMIC_CHAR8_T_LOCK_FREE`](atomic/atomic_lock_free_consts "c/atomic/ATOMIC LOCK FREE consts") test macro * POSIX functions + [`memccpy()`](string/byte/memccpy "c/string/byte/memccpy") + [`strdup()`](string/byte/strdup "c/string/byte/strdup") + [`strndup()`](string/byte/strndup "c/string/byte/strndup") + [`gmtime_r()`](chrono/gmtime "c/chrono/gmtime") + [`localtime_r()`](chrono/localtime "c/chrono/localtime") + Extensions for [`strftime()`](chrono/strftime "c/chrono/strftime") and [`wcsftime()`](chrono/wcsftime "c/chrono/wcsftime") * Extensions for [`fscanf()`](io/fscanf "c/io/fscanf") and [`fprintf()`](io/fprintf "c/io/fprintf") function families + `w*N*` and `wf*N*` length modifiers for [`[u]intN_t`](types/integer "c/types/integer") and [`[u]int_fastN_t`](types/integer "c/types/integer") respectively + `H`, `D`, and `DD` length modifiers for `_Decimal32`, `_Decimal64`, and `_Decimal128` respectively + `b` conversion specifier for unsigned integer types * [`timespec_getres()`](chrono/timespec_getres "c/chrono/timespec getres") * Macro constants for width of integer types * Additional numeric limit macros for floating-point types * Library version-test macros + [`__STDC_VERSION_FENV_H__`](numeric/fenv "c/numeric/fenv") + [`__STDC_VERSION_MATH_H__`](numeric/math "c/numeric/math") + [`__STDC_VERSION_STDINT_H__`](types/integer "c/types/integer") + [`__STDC_VERSION_STDLIB_H__`](string/byte "c/string/byte") + [`__STDC_VERSION_TGMATH_H__`](numeric/tgmath "c/numeric/tgmath") + [`__STDC_VERSION_TIME_H__`](chrono "c/chrono") Defect reports --------------- | Defect Reports fixed in C23 (? defects) | | --- | | * [DR 440](https://open-std.org/JTC1/SC22/WG14/www/docs/n2379.htm) * [DR 432](https://open-std.org/JTC1/SC22/WG14/www/docs/n2326.htm) * [DR 467](https://open-std.org/JTC1/SC22/WG14/www/docs/n2326.htm) * [DR 476](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_476) * [DR 482](https://open-std.org/JTC1/SC22/WG14/www/docs/n2324.htm) * [DR 488](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_488) * [DR 489](https://open-std.org/JTC1/SC22/WG14/www/docs/n2713.htm) * [DR 494](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_494) * [DR 496](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_496) * [DR 497](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_497) * [DR 499](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_499) * [DR 500](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_500) * [DR 501](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_501) | Compiler support ----------------- ### C23 core language features | C23 feature | Paper(s) | GCC | Clang | MSVC | Apple Clang | EDG eccp | Intel C++ | IBM XLC++ | Sun/Oracle C++ | Embarcadero C++ Builder | Cray | Nvidia HPC C++ (ex Portland Group/PGI) | Nvidia nvcc | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [`_Static_assert`](language/_static_assert "c/language/ Static assert") with no message | [N2265](https://open-std.org/JTC1/SC22/WG14/www/docs/n2265.pdf) | 9 | 9 | | Yes | | | | | | | | | | `[[[nodiscard](language/attributes/nodiscard "c/language/attributes/nodiscard")]]` | [N2267](https://open-std.org/JTC1/SC22/WG14/www/docs/n2267.pdf) | 10 | 9 | | Yes | | | | | | | | | | `[[[maybe\_unused](language/attributes/maybe_unused "c/language/attributes/maybe unused")]]` | [N2270](https://open-std.org/JTC1/SC22/WG14/www/docs/n2270.pdf) | 10 | 9 | | Yes | | | | | | | | | | `[[[deprecated](language/attributes/deprecated "c/language/attributes/deprecated")]]` | [N2334](https://open-std.org/JTC1/SC22/WG14/www/docs/n2334.pdf) | 10 | 9 | | Yes | | | | | | | | | | [Attributes](language/attributes "c/language/attributes") | [N2335](https://open-std.org/JTC1/SC22/WG14/www/docs/n2335.pdf)[N2554](https://open-std.org/JTC1/SC22/WG14/www/docs/n2554.pdf) | 10 | 9 | | Yes | | | | | | | | | | IEEE 754 decimal floating-point types | [N2341](https://open-std.org/JTC1/SC22/WG14/www/docs/n2341.pdf) | 4.2 (partial)\* | | | | | 13.0 (partial)\* | | | | | | | | `[[[fallthrough](language/attributes/fallthrough "c/language/attributes/fallthrough")]]` | [N2408](https://open-std.org/JTC1/SC22/WG14/www/docs/n2408.pdf) | 10 | 9 | | Yes | | | | | | | | | | [`u8` character constants](language/character_constant "c/language/character constant") | [N2418](https://open-std.org/JTC1/SC22/WG14/www/docs/n2418.pdf) | 10 | 15 | | | | | | | | | | | | Removal of [function definitions](language/function_definition "c/language/function definition") without prototype | [N2432](https://open-std.org/JTC1/SC22/WG14/www/docs/n2432.pdf) | 10 | 15 | | | | | | | | | | | | `[[[nodiscard](language/attributes/nodiscard "c/language/attributes/nodiscard")]]` with message | [N2448](https://open-std.org/JTC1/SC22/WG14/www/docs/n2448.pdf) | 11 | 10 | | Yes | | | | | | | | | | Unnamed parameters in function definitions | [N2480](https://open-std.org/JTC1/SC22/WG14/www/docs/n2480.pdf) | 11 | 11 | | Yes | | | | | | | | | | [Labels](language/statements#Labels "c/language/statements") before declarations and end of blocks | [N2508](https://open-std.org/JTC1/SC22/WG14/www/docs/n2508.pdf) | 11 | | Partial\* | | | 17.0\* | | | | | | | | [Binary integer constants](language/integer_constant "c/language/integer constant") | [N2549](https://open-std.org/JTC1/SC22/WG14/www/docs/n2549.pdf) | 4.3\*11 | 2.9\*9 | 19.0 (2015)\*\* | Yes | | 11.0\* | | | | | | | | [`__has_c_attribute`](language/attributes#Attribute_testing "c/language/attributes") in preprocessor conditionals | [N2553](https://open-std.org/JTC1/SC22/WG14/www/docs/n2553.pdf) | 11 | 9 | | Yes | | | | | | | | | | Allow duplicate attributes | [N2557](https://open-std.org/JTC1/SC22/WG14/www/docs/n2557.pdf) | 11 | 13 | | Yes | | | | | | | | | | IEEE 754 interchange and extended types | [N2601](https://open-std.org/JTC1/SC22/WG14/www/docs/n2601.pdf) | 7 (partial)\* | 6 (partial)\* | | Partial\* | | | | | | | | | | Digit separators | [N2626](https://open-std.org/JTC1/SC22/WG14/www/docs/n2626.pdf) | 12 | 13 | 19.0 (2015)\*\* | Yes | | 18.0\* | | | | | | | | [`#elifdef` and `#elifndef`](preprocessor/conditional "c/preprocessor/conditional") | [N2645](https://open-std.org/JTC1/SC22/WG14/www/docs/n2645.pdf) | 12 | 13 | | 13.1.6\* | | | | | | | | | | Type change of [`u8` string literals](language/string_literal "c/language/string literal") | [N2653](https://open-std.org/JTC1/SC22/WG14/www/docs/n2653.htm) | | | | | | | | | | | | | | `[[[maybe\_unused](language/attributes/maybe_unused "c/language/attributes/maybe unused")]]` for labels | [N2662](https://open-std.org/JTC1/SC22/WG14/www/docs/n2662.pdf) | 11 | | | | | | | | | | | | | [`#warning`](preprocessor/error "c/preprocessor/error") | [N2686](https://open-std.org/JTC1/SC22/WG14/www/docs/n2686.pdf) | Yes | Yes | | Yes | Yes | Yes | | | | | | | | Bit-precise integer types (`_BitInt`) | [N2763](https://open-std.org/JTC1/SC22/WG14/www/docs/n2763.pdf) | | 15 | | | | | | | | | | | | `[[[noreturn](language/attributes/noreturn "c/language/attributes/noreturn")]]` | [N2764](https://open-std.org/JTC1/SC22/WG14/www/docs/n2764.pdf) | | 15 | | | | | | | | | | | | Suffixes for bit-precise integer constants | [N2775](https://open-std.org/JTC1/SC22/WG14/www/docs/n2775.pdf) | | 15 | | | | | | | | | | | | [`__has_include`](preprocessor/include "c/preprocessor/include") in preprocessor conditionals | [N2799](https://open-std.org/JTC1/SC22/WG14/www/docs/n2799.pdf) | 5 | Yes | 19.11\* | Yes | 4.13 | 18.0 | | | | | | | | Removal of [function declarations](language/function_declaration "c/language/function declaration") without prototype | [N2841](https://open-std.org/JTC1/SC22/WG14/www/docs/n2841.htm) | | 15 | | | | | | | | | | | | [Empty initializers](language/initialization#Empty_initialization "c/language/initialization") | [N2900](https://open-std.org/JTC1/SC22/WG14/www/docs/n2900.htm) | Partial\* | Partial\* | | Partial\* | Partial\* | Partial\* | | | | | | | | [`typeof`](https://en.cppreference.com/mwiki/index.php?title=c/language/typeof&action=edit&redlink=1 "c/language/typeof (page does not exist)") and [`typeof_unqual`](https://en.cppreference.com/mwiki/index.php?title=c/language/typeof&action=edit&redlink=1 "c/language/typeof (page does not exist)") | [N2927](https://open-std.org/JTC1/SC22/WG14/www/docs/n2927.htm) | Partial\* | Partial\* | | Partial\* | Partial\* | Partial\* | | | | Partial\* | | | | Predefined [`true` and `false`](language/bool_constant "c/language/bool constant") | [N2935](https://open-std.org/JTC1/SC22/WG14/www/docs/n2935.pdf) | | | | | | | | | | | | | | `[[[unsequenced](https://en.cppreference.com/mwiki/index.php?title=c/language/attributes/unsequenced&action=edit&redlink=1 "c/language/attributes/unsequenced (page does not exist)")]]` and `[[[reproducible](https://en.cppreference.com/mwiki/index.php?title=c/language/attributes/reproducible&action=edit&redlink=1 "c/language/attributes/reproducible (page does not exist)")]]` | [N2956](https://open-std.org/JTC1/SC22/WG14/www/docs/n2956.htm) | | | | | | | | | | | | | | Relax requirements for [variadic parameter list](language/variadic "c/language/variadic") | [N2975](https://open-std.org/JTC1/SC22/WG14/www/docs/n2975.pdf) | | | | | | | | | | | | | | Type inference in object definitions | [N3007](https://open-std.org/JTC1/SC22/WG14/www/docs/n3007.htm) | | | | | | | | | | | | | | [`constexpr`](https://en.cppreference.com/mwiki/index.php?title=c/language/constexpr&action=edit&redlink=1 "c/language/constexpr (page does not exist)") objects | [N3008](https://open-std.org/JTC1/SC22/WG14/www/docs/n3008.htm) | | | | | | | | | | | | | | [`nullptr`](language/nullptr "c/language/nullptr") | [N3042](https://open-std.org/JTC1/SC22/WG14/www/docs/n3042.htm) | | | | | | | | | | | | | | C23 feature | Paper(s) | GCC | Clang | MSVC | Apple Clang | EDG eccp | Intel C++ | IBM XLC++ | Sun/Oracle C++ | Embarcadero C++ Builder | Cray | Nvidia HPC C++(ex Portland Group/PGI) | Nvidia nvcc | ### C23 library features
programming_docs
c Numerics Numerics ======== The C numerics library includes common mathematical functions and types, as well as support for random number generation. ### [Common mathematical functions](numeric/math "c/numeric/math") The header `math.h` provides [standard C library mathematical functions](numeric/math "c/numeric/math") such as `[fabs](numeric/math/fabs "c/numeric/math/fabs")`, `[sqrt](numeric/math/sqrt "c/numeric/math/sqrt")`, and `[sin](numeric/math/sin "c/numeric/math/sin")`. ### [Floating-point environment](numeric/fenv "c/numeric/fenv") The header `fenv.h` defines [flags and functions related to exceptional floating-point state](numeric/fenv "c/numeric/fenv"), such as overflow and division by zero. ### [Pseudo-random number generation](numeric/random "c/numeric/random") The header `stdlib.h` also includes C-style random number generation via `[srand](numeric/random/srand "c/numeric/random/srand")` and `[rand](numeric/random/rand "c/numeric/random/rand")`. ### [Complex number arithmetic](numeric/complex "c/numeric/complex") The header `complex.h` provides types and functions about [complex numbers](numeric/complex "c/numeric/complex"). ### [Type-generic math](numeric/tgmath "c/numeric/tgmath") The header `tgmath.h` provides some macros for a function which names XXX: * real function: + `float` variant `XXXf` + `double` variant `XXX` + `long double` variant `XXXl` * complex function: + `float` variant `cXXXf` + `double` variant `cXXX` + `long double` variant `cXXXl` ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/numeric "cpp/numeric") for Numerics library | c Algorithms Algorithms ========== | Defined in header `<stdlib.h>` | | --- | | [qsortqsort\_s](algorithm/qsort "c/algorithm/qsort") (C11) | sorts a range of elements with unspecified type (function) | | [bsearchbsearch\_s](algorithm/bsearch "c/algorithm/bsearch") (C11) | searches an array for an element of unspecified type (function) | ### References * C11 standard (ISO/IEC 9899:2011): + 7.22.5 Searching and sorting utilities (p: 354-356) + K.3.6.3 Searching and sorting utilities (p: 607-609) * C99 standard (ISO/IEC 9899:1999): + 7.20.5 Searching and sorting utilities (p: 318-319) * C89/C90 standard (ISO/IEC 9899:1990): + 4.10.5 Searching and sorting utilities ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/algorithm "cpp/algorithm") for Algorithms library | c C Programming Language C Programming Language ====================== The interface of C standard library is defined by the following collection of headers. | | | | --- | --- | | `<assert.h>` | [Conditionally compiled macro that compares its argument to zero](error "c/error") | | `<complex.h>` (C99) | [Complex number arithmetic](numeric/complex "c/numeric/complex") | | `<ctype.h>` | [Functions to determine the type contained in character data](string/byte "c/string/byte") | | `<errno.h>` | [Macros reporting error conditions](error "c/error") | | `<fenv.h>` (C99) | [Floating-point environment](numeric/fenv "c/numeric/fenv") | | `<float.h>` | [Limits of floating-point types](types/limits#Limits_of_floating_point_types "c/types/limits") | | `<inttypes.h>` (C99) | [Format conversion of integer types](types/integer "c/types/integer") | | `<iso646.h>` (C95) | [Alternative operator spellings](language/operator_alternative "c/language/operator alternative") | | `<limits.h>` | [Ranges of integer types](types/limits "c/types/limits") | | `<locale.h>` | [Localization utilities](locale "c/locale") | | `<math.h>` | [Common mathematics functions](numeric/math "c/numeric/math") | | `<setjmp.h>` | [Nonlocal jumps](program "c/program") | | `<signal.h>` | [Signal handling](program "c/program") | | `<stdalign.h>` (C11) | [`alignas` and `alignof`](types "c/types") convenience macros | | `<stdarg.h>` | [Variable arguments](variadic "c/variadic") | | `<stdatomic.h>` (C11) | [Atomic operations](thread#Atomic_operations "c/thread") | | `<stdbool.h>` (C99) | [Macros for boolean type](types "c/types") | | `<stddef.h>` | [Common macro definitions](types "c/types") | | `<stdint.h>` (C99) | [Fixed-width integer types](types/integer "c/types/integer") | | `<stdio.h>` | [Input/output](io "c/io") | | `<stdlib.h>` | General utilities: [memory management](memory "c/memory"), [program utilities](program "c/program"), [string conversions](string "c/string"), [random numbers](numeric/random "c/numeric/random"), [algorithms](algorithm "c/algorithm") | | `<stdnoreturn.h>` (C11) | [`noreturn`](language/_noreturn "c/language/ Noreturn") convenience macro | | `<string.h>` | [String handling](string/byte "c/string/byte") | | `<tgmath.h>` (C99) | [Type-generic math](numeric/tgmath "c/numeric/tgmath") (macros wrapping math.h and complex.h) | | `<threads.h>` (C11) | [Thread library](thread "c/thread") | | `<time.h>` | [Time/date utilities](chrono "c/chrono") | | `<uchar.h>` (C11) | [UTF-16 and UTF-32 character utilities](string/multibyte "c/string/multibyte") | | `<wchar.h>` (C95) | [Extended multibyte and wide character utilities](string/wide "c/string/wide") | | `<wctype.h>` (C95) | [Functions to determine the type contained in wide character data](string/wide "c/string/wide") | ### References * C17 standard (ISO/IEC 9899:2018): + 7.1.2 Standard headers (p: 131-132) * C11 standard (ISO/IEC 9899:2011): + 7.1.2 Standard headers (p: 181-182) * C99 standard (ISO/IEC 9899:1999): + 7.1.2 Standard headers (p: 165) * C89/C90 standard (ISO/IEC 9899:1990): + 4.1.2 Standard headers ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/header "cpp/header") for C++ Standard Library header files | c File input/output File input/output ================= The `<stdio.h>` header provides generic file operation support and supplies functions with narrow character input/output capabilities. The `<wchar.h>` header supplies functions with wide character input/output capabilities. I/O streams are denoted by objects of type `[FILE](io/file "c/io/FILE")` that can only be accessed and manipulated through pointers of type `[FILE](http://en.cppreference.com/w/c/io/FILE)\*`. Each stream is associated with an external physical device (file, standard input stream, printer, serial port, etc). ### Types | Defined in header `<stdio.h>` | | --- | | [FILE](io/file "c/io/FILE") | object type, capable of holding all information needed to control a C I/O stream (typedef) | | [fpos\_t](io/fpos_t "c/io/fpos t") | non-array complete object type, capable of uniquely specifying a position and multibyte parser state in a file (typedef) | ### Predefined standard streams | Defined in header `<stdio.h>` | | --- | | [stdinstdoutstderr](io/std_streams "c/io/std streams") | expression of type `[FILE](http://en.cppreference.com/w/c/io/FILE)\*` associated with the input streamexpression of type `[FILE](http://en.cppreference.com/w/c/io/FILE)\*` associated with the output streamexpression of type `[FILE](http://en.cppreference.com/w/c/io/FILE)\*` associated with the error output stream (macro constant) | ### Functions | | | --- | | File access | | Defined in header `<stdio.h>` | | [fopenfopen\_s](io/fopen "c/io/fopen") (C11) | opens a file (function) | | [freopenfreopen\_s](io/freopen "c/io/freopen") (C11) | open an existing stream with a different name (function) | | [fclose](io/fclose "c/io/fclose") | closes a file (function) | | [fflush](io/fflush "c/io/fflush") | synchronizes an output stream with the actual file (function) | | [setbuf](io/setbuf "c/io/setbuf") | sets the buffer for a file stream (function) | | [setvbuf](io/setvbuf "c/io/setvbuf") | sets the buffer and its size for a file stream (function) | | Defined in header `<wchar.h>` | | [fwide](io/fwide "c/io/fwide") (C95) | switches a file stream between wide character I/O and narrow character I/O (function) | | Direct input/output | | Defined in header `<stdio.h>` | | [fread](io/fread "c/io/fread") | reads from a file (function) | | [fwrite](io/fwrite "c/io/fwrite") | writes to a file (function) | | Unformatted input/output | | Narrow character | | Defined in header `<stdio.h>` | | [fgetcgetc](io/fgetc "c/io/fgetc") | gets a character from a file stream (function) | | [fgets](io/fgets "c/io/fgets") | gets a character string from a file stream (function) | | [fputcputc](io/fputc "c/io/fputc") | writes a character to a file stream (function) | | [fputs](io/fputs "c/io/fputs") | writes a character string to a file stream (function) | | [getchar](io/getchar "c/io/getchar") | reads a character from `[stdin](io/std_streams "c/io/std streams")` (function) | | [getsgets\_s](io/gets "c/io/gets") (removed in C11)(C11) | reads a character string from `stdin` (function) | | [putchar](io/putchar "c/io/putchar") | writes a character to `stdout` (function) | | [puts](io/puts "c/io/puts") | writes a character string to `[stdout](io/std_streams "c/io/std streams")` (function) | | [ungetc](io/ungetc "c/io/ungetc") | puts a character back into a file stream (function) | | Wide character | | Defined in header `<wchar.h>` | | [fgetwcgetwc](io/fgetwc "c/io/fgetwc") (C95) | gets a wide character from a file stream (function) | | [fgetws](io/fgetws "c/io/fgetws") (C95) | gets a wide string from a file stream (function) | | [fputwcputwc](io/fputwc "c/io/fputwc") (C95) | writes a wide character to a file stream (function) | | [fputws](io/fputws "c/io/fputws") (C95) | writes a wide string to a file stream (function) | | [getwchar](io/getwchar "c/io/getwchar") (C95) | reads a wide character from `stdin` (function) | | [putwchar](io/putwchar "c/io/putwchar") (C95) | writes a wide character to `[stdout](io/std_streams "c/io/std streams")` (function) | | [ungetwc](io/ungetwc "c/io/ungetwc") (C95) | puts a wide character back into a file stream (function) | | Formatted input/output | | Narrow character | | Defined in header `<stdio.h>` | | [scanffscanfsscanfscanf\_sfscanf\_ssscanf\_s](io/fscanf "c/io/fscanf") (C11)(C11)(C11) | reads formatted input from `[stdin](io/std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vscanfvfscanfvsscanfvscanf\_svfscanf\_svsscanf\_s](io/vfscanf "c/io/vfscanf") (C99)(C99)(C99)(C11)(C11)(C11) | reads formatted input from `[stdin](io/std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](io/fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](io/std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vprintfvfprintfvsprintfvsnprintfvprintf\_svfprintf\_svsprintf\_svsnprintf\_s](io/vfprintf "c/io/vfprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](io/std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | Wide character | | Defined in header `<wchar.h>` | | [wscanffwscanfswscanfwscanf\_sfwscanf\_sswscanf\_s](io/fwscanf "c/io/fwscanf") (C95)(C95)(C95)(C11)(C11)(C11) | reads formatted wide character input from `[stdin](io/std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vwscanfvfwscanfvswscanfvwscanf\_svfwscanf\_svswscanf\_s](io/vfwscanf "c/io/vfwscanf") (C99)(C99)(C99)(C11)(C11)(C11) | reads formatted wide character input from `[stdin](io/std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [wprintffwprintfswprintfwprintf\_sfwprintf\_sswprintf\_ssnwprintf\_s](io/fwprintf "c/io/fwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](io/std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vwprintfvfwprintfvswprintfvwprintf\_svfwprintf\_svswprintf\_svsnwprintf\_s](io/vfwprintf "c/io/vfwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](io/std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | File positioning | | Defined in header `<stdio.h>` | | [ftell](io/ftell "c/io/ftell") | returns the current file position indicator (function) | | [fgetpos](io/fgetpos "c/io/fgetpos") | gets the file position indicator (function) | | [fseek](io/fseek "c/io/fseek") | moves the file position indicator to a specific location in a file (function) | | [fsetpos](io/fsetpos "c/io/fsetpos") | moves the file position indicator to a specific location in a file (function) | | [rewind](io/rewind "c/io/rewind") | moves the file position indicator to the beginning in a file (function) | | Error handling | | Defined in header `<stdio.h>` | | [clearerr](io/clearerr "c/io/clearerr") | clears errors (function) | | [feof](io/feof "c/io/feof") | checks for the end-of-file (function) | | [ferror](io/ferror "c/io/ferror") | checks for a file error (function) | | [perror](io/perror "c/io/perror") | displays a character string corresponding of the current error to `[stderr](io/std_streams "c/io/std streams")` (function) | | Operations on files | | Defined in header `<stdio.h>` | | [remove](io/remove "c/io/remove") | erases a file (function) | | [rename](io/rename "c/io/rename") | renames a file (function) | | [tmpfiletmpfile\_s](io/tmpfile "c/io/tmpfile") (C11) | returns a pointer to a temporary file (function) | | [tmpnamtmpnam\_s](io/tmpnam "c/io/tmpnam") (C11) | returns a unique filename (function) | ### Macro constants | Defined in header `<stdio.h>` | | --- | | EOF | integer constant expression of type `int` and negative value (macro constant) | | FOPEN\_MAX | maximum number of files that can be open simultaneously (macro constant) | | FILENAME\_MAX | size needed for an array of `char` to hold the longest supported file name (macro constant) | | BUFSIZ | size of the buffer used by `setbuf()` (macro constant) | | \_IOFBF\_IOLBF\_IONBF | argument to `setvbuf()` indicating fully buffered I/Oargument to `setvbuf()` indicating line buffered I/Oargument to `setvbuf()` indicating unbuffered I/O (macro constant) | | SEEK\_SETSEEK\_CURSEEK\_END | argument to `fseek()` indicating seeking from beginning of the fileargument to `fseek()` indicating seeking from the current file positionargument to `fseek()` indicating seeking from end of the file (macro constant) | | TMP\_MAXTMP\_MAX\_S (C11) | maximum number of unique filenames that can be generated by `[tmpnam](io/tmpnam "c/io/tmpnam")`maximum number of unique filenames that can be generated by `tmpnam_s` (macro constant) | | L\_tmpnamL\_tmpnam\_s (C11) | size needed for an array of `char` to hold the result of `[tmpnam](io/tmpnam "c/io/tmpnam")`size needed for an array of `char` to hold the result of `tmpnam_s` (macro constant) | ### References * C11 standard (ISO/IEC 9899:2011): + 7.21 Input/output <stdio.h> (p: 296-339) + 7.29 Extended multibyte and wide character utilities <wchar.h> (p: 402-446) + 7.31.11 Input/output <stdio.h> (p: 456) + 7.31.16 Extended multibyte and wide character utilities <wchar.h> (p: 456) + K.3.5 Input/output <stdio.h> (p: 586-603) * C99 standard (ISO/IEC 9899:1999): + 7.19 Input/output <stdio.h> (p: 262-305) + 7.24 Extended multibyte and wide character utilities <wchar.h> (p: 348-392) + 7.26.9 Input/output <stdio.h> (p: 402) + 7.26.12 Extended multibyte and wide character utilities <wchar.h> (p: 402) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9 INPUT/OUTPUT <stdio.h> + 4.13.6 Input/output <stdio.h> ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c "cpp/io/c") for C-style file input/output | c Strings library Strings library =============== ### [Null-terminated byte string management](string/byte "c/string/byte") ### [Null-terminated multibyte string management](string/multibyte "c/string/multibyte") ### [Null-terminated wide string management](string/wide "c/string/wide") ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/string "cpp/string") for Strings library | c C11 C11 === **ISO/IEC 9899:2011**, a.k.a. **C11**, is a previous revision of the C standard. Obsolete --------- ### Removed * `[gets()](io/gets "c/io/gets")` New language features ---------------------- * Multithreaded environments + [Atomic objects](language/atomic "c/language/atomic") ([`_Atomic`](keyword/_atomic "c/keyword/ Atomic")) + [Thread local storage](language/storage_duration#Storage_duration "c/language/storage duration") ([`_Thread_local`](keyword/_thread_local "c/keyword/ Thread local")) * Enhanced alignment support + [Alignment query](language/_alignof "c/language/ Alignof") ([`_Alignof`](keyword/_alignof "c/keyword/ Alignof")) + [Alignment strengthening](language/_alignas "c/language/ Alignas") ([`_Alignas`](keyword/_alignas "c/keyword/ Alignas")) + Over-aligned types * Unicode support + [`u`/`U` character constants](language/character_constant "c/language/character constant") + [`u8`/`u`/`U` string literals](language/string_literal "c/language/string literal") * [Generic selection expressions](language/generic "c/language/generic") ([`_Generic`](keyword/_generic "c/keyword/ Generic")) * [Non-returning functions](language/_noreturn "c/language/ Noreturn") ([`_Noreturn`](keyword/_noreturn "c/keyword/ Noreturn")) * Anonymous [struct](language/struct "c/language/struct") and [union](language/union "c/language/union") members * Fine-grained [evaluation order](language/eval_order "c/language/eval order") * Extending the lifetime of [temporary objects](language/lifetime#Temporary_lifetime "c/language/lifetime") * [`_Static_assert`](language/_static_assert "c/language/ Static assert") * [Analyzability](language/analyzability "c/language/analyzability") ### Feature test macros for optional features * [`__STDC_ANALYZABLE__`](preprocessor/replace "c/preprocessor/replace") + Indicates analyzability is supported. * [`__STDC_LIB_EXT1__`](preprocessor/replace "c/preprocessor/replace") + Indicates bounds checking functions are supported. * [`__STDC_NO_ATOMICS__`](preprocessor/replace "c/preprocessor/replace") + Indicates atomic objects and the atomic operation library are not supported. * [`__STDC_NO_COMPLEX__`](preprocessor/replace "c/preprocessor/replace") + Indicates complex types and the complex math functions are not supported. These features were mandatory in C99. * [`__STDC_NO_THREADS__`](preprocessor/replace "c/preprocessor/replace") + Indicates thread local storage and the thread support library are not supported. * [`__STDC_NO_VLA__`](preprocessor/replace "c/preprocessor/replace") + Indicates [variable length arrays and variably modified types](language/array#Variable-length_arrays "c/language/array") are not supported. These features were mandatory in C99. New library features --------------------- ### New headers * `<stdalign.h>` * `<stdatomic.h>` * `<stdnoreturn.h>` * `<threads.h>` * `<uchar.h>` ### Library features * [Concurrency support library](thread "c/thread") * [`aligned_alloc()`](memory/aligned_alloc "c/memory/aligned alloc") * UTF-16/32 type aliases + [`char16_t`](string/multibyte/char16_t "c/string/multibyte/char16 t") + [`char32_t`](string/multibyte/char32_t "c/string/multibyte/char32 t") * UTF-16/32 conversion functions + `[mbrtoc16()](string/multibyte/mbrtoc16 "c/string/multibyte/mbrtoc16")` + `[mbrtoc32()](string/multibyte/mbrtoc32 "c/string/multibyte/mbrtoc32")` + `[c16rtomb()](string/multibyte/c16rtomb "c/string/multibyte/c16rtomb")` + `[c32rtomb()](string/multibyte/c32rtomb "c/string/multibyte/c32rtomb")` * `[quick\_exit](program/quick_exit "c/program/quick exit")` * `[at\_quick\_exit](program/at_quick_exit "c/program/at quick exit")` * Exclusive modes of `[fopen()](io/fopen "c/io/fopen")` and `[freopen()](io/freopen "c/io/freopen")` (`"x"`) * [Bounds checking functions](error#Bounds_checking "c/error") * [`timespec`](chrono/timespec "c/chrono/timespec") * [`timespec_get()`](chrono/timespec_get "c/chrono/timespec get") * [`CMPLX(F|L)?`](numeric/complex/cmplx "c/numeric/complex/CMPLX") * New numeric limit macros + [`(FLT|DBL|LDBL)_DECIMAL_DIG`](types/limits "c/types/limits") + [`(FLT|DBL|LDBL)_TRUE_MIN`](types/limits "c/types/limits") + [`(FLT|DBL|LDBL)_HAS_SUBNORM`](types/limits "c/types/limits") * Thread local `[errno](error/errno "c/error/errno")` Defect reports --------------- [Template:c/language/history/DR11](https://en.cppreference.com/mwiki/index.php?title=Template:c/language/history/DR11&action=edit&redlink=1 "Template:c/language/history/DR11 (page does not exist)"). Compiler support ----------------- [Template:c/compiler support/11](https://en.cppreference.com/mwiki/index.php?title=Template:c/compiler_support/11&action=edit&redlink=1 "Template:c/compiler support/11 (page does not exist)").
programming_docs
c Localization support Localization support ==================== | Defined in header `<locale.h>` | | --- | | [setlocale](locale/setlocale "c/locale/setlocale") | gets and sets the current C locale (function) | | [localeconv](locale/localeconv "c/locale/localeconv") | queries numeric and monetary formatting details of the current locale (function) | | [lconv](locale/lconv "c/locale/lconv") | formatting details, returned by `[localeconv](http://en.cppreference.com/w/c/locale/localeconv)` (struct) | | Locale categories | | [LC\_ALLLC\_COLLATELC\_CTYPELC\_MONETARYLC\_NUMERICLC\_TIME](locale/lc_categories "c/locale/LC categories") | locale categories for `[setlocale](http://en.cppreference.com/w/c/locale/setlocale)` (macro constant) | ### References * C11 standard (ISO/IEC 9899:2011): + 7.11 Localization <locale.h> (p: 223-230) + 7.31.6 Localization <locale.h> (p: 455) * C99 standard (ISO/IEC 9899:1999): + 7.11 Localization <locale.h> (p: 204-211) + 7.26.5 Localization <locale.h> (p: 401) * C89/C90 standard (ISO/IEC 9899:1990): + 4.4 LOCALIZATION <locale.h> + 4.13.3 Localization <locale.h> ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/locale "cpp/locale") for Localization library | c Comments Comments ======== Comments serve as a sort of in-code documentation. When inserted into a program, they are effectively ignored by the compiler; they are solely intended to be used as notes by the humans that read source code. ### Syntax | | | | | --- | --- | --- | | `/*` comment `*/` | (1) | | | `//` comment | (2) | (since C99) | 1) Often known as "C-style" or "multi-line" comments. 2) Often known as "C++-style" or "single-line" comments. All comments are removed from the program at [translation phase 3](language/translation_phases "c/language/translation phases") by replacing each comment with a single whitespace character. ### C-style C-style comments are usually used to comment large blocks of text or small fragments of code; however, they can be used to comment single lines. To insert text as a C-style comment, simply surround the text with `/*` and `*/`. C-style comments tell the compiler to ignore all content between `/*` and `*/`. Although it is not part of the C standard, `/**` and `*/` are often used to indicate documentation blocks; this is legal because the second asterisk is simply treated as part of the comment. Except within a [character constant](language/character_constant "c/language/character constant"), a [string literal](language/string_literal "c/language/string literal"), or a comment, the characters `/*` introduce a comment. The contents of such a comment are examined only to identify multibyte characters and to find the characters `*/` that terminate the comment. C-style comments cannot be nested. | | | | --- | --- | | C++-style C++-style comments are usually used to comment single lines of text or code; however, they can be placed together to form multi-line comments. To insert text as a C++-style comment, simply precede the text with `//` and follow the text with the new line character. C++-style comments tell the compiler to ignore all content between `//` and a new line. Except within a [character constant](language/character_constant "c/language/character constant"), a [string literal](language/string_literal "c/language/string literal"), or a comment, the characters `//` introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify multibyte characters and to find the new-line character that terminates the comment. C++-style comments can be nested: ``` // y = f(x); // invoke algorithm ``` A C-style comment may appear within a C++-style comment: ``` // y = f(x); /* invoke algorithm */ ``` A C++-style comment may appear within a C-style comment; this is a mechanism for excluding a small block of source code: ``` /* y = f(x); // invoke algorithms z = g(x); */ ``` | (since C99) | ### Notes Because comments [are removed](language/translation_phases "c/language/translation phases") before the preprocessor stage, a macro cannot be used to form a comment and an unterminated C-style comment doesn't spill over from an #include'd file. ``` /* An attempt to use a macro to form a comment. */ /* But, a space replaces characters "//". */ #ifndef DEBUG #define PRINTF // #else #define PRINTF printf #endif ... PRINTF("Error in file %s at line %i\n", __FILE__, __LINE__); ``` Besides commenting out, other mechanisms used for source code exclusion are: ``` #if 0 puts("this will not be compiled"); /* no conflict with C-style comments */ // no conflict with C++-style comments #endif ``` and. ``` if(0) { puts("this will be compiled but not be executed"); /* no conflict with C-style comments */ // no conflict with C++-style comments } ``` The introduction of // comments in C99 was a breaking change in some rare circumstances: ``` a = b //*divisor:*/ c + d; /* C89 compiles a = b / c + d; C99 compiles a = b + d; */ ``` ### Example ``` #include <stdio.h> /* C-style comments can contain multiple lines. */ /* Or, just one line. */ // C++-style comments can comment one line. // Or, they can // be strung together. int main(void) { // The below code won't be run // puts("Hello"); // The below code will be run puts("World"); // A note regarding backslash + newline. // Despite belonging to translation phase 2 (vs phase 3 for comments), // '\' still determines which portion of the source code is considered // as 'comments': // This comment will be promoted to the next line \ puts("Won't be run"); // may issue a warning "multi-line comment" puts("Hello, again"); } ``` Output: ``` World Hello, again ``` ### References * C17 standard (ISO/IEC 9899:2018): + 6.4.9 Comments (p: 54) * C11 standard (ISO/IEC 9899:2011): + 6.4.9 Comments (p: 75) * C99 standard (ISO/IEC 9899:1999): + 6.4.9 Comments (p: 66) * C89/C90 standard (ISO/IEC 9899:1990): + 3.1.9 Comments ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/comments "cpp/comments") for Comments | c Dynamic memory management Dynamic memory management ========================= ### Functions | Defined in header `<stdlib.h>` | | --- | | [malloc](memory/malloc "c/memory/malloc") | allocates memory (function) | | [calloc](memory/calloc "c/memory/calloc") | allocates and zeroes memory (function) | | [realloc](memory/realloc "c/memory/realloc") | expands previously allocated memory block (function) | | [free](memory/free "c/memory/free") | deallocates previously allocated memory (function) | | [aligned\_alloc](memory/aligned_alloc "c/memory/aligned alloc") (C11) | allocates aligned memory (function) | ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/memory/c "cpp/memory/c") for C memory management library | c Type support Type support ============ See also [type system overview](language/types "c/language/types") and [arithmetic types defined by the language](language/arithmetic_types "c/language/arithmetic types"). ### Basic types #### Additional basic types and convenience macros | Defined in header `<stddef.h>` | | --- | | [size\_t](types/size_t "c/types/size t") | unsigned integer type returned by the [`sizeof`](language/sizeof "c/language/sizeof") operator (typedef) | | [ptrdiff\_t](types/ptrdiff_t "c/types/ptrdiff t") | signed integer type returned when subtracting two pointers (typedef) | | [nullptr\_t](types/nullptr_t "c/types/nullptr t") (C23) | the type of the predefined null pointer constant [`nullptr`](language/nullptr "c/language/nullptr") (typedef) | | [NULL](types/null "c/types/NULL") | implementation-defined null pointer constant (macro constant) | | [max\_align\_t](types/max_align_t "c/types/max align t") (C11) | a type with alignment requirement as great as any other scalar type (typedef) | | [offsetof](types/offsetof "c/types/offsetof") | byte offset from the beginning of a struct type to specified member (function macro) | | Defined in header `<stdbool.h>` | | bool (C99)(until C23) | convenience macro, expands to [`_Bool`](keyword/_bool "c/keyword/ Bool") (keyword macro) | | true (C99)(until C23) | expands to integer constant `1` (macro constant) | | false (C99)(until C23) | expands to integer constant `0` (macro constant) | | \_\_bool\_true\_false\_are\_defined (C99)(deprecated in C23) | expands to integer constant `1` (macro constant) | | Defined in header `<stdalign.h>` | | alignas (C11)(until C23) | convenience macro, expands to keyword [`_Alignas`](keyword/_alignas "c/keyword/ Alignas") (keyword macro) | | alignof (C11)(until C23) | convenience macro, expands to keyword [`_Alignof`](keyword/_alignof "c/keyword/ Alignof") (keyword macro) | | \_\_alignas\_is\_defined (C11)(until C23) | expands to integer constant `1` (macro constant) | | \_\_alignof\_is\_defined (C11)(until C23) | expands to integer constant `1` (macro constant) | | Defined in header `<stdnoreturn.h>` | | noreturn (C11)(deprecated in C23) | convenience macro, expands to [`_Noreturn`](keyword/_noreturn "c/keyword/ Noreturn") (keyword macro) | #### [Fixed width integer types](types/integer "c/types/integer") (since C99) #### [Numeric limits](types/limits "c/types/limits") ### Notes | | | | --- | --- | | The type of `true` and `false` is `int` rather than `_Bool`. A program may undefine and perhaps then redefine the macros `bool`, `true` and `false`. However, such ability is a deprecated feature. | (since C99)(until C23) | | The type of `true` and `false` is `bool`. It is unspecified whether any of `bool`, `_Bool`, `true`, or `false` is implemented as a predefined macro. If `bool`, `true`, or `false` (but not `_Bool`) is defined as a predefined macro, a program may undefine and perhaps redefine it. | (since C23) | ### Example ``` #include <stdio.h> #include <stdbool.h> #include <stdalign.h> int main(void) { printf("%d %d %d\n", true && false, true || false, !false); printf("%d %d\n", true ^ true, true + true); printf("%zu\n", alignof(short)); } ``` Possible output: ``` 0 1 1 0 2 2 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.15 Alignment <stdalign.h> (p: 196) + 7.18 Boolean type and values <stdbool.h> (p: 210) + 7.19 Common definitions <stddef.h> (p: 211) + 7.23 \_Noreturn <stdnoreturn.h> (p: 263) + 7.31.9 Boolean type and values <stdbool.h> (p: 332) * C11 standard (ISO/IEC 9899:2011): + 7.15 Alignment <stdalign.h> (p: 268) + 7.18 Boolean type and values <stdbool.h> (p: 287) + 7.19 Common definitions <stddef.h> (p: 288) + 7.23 \_Noreturn <stdnoreturn.h> (p: 361) + 7.31.9 Boolean type and values <stdbool.h> (p: 456) * C99 standard (ISO/IEC 9899:1999): + 7.18 Boolean type and values <stdbool.h> (p: 253) + 7.19 Common definitions <stddef.h> (p: 254) + 7.26.7 Boolean type and values <stdbool.h> (p: 401) * C89/C90 standard (ISO/IEC 9899:1990): + 4.1.5 Common definitions <stddef.h> ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/types "cpp/types") for Type support library | c Atomic operations library Atomic operations library ========================= If the macro constant `__STDC_NO_ATOMICS__`(C11) is defined by the compiler, the header `<stdatomic.h>`, the keyword `_Atomic`, and all of the names listed here are not provided. ### Types | Defined in header `<stdatomic.h>` | | --- | | [memory\_order](atomic/memory_order "c/atomic/memory order") (C11) | defines memory ordering constraints (enum) | | [atomic\_flag](atomic/atomic_flag "c/atomic/atomic flag") (C11) | lock-free atomic boolean flag (struct) | ### Macros | Defined in header `<stdatomic.h>` | | --- | | [ATOMIC\_BOOL\_LOCK\_FREEATOMIC\_CHAR\_LOCK\_FREEATOMIC\_CHAR16\_T\_LOCK\_FREEATOMIC\_CHAR32\_T\_LOCK\_FREEATOMIC\_WCHAR\_T\_LOCK\_FREEATOMIC\_SHORT\_LOCK\_FREEATOMIC\_INT\_LOCK\_FREEATOMIC\_LONG\_LOCK\_FREEATOMIC\_LLONG\_LOCK\_FREEATOMIC\_POINTER\_LOCK\_FREE](atomic/atomic_lock_free_consts "c/atomic/ATOMIC LOCK FREE consts") (C11) | indicates that the given atomic type is lock-free (macro constant) | | [ATOMIC\_FLAG\_INIT](atomic/atomic_flag_init "c/atomic/ATOMIC FLAG INIT") (C11) | initializes a new `[atomic\_flag](http://en.cppreference.com/w/c/atomic/atomic_flag)` (macro constant) | | [ATOMIC\_VAR\_INIT](atomic/atomic_var_init "c/atomic/ATOMIC VAR INIT") (C11)(deprecated in C17)(removed in C23) | initializes a new atomic object (function macro) | | [kill\_dependency](atomic/kill_dependency "c/atomic/kill dependency") (C11) | breaks a dependency chain for `[memory\_order\_consume](http://en.cppreference.com/w/c/atomic/memory_order)` (function macro) | ### Functions | Defined in header `<stdatomic.h>` | | --- | | [atomic\_flag\_test\_and\_setatomic\_flag\_test\_and\_set\_explicit](atomic/atomic_flag_test_and_set "c/atomic/atomic flag test and set") (C11) | sets an atomic\_flag to true and returns the old value (function) | | [atomic\_flag\_clearatomic\_flag\_clear\_explicit](atomic/atomic_flag_clear "c/atomic/atomic flag clear") (C11) | sets an atomic\_flag to false (function) | | [atomic\_init](atomic/atomic_init "c/atomic/atomic init") (C11) | initializes an existing atomic object (function) | | [atomic\_is\_lock\_free](atomic/atomic_is_lock_free "c/atomic/atomic is lock free") (C11) | indicates whether the atomic object is lock-free (function) | | [atomic\_storeatomic\_store\_explicit](atomic/atomic_store "c/atomic/atomic store") (C11) | stores a value in an atomic object (function) | | [atomic\_loadatomic\_load\_explicit](atomic/atomic_load "c/atomic/atomic load") (C11) | reads a value from an atomic object (function) | | [atomic\_exchangeatomic\_exchange\_explicit](atomic/atomic_exchange "c/atomic/atomic exchange") (C11) | swaps a value with the value of an atomic object (function) | | [atomic\_compare\_exchange\_strongatomic\_compare\_exchange\_strong\_explicitatomic\_compare\_exchange\_weakatomic\_compare\_exchange\_weak\_explicit](atomic/atomic_compare_exchange "c/atomic/atomic compare exchange") (C11) | swaps a value with an atomic object if the old value is what is expected, otherwise reads the old value (function) | | [atomic\_fetch\_addatomic\_fetch\_add\_explicit](atomic/atomic_fetch_add "c/atomic/atomic fetch add") (C11) | atomic addition (function) | | [atomic\_fetch\_subatomic\_fetch\_sub\_explicit](atomic/atomic_fetch_sub "c/atomic/atomic fetch sub") (C11) | atomic subtraction (function) | | [atomic\_fetch\_oratomic\_fetch\_or\_explicit](atomic/atomic_fetch_or "c/atomic/atomic fetch or") (C11) | atomic bitwise OR (function) | | [atomic\_fetch\_xoratomic\_fetch\_xor\_explicit](atomic/atomic_fetch_xor "c/atomic/atomic fetch xor") (C11) | atomic bitwise exclusive OR (function) | | [atomic\_fetch\_andatomic\_fetch\_and\_explicit](atomic/atomic_fetch_and "c/atomic/atomic fetch and") (C11) | atomic bitwise AND (function) | | [atomic\_thread\_fence](atomic/atomic_thread_fence "c/atomic/atomic thread fence") (C11) | generic memory order-dependent fence synchronization primitive (function) | | [atomic\_signal\_fence](atomic/atomic_signal_fence "c/atomic/atomic signal fence") (C11) | fence between a thread and a signal handler executed in the same thread (function) | ### Types The standard library offers convenience typedefs for the [core language atomic types](language/atomic "c/language/atomic"). | Typedef name | Full type name | | --- | --- | | `atomic_bool` | `_Atomic _Bool` | | `atomic_char` | `_Atomic char` | | `atomic_schar` | `_Atomic signed char` | | `atomic_uchar` | `_Atomic unsigned char` | | `atomic_short` | `_Atomic short` | | `atomic_ushort` | `_Atomic unsigned short` | | `atomic_int` | `_Atomic int` | | `atomic_uint` | `_Atomic unsigned int` | | `atomic_long` | `_Atomic long` | | `atomic_ulong` | `_Atomic unsigned long` | | `atomic_llong` | `_Atomic long long` | | `atomic_ullong` | `_Atomic unsigned long long` | | `atomic_char16_t` | `_Atomic char16_t` | | `atomic_char32_t` | `_Atomic char32_t` | | `atomic_wchar_t` | `_Atomic wchar_t` | | `atomic_int_least8_t` | `_Atomic [int\_least8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least8_t` | `_Atomic [uint\_least8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_least16_t` | `_Atomic [int\_least16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least16_t` | `_Atomic [uint\_least16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_least32_t` | `_Atomic [int\_least32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least32_t` | `_Atomic [uint\_least32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_least64_t` | `_Atomic [int\_least64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least64_t` | `_Atomic [uint\_least64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast8_t` | `_Atomic [int\_fast8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast8_t` | `_Atomic [uint\_fast8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast16_t` | `_Atomic [int\_fast16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast16_t` | `_Atomic [uint\_fast16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast32_t` | `_Atomic [int\_fast32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast32_t` | `_Atomic [uint\_fast32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast64_t` | `_Atomic [int\_fast64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast64_t` | `_Atomic [uint\_fast64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_intptr_t` | `_Atomic [intptr\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uintptr_t` | `_Atomic [uintptr\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_size_t` | `_Atomic [size\_t](http://en.cppreference.com/w/c/types/size_t)` | | `atomic_ptrdiff_t` | `_Atomic [ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | | `atomic_intmax_t` | `_Atomic [intmax\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uintmax_t` | `_Atomic [uintmax\_t](http://en.cppreference.com/w/c/types/integer)` | ### References * C11 standard (ISO/IEC 9899:2011): + 7.17 Atomics <stdatomic.h> (p: 273-286) + 7.31.8 Atomics <stdatomic.h> (p: 455-456) ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/atomic "cpp/atomic") for Atomic operations library | c Program support utilities Program support utilities ========================= ### Program termination The following functions manage program termination and resources cleanup. | Defined in header `<stdlib.h>` | | --- | | [abort](program/abort "c/program/abort") | causes abnormal program termination (without cleaning up) (function) | | [exit](program/exit "c/program/exit") | causes normal program termination with cleaning up (function) | | [quick\_exit](program/quick_exit "c/program/quick exit") (C11) | causes normal program termination without completely cleaning up (function) | | [\_Exit](program/_exit "c/program/ Exit") (C99) | causes normal program termination without cleaning up (function) | | [atexit](program/atexit "c/program/atexit") | registers a function to be called on `[exit()](program/exit "c/program/exit")` invocation (function) | | [at\_quick\_exit](program/at_quick_exit "c/program/at quick exit") (C11) | registers a function to be called on [`quick_exit`](program/quick_exit "c/program/quick exit") invocation (function) | | [EXIT\_SUCCESSEXIT\_FAILURE](program/exit_status "c/program/EXIT status") | indicates program execution execution status (macro constant) | ### Unreachable control flow | Defined in header `<stddef.h>` | | --- | | [unreachable](program/unreachable "c/program/unreachable") (C23) | marks unreachable point of execution (function macro) | ### Communicating with the environment | Defined in header `<stdlib.h>` | | --- | | [system](program/system "c/program/system") | calls the host environment's command processor (function) | | [getenvgetenv\_s](program/getenv "c/program/getenv") (C11) | access to the list of environment variables (function) | ### Signals Several functions and macro constants for signal management are provided. | Defined in header `<signal.h>` | | --- | | [signal](program/signal "c/program/signal") | sets a signal handler for particular signal (function) | | [raise](program/raise "c/program/raise") | runs the signal handler for particular signal (function) | | [sig\_atomic\_t](program/sig_atomic_t "c/program/sig atomic t") | the integer type that can be accessed as an atomic entity from an asynchronous signal handler (typedef) | | [SIG\_DFLSIG\_IGN](program/sig_strategies "c/program/SIG strategies") | defines signal handling strategies (macro constant) | | [SIG\_ERR](program/sig_err "c/program/SIG ERR") | error was encountered (macro constant) | | Signal types | | [SIGABRTSIGFPESIGILLSIGINTSIGSEGVSIGTERM](program/sig_types "c/program/SIG types") | defines signal types (macro constant) | ### Non-local jumps | Defined in header `<setjmp.h>` | | --- | | [setjmp](program/setjmp "c/program/setjmp") | saves the context (function macro) | | [longjmp](program/longjmp "c/program/longjmp") | jumps to specified location (function) | | Types | | [jmp\_buf](program/jmp_buf "c/program/jmp buf") | execution context type (typedef) | ### References * C17 standard (ISO/IEC 9899:2018): + 7.13 Nonlocal jumps <setjmp.h> (p: 191-192) + 7.14 Signal handling <signal.h> (p: 193-195) + 7.22 General utilities <stdlib.h> (p: 248-262) + 7.31.7 Signal handling <signal.h> (p: 332) + 7.31.12 General utilities <stdlib.h> (p: 333) * C11 standard (ISO/IEC 9899:2011): + 7.13 Nonlocal jumps <setjmp.h> (p: 262-264) + 7.14 Signal handling <signal.h> (p: 265-267) + 7.22 General utilities <stdlib.h> (p: 340-360) + 7.31.7 Signal handling <signal.h> (p: 455) + 7.31.12 General utilities <stdlib.h> (p: 456) * C99 standard (ISO/IEC 9899:1999): + 7.13 Nonlocal jumps <setjmp.h> (p: 243-245) + 7.14 Signal handling <signal.h> (p: 246-248) + 7.20 General utilities <stdlib.h> (p: 306-324) + 7.26.6 Signal handling <signal.h> (p: 401) + 7.26.10 General utilities <stdlib.h> (p: 402) * C89/C90 standard (ISO/IEC 9899:1990): + 4.6 NON-LOCAL JUMPS <setjmp.h> + 4.7 SIGNAL HANDLING <signal.h> + 4.10 GENERAL UTILITIES <stdlib.h> + 4.13.5 Signal handling <signal.h> + 7.13.7 General utilities <stdlib.h> ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/program "cpp/utility/program") for Program support utilities |
programming_docs
c C99 C99 === **ISO/IEC 9899:1999**, a.k.a. **C99**, is a previous revision of the C standard. Obsolete --------- ### Removed * Implicit `int` in declarations * Implicit function declarations ### Deprecated * `[gets()](io/gets "c/io/gets")` New language features ---------------------- * Universal-character-names in [identifiers](language/identifier "c/language/identifier") * Increased [translation limits](language/identifier#Translation_limits "c/language/identifier") * `//` [comments](comment "c/comment") * [`restrict`](language/restrict "c/language/restrict") pointers * Enhanced [arithmetic types](language/arithmetic_types "c/language/arithmetic types") + `_Bool` + `long long` and `unsigned long long` + Extended integer types + [`_Complex`](keyword/_complex "c/keyword/ Complex") types (`float _Complex`, `double _Complex`, and `long double _Complex`) + [`_Imaginary`](keyword/_imaginary "c/keyword/ Imaginary") types (`float _Imaginary`, `double _Imaginary`, and `long double _Imaginary`) * Flexible array members * [Variable-length array](language/array#Variable-length_arrays "c/language/array") (VLA) types and variably-modified (VM) types * Improvements of braced-init-list for [array](language/array_initialization "c/language/array initialization"), [struct and union](language/struct_initialization "c/language/struct initialization") types + Non-constant initializers + Designated initializers * Idempotent cvr-qualifiers * Trailing comma in [enumerator-list](language/enum "c/language/enum") * Hexadecimal [floating constants](language/floating_constant "c/language/floating constant") * [Compound literals](language/compound_literal "c/language/compound literal") * Floating-point environment * Requiring truncation for divisions of signed integer types * Implicit `return 0;` in the [`main()` function](language/main_function "c/language/main function") * Declarations and statements in mixed order * init-statement in [`for`](language/for "c/language/for") loops * [`inline`](language/inline "c/language/inline") functions * Predefined variable [`__func__`](language/function_definition "c/language/function definition") * Cvr-qualifiers and `static` in `[]` within function declarations * [Variadic macros](preprocessor/replace "c/preprocessor/replace") * [`_Pragma`](preprocessor/impl "c/preprocessor/impl") preprocessor operator * Standard pragmas for floating-point evaluation + `STDC` [`FENV_ACCESS`](preprocessor/impl "c/preprocessor/impl") + `STDC` [`FP_CONTRACT`](preprocessor/impl "c/preprocessor/impl") + `STDC` [`CX_LIMITED_RANGE`](preprocessor/impl "c/preprocessor/impl") ### Feature test macros for optional features * [`__STDC_IEC_559__`](preprocessor/replace "c/preprocessor/replace") + Indicates IEEE-754 binary floating-point arithmetic and required math functions are supported. * [`__STDC_IEC_559_COMPLEX__`](preprocessor/replace "c/preprocessor/replace") + Indicates IEEE-754 complex arithmetic and required math functions are supported. * [`__STDC_HOSTED__`](preprocessor/replace "c/preprocessor/replace") + Indicates that the implementation is [hosted](language/conformance "c/language/conformance"). * [`__STDC_ISO_10646__`](preprocessor/replace "c/preprocessor/replace") + Indicates that Unicode is used by the wide literal encodings and expands to the latest supported revision. * [`__STDC_MB_MIGHT_NEQ_WC__`](preprocessor/replace "c/preprocessor/replace") + Indicates that there are some characters in the basic character set having different code unit values in [ordinary and wide literal encodings](language/character_constant "c/language/character constant"). New library features --------------------- ### New headers * `<complex.h>` * `<fenv.h>` * `<inttypes.h>` * `<stdbool.h>` * `<stdint.h>` * `<tgmath.h>` ### Library features * [Aliases for integer types](types/integer "c/types/integer") + Integer types with exact width (`int*N*_t` and `uint*N*_t`) + Fastest integer types with at least given width (`int_fast*N*_t` and `uint_fast*N*_t`) + Smallest integer types with at least given width (`int_least*N*_t` and `uint_least*N*_t`) + Integer types capable for cast between object pointers (`[intptr\_t](types/integer "c/types/integer")` and `[uintptr\_t](types/integer "c/types/integer")`) + Integer types with maximum width (`[intmax\_t](types/integer "c/types/integer")` and `[uintmax\_t](types/integer "c/types/integer")`) * Operations on `long long` and `[intmax\_t](types/integer "c/types/integer")` + `[llabs()](numeric/math/abs "c/numeric/math/abs")` + `[imaxabs()](numeric/math/abs "c/numeric/math/abs")` + `[lldiv()](numeric/math/div "c/numeric/math/div")` + `[imaxdiv()](numeric/math/div "c/numeric/math/div")` * [Floating-point environment access](numeric/fenv "c/numeric/fenv") * Extended floating-point math functions + New floating-point math functions + -`f` and -`l` variants for existing and new floating-point math functions + [Math error handling](numeric/math/math_errhandling "c/numeric/math/math errhandling") * [Complex functions](numeric/complex "c/numeric/complex") * `[\_Exit()](program/_exit "c/program/ Exit")` * Formatting support for `long long`, `unsigned long long`, `[intmax\_t](types/integer "c/types/integer")`, and `[uintmax\_t](types/integer "c/types/integer")` + `[atoll()](string/byte/atoi "c/string/byte/atoi")` + `[strtoimax()](string/byte/strtoimax "c/string/byte/strtoimax")` + `[strtoll()](string/byte/strtol "c/string/byte/strtol")` + `[strtoull](string/byte/strtoul "c/string/byte/strtoul")` + `[strtoumax()](string/byte/strtoimax "c/string/byte/strtoimax")` + `[wcstoimax()](string/wide/wcstoimax "c/string/wide/wcstoimax")` + `[wcstoll()](string/wide/wcstol "c/string/wide/wcstol")` + `[wcstoull()](string/wide/wcstoul "c/string/wide/wcstoul")` + `[wcstoumax()](string/wide/wcstoimax "c/string/wide/wcstoimax")` * `[isblank()](string/byte/isblank "c/string/byte/isblank")` and `[iswblank()](string/wide/iswblank "c/string/wide/iswblank")` * `[snprintf()](io/fprintf "c/io/fprintf")` and `[vsnprintf()](io/vfprintf "c/io/vfprintf")` * `[vfscanf()](io/vfscanf "c/io/vfscanf")` and `[vfwscanf()](io/vfwscanf "c/io/vfwscanf")` function families * Extensions for [`fscanf()`](io/fscanf "c/io/fscanf") and [`fprintf()`](io/fprintf "c/io/fprintf") function families + `ll` length modifier for `long long` and `unsigned long long` + `hh` length modifier for `signed char` and `unsigned char` + `l` length modifier for `double` + `z` length modifier for `[size\_t](types/size_t "c/types/size t")` and its signed version + `t` length modifier for `[ptrdiff\_t](types/ptrdiff_t "c/types/ptrdiff t")` and its unsigned version + `j` length modifier for `[intmax\_t](types/integer "c/types/integer")` and `[uintmax\_t](types/integer "c/types/integer")` + `a` conversion specifier for floating-point types * Numeric limit macros for `long long` and `unsigned long long` * Numeric limit macros corresponding to existing and new aliases for integer types * [Format string macros for integer types](types/integer#Format_macro_constants "c/types/integer") * [`va_copy`](variadic/va_copy "c/variadic/va copy") * [Type-generic math macros](numeric/tgmath "c/numeric/tgmath") * Floating-point comparison macros * Floating-point classification macros * Compatibility macros for `_Bool` ([`bool`](types "c/types"), [`true`](types "c/types"), and [`false`](types "c/types")) Defect reports --------------- [Template:c/language/history/DR99](https://en.cppreference.com/mwiki/index.php?title=Template:c/language/history/DR99&action=edit&redlink=1 "Template:c/language/history/DR99 (page does not exist)"). Compiler support ----------------- ### C99 core language features | C99 feature | Paper(s) | GCC | Clang | MSVC | Apple Clang | EDG eccp | Intel C++ | IBM XLC++ | Sun/Oracle C++ | Embarcadero C++ Builder | Cray | Nvidia HPC C++ (ex Portland Group/PGI) | Nvidia nvcc | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | Universal-character-names in [identifiers](language/identifier "c/language/identifier") | N/A | 3.1 | Yes | | | | | | | | | | | | Increased [translation limits](language/identifier#Translation_limits "c/language/identifier") | N590 | 0.9 | N/A | | | | | | | | | | | | `//` [comments](comment "c/comment") | [N644](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n644.htm) | 2.7 | Yes | | | | | | | | | | | | [`restrict`](language/restrict "c/language/restrict") pointers | N448 | 2.95 | Yes | | | | | | | | | | | | Enhanced [arithmetic types](language/arithmetic_types "c/language/arithmetic types") | [N815](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n815.htm)[N601](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n601.ps)[N620](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n620.ps)[N638](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n638.ps)[N657](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n657.ps)[N694](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n694.ps)[N809](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n809.ps) | Yes | partial | | | | | | | | | | | | Flexible array members | N/A | 3.0 | Yes | | | | | | | | | | | | [Variable-length array](language/array#Variable-length_arrays "c/language/array") (VLA) types | [N683](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n683.htm) | 0.9 | Yes | | | | | | | | | | | | Variably-modified (VM) types | [N2778](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2778.pdf) | N/A | Yes | | | | | | | | | | | | Designated initializers | [N494](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n494.pdf) | 3.0 | Yes | | | | | | | | | | | | Non-constant initializers | N/A | 1.21 | N/A | | | | | | | | | | | | Idempotent cvr-qualifiers | N505 | 3.0 | N/A | | | | | | | | | | | | Trailing comma in [enumerator-list](language/enum "c/language/enum") | N/A | 0.9 | Yes | | | | | | | | | | | | Hexadecimal [floating constants](language/floating_constant "c/language/floating constant") | N308 | 2.8 | Yes | | | | | | | | | | | | [Compound literals](language/compound_literal "c/language/compound literal") | [N716](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n716.htm) | 3.1 | Yes | | | | | | | | | | | | Floating-point environment | N/A | partial | partial | | | | | | | | | | | | Requiring truncation for divisions of signed integer types | [N617](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n617.htm) | 0.9 | N/A | | | | | | | | | | | | Implicit `return 0;` in the [`main()` function](language/main_function "c/language/main function") | N/A | Yes | Yes | | | | | | | | | | | | Declarations and statements in mixed order | [N740](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n740.htm) | 3.0 | Yes | | | | | | | | | | | | init-statement in [`for`](language/for "c/language/for") loops | N/A | Yes | Yes | | | | | | | | | | | | [`inline`](language/inline "c/language/inline") functions | [N741](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n741.htm) | 4.3 | Yes | | | | | | | | | | | | Predefined variable [`__func__`](language/function_definition "c/language/function definition") | [N611](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n611.ps) | 2.95 | Yes | | | | | | | | | | | | Cvr-qualifiers and `static` in `[]` within function declarations | N/A | 3.1 | Yes | | | | | | | | | | | | [Variadic macros](preprocessor/replace "c/preprocessor/replace") | [N707](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n707.htm) | 2.95 | Yes | | | | | | | | | | | | [`_Pragma`](preprocessor/impl "c/preprocessor/impl") preprocessor operator | [N634](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n634.ps) | 3.0 | Yes | | | | | | | | | | | | Standard pragmas for floating-point evaluation | [N631](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n631.htm)[N696](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n696.ps) | No | No | | | | | Yes | Yes | | | | | | C99 feature | Paper(s) | GCC | Clang | MSVC | Apple Clang | EDG eccp | Intel C++ | IBM XLC++ | Sun/Oracle C++ | Embarcadero C++ Builder | Cray | Nvidia HPC C++(ex Portland Group/PGI) | Nvidia nvcc | c Date and time utilities Date and time utilities ======================= ### Functions | | | --- | | Time manipulation | | Defined in header `<time.h>` | | [difftime](chrono/difftime "c/chrono/difftime") | computes the difference between times (function) | | [time](chrono/time "c/chrono/time") | returns the current calendar time of the system as time since epoch (function) | | [clock](chrono/clock "c/chrono/clock") | returns raw processor clock time since the program is started (function) | | [timespec\_get](chrono/timespec_get "c/chrono/timespec get") (C11) | returns the calendar time in seconds and nanoseconds based on a given time base (function) | | [timespec\_getres](chrono/timespec_getres "c/chrono/timespec getres") (C23) | returns the resolution of calendar time based on a given time base (function) | | Format conversions | | Defined in header `<time.h>` | | [asctimeasctime\_s](chrono/asctime "c/chrono/asctime") (deprecated in C23)(C11) | converts a `[tm](chrono/tm "c/chrono/tm")` object to a textual representation (function) | | [ctimectime\_s](chrono/ctime "c/chrono/ctime") (deprecated in C23)(C11) | converts a `[time\_t](chrono/time_t "c/chrono/time t")` object to a textual representation (function) | | [strftime](chrono/strftime "c/chrono/strftime") | converts a `[tm](chrono/tm "c/chrono/tm")` object to custom textual representation (function) | | Defined in header `<wchar.h>` | | [wcsftime](chrono/wcsftime "c/chrono/wcsftime") (C95) | converts a `[tm](chrono/tm "c/chrono/tm")` object to custom wide string textual representation (function) | | Defined in header `<time.h>` | | [gmtimegmtime\_rgmtime\_s](chrono/gmtime "c/chrono/gmtime") (C23)(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) | | [localtimelocaltime\_rlocaltime\_s](chrono/localtime "c/chrono/localtime") (C23)(C11) | converts time since epoch to calendar time expressed as local time (function) | | [mktime](chrono/mktime "c/chrono/mktime") | converts calendar time to time since epoch (function) | ### Constants | Defined in header `<time.h>` | | --- | | [CLOCKS\_PER\_SEC](chrono/clocks_per_sec "c/chrono/CLOCKS PER SEC") | number of processor clock ticks per second (macro constant) | ### Types | Defined in header `<time.h>` | | --- | | [tm](chrono/tm "c/chrono/tm") | calendar time type (struct) | | [time\_t](chrono/time_t "c/chrono/time t") | calendar time since epoch type (typedef) | | [clock\_t](chrono/clock_t "c/chrono/clock t") | processor time since era type (typedef) | | [timespec](chrono/timespec "c/chrono/timespec") (C11) | time in seconds and nanoseconds (struct) | ### References * C17 standard (ISO/IEC 9899:2018): + 7.27 Date and time <time.h> (p: 284-291) + 7.29.5.1 The wcsftime function (p: 320-321) + 7.31.14 Date and time <time.h> (p: 333) * C11 standard (ISO/IEC 9899:2011): + 7.27 Date and time <time.h> (p: 388-397) + 7.29.5.1 The wcsftime function (p: 439-440) + 7.31.14 Date and time <time.h> (p: 456) * C99 standard (ISO/IEC 9899:1999): + 7.23 Date and time <time.h> (p: 338-347) + 7.24.5.1 The wcsftime function (p: 385-386) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12 DATE AND TIME <time.h> ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c "cpp/chrono/c") for C Date and time utilities | c C language C language ========== This is a reference of the core C language constructs. | | | | | --- | --- | --- | | **[Basic concepts](language/basic_concepts "c/language/basic concepts")**. [Comments](comment "c/comment") [ASCII chart](language/ascii "c/language/ascii") [Character sets](language/charset "c/language/charset") [Translation phases](language/translation_phases "c/language/translation phases") [Punctuation](language/punctuators "c/language/punctuators") [Identifier](language/identifier "c/language/identifier") - [Scope](language/scope "c/language/scope") - [Lifetime](language/lifetime "c/language/lifetime") [Lookup and Name Spaces](language/name_space "c/language/name space") [Type](language/type "c/language/type") - [Arithmetic types](language/arithmetic_types "c/language/arithmetic types") [Objects and Alignment](language/object "c/language/object") [The `main` function](language/main_function "c/language/main function") [As-if rule](language/as_if "c/language/as if") [Undefined behavior](language/behavior "c/language/behavior") [Memory model and Data races](language/memory_model "c/language/memory model"). **[Keywords](keyword "c/keyword")**. **[Preprocessor](preprocessor "c/preprocessor")**. [`#if` - `#ifdef` - `#ifndef` - `#elif`](preprocessor/conditional "c/preprocessor/conditional") [`#elifdef` - `#elifndef`](preprocessor/conditional "c/preprocessor/conditional")(C23) [`#define` - `#` - `##`](preprocessor/replace "c/preprocessor/replace") [`#include`](preprocessor/include "c/preprocessor/include") - [`#pragma`](preprocessor/impl "c/preprocessor/impl") [`#line`](preprocessor/line "c/preprocessor/line") - [`#error`](preprocessor/error "c/preprocessor/error") [`#warning`](preprocessor/error "c/preprocessor/error")(C23). **[Statements](language/statements "c/language/statements")**. [`if`](language/if "c/language/if") - [`switch`](language/switch "c/language/switch") [`for`](language/for "c/language/for") [`while`](language/while "c/language/while") - [`do`-`while`](language/do "c/language/do") [`continue`](language/continue "c/language/continue") - [`break`](language/break "c/language/break") [`goto`](language/goto "c/language/goto") - [`return`](language/return "c/language/return"). | **[Expressions](language/expressions "c/language/expressions")**. [Value categories](language/value_category "c/language/value category") [Evaluation order and sequencing](language/eval_order "c/language/eval order") [Constants and literals](language/expressions#Constants_and_literals "c/language/expressions") [Integer constants](language/integer_constant "c/language/integer constant") [Floating constants](language/floating_constant "c/language/floating constant") [Character constants](language/character_constant "c/language/character constant") [`true`/`false`](language/bool_constant "c/language/bool constant")(C23) [`nullptr`](language/nullptr "c/language/nullptr")(C23) [String literals](language/string_literal "c/language/string literal") [Compound literals](language/compound_literal "c/language/compound literal")(C99) [Constant expressions](language/constant_expression "c/language/constant expression") [Implicit conversions](language/conversion "c/language/conversion") [Operators](language/expressions#Operators "c/language/expressions") [Member access and indirection](language/operator_member_access "c/language/operator member access") [Logical](language/operator_logical "c/language/operator logical") - [Comparison](language/operator_comparison "c/language/operator comparison") [Arithmetic](language/operator_arithmetic "c/language/operator arithmetic") - [Assignment](language/operator_assignment "c/language/operator assignment") [Increment and Decrement](language/operator_incdec "c/language/operator incdec") [Call, Comma, Ternary](language/operator_other "c/language/operator other") [`sizeof`](language/sizeof "c/language/sizeof") - [`_Alignof`](language/_alignof "c/language/ Alignof")(C11) [Cast operators](language/cast "c/language/cast") [Operator precedence](language/operator_precedence "c/language/operator precedence") [Generic selection](language/generic "c/language/generic")(C11). **[Initialization](language/initialization "c/language/initialization")**. [Scalar](language/scalar_initialization "c/language/scalar initialization") [Array](language/array_initialization "c/language/array initialization") [Structure/Union](language/struct_initialization "c/language/struct initialization") | **[Declarations](language/declarations "c/language/declarations")**. [Pointers](language/pointer "c/language/pointer") - [Arrays](language/array "c/language/array") [Enumerations](language/enum "c/language/enum") [Storage duration and Linkage](language/storage_duration "c/language/storage duration") [`const`](language/const "c/language/const") - [`volatile`](language/volatile "c/language/volatile") - [`restrict`](language/restrict "c/language/restrict")(C99) [`struct`](language/struct "c/language/struct") - [`union`](language/union "c/language/union") - [Bit fields](language/bit_field "c/language/bit field") [`_Alignas`](language/_alignas "c/language/ Alignas")(C11) - [`typedef`](language/typedef "c/language/typedef") [`_Static_assert`](language/_static_assert "c/language/ Static assert")(C11) [Atomic types](language/atomic "c/language/atomic")(C11) [External and tentative definitions](language/extern "c/language/extern") [Attributes](language/attributes "c/language/attributes")(C23). **[Functions](language/functions "c/language/functions")**. [Function declaration](language/function_declaration "c/language/function declaration") [Function definition](language/function_definition "c/language/function definition") [`inline`](language/inline "c/language/inline")(C99) [`_Noreturn`](language/_noreturn "c/language/ Noreturn")(C11)(deprecated in C23) [Variadic arguments](language/variadic "c/language/variadic"). **Miscellaneous**. [History of C](language/history "c/language/history") [Conformance](language/conformance "c/language/conformance") [Inline assembly](language/asm "c/language/asm") [Signal handling](https://en.cppreference.com/mwiki/index.php?title=c/language/signal&action=edit&redlink=1 "c/language/signal (page does not exist)") [Analyzability](language/analyzability "c/language/analyzability")(C11). | ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language "cpp/language") for C++ language constructs |
programming_docs
c C17 C17 === **ISO/IEC 9899:2018**, a.k.a. **C17**/**C18** (denote the year of completion and publication respectively), is the current revision of the C standard. C17 is same as C11, except that it bumps the [`__STDC_VERSION__`](preprocessor/replace "c/preprocessor/replace") predefined macro to `201710L`, contains several defect reports, and deprecates some features. Obsolete --------- ### Deprecated * `[ATOMIC\_VAR\_INIT](atomic/atomic_var_init "c/atomic/ATOMIC VAR INIT")` * Support for calling [`realloc()`](memory/realloc "c/memory/realloc") with zero size Defect reports --------------- | Defect Reports fixed in C17 (54 defects) | | --- | | * [DR 400](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_400) * [DR 401](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_401) * [DR 402](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_402) * [DR 403](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_403) * [DR 404](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_404) * [DR 405](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_405) * [DR 406](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_406) * [DR 407](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_407) * [DR 410](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_410) * [DR 412](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_412) * [DR 414](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_414) * [DR 415](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_415) * [DR 416](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_416) * [DR 417](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_417) * [DR 419](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_419) * [DR 423](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_423) * [DR 426](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_426) * [DR 428](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_428) * [DR 429](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_429) * [DR 430](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_430) * [DR 431](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_431) * [DR 433](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_433) * [DR 434](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_434) * [DR 436](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_436) * [DR 437](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_437) * [DR 438](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_438) * [DR 439](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_439) * [DR 441](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_441) * [DR 444](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_444) * [DR 445](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_445) * [DR 447](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_447) * [DR 448](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_448) * [DR 450](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_450) * [DR 452](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_452) * [DR 453](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_453) * [DR 457](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_457) * [DR 458](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_458) * [DR 459](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_459) * [DR 460](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_460) * [DR 462](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_462) * [DR 464](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_464) * [DR 465](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_465) * [DR 468](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_468) * [DR 470](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_470) * [DR 471](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_471) * [DR 472](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_472) * [DR 473](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_473) * [DR 475](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_475) * [DR 477](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_477) * [DR 480](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_480) * [DR 481](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_481) * [DR 485](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_485) * [DR 487](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_487) * [DR 491](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_491) | c Current Status Current Status ============== **Recent milestones: C17 published, C23 underway**. C17 has been published, and work is now underway on C23. [The current schedule is in paper N2984](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2984.pdf). You can also visit [open-std.org](https://www.open-std.org/jtc1/sc22/wg14/www/documents) to get the latest C standards committee papers. Reading through those proposals, you can track the C developing trends and know how does a cool idea turned into the standard. However, those papers **ARE NOT** and also **SHOULD NOT BE TREATED AS** the standard documents. ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/current_status "cpp/current status") for Current status | c Concurrency support library Concurrency support library =========================== C includes built-in support for threads, atomic operations, mutual exclusion, condition variables, and thread-specific storages. These features are optionally provided: * if the macro constant `__STDC_NO_THREADS__` is defined by the compiler, the header `<threads.h>` and all of the names provided in it are not provided; * if the macro constant `__STDC_NO_ATOMICS__` is defined by the compiler, the header `<stdatomic.h>` and all of the names provided in it are not provided. ### Threads | Defined in header `<threads.h>` | | --- | | `thrd_t` | implementation-defined complete object type identifying a thread | | [thrd\_create](thread/thrd_create "c/thread/thrd create") (C11) | creates a thread (function) | | [thrd\_equal](thread/thrd_equal "c/thread/thrd equal") (C11) | checks if two identifiers refer to the same thread (function) | | [thrd\_current](thread/thrd_current "c/thread/thrd current") (C11) | obtains the current thread identifier (function) | | [thrd\_sleep](thread/thrd_sleep "c/thread/thrd sleep") (C11) | suspends execution of the calling thread for the given period of time (function) | | [thrd\_yield](thread/thrd_yield "c/thread/thrd yield") (C11) | yields the current time slice (function) | | [thrd\_exit](thread/thrd_exit "c/thread/thrd exit") (C11) | terminates the calling thread (function) | | [thrd\_detach](thread/thrd_detach "c/thread/thrd detach") (C11) | detaches a thread (function) | | [thrd\_join](thread/thrd_join "c/thread/thrd join") (C11) | blocks until a thread terminates (function) | | [thrd\_successthrd\_timedoutthrd\_busythrd\_nomemthrd\_error](thread/thrd_errors "c/thread/thrd errors") (C11) | indicates a thread error status (constant) | | thrd\_start\_t (C11) | a typedef of the function pointer type `int(*)(void*)`, used by `[thrd\_create](http://en.cppreference.com/w/c/thread/thrd_create)` (typedef) | ### Atomic operations | Defined in header `<stdatomic.h>` | | --- | | Operations on atomic types | | [ATOMIC\_BOOL\_LOCK\_FREEATOMIC\_CHAR\_LOCK\_FREEATOMIC\_CHAR16\_T\_LOCK\_FREEATOMIC\_CHAR32\_T\_LOCK\_FREEATOMIC\_WCHAR\_T\_LOCK\_FREEATOMIC\_SHORT\_LOCK\_FREEATOMIC\_INT\_LOCK\_FREEATOMIC\_LONG\_LOCK\_FREEATOMIC\_LLONG\_LOCK\_FREEATOMIC\_POINTER\_LOCK\_FREE](atomic/atomic_lock_free_consts "c/atomic/ATOMIC LOCK FREE consts") (C11) | indicates that the given atomic type is lock-free (macro constant) | | [atomic\_is\_lock\_free](atomic/atomic_is_lock_free "c/atomic/atomic is lock free") (C11) | indicates whether the atomic object is lock-free (function) | | [atomic\_storeatomic\_store\_explicit](atomic/atomic_store "c/atomic/atomic store") (C11) | stores a value in an atomic object (function) | | [atomic\_loadatomic\_load\_explicit](atomic/atomic_load "c/atomic/atomic load") (C11) | reads a value from an atomic object (function) | | [atomic\_exchangeatomic\_exchange\_explicit](atomic/atomic_exchange "c/atomic/atomic exchange") (C11) | swaps a value with the value of an atomic object (function) | | [atomic\_compare\_exchange\_strongatomic\_compare\_exchange\_strong\_explicitatomic\_compare\_exchange\_weakatomic\_compare\_exchange\_weak\_explicit](atomic/atomic_compare_exchange "c/atomic/atomic compare exchange") (C11) | swaps a value with an atomic object if the old value is what is expected, otherwise reads the old value (function) | | [atomic\_fetch\_addatomic\_fetch\_add\_explicit](atomic/atomic_fetch_add "c/atomic/atomic fetch add") (C11) | atomic addition (function) | | [atomic\_fetch\_subatomic\_fetch\_sub\_explicit](atomic/atomic_fetch_sub "c/atomic/atomic fetch sub") (C11) | atomic subtraction (function) | | [atomic\_fetch\_oratomic\_fetch\_or\_explicit](atomic/atomic_fetch_or "c/atomic/atomic fetch or") (C11) | atomic bitwise OR (function) | | [atomic\_fetch\_xoratomic\_fetch\_xor\_explicit](atomic/atomic_fetch_xor "c/atomic/atomic fetch xor") (C11) | atomic bitwise exclusive OR (function) | | [atomic\_fetch\_andatomic\_fetch\_and\_explicit](atomic/atomic_fetch_and "c/atomic/atomic fetch and") (C11) | atomic bitwise AND (function) | | Flag type and operations | | [atomic\_flag](atomic/atomic_flag "c/atomic/atomic flag") (C11) | lock-free atomic boolean flag (struct) | | [atomic\_flag\_test\_and\_setatomic\_flag\_test\_and\_set\_explicit](atomic/atomic_flag_test_and_set "c/atomic/atomic flag test and set") (C11) | sets an atomic\_flag to true and returns the old value (function) | | [atomic\_flag\_clearatomic\_flag\_clear\_explicit](atomic/atomic_flag_clear "c/atomic/atomic flag clear") (C11) | sets an atomic\_flag to false (function) | | Initialization | | [atomic\_init](atomic/atomic_init "c/atomic/atomic init") (C11) | initializes an existing atomic object (function) | | [ATOMIC\_VAR\_INIT](atomic/atomic_var_init "c/atomic/ATOMIC VAR INIT") (C11)(deprecated in C17)(removed in C23) | initializes a new atomic object (function macro) | | [ATOMIC\_FLAG\_INIT](atomic/atomic_flag_init "c/atomic/ATOMIC FLAG INIT") (C11) | initializes a new `[atomic\_flag](http://en.cppreference.com/w/c/atomic/atomic_flag)` (macro constant) | | Memory synchronization ordering | | [memory\_order](atomic/memory_order "c/atomic/memory order") (C11) | defines memory ordering constraints (enum) | | [kill\_dependency](atomic/kill_dependency "c/atomic/kill dependency") (C11) | breaks a dependency chain for `[memory\_order\_consume](http://en.cppreference.com/w/c/atomic/memory_order)` (function macro) | | [atomic\_thread\_fence](atomic/atomic_thread_fence "c/atomic/atomic thread fence") (C11) | generic memory order-dependent fence synchronization primitive (function) | | [atomic\_signal\_fence](atomic/atomic_signal_fence "c/atomic/atomic signal fence") (C11) | fence between a thread and a signal handler executed in the same thread (function) | | Convenience type aliases | | Typedef name | Full type name | | `atomic_bool`(C11) | `_Atomic _Bool` | | `atomic_char`(C11) | `_Atomic char` | | `atomic_schar`(C11) | `_Atomic signed char` | | `atomic_uchar`(C11) | `_Atomic unsigned char` | | `atomic_short`(C11) | `_Atomic short` | | `atomic_ushort`(C11) | `_Atomic unsigned short` | | `atomic_int`(C11) | `_Atomic int` | | `atomic_uint`(C11) | `_Atomic unsigned int` | | `atomic_long`(C11) | `_Atomic long` | | `atomic_ulong`(C11) | `_Atomic unsigned long` | | `atomic_llong`(C11) | `_Atomic long long` | | `atomic_ullong`(C11) | `_Atomic unsigned long long` | | `atomic_char8_t`(C23) | `_Atomic char8_t` | | `atomic_char16_t`(C11) | `_Atomic char16_t` | | `atomic_char32_t`(C11) | `_Atomic char32_t` | | `atomic_wchar_t`(C11) | `_Atomic wchar_t` | | `atomic_int_least8_t`(C11) | `_Atomic [int\_least8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least8_t`(C11) | `_Atomic [uint\_least8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_least16_t`(C11) | `_Atomic [int\_least16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least16_t`(C11) | `_Atomic [uint\_least16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_least32_t`(C11) | `_Atomic [int\_least32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least32_t`(C11) | `_Atomic [uint\_least32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_least64_t`(C11) | `_Atomic [int\_least64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_least64_t`(C11) | `_Atomic [uint\_least64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast8_t`(C11) | `_Atomic [int\_fast8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast8_t`(C11) | `_Atomic [uint\_fast8\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast16_t`(C11) | `_Atomic [int\_fast16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast16_t`(C11) | `_Atomic [uint\_fast16\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast32_t`(C11) | `_Atomic [int\_fast32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast32_t`(C11) | `_Atomic [uint\_fast32\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_int_fast64_t`(C11) | `_Atomic [int\_fast64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uint_fast64_t`(C11) | `_Atomic [uint\_fast64\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_intptr_t`(C11) | `_Atomic [intptr\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uintptr_t`(C11) | `_Atomic [uintptr\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_size_t`(C11) | `_Atomic [size\_t](http://en.cppreference.com/w/c/types/size_t)` | | `atomic_ptrdiff_t`(C11) | `_Atomic [ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | | `atomic_intmax_t`(C11) | `_Atomic [intmax\_t](http://en.cppreference.com/w/c/types/integer)` | | `atomic_uintmax_t`(C11) | `_Atomic [uintmax\_t](http://en.cppreference.com/w/c/types/integer)` | ### Mutual exclusion | Defined in header `<threads.h>` | | --- | | `mtx_t` | mutex identifier | | [mtx\_init](thread/mtx_init "c/thread/mtx init") (C11) | creates a mutex (function) | | [mtx\_lock](thread/mtx_lock "c/thread/mtx lock") (C11) | blocks until locks a mutex (function) | | [mtx\_timedlock](thread/mtx_timedlock "c/thread/mtx timedlock") (C11) | blocks until locks a mutex or times out (function) | | [mtx\_trylock](thread/mtx_trylock "c/thread/mtx trylock") (C11) | locks a mutex or returns without blocking if already locked (function) | | [mtx\_unlock](thread/mtx_unlock "c/thread/mtx unlock") (C11) | unlocks a mutex (function) | | [mtx\_destroy](thread/mtx_destroy "c/thread/mtx destroy") (C11) | destroys a mutex (function) | | [mtx\_plainmtx\_recursivemtx\_timed](thread/mtx_types "c/thread/mtx types") (C11)(C11)(C11) | defines the type of a mutex (enum) | | Call once | | [call\_once](thread/call_once "c/thread/call once") (C11) | calls a function exactly once (function) | ### Condition variables | Defined in header `<threads.h>` | | --- | | `cnd_t` | condition variable identifier | | [cnd\_init](thread/cnd_init "c/thread/cnd init") (C11) | creates a condition variable (function) | | [cnd\_signal](thread/cnd_signal "c/thread/cnd signal") (C11) | unblocks one thread blocked on a condition variable (function) | | [cnd\_broadcast](thread/cnd_broadcast "c/thread/cnd broadcast") (C11) | unblocks all threads blocked on a condition variable (function) | | [cnd\_wait](thread/cnd_wait "c/thread/cnd wait") (C11) | blocks on a condition variable (function) | | [cnd\_timedwait](thread/cnd_timedwait "c/thread/cnd timedwait") (C11) | blocks on a condition variable, with a timeout (function) | | [cnd\_destroy](thread/cnd_destroy "c/thread/cnd destroy") (C11) | destroys a condition variable (function) | ### Thread-local storage | Defined in header `<threads.h>` | | --- | | [thread\_local](thread/thread_local "c/thread/thread local") (C11) | thread local type macro (keyword macro) | | `tss_t` | thread-specific storage pointer | | [TSS\_DTOR\_ITERATIONS](thread/tss_dtor_iterations "c/thread/TSS DTOR ITERATIONS") (C11) | maximum number of times destructors are called (macro constant) | | `tss_dtor_t` | function pointer type `void(*)(void*)`, used for TSS destructor | | [tss\_create](thread/tss_create "c/thread/tss create") (C11) | creates thread-specific storage pointer with a given destructor (function) | | [tss\_get](thread/tss_get "c/thread/tss get") (C11) | reads from thread-specific storage (function) | | [tss\_set](thread/tss_set "c/thread/tss set") (C11) | write to thread-specific storage (function) | | [tss\_delete](thread/tss_delete "c/thread/tss delete") (C11) | releases the resources held by a given thread-specific pointer (function) | ### Reserved identifiers In future revisions of the C standard: * function names, type names, and enumeration constants that begin with either `cnd_`, `mtx_`, `thrd_`, or `tss_`, and a lowercase letter may be added to the declarations in the `<threads.h>` header; * macros that begin with `ATOMIC_` and an uppercase letter may be added to the macros defined in the `<stdatomic.h>` header; * typedef names that begin with either `atomic_` or `memory_`, and a lowercase letter may be added to the declarations in the `<stdatomic.h>` header; * enumeration constants that begin with `memory_order_` and a lowercase letter may be added to the definition of the `[memory\_order](atomic/memory_order "c/atomic/memory order")` type in the `<stdatomic.h>` header; * function names that begin with `atomic_` and a lowercase letter may be added to the declarations in the `<stdatomic.h>` header. Identifiers reserved for functions names are always potentially (since C23) reserved for use as identifiers with external linkage, while other identifiers list here are potentially (since C23) reserved when `<stdatomic.h>` is included. Declaring, defining, or `#undef`ing such an identifier results in undefined behavior if it is provided by the standard or implementation (since C23). Portable programs should not use those identifiers. ### References * C17 standard (ISO/IEC 9899:2018): + 7.17 Atomics <stdatomic.h> (p: 200-209) + 7.26 Threads <threads.h> (p: 274-283) + 7.31.8 Atomics <stdatomic.h> (p: 332) + 7.31.15 Threads <threads.h> (p: 333) * C11 standard (ISO/IEC 9899:2011): + 7.17 Atomics <stdatomic.h> (p: 273-286) + 7.26 Threads <threads.h> (p: 376-387) + 7.31.8 Atomics <stdatomic.h> (p: 455-456) + 7.31.15 Threads <threads.h> (p: 456) ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/thread "cpp/thread") for Concurrency support library | | [GNU GCC Libc Manual: ISO-C-Mutexes](https://www.gnu.org/software/libc/manual/html_node/ISO-C-Mutexes.html) | c Variadic functions Variadic functions ================== Variadic functions are functions (e.g. `[printf](io/fprintf "c/io/fprintf")`) which take a variable number of arguments. The declaration of a variadic function uses an ellipsis as the last parameter, e.g. `int [printf](http://en.cppreference.com/w/c/io/fprintf)(const char\* format, ...);`. See [variadic arguments](language/variadic "c/language/variadic") for additional detail on the syntax and automatic argument conversions. Accessing the variadic arguments from the function body uses the following library facilities: | | | --- | | Macros | | Defined in header `<stdarg.h>` | | [va\_start](variadic/va_start "c/variadic/va start") | enables access to variadic function arguments (function macro) | | [va\_arg](variadic/va_arg "c/variadic/va arg") | accesses the next variadic function argument (function macro) | | [va\_copy](variadic/va_copy "c/variadic/va copy") (C99) | makes a copy of the variadic function arguments (function macro) | | [va\_end](variadic/va_end "c/variadic/va end") | ends traversal of the variadic function arguments (function macro) | | Type | | [va\_list](variadic/va_list "c/variadic/va list") | holds the information needed by va\_start, va\_arg, va\_end, and va\_copy (typedef) | ### Example Print values of different types. ``` #include <stdio.h> #include <stdarg.h> void simple_printf(const char* fmt, ...) { va_list args; va_start(args, fmt); while (*fmt != '\0') { if (*fmt == 'd') { int i = va_arg(args, int); printf("%d\n", i); } else if (*fmt == 'c') { // A 'char' variable will be promoted to 'int' // A character literal in C is already 'int' by itself int c = va_arg(args, int); printf("%c\n", c); } else if (*fmt == 'f') { double d = va_arg(args, double); printf("%f\n", d); } ++fmt; } va_end(args); } int main(void) { simple_printf("dcff", 3, 'a', 1.999, 42.5); } ``` Output: ``` 3 a 1.999000 42.50000 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.16 Variable arguments <stdarg.h> (p: 269-272) * C99 standard (ISO/IEC 9899:1999): + 7.15 Variable arguments <stdarg.h> (p: 249-252) * C89/C90 standard (ISO/IEC 9899:1990): + 4.8 VARIABLE ARGUMENTS <stdarg.h> ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/variadic "cpp/utility/variadic") for Variadic functions |
programming_docs
c Error handling Error handling ============== ### Error numbers | Defined in header `<errno.h>` | | --- | | [errno](error/errno "c/error/errno") | macro which expands to POSIX-compatible thread-local error number variable(macro variable) | | [E2BIG, EACCES, ..., EXDEV](error/errno_macros "c/error/errno macros") | macros for standard POSIX-compatible error conditions (macro constant) | ### Assertions | Defined in header `<assert.h>` | | --- | | [assert](error/assert "c/error/assert") | aborts the program if the user-specified condition is not `true`. May be disabled for release builds (function macro) | | [static\_assert](error/static_assert "c/error/static assert") (C11) | issues a compile-time diagnostic if the value of a constant expression is false (keyword macro) | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | Bounds checking The standard library provides bounds-checked versions of some existing functions (`[gets\_s](io/gets "c/io/gets")`, `[fopen\_s](io/fopen "c/io/fopen")`, `[printf\_s](io/fprintf "c/io/fprintf")`, `[strcpy\_s](string/byte/strcpy "c/string/byte/strcpy")`, `[wcscpy\_s](string/wide/wcscpy "c/string/wide/wcscpy")`, `[mbstowcs\_s](string/multibyte/mbstowcs "c/string/multibyte/mbstowcs")`, `[qsort\_s](algorithm/qsort "c/algorithm/qsort")`, `[getenv\_s](program/getenv "c/program/getenv")`, etc). This functionality is *optional* and is only available if `__STDC_LIB_EXT1__` is defined. The following macros and functions support this functionality. | Defined in header `<errno.h>` | | --- | | Defined in header `<stdio.h>` | | errno\_t (C11) | a typedef for the type `int`, used to self-document functions that return `[errno](error/errno "c/error/errno")` values (typedef) | | Defined in header `<stddef.h>` | | Defined in header `<stdio.h>` | | Defined in header `<stdlib.h>` | | Defined in header `<string.h>` | | Defined in header `<time.h>` | | Defined in header `<wchar.h>` | | rsize\_t (C11) | a typedef for the same type as `[size\_t](types/size_t "c/types/size t")`, used to self-document functions that range-check their parameters at runtime (typedef) | | Defined in header `<stdint.h>` | | RSIZE\_MAX (C11) | largest acceptable size for bounds-checked functions, expands to either constant or variable which may change at runtime (e.g. as the currently allocated memory size changes)(macro variable) | | Defined in header `<stdlib.h>` | | [set\_constraint\_handler\_s](error/set_constraint_handler_s "c/error/set constraint handler s") (C11) | set the error callback for bounds-checked functions (function) | | [abort\_handler\_s](error/abort_handler_s "c/error/abort handler s") (C11) | abort callback for the bounds-checked functions (function) | | [ignore\_handler\_s](error/ignore_handler_s "c/error/ignore handler s") (C11) | ignore callback for the bounds-checked functions (function) | Note: implementations of bounds-checked functions are available as open-source libraries [Safe C](https://github.com/rurban/safeclib/) and [Slibc](https://code.google.com/archive/p/slibc/), and as part of Watcom C. There is also an incompatible set of bounds-checked functions available in Visual Studio. | (since C11) | ### References * C11 standard (ISO/IEC 9899:2011): + 7.2 Diagnostics <assert.h> (p: 186-187) + 7.5 Errors <errno.h> (p: 205) + 7.19 Common definitions <stddef.h> (p: 288) + 7.20 Integer types <stdint.h> (p: 289-295) + 7.21 Input/output <stdio.h> (p: 296-339) + 7.22 General utilities <stdlib.h> (p: 340-360) + K.3.1.3 Use of errno (p: 584) + K.3.2/2 errno\_t (p: 585) + K.3.3/2 rsize\_t (p: 585) + K.3.4/2 RSIZE\_MAX (p: 585) + 7.31.3 Errors <errno.h> (p: 455) + 7.31.10 Integer types <stdint.h> (p: 456) + 7.31.11 Input/output <stdio.h> (p: 456) + 7.31.12 General utilities <stdlib.h> (p: 456) * C99 standard (ISO/IEC 9899:1999): + 7.2 Diagnostics <assert.h> (p: 169) + 7.5 Errors <errno.h> (p: 186) + 7.26.3 Errors <errno.h> (p: 401) + 7.26.8 Integer types <stdint.h> (p: 401) + 7.26.9 Input/output <stdio.h> (p: 402) + 7.26.10 General utilities <stdlib.h> (p: 402) * C89/C90 standard (ISO/IEC 9899:1990): + 4.2 DIAGNOSTICS <assert.h> + 4.1.3 Errors <errno.h> + 4.13.1 Errors <errno.h> + 4.13.6 Input/output <stdio.h> + 4.13.7 General utilities <stdlib.h> ### See also | | | | --- | --- | | [math\_errhandlingMATH\_ERRNOMATH\_ERREXCEPT](numeric/math/math_errhandling "c/numeric/math/math errhandling") (C99)(C99)(C99) | defines the error handling mechanism used by the common mathematical functions (macro constant) | | [C++ documentation](https://en.cppreference.com/w/cpp/error "cpp/error") for `Error handling` | c Preprocessor Preprocessor ============ The preprocessor is executed at [translation phase 4](language/translation_phases "c/language/translation phases"), before the compilation. The result of preprocessing is a single file which is then passed to the actual compiler. ### Directives The preprocessing directives control the behavior of the preprocessor. Each directive occupies one line and has the following format: * `#` character * preprocessing instruction (one of `define`, `undef`, `include`, `if`, `ifdef`, `ifndef`, `else`, `elif`, `elifdef`, `elifndef` (since C23), `endif`, `line`, `embed` (since C23), `error`, `warning` (since C23), `pragma`) [[1]](#cite_note-1) * arguments (depends on the instruction) * line break The null directive (`#` followed by a line break) is allowed and has no effect. ### Capabilities The preprocessor has the source file translation capabilities: * **[conditionally](preprocessor/conditional "c/preprocessor/conditional")** compile of parts of source file (controlled by directive `#if`, `#ifdef`, `#ifndef`, `#else`, `#elif`, `#elifdef`, `#elifndef` (since C23) and `#endif`). * **[replace](preprocessor/replace "c/preprocessor/replace")** text macros while possibly concatenating or quoting identifiers (controlled by directives `#define` and `#undef`, and operators `#` and `##`) * **[include](preprocessor/include "c/preprocessor/include")** other files (controlled by directive `#include`) * cause an **[error](preprocessor/error "c/preprocessor/error")** or **[warning](preprocessor/error "c/preprocessor/error")** (since C23) (controlled by directive `#error` or `#warning` respectively (since C23)) The following aspects of the preprocessor can be controlled: * **[implementation defined](preprocessor/impl "c/preprocessor/impl")** behavior (controlled by directive `#pragma` and operator `_Pragma` (since C99)) * **[file name and line information](preprocessor/line "c/preprocessor/line")** available to the preprocessor (controlled by directives `#line`) ### Footnotes 1. These are the directives defined by the standard. The standard does not define behavior for other directives: they might be ignored, have some useful meaning, or make the program ill-formed. Even if otherwise ignored, they are removed from the source code when the preprocessor is done. A common non-standard extension is the directive `#warning` which emits a user-defined message during compilation. (until C23) ### References * C17 standard (ISO/IEC 9899:2018): + 6.10 Preprocessing directives (p: 117-129) * C11 standard (ISO/IEC 9899:2011): + 6.10 Preprocessing directives (p: 160-178) * C99 standard (ISO/IEC 9899:1999): + 6.10 Preprocessing directives (p: 145-162) * C89/C90 standard (ISO/IEC 9899:1990): + 3.8 PREPROCESSING DIRECTIVES ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/preprocessor "cpp/preprocessor") for Preprocessor | c C keywords C keywords ========== This is a list of reserved keywords in C. Since they are used by the language, these keywords are not available for re-definition. | | | | | | --- | --- | --- | --- | | [`auto`](keyword/auto "c/keyword/auto") [`break`](keyword/break "c/keyword/break") [`case`](keyword/case "c/keyword/case") [`char`](keyword/char "c/keyword/char") [`const`](keyword/const "c/keyword/const") [`continue`](keyword/continue "c/keyword/continue") [`default`](keyword/default "c/keyword/default") [`do`](keyword/do "c/keyword/do") [`double`](keyword/double "c/keyword/double") [`else`](keyword/else "c/keyword/else") [`enum`](keyword/enum "c/keyword/enum") [`extern`](keyword/extern "c/keyword/extern"). | [`float`](keyword/float "c/keyword/float") [`for`](keyword/for "c/keyword/for") [`goto`](keyword/goto "c/keyword/goto") [`if`](keyword/if "c/keyword/if") [`inline`](keyword/inline "c/keyword/inline") (C99) [`int`](keyword/int "c/keyword/int") [`long`](keyword/long "c/keyword/long") [`register`](keyword/register "c/keyword/register") [`restrict`](keyword/restrict "c/keyword/restrict") (C99) [`return`](keyword/return "c/keyword/return") [`short`](keyword/short "c/keyword/short"). | [`signed`](keyword/signed "c/keyword/signed") [`sizeof`](keyword/sizeof "c/keyword/sizeof") [`static`](keyword/static "c/keyword/static") [`struct`](keyword/struct "c/keyword/struct") [`switch`](keyword/switch "c/keyword/switch") [`typedef`](keyword/typedef "c/keyword/typedef") [`union`](keyword/union "c/keyword/union") [`unsigned`](keyword/unsigned "c/keyword/unsigned") [`void`](keyword/void "c/keyword/void") [`volatile`](keyword/volatile "c/keyword/volatile") [`while`](keyword/while "c/keyword/while"). | [`_Alignas`](keyword/_alignas "c/keyword/ Alignas") (C11) [`_Alignof`](keyword/_alignof "c/keyword/ Alignof") (C11) [`_Atomic`](keyword/_atomic "c/keyword/ Atomic") (C11) [`_Bool`](keyword/_bool "c/keyword/ Bool") (C99) [`_Complex`](keyword/_complex "c/keyword/ Complex") (C99) [`_Decimal128`](keyword/_decimal128 "c/keyword/ Decimal128") (C23) [`_Decimal32`](keyword/_decimal32 "c/keyword/ Decimal32") (C23) [`_Decimal64`](keyword/_decimal64 "c/keyword/ Decimal64") (C23) [`_Generic`](keyword/_generic "c/keyword/ Generic") (C11) [`_Imaginary`](keyword/_imaginary "c/keyword/ Imaginary") (C99) [`_Noreturn`](keyword/_noreturn "c/keyword/ Noreturn") (C11) [`_Static_assert`](keyword/_static_assert "c/keyword/ Static assert") (C11) [`_Thread_local`](keyword/_thread_local "c/keyword/ Thread local") (C11). | The most common keywords that begin with an underscore are generally used through their convenience macros: | | | | | --- | --- | --- | | keyword | used as | defined in | | [`_Alignas`](keyword/_alignas "c/keyword/ Alignas") (C11) | [`alignas`](types "c/types") | `stdalign.h` | | [`_Alignof`](keyword/_alignof "c/keyword/ Alignof") (C11) | [`alignof`](types "c/types") | `stdalign.h` | | [`_Atomic`](keyword/_atomic "c/keyword/ Atomic") (C11) | [`atomic_bool, atomic_int, ...`](thread "c/thread") | `stdatomic.h` | | [`_Bool`](keyword/_bool "c/keyword/ Bool") (C99) | [`bool`](types "c/types") | `stdbool.h` | | [`_Complex`](keyword/_complex "c/keyword/ Complex") (C99) | [`complex`](numeric/complex/complex "c/numeric/complex/complex") | `complex.h` | | [`_Decimal128`](keyword/_decimal128 "c/keyword/ Decimal128") (C23) | (no macro) | | | [`_Decimal32`](keyword/_decimal32 "c/keyword/ Decimal32") (C23) | (no macro) | | | [`_Decimal64`](keyword/_decimal64 "c/keyword/ Decimal64") (C23) | (no macro) | | | [`_Generic`](keyword/_generic "c/keyword/ Generic") (C11) | (no macro) | | | [`_Imaginary`](keyword/_imaginary "c/keyword/ Imaginary") (C99) | [`imaginary`](numeric/complex/imaginary "c/numeric/complex/imaginary") | `complex.h` | | [`_Noreturn`](keyword/_noreturn "c/keyword/ Noreturn") (C11) | [`noreturn`](types "c/types") | `stdnoreturn.h` | | [`_Static_assert`](keyword/_static_assert "c/keyword/ Static assert") (C11) | [`static_assert`](error/static_assert "c/error/static assert") | `assert.h` | | [`_Thread_local`](keyword/_thread_local "c/keyword/ Thread local") (C11) | [`thread_local`](thread/thread_local "c/thread/thread local") | `threads.h` | Also, each name that begins with a double underscore \_\_ or an underscore followed by an uppercase letter is reserved: see [identifier](language/identifier#Reserved_identifiers "c/language/identifier") for details. Note that digraphs `<%`, `%>`, `<:`, `:>`, `%:`, and `%:%:` provide an [alternative way to represent standard tokens](language/operator_alternative "c/language/operator alternative"). The following tokens are recognized by the [preprocessor](preprocessor "c/preprocessor") when they are used *within* the context of a preprocessor directive: | | | | | | --- | --- | --- | --- | | [`if`](preprocessor/conditional "c/preprocessor/conditional") [`elif`](preprocessor/conditional "c/preprocessor/conditional") [`else`](preprocessor/conditional "c/preprocessor/conditional") [`endif`](preprocessor/conditional "c/preprocessor/conditional"). | [`ifdef`](preprocessor/conditional "c/preprocessor/conditional") [`ifndef`](preprocessor/conditional "c/preprocessor/conditional") [`elifdef`](preprocessor/conditional "c/preprocessor/conditional") (C23) [`elifndef`](preprocessor/conditional "c/preprocessor/conditional") (C23) [`define`](preprocessor/replace "c/preprocessor/replace") [`undef`](preprocessor/replace "c/preprocessor/replace"). | [`include`](preprocessor/include "c/preprocessor/include") [`line`](preprocessor/line "c/preprocessor/line") [`error`](preprocessor/error "c/preprocessor/error") [`warning`](preprocessor/error "c/preprocessor/error") (C23) [`pragma`](preprocessor/impl "c/preprocessor/impl"). | [`defined`](preprocessor/conditional "c/preprocessor/conditional") [`__has_c_attribute`](language/attributes#Attribute_testing "c/language/attributes") (C23). | The following tokens are recognized by the preprocessor when they are used *outside* the context of a preprocessor directive: | | | --- | | [`_Pragma`](preprocessor/impl "c/preprocessor/impl") (C99). | The following additional keywords are classified as extensions and conditionally-supported: | | | --- | | [`asm`](language/asm "c/language/asm") [`fortran`](keyword/fortran "c/keyword/fortran"). | ### References * C17 standard (ISO/IEC 9899:2018): + 6.4.1 Keywords (p: 42-43) + J.5.9 The fortran keyword (p: 422) + J.5.10 The asm keyword (p: 422) * C11 standard (ISO/IEC 9899:2011): + 6.4.1 Keywords (p: 58-59) + J.5.9 The fortran keyword (p: 580) + J.5.10 The asm keyword (p: 580) * C99 standard (ISO/IEC 9899:1999): + 6.4.1 Keywords (p: 50) + J.5.9 The fortran keyword (p: 514) + J.5.10 The asm keyword (p: 514) * C89/C90 standard (ISO/IEC 9899:1990): + 3.1.1 Keywords + G.5.9 The fortran keyword + G.5.10 The asm keyword ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/keyword "cpp/keyword") for C++ keywords | c Fixed width integer types (since C99) Fixed width integer types (since C99) ===================================== ### Types | Defined in header `<stdint.h>` | | --- | | int8\_tint16\_tint32\_tint64\_t (optional) | signed integer type with width of exactly 8, 16, 32 and 64 bits respectivelywith no padding bits and using 2's complement for negative values(provided if and only if the implementation directly supports the type) (typedef) | | int\_fast8\_tint\_fast16\_tint\_fast32\_tint\_fast64\_t | fastest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) | | int\_least8\_tint\_least16\_tint\_least32\_tint\_least64\_t | smallest signed integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) | | intmax\_t | maximum-width signed integer type (typedef) | | intptr\_t (optional) | signed integer type capable of holding a pointer to `void` (typedef) | | uint8\_tuint16\_tuint32\_tuint64\_t (optional) | unsigned integer type with width of exactly 8, 16, 32 and 64 bits respectively (provided if and only if the implementation directly supports the type) (typedef) | | uint\_fast8\_tuint\_fast16\_tuint\_fast32\_tuint\_fast64\_t | fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) | | uint\_least8\_tuint\_least16\_tuint\_least32\_tuint\_least64\_t | smallest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively (typedef) | | uintmax\_t | maximum-width unsigned integer type (typedef) | | uintptr\_t (optional) | unsigned integer type capable of holding a pointer to `void` (typedef) | The implementation may define typedef names `int*N*_t`, `int_fast*N*_t`, `int_least*N*_t`, `uint*N*_t`, `uint_fast*N*_t`, and `uint_least*N*_t` when *N* is not 8, 16, 32 or 64. Typedef names of the form `int*N*_t` may only be defined if the implementation supports an integer type of that width with no padding. Thus, `uint24_t` denotes an unsigned integer type with a width of exactly 24 bits. Each of the macros listed in below is defined if and only if the implementation defines the corresponding typedef name. The macros `INT*N*_C` and `UINT*N*_C` correspond to the typedef names `int_least*N*_t` and `uint_least*N*_t`, respectively. ### Macro constants | Defined in header `<stdint.h>` | | --- | | Signed integers : width | | INT8\_WIDTHINT16\_WIDTHINT32\_WIDTHINT64\_WIDTH (C23)(optional) | bit width of an object of type `int8_t`, `int16_t`, `int32_t`, `int64_t` (exactly 8, 16, 32, 64) (macro constant) | | INT\_FAST8\_WIDTHINT\_FAST16\_WIDTHINT\_FAST32\_WIDTHINT\_FAST64\_WIDTH (C23) | bit width of an object of type `int_fast8_t`, `int_fast16_t`, `int_fast32_t`, `int_fast64_t` (macro constant) | | INT\_LEAST8\_WIDTHINT\_LEAST16\_WIDTHINT\_LEAST32\_WIDTHINT\_LEAST64\_WIDTH (C23) | bit width of an object of type `int_least8_t`, `int_least16_t`, `int_least32_t`, `int_least64_t` (macro constant) | | INTPTR\_WIDTH (C23)(optional) | bit width of an object of type `intptr_t` (macro constant) | | INTMAX\_WIDTH (C23) | bit width of an object of type `intmax_t` (macro constant) | | Signed integers : minimum value | | INT8\_MININT16\_MININT32\_MININT64\_MIN (optional) | minimum value of an object of type `int8_t`, `int16_t`, `int32_t`, `int64_t` (macro constant) | | INT\_FAST8\_MININT\_FAST16\_MININT\_FAST32\_MININT\_FAST64\_MIN | minimum value of an object of type `int_fast8_t`, `int_fast16_t`, `int_fast32_t`, `int_fast64_t` (macro constant) | | INT\_LEAST8\_MININT\_LEAST16\_MININT\_LEAST32\_MININT\_LEAST64\_MIN | minimum value of an object of type `int_least8_t`, `int_least16_t`, `int_least32_t`, `int_least64_t` (macro constant) | | INTPTR\_MIN (optional) | minimum value of an object of type `intptr_t` (macro constant) | | INTMAX\_MIN | minimum value of an object of type `intmax_t` (macro constant) | | Signed integers : maximum value | | INT8\_MAXINT16\_MAXINT32\_MAXINT64\_MAX (optional) | maximum value of an object of type `int8_t`, `int16_t`, `int32_t`, `int64_t` (macro constant) | | INT\_FAST8\_MAXINT\_FAST16\_MAXINT\_FAST32\_MAXINT\_FAST64\_MAX | maximum value of an object of type `int_fast8_t`, `int_fast16_t`, `int_fast32_t`, `int_fast64_t` (macro constant) | | INT\_LEAST8\_MAXINT\_LEAST16\_MAXINT\_LEAST32\_MAXINT\_LEAST64\_MAX | maximum value of an object of type `int_least8_t`, `int_least16_t`, `int_least32_t`, `int_least64_t` (macro constant) | | INTPTR\_MAX (optional) | maximum value of an object of type `intptr_t` (macro constant) | | INTMAX\_MAX | maximum value of an object of type `intmax_t` (macro constant) | | Unsigned integers : width | | UINT8\_WIDTHUINT16\_WIDTHUINT32\_WIDTHUINT64\_WIDTH (C23)(optional) | bit width of an object of type `uint8_t`, `uint16_t`, `uint32_t`, `uint64_t` (exactly 8, 16, 32, 64) (macro constant) | | UINT\_FAST8\_WIDTHUINT\_FAST16\_WIDTHUINT\_FAST32\_WIDTHUINT\_FAST64\_WIDTH (C23) | bit width of an object of type `uint_fast8_t`, `uint_fast16_t`, `uint_fast32_t`, `uint_fast64_t` (macro constant) | | UINT\_LEAST8\_WIDTHUINT\_LEAST16\_WIDTHUINT\_LEAST32\_WIDTHUINT\_LEAST64\_WIDTH (C23) | bit width of an object of type `uint_least8_t`, `uint_least16_t`, `uint_least32_t`, `uint_least64_t` (macro constant) | | UINTPTR\_WIDTH (C23)(optional) | bit width of an object of type `uintptr_t` (macro constant) | | UINTMAX\_WIDTH (C23) | bit width of an object of type `uintmax_t` (macro constant) | | Unsigned integers : maximum value | | UINT8\_MAXUINT16\_MAXUINT32\_MAXUINT64\_MAX (optional) | maximum value of an object of type `uint8_t`, `uint16_t`, `uint32_t`, `uint64_t` (macro constant) | | UINT\_FAST8\_MAXUINT\_FAST16\_MAXUINT\_FAST32\_MAXUINT\_FAST64\_MAX | maximum value of an object of type `uint_fast8_t`, `uint_fast16_t`, `uint_fast32_t`, `uint_fast64_t` (macro constant) | | UINT\_LEAST8\_MAXUINT\_LEAST16\_MAXUINT\_LEAST32\_MAXUINT\_LEAST64\_MAX | maximum value of an object of type `uint_least8_t`, `uint_least16_t`, `uint_least32_t`, `uint_least64_t` (macro constant) | | UINTPTR\_MAX (optional) | maximum value of an object of type `uintptr_t` (macro constant) | | UINTMAX\_MAX | maximum value of an object of type `uintmax_t` (macro constant) | ### Function macros for minimum-width integer constants | Defined in header `<stdint.h>` | | --- | | INT8\_CINT16\_CINT32\_CINT64\_C | expands to an integer constant expression having the value specified by its argument and whose type is the [promoted](https://en.cppreference.com/w/cpp/language/implicit_conversion#Integral_promotion "cpp/language/implicit conversion") type of `int_least8_t`, `int_least16_t`, `int_least32_t`, `int_least64_t` respectively (function macro) | | INTMAX\_C | expands to an integer constant expression having the value specified by its argument and the type `intmax_t` (function macro) | | UINT8\_CUINT16\_CUINT32\_CUINT64\_C | expands to an integer constant expression having the value specified by its argument and whose type is the [promoted](https://en.cppreference.com/w/cpp/language/implicit_conversion#Integral_promotion "cpp/language/implicit conversion") type of `uint_least8_t`, `uint_least16_t`, `uint_least32_t`, `uint_least64_t` respectively (function macro) | | UINTMAX\_C | expands to an integer constant expression having the value specified by its argument and the type `uintmax_t` (function macro) | ``` #include <stdint.h> UINT64_C(0x123) // might expand to 0x123ULL or 0x123UL ``` ### Format macro constants | Defined in header `<inttypes.h>` | | --- | #### Format constants for the `[fprintf](../io/fprintf "c/io/fprintf")` family of functions Each of the `PRI` macros listed here is defined if and only if the implementation defines the corresponding typedef name. | Equivalentfor `int` or`unsigned int` | Description | Macros for data types | | --- | --- | --- | | `[u]intx_t` | `[u]int_leastx_t` | `[u]int_fastx_t` | `[u]intmax_t` | `[u]intptr_t` | | `d` | output of a signed decimal integer value | PRId**x** | PRIdLEAST**x** | PRIdFAST**x** | PRIdMAX | PRIdPTR | | `i` | PRIi**x** | PRIiLEAST**x** | PRIiFAST**x** | PRIiMAX | PRIiPTR | | `u` | output of an unsigned decimal integer value | PRIu**x** | PRIuLEAST**x** | PRIuFAST**x** | PRIuMAX | PRIuPTR | | `o` | output of an unsigned octal integer value | PRIo**x** | PRIoLEAST**x** | PRIoFAST**x** | PRIoMAX | PRIoPTR | | `x` | output of an unsigned lowercase hexadecimal integer value | PRIx**x** | PRIxLEAST**x** | PRIxFAST**x** | PRIxMAX | PRIxPTR | | `X` | output of an unsigned uppercase hexadecimal integer value | PRIX**x** | PRIXLEAST**x** | PRIXFAST**x** | PRIXMAX | PRIXPTR | #### Format constants for the `[fscanf](../io/fscanf "c/io/fscanf")` family of functions Each of the `SCN` macros listed in here is defined if and only if the implementation defines the corresponding typedef name and has a suitable `[fscanf](../io/fscanf "c/io/fscanf")` length modifier for the type. | Equivalentfor `int` or`unsigned int` | Description | Macros for data types | | --- | --- | --- | | `[u]intx_t` | `[u]int_leastx_t` | `[u]int_fastx_t` | `[u]intmax_t` | `[u]intptr_t` | | `d` | input of a signed decimal integer value | SCNd**x** | SCNdLEAST**x** | SCNdFAST**x** | SCNdMAX | SCNdPTR | | `i` | input of a signed integer value (base is determined by the first characters parsed) | SCNi**x** | SCNiLEAST**x** | SCNiFAST**x** | SCNiMAX | SCNiPTR | | `u` | input of an unsigned decimal integer value | SCNu**x** | SCNuLEAST**x** | SCNuFAST**x** | SCNuMAX | SCNuPTR | | `o` | input of an unsigned octal integer value | SCNo**x** | SCNoLEAST**x** | SCNoFAST**x** | SCNoMAX | SCNoPTR | | `x` | input of an unsigned hexadecimal integer value | SCNx**x** | SCNxLEAST**x** | SCNxFAST**x** | SCNxMAX | SCNxPTR | ### Example ``` #include <stdio.h> #include <inttypes.h> int main(void) { printf("%zu\n", sizeof(int64_t)); printf("%s\n", PRId64); printf("%+"PRId64"\n", INT64_MIN); printf("%+"PRId64"\n", INT64_MAX); int64_t n = 7; printf("%+"PRId64"\n", n); } ``` Possible output: ``` 8 lld -9223372036854775808 +9223372036854775807 +7 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.8.1 Macros for format specifiers (p: 158-159) + 7.18 Integer types <stdint.h> (p: 212-216) * C11 standard (ISO/IEC 9899:2011): + 7.8.1 Macros for format specifiers (p: 217-218) + 7.18 Integer types <stdint.h> (p: 289-295) * C99 standard (ISO/IEC 9899:1999): + 7.8.1 Macros for format specifiers (p: 198-199) + 7.18 Integer types <stdint.h> (p: 255-261) ### See also * [Arithmetic types](../language/arithmetic_types "c/language/arithmetic types") | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/types/integer "cpp/types/integer") for Fixed width integer types |
programming_docs
c size_t size\_t ======= | Defined in header `<stddef.h>` | | | | --- | --- | --- | | Defined in header `<stdio.h>` | | | | Defined in header `<stdlib.h>` | | | | Defined in header `<string.h>` | | | | Defined in header `<time.h>` | | | | Defined in header `<uchar.h>` | | (since C11) | | Defined in header `<wchar.h>` | | (since C95) | | ``` typedef /*implementation-defined*/ size_t; ``` | | | `size_t` is the unsigned integer type of the result of [`sizeof`](../language/sizeof "c/language/sizeof") , [`_Alignof`](../language/_alignof "c/language/ Alignof") (since C11) and `[offsetof](offsetof "c/types/offsetof")`, depending on the [data model](../language/arithmetic_types#Data_models "c/language/arithmetic types"). | | | | --- | --- | | The bit width of `size_t` is not less than 16. | (since C99) | ### Notes `size_t` can store the maximum size of a theoretically possible object of any type (including array). `size_t` is commonly used for array indexing and loop counting. Programs that use other types, such as `unsigned int`, for array indexing may fail on, e.g. 64-bit systems when the index exceeds `[UINT\_MAX](limits "c/types/limits")` or if it relies on 32-bit modular arithmetic. ### Example ``` #include <stdio.h> #include <stddef.h> #include <stdint.h> int main(void) { const size_t N = 100; int numbers[N]; for (size_t ndx = 0; ndx < N; ++ndx) numbers[ndx] = ndx; printf("SIZE_MAX = %zu\n", SIZE_MAX); size_t size = sizeof numbers; printf("size = %zu\n", size); } ``` Possible output: ``` SIZE_MAX = 18446744073709551615 size = 400 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.19 Common definitions <stddef.h> (p: 211) + 7.20.3 Limits of other integer types (p: 215) * C11 standard (ISO/IEC 9899:2011): + 7.19 Common definitions <stddef.h> (p: 288) + 7.20.3 Limits of other integer types (p: 293) * C99 standard (ISO/IEC 9899:1999): + 7.17 Common definitions <stddef.h> (p: 253) + 7.18.3 Limits of other integer types (p: 258) * C89/C90 standard (ISO/IEC 9899:1990): + 4.1.6 Common definitions <stddef.h> ### See also | | | | --- | --- | | [ptrdiff\_t](ptrdiff_t "c/types/ptrdiff t") | signed integer type returned when subtracting two pointers (typedef) | | [offsetof](offsetof "c/types/offsetof") | byte offset from the beginning of a struct type to specified member (function macro) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/size_t "cpp/types/size t") for `size_t` | c offsetof offsetof ======== | Defined in header `<stddef.h>` | | | | --- | --- | --- | | ``` #define offsetof(type, member) /*implementation-defined*/ ``` | | | The macro `offsetof` expands to an [integer constant expression](../language/constant_expression#Integer_constant_expression "c/language/constant expression") of type `[size\_t](size_t "c/types/size t")`, the value of which is the offset, in bytes, from the beginning of an object of specified type to its specified subobject, including padding if any. Given an object `o` of type `type` with static storage duration, `&(o.member)` shall be an address constant expression and point to a subobject of `o`. Otherwise, the behavior is undefined. | | | | --- | --- | | If a new type is defined in `type`, the behavior is undefined. | (since C23) | ### Notes If `offsetof` is applied to a bit-field member, the behavior is undefined, because the address of a bit-field cannot be taken. `member` is not restricted to a direct member. It can denote a subobject of a given member, such as an element of an array member. Even though it is specified in C23 that defining a new type in `offsetof` is undefined behavior, such usage is only partially supported by implementations even in earlier modes: `offsetof(struct Foo { int a; }, a)` is usually supported, but `offsetof(struct Foo { int a, b; }, a)` is not because of the comma in the definition of `struct Foo`. ### Example ``` #include <stdio.h> #include <stddef.h> struct S { char c; double d; }; int main(void) { printf("the first element is at offset %zu\n", offsetof(struct S, c)); printf("the double is at offset %zu\n", offsetof(struct S, d)); } ``` Possible output: ``` the first element is at offset 0 the double is at offset 8 ``` ### Defect reports The following behavior-changing defect reports were applied retroactively to previously published C standards. | DR | Applied to | Behavior as published | Correct behavior | | --- | --- | --- | --- | | [DR 496](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_496) | C89 | only structs and struct members were mentioned | unions and other subobjects are also supported | ### See also | | | | --- | --- | | [size\_t](size_t "c/types/size t") | unsigned integer type returned by the [`sizeof`](../language/sizeof "c/language/sizeof") operator (typedef) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/offsetof "cpp/types/offsetof") for `offsetof` | c NULL NULL ==== | Defined in header `<stddef.h>` | | | | --- | --- | --- | | Defined in header `<string.h>` | | | | Defined in header `<wchar.h>` | | | | Defined in header `<time.h>` | | | | Defined in header `<locale.h>` | | | | Defined in header `<stdio.h>` | | | | Defined in header `<stdlib.h>` | | | | ``` #define NULL /*implementation-defined*/ ``` | | | The macro `NULL` is an implementation-defined null pointer constant, which may be. * an integer [constant expression](../language/constant_expression#Integer_constant_expression "c/language/constant expression") with the value `​0​` * an integer constant expression with the value 0 [cast to the type](../language/conversion#Pointer_conversions "c/language/conversion") `void*` | | | | --- | --- | | * predefined constant [`nullptr`](../language/nullptr "c/language/nullptr") | (since C23) | A null pointer constant may be [converted](../language/conversion#Pointer_conversions "c/language/conversion") to any pointer type; such conversion results in the null pointer value of that type. ### Possible implementation | | | --- | | ``` // C++ compatible: #define NULL 0 // C++ incompatible: #define NULL (10*2 - 20) #define NULL ((void*)0) // since C23 (compatible with C++11 and later) #define NULL nullptr ``` | ### Example ``` #include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <inttypes.h> int main(void) { // any kind of pointer can be set to NULL int* p = NULL; struct S *s = NULL; void(*f)(int, double) = NULL; printf("%p %p %p\n", (void*)p, (void*)s, (void*)(long)f); // many pointer-returning functions use null pointers to indicate error char *ptr = malloc(0xFULL); if (ptr == NULL) printf("Out of memory"); else printf("ptr = %#" PRIxPTR"\n", (uintptr_t)ptr); free(ptr); } ``` Possible output: ``` (nil) (nil) (nil) ptr = 0xc001cafe ``` ### See also | | | | --- | --- | | [nullptr\_t](nullptr_t "c/types/nullptr t") (C23) | the type of the predefined null pointer constant [`nullptr`](../language/nullptr "c/language/nullptr") (typedef) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/NULL "cpp/types/NULL") for `NULL` | c max_align_t max\_align\_t ============= | Defined in header `<stddef.h>` | | | | --- | --- | --- | | ``` typedef /*implementation-defined*/ max_align_t; ``` | | (since C11) | `max_align_t` is a type whose alignment requirement is at least as strict (as large) as that of every scalar type. ### Notes Pointers returned by allocation functions such as `[malloc](../memory/malloc "c/memory/malloc")` are suitably aligned for any object, which means they are aligned at least as strictly as `max_align_t`. `max_align_t` is usually synonymous with the largest scalar type, which is `long double` on most platforms, and its alignment requirement is either 8 or 16. ### Example ``` #include <stdio.h> #include <stddef.h> #include <stdalign.h> #include <stdlib.h> #include <stdint.h> #include <inttypes.h> int main(void) { size_t a = alignof(max_align_t); printf("Alignment of max_align_t is %zu (%#zx)\n", a, a); void *p = malloc(123); printf("The address obtained from malloc(123) is %#" PRIxPTR"\n", (uintptr_t)p); free(p); } ``` Possible output: ``` Alignment of max_align_t is 16 (0x10) The address obtained from malloc(123) is 0x1fa67010 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.19 Common definitions <stddef.h> (p: 211) * C11 standard (ISO/IEC 9899:2011): + 7.19 Common definitions <stddef.h> (p: 288) ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/types/max_align_t "cpp/types/max align t") for `max_align_t` | c ptrdiff_t ptrdiff\_t ========== | Defined in header `<stddef.h>` | | | | --- | --- | --- | | ``` typedef /*implementation-defined*/ ptrdiff_t; ``` | | | `ptrdiff_t` is the signed integer type of the result of [subtracting two pointers](../language/operator_arithmetic#Pointer_arithmetic "c/language/operator arithmetic"). | | | | --- | --- | | The bit width of `ptrdiff_t` is not less than 17. | (since C99)(until C23) | | The bit width of `ptrdiff_t` is not less than 16. | (since C23) | ### Notes `ptrdiff_t` is used for pointer arithmetic and array indexing, if negative values are possible. Programs that use other types, such as `int`, may fail on, e.g. 64-bit systems when the index exceeds `[INT\_MAX](limits "c/types/limits")` or if it relies on 32-bit modular arithmetic. Only pointers to elements of the same array (including the pointer one past the end of the array) may be subtracted from each other. If an array is so large (greater than `[PTRDIFF\_MAX](limits "c/types/limits")` elements, but less than `[SIZE\_MAX](limits "c/types/limits")` bytes), that the difference between two pointers may not be representable as `ptrdiff_t`, the result of subtracting two such pointers is undefined. For char arrays shorter than `[PTRDIFF\_MAX](limits "c/types/limits")`, `ptrdiff_t` acts as the signed counterpart of `[size\_t](size_t "c/types/size t")`: it can store the size of the array of any type and is, on most platforms, synonymous with `intptr_t`). ### Example ``` #include <stdio.h> #include <stddef.h> #include <stdint.h> int main(void) { const size_t N = 100; int numbers[N]; printf("PTRDIFF_MAX = %ld\n", PTRDIFF_MAX); int *p1=&numbers[18], *p2=&numbers[23]; ptrdiff_t diff = p2-p1; printf("p2-p1 = %td\n", diff); return 0; } ``` Possible output: ``` PTRDIFF_MAX = 9223372036854775807 p2-p1 = 5 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.19 Common definitions <stddef.h> (p: 211) + 7.20.3 Limits of other integer types (p: 215) * C11 standard (ISO/IEC 9899:2011): + 7.19 Common definitions <stddef.h> (p: 288) + 7.20.3 Limits of other integer types (p: 293) * C99 standard (ISO/IEC 9899:1999): + 7.17 Common definitions <stddef.h> (p: 253) + 7.18.3 Limits of other integer types (p: 258) * C89/C90 standard (ISO/IEC 9899:1990): + 4.1.6 Common definitions <stddef.h> ### See also | | | | --- | --- | | [size\_t](size_t "c/types/size t") | unsigned integer type returned by the [`sizeof`](../language/sizeof "c/language/sizeof") operator (typedef) | | [offsetof](offsetof "c/types/offsetof") | byte offset from the beginning of a struct type to specified member (function macro) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/ptrdiff_t "cpp/types/ptrdiff t") for `ptrdiff_t` | c Numeric limits Numeric limits ============== ### Limits of integer types | | | --- | | Limits of core language integer types | | Defined in header `<limits.h>` | | BOOL\_WIDTH (C23) | bit width of `_Bool` (macro constant) | | CHAR\_BIT | number of bits in a byte (macro constant) | | MB\_LEN\_MAX | maximum number of bytes in a multibyte character (macro constant) | | CHAR\_WIDTH (C23) | bit width of `char`, same as `CHAR_BIT` (macro constant) | | CHAR\_MIN | minimum value of `char` (macro constant) | | CHAR\_MAX | maximum value of `char` (macro constant) | | SCHAR\_WIDTHSHRT\_WIDTHINT\_WIDTHLONG\_WIDTHLLONG\_WIDTH (C23)(C23)(C23)(C23)(C23) | bit width of `signed char`, `short`, `int`, `long`, and `long long` respectively (macro constant) | | SCHAR\_MINSHRT\_MININT\_MINLONG\_MINLLONG\_MIN (C99) | minimum value of `signed char`, `short`, `int`, `long` and `long long` respectively (macro constant) | | SCHAR\_MAXSHRT\_MAXINT\_MAXLONG\_MAXLLONG\_MAX (C99) | maximum value of `signed char`, `short`, `int`, `long` and `long long` respectively (macro constant) | | UCHAR\_WIDTHUSHRT\_WIDTHUINT\_WIDTHULONG\_WIDTHULLONG\_WIDTH (C23)(C23)(C23)(C23)(C23) | bit width of `unsigned char`, `unsigned short`, `unsigned int`, `unsigned long`, and `unsigned long long` respectively (macro constant) | | UCHAR\_MAXUSHRT\_MAXUINT\_MAXULONG\_MAXULLONG\_MAX (C99) | maximum value of `unsigned char`, `unsigned short`, `unsigned int`,`unsigned long` and `unsigned long long` respectively (macro constant) | | Limits of library type aliases | | Defined in header `<stdint.h>` | | PTRDIFF\_WIDTH (C23) | bit width of object of `[ptrdiff\_t](ptrdiff_t "c/types/ptrdiff t")` type (macro constant) | | PTRDIFF\_MIN (C99) | minimum value of object of `[ptrdiff\_t](ptrdiff_t "c/types/ptrdiff t")` type (macro constant) | | PTRDIFF\_MAX (C99) | maximum value of object of `[ptrdiff\_t](ptrdiff_t "c/types/ptrdiff t")` type (macro constant) | | SIZE\_WIDTH (C23) | bit width of object of `[size\_t](size_t "c/types/size t")` type (macro constant) | | SIZE\_MAX (C99) | maximum value of object of `[size\_t](size_t "c/types/size t")` type (macro constant) | | SIG\_ATOMIC\_WIDTH (C23) | bit width of object of `[sig\_atomic\_t](../program/sig_atomic_t "c/program/sig atomic t")` type (macro constant) | | SIG\_ATOMIC\_MIN (C99) | minimum value of object of `[sig\_atomic\_t](../program/sig_atomic_t "c/program/sig atomic t")` type (macro constant) | | SIG\_ATOMIC\_MAX (C99) | maximum value of object of `[sig\_atomic\_t](../program/sig_atomic_t "c/program/sig atomic t")` type (macro constant) | | WINT\_WIDTH (C23) | bit width of object of `wint_t` type (macro constant) | | WINT\_MIN (C99) | minimum value of object of `wint_t` type (macro constant) | | WINT\_MAX (C99) | maximum value of object of `wint_t` type (macro constant) | | Defined in header `<wchar.h>` | | Defined in header `<stdint.h>` | | WCHAR\_WIDTH (C23) | bit width of object of `wchar_t` type (macro constant) | | WCHAR\_MIN (C99) | minimum value of object of `wchar_t` type (macro constant) | | WCHAR\_MAX (C99) | maximum value of object of `wchar_t` type (macro constant) | #### Notes The types of these constants, other than `CHAR_BIT` and `MB_LEN_MAX`, are required to match the results of the [integral promotions](../language/conversion#Integer_promotions "c/language/conversion") as applied to objects of the types they describe: `CHAR_MAX` may have type `int` or `unsigned int`, but never `char`. Similarly `USHRT_MAX` may not be of an unsigned type: its type may be `int`. A freestanding implementation may lack `[sig\_atomic\_t](../program/sig_atomic_t "c/program/sig atomic t")` and/or `wint_t` typedef names, in which case the `SIG_ATOMIC_*` and/or `WINT_*` macros are correspondingly absent. #### Example ``` #include <stdio.h> #include <limits.h> #include <stdint.h> int main(void) { printf("CHAR_BIT = %d\n", CHAR_BIT); printf("MB_LEN_MAX = %d\n\n", MB_LEN_MAX); printf("CHAR_MIN = %+d\n", CHAR_MIN); printf("CHAR_MAX = %+d\n", CHAR_MAX); printf("SCHAR_MIN = %+d\n", SCHAR_MIN); printf("SCHAR_MAX = %+d\n", SCHAR_MAX); printf("UCHAR_MAX = %u\n\n", UCHAR_MAX); printf("SHRT_MIN = %+d\n", SHRT_MIN); printf("SHRT_MAX = %+d\n", SHRT_MAX); printf("USHRT_MAX = %u\n\n", USHRT_MAX); printf("INT_MIN = %+d\n", INT_MIN); printf("INT_MAX = %+d\n", INT_MAX); printf("UINT_MAX = %u\n\n", UINT_MAX); printf("LONG_MIN = %+ld\n", LONG_MIN); printf("LONG_MAX = %+ld\n", LONG_MAX); printf("ULONG_MAX = %lu\n\n", ULONG_MAX); printf("LLONG_MIN = %+lld\n", LLONG_MIN); printf("LLONG_MAX = %+lld\n", LLONG_MAX); printf("ULLONG_MAX = %llu\n\n", ULLONG_MAX); printf("PTRDIFF_MIN = %td\n", PTRDIFF_MIN); printf("PTRDIFF_MAX = %+td\n", PTRDIFF_MAX); printf("SIZE_MAX = %zu\n", SIZE_MAX); printf("SIG_ATOMIC_MIN = %+jd\n",(intmax_t)SIG_ATOMIC_MIN); printf("SIG_ATOMIC_MAX = %+jd\n",(intmax_t)SIG_ATOMIC_MAX); printf("WCHAR_MIN = %+jd\n",(intmax_t)WCHAR_MIN); printf("WCHAR_MAX = %+jd\n",(intmax_t)WCHAR_MAX); printf("WINT_MIN = %jd\n", (intmax_t)WINT_MIN); printf("WINT_MAX = %jd\n", (intmax_t)WINT_MAX); } ``` Possible output: ``` CHAR_BIT = 8 MB_LEN_MAX = 16 CHAR_MIN = -128 CHAR_MAX = +127 SCHAR_MIN = -128 SCHAR_MAX = +127 UCHAR_MAX = 255 SHRT_MIN = -32768 SHRT_MAX = +32767 USHRT_MAX = 65535 INT_MIN = -2147483648 INT_MAX = +2147483647 UINT_MAX = 4294967295 LONG_MIN = -9223372036854775808 LONG_MAX = +9223372036854775807 ULONG_MAX = 18446744073709551615 LLONG_MIN = -9223372036854775808 LLONG_MAX = +9223372036854775807 ULLONG_MAX = 18446744073709551615 PTRDIFF_MIN = -9223372036854775808 PTRDIFF_MAX = +9223372036854775807 SIZE_MAX = 18446744073709551615 SIG_ATOMIC_MIN = -2147483648 SIG_ATOMIC_MAX = +2147483647 WCHAR_MIN = -2147483648 WCHAR_MAX = +2147483647 WINT_MIN = 0 WINT_MAX = 4294967295 ``` ### Limits of floating-point types | Defined in header `<float.h>` | | --- | | FLT\_RADIX | the radix (integer base) used by the representation of all three floating-point types (macro constant) | | DECIMAL\_DIG (C99) | conversion from `long double` to decimal with at least `DECIMAL_DIG` digits and back to `long double` is the identity conversion: this is the decimal precision required to serialize/deserialize a `long double` (macro constant) | | FLT\_DECIMAL\_DIGDBL\_DECIMAL\_DIGLDBL\_DECIMAL\_DIG (C11) | conversion from `float`/`double`/`long double` to decimal with at least `FLT_DECIMAL_DIG`/`DBL_DECIMAL_DIG`/`LDBL_DECIMAL_DIG` digits and back is the identity conversion: this is the decimal precision required to serialize/deserialize a floating-point value. Defined to at least `6`, `10`, and `10` respectively, or `9` for IEEE float and `17` for IEEE double (see also the C++ analog: [`max_digits10`](https://en.cppreference.com/w/cpp/types/numeric_limits/max_digits10 "cpp/types/numeric limits/max digits10")) (macro constant) | | FLT\_MINDBL\_MINLDBL\_MIN | minimum, normalized, positive value of `float`, `double` and `long double` respectively (macro constant) | | FLT\_TRUE\_MINDBL\_TRUE\_MINLDBL\_TRUE\_MIN (C11) | minimum positive value of `float`, `double` and `long double` respectively (macro constant) | | FLT\_MAXDBL\_MAXLDBL\_MAX | maximum finite value of `float`, `double` and `long double` respectively (macro constant) | | FLT\_EPSILONDBL\_EPSILONLDBL\_EPSILON | difference between `1.0` and the next representable value for `float`, `double` and `long double` respectively (macro constant) | | FLT\_DIGDBL\_DIGLDBL\_DIG | number of decimal digits that are guaranteed to be preserved in text → `float`/`double`/`long double` → text roundtrip without change due to rounding or overflow (see the C++ analog [`digits10`](https://en.cppreference.com/w/cpp/types/numeric_limits/digits10 "cpp/types/numeric limits/digits10") for detail) (macro constant) | | FLT\_MANT\_DIGDBL\_MANT\_DIGLDBL\_MANT\_DIG | number of base-`FLT_RADIX` digits that are in the floating-point mantissa and that can be represented without losing precision for `float`, `double` and `long double` respectively (macro constant) | | FLT\_MIN\_EXPDBL\_MIN\_EXPLDBL\_MIN\_EXP | minimum negative integer such that `FLT_RADIX` raised by power one less than that integer is a normalized `float`, `double` and `long double` respectively (macro constant) | | FLT\_MIN\_10\_EXPDBL\_MIN\_10\_EXPLDBL\_MIN\_10\_EXP | minimum negative integer such that 10 raised by power one less than that integer is a normalized `float`, `double` and `long double` respectively (macro constant) | | FLT\_MAX\_EXPDBL\_MAX\_EXPLDBL\_MAX\_EXP | maximum positive integer such that `FLT_RADIX` raised by power one less than that integer is a representable finite `float`, `double` and `long double` respectively (macro constant) | | FLT\_MAX\_10\_EXPDBL\_MAX\_10\_EXPLDBL\_MAX\_10\_EXP | maximum positive integer such that 10 raised by power one less than that integer is a representable finite `float`, `double` and `long double` respectively (macro constant) | | [FLT\_ROUNDS](limits/flt_rounds "c/types/limits/FLT ROUNDS") | rounding mode of floating-point arithmetics (macro constant) | | [FLT\_EVAL\_METHOD](limits/flt_eval_method "c/types/limits/FLT EVAL METHOD") (C99) | use of extended precision for intermediate results: `​0​` – not used, `1` – `double` is used instead of `float`, `2` – `long double` is used (macro constant) | | FLT\_HAS\_SUBNORMDBL\_HAS\_SUBNORMLDBL\_HAS\_SUBNORM (C11) | whether the type supports subnormal ([denormal](https://en.wikipedia.org/wiki/Denormal_number "enwiki:Denormal number")) numbers: `-1` – indeterminable, `​0​` – absent, `1` – present (macro constant) | #### Example ``` #include <stdio.h> #include <float.h> #include <math.h> int main(void) { printf("DECIMAL_DIG = %d\n", DECIMAL_DIG); printf("FLT_DECIMAL_DIG = %d\n", FLT_DECIMAL_DIG); printf("FLT_RADIX = %d\n", FLT_RADIX); printf("FLT_MIN = %e\n", FLT_MIN); printf("FLT_MAX = %e\n", FLT_MAX); printf("FLT_EPSILON = %e\n", FLT_EPSILON); printf("FLT_DIG = %d\n", FLT_DIG); printf("FLT_MANT_DIG = %d\n", FLT_MANT_DIG); printf("FLT_MIN_EXP = %d\n", FLT_MIN_EXP); printf("FLT_MIN_10_EXP = %d\n", FLT_MIN_10_EXP); printf("FLT_MAX_EXP = %d\n", FLT_MAX_EXP); printf("FLT_MAX_10_EXP = %d\n", FLT_MAX_10_EXP); printf("FLT_ROUNDS = %d\n", FLT_ROUNDS); printf("FLT_EVAL_METHOD = %d\n", FLT_EVAL_METHOD); printf("FLT_HAS_SUBNORM = %d\n", FLT_HAS_SUBNORM); } ``` Possible output: ``` DECIMAL_DIG = 37 FLT_DECIMAL_DIG = 9 FLT_RADIX = 2 FLT_MIN = 1.175494e-38 FLT_MAX = 3.402823e+38 FLT_EPSILON = 1.192093e-07 FLT_DIG = 6 FLT_MANT_DIG = 24 FLT_MIN_EXP = -125 FLT_MIN_10_EXP = -37 FLT_MAX_EXP = 128 FLT_MAX_10_EXP = 38 FLT_ROUNDS = 1 FLT_EVAL_METHOD = 1 FLT_HAS_SUBNORM = 1 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 5.2.4.2 Numerical limits (p: 20-27) + 7.20.3 Limits of other integer types (p: 215-216) * C11 standard (ISO/IEC 9899:2011): + 5.2.4.2 Numerical limits (p: 26-34) + 7.20.3 Limits of other integer types (p: 293-294) * C99 standard (ISO/IEC 9899:1999): + 5.2.4.2 Numerical limits (p: 21-28) + 7.18.3 Limits of other integer types (p: 259-260) * C89/C90 standard (ISO/IEC 9899:1990): + 2.2.4.2 Numerical limits ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/types/climits "cpp/types/climits") for C numeric limits interface |
programming_docs
c nullptr_t nullptr\_t ========== | Defined in header `<stddef.h>` | | | | --- | --- | --- | | ``` typedef typeof(nullptr) nullptr_t; ``` | | (since C23) | `nullptr_t` is the type of the predefined null pointer constant, [`nullptr`](../language/nullptr "c/language/nullptr"). It is a distinct type that is not itself a pointer type. It can be [implicitly converted](../language/conversion "c/language/conversion") to any pointer type or `bool`, and the result is the null pointer value of that type or `false` respectively. No type other than `nullptr_t` itself can be converted or explicitly cast to `nullptr_t`. `sizeof(nullptr_t)` and `alignof(nullptr_t)` are equal to `sizeof(void*)` and `alignof(void*)` respectively. `nullptr_t` has only one valid value, i.e., `nullptr`. The object representation of `nullptr` is same as that of `(void*)0`. If a program produces a `nullptr_t` value with a different object representation, the behavior is undefined. ### Example Demonstrate that `nullptr_t` is a distict type. ``` #include <stddef.h> #include <stdio.h> #define DETECT_NULL_POINTER_CONSTANT(e) \ _Generic(e, \ void* : puts("void*"), \ nullptr_t : puts("nullptr_t"), \ default : puts("other") \ ) int main() { DETECT_NULL_POINTER_CONSTANT(((void*)0)); DETECT_NULL_POINTER_CONSTANT(0); DETECT_NULL_POINTER_CONSTANT(nullptr); } ``` Output: ``` void* other nullptr_t ``` ### See also | | | | --- | --- | | [NULL](null "c/types/NULL") | implementation-defined null pointer constant (macro constant) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/nullptr_t "cpp/types/nullptr t") for `nullptr_t` | c FLT_EVAL_METHOD FLT\_EVAL\_METHOD ================= | Defined in header `<float.h>` | | | | --- | --- | --- | | ``` #define FLT_EVAL_METHOD /* implementation defined */ ``` | | (since C99) | Specifies range and precision of floating-point values obtained from floating-point constants and from all operations (operators, implicit conversions of operands) except assignment, cast, and library function call. | Value | Explanation | | --- | --- | | negative values except `-1` | implementation-defined behavior | | `-1` | the default precision is not known | | `0` | all operations and constants evaluate in the range and precision of the type used. Additionally, `float_t` and `double_t` are equivalent to `float` and `double` respectively | | `1` | all operations and constants evaluate in the range and precision of `double`. Additionally, both `float_t` and `double_t` are equivalent to `double` | | `2` | all operations and constants evaluate in the range and precision of `long double`. Additionally, both `float_t` and `double_t` are equivalent to `long double` | ### Notes Regardless of the value of `FLT_EVAL_METHOD`, any floating-point expression may be *contracted*, that is, calculated as if all intermediate results have infinite range and precision (unless [#pragma](../../preprocessor/impl "c/preprocessor/impl") `STDC FP_CONTRACT` is off). Cast and assignment strip away any extraneous range and precision: this models the action of storing a value from an extended-precision FPU register into a standard-sized memory location. ### See also | | | | --- | --- | | [float\_tdouble\_t](../../numeric/math/float_t "c/numeric/math/float t") (C99)(C99) | most efficient floating-point type at least as wide as `float` or `double` (typedef) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/climits/FLT_EVAL_METHOD "cpp/types/climits/FLT EVAL METHOD") for `FLT_EVAL_METHOD` | c FLT_ROUNDS FLT\_ROUNDS =========== | Defined in header `<float.h>` | | | | --- | --- | --- | | ``` #define FLT_ROUNDS /* implementation defined */ ``` | | | Returns the current rounding direction of floating-point arithmetic operations. | Value | Explanation | | --- | --- | | `-1` | the default rounding direction is not known | | `0` | toward zero; same meaning as `[FE\_TOWARDZERO](../../numeric/fenv/fe_round "c/numeric/fenv/FE round")` | | `1` | to nearest; same meaning as `[FE\_TONEAREST](../../numeric/fenv/fe_round "c/numeric/fenv/FE round")` | | `2` | towards positive infinity; same meaning as `[FE\_UPWARD](../../numeric/fenv/fe_round "c/numeric/fenv/FE round")` | | `3` | towards negative infinity; same meaning as `[FE\_DOWNWARD](../../numeric/fenv/fe_round "c/numeric/fenv/FE round")` | | other values | implementation-defined behavior | ### Notes The rounding mode can be changed with `[fesetround](../../numeric/fenv/feround "c/numeric/fenv/feround")` and `FLT_ROUNDS` reflects that change. ### See also | | | | --- | --- | | [fegetroundfesetround](../../numeric/fenv/feround "c/numeric/fenv/feround") (C99)(C99) | gets or sets rounding direction (function) | | [FE\_DOWNWARDFE\_TONEARESTFE\_TOWARDZEROFE\_UPWARD](../../numeric/fenv/fe_round "c/numeric/fenv/FE round") (C99) | floating-point rounding direction (macro constant) | | [C++ documentation](https://en.cppreference.com/w/cpp/types/climits/FLT_ROUNDS "cpp/types/climits/FLT ROUNDS") for `FLT_ROUNDS` | c setlocale setlocale ========= | Defined in header `<locale.h>` | | | | --- | --- | --- | | ``` char* setlocale( int category, const char* locale ); ``` | | | The `setlocale` function installs the specified system locale or its portion as the new C locale. The modifications remain in effect and influences the execution of all locale-sensitive C library functions until the next call to `setlocale`. If `locale` is a null pointer, `setlocale` queries the current C locale without modifying it. ### Parameters | | | | | --- | --- | --- | | category | - | locale category identifier, one of the [LC\_xxx](lc_categories "c/locale/LC categories") macros. May be null. | | locale | - | system-specific locale identifier. Can be `""` for the user-preferred locale or `"C"` for the minimal locale | ### Return value pointer to a narrow null-terminated string identifying the C locale after applying the changes, if any, or null pointer on failure. A copy of the returned string along with the category used in this call to `setlocale` may be used later in the program to restore the locale back to the state at the end of this call. ### Notes During program startup, the equivalent of `setlocale([LC\_ALL](http://en.cppreference.com/w/c/locale/LC_categories), "C");` is executed before any user code is run. Although the return type is `char*`, modifying the pointed-to characters is undefined behavior. Because `setlocale` modifies global state which affects execution of locale-dependent functions, it is undefined behavior to call it from one thread, while another thread is executing any of the following functions: `[fprintf](../io/fprintf "c/io/fprintf")`, `[isprint](../string/byte/isprint "c/string/byte/isprint")`, `[iswdigit](../string/wide/iswdigit "c/string/wide/iswdigit")`, `[localeconv](localeconv "c/locale/localeconv")`, `[tolower](../string/byte/tolower "c/string/byte/tolower")`, `[fscanf](../io/fscanf "c/io/fscanf")`, `[ispunct](../string/byte/ispunct "c/string/byte/ispunct")`, `[iswgraph](../string/wide/iswgraph "c/string/wide/iswgraph")`, `[mblen](../string/multibyte/mblen "c/string/multibyte/mblen")`, `[toupper](../string/byte/toupper "c/string/byte/toupper")`, `[isalnum](../string/byte/isalnum "c/string/byte/isalnum")`, `[isspace](../string/byte/isspace "c/string/byte/isspace")`, `[iswlower](../string/wide/iswlower "c/string/wide/iswlower")`, `[mbstowcs](../string/multibyte/mbstowcs "c/string/multibyte/mbstowcs")`, `[towlower](../string/wide/towlower "c/string/wide/towlower")`, `[isalpha](../string/byte/isalpha "c/string/byte/isalpha")`, `[isupper](../string/byte/isupper "c/string/byte/isupper")`, `[iswprint](../string/wide/iswprint "c/string/wide/iswprint")`, `[mbtowc](../string/multibyte/mbtowc "c/string/multibyte/mbtowc")`, `[towupper](../string/wide/towupper "c/string/wide/towupper")`, `[isblank](../string/byte/isblank "c/string/byte/isblank")`, `[iswalnum](../string/wide/iswalnum "c/string/wide/iswalnum")`, `[iswpunct](../string/wide/iswpunct "c/string/wide/iswpunct")`, `setlocale`, `[wcscoll](../string/wide/wcscoll "c/string/wide/wcscoll")`, `[iscntrl](../string/byte/iscntrl "c/string/byte/iscntrl")`, `[iswalpha](../string/wide/iswalpha "c/string/wide/iswalpha")`, `[iswspace](../string/wide/iswspace "c/string/wide/iswspace")`, `[strcoll](../string/byte/strcoll "c/string/byte/strcoll")`, `[wcstod](../string/wide/wcstof "c/string/wide/wcstof")`, `[isdigit](../string/byte/isdigit "c/string/byte/isdigit")`, `[iswblank](../string/wide/iswblank "c/string/wide/iswblank")`, `[iswupper](../string/wide/iswupper "c/string/wide/iswupper")`, `[strerror](../string/byte/strerror "c/string/byte/strerror")`, `[wcstombs](../string/multibyte/wcstombs "c/string/multibyte/wcstombs")`, `[isgraph](../string/byte/isgraph "c/string/byte/isgraph")`, `[iswcntrl](../string/wide/iswcntrl "c/string/wide/iswcntrl")`, `[iswxdigit](../string/wide/iswxdigit "c/string/wide/iswxdigit")`, `[strtod](../string/byte/strtof "c/string/byte/strtof")`, `[wcsxfrm](../string/wide/wcsxfrm "c/string/wide/wcsxfrm")`, `[islower](../string/byte/islower "c/string/byte/islower")`, `[iswctype](../string/wide/iswctype "c/string/wide/iswctype")`, `[isxdigit](../string/byte/isxdigit "c/string/byte/isxdigit")`. POSIX also defines a locale named "POSIX", which is always accessible and is exactly equivalent to the default minimal "C" locale. POSIX also specifies that the returned pointer, not just the contents of the pointed-to string, may be invalidated by subsequent calls to `setlocale`. ### Example ``` #include <stdio.h> #include <locale.h> #include <time.h> #include <wchar.h> int main(void) { // the C locale will be UTF-8 enabled English; // decimal dot will be German // date and time formatting will be Japanese setlocale(LC_ALL, "en_US.UTF-8"); setlocale(LC_NUMERIC, "de_DE.utf8"); setlocale(LC_TIME, "ja_JP.utf8"); wchar_t str[100]; time_t t = time(NULL); wcsftime(str, 100, L"%A %c", localtime(&t)); wprintf(L"Number: %.2f\nDate: %ls\n", 3.14, str); } ``` Possible output: ``` Number: 3,14 Date: 月曜日 2017年09月25日 13時00分15秒 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.11.1.1 The setlocale function (p: 163-164) * C11 standard (ISO/IEC 9899:2011): + 7.11.1.1 The setlocale function (p: 224-225) * C99 standard (ISO/IEC 9899:1999): + 7.11.1.1 The setlocale function (p: 205-206) * C89/C90 standard (ISO/IEC 9899:1990): + 4.4.1.1 The setlocale function ### See also | | | | --- | --- | | [LC\_ALLLC\_COLLATELC\_CTYPELC\_MONETARYLC\_NUMERICLC\_TIME](lc_categories "c/locale/LC categories") | locale categories for `setlocale` (macro constant) | | [C++ documentation](https://en.cppreference.com/w/cpp/locale/setlocale "cpp/locale/setlocale") for `setlocale` | c localeconv localeconv ========== | Defined in header `<locale.h>` | | | | --- | --- | --- | | ``` struct lconv *localeconv(void); ``` | | | The `localeconv` function obtains a pointer to a static object of type `[lconv](lconv "c/locale/lconv")`, which represents numeric and monetary formatting rules of the current C locale. ### Parameters (none). ### Return value pointer to the current `[lconv](lconv "c/locale/lconv")` object. ### Notes Modifying the object references through the returned pointer is undefined behavior. `localeconv` modifies a static object, calling it from different threads without synchronization is undefined behavior. ### Example ``` #include <stdio.h> #include <locale.h> int main(void) { setlocale(LC_MONETARY, "en_IN.utf8"); struct lconv *lc = localeconv(); printf("Local Currency Symbol : %s\n", lc->currency_symbol); printf("International Currency Symbol: %s\n", lc->int_curr_symbol); } ``` Output: ``` Local Currency Symbol : ₹ International Currency Symbol: INR ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.11.2.1 The localeconv function (p: 225-230) * C99 standard (ISO/IEC 9899:1999): + 7.11.2.1 The localeconv function (p: 206-211) * C89/C90 standard (ISO/IEC 9899:1990): + 4.4.2.1 The localeconv function ### See also | | | | --- | --- | | [setlocale](setlocale "c/locale/setlocale") | gets and sets the current C locale (function) | | [lconv](lconv "c/locale/lconv") | formatting details, returned by `localeconv` (struct) | | [C++ documentation](https://en.cppreference.com/w/cpp/locale/localeconv "cpp/locale/localeconv") for `localeconv` | c LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME LC\_ALL, LC\_COLLATE, LC\_CTYPE, LC\_MONETARY, LC\_NUMERIC, LC\_TIME ==================================================================== | Defined in header `<locale.h>` | | | | --- | --- | --- | | ``` #define LC_ALL /*implementation defined*/ ``` | | | | ``` #define LC_COLLATE /*implementation defined*/ ``` | | | | ``` #define LC_CTYPE /*implementation defined*/ ``` | | | | ``` #define LC_MONETARY /*implementation defined*/ ``` | | | | ``` #define LC_NUMERIC /*implementation defined*/ ``` | | | | ``` #define LC_TIME /*implementation defined*/ ``` | | | Each of the above macro constants expand to integer constant expressions with distinct values that are suitable for use as the first argument of `[setlocale](setlocale "c/locale/setlocale")`. | Constant | Explanation | | --- | --- | | `LC_ALL` | selects the entire C locale | | `LC_COLLATE` | selects the collation category of the C locale | | `LC_CTYPE` | selects the character classification category of the C locale | | `LC_MONETARY` | selects the monetary formatting category of the C locale | | `LC_NUMERIC` | selects the numeric formatting category of the C locale | | `LC_TIME` | selects the time formatting category of the C locale | Additional macro constants, with names that begin with `LC_` followed by at least one uppercase letter, may be defined in `locale.h`. For example, the POSIX specification requires LC\_MESSAGES (which controls, among other things, `[perror](../io/perror "c/io/perror")` and `[strerror](../string/byte/strerror "c/string/byte/strerror")`), ISO/IEC 30112:2014 ([2014 draft](http://www.open-std.org/JTC1/SC35/WG5/docs/30112d10.pdf)) additionally defines LC\_IDENTIFICATION, LC\_XLITERATE, LC\_NAME, LC\_ADDRESS, LC\_TELEPHONE, LC\_PAPER, LC\_MEASUREMENT, and LC\_KEYBOARD, which are supported by the GNU C library (except for LC\_XLITERATE). ### Example ``` #include <stdio.h> #include <locale.h> #include <time.h> #include <wchar.h> int main(void) { setlocale(LC_ALL, "en_US.UTF-8"); // the C locale will be the UTF-8 enabled English setlocale(LC_NUMERIC, "de_DE.utf8"); // decimal dot will be German setlocale(LC_TIME, "ja_JP.utf8"); // date/time formatting will be Japanese wchar_t str[100]; time_t t = time(NULL); wcsftime(str, 100, L"%A %c", localtime(&t)); wprintf(L"Number: %.2f\nDate: %Ls\n", 3.14, str); } ``` Possible output: ``` Number: 3,14 Date: 月曜日 2017年09月25日 13時00分15秒 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.11/3 Localization <locale.h> (p: 224) * C99 standard (ISO/IEC 9899:1999): + 7.11/3 Localization <locale.h> (p: 205) * C89/C90 standard (ISO/IEC 9899:1990): + 4.4 LOCALIZATION <locale.h> ### See also | | | | --- | --- | | [setlocale](setlocale "c/locale/setlocale") | gets and sets the current C locale (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/locale/LC_categories "cpp/locale/LC categories") for locale categories | c lconv lconv ===== | Defined in header `<locale.h>` | | | | --- | --- | --- | | ``` struct lconv; ``` | | | The struct `lconv` contains numeric and monetary formatting rules as defined by a C locale. Objects of this struct may be obtained with `[localeconv](localeconv "c/locale/localeconv")`. The members of `lconv` are values of type `char` and of type `char*`. Each `char*` member except `decimal_point` may be pointing at a null character (that is, at an empty C-string). The members of type `char` are all non-negative numbers, any of which may be `[CHAR\_MAX](../types/limits "c/types/limits")` if the corresponding value is not available in the current C locale. ### Member objects #### Non-monetary numeric formatting parameters | | | | --- | --- | | char\* decimal\_point | the character used as the decimal point (public member object) | | char\* thousands\_sep | the character used to separate groups of digits before the decimal point (public member object) | | char\* grouping | a string whose elements indicate the sizes of digit groups (public member object) | #### Monetary numeric formatting parameters | | | | --- | --- | | char\* mon\_decimal\_point | the character used as the decimal point (public member object) | | char\* mon\_thousands\_sep | the character used to separate groups of digits before the decimal point (public member object) | | char\* mon\_grouping | a string whose elements indicate the sizes of digit groups (public member object) | | char\* positive\_sign | a string used to indicate non-negative monetary quantity (public member object) | | char\* negative\_sign | a string used to indicate negative monetary quantity (public member object) | #### Local monetary numeric formatting parameters | | | | --- | --- | | char\* currency\_symbol | the symbol used for currency in the current C locale (public member object) | | char frac\_digits | the number of digits after the decimal point to display in a monetary quantity (public member object) | | char p\_cs\_precedes | `1` if currency\_symbol is placed before non-negative value, `​0​` if after (public member object) | | char n\_cs\_precedes | `1` if currency\_symbol is placed before negative value, `​0​` if after (public member object) | | char p\_sep\_by\_space | indicates the separation of `currency_symbol`, `positive_sign`, and the non-negative monetary value (public member object) | | char n\_sep\_by\_space | indicates the separation of `currency_symbol`, `negative_sign`, and the negative monetary value (public member object) | | char p\_sign\_posn | indicates the position of `positive_sign` in a non-negative monetary value (public member object) | | char n\_sign\_posn | indicates the position of `negative_sign` in a negative monetary value (public member object) | #### International monetary numeric formatting parameters | | | | --- | --- | | char\* int\_curr\_symbol | the string used as international currency name in the current C locale (public member object) | | char int\_frac\_digits | the number of digits after the decimal point to display in an international monetary quantity (public member object) | | char int\_p\_cs\_precedes (C99) | `1` if int\_curr\_symbol is placed before non-negative international monetary value, `​0​` if after (public member object) | | char int\_n\_cs\_precedes (C99) | `1` if int\_curr\_symbol is placed before negative international monetary value, `​0​` if after (public member object) | | char int\_p\_sep\_by\_space (C99) | indicates the separation of `int_curr_symbol`, `positive_sign`, and the non-negative international monetary value (public member object) | | char int\_n\_sep\_by\_space (C99) | indicates the separation of `int_curr_symbol`, `negative_sign`, and the negative international monetary value (public member object) | | char int\_p\_sign\_posn (C99) | indicates the position of `positive_sign` in a non-negative international monetary value (public member object) | | char int\_n\_sign\_posn (C99) | indicates the position of `negative_sign` in a negative international monetary value (public member object) | The characters of the C-strings pointed to by `grouping` and `mon_grouping` are interpreted according to their numeric values. When the terminating `'\0'` is encountered, the last value seen is assumed to repeat for the remainder of digits. If `[CHAR\_MAX](../types/limits "c/types/limits")` is encountered, no further digits are grouped. the typical grouping of three digits at a time is `"\003"`. The values of `p_sep_by_space`, `n_sep_by_space`, `int_p_sep_by_space`, `int_n_sep_by_space` are interpreted as follows: | | | | --- | --- | | 0 | no space separates the currency symbol and the value | | 1 | sign sticks to the currency symbol, value is separated by a space | | 2 | sign sticks to the value. Currency symbol is separated by a space | The values of `p_sign_posn`, `n_sign_posn`, `int_p_sign_posn`, `int_n_sign_posn` are interpreted as follows: | | | | --- | --- | | 0 | parentheses around the value and the currency symbol are used to represent the sign | | 1 | sign before the value and the currency symbol | | 2 | sign after the value and the currency symbol | | 3 | sign before the currency symbol | | 4 | sign after the currency symbol | ### Example ``` #include <locale.h> #include <stdio.h> int main(void) { setlocale(LC_ALL, "ja_JP.UTF-8"); struct lconv *lc = localeconv(); printf("Japanese currency symbol: %s(%s)\n", lc->currency_symbol, lc->int_curr_symbol); } ``` Possible output: ``` Japanese currency symbol: ¥(JPY ) ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.11/2 Localization <locale.h> (p: 223) * C99 standard (ISO/IEC 9899:1999): + 7.11/2 Localization <locale.h> (p: 204) * C89/C90 standard (ISO/IEC 9899:1990): + 4.4 LOCALIZATION <locale.h> ### See also | | | | --- | --- | | [localeconv](localeconv "c/locale/localeconv") | queries numeric and monetary formatting details of the current locale (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/locale/lconv "cpp/locale/lconv") for `lconv` |
programming_docs
c malloc malloc ====== | Defined in header `<stdlib.h>` | | | | --- | --- | --- | | ``` void* malloc( size_t size ); ``` | | | Allocates `size` bytes of uninitialized storage. If allocation succeeds, returns a pointer that is suitably aligned for any object type with [fundamental alignment](../language/object#Alignment "c/language/object"). If `size` is zero, the behavior of `malloc` is implementation-defined. For example, a null pointer may be returned. Alternatively, a non-null pointer may be returned; but such a pointer should not be [dereferenced](../language/operator_member_access "c/language/operator member access"), and should be passed to `[free](free "c/memory/free")` to avoid memory leaks. | | | | --- | --- | | `malloc` is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage. A previous call to `[free](free "c/memory/free")` or `[realloc](realloc "c/memory/realloc")` that deallocates a region of memory *synchronizes-with* a call to `malloc` that allocates the same or a part of the same region of memory. This synchronization occurs after any access to the memory by the deallocating function and before any access to the memory by `malloc`. There is a single total order of all allocation and deallocation functions operating on each particular region of memory. | (since C11) | ### Parameters | | | | | --- | --- | --- | | size | - | number of bytes to allocate | ### Return value On success, returns the pointer to the beginning of newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with `[free()](free "c/memory/free")` or `[realloc()](realloc "c/memory/realloc")`. On failure, returns a null pointer. ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int *p1 = malloc(4*sizeof(int)); // allocates enough for an array of 4 int int *p2 = malloc(sizeof(int[4])); // same, naming the type directly int *p3 = malloc(4*sizeof *p3); // same, without repeating the type name if(p1) { for(int n=0; n<4; ++n) // populate the array p1[n] = n*n; for(int n=0; n<4; ++n) // print it back out printf("p1[%d] == %d\n", n, p1[n]); } free(p1); free(p2); free(p3); } ``` Output: ``` p1[0] == 0 p1[1] == 1 p1[2] == 4 p1[3] == 9 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.22.3.4 The malloc function (p: 254) * C11 standard (ISO/IEC 9899:2011): + 7.22.3.4 The malloc function (p: 349) * C99 standard (ISO/IEC 9899:1999): + 7.20.3.3 The malloc function (p: 314) * C89/C90 standard (ISO/IEC 9899:1990): + 4.10.3.3 The malloc function ### See also | | | | --- | --- | | [free](free "c/memory/free") | deallocates previously allocated memory (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/memory/c/malloc "cpp/memory/c/malloc") for `malloc` | c free free ==== | Defined in header `<stdlib.h>` | | | | --- | --- | --- | | ``` void free( void* ptr ); ``` | | | Deallocates the space previously allocated by `[malloc()](malloc "c/memory/malloc")`, `[calloc()](calloc "c/memory/calloc")`, `aligned_alloc()`, (since C11) or `[realloc()](realloc "c/memory/realloc")`. If `ptr` is a null pointer, the function does nothing. The behavior is undefined if the value of `ptr` does not equal a value returned earlier by `[malloc()](malloc "c/memory/malloc")`, `[calloc()](calloc "c/memory/calloc")`, `[realloc()](realloc "c/memory/realloc")`, or `aligned_alloc()` (since C11). The behavior is undefined if the memory area referred to by `ptr` has already been deallocated, that is, `free()` or `[realloc()](realloc "c/memory/realloc")` has already been called with `ptr` as the argument and no calls to `[malloc()](malloc "c/memory/malloc")`, `[calloc()](calloc "c/memory/calloc")`, `[realloc()](realloc "c/memory/realloc")`, or `aligned_alloc()` (since C11) resulted in a pointer equal to `ptr` afterwards. The behavior is undefined if after `free()` returns, an access is made through the pointer `ptr` (unless another allocation function happened to result in a pointer value equal to `ptr`). | | | | --- | --- | | `free` is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage. A call to `free` that deallocates a region of memory *synchronizes-with* a call to any subsequent allocation function that allocates the same or a part of the same region of memory. This synchronization occurs after any access to the memory by the deallocating function and before any access to the memory by the allocation function. There is a single total order of all allocation and deallocation functions operating on each particular region of memory. | (since C11) | ### Parameters | | | | | --- | --- | --- | | ptr | - | pointer to the memory to deallocate | ### Return value (none). ### Notes The function accepts (and does nothing with) the null pointer to reduce the amount of special-casing. Whether allocation succeeds or not, the pointer returned by an allocation function can be passed to `free()`. ### Example ``` #include <stdlib.h> int main(void) { int *p1 = malloc(10*sizeof *p1); free(p1); // every allocated pointer must be freed int *p2 = calloc(10, sizeof *p2); int *p3 = realloc(p2, 1000*sizeof *p3); if(p3) // p3 not null means p2 was freed by realloc free(p3); else // p3 null means p2 was not freed free(p2); } ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.22.3.3 The free function (p: 254) * C11 standard (ISO/IEC 9899:2011): + 7.22.3.3 The free function (p: 348) * C99 standard (ISO/IEC 9899:1999): + 7.20.3.2 The free function (p: 313) * C89/C90 standard (ISO/IEC 9899:1990): + 4.10.3.2 The free function ### See also | | | | --- | --- | | [malloc](malloc "c/memory/malloc") | allocates memory (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/memory/c/free "cpp/memory/c/free") for `free` | c realloc realloc ======= | Defined in header `<stdlib.h>` | | | | --- | --- | --- | | ``` void *realloc( void *ptr, size_t new_size ); ``` | | | Reallocates the given area of memory. It must be previously allocated by `[malloc()](malloc "c/memory/malloc")`, `[calloc()](calloc "c/memory/calloc")` or `realloc()` and not yet freed with a call to `[free](free "c/memory/free")` or `realloc`. Otherwise, the results are undefined. The reallocation is done by either: a) expanding or contracting the existing area pointed to by `ptr`, if possible. The contents of the area remain unchanged up to the lesser of the new and old sizes. If the area is expanded, the contents of the new part of the array are undefined. b) allocating a new memory block of size `new_size` bytes, copying memory area with size equal the lesser of the new and the old sizes, and freeing the old block. If there is not enough memory, the old memory block is not freed and null pointer is returned. If `ptr` is `[NULL](../types/null "c/types/NULL")`, the behavior is the same as calling `[malloc](http://en.cppreference.com/w/c/memory/malloc)(new_size)`. Otherwise, | | | | --- | --- | | if `new_size` is zero, the behavior is implementation defined (null pointer may be returned (in which case the old memory block may or may not be freed), or some non-null pointer may be returned that may not be used to access storage). Such usage is deprecated (via [DR 400](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_400)). (since C17). | (until C23) | | if `new_size` is zero, the behavior is undefined. | (since C23) | | | | | --- | --- | | `realloc` is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage. A previous call to `[free](free "c/memory/free")` or `realloc` that deallocates a region of memory *synchronizes-with* a call to any allocation function, including `realloc` that allocates the same or a part of the same region of memory. This synchronization occurs after any access to the memory by the deallocating function and before any access to the memory by `realloc`. There is a single total order of all allocation and deallocation functions operating on each particular region of memory. | (since C11) | ### Parameters | | | | | --- | --- | --- | | ptr | - | pointer to the memory area to be reallocated | | new\_size | - | new size of the array in bytes | ### Return value On success, returns the pointer to the beginning of newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with `[free()](free "c/memory/free")` or `realloc()`. The original pointer `ptr` is invalidated and any access to it is undefined behavior (even if reallocation was in-place). On failure, returns a null pointer. The original pointer `ptr` remains valid and may need to be deallocated with `[free()](free "c/memory/free")` or `realloc()`. ### Notes Originally (in C89), support for zero size was added to accommodate code such as. ``` OBJ *p = calloc(0, sizeof(OBJ)); // "zero-length" placeholder ... while(1) { p = realloc(p, c * sizeof(OBJ)); // reallocations until size settles ... // code that may change c or break out of loop } ``` ### Example ``` #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> void print_storage_info(const int* next, const int* prev, int ints) { if (next) { printf("%s location: %p. Size: %d ints (%ld bytes).\n", (next != prev ? "New" : "Old"), (void*)next, ints, ints * sizeof(int)); } else { printf("Allocation failed.\n"); } } int main(void) { const int pattern[] = {1, 2, 3, 4, 5, 6, 7, 8}; const int pattern_size = sizeof pattern / sizeof(int); int *next = NULL, *prev = NULL; if ((next = (int*)malloc(pattern_size * sizeof *next))) { // allocates an array memcpy(next, pattern, sizeof pattern); // fills the array print_storage_info(next, prev, pattern_size); } else { return EXIT_FAILURE; } // Reallocate in cycle using the following values as a new storage size. const int realloc_size[] = {10, 12, 512, 32768, 65536, 32768}; for (int i = 0; i != sizeof realloc_size / sizeof(int); ++i) { if ((next = (int*)realloc(prev = next, realloc_size[i] * sizeof(int)))) { print_storage_info(next, prev, realloc_size[i]); assert(!memcmp(next, pattern, sizeof pattern)); // is pattern held } else { // if realloc failed, the original pointer needs to be freed free(prev); return EXIT_FAILURE; } } free(next); // finally, frees the storage return EXIT_SUCCESS; } ``` Possible output: ``` New location: 0x144c010. Size: 8 ints (32 bytes). Old location: 0x144c010. Size: 10 ints (40 bytes). New location: 0x144c450. Size: 12 ints (48 bytes). Old location: 0x144c450. Size: 512 ints (2048 bytes). Old location: 0x144c450. Size: 32768 ints (131072 bytes). New location: 0x7f490c5bd010. Size: 65536 ints (262144 bytes). Old location: 0x7f490c5bd010. Size: 32768 ints (131072 bytes). ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.22.3.5 The realloc function (p: 254) * C11 standard (ISO/IEC 9899:2011): + 7.22.3.5 The realloc function (p: 349) * C99 standard (ISO/IEC 9899:1999): + 7.20.3.4 The realloc function (p: 314) * C89/C90 standard (ISO/IEC 9899:1990): + 4.10.3.4 The realloc function ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/memory/c/realloc "cpp/memory/c/realloc") for `realloc` | c aligned_alloc aligned\_alloc ============== | Defined in header `<stdlib.h>` | | | | --- | --- | --- | | ``` void *aligned_alloc( size_t alignment, size_t size ); ``` | | (since C11) | Allocate `size` bytes of uninitialized storage whose alignment is specified by `alignment`. The `size` parameter must be an integral multiple of `alignment`. `aligned_alloc` is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage. A previous call to `[free](free "c/memory/free")` or `[realloc](realloc "c/memory/realloc")` that deallocates a region of memory *synchronizes-with* a call to `aligned_alloc` that allocates the same or a part of the same region of memory. This synchronization occurs after any access to the memory by the deallocating function and before any access to the memory by `aligned_alloc`. There is a single total order of all allocation and deallocation functions operating on each particular region of memory. ### Parameters | | | | | --- | --- | --- | | alignment | - | specifies the alignment. Must be a valid alignment supported by the implementation. | | size | - | number of bytes to allocate. An integral multiple of `alignment` | ### Return value On success, returns the pointer to the beginning of newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with `[free()](free "c/memory/free")` or `[realloc()](realloc "c/memory/realloc")`. On failure, returns a null pointer. ### Notes Passing a `size` which is not an integral multiple of `alignment` or an `alignment` which is not valid or not supported by the implementation causes the function to fail and return a null pointer (C11, as published, specified undefined behavior in this case, this was corrected by DR 460). Removal of size restrictions to make it possible to allocate small objects at restrictive alignment boundaries (similar to [`alignas`](../language/_alignas "c/language/ Alignas")) has been proposed by [n2072](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2072.htm). As an example of the "supported by the implementation" requirement, POSIX function [`posix_memalign`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html) accepts any `alignment` that is a power of two and a multiple of `sizeof(void *)`, and POSIX-based implementations of `aligned_alloc` inherit this requirements. Regular `[malloc](malloc "c/memory/malloc")` aligns memory suitable for any object type (which, in practice, means that it is aligned to `alignof([max\_align\_t](http://en.cppreference.com/w/c/types/max_align_t))`). `aligned_alloc` is useful for over-aligned allocations, such as to SSE, cache line, or VM page boundary. ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int *p1 = malloc(10*sizeof *p1); printf("default-aligned addr: %p\n", (void*)p1); free(p1); int *p2 = aligned_alloc(1024, 1024*sizeof *p2); printf("1024-byte aligned addr: %p\n", (void*)p2); free(p2); } ``` Possible output: ``` default-aligned addr: 0x1e40c20 1024-byte aligned addr: 0x1e41000 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.22.3.1 The aligned\_alloc function (p: 253) * C11 standard (ISO/IEC 9899:2011): + 7.22.3.1 The aligned\_alloc function (p: 347-348) ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/memory/c/aligned_alloc "cpp/memory/c/aligned alloc") for `aligned_alloc` | c calloc calloc ====== | Defined in header `<stdlib.h>` | | | | --- | --- | --- | | ``` void* calloc( size_t num, size_t size ); ``` | | | Allocates memory for an array of `num` objects of `size` and initializes all bytes in the allocated storage to zero. If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any object type. If `size` is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage). | | | | --- | --- | | `calloc` is thread-safe: it behaves as though only accessing the memory locations visible through its argument, and not any static storage. A previous call to `[free](free "c/memory/free")` or `[realloc](realloc "c/memory/realloc")` that deallocates a region of memory *synchronizes-with* a call to `calloc` that allocates the same or a part of the same region of memory. This synchronization occurs after any access to the memory by the deallocating function and before any access to the memory by `calloc`. There is a single total order of all allocation and deallocation functions operating on each particular region of memory. | (since C11) | ### Parameters | | | | | --- | --- | --- | | num | - | number of objects | | size | - | size of each object | ### Return value On success, returns the pointer to the beginning of newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with `[free()](free "c/memory/free")` or `[realloc()](realloc "c/memory/realloc")`. On failure, returns a null pointer. ### Notes Due to the alignment requirements, the number of allocated bytes is not necessarily equal to `num*size`. Initialization to all bits zero does not guarantee that a floating-point or a pointer would be initialized to 0.0 and the null pointer value, respectively (although that is true on all common platforms). Originally (in C89), support for zero size was added to accommodate code such as. ``` OBJ *p = calloc(0, sizeof(OBJ)); // "zero-length" placeholder ... while(1) { p = realloc(p, c * sizeof(OBJ)); // reallocations until size settles ... // code that may change c or break out of loop } ``` ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int *p1 = calloc(4, sizeof(int)); // allocate and zero out an array of 4 int int *p2 = calloc(1, sizeof(int[4])); // same, naming the array type directly int *p3 = calloc(4, sizeof *p3); // same, without repeating the type name if(p2) { for(int n=0; n<4; ++n) // print the array printf("p2[%d] == %d\n", n, p2[n]); } free(p1); free(p2); free(p3); } ``` Output: ``` p2[0] == 0 p2[1] == 0 p2[2] == 0 p2[3] == 0 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.22.3.2 The calloc function (p: 253) * C11 standard (ISO/IEC 9899:2011): + 7.22.3.2 The calloc function (p: 348) * C99 standard (ISO/IEC 9899:1999): + 7.20.3.1 The calloc function (p: 313) * C89/C90 standard (ISO/IEC 9899:1990): + 4.10.3.1 The calloc function ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/memory/c/calloc "cpp/memory/c/calloc") for `calloc` | c strftime strftime ======== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` size_t strftime( char * str, size_t count, const char * format, const struct tm * time ); ``` | | (until C99) | | ``` size_t strftime( char *restrict str, size_t count, const char *restrict format, const struct tm *restrict time ); ``` | | (since C99) | Converts the date and time information from a given calendar time `time` to a null-terminated multibyte character string `str` according to [format string](#Format_string) `format`. Up to `count` bytes are written. ### Parameters | | | | | --- | --- | --- | | str | - | pointer to the first element of the char array for output | | count | - | maximum number of bytes to write | | format | - | pointer to a null-terminated multibyte character string specifying the [format of conversion](#Format_string) | | time | - | pointer to a struct tm object specifying the time to format | ### Format string The format string consists of zero or more conversion specifiers and ordinary characters (except `%`). All ordinary characters, including the terminating null character, are copied to the output string without modification. Each conversion specification begins with `%` character, optionally followed by `E` or `O` modifier (ignored if unsupported by the locale), followed by the character that determines the behavior of the specifier. The following format specifiers are available: | Conversion specifier | Explanation | Used fields | | --- | --- | --- | | `%` | writes literal `%`. The full conversion specification must be `%%`. | | | `n`(C99) | writes newline character | | | `t`(C99) | writes horizontal tab character | | | Year | | `Y` | writes **year** as a decimal number, e.g. 2017 | `tm_year` | | `EY`(C99) | writes **year** in the alternative representation, e.g.平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja\_JP locale | `tm_year` | | `y` | writes last 2 digits of **year** as a decimal number (range `[00,99]`) | `tm_year` | | `Oy`(C99) | writes last 2 digits of **year** using the alternative numeric system, e.g. 十一 instead of 11 in ja\_JP locale | `tm_year` | | `Ey`(C99) | writes **year** as offset from locale's alternative calendar period `%EC` (locale-dependent) | `tm_year` | | `C`(C99) | writes first 2 digits of **year** as a decimal number (range `[00,99]`) | `tm_year` | | `EC`(C99) | writes name of the **base year (period)** in the locale's alternative representation, e.g. 平成 (Heisei era) in ja\_JP | `tm_year` | | `G`(C99) | writes **ISO 8601 week-based year**, i.e. the year that contains the specified week. In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:* Includes January 4 * Includes first Thursday of the year | `tm_year`, `tm_wday`, `tm_yday` | | `g`(C99) | writes last 2 digits of **ISO 8601 week-based year**, i.e. the year that contains the specified week (range `[00,99]`). In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:* Includes January 4 * Includes first Thursday of the year | `tm_year`, `tm_wday`, `tm_yday` | | Month | | `b` | writes **abbreviated month** name, e.g. `Oct` (locale dependent) | `tm_mon` | | `Ob`(C23) | writes **abbreviated month** name in the locale's alternative representation | `tm_mon` | | `h`(C99) | synonym of `b` | `tm_mon` | | `B` | writes **full month** name, e.g. `October` (locale dependent) | `tm_mon` | | `OB`(C23) | writes appropriate **full month** name in the locale's alternative representation | `tm_mon` | | `m` | writes **month** as a decimal number (range `[01,12]`) | `tm_mon` | | `Om`(C99) | writes **month** using the alternative numeric system, e.g. 十二 instead of 12 in ja\_JP locale | `tm_mon` | | Week | | `U` | writes **week of the year** as a decimal number (Sunday is the first day of the week) (range `[00,53]`) | `tm_year`, `tm_wday`, `tm_yday` | | `OU`(C99) | writes **week of the year**, as by `%U`, using the alternative numeric system, e.g. 五十二 instead of 52 in ja\_JP locale | `tm_year`, `tm_wday`, `tm_yday` | | `W` | writes **week of the year** as a decimal number (Monday is the first day of the week) (range `[00,53]`) | `tm_year`, `tm_wday`, `tm_yday` | | `OW`(C99) | writes **week of the year**, as by `%W`, using the alternative numeric system, e.g. 五十二 instead of 52 in ja\_JP locale | `tm_year`, `tm_wday`, `tm_yday` | | `V`(C99) | writes **ISO 8601 week of the year** (range `[01,53]`). In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:* Includes January 4 * Includes first Thursday of the year | `tm_year`, `tm_wday`, `tm_yday` | | `OV`(C99) | writes **week of the year**, as by `%V`, using the alternative numeric system, e.g. 五十二 instead of 52 in ja\_JP locale | `tm_year`, `tm_wday`, `tm_yday` | | Day of the year/month | | `j` | writes **day of the year** as a decimal number (range `[001,366]`) | `tm_yday` | | `d` | writes **day of the month** as a decimal number (range `[01,31]`) | `tm_mday` | | `Od`(C99) | writes zero-based **day of the month** using the alternative numeric system, e.g 二十七 instead of 27 in ja\_JP locale Single character is preceded by a space. | `tm_mday` | | `e`(C99) | writes **day of the month** as a decimal number (range `[1,31]`). Single digit is preceded by a space. | `tm_mday` | | `Oe`(C99) | writes one-based **day of the month** using the alternative numeric system, e.g. 二十七 instead of 27 in ja\_JP locale Single character is preceded by a space. | `tm_mday` | | Day of the week | | `a` | writes **abbreviated weekday** name, e.g. `Fri` (locale dependent) | `tm_wday` | | `A` | writes **full weekday** name, e.g. `Friday` (locale dependent) | `tm_wday` | | `w` | writes **weekday** as a decimal number, where Sunday is `0` (range `[0-6]`) | `tm_wday` | | `Ow`(C99) | writes **weekday**, where Sunday is `0`, using the alternative numeric system, e.g. 二 instead of 2 in ja\_JP locale | `tm_wday` | | `u`(C99) | writes **weekday** as a decimal number, where Monday is `1` (ISO 8601 format) (range `[1-7]`) | `tm_wday` | | `Ou`(C99) | writes **weekday**, where Monday is `1`, using the alternative numeric system, e.g. 二 instead of 2 in ja\_JP locale | `tm_wday` | | Hour, minute, second | | `H` | writes **hour** as a decimal number, 24 hour clock (range `[00-23]`) | `tm_hour` | | `OH`(C99) | writes **hour** from 24-hour clock using the alternative numeric system, e.g. 十八 instead of 18 in ja\_JP locale | `tm_hour` | | `I` | writes **hour** as a decimal number, 12 hour clock (range `[01,12]`) | `tm_hour` | | `OI`(C99) | writes **hour** from 12-hour clock using the alternative numeric system, e.g. 六 instead of 06 in ja\_JP locale | `tm_hour` | | `M` | writes **minute** as a decimal number (range `[00,59]`) | `tm_min` | | `OM`(C99) | writes **minute** using the alternative numeric system, e.g. 二十五 instead of 25 in ja\_JP locale | `tm_min` | | `S` | writes **second** as a decimal number (range `[00,60]`) | `tm_sec` | | `OS`(C99) | writes **second** using the alternative numeric system, e.g. 二十四 instead of 24 in ja\_JP locale | `tm_sec` | | Other | | `c` | writes **standard date and time string**, e.g. `Sun Oct 17 04:41:13 2010` (locale dependent) | all | | `Ec`(C99) | writes **alternative date and time string**, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja\_JP locale | all | | `x` | writes localized **date representation** (locale dependent) | all | | `Ex`(C99) | writes **alternative date representation**, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja\_JP locale | all | | `X` | writes localized **time representation**, e.g. 18:40:20 or 6:40:20 PM (locale dependent) | all | | `EX`(C99) | writes **alternative time representation** (locale dependent) | all | | `D`(C99) | equivalent to **"%m/%d/%y"** | `tm_mon`, `tm_mday`, `tm_year` | | `F`(C99) | equivalent to **"%Y-%m-%d"** (the ISO 8601 date format) | `tm_mon`, `tm_mday`, `tm_year` | | `r`(C99) | writes localized **12-hour clock** time (locale dependent) | `tm_hour`, `tm_min`, `tm_sec` | | `R`(C99) | equivalent to **"%H:%M"** | `tm_hour`, `tm_min` | | `T`(C99) | equivalent to **"%H:%M:%S"** (the ISO 8601 time format) | `tm_hour`, `tm_min`, `tm_sec` | | `p` | writes localized **a.m. or p.m.** (locale dependent) | `tm_hour` | | `z`(C99) | writes **offset from UTC** in the ISO 8601 format (e.g. `-0430`), or no characters if the time zone information is not available | `tm_isdst` | | `Z` | writes locale-dependent **time zone name or abbreviation**, or no characters if the time zone information is not available | `tm_isdst` | ### Return value The number of bytes written into the character array pointed to by `str` not including the terminating `'\0'` on success. If `count` was reached before the entire string could be stored, `​0​` is returned and the contents are undefined. ### Example ``` #include <stdio.h> #include <time.h> #include <locale.h> int main(void) { char buff[70]; struct tm my_time = { .tm_year=112, // = year 2012 .tm_mon=9, // = 10th month .tm_mday=9, // = 9th day .tm_hour=8, // = 8 hours .tm_min=10, // = 10 minutes .tm_sec=20 // = 20 secs }; if (strftime(buff, sizeof buff, "%A %c", &my_time)) { puts(buff); } else { puts("strftime failed"); } setlocale(LC_TIME, "el_GR.utf8"); if (strftime(buff, sizeof buff, "%A %c", &my_time)) { puts(buff); } else { puts("strftime failed"); } } ``` Possible output: ``` Sunday Sun Oct 9 08:10:20 2012 Κυριακή Κυρ 09 Οκτ 2012 08:10:20 πμ EST ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.3.5 The strftime function (p: 288-291) * C11 standard (ISO/IEC 9899:2011): + 7.27.3.5 The strftime function (p: 394-397) * C99 standard (ISO/IEC 9899:1999): + 7.23.3.5 The strftime function (p: 343-347) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.3.5 The strftime function ### See also | | | | --- | --- | | [asctimeasctime\_s](asctime "c/chrono/asctime") (deprecated in C23)(C11) | converts a `[tm](tm "c/chrono/tm")` object to a textual representation (function) | | [ctimectime\_s](ctime "c/chrono/ctime") (deprecated in C23)(C11) | converts a `[time\_t](time_t "c/chrono/time t")` object to a textual representation (function) | | [wcsftime](wcsftime "c/chrono/wcsftime") (C95) | converts a `[tm](tm "c/chrono/tm")` object to custom wide string textual representation (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/strftime "cpp/chrono/c/strftime") for `strftime` |
programming_docs
c difftime difftime ======== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` double difftime( time_t time_end, time_t time_beg ); ``` | | | Computes difference between two calendar times as `[time\_t](time_t "c/chrono/time t")` objects (`time_end - time_beg`) in seconds. If `time_end` refers to time point before `time_beg` then the result is negative. ### Parameters | | | | | --- | --- | --- | | time\_beg, time\_end | - | times to compare | ### Return value Difference between two times in seconds. ### Notes On POSIX systems, `[time\_t](time_t "c/chrono/time t")` is measured in seconds, and `difftime` is equivalent to arithmetic subtraction, but C and C++ allow fractional units for `[time\_t](time_t "c/chrono/time t")`. ### Example The following program computes the number of seconds that have passed since the beginning of the month. ``` #include <stdio.h> #include <time.h> int main(void) { time_t now; time(&now); struct tm beg; beg = *localtime(&now); // set beg to the beginning of the month beg.tm_hour = 0; beg.tm_min = 0; beg.tm_sec = 0; beg.tm_mday = 1; double seconds = difftime(now, mktime(&beg)); printf("%.f seconds have passed since the beginning of the month.\n", seconds); return 0; } ``` Output: ``` 1937968 seconds have passed since the beginning of the month. ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.2.2 The difftime function (p: 285) * C11 standard (ISO/IEC 9899:2011): + 7.27.2.2 The difftime function (p: 390) * C99 standard (ISO/IEC 9899:1999): + 7.23.2.2 The difftime function (p: 338) * C89/C90 standard (ISO/IEC 9899:1990): + 7.12.2.2 The difftime function (p: 171) ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/difftime "cpp/chrono/c/difftime") for `difftime` | c gmtime, gmtime_r, gmtime_s gmtime, gmtime\_r, gmtime\_s ============================ | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` struct tm *gmtime ( const time_t *timer ); ``` | (1) | | | ``` struct tm *gmtime_r( const time_t *timer, struct tm *buf ); ``` | (2) | (since C23) | | ``` struct tm *gmtime_s( const time_t *restrict timer, struct tm *restrict buf ); ``` | (3) | (since C11) | 1) Converts given time since epoch (a `[time\_t](time_t "c/chrono/time t")` value pointed to by `timer`) into calendar time, expressed in Coordinated Universal Time (UTC) in the [`struct tm`](tm "c/chrono/tm") format. The result is stored in static storage and a pointer to that static storage is returned. 2) Same as (1), except that the function uses user-provided storage `buf` for the result. 3) Same as (1), except that the function uses user-provided storage `buf` for the result and that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `timer` or `buf` is a null pointer As with all bounds-checked functions, `gmtime_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<time.h>`. ### Parameters | | | | | --- | --- | --- | | timer | - | pointer to a `[time\_t](time_t "c/chrono/time t")` object to convert | | buf | - | pointer to a `struct [tm](http://en.cppreference.com/w/c/chrono/tm)` object to store the result | ### Return value 1) pointer to a static internal `[tm](tm "c/chrono/tm")` object on success, or null pointer otherwise. The structure may be shared between `gmtime`, `[localtime](localtime "c/chrono/localtime")`, and `[ctime](ctime "c/chrono/ctime")` and may be overwritten on each invocation. 2-3) copy of the `buf` pointer, or null pointer on error (which may be a runtime constraint violation or a failure to convert the specified time to UTC) ### Notes `gmtime` may not be thread-safe. POSIX requires that `gmtime` and `gmtime_r` set `[errno](../error/errno "c/error/errno")` to `[EOVERFLOW](../error/errno_macros "c/error/errno macros")` if they fail because the argument is too large. The implementation of `gmtime_s` in [Microsoft CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/gmtime-s-gmtime32-s-gmtime64-s?view=vs-2019) is incompatible with the C standard since it has reversed parameter order. ### Example ``` #define __STDC_WANT_LIB_EXT1__ 1 #define _XOPEN_SOURCE // for putenv #include <time.h> #include <stdio.h> #include <stdlib.h> // for putenv int main(void) { time_t t = time(NULL); printf("UTC: %s", asctime(gmtime(&t))); printf("local: %s", asctime(localtime(&t))); // POSIX-specific putenv("TZ=Asia/Singapore"); printf("Singapore: %s", asctime(localtime(&t))); #ifdef __STDC_LIB_EXT1__ struct tm buf; char str[26]; asctime_s(str,sizeof str,gmtime_s(&t, &buf)); printf("UTC: %s", str); asctime_s(str,sizeof str,localtime_s(&t, &buf)); printf("local: %s", str); #endif } ``` Possible output: ``` UTC: Fri Sep 15 14:22:05 2017 local: Fri Sep 15 14:22:05 2017 Singapore: Fri Sep 15 22:22:05 2017 UTC: Fri Sep 15 14:22:05 2017 local: Fri Sep 15 14:22:05 2017 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.3.3 The gmtime function (p: 288) + K.3.8.2.3 The gmtime\_s function (p: 454-455) * C11 standard (ISO/IEC 9899:2011): + 7.27.3.3 The gmtime function (p: 393-394) + K.3.8.2.3 The gmtime\_s function (p: 626-627) * C99 standard (ISO/IEC 9899:1999): + 7.23.3.3 The gmtime function (p: 343) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.3.3 The gmtime function ### See also | | | | --- | --- | | [localtimelocaltime\_rlocaltime\_s](localtime "c/chrono/localtime") (C23)(C11) | converts time since epoch to calendar time expressed as local time (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/gmtime "cpp/chrono/c/gmtime") for `gmtime` | c time_t time\_t ======= | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` typedef /* unspecified */ time_t; ``` | | | Arithmetic (until C11) Real (since C11) type capable of representing times. Although not defined by the C standard, this is almost always an integral value holding the number of seconds (not counting leap seconds) since 00:00, Jan 1 1970 UTC, corresponding to [POSIX time](https://en.wikipedia.org/wiki/Unix_time "enwiki:Unix time"). ### Notes The standard uses the term *calendar time* when referring to a value of type `time_t`. ### Example Show the start of the epoch. ``` #include <stdio.h> #include <time.h> #include <stdint.h> int main(void) { time_t epoch = 0; printf("%jd seconds since the epoch began\n", (intmax_t)epoch); printf("%s", asctime(gmtime(&epoch))); } ``` Possible output: ``` 0 seconds since the epoch began Thu Jan 1 00:00:00 1970 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.1/3 Components of time (p: 284) * C11 standard (ISO/IEC 9899:2011): + 7.27.1/3 Components of time (p: 388) * C99 standard (ISO/IEC 9899:1999): + 7.23.1/3 Components of time (p: 338) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.1 Components of time ### See also | | | | --- | --- | | [time](time "c/chrono/time") | returns the current calendar time of the system as time since epoch (function) | | [localtimelocaltime\_rlocaltime\_s](localtime "c/chrono/localtime") (C23)(C11) | converts time since epoch to calendar time expressed as local time (function) | | [gmtimegmtime\_rgmtime\_s](gmtime "c/chrono/gmtime") (C23)(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/time_t "cpp/chrono/c/time t") for `time_t` | c ctime, ctime_s ctime, ctime\_s =============== | Defined in header `<time.h>` | | | | --- | --- | --- | | | (1) | | | ``` char* ctime( const time_t* timer ); ``` | (until C23) | | ``` [[deprecated]] char* ctime( const time_t* timer ); ``` | (since C23) | | ``` errno_t ctime_s( char *buf, rsize_t bufsz, const time_t* timer ); ``` | (2) | (since C11) | 1) Converts given time since epoch to a calendar local time and then to a textual representation, as if by calling `[asctime](http://en.cppreference.com/w/c/chrono/asctime)([localtime](http://en.cppreference.com/w/c/chrono/localtime)(timer))` or `[asctime](http://en.cppreference.com/w/c/chrono/asctime)(localtime_r(timer, &(struct [tm](http://en.cppreference.com/w/c/chrono/tm)){0}))` (since C23). This function is deprecated and should not be used in new code. (since C23) 2) Same as (1), except that the function is equivalent to `asctime_s(buf, bufsz, localtime_s(timer, &(struct [tm](http://en.cppreference.com/w/c/chrono/tm)){0}))`, and the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `buf` or `timer` is a null pointer * `bufsz` is less than `26` or greater than `RSIZE_MAX` As with all bounds-checked functions, `ctime_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<time.h>`. The resulting string has the following format: ``` Www Mmm dd hh:mm:ss yyyy\n ``` * `Www` - the day of the week (one of `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat`, `Sun`). * `Mmm` - the month (one of `Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov`, `Dec`). * `dd` - the day of the month * `hh` - hours * `mm` - minutes * `ss` - seconds * `yyyy` - years The function does not support localization. ### Parameters | | | | | --- | --- | --- | | timer | - | pointer to a `[time\_t](time_t "c/chrono/time t")` object specifying the time to print | | buf | - | pointer to the first element of a char array of size at least `bufsz` | | bufsz | - | max number of bytes to output, typically the size of the buffer pointed to by `buf` | ### Return value 1) pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between `[asctime](asctime "c/chrono/asctime")` and `ctime`, and may be overwritten on each invocation of any of those functions. 2) zero on success (in which case the string representation of time has been written out to the array pointed to by `buf`), or non-zero on failure (in which case, the terminating null character is always written to `buf[0]` unless `buf` is a null pointer or `bufsz` is zero or greater than `RSIZE_MAX`. ### Notes `ctime` returns a pointer to static data and is not thread-safe. In addition, it modifies the static `[tm](tm "c/chrono/tm")` object which may be shared with `[gmtime](gmtime "c/chrono/gmtime")` and `[localtime](localtime "c/chrono/localtime")`. POSIX marks this function obsolete and recommends `[strftime](strftime "c/chrono/strftime")` instead. The C standard also recommends `[strftime](strftime "c/chrono/strftime")` instead of `ctime` and `ctime_s` because `strftime` is more flexible and locale-sensitive. The behavior of `ctime` is undefined for the values of `[time\_t](time_t "c/chrono/time t")` that result in the string longer than 25 characters (e.g. year 10000). ### Example ``` #define __STDC_WANT_LIB_EXT1__ 1 #include <time.h> #include <stdio.h> int main(void) { time_t result = time(NULL); printf("%s", ctime(&result)); #ifdef __STDC_LIB_EXT1__ char str[26]; ctime_s(str,sizeof str,&result); printf("%s", str); #endif } ``` Possible output: ``` Tue May 26 21:51:03 2015 Tue May 26 21:51:03 2015 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.3.2 The ctime function (p: 287-288) + K.3.8.2.2 The ctime\_s function (p: 454) * C11 standard (ISO/IEC 9899:2011): + 7.27.3.2 The ctime function (p: 393) + K.3.8.2.2 The ctime\_s function (p: 626) * C99 standard (ISO/IEC 9899:1999): + 7.23.3.2 The ctime function (p: 342) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.3.2 The ctime function ### See also | | | | --- | --- | | [asctimeasctime\_s](asctime "c/chrono/asctime") (deprecated in C23)(C11) | converts a `[tm](tm "c/chrono/tm")` object to a textual representation (function) | | [strftime](strftime "c/chrono/strftime") | converts a `[tm](tm "c/chrono/tm")` object to custom textual representation (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/ctime "cpp/chrono/c/ctime") for `ctime` | c mktime mktime ====== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` time_t mktime( struct tm *arg ); ``` | | | Renormalizes local calendar time expressed as a `[struct tm](tm "c/chrono/tm")` object and also converts it to time since epoch as a `[time\_t](time_t "c/chrono/time t")` object. `arg->tm_wday` and `arg->tm_yday` are ignored. The values in `arg` are not checked for being out of range. A negative value of `arg->tm_isdst` causes `mktime` to attempt to determine if Daylight Saving Time was in effect in the specified time. If the conversion to `time_t` is successful, the `arg` object is modified. All fields of `arg` are updated to fit their proper ranges. `arg->tm_wday` and `arg->tm_yday` are recalculated using information available in other fields. ### Parameters | | | | | --- | --- | --- | | arg | - | pointer to a `[tm](tm "c/chrono/tm")` object specifying local calendar time to convert | ### Return value time since epoch as a `[time\_t](time_t "c/chrono/time t")` object on success, or `-1` if `arg` cannot be represented as a `[time\_t](time_t "c/chrono/time t")` object (POSIX also requires `EOVERFLOW` to be stored in `[errno](../error/errno "c/error/errno")` in this case). ### Notes If the `struct [tm](http://en.cppreference.com/w/c/chrono/tm)` object was obtained from POSIX [`strptime`](http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html) or equivalent function, the value of `tm_isdst` is indeterminate, and needs to be set explicitly before calling `mktime`. ### Example ``` #define _POSIX_C_SOURCE 200112L // for setenv on gcc #include <stdlib.h> #include <stdio.h> #include <time.h> int main(void) { setenv("TZ", "/usr/share/zoneinfo/America/New_York", 1); // POSIX-specific struct tm tm = *localtime(&(time_t){time(NULL)}); printf("Today is %s", asctime(&tm)); printf("(DST is %s)\n", tm.tm_isdst ? "in effect" : "not in effect"); tm.tm_mon -= 100; // tm_mon is now outside its normal range mktime(&tm); // tm_isdst is not set to -1; today's DST status is used printf("100 months ago was %s", asctime(&tm)); printf("(DST was %s)\n", tm.tm_isdst ? "in effect" : "not in effect"); } ``` Possible output: ``` Today is Fri Apr 22 11:53:36 2016 (DST is in effect) 100 months ago was Sat Dec 22 10:53:36 2007 (DST was not in effect) ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.2.3 The mktime function (p: 285-286) * C11 standard (ISO/IEC 9899:2011): + 7.27.2.3 The mktime function (p: 390-391) * C99 standard (ISO/IEC 9899:1999): + 7.23.2.3 The mktime function (p: 340-341) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.2.3 The mktime function ### See also | | | | --- | --- | | [localtimelocaltime\_rlocaltime\_s](localtime "c/chrono/localtime") (C23)(C11) | converts time since epoch to calendar time expressed as local time (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/mktime "cpp/chrono/c/mktime") for `mktime` | c wcsftime wcsftime ======== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` size_t wcsftime( wchar_t* str, size_t count, const wchar_t* format, tm* time ); ``` | | (since C95) | Converts the date and time information from a given calendar time `time` to a null-terminated wide character string `str` according to [format string](#Format_string) `format`. Up to `count` bytes are written. ### Parameters | | | | | --- | --- | --- | | str | - | pointer to the first element of the wchar\_t array for output | | count | - | maximum number of wide characters to write | | format | - | pointer to a null-terminated wide character string specifying the [format of conversion](#Format_string) | ### Format string The format string consists of zero or more conversion specifiers and ordinary characters (except `%`). All ordinary characters, including the terminating null character, are copied to the output string without modification. Each conversion specification begins with `%` character, optionally followed by `E` or `O` modifier (ignored if unsupported by the locale), followed by the character that determines the behavior of the specifier. The following format specifiers are available: | Conversion specifier | Explanation | Used fields | | --- | --- | --- | | `%` | writes literal `%`. The full conversion specification must be `%%`. | | | `n`(C99) | writes newline character | | | `t`(C99) | writes horizontal tab character | | | Year | | `Y` | writes **year** as a decimal number, e.g. 2017 | `tm_year` | | `EY`(C99) | writes **year** in the alternative representation, e.g.平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja\_JP locale | `tm_year` | | `y` | writes last 2 digits of **year** as a decimal number (range `[00,99]`) | `tm_year` | | `Oy`(C99) | writes last 2 digits of **year** using the alternative numeric system, e.g. 十一 instead of 11 in ja\_JP locale | `tm_year` | | `Ey`(C99) | writes **year** as offset from locale's alternative calendar period `%EC` (locale-dependent) | `tm_year` | | `C`(C99) | writes first 2 digits of **year** as a decimal number (range `[00,99]`) | `tm_year` | | `EC`(C99) | writes name of the **base year (period)** in the locale's alternative representation, e.g. 平成 (Heisei era) in ja\_JP | `tm_year` | | `G`(C99) | writes **ISO 8601 week-based year**, i.e. the year that contains the specified week. In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:* Includes January 4 * Includes first Thursday of the year | `tm_year`, `tm_wday`, `tm_yday` | | `g`(C99) | writes last 2 digits of **ISO 8601 week-based year**, i.e. the year that contains the specified week (range `[00,99]`). In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:* Includes January 4 * Includes first Thursday of the year | `tm_year`, `tm_wday`, `tm_yday` | | Month | | `b` | writes **abbreviated month** name, e.g. `Oct` (locale dependent) | `tm_mon` | | `Ob`(C23) | writes **abbreviated month** name in the locale's alternative representation | `tm_mon` | | `h`(C99) | synonym of `b` | `tm_mon` | | `B` | writes **full month** name, e.g. `October` (locale dependent) | `tm_mon` | | `OB`(C23) | writes appropriate **full month** name in the locale's alternative representation | `tm_mon` | | `m` | writes **month** as a decimal number (range `[01,12]`) | `tm_mon` | | `Om`(C99) | writes **month** using the alternative numeric system, e.g. 十二 instead of 12 in ja\_JP locale | `tm_mon` | | Week | | `U` | writes **week of the year** as a decimal number (Sunday is the first day of the week) (range `[00,53]`) | `tm_year`, `tm_wday`, `tm_yday` | | `OU`(C99) | writes **week of the year**, as by `%U`, using the alternative numeric system, e.g. 五十二 instead of 52 in ja\_JP locale | `tm_year`, `tm_wday`, `tm_yday` | | `W` | writes **week of the year** as a decimal number (Monday is the first day of the week) (range `[00,53]`) | `tm_year`, `tm_wday`, `tm_yday` | | `OW`(C99) | writes **week of the year**, as by `%W`, using the alternative numeric system, e.g. 五十二 instead of 52 in ja\_JP locale | `tm_year`, `tm_wday`, `tm_yday` | | `V`(C99) | writes **ISO 8601 week of the year** (range `[01,53]`). In IS0 8601 weeks begin with Monday and the first week of the year must satisfy the following requirements:* Includes January 4 * Includes first Thursday of the year | `tm_year`, `tm_wday`, `tm_yday` | | `OV`(C99) | writes **week of the year**, as by `%V`, using the alternative numeric system, e.g. 五十二 instead of 52 in ja\_JP locale | `tm_year`, `tm_wday`, `tm_yday` | | Day of the year/month | | `j` | writes **day of the year** as a decimal number (range `[001,366]`) | `tm_yday` | | `d` | writes **day of the month** as a decimal number (range `[01,31]`) | `tm_mday` | | `Od`(C99) | writes zero-based **day of the month** using the alternative numeric system, e.g 二十七 instead of 27 in ja\_JP locale Single character is preceded by a space. | `tm_mday` | | `e`(C99) | writes **day of the month** as a decimal number (range `[1,31]`). Single digit is preceded by a space. | `tm_mday` | | `Oe`(C99) | writes one-based **day of the month** using the alternative numeric system, e.g. 二十七 instead of 27 in ja\_JP locale Single character is preceded by a space. | `tm_mday` | | Day of the week | | `a` | writes **abbreviated weekday** name, e.g. `Fri` (locale dependent) | `tm_wday` | | `A` | writes **full weekday** name, e.g. `Friday` (locale dependent) | `tm_wday` | | `w` | writes **weekday** as a decimal number, where Sunday is `0` (range `[0-6]`) | `tm_wday` | | `Ow`(C99) | writes **weekday**, where Sunday is `0`, using the alternative numeric system, e.g. 二 instead of 2 in ja\_JP locale | `tm_wday` | | `u`(C99) | writes **weekday** as a decimal number, where Monday is `1` (ISO 8601 format) (range `[1-7]`) | `tm_wday` | | `Ou`(C99) | writes **weekday**, where Monday is `1`, using the alternative numeric system, e.g. 二 instead of 2 in ja\_JP locale | `tm_wday` | | Hour, minute, second | | `H` | writes **hour** as a decimal number, 24 hour clock (range `[00-23]`) | `tm_hour` | | `OH`(C99) | writes **hour** from 24-hour clock using the alternative numeric system, e.g. 十八 instead of 18 in ja\_JP locale | `tm_hour` | | `I` | writes **hour** as a decimal number, 12 hour clock (range `[01,12]`) | `tm_hour` | | `OI`(C99) | writes **hour** from 12-hour clock using the alternative numeric system, e.g. 六 instead of 06 in ja\_JP locale | `tm_hour` | | `M` | writes **minute** as a decimal number (range `[00,59]`) | `tm_min` | | `OM`(C99) | writes **minute** using the alternative numeric system, e.g. 二十五 instead of 25 in ja\_JP locale | `tm_min` | | `S` | writes **second** as a decimal number (range `[00,60]`) | `tm_sec` | | `OS`(C99) | writes **second** using the alternative numeric system, e.g. 二十四 instead of 24 in ja\_JP locale | `tm_sec` | | Other | | `c` | writes **standard date and time string**, e.g. `Sun Oct 17 04:41:13 2010` (locale dependent) | all | | `Ec`(C99) | writes **alternative date and time string**, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja\_JP locale | all | | `x` | writes localized **date representation** (locale dependent) | all | | `Ex`(C99) | writes **alternative date representation**, e.g. using 平成23年 (year Heisei 23) instead of 2011年 (year 2011) in ja\_JP locale | all | | `X` | writes localized **time representation**, e.g. 18:40:20 or 6:40:20 PM (locale dependent) | all | | `EX`(C99) | writes **alternative time representation** (locale dependent) | all | | `D`(C99) | equivalent to **"%m/%d/%y"** | `tm_mon`, `tm_mday`, `tm_year` | | `F`(C99) | equivalent to **"%Y-%m-%d"** (the ISO 8601 date format) | `tm_mon`, `tm_mday`, `tm_year` | | `r`(C99) | writes localized **12-hour clock** time (locale dependent) | `tm_hour`, `tm_min`, `tm_sec` | | `R`(C99) | equivalent to **"%H:%M"** | `tm_hour`, `tm_min` | | `T`(C99) | equivalent to **"%H:%M:%S"** (the ISO 8601 time format) | `tm_hour`, `tm_min`, `tm_sec` | | `p` | writes localized **a.m. or p.m.** (locale dependent) | `tm_hour` | | `z`(C99) | writes **offset from UTC** in the ISO 8601 format (e.g. `-0430`), or no characters if the time zone information is not available | `tm_isdst` | | `Z` | writes locale-dependent **time zone name or abbreviation**, or no characters if the time zone information is not available | `tm_isdst` | ### Return value number of wide characters written into the wide character array pointed to by `str` not including the terminating `L'\0'` on success. If `count` was reached before the entire string could be stored, `​0​` is returned and the contents are undefined. ### Example ``` #include <stdio.h> #include <time.h> #include <wchar.h> #include <locale.h> int main(void) { wchar_t buff[40]; struct tm my_time = { .tm_year=112, // = year 2012 .tm_mon=9, // = 10th month .tm_mday=9, // = 9th day .tm_hour=8, // = 8 hours .tm_min=10, // = 10 minutes .tm_sec=20 // = 20 secs }; if (wcsftime(buff, sizeof buff, L"%A %c", &my_time)) { printf("%ls\n", buff); } else { puts("wcsftime failed"); } setlocale(LC_ALL, "ja_JP.utf8"); if (wcsftime(buff, sizeof buff, L"%A %c", &my_time)) { printf("%ls\n", buff); } else { puts("wcsftime failed"); } } ``` Output: ``` Sunday Sun Oct 9 08:10:20 2012 日曜日 2012年10月09日 08時10分20秒 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.29.5.1 The wcsftime function (p: 230-231) * C11 standard (ISO/IEC 9899:2011): + 7.29.5.1 The wcsftime function (p: 439-440) * C99 standard (ISO/IEC 9899:1999): + 7.24.5.1 The wcsftime function (p: 385-386) ### See also | | | | --- | --- | | [strftime](strftime "c/chrono/strftime") | converts a `[tm](tm "c/chrono/tm")` object to custom textual representation (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/wcsftime "cpp/chrono/c/wcsftime") for `wcsftime` |
programming_docs
c localtime, localtime_r, localtime_s localtime, localtime\_r, localtime\_s ===================================== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` struct tm *localtime ( const time_t *timer ); ``` | (1) | | | ``` struct tm *localtime_r( const time_t *timer, struct tm *buf ); ``` | (2) | (since C23) | | ``` struct tm *localtime_s( const time_t *restrict timer, struct tm *restrict buf ); ``` | (3) | (since C11) | 1) Converts given time since epoch (a `[time\_t](time_t "c/chrono/time t")` value pointed to by `timer`) into calendar time, expressed in local time, in the [`struct tm`](tm "c/chrono/tm") format. The result is stored in static storage and a pointer to that static storage is returned. 2) Same as (1), except that the function uses user-provided storage `buf` for the result. 3) Same as (1), except that the function uses user-provided storage `buf` for the result and that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `timer` or `buf` is a null pointer As with all bounds-checked functions, `localtime_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<time.h>`. ### Parameters | | | | | --- | --- | --- | | timer | - | pointer to a `[time\_t](time_t "c/chrono/time t")` object to convert | | buf | - | pointer to a `struct [tm](http://en.cppreference.com/w/c/chrono/tm)` object to store the result | ### Return value 1) pointer to a static internal `[tm](tm "c/chrono/tm")` object on success, or null pointer otherwise. The structure may be shared between `[gmtime](gmtime "c/chrono/gmtime")`, `localtime`, and `[ctime](ctime "c/chrono/ctime")` and may be overwritten on each invocation. 2-3) copy of the `buf` pointer, or null pointer on error (which may be a runtime constraint violation or a failure to convert the specified time to local calendar time) ### Notes The function `localtime` may not be thread-safe. POSIX requires that `localtime` and `localtime_r` set `[errno](../error/errno "c/error/errno")` to `[EOVERFLOW](../error/errno_macros "c/error/errno macros")` if it fails because the argument is too large. [POSIX specifies](http://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html) that the timezone information is determined by `localtime` and `localtime_r` as if by calling [`tzset`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html), which reads the environment variable `TZ`. The implementation of `localtime_s` in [Microsoft CRT](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s?view=vs-2019) is incompatible with the C standard since it has reversed parameter order and returns `errno_t`. ### Example ``` #define __STDC_WANT_LIB_EXT1__ 1 #define _XOPEN_SOURCE // for putenv #include <time.h> #include <stdio.h> #include <stdlib.h> // for putenv int main(void) { time_t t = time(NULL); printf("UTC: %s", asctime(gmtime(&t))); printf("local: %s", asctime(localtime(&t))); // POSIX-specific putenv("TZ=Asia/Singapore"); printf("Singapore: %s", asctime(localtime(&t))); #ifdef __STDC_LIB_EXT1__ struct tm buf; char str[26]; asctime_s(str,sizeof str,gmtime_s(&t, &buf)); printf("UTC: %s", str); asctime_s(str,sizeof str,localtime_s(&t, &buf)); printf("local: %s", str); #endif } ``` Possible output: ``` UTC: Fri Sep 15 14:22:05 2017 local: Fri Sep 15 14:22:05 2017 Singapore: Fri Sep 15 22:22:05 2017 UTC: Fri Sep 15 14:22:05 2017 local: Fri Sep 15 14:22:05 2017 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.3.4 The localtime function (p: 288) + K.3.8.2.4 The localtime\_s function (p: 455) * C11 standard (ISO/IEC 9899:2011): + 7.27.3.4 The localtime function (p: 394) + K.3.8.2.4 The localtime\_s function (p: 627) * C99 standard (ISO/IEC 9899:1999): + 7.23.3.4 The localtime function (p: 343) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.3.4 The localtime function ### See also | | | | --- | --- | | [gmtimegmtime\_rgmtime\_s](gmtime "c/chrono/gmtime") (C23)(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/localtime "cpp/chrono/c/localtime") for `localtime` | c timespec timespec ======== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` struct timespec; ``` | | (since C11) | Structure holding an interval broken down into seconds and nanoseconds. ### Member objects | | | | --- | --- | | `[time\_t](time_t "c/chrono/time t")` `tv_sec` | whole seconds (valid values are >= 0) | | `long` `tv_nsec` | nanoseconds (valid values are [0, 999999999]) | ### Example ``` #include <stdio.h> #include <time.h> #include <stdint.h> int main(void) { struct timespec ts; timespec_get(&ts, TIME_UTC); char buff[100]; strftime(buff, sizeof buff, "%D %T", gmtime(&ts.tv_sec)); printf("Current time: %s.%09ld UTC\n", buff, ts.tv_nsec); printf("Raw timespec.time_t: %jd\n", (intmax_t)ts.tv_sec); printf("Raw timespec.tv_nsec: %09ld\n", ts.tv_nsec); } ``` Possible output: ``` Current time: 11/24/21 03:10:50.408191283 UTC Raw timespec.time_t: 1637723450 Raw timespec.tv_nsec: 408191283 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.1/3 Components of time (p: 284) * C11 standard (ISO/IEC 9899:2011): + 7.27.1/3 Components of time (p: 388) ### See also | | | | --- | --- | | [timespec\_get](timespec_get "c/chrono/timespec get") (C11) | returns the calendar time in seconds and nanoseconds based on a given time base (function) | | [tm](tm "c/chrono/tm") | calendar time type (struct) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/timespec "cpp/chrono/c/timespec") for `timespec` | c time time ==== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` time_t time( time_t *arg ); ``` | | | Returns the current calendar time encoded as a `[time\_t](time_t "c/chrono/time t")` object, and also stores it in the `[time\_t](time_t "c/chrono/time t")` object pointed to by `arg` (unless `arg` is a null pointer). ### Parameters | | | | | --- | --- | --- | | arg | - | pointer to a `[time\_t](time_t "c/chrono/time t")` object where the time will be stored, or a null pointer | ### Return value Current calendar time encoded as `[time\_t](time_t "c/chrono/time t")` object on success, `([time\_t](http://en.cppreference.com/w/c/chrono/time_t))(-1)` on error. If `arg` is not a null pointer, the return value is also stored in the object pointed to by `arg`. ### Notes The encoding of calendar time in `[time\_t](time_t "c/chrono/time t")` is unspecified, but most systems conform to [POSIX specification](http://pubs.opengroup.org/onlinepubs/9699919799/functions/time.html) and return a value of integral type holding the number of seconds since [the Epoch](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15). Implementations in which `[time\_t](time_t "c/chrono/time t")` is a 32-bit signed integer (many historical implementations) fail in the year [2038](http://en.wikipedia.org/wiki/Year_2038_problem). ### Example ``` #include <stdio.h> #include <time.h> #include <stdint.h> int main(void) { time_t result = time(NULL); if(result != (time_t)(-1)) printf("The current time is %s(%jd seconds since the Epoch)\n", asctime(gmtime(&result)), (intmax_t)result); } ``` Possible output: ``` The current time is Fri Apr 24 15:05:25 2015 (1429887925 seconds since the Epoch) ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.2.4 The time function (p: 286) * C11 standard (ISO/IEC 9899:2011): + 7.27.2.4 The time function (p: 391) * C99 standard (ISO/IEC 9899:1999): + 7.23.2.4 The time function (p: 341) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.2.4 The time function ### See also | | | | --- | --- | | [localtimelocaltime\_rlocaltime\_s](localtime "c/chrono/localtime") (C23)(C11) | converts time since epoch to calendar time expressed as local time (function) | | [gmtimegmtime\_rgmtime\_s](gmtime "c/chrono/gmtime") (C23)(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) | | [timespec\_get](timespec_get "c/chrono/timespec get") (C11) | returns the calendar time in seconds and nanoseconds based on a given time base (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/time "cpp/chrono/c/time") for `time` | c timespec_getres timespec\_getres ================ | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` int timespec_getres( struct timespec *ts, int base ); ``` | | (since C23) | If `ts` is non-null and `base` is supported by `timespec_get`, modifies `*ts` to hold the resolution of time provided by `timespec_get` for `base`. For each supported `base`, multiple calls to `timespec_getres` during the same program execution have identical results. ### Parameters | | | | | --- | --- | --- | | ts | - | pointer to an object of type `struct timespec` | | base | - | `TIME_UTC` or another nonzero integer value indicating the time base | ### Return value The value of `base` if `base` is supported, zero otherwise. ### Notes The POSIX function [`clock_getres(clock_id, ts)`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html) may also be used to populate a `timespec` with the resolution of time identified by `clock_id`. ### Example ``` #include <stdio.h> #include <time.h> int main(void) { char buff[128]; struct timespec ts; const int res = timespec_getres(&ts, TIME_UTC); if (res == TIME_UTC) { struct tm timer; strftime(buff, sizeof buff, "%D %T", gmtime_r(&ts.tv_sec, &timer)); printf("Time resolution info: %s.%09ld UTC\n", buff, ts.tv_nsec); } else { printf("TIME_UTC base is not supported."); } } ``` Possible output: ``` Time resolution info: 01/01/70 00:00:00.000000001 UTC ``` ### See also | | | | --- | --- | | [timespec](timespec "c/chrono/timespec") (C11) | time in seconds and nanoseconds (struct) | | [timespec\_get](timespec_get "c/chrono/timespec get") (C11) | returns the calendar time in seconds and nanoseconds based on a given time base (function) | | [time](time "c/chrono/time") | returns the current calendar time of the system as time since epoch (function) | c timespec_get timespec\_get ============= | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` int timespec_get( struct timespec *ts, int base ); ``` | (1) | (since C11) | | ``` #define TIME_UTC /* implementation-defined */ ``` | (2) | (since C11) | 1) Modifies the `timespec` object pointed to by `ts` to hold the current calendar time in the time base `base`. 2) Expands to a value suitable for use as the `base` argument of `timespec_get` Other macro constants beginning with `TIME_` may be provided by the implementation to indicate additional time bases. If `base` is `TIME_UTC`, then. * `ts->tv_sec` is set to the number of seconds since an implementation defined epoch, truncated to a whole value * `ts->tv_nsec` member is set to the integral number of nanoseconds, rounded to the resolution of the system clock ### Parameters | | | | | --- | --- | --- | | ts | - | pointer to an object of type `struct timespec` | | base | - | `TIME_UTC` or another nonzero integer value indicating the time base | ### Return value The value of `base` if successful, zero otherwise. ### Notes The POSIX function [`clock_gettime(CLOCK_REALTIME, ts)`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html) may also be used to populate a `timespec` with the time since the Epoch. ### Example ``` #include <stdio.h> #include <time.h> int main(void) { struct timespec ts; timespec_get(&ts, TIME_UTC); char buff[100]; strftime(buff, sizeof buff, "%D %T", gmtime(&ts.tv_sec)); printf("Current time: %s.%09ld UTC\n", buff, ts.tv_nsec); } ``` Possible output: ``` Current time: 02/18/15 14:34:03.048508855 UTC ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.2.5 The timespec\_get function (p: 286) * C11 standard (ISO/IEC 9899:2011): + 7.27.2.5 The timespec\_get function (p: 390) ### See also | | | | --- | --- | | [timespec](timespec "c/chrono/timespec") (C11) | time in seconds and nanoseconds (struct) | | [timespec\_getres](timespec_getres "c/chrono/timespec getres") (C23) | returns the resolution of calendar time based on a given time base (function) | | [time](time "c/chrono/time") | returns the current calendar time of the system as time since epoch (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/timespec_get "cpp/chrono/c/timespec get") for `timespec_get` | c clock_t clock\_t ======== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` typedef /* unspecified */ clock_t; ``` | | | Arithmetic (until C11)Real (since C11) type capable of representing the processor time used by a process. It has implementation-defined range and precision. ### Example ``` #include <stdio.h> #include <time.h> #include <math.h> volatile double sink; int main (void) { clock_t start = clock(); for(size_t i=0; i<3141592; ++i) sink+=sin(i); clock_t end = clock(); double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC; printf("for loop took %f seconds to execute \n", cpu_time_used); } ``` Possible output: ``` for loop took 0.271828 seconds to execute ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.1/3 Components of time (p: 284) * C11 standard (ISO/IEC 9899:2011): + 7.27.1/3 Components of time (p: 388) * C99 standard (ISO/IEC 9899:1999): + 7.23.1/3 Components of time (p: 338) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.1 Components of time ### See also | | | | --- | --- | | [clock](clock "c/chrono/clock") | returns raw processor clock time since the program is started (function) | | [CLOCKS\_PER\_SEC](clocks_per_sec "c/chrono/CLOCKS PER SEC") | number of processor clock ticks per second (macro constant) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/clock_t "cpp/chrono/c/clock t") for `clock_t` | c asctime, asctime_s asctime, asctime\_s =================== | Defined in header `<time.h>` | | | | --- | --- | --- | | | (1) | | | ``` char* asctime( const struct tm* time_ptr ); ``` | (until C23) | | ``` [[deprecated]] char* asctime( const struct tm* time_ptr ); ``` | (since C23) | | ``` errno_t asctime_s( char* buf, rsize_t bufsz, const struct tm* time_ptr ); ``` | (2) | (since C11) | 1) Converts given calendar time `[tm](tm "c/chrono/tm")` to a textual representation of the following fixed 25-character form: `Www Mmm dd hh:mm:ss yyyy\n` * `Www` - three-letter English abbreviated day of the week from `time_ptr->tm_wday`, one of `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat`, `Sun`. * `Mmm` - three-letter English abbreviated month name from `time_ptr->tm_mon`, one of `Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov`, `Dec`. * `dd` - 2-digit day of the month from `timeptr->tm_mday` as if printed by `[sprintf](../io/fprintf "c/io/fprintf")` using `%2d` * `hh` - 2-digit hour from `timeptr->tm_hour` as if printed by `[sprintf](../io/fprintf "c/io/fprintf")` using `%.2d` * `mm` - 2-digit minute from `timeptr->tm_min` as if printed by `[sprintf](../io/fprintf "c/io/fprintf")` using `%.2d` * `ss` - 2-digit second from `timeptr->tm_sec` as if printed by `[sprintf](../io/fprintf "c/io/fprintf")` using `%.2d` * `yyyy` - 4-digit year from `timeptr->tm_year + 1900` as if printed by `[sprintf](../io/fprintf "c/io/fprintf")` using `%4d` The behavior is undefined if any member of `*time_ptr` is outside its normal range The behavior is undefined if the calendar year indicated by `time_ptr->tm_year` has more than 4 digits or is less than the year 1000. The function does not support localization, and the newline character cannot be removed. The function modifies static storage and is not thread-safe. | | | | --- | --- | | This function is deprecated and should not be used in new code. | (since C23) | 2) Same as (1), except that the message is written into user-provided storage `buf`, which is guaranteed to be null-terminated, and the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `buf` or `time_ptr` is a null pointer * `bufsz` is less than 26 or greater than `RSIZE_MAX` * not all members of `*time_ptr` are within their normal ranges * the year indicated by `time_ptr->tm_year` is less than 0 or greater than 9999 As with all bounds-checked functions, `asctime_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<time.h>`. ### Parameters | | | | | --- | --- | --- | | time\_ptr | - | pointer to a `[tm](tm "c/chrono/tm")` object specifying the time to print | | buf | - | pointer to a user-supplied buffer at least 26 bytes in length | | bufsz | - | size of the user-supplied buffer | ### Return value 1) pointer to a static null-terminated character string holding the textual representation of date and time as described above. The string may be shared between `asctime` and `[ctime](ctime "c/chrono/ctime")`, and may be overwritten on each invocation of any of those functions. 2) zero on success, non-zero on failure, in which case `buf[0]` is set to zero (unless `buf` is a null pointer or `bufsz` is zero or greater than `RSIZE_MAX`). ### Notes `asctime` returns a pointer to static data and is not thread-safe. POSIX marks this function obsolete and recommends `[strftime](strftime "c/chrono/strftime")` instead. The C standard also recommends `[strftime](strftime "c/chrono/strftime")` instead of `asctime` and `asctime_s` because `strftime` is more flexible and locale-sensitive. POSIX limits undefined behaviors only to when the output string would be longer than 25 characters, when `timeptr->tm_wday` or `timeptr->tm_mon` are not within the expected ranges, or when `timeptr->tm_year` exceeds `INT_MAX-1990`. Some implementations handle `timeptr->tm_mday==0` as meaning the last day of the preceding month. ### Example ``` #define __STDC_WANT_LIB_EXT1__ 1 #include <time.h> #include <stdio.h> int main(void) { struct tm tm = *localtime(&(time_t){time(NULL)}); printf("%s", asctime(&tm)); #ifdef __STDC_LIB_EXT1__ char str[26]; asctime_s(str, sizeof str, &tm); printf("%s", str); #endif } ``` Possible output: ``` Tue May 26 21:51:50 2015 Tue May 26 21:51:50 2015 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.2.1 The asctime function (p: 287) + K.3.8.2.1 The asctime\_s function (p: 453-454) * C11 standard (ISO/IEC 9899:2011): + 7.27.2.1 The asctime function (p: 392-393) + K.3.8.2.1 The asctime\_s function (p: 624-625) * C99 standard (ISO/IEC 9899:1999): + 7.23.3.1 The asctime function (p: 341-342) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.3.1 The asctime function ### See also | | | | --- | --- | | [ctimectime\_s](ctime "c/chrono/ctime") (deprecated in C23)(C11) | converts a `[time\_t](time_t "c/chrono/time t")` object to a textual representation (function) | | [strftime](strftime "c/chrono/strftime") | converts a `[tm](tm "c/chrono/tm")` object to custom textual representation (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/asctime "cpp/chrono/c/asctime") for `asctime` |
programming_docs
c tm tm == | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` struct tm; ``` | | | Structure holding a calendar date and time broken down into its components. ### Member objects | | | | --- | --- | | int tm\_sec | seconds after the minute – [0, 61] (until C99)[0, 60] (since C99)[[note 1]](#cite_note-leapsecond-1) (public member object) | | int tm\_min | minutes after the hour – [0, 59] (public member object) | | int tm\_hour | hours since midnight – [0, 23] (public member object) | | int tm\_mday | day of the month – [1, 31] (public member object) | | int tm\_mon | months since January – [0, 11] (public member object) | | int tm\_year | years since 1900 (public member object) | | int tm\_wday | days since Sunday – [0, 6] (public member object) | | int tm\_yday | days since January 1 – [0, 365] (public member object) | | int tm\_isdst | Daylight Saving Time flag. The value is positive if DST is in effect, zero if not and negative if no information is available (public member object) | ###### Notes The Standard mandates only the presence of the aforementioned members in either order. The implementations usually add more data-members to this structure. 1. Range allows for a positive leap second. Two leap seconds in the same minute are not allowed (the C89 range 0..61 was a defect) ### Example ``` #include <stdio.h> #include <time.h> int main(void) { struct tm start = {.tm_year=2022-1900, .tm_mday=1}; mktime(&start); printf("%s", asctime(&start)); } ``` Output: ``` Sat Jan 1 00:00:00 2022 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.1/3 Components of time (p: 284) * C11 standard (ISO/IEC 9899:2011): + 7.27.1/3 Components of time (p: 388) * C99 standard (ISO/IEC 9899:1999): + 7.23.1/3 Components of time (p: 338) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.1 Components of time ### See also | | | | --- | --- | | [localtimelocaltime\_rlocaltime\_s](localtime "c/chrono/localtime") (C23)(C11) | converts time since epoch to calendar time expressed as local time (function) | | [gmtimegmtime\_rgmtime\_s](gmtime "c/chrono/gmtime") (C23)(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/tm "cpp/chrono/c/tm") for `tm` | c CLOCKS_PER_SEC CLOCKS\_PER\_SEC ================ | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` #define CLOCKS_PER_SEC /*implementation defined*/ ``` | | | Expands to an expression (not necessarily a compile-time constant) of type `[clock\_t](clock_t "c/chrono/clock t")` equal to the number of clock ticks per second, as returned by `[clock()](clock "c/chrono/clock")`. ### Notes POSIX defines `CLOCKS_PER_SEC` as one million, regardless of the actual precision of `[clock](clock "c/chrono/clock")`. Until standardized as `CLOCKS_PER_SEC` in C89, this macro was sometimes known by its IEEE std 1003.1-1988 name `CLK_TCK`: that name was not included in C89 and was removed from POSIX itself in 1996 over ambiguity with `_SC_CLK_TCK`, which gives number of clocks per second for the function [`times()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/times.html)). ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.1/2 Components of time (p: 284) * C11 standard (ISO/IEC 9899:2011): + 7.27.1/2 Components of time (p: 388) * C99 standard (ISO/IEC 9899:1999): + 7.23.1/2 Components of time (p: 338) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.1 Components of time ### See also | | | | --- | --- | | [clock](clock "c/chrono/clock") | returns raw processor clock time since the program is started (function) | | [clock\_t](clock_t "c/chrono/clock t") | processor time since era type (typedef) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/CLOCKS_PER_SEC "cpp/chrono/c/CLOCKS PER SEC") for `CLOCKS_PER_SEC` | c clock clock ===== | Defined in header `<time.h>` | | | | --- | --- | --- | | ``` clock_t clock(void); ``` | | | Returns the approximate processor time used by the process since the beginning of an implementation-defined era related to the program's execution. To convert result value to seconds, divide it by `[CLOCKS\_PER\_SEC](clocks_per_sec "c/chrono/CLOCKS PER SEC")`. Only the difference between two values returned by different calls to `clock` is meaningful, as the beginning of the `clock` era does not have to coincide with the start of the program. `clock` time may advance faster or slower than the wall clock, depending on the execution resources given to the program by the operating system. For example, if the CPU is shared by other processes, `clock` time may advance slower than wall clock. On the other hand, if the current process is multithreaded and more than one execution core is available, `clock` time may advance faster than wall clock. ### Parameters (none). ### Return value Processor time used by the program so far or `([clock\_t](http://en.cppreference.com/w/c/chrono/clock_t))(-1)` if that information is unavailable or its value cannot be represented. ### Notes On POSIX-compatible systems, [`clock_gettime`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html) with clock id `CLOCK_PROCESS_CPUTIME_ID` offers better resolution. The value returned by `clock()` may wrap around on some non-conforming implementations. For example, on such an implementation, if `[clock\_t](clock_t "c/chrono/clock t")` is a signed 32-bit integer and `[CLOCKS\_PER\_SEC](clocks_per_sec "c/chrono/CLOCKS PER SEC")` is 1000000, it will wrap after about 2147 seconds (about 36 minutes). ### Example This example demonstrates the difference between `clock()` time and real time. ``` #include <stdio.h> #include <time.h> #include <stdlib.h> #include <threads.h> // pthread.h in POSIX // the function f() does some time-consuming work int f(void* thr_data) // return void* in POSIX { volatile double d = 0; for (int n=0; n<10000; ++n) for (int m=0; m<10000; ++m) d += d*n*m; return 0; } int main(void) { struct timespec ts1, tw1; // both C11 and POSIX clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts1); // POSIX clock_gettime(CLOCK_MONOTONIC, &tw1); // POSIX; use timespec_get in C11 clock_t t1 = clock(); thrd_t thr1, thr2; // C11; use pthread_t in POSIX thrd_create(&thr1, f, NULL); // C11; use pthread_create in POSIX thrd_create(&thr2, f, NULL); thrd_join(thr1, NULL); // C11; use pthread_join in POSIX thrd_join(thr2, NULL); struct timespec ts2, tw2; clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts2); clock_gettime(CLOCK_MONOTONIC, &tw2); clock_t t2 = clock(); double dur = 1000.0*(t2-t1)/CLOCKS_PER_SEC; double posix_dur = 1000.0*ts2.tv_sec + 1e-6*ts2.tv_nsec - (1000.0*ts1.tv_sec + 1e-6*ts1.tv_nsec); double posix_wall = 1000.0*tw2.tv_sec + 1e-6*tw2.tv_nsec - (1000.0*tw1.tv_sec + 1e-6*tw1.tv_nsec); printf("CPU time used (per clock()): %.2f ms\n", dur); printf("CPU time used (per clock_gettime()): %.2f ms\n", posix_dur); printf("Wall time passed: %.2f ms\n", posix_wall); } ``` Possible output: ``` CPU time used (per clock()): 1580.00 ms CPU time used (per clock_gettime()): 1582.76 ms Wall time passed: 792.13 ms ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.27.2.1 The clock function (p: 285) * C11 standard (ISO/IEC 9899:2011): + 7.27.2.1 The clock function (p: 389) * C99 standard (ISO/IEC 9899:1999): + 7.23.2.1 The clock function (p: 339) * C89/C90 standard (ISO/IEC 9899:1990): + 4.12.2.1 The clock function ### See also | | | | --- | --- | | [ctimectime\_s](ctime "c/chrono/ctime") (deprecated in C23)(C11) | converts a `[time\_t](time_t "c/chrono/time t")` object to a textual representation (function) | | [time](time "c/chrono/time") | returns the current calendar time of the system as time since epoch (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/chrono/c/clock "cpp/chrono/c/clock") for `clock` | c va_copy va\_copy ======== | Defined in header `<stdarg.h>` | | | | --- | --- | --- | | ``` void va_copy( va_list dest, va_list src ); ``` | | (since C99) | The `va_copy` macro copies `src` to `dest`. `va_end` should be called on `dest` before the function returns or any subsequent re-initialization of `dest` (via calls to `va_start` or `va_copy`). ### Parameters | | | | | --- | --- | --- | | dest | - | an instance of the `va_list` type to initialize | | src | - | the source `va_list` that will be used to initialize `dest` | ### Expanded value (none). ### Example ``` #include <stdio.h> #include <stdarg.h> #include <math.h> double sample_stddev(int count, ...) { /* Compute the mean with args1. */ double sum = 0; va_list args1; va_start(args1, count); va_list args2; va_copy(args2, args1); /* copy va_list object */ for (int i = 0; i < count; ++i) { double num = va_arg(args1, double); sum += num; } va_end(args1); double mean = sum / count; /* Compute standard deviation with args2 and mean. */ double sum_sq_diff = 0; for (int i = 0; i < count; ++i) { double num = va_arg(args2, double); sum_sq_diff += (num-mean) * (num-mean); } va_end(args2); return sqrt(sum_sq_diff / count); } int main(void) { printf("%f\n", sample_stddev(4, 25.0, 27.3, 26.9, 25.7)); } ``` Possible output: ``` 0.920258 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.16.1.2 The va\_copy macro (p: 270) * C99 standard (ISO/IEC 9899:1999): + 7.15.1.2 The va\_copy macro (p: 250) ### See also | | | | --- | --- | | [va\_arg](va_arg "c/variadic/va arg") | accesses the next variadic function argument (function macro) | | [va\_end](va_end "c/variadic/va end") | ends traversal of the variadic function arguments (function macro) | | [va\_list](va_list "c/variadic/va list") | holds the information needed by va\_start, va\_arg, va\_end, and va\_copy (typedef) | | [va\_start](va_start "c/variadic/va start") | enables access to variadic function arguments (function macro) | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/variadic/va_copy "cpp/utility/variadic/va copy") for `va_copy` | c va_end va\_end ======= | Defined in header `<stdarg.h>` | | | | --- | --- | --- | | ``` void va_end( va_list ap ); ``` | | | The `va_end` macro performs cleanup for an `ap` object initialized by a call to `va_start` or `va_copy`. `va_end` may modify `ap` so that it is no longer usable. If there is no corresponding call to `va_start` or `va_copy`, or if `va_end` is not called before a function that calls `va_start` or `va_copy` returns, the behavior is undefined. ### Parameters | | | | | --- | --- | --- | | ap | - | an instance of the `va_list` type to clean up | ### Expanded value (none). ### References * C11 standard (ISO/IEC 9899:2011): + 7.16.1.3 The va\_end macro (p: 270-271) * C99 standard (ISO/IEC 9899:1999): + 7.15.1.3 The va\_end macro (p: 250-251) * C89/C90 standard (ISO/IEC 9899:1990): + 4.8.1.3 The va\_end macro ### See also | | | | --- | --- | | [va\_arg](va_arg "c/variadic/va arg") | accesses the next variadic function argument (function macro) | | [va\_copy](va_copy "c/variadic/va copy") (C99) | makes a copy of the variadic function arguments (function macro) | | [va\_list](va_list "c/variadic/va list") | holds the information needed by va\_start, va\_arg, va\_end, and va\_copy (typedef) | | [va\_start](va_start "c/variadic/va start") | enables access to variadic function arguments (function macro) | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/variadic/va_end "cpp/utility/variadic/va end") for `va_end` | c va_arg va\_arg ======= | Defined in header `<stdarg.h>` | | | | --- | --- | --- | | ``` T va_arg( va_list ap, T ); ``` | | | The `va_arg` macro expands to an expression of type `T` that corresponds to the next parameter from the `va_list` `ap`. Prior to calling `va_arg`, `ap` must be initialized by a call to either `va_start` or `va_copy`, with no intervening call to `va_end`. Each invocation of the `va_arg` macro modifies `ap` to point to the next variable argument. If the type of the next argument in `ap` (after promotions) is not compatible with `T`, the behavior is undefined, unless: * one type is a signed integer type, the other type is the corresponding unsigned integer type, and the value is representable in both types; or * one type is pointer to `void` and the other is a pointer to a character type. If `va_arg` is called when there are no more arguments in `ap`, the behavior is undefined. ### Parameters | | | | | --- | --- | --- | | ap | - | an instance of the `va_list` type | | T | - | the type of the next parameter in `ap` | ### Expanded value the next variable parameter in `ap`. ### Example ``` #include <stdio.h> #include <stdarg.h> #include <math.h> double stddev(int count, ...) { double sum = 0; double sum_sq = 0; va_list args; va_start(args, count); for (int i = 0; i < count; ++i) { double num = va_arg(args, double); sum += num; sum_sq += num*num; } va_end(args); return sqrt(sum_sq/count - (sum/count)*(sum/count)); } int main(void) { printf("%f\n", stddev(4, 25.0, 27.3, 26.9, 25.7)); } ``` Output: ``` 0.920258 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.16.1.1 The va\_arg macro (p: 269-270) * C99 standard (ISO/IEC 9899:1999): + 7.15.1.1 The va\_arg macro (p: 249-250) * C89/C90 standard (ISO/IEC 9899:1990): + 4.8.1.2 The va\_arg macro ### See also | | | | --- | --- | | [va\_copy](va_copy "c/variadic/va copy") (C99) | makes a copy of the variadic function arguments (function macro) | | [va\_end](va_end "c/variadic/va end") | ends traversal of the variadic function arguments (function macro) | | [va\_list](va_list "c/variadic/va list") | holds the information needed by va\_start, va\_arg, va\_end, and va\_copy (typedef) | | [va\_start](va_start "c/variadic/va start") | enables access to variadic function arguments (function macro) | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/variadic/va_arg "cpp/utility/variadic/va arg") for `va_arg` | c va_list va\_list ======== | Defined in header `<stdarg.h>` | | | | --- | --- | --- | | ``` /* unspecified */ va_list; ``` | | | `va_list` is a complete object type suitable for holding the information needed by the macros `va_start`, `va_copy`, `va_arg`, and `va_end`. If a `va_list` instance is created, passed to another function, and used via `va_arg` in that function, then any subsequent use in the calling function should be preceded by a call to `va_end`. It is legal to pass a pointer to a `va_list` object to another function and then use that object after the function returns. ### References * C11 standard (ISO/IEC 9899:2011): + 7.16/3 Variable arguments <stdarg.h> (p: 269) * C99 standard (ISO/IEC 9899:1999): + 7.15/3 Variable arguments <stdarg.h> (p: 249) * C89/C90 standard (ISO/IEC 9899:1990): + 4.8 VARIABLE ARGUMENTS <stdarg.h> ### See also | | | | --- | --- | | [va\_arg](va_arg "c/variadic/va arg") | accesses the next variadic function argument (function macro) | | [va\_copy](va_copy "c/variadic/va copy") (C99) | makes a copy of the variadic function arguments (function macro) | | [va\_end](va_end "c/variadic/va end") | ends traversal of the variadic function arguments (function macro) | | [va\_start](va_start "c/variadic/va start") | enables access to variadic function arguments (function macro) | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/variadic/va_list "cpp/utility/variadic/va list") for `va_list` | c va_start va\_start ========= | Defined in header `<stdarg.h>` | | | | --- | --- | --- | | ``` void va_start( va_list ap, parmN ); ``` | | (until C23) | | ``` void va_start( va_list ap, ... ); ``` | | (since C23) | The `va_start` macro enables access to the variable arguments following the named argument `parmN` (until C23). `va_start` shall be invoked with an instance to a valid `va_list` object `ap` before any calls to `va_arg`. | | | | --- | --- | | If `parmN` is declared with `register` storage class specifier, with an array type, with a function type, or with a type not compatible with the type that results from default argument promotions, the behavior is undefined. | (until C23) | | Only the first argument passed to `va_start` is evaluated. Any additional arguments are neither expanded nor used in any way. | (since C23) | ### Parameters | | | | | --- | --- | --- | | ap | - | an instance of the `va_list` type | | parmN | - | the named parameter preceding the first variable parameter | ### Expanded value (none). ### Example ``` #include <stdio.h> #include <stdarg.h> int add_nums_C99(int count, ...) { int result = 0; va_list args; va_start(args, count); // count can be omitted since C23 for (int i = 0; i < count; ++i) { result += va_arg(args, int); } va_end(args); return result; } #if __STDC_VERSION__ > 201710L // Same as above, valid since C23 int add_nums_C23(...) { int result = 0; va_list args; va_start(args); int count = va_arg(args, int); for (int i = 0; i < count; ++i) { result += va_arg(args, int); } va_end(args); return result; } #endif int main(void) { printf("%d\n", add_nums_C99(4, 25, 25, 50, 50)); #if __STDC_VERSION__ > 201710L printf("%d\n", add_nums_C23(4, 25, 25, 50, 50)); #endif } ``` Possible output: ``` 150 150 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.16.1.4 The va\_start macro (p: 198-199) * C11 standard (ISO/IEC 9899:2011): + 7.16.1.4 The va\_start macro (p: 271-272) * C99 standard (ISO/IEC 9899:1999): + 7.15.1.4 The va\_start macro (p: 251-252) * C89/C90 standard (ISO/IEC 9899:1990): + 4.8.1.1 The va\_start macro ### See also | | | | --- | --- | | [va\_arg](va_arg "c/variadic/va arg") | accesses the next variadic function argument (function macro) | | [va\_copy](va_copy "c/variadic/va copy") (C99) | makes a copy of the variadic function arguments (function macro) | | [va\_end](va_end "c/variadic/va end") | ends traversal of the variadic function arguments (function macro) | | [va\_list](va_list "c/variadic/va list") | holds the information needed by va\_start, va\_arg, va\_end, and va\_copy (typedef) | | [C++ documentation](https://en.cppreference.com/w/cpp/utility/variadic/va_start "cpp/utility/variadic/va start") for `va_start` | c fseek fseek ===== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fseek( FILE *stream, long offset, int origin ); ``` | | | | ``` #define SEEK_SET /*unspecified*/ #define SEEK_CUR /*unspecified*/ #define SEEK_END /*unspecified*/ ``` | | | Sets the file position indicator for the file stream `stream` to the value pointed to by `offset`. If the `stream` is open in binary mode, the new position is exactly `offset` bytes measured from the beginning of the file if `origin` is `[SEEK\_SET](../io "c/io")`, from the current file position if `origin` is `[SEEK\_CUR](../io "c/io")`, and from the end of the file if `origin` is `[SEEK\_END](../io "c/io")`. Binary streams are not required to support `[SEEK\_END](../io "c/io")`, in particular if additional null bytes are output. If the `stream` is open in text mode, the only supported values for `offset` are zero (which works with any `origin`) and a value returned by an earlier call to `[ftell](ftell "c/io/ftell")` on a stream associated with the same file (which only works with `origin` of `[SEEK\_SET](../io "c/io")`). If the `stream` is wide-oriented, the restrictions of both text and binary streams apply (result of `[ftell](ftell "c/io/ftell")` is allowed with `[SEEK\_SET](../io "c/io")` and zero offset is allowed from `[SEEK\_SET](../io "c/io")` and `[SEEK\_CUR](../io "c/io")`, but not `[SEEK\_END](../io "c/io")`). In addition to changing the file position indicator, `fseek` undoes the effects of `[ungetc](ungetc "c/io/ungetc")` and clears the end-of-file status, if applicable. If a read or write error occurs, the error indicator for the stream (`[ferror](ferror "c/io/ferror")`) is set and the file position is unaffected. ### Parameters | | | | | --- | --- | --- | | stream | - | file stream to modify | | offset | - | number of characters to shift the position relative to origin | | origin | - | position to which `offset` is added. It can have one of the following values: `[SEEK\_SET](../io "c/io")`, `[SEEK\_CUR](../io "c/io")`, `[SEEK\_END](../io "c/io")` | ### Return value `​0​` upon success, nonzero value otherwise. ### Notes After seeking to a non-end position in a wide stream, the next call to any output function may render the remainder of the file undefined, e.g. by outputting a multibyte sequence of a different length. For text streams, the only valid values of `offset` are `​0​` (applicable to any `origin`) and a value returned by an earlier call to `[ftell](ftell "c/io/ftell")` (only applicable to `SEEK_SET`). POSIX allows seeking beyond the existing end of file. If an output is performed after this seek, any read from the gap will return zero bytes. Where supported by the filesystem, this creates a *sparse file*. POSIX also requires that fseek first performs `[fflush](fflush "c/io/fflush")` if there are any unwritten data (but whether the shift state is restored is implementation-defined). ### Example `fseek` with error checking: ``` #include <stdio.h> #include <stdlib.h> int main(void) { /* Prepare an array of double values. */ #define SIZE 5 double A[SIZE] = {1.0, 2.0, 3.0, 4.0, 5.0}; /* Write array to a file. */ FILE * fp = fopen("test.bin", "wb"); fwrite(A, sizeof(double), SIZE, fp); fclose (fp); /* Read the double values into array B. */ double B[SIZE]; fp = fopen("test.bin", "rb"); /* Set the file position indicator in front of third double value. */ if (fseek(fp, sizeof(double) * 2L, SEEK_SET) != 0) { fprintf(stderr, "fseek() failed in file %s at line # %d\n", __FILE__, __LINE__ - 2); fclose(fp); return EXIT_FAILURE; } int ret_code = fread(B, sizeof(double), 1, fp); /* read one double value */ printf("ret_code == %d\n", ret_code); /* print the number of values read */ printf("B[0] == %.1f\n", B[0]); /* print one value */ fclose(fp); return EXIT_SUCCESS; } ``` Possible output: ``` ret_code == 1 B[0] == 3.0 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.9.2 The fseek function (p: 245) * C11 standard (ISO/IEC 9899:2011): + 7.21.9.2 The fseek function (p: 336-337) * C99 standard (ISO/IEC 9899:1999): + 7.19.9.2 The fseek function (p: 302-303) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.9.2 The fseek function ### See also | | | | --- | --- | | [fsetpos](fsetpos "c/io/fsetpos") | moves the file position indicator to a specific location in a file (function) | | [fgetpos](fgetpos "c/io/fgetpos") | gets the file position indicator (function) | | [ftell](ftell "c/io/ftell") | returns the current file position indicator (function) | | [rewind](rewind "c/io/rewind") | moves the file position indicator to the beginning in a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fseek "cpp/io/c/fseek") for `fseek` |
programming_docs
c wprintf, fwprintf, swprintf, wprintf_s, fwprintf_s, swprintf_s, snwprintf_s wprintf, fwprintf, swprintf, wprintf\_s, fwprintf\_s, swprintf\_s, snwprintf\_s =============================================================================== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | | (1) | | | ``` int wprintf( const wchar_t *format, ... ); ``` | (since C95) (until C99) | | ``` int wprintf( const wchar_t *restrict format, ... ); ``` | (since C99) | | | (2) | | | ``` int fwprintf( FILE *stream, const wchar_t* format, ... ); ``` | (since C95) (until C99) | | ``` int fwprintf( FILE *restrict stream, const wchar_t *restrict format, ... ); ``` | (since C99) | | | (3) | | | ``` int swprintf( wchar_t *buffer, size_t bufsz, const wchar_t* format, ... ); ``` | (since C95) (until C99) | | ``` int swprintf( wchar_t *restrict buffer, size_t bufsz, const wchar_t *restrict format, ... ); ``` | (since C99) | | ``` int wprintf_s( const wchar_t *restrict format, ... ); ``` | (4) | (since C11) | | ``` int fwprintf_s( FILE *restrict stream, const wchar_t *restrict format, ... ); ``` | (5) | (since C11) | | ``` int swprintf_s( wchar_t *restrict buffer, rsize_t bufsz, const wchar_t* restrict format, ... ); ``` | (6) | (since C11) | | ``` int snwprintf_s( wchar_t * restrict s, rsize_t n, const wchar_t * restrict format, ... ); ``` | (7) | (since C11) | Loads the data from the given locations, converts them to wide string equivalents and writes the results to a variety of sinks. 1) Writes the results to `[stdout](std_streams "c/io/std streams")`. 2) Writes the results to a file stream `stream`. 3) If `bufsz` is greater than zero, writes the results to a wide string `buffer`. At most `bufsz-1` wide characters are written followed by null wide character. If `bufsz` is zero, nothing is written (and `buffer` may be a null pointer), however the return value (number of wide characters that would be written) is still calculated and returned. 4-6) Same as (1-3), except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * the conversion specifier `%n` is present in `format` * any of the arguments corresponding to `%s` is a null pointer * `format` or `buffer` is a null pointer * `bufsz` is zero or greater than `RSIZE_MAX/sizeof(wchar_t)` * encoding errors occur in any of string and character conversion specifiers * (only for `swprintf_s`) the number of wide characters to be written, including the null, would exceed `bufsz`. 7) Same as (6), except it will truncate the result to fit within the array pointed to by s. As with all bounds-checked functions, `wprintf_s` , `fwprintf_s`, `swprintf_s`, and `snwprintf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | output file stream to write to | | buffer | - | pointer to a wide character string to write to | | bufsz | - | up to `bufsz-1` wide characters may be written, plus the null terminator | | format | - | pointer to a null-terminated wide string specifying how to interpret the data | | ... | - | arguments specifying data to print. If any argument after [default argument promotions](../language/conversion#Default_argument_promotions "c/language/conversion") is not the type expected by the corresponding conversion specifier, or if there are fewer arguments than required by `format`, the behavior is undefined. If there are more arguments than required by `format`, the extraneous arguments are evaluated and ignored. | The **format** string consists of ordinary wide characters (except `%`), which are copied unchanged into the output stream, and conversion specifications. Each conversion specification has the following format: * introductory `%` character * (optional) one or more flags that modify the behavior of the conversion: + `-`: the result of the conversion is left-justified within the field (by default it is right-justified) + `+`: the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative) + *space*: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if `+` flag is present. + `#` : *alternative form* of the conversion is performed. See the table below for exact effects otherwise the behavior is undefined. + `0` : for integer and floating point number conversions, leading zeros are used to pad the field instead of *space* characters. For integer numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if `-` flag is present. * (optional) integer value or `*` that specifies minimum field width. The result is padded with *space* characters (by default), if required, on the left when right-justified, or on the right if left-justified. In the case when `*` is used, the width is specified by an additional argument of type `int`, which appears before the argument to be converted and the argument supplying precision if one is supplied. If the value of the argument is negative, it results with the `-` flag specified and positive field width. (Note: This is the minimum width: The value is never truncated.) + (optional) `.` followed by integer number or `*`, or neither that specifies *precision* of the conversion. In the case when `*` is used, the *precision* is specified by an additional argument of type `int`, which appears before the argument to be converted, but after the argument supplying minimum field width if one is supplied. If the value of this argument is negative, it is ignored. If neither a number nor `*` is used, the precision is taken as zero. See the table below for exact effects of *precision*. + (optional) *length modifier* that specifies the size of the argument (in combination with the conversion format specifier, it specifies the type of the corresponding argument) + conversion format specifier The following format specifiers are available: | ConversionSpecifier | Explanation | ExpectedArgument Type | | --- | --- | --- | | **LengthModifier****→** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | writes literal `%`. The full conversion specification must be `%%`. | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | writes a **single character**. The argument is first converted to `wchar_t` as if by calling `[btowc](../string/multibyte/btowc "c/string/multibyte/btowc")`. If the **l** modifier is used, the `wint_t` argument is first converted to `wchar_t`. | N/A | N/A | `int` | `wint_t` | N/A | N/A | N/A | N/A | N/A | | `s` | writes a **character string** The argument must be a pointer to the initial element of a character array containing a multibyte character sequence beginning in the initial shift state, which is converted to wide character array as if by a call to `[mbrtowc](../string/multibyte/mbrtowc "c/string/multibyte/mbrtowc")` with zero-initialized conversion state. *Precision* specifies the maximum number of wide characters to be written. If *Precision* is not specified, writes every wide characters up to and not including the first null terminator. If the **l** specifier is used, the argument must be a pointer to the initial element of an array of `wchar_t`. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `d` `i` | converts a **signed integer** into decimal representation *[-]dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | `signed char` | `short` | `int` | `long` | `long long` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `o` | converts an **unsigned integer** into octal representation *oooo*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* precision is increased if necessary, to write one leading zero. In that case if both the converted value and the precision are `​0​`, single `​0​` is written. | `unsigned char` | `unsigned short` | `unsigned int` | `unsigned long` | `unsigned long long` | `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | unsigned version of `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `x` `X` | converts an **unsigned integer** into hexadecimal representation *hhhh*. For the `x` conversion letters `abcdef` are used. For the `X` conversion letters `ABCDEF` are used. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* `0x` or `0X` is prefixed to results if the converted value is nonzero. | N/A | | `u` | converts an **unsigned integer** into decimal representation *dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | N/A | | `f` `F` | converts **floating-point number** to the decimal notation in the style *[-]ddd.ddd*. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | `double` | `double` (C99) | N/A | N/A | N/A | N/A | `long double` | | `e` `E` | converts **floating-point number** to the decimal exponent notation. For the `e` conversion style *[-]d.ddd*`e`*±dd* is used. For the `E` conversion style *[-]d.ddd*`E`*±dd* is used. The exponent contains at least two digits, more digits are used only if necessary. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `a` `A` (C99). | converts **floating-point number** to the hexadecimal exponent notation. For the `a` conversion style *[-]*`0x`*h.hhh*`p`*±d* is used. For the `A` conversion style *[-]*`0X`*h.hhh*`P`*±d* is used. The first hexadecimal digit is not `0` if the argument is a normalized floating point value. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the hexadecimal point character. The default precision is sufficient for exact representation of the value. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `g` `G` | converts **floating-point number** to decimal or decimal exponent notation depending on the value and the *precision*. For the `g` conversion style conversion with style `e` or `f` will be performed. For the `G` conversion style conversion with style `E` or `F` will be performed. Let `P` equal the precision if nonzero, `6` if the precision is not specified, or `1` if the precision is `​0​`. Then, if a conversion with style `E` would have an exponent of `X`:* if *P > X ≥ −4*, the conversion is with style `f` or `F` and precision *P − 1 − X*. * otherwise, the conversion is with style `e` or `E` and precision *P − 1*. Unless *alternative representation* is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `n` | returns the **number of characters written** so far by this call to the function. The result is *written* to the value pointed to by the argument. The specification may not contain any *flag*, *field width*, or *precision*. | `signed char*` | `short*` | `int*` | `long*` | `long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `p` | writes an implementation defined character sequence defining a **pointer**. | N/A | N/A | `void*` | N/A | N/A | N/A | N/A | N/A | N/A | The floating point conversion functions convert infinity to `inf` or `infinity`. Which one is used is implementation defined. Not-a-number is converted to `nan` or `nan(*char\_sequence*)`. Which one is used is implementation defined. The conversions `F`, `E`, `G`, `A` output `INF`, `INFINITY`, `NAN` instead. Even though `%c` expects `int` argument, it is safe to pass a `char` because of the integer promotion that takes place when a variadic function is called. The correct conversion specifications for the fixed-width character types (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although `[PRIdMAX](../types/integer "c/types/integer")`, `[PRIuMAX](../types/integer "c/types/integer")`, etc is synonymous with `%jd`, `%ju`, etc). The memory-writing conversion specifier `%n` is a common target of security exploits where format strings depend on user input and is not supported by the bounds-checked `printf_s` family of functions. There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple `%n` results in the same variable or, as an edge case, printing a string modified by an earlier `%n` within the same call. If a conversion specification is invalid, the behavior is undefined. ### Return value 1,2) Number of wide characters written if successful or negative value if an error occurred. 3) Number of wide characters written (not counting the terminating null wide character) if successful or negative value if an encoding error occurred or if the number of characters to be generated was equal or greater than `size` (including when `size` is zero). 4,5) Number of wide characters written if successful or negative value if an error occurred. 6) Number of wide characters (not counting the terminating null) that were written to `buffer`. Returns a negative value on encoding errors and on overflow. Returns zero on all other errors. 7) Number of wide characters (not counting the terminating null) that would have been written to `buffer` had `bufsz` been sufficiently large, or a negative value if an error occurs. (meaning, write was successful and complete only if the return is nonnegative and less than `bufsz`) ### Notes While narrow strings provide `[snprintf](fprintf "c/io/fprintf")`, which makes it possible to determine the required output buffer size, there is no equivalent for wide strings (until C11's `snwprintf_s`), and in order to determine the buffer size, the program may need to call `swprintf`, check the result value, and reallocate a larger buffer, trying again until successful. `snwprintf_s`, unlike `swprintf_s`, will truncate the result to fit within the array pointed to by `buffer`, even though truncation is treated as an error by most bounds-checked functions. ### Example ``` #include <locale.h> #include <wchar.h> int main(void) { char narrow_str[] = "z\u00df\u6c34\U0001f34c"; // or "zß水🍌" // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9f\x8d\x8c"; wchar_t warr[29]; // the expected string is 28 characters plus 1 null terminator setlocale(LC_ALL, "en_US.utf8"); swprintf(warr, sizeof warr/sizeof *warr, L"Converted from UTF-8: '%s'", narrow_str); wprintf(L"%ls\n", warr); } ``` Output: ``` Converted from UTF-8: 'zß水🍌' ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.2.1 The fwprintf function (p: 403-410) + 7.29.2.3 The swprintf function (p: 416) + 7.29.2.11 The wprintf function (p: 421) + K.3.9.1.1 The fwprintf\_s function (p: 628) + K.3.9.1.4 The swprintf\_s function (p: 630-631) + K.3.9.1.13 The wprintf\_s function (p: 637-638) * C99 standard (ISO/IEC 9899:1999): + 7.24.2.1 The fwprintf function (p: 349-356) + 7.24.2.3 The swprintf function (p: 362) + 7.24.2.11 The wprintf function (p: 366) ### See also | | | | --- | --- | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vwprintfvfwprintfvswprintfvwprintf\_svfwprintf\_svswprintf\_svsnwprintf\_s](vfwprintf "c/io/vfwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [fputws](fputws "c/io/fputws") (C95) | writes a wide string to a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fwprintf "cpp/io/c/fwprintf") for `wprintf, fwprintf, swprintf` | c vprintf, vfprintf, vsprintf, vsnprintf, vprintf_s, vfprintf_s, vsprintf_s, vsnprintf_s vprintf, vfprintf, vsprintf, vsnprintf, vprintf\_s, vfprintf\_s, vsprintf\_s, vsnprintf\_s ========================================================================================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | | (1) | | | ``` int vprintf( const char *format, va_list vlist ); ``` | (until C99) | | ``` int vprintf( const char *restrict format, va_list vlist ); ``` | (since C99) | | | (2) | | | ``` int vfprintf( FILE *stream, const char *format, va_list vlist ); ``` | (until C99) | | ``` int vfprintf( FILE *restrict stream, const char *restrict format, va_list vlist ); ``` | (since C99) | | | (3) | | | ``` int vsprintf( char *buffer, const char *format, va_list vlist ); ``` | (until C99) | | ``` int vsprintf( char *restrict buffer, const char *restrict format, va_list vlist ); ``` | (since C99) | | ``` int vsnprintf( char *restrict buffer, size_t bufsz, const char *restrict format, va_list vlist ); ``` | (4) | (since C99) | | ``` int vprintf_s( const char *restrict format, va_list vlist ); ``` | (5) | (since C11) | | ``` int vfprintf_s( FILE *restrict stream, const char *restrict format, va_list vlist ); ``` | (6) | (since C11) | | ``` int vsprintf_s( char *restrict buffer, rsize_t bufsz, const char *restrict format, va_list vlist ); ``` | (7) | (since C11) | | ``` int vsnprintf_s( char *restrict buffer, rsize_t bufsz, const char *restrict format, va_list vlist ); ``` | (8) | (since C11) | Loads the data from the locations, defined by `vlist`, converts them to character string equivalents and writes the results to a variety of sinks. 1) Writes the results to `[stdout](std_streams "c/io/std streams")`. 2) Writes the results to a file stream `stream`. 3) Writes the results to a character string `buffer`. 4) Writes the results to a character string `buffer`. At most `bufsz - 1` characters are written. The resulting character string will be terminated with a null character, unless `bufsz` is zero. If `bufsz` is zero, nothing is written and `buffer` may be a null pointer, however the return value (number of bytes that would be written not including the null terminator) is still calculated and returned. 5-8) Same as (1-4), except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * the conversion specifier `%n` is present in `format` * any of the arguments corresponding to `%s` is a null pointer * `format` or `buffer` is a null pointer * `bufsz` is zero or greater than `RSIZE_MAX` * encoding errors occur in any of string and character conversion specifiers * (for `vsprintf_s` only), the string to be stored in `buffer` (including the trailing null)) would be exceed `bufsz` As with all bounds-checked functions, `vprintf_s` , `vfprintf_s`, `vsprintf_s`, and `vsnprintf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | output file stream to write to | | buffer | - | pointer to a character string to write to | | bufsz | - | up to bufsz - 1 characters may be written, plus the null terminator | | format | - | pointer to a null-terminated character string specifying how to interpret the data | | vlist | - | variable argument list containing the data to print. | The **format** string consists of ordinary multibyte characters (except `%`), which are copied unchanged into the output stream, and conversion specifications. Each conversion specification has the following format: * introductory `%` character * (optional) one or more flags that modify the behavior of the conversion: + `-`: the result of the conversion is left-justified within the field (by default it is right-justified) + `+`: the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative) + *space*: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if `+` flag is present. + `#` : *alternative form* of the conversion is performed. See the table below for exact effects otherwise the behavior is undefined. + `0` : for integer and floating point number conversions, leading zeros are used to pad the field instead of *space* characters. For integer numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if `-` flag is present. * (optional) integer value or `*` that specifies minimum field width. The result is padded with *space* characters (by default), if required, on the left when right-justified, or on the right if left-justified. In the case when `*` is used, the width is specified by an additional argument of type `int`, which appears before the argument to be converted and the argument supplying precision if one is supplied. If the value of the argument is negative, it results with the `-` flag specified and positive field width. (Note: This is the minimum width: The value is never truncated.) + (optional) `.` followed by integer number or `*`, or neither that specifies *precision* of the conversion. In the case when `*` is used, the *precision* is specified by an additional argument of type `int`, which appears before the argument to be converted, but after the argument supplying minimum field width if one is supplied. If the value of this argument is negative, it is ignored. If neither a number nor `*` is used, the precision is taken as zero. See the table below for exact effects of *precision*. + (optional) *length modifier* that specifies the size of the argument (in combination with the conversion format specifier, it specifies the type of the corresponding argument) + conversion format specifier The following format specifiers are available: | ConversionSpecifier | Explanation | ExpectedArgument Type | | --- | --- | --- | | **LengthModifier****→** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | writes literal `%`. The full conversion specification must be `%%`. | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | writes a **single character**. The argument is first converted to `unsigned char`. If the **l** modifier is used, the argument is first converted to a character string as if by **%ls** with a `wchar_t[2]` argument. | N/A | N/A | `int` | `wint_t` | N/A | N/A | N/A | N/A | N/A | | `s` | writes a **character string** The argument must be a pointer to the initial element of an array of characters. *Precision* specifies the maximum number of bytes to be written. If *Precision* is not specified, writes every byte up to and not including the first null terminator. If the **l** specifier is used, the argument must be a pointer to the initial element of an array of `wchar_t`, which is converted to char array as if by a call to `[wcrtomb](../string/multibyte/wcrtomb "c/string/multibyte/wcrtomb")` with zero-initialized conversion state. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `d` `i` | converts a **signed integer** into decimal representation *[-]dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | `signed char` | `short` | `int` | `long` | `long long` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `o` | converts an **unsigned integer** into octal representation *oooo*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* precision is increased if necessary, to write one leading zero. In that case if both the converted value and the precision are `​0​`, single `​0​` is written. | `unsigned char` | `unsigned short` | `unsigned int` | `unsigned long` | `unsigned long long` | `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | unsigned version of `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `x` `X` | converts an **unsigned integer** into hexadecimal representation *hhhh*. For the `x` conversion letters `abcdef` are used. For the `X` conversion letters `ABCDEF` are used. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* `0x` or `0X` is prefixed to results if the converted value is nonzero. | N/A | | `u` | converts an **unsigned integer** into decimal representation *dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | N/A | | `f` `F` | converts **floating-point number** to the decimal notation in the style *[-]ddd.ddd*. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | `double` | `double` (C99) | N/A | N/A | N/A | N/A | `long double` | | `e` `E` | converts **floating-point number** to the decimal exponent notation. For the `e` conversion style *[-]d.ddd*`e`*±dd* is used. For the `E` conversion style *[-]d.ddd*`E`*±dd* is used. The exponent contains at least two digits, more digits are used only if necessary. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `a` `A` (C99). | converts **floating-point number** to the hexadecimal exponent notation. For the `a` conversion style *[-]*`0x`*h.hhh*`p`*±d* is used. For the `A` conversion style *[-]*`0X`*h.hhh*`P`*±d* is used. The first hexadecimal digit is not `0` if the argument is a normalized floating point value. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the hexadecimal point character. The default precision is sufficient for exact representation of the value. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `g` `G` | converts **floating-point number** to decimal or decimal exponent notation depending on the value and the *precision*. For the `g` conversion style conversion with style `e` or `f` will be performed. For the `G` conversion style conversion with style `E` or `F` will be performed. Let `P` equal the precision if nonzero, `6` if the precision is not specified, or `1` if the precision is `​0​`. Then, if a conversion with style `E` would have an exponent of `X`:* if *P > X ≥ −4*, the conversion is with style `f` or `F` and precision *P − 1 − X*. * otherwise, the conversion is with style `e` or `E` and precision *P − 1*. Unless *alternative representation* is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `n` | returns the **number of characters written** so far by this call to the function. The result is *written* to the value pointed to by the argument. The specification may not contain any *flag*, *field width*, or *precision*. | `signed char*` | `short*` | `int*` | `long*` | `long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `p` | writes an implementation defined character sequence defining a **pointer**. | N/A | N/A | `void*` | N/A | N/A | N/A | N/A | N/A | N/A | The floating point conversion functions convert infinity to `inf` or `infinity`. Which one is used is implementation defined. Not-a-number is converted to `nan` or `nan(*char\_sequence*)`. Which one is used is implementation defined. The conversions `F`, `E`, `G`, `A` output `INF`, `INFINITY`, `NAN` instead. Even though `%c` expects `int` argument, it is safe to pass a `char` because of the integer promotion that takes place when a variadic function is called. The correct conversion specifications for the fixed-width character types (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although `[PRIdMAX](../types/integer "c/types/integer")`, `[PRIuMAX](../types/integer "c/types/integer")`, etc is synonymous with `%jd`, `%ju`, etc). The memory-writing conversion specifier `%n` is a common target of security exploits where format strings depend on user input and is not supported by the bounds-checked `printf_s` family of functions. There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple `%n` results in the same variable or, as an edge case, printing a string modified by an earlier `%n` within the same call. If a conversion specification is invalid, the behavior is undefined. ### Return value 1-3) The number of characters written if successful or negative value if an error occurred. 4) The number of characters written if successful or negative value if an error occurred. If the resulting string gets truncated due to `buf_size` limit, function returns the total number of characters (not including the terminating null-byte) which would have been written, if the limit was not imposed. 5,6) number of characters transmitted to the output stream or negative value if an output error, a runtime constrants violation error, or an encoding error occurred. 7) number of characters written to `buffer`, not counting the null character (which is always written as long as `buffer` is not a null pointer and `bufsz` is not zero and not greater than `RSIZE_MAX`), or zero on runtime constraint violations, and negative value on encoding errors 8) number of characters not including the terminating null character (which is always written as long as `buffer` is not a null pointer and `bufsz` is not zero and not greater than `RSIZE_MAX`), which would have been written to `buffer` if `bufsz` was ignored, or a negative value if a runtime constraints violation or an encoding error occurred ### Notes All these functions invoke `va_arg` at least once, the value of `arg` is indeterminate after the return. These functions do not invoke `va_end`, and it must be done by the caller. `vsnprintf_s`, unlike `vsprintf_s`, will truncate the result to fit within the array pointed to by `buffer`. ### Example ``` #include <stdio.h> #include <stdarg.h> #include <time.h> void debug_log(const char *fmt, ...) { struct timespec ts; timespec_get(&ts, TIME_UTC); char time_buf[100]; size_t rc = strftime(time_buf, sizeof time_buf, "%D %T", gmtime(&ts.tv_sec)); snprintf(time_buf + rc, sizeof time_buf - rc, ".%06ld UTC", ts.tv_nsec / 1000); va_list args1; va_start(args1, fmt); va_list args2; va_copy(args2, args1); char buf[1+vsnprintf(NULL, 0, fmt, args1)]; va_end(args1); vsnprintf(buf, sizeof buf, fmt, args2); va_end(args2); printf("%s [debug]: %s\n", time_buf, buf); } int main(void) { debug_log("Logging, %d, %d, %d", 1, 2, 3); } ``` Possible output: ``` 02/20/15 21:58:09.072683 UTC [debug]: Logging, 1, 2, 3 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.6.8 The vfprintf function (p: 238) + 7.21.6.10 The vprintf function (p: 239) + 7.21.6.12 The vsnprintf function (p: 239-240) + 7.21.6.13 The vsprintf function (p: 240) + K.3.5.3.8 The vfprintf\_s function (p: 434) + K.3.5.3.10 The vprintf\_s function (p: 435) + K.3.5.3.12 The vsnprintf\_s function (p: 436-437) + K.3.5.3.13 The vsprintf\_s function (p: 437) * C11 standard (ISO/IEC 9899:2011): + 7.21.6.8 The vfprintf function (p: 326-327) + 7.21.6.10 The vprintf function (p: 328) + 7.21.6.12 The vsnprintf function (p: 329) + 7.21.6.13 The vsprintf function (p: 329) + K.3.5.3.8 The vfprintf\_s function (p: 597) + K.3.5.3.10 The vprintf\_s function (p: 598-599) + K.3.5.3.12 The vsnprintf\_s function (p: 600) + K.3.5.3.13 The vsprintf\_s function (p: 601) * C99 standard (ISO/IEC 9899:1999): + 7.19.6.8 The vfprintf function (p: 292) + 7.19.6.10 The vprintf function (p: 293) + 7.19.6.12 The vsnprintf function (p: 294) + 7.19.6.13 The vsprintf function (p: 295) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.6.7 The vfprintf function + 4.9.6.8 The vprintf function + 4.9.6.9 The vsprintf function ### See also | | | | --- | --- | | [vwprintfvfwprintfvswprintfvwprintf\_svfwprintf\_svswprintf\_svsnwprintf\_s](vfwprintf "c/io/vfwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vscanfvfscanfvsscanfvscanf\_svfscanf\_svsscanf\_s](vfscanf "c/io/vfscanf") (C99)(C99)(C99)(C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/vfprintf "cpp/io/c/vfprintf") for `vprintf, vfprintf, vsprintf, vsnprintf` |
programming_docs
c clearerr clearerr ======== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` void clearerr( FILE *stream ); ``` | | | Resets the error flags and the [`EOF`](../io#Macro_constants "c/io") indicator for the given file stream. ### Parameters | | | | | --- | --- | --- | | stream | - | the file to reset the error flags for | ### Return value (none). ### Example ``` #include <stdio.h> #include <assert.h> int main(void) { FILE* tmpf = tmpfile(); fputs("cppreference.com\n", tmpf); rewind(tmpf); for (int ch; (ch = fgetc(tmpf)) != EOF; putchar(ch)) { } assert(feof(tmpf)); // the loop is expected to terminate by EOF puts("End of file reached"); clearerr(tmpf); // clear EOF puts(feof(tmpf) ? "EOF indicator set" : "EOF indicator cleared"); } ``` Output: ``` cppreference.com End of file reached EOF indicator cleared ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.10.1 The clearerr function (p: 246) * C11 standard (ISO/IEC 9899:2011): + 7.21.10.1 The clearerr function (p: 338) * C99 standard (ISO/IEC 9899:1999): + 7.19.10.1 The clearerr function (p: 304) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.10.1 The clearerr function ### See also | | | | --- | --- | | [feof](feof "c/io/feof") | checks for the end-of-file (function) | | [perror](perror "c/io/perror") | displays a character string corresponding of the current error to `[stderr](std_streams "c/io/std streams")` (function) | | [ferror](ferror "c/io/ferror") | checks for a file error (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/clearerr "cpp/io/c/clearerr") for `clearerr` | c tmpnam, tmpnam_s tmpnam, tmpnam\_s ================= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` char *tmpnam( char *filename ); ``` | (1) | | | ``` errno_t tmpnam_s(char *filename_s, rsize_t maxsize); ``` | (2) | (since C11) | | ``` #define TMP_MAX /*unspecified*/ ``` | | | | ``` #define TMP_MAX_S /*unspecified*/ ``` | | (since C11) | | ``` #define L_tmpnam /*unspecified*/ ``` | | | | ``` #define L_tmpnam_s /*unspecified*/ ``` | | (since C11) | 1) Creates a unique valid file name (no longer than `[L\_tmpnam](../io "c/io")` in length) and stores it in character string pointed to by `filename`. The function is capable of generating up to `[TMP\_MAX](../io "c/io")` of unique filenames, but some or all of them may be in use in the filesystem and thus not suitable return values. 2) Same as (1), except that up to `TMP_MAX_S` names may be generated, no longer than `L_tmpnam_s` in length, and the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `filename_s` is a null pointer * `maxsize` is greater than `RSIZE_MAX` * `maxsize` is less than the generated file name string As with all bounds-checked functions, `tmpnam_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. `tmpnam` and `tmpnam_s` modify static state (which may be shared between these functions) and are not required to be thread-safe. ### Parameters | | | | | --- | --- | --- | | filename | - | pointer to the character array capable of holding at least `[L\_tmpnam](../io "c/io")` bytes, to be used as a result buffer. If null pointer is passed, a pointer to an internal static buffer is returned. | | filename\_s | - | pointer to the character array capable of holding at least `L_tmpnam_s` bytes, to be used as a result buffer. | | maxsize | - | maximum number of characters the function is allowed to write (typically the size of the `filename_s` array). | ### Return value 1) `filename` if `filename` was not a null pointer. Otherwise a pointer to an internal static buffer is returned. If no suitable filename can be generated, null pointer is returned. 2) Returns zero and writes the file name to `filename_s` on success. On error, returns non-zero and writes the null character to `filename_s[0]` (only if `filename_s` is not null and `maxsize` is not zero and is not greater than `RSIZE_MAX`). ### Notes Although the names generated by `tmpnam` are difficult to guess, it is possible that a file with that name is created by another process between the moment `tmpnam` returns and the moment this program attempts to use the returned name to create a file. The standard function `[tmpfile](tmpfile "c/io/tmpfile")` and the POSIX function [`mkstemp`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdtemp.html) do not have this problem (creating a unique directory using only the standard C library still requires the use of `tmpnam`). POSIX systems additionally define the similarly named function `[tempnam()](http://pubs.opengroup.org/onlinepubs/9699919799/functions/tempnam.html)`, which offers the choice of a directory (which defaults to the optionally defined macro `[P\_tmpdir](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html))`. ### Example ``` #include <stdio.h> #include <string.h> int main(void) { char* name1 = tmpnam(NULL); printf("temporary file name: %s\n", name1); char name2[L_tmpnam]; if (tmpnam(name2)) printf("temporary file name: %s\n", name2); } ``` Possible output: ``` temporary file name: /tmp/fileRZHMwL temporary file name: /tmp/file420gSN ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.4.4 The tmpnam function (p: 222) + K.3.5.1.2 The tmpnam\_s function (p: 427-428) * C11 standard (ISO/IEC 9899:2011): + 7.21.4.4 The tmpnam function (p: 303-304) + K.3.5.1.2 The tmpnam\_s function (p: 587-588) * C99 standard (ISO/IEC 9899:1999): + 7.19.4.4 The tmpnam function (p: 269-270) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.4.4 The tmpnam function ### See also | | | | --- | --- | | [tmpfiletmpfile\_s](tmpfile "c/io/tmpfile") (C11) | returns a pointer to a temporary file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/tmpnam "cpp/io/c/tmpnam") for `tmpnam` | c feof feof ==== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int feof( FILE *stream ); ``` | | | Checks if the end of the given file stream has been reached. ### Parameters | | | | | --- | --- | --- | | stream | - | the file stream to check | ### Return value nonzero value if the end of the stream has been reached, otherwise `​0​` ### Notes This function only reports the stream state as reported by the most recent I/O operation, it does not examine the associated data source. For example, if the most recent I/O was a `[fgetc](fgetc "c/io/fgetc")`, which returned the last byte of a file, `feof` returns zero. The next `[fgetc](fgetc "c/io/fgetc")` fails and changes the stream state to *end-of-file*. Only then `feof` returns non-zero. In typical usage, input stream processing stops on any error; `feof` and `[ferror](ferror "c/io/ferror")` are then used to distinguish between different error conditions. ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int is_ok = EXIT_FAILURE; const char* fname = "/tmp/unique_name.txt"; // or tmpnam(NULL); FILE* fp = fopen(fname, "w+"); if(!fp) { perror("File opening failed"); return is_ok; } fputs("Hello, world!\n", fp); rewind(fp); int c; // note: int, not char, required to handle EOF while ((c = fgetc(fp)) != EOF) { // standard C I/O file reading loop putchar(c); } if (ferror(fp)) { puts("I/O error when reading"); } else if (feof(fp)) { puts("End of file reached successfully"); is_ok = EXIT_SUCCESS; } fclose(fp); remove(fname); return is_ok; } ``` Possible output: ``` Hello, world! End of file reached successfully ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.10.2 The feof function (p: 339) * C99 standard (ISO/IEC 9899:1999): + 7.19.10.2 The feof function (p: 305) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.10.2 The feof function ### See also | | | | --- | --- | | [clearerr](clearerr "c/io/clearerr") | clears errors (function) | | [perror](perror "c/io/perror") | displays a character string corresponding of the current error to `[stderr](std_streams "c/io/std streams")` (function) | | [ferror](ferror "c/io/ferror") | checks for a file error (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/feof "cpp/io/c/feof") for `feof` | c gets, gets_s gets, gets\_s ============= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` char *gets( char *str ); ``` | (1) | (removed in C11) | | ``` char *gets_s( char *str, rsize_t n ); ``` | (2) | (since C11) | 1) Reads `[stdin](std_streams "c/io/std streams")` into the character array pointed to by `str` until a newline character is found or end-of-file occurs. A null character is written immediately after the last character read into the array. The newline character is discarded but not stored in the buffer. 2) Reads characters from `[stdin](std_streams "c/io/std streams")` until a newline is found or end-of-file occurs. Writes only at most `n-1` characters into the array pointed to by `str`, and always writes the terminating null character (unless str is a null pointer). The newline character, if found, is discarded and does not count toward the number of characters written to the buffer. The following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `n` is zero * `n` is greater than `RSIZE_MAX` * `str` is a null pointer * endline or eof not encountered after storing `n-1` characters to the buffer. In any case, `gets_s` first finishes reading and discarding the characters from `[stdin](std_streams "c/io/std streams")` until new-line character, end-of-file condition, or read error before calling the constraint handler. As with all bounds-checked functions, `gets_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | str | - | character string to be written | ### Return value `str` on success, a null pointer on failure. If the failure has been caused by end of file condition, additionally sets the *eof* indicator (see `[feof()](feof "c/io/feof")`) on `[stdin](std_streams "c/io/std streams")`. If the failure has been caused by some other error, sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `[stdin](std_streams "c/io/std streams")`. ### Notes The `gets()` function does not perform bounds checking, therefore this function is extremely vulnerable to buffer-overflow attacks. It cannot be used safely (unless the program runs in an environment which restricts what can appear on `stdin`). For this reason, the function has been deprecated in the third corrigendum to the C99 standard and removed altogether in the C11 standard. `[fgets()](fgets "c/io/fgets")` and `gets_s()` are the recommended replacements. **Never use `gets()`.** ### References * C11 standard (ISO/IEC 9899:2011): + K.3.5.4.1 The gets\_s function (p: 602-603) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.7 The gets function (p: 298) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.7 The gets function ### See also | | | | --- | --- | | [scanffscanfsscanfscanf\_sfscanf\_ssscanf\_s](fscanf "c/io/fscanf") (C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [fgets](fgets "c/io/fgets") | gets a character string from a file stream (function) | | [fputs](fputs "c/io/fputs") | writes a character string to a file stream (function) | | [getlinegetwlinegetdelimgetwdelim](https://en.cppreference.com/w/c/experimental/dynamic/getline "c/experimental/dynamic/getline") (dynamic memory TR) | read from a stream into a automatically resized buffer until delimiter/end of line (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/gets "cpp/io/c/gets") for `gets` | c fgetwc, getwc fgetwc, getwc ============= | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` wint_t fgetwc( FILE *stream ); ``` | | (since C95) | | ``` wint_t getwc( FILE *stream ); ``` | | (since C95) | Reads the next wide character from the given input stream. `getwc()` may be implemented as a macro and may evaluate `stream` more than once. ### Parameters | | | | | --- | --- | --- | | stream | - | to read the wide character from | ### Return value The next wide character from the stream or `WEOF` on failure. If the failure has been caused by end-of-file condition, additionally sets the *eof* indicator (see `[feof()](feof "c/io/feof")`) on `stream`. If the failure has been caused by some other error, sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. If an encoding error occurred, additionally sets `[errno](../error/errno "c/error/errno")` to `EILSEQ`. ### Example ``` #include <stdio.h> #include <stdlib.h> #include <wchar.h> #include <errno.h> #include <locale.h> int main(void) { setlocale(LC_ALL, "en_US.utf8"); FILE *fp = fopen("fgetwc.dat", "w"); if(!fp) { perror("Can't open file for writing"); return EXIT_FAILURE; } fputs("кошка\n", fp); fclose(fp); fp = fopen("fgetwc.dat", "r"); if(!fp) { perror("Can't open file for reading"); return EXIT_FAILURE; } wint_t wc; errno = 0; while ((wc = fgetwc(fp)) != WEOF) putwchar(wc); if (ferror(fp)) { if (errno == EILSEQ) puts("Character encoding error while reading."); else puts("I/O error when reading"); } else if (feof(fp)) puts("End of file reached successfully"); fclose(fp); } ``` Output: ``` кошка ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.29.3.1 The fgetwc function (p: 307-308) + 7.29.3.6 The getwc function (p: 309) * C11 standard (ISO/IEC 9899:2011): + 7.29.3.1 The fgetwc function (p: 421-422) + 7.29.3.6 The getwc function (p: 424) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.1 The fgetwc function (p: 367) + 7.24.3.6 The getwc function (p: 369) ### See also | | | | --- | --- | | [fgetcgetc](fgetc "c/io/fgetc") | gets a character from a file stream (function) | | [fgetws](fgetws "c/io/fgetws") (C95) | gets a wide string from a file stream (function) | | [fputwcputwc](fputwc "c/io/fputwc") (C95) | writes a wide character to a file stream (function) | | [ungetwc](ungetwc "c/io/ungetwc") (C95) | puts a wide character back into a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fgetwc "cpp/io/c/fgetwc") for `fgetwc` | c fopen, fopen_s fopen, fopen\_s =============== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | | (1) | | | ``` FILE *fopen( const char *filename, const char *mode ); ``` | (until C99) | | ``` FILE *fopen( const char *restrict filename, const char *restrict mode ); ``` | (since C99) | | ``` errno_t fopen_s( FILE *restrict *restrict streamptr, const char *restrict filename, const char *restrict mode ); ``` | (2) | (since C11) | 1) Opens a file indicated by `filename` and returns a pointer to the file stream associated with that file. `mode` is used to determine the file access mode. 2) Same as (1), except that the pointer to the file stream is written to `streamptr` and the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `streamptr` is a null pointer * `filename` is a null pointer * `mode` is a null pointer As with all bounds-checked functions, `fopen_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | filename | - | file name to associate the file stream to | | mode | - | null-terminated character string determining [file access mode](#File_access_flags) | | streamptr | - | pointer to a pointer where the function stores the result (an out-parameter) | ### File access flags | File access mode string | Meaning | Explanation | Action if file already exists | Action if file does not exist | | --- | --- | --- | --- | --- | | `"r"` | read | Open a file for reading | read from start | failure to open | | `"w"` | write | Create a file for writing | destroy contents | create new | | `"a"` | append | Append to a file | write to end | create new | | `"r+"` | read extended | Open a file for read/write | read from start | error | | `"w+"` | write extended | Create a file for read/write | destroy contents | create new | | `"a+"` | append extended | Open a file for read/write | write to end | create new | | File access mode flag `"b"` can optionally be specified to open a file in binary mode. This flag has no effect on POSIX systems, but on Windows it disables special handling of `'\n'` and `'\x1A'`. On the append file access modes, data is written to the end of the file regardless of the current position of the file position indicator. | | The behavior is undefined if the mode is not one of the strings listed above. Some implementations define additional supported modes (e.g. [Windows](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen)). | | In update mode (`'+'`), both input and output may be performed, but output cannot be followed by input without an intervening call to `[fflush](fflush "c/io/fflush")`, `[fseek](fseek "c/io/fseek")`, `[fsetpos](fsetpos "c/io/fsetpos")` or `[rewind](rewind "c/io/rewind")`, and input cannot be followed by output without an intervening call to `[fseek](fseek "c/io/fseek")`, `[fsetpos](fsetpos "c/io/fsetpos")` or `[rewind](rewind "c/io/rewind")`, unless the input operation encountered end of file. In update mode, implementations are permitted to use binary mode even when text mode is specified. | | File access mode flag `"x"` can optionally be appended to `"w"` or `"w+"` specifiers. This flag forces the function to fail if the file exists, instead of overwriting it. (C11) | | When using `fopen_s` or `freopen_s`, file access permissions for any file created with `"w"` or `"a"` prevents other users from accessing it. File access mode flag `"u"` can optionally be prepended to any specifier that begins with `"w"` or `"a"`, to enable the default `fopen` permissions. (C11) | ### Return value 1) If successful, returns a pointer to the new file stream. The stream is fully buffered unless `filename` refers to an interactive device. On error, returns a `null pointer`. [POSIX requires](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html) that `[errno](../error/errno "c/error/errno")` be set in this case. 2) If successful, returns zero and a pointer to the new file stream is written to `*streamptr`. On error, returns a non-zero error code and writes the null pointer to `*streamptr` (unless `streamptr` is a null pointer itself). ### Notes The format of `filename` is implementation-defined, and does not necessarily refer to a file (e.g. it may be the console or another device accessible though filesystem API). On platforms that support them, `filename` may include absolute or relative filesystem path. ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int is_ok = EXIT_FAILURE; const char* fname = "/tmp/unique_name.txt"; // or tmpnam(NULL); FILE* fp = fopen(fname, "w+"); if(!fp) { perror("File opening failed"); return is_ok; } fputs("Hello, world!\n", fp); rewind(fp); int c; // note: int, not char, required to handle EOF while ((c = fgetc(fp)) != EOF) { // standard C I/O file reading loop putchar(c); } if (ferror(fp)) { puts("I/O error when reading"); } else if (feof(fp)) { puts("End of file reached successfully"); is_ok = EXIT_SUCCESS; } fclose(fp); remove(fname); return is_ok; } ``` Possible output: ``` Hello, world! End of file reached successfully ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.5.3 The fopen function (p: 223-224) + K.3.5.2.1 The fopen\_s function (p: 428-429) * C11 standard (ISO/IEC 9899:2011): + 7.21.5.3 The fopen function (p: 305-306) + K.3.5.2.1 The fopen\_s function (p: 588-590) * C99 standard (ISO/IEC 9899:1999): + 7.19.5.3 The fopen function (p: 271-272) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.5.3 The fopen function ### See also | | | | --- | --- | | [fclose](fclose "c/io/fclose") | closes a file (function) | | [fflush](fflush "c/io/fflush") | synchronizes an output stream with the actual file (function) | | [freopenfreopen\_s](freopen "c/io/freopen") (C11) | open an existing stream with a different name (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fopen "cpp/io/c/fopen") for `fopen` |
programming_docs
c fpos_t fpos\_t ======= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` typedef /* implementation-defined */ fpos_t; ``` | | | `fpos_t` is a non-array complete object type, can be used to store (by `[fgetpos](fgetpos "c/io/fgetpos")`) and restore (by `[fsetpos](fsetpos "c/io/fsetpos")`) the position and multibyte parser state (if any) for a C stream. | | | | --- | --- | | The multibyte parser state of a wide-oriented C stream is represented by a `[mbstate\_t](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t")` object, whose value is stored as part of the value of a `fpos_t` object by `[fgetpos](fgetpos "c/io/fgetpos")`. | (since C95) | ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.1 Introduction (p: 217-218) + 7.21.2 Streams (p: 218-219) * C11 standard (ISO/IEC 9899:2011): + 7.21.1 Introduction (p: 296-298) + 7.21.2 Streams (p: 298-299) * C99 standard (ISO/IEC 9899:1999): + 7.19.1 Introduction (p: 262-264) + 7.19.2 Streams (p: 264-265) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.1 Introduction + 4.9.2 Streams ### See also | | | | --- | --- | | [fgetpos](fgetpos "c/io/fgetpos") | gets the file position indicator (function) | | [fsetpos](fsetpos "c/io/fsetpos") | moves the file position indicator to a specific location in a file (function) | | [mbstate\_t](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t") (C95) | conversion state information necessary to iterate multibyte character strings (class) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fpos_t "cpp/io/c/fpos t") for `fpos_t` | c puts puts ==== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int puts( const char *str ); ``` | | | Writes every character from the null-terminated string `str` and one additional newline character `'\n'` to the output stream `stdout`, as if by repeatedly executing `[fputc](fputc "c/io/fputc")`. The terminating null character from `str` is not written. ### Parameters | | | | | --- | --- | --- | | str | - | character string to be written | ### Return value On success, returns a non-negative value. On failure, returns `[EOF](../io "c/io")` and sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. ### Notes The `puts` function appends the newline character to the output, while `[fputs](fputs "c/io/fputs")` function does not. Different implementations return different non-negative numbers: some return the last character written, some return the number of characters written (or INT\_MAX if the string was longer than that), some simply return a non-negative constant. A typical cause of failure for `puts` is running out of space on the file system, when stdout is redirected to a file. ### Example ``` #include <stdio.h> int main(void) { int rc = puts("Hello World"); if (rc == EOF) perror("puts()"); // POSIX requires that errno is set } ``` Output: ``` Hello World ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.7.9 The puts function (p: 333) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.10 The puts function (p: 299) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.10 The puts function ### See also | | | | --- | --- | | [fputs](fputs "c/io/fputs") | writes a character string to a file stream (function) | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/puts "cpp/io/c/puts") for `puts` | c fclose fclose ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fclose( FILE *stream ); ``` | | | Closes the given file stream. Any unwritten buffered data are flushed to the OS. Any unread buffered data are discarded. Whether or not the operation succeeds, the stream is no longer associated with a file, and the buffer allocated by `[setbuf](setbuf "c/io/setbuf")` or `[setvbuf](setvbuf "c/io/setvbuf")`, if any, is also disassociated and deallocated if automatic allocation was used. The behavior is undefined if the value of the pointer `stream` is used after `fclose` returns. ### Parameters | | | | | --- | --- | --- | | stream | - | the file stream to close | ### Return value `​0​` on success, `[EOF](../io "c/io")` otherwise. ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int is_ok = EXIT_FAILURE; const char* fname = "/tmp/unique_name.txt"; // or tmpnam(NULL); FILE* fp = fopen(fname, "w+"); if(!fp) { perror("File opening failed"); return is_ok; } fputs("Hello, world!\n", fp); rewind(fp); int c; // note: int, not char, required to handle EOF while ((c = fgetc(fp)) != EOF) { // standard C I/O file reading loop putchar(c); } if (ferror(fp)) { puts("I/O error when reading"); } else if (feof(fp)) { puts("End of file reached successfully"); is_ok = EXIT_SUCCESS; } fclose(fp); remove(fname); return is_ok; } ``` Possible output: ``` Hello, world! End of file reached successfully ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.5.1 The fclose function (p: 304) * C99 standard (ISO/IEC 9899:1999): + 7.19.5.1 The fclose function (p: 270) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.5.1 The fclose function ### See also | | | | --- | --- | | [fopenfopen\_s](fopen "c/io/fopen") (C11) | opens a file (function) | | [freopenfreopen\_s](freopen "c/io/freopen") (C11) | open an existing stream with a different name (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fclose "cpp/io/c/fclose") for `fclose` | c wscanf, fwscanf, swscanf, wscanf_s, fwscanf_s, swscanf_s wscanf, fwscanf, swscanf, wscanf\_s, fwscanf\_s, swscanf\_s =========================================================== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | | (1) | | | ``` int wscanf( const wchar_t *format, ... ); ``` | (since C95) (until C99) | | ``` int wscanf( const wchar_t *restrict format, ... ); ``` | (since C99) | | | (2) | | | ``` int fwscanf( FILE *stream, const wchar_t *format, ... ); ``` | (since C95) (until C99) | | ``` int fwscanf( FILE *restrict stream, const wchar_t *restrict format, ... ); ``` | (since C99) | | | (3) | | | ``` int swscanf( const wchar_t *buffer, const wchar_t *format, ... ); ``` | (since C95) (until C99) | | ``` int swscanf( const wchar_t *restrict buffer, const wchar_t *restrict format, ... ); ``` | (since C99) | | ``` int wscanf_s( const wchar_t *restrict format, ...); ``` | (4) | (since C11) | | ``` int fwscanf_s( FILE *restrict stream, const wchar_t *restrict format, ...); ``` | (5) | (since C11) | | ``` int swscanf_s( const wchar_t *restrict s, const wchar_t *restrict format, ...); ``` | (6) | (since C11) | Reads data from the a variety of sources, interprets it according to `format` and stores the results into given locations. 1) Reads the data from `[stdin](std_streams "c/io/std streams")`. 2) Reads the data from file stream `stream`. 3) Reads the data from null-terminated wide string `buffer`. Reaching the end of the string is equivalent to reaching the end-of-file condition for `fwscanf` 4-6) Same as (1-3), except that `%c`, `%s`, and `%[` conversion specifiers each expect two arguments (the usual pointer and a value of type `rsize_t` indicating the size of the receiving array, which may be `1` when reading with a `%lc` into a single wide character) and except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * any of the arguments of pointer type is a null pointer * `format`, `stream`, or `buffer` is a null pointer * the number of characters that would be written by `%c`, `%s`, or `%[`, plus the terminating null character, would exceed the second (`rsize_t`) argument provided for each of those conversion specifiers * optionally, any other detectable error, such as unknown conversion specifier As all bounds-checked functions, `wscanf_s`, `fwscanf_s`, and `swscanf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<wchar.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | input file stream to read from | | buffer | - | pointer to a null-terminated wide string to read from | | format | - | pointer to a null-terminated wide string specifying how to read the input | | ... | - | receiving arguments. | The **format** string consists of. * non-whitespace wide characters except `%`: each such character in the format string consumes exactly one identical character from the input stream, or causes the function to fail if the next character on the stream does not compare equal. * whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace characters from the input (determined as if by calling [`iswspace`](../string/wide/iswspace "c/string/wide/iswspace") in a loop). Note that there is no difference between `"\n"`, `" "`, `"\t\t"`, or other whitespace in the format string. * conversion specifications. Each conversion specification has the following format: + introductory `%` character + (optional) assignment-suppressing character `*`. If this option is present, the function does not assign the result of the conversion to any receiving argument. + (optional) integer number (greater than zero) that specifies *maximum field width*, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that `%s` and `%[` may lead to buffer overflow if the width is not provided. + (optional) *length modifier* that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below). + conversion format specifier The following format specifiers are available: | Conversion specifier | Explanation | Argument type | | --- | --- | --- | | **Length modifier →** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | matches literal `%` | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | matches a **character** or a sequence of **characters** If a width specifier is used, matches exactly *width* wide characters (the argument must be a pointer to an array with sufficient room). Unlike %s and %[, does not append the null character to the array. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `s` | matches a sequence of non-whitespace characters (a **string**) If width specifier is used, matches up to *width* or until the first whitespace character, whichever appears first. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `[`set`]` | matches a non-empty sequence of character from set of characters. If the first character of the set is `^`, then all characters not in the set are matched. If the set begins with `]` or `^]` then the `]` character is also included into the set. It is implementation-defined whether the character `-` in the non-initial position in the scanset may be indicating a range, as in `[0-9]`. If width specifier is used, matches only up to *width*. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `d` | matches a **decimal integer**. The format of the number is the same as expected by [`wcstol`](../string/wide/wcstol "c/string/wide/wcstol") with the value `10` for the `base` argument. | `signed char*` or `unsigned char*` | `signed short*` or `unsigned short*` | `signed int*` or `unsigned int*` | `signed long*` or `unsigned long*` | `signed long long*` or `unsigned long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` or `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `i` | matches an **integer**. The format of the number is the same as expected by [`wcstol`](../string/wide/wcstol "c/string/wide/wcstol") with the value `​0​` for the `base` argument (base is determined by the first characters parsed). | | `u` | matches an unsigned **decimal integer**. The format of the number is the same as expected by [`wcstoul`](../string/wide/wcstoul "c/string/wide/wcstoul") with the value `10` for the `base` argument. | | `o` | matches an unsigned **octal integer**. The format of the number is the same as expected by [`wcstoul`](../string/wide/wcstoul "c/string/wide/wcstoul") with the value `8` for the `base` argument. | | `x`, `X` | matches an unsigned **hexadecimal integer**. The format of the number is the same as expected by [`wcstoul`](../string/wide/wcstoul "c/string/wide/wcstoul") with the value `16` for the `base` argument. | | `n` | returns the **number of characters read so far**. No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined. | | `a`, `A`(C99) `e`, `E` `f`, `F` `g`, `G` | matches a **floating-point number**. The format of the number is the same as expected by [`wcstof`](../string/wide/wcstof "c/string/wide/wcstof"). | N/A | N/A | `float*` | `double*` | N/A | N/A | N/A | N/A | `long double*` | | `p` | matches implementation defined character sequence defining a **pointer**. `printf` family of functions should produce the same sequence using `%p` format specifier. | N/A | N/A | `void**` | N/A | N/A | N/A | N/A | N/A | N/A | For every conversion specifier other than `n`, the longest sequence of input characters which does not exceed any specified field width and which either is exactly what the conversion specifier expects or is a prefix of a sequence it would expect, is what's consumed from the stream. The first character, if any, after this consumed sequence remains unread. If the consumed sequence has length zero or if the consumed sequence cannot be converted as specified above, the matching failure occurs unless end-of-file, an encoding error, or a read error prevented input from the stream, in which case it is an input failure. All conversion specifiers other than `[`, `c`, and `n` consume and discard all leading whitespace characters (determined as if by calling [`iswspace`](../string/wide/iswspace "c/string/wide/iswspace")) before attempting to parse the input. These consumed characters do not count towards the specified maximum field width. If the length specifier `l` is not used, the conversion specifiers `c`, `s`, and `[` perform wide-to-multibyte character conversion as if by calling [`wcrtomb`](../string/multibyte/wcrtomb "c/string/multibyte/wcrtomb") with an [`mbstate_t`](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t") object initialized to zero before the first character is converted. The conversion specifiers `s` and `[` always store the null terminator in addition to the matched characters. The size of the destination array must be at least one greater than the specified field width. The use of `%s` or `%[`, without specifying the destination array size, is as unsafe as `[gets](gets "c/io/gets")`. The correct conversion specifications for the [fixed-width integer types](../types/integer "c/types/integer") (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although [`SCNdMAX`](../types/integer "c/types/integer"), [`SCNuMAX`](../types/integer "c/types/integer"), etc is synonymous with `%jd`, `%ju`, etc). There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple fields in the same "sink" variable. When parsing an incomplete floating-point value that ends in the exponent with no digits, such as parsing `"100er"` with the conversion specifier `%f`, the sequence `"100e"` (the longest prefix of a possibly valid floating-point number) is consumed, resulting in a matching error (the consumed sequence cannot be converted to a floating-point number), with `"r"` remaining. Some existing implementations do not follow this rule and roll back to consume only `"100"`, leaving `"er"`, e.g. [glibc bug 1765](https://sourceware.org/bugzilla/show_bug.cgi?id=1765). ### Return value 1-3) Number of receiving arguments successfully assigned, or `[EOF](../io "c/io")` if read failure occurs before the first receiving argument was assigned. 4-6) Same as (1-3), except that `[EOF](../io "c/io")` is also returned if there is a runtime constraint violation. ### Example ``` #include <stdio.h> #include <wchar.h> #include <string.h> #define NUM_VARS 3 #define ERR_READ 2 #define ERR_WRITE 3 int main(void) { wchar_t state[64]; wchar_t capital[64]; unsigned int population = 0; int elevation = 0; int age = 0; float pi = 0; #if INTERACTIVE_MODE wprintf(L"Enter state, age, and pi value: "); if (wscanf(L"%ls%d%f", state, &age, &pi) != NUM_VARS) { fprintf(stderr, "Error reading input.\n"); return ERR_READ; } #else wchar_t* input = L"California 170 3.141592"; if (swscanf(input, L"%ls%d%f", state, &age, &pi) != NUM_VARS) { fprintf(stderr, "Error reading input.\n"); return ERR_READ; } #endif wprintf(L"State: %ls\nAge : %d years\nPi : %.5f\n\n", state, age, pi); FILE* fp = tmpfile(); if (fp) { // write some data to temp file if (!fwprintf(fp, L"Mississippi Jackson 420000 807")) { fprintf(stderr, "Error writing to file.\n"); fclose(fp); return ERR_WRITE; } // rewind file pointer rewind(fp); // read data into variables fwscanf(fp, L"%ls%ls%u%d", state, capital, &population, &elevation); wprintf(L"State : %ls\nCapital: %ls\nJackson population (in 2020): %u\n" L"Highest elevation: %dft\n", state, capital, population, elevation); fclose(fp); } } ``` Possible output: ``` State: California Age : 170 years Pi : 3.14159 State : Mississippi Capital: Jackson Jackson population (in 2020): 420000 Highest elevation: 807ft ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.2.2 The fwscanf function (p: 410-416) + 7.29.2.4 The swscanf function (p: 417) + 7.29.2.12 The wscanf function (p: 421) + K.3.9.1.2 The fwscanf\_s function (p: 628-629) + K.3.9.1.5 The swscanf\_s function (p: 631) + K.3.9.1.14 The wscanf\_s function (p: 638) * C99 standard (ISO/IEC 9899:1999): + 7.24.2.2 The fwscanf function (p: 356-362) + 7.24.2.4 The swscanf function (p: 362) + 7.24.2.12 The wscanf function (p: 366-367) ### See also | | | | --- | --- | | [vwscanfvfwscanfvswscanfvwscanf\_svfwscanf\_svswscanf\_s](vfwscanf "c/io/vfwscanf") (C99)(C99)(C99)(C11)(C11)(C11) | reads formatted wide character input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fwscanf "cpp/io/c/fwscanf") for `wscanf, fwscanf, swscanf` |
programming_docs
c rename rename ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int rename( const char *old_filename, const char *new_filename ); ``` | | | Changes the filename of a file. The file is identified by character string pointed to by `old_filename`. The new filename is identified by character string pointed to by `new_filename`. If `new_filename` exists, the behavior is implementation-defined. ### Parameters | | | | | --- | --- | --- | | old\_filename | - | pointer to a null-terminated string containing the path identifying the file to rename | | new\_filename | - | pointer to a null-terminated string containing the new path of the file | ### Return value `​0​` upon success or non-zero value on error. ### Notes [POSIX](http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html) specifies many additional details on the semantics of this function. ### Example ``` #include <stdio.h> int main(void) { FILE* fp = fopen("from.txt", "w"); // create file "from.txt" if(!fp) { perror("from.txt"); return 1; } fputc('a', fp); // write to "from.txt" fclose(fp); int rc = rename("from.txt", "to.txt"); if(rc) { perror("rename"); return 1; } fp = fopen("to.txt", "r"); if(!fp) { perror("to.txt"); return 1; } printf("%c\n", fgetc(fp)); // read from "to.txt" fclose(fp); } ``` Output: ``` a ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.4.2 The rename function (p: 302-303) * C99 standard (ISO/IEC 9899:1999): + 7.19.4.2 The rename function (p: 268-269) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.4.2 The rename function ### See also | | | | --- | --- | | [remove](remove "c/io/remove") | erases a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/rename "cpp/io/c/rename") for `rename` | c fwide fwide ===== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` int fwide( FILE *stream, int mode ); ``` | | (since C95) | If `mode > 0`, attempts to make `stream` wide-oriented. If `mode < 0`, attempts to make `stream` byte-oriented. If `mode==0`, only queries the current orientation of the stream. If the orientation of the stream has already been decided (by executing output or by an earlier call to fwide), this function does nothing. ### Parameters | | | | | --- | --- | --- | | stream | - | pointer to the C I/O stream to modify or query | | mode | - | integer value greater than zero to set the stream wide, less than zero to set the stream narrow, or zero to query only | ### Return value An integer greater than zero if the stream is wide-oriented after this call, less than zero if the stream is byte-oriented after this call, and zero if the stream has no orientation. ### Example The following code sets and resets the stream orientation. ``` #include <wchar.h> #include <stdio.h> #include <stdlib.h> void show_orientation(int n) { n < 0 ? puts("\tnarrow orientation"): n > 0 ? puts("\twide orientation"): puts("\tno orientation"); } void try_read(FILE* fp) { int c = fgetc(fp); if(c == EOF) puts("\tnarrow character read failed"); else printf("\tnarrow character read '%c'\n", c); wint_t wc = fgetwc(fp); if(wc == WEOF) puts("\twide character read failed"); else printf("\twide character read '%lc'\n", wc); } int main(void) { enum fwide_orientation { narrow = -1, query, wide }; FILE* fp = fopen("main.cpp", "r"); if (!fp) { perror("fopen() failed"); return EXIT_FAILURE; } puts("1) A newly opened stream has no orientation."); show_orientation(fwide(fp, query)); puts("2) Establish byte orientation."); show_orientation(fwide(fp, narrow)); try_read(fp); puts("3) Only freopen() can reset stream orientation."); if (freopen("main.cpp", "r", fp) == NULL) { perror("freopen() failed"); return EXIT_FAILURE; } puts("4) A reopened stream has no orientation."); show_orientation(fwide(fp, query)); puts("5) Establish wide orientation."); show_orientation(fwide(fp, wide)); try_read(fp); fclose(fp); } ``` Possible output: ``` 1) A newly opened stream has no orientation. no orientation 2) Establish byte orientation. narrow orientation narrow character read '#' wide character read failed 3) Only freopen() can reset stream orientation. 4) A reopened stream has no orientation. no orientation 5) Establish wide orientation. wide orientation narrow character read failed wide character read '#' ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.29.3.5 The fwide function (p: 309) * C11 standard (ISO/IEC 9899:2011): + 7.29.3.5 The fwide function (p: 423) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.5 The fwide function (p: 369) ### See also | | | | --- | --- | | [fopenfopen\_s](fopen "c/io/fopen") (C11) | opens a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fwide "cpp/io/c/fwide") for `fwide` | c fputwc, putwc fputwc, putwc ============= | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` wint_t fputwc( wchar_t ch, FILE *stream ); ``` | | (since C95) | | ``` wint_t putwc( wchar_t ch, FILE *stream ); ``` | | (since C95) | Writes a wide character `ch` to the given output stream `stream`. `putwc()` may be implemented as a macro and may evaluate `stream` more than once. ### Parameters | | | | | --- | --- | --- | | ch | - | wide character to be written | | stream | - | the output stream | ### Return value Returns a copy of `ch` on success. On failure, returns `WEOF` and sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. If an encoding error occurred, additionally sets `[errno](../error/errno "c/error/errno")` to `EILSEQ`. ### Example ``` #include <locale.h> #include <stdio.h> #include <stdlib.h> #include <wchar.h> #include <errno.h> int main(void) { setlocale(LC_ALL, "en_US.utf8"); errno = 0; if (fputwc(L'🍌', stdout) == WEOF) { if (errno == EILSEQ) puts("Encoding error in fputwc."); else puts("I/O error in fputwc."); return EXIT_FAILURE; } } ``` Output: ``` 🍌 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.3.3 The fputwc function (p: 422-423) + 7.29.3.8 The putwc function (p: 424) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.3 The fputwc function (p: 368) + 7.24.3.8 The putwc function (p: 370) ### See also | | | | --- | --- | | [fputcputc](fputc "c/io/fputc") | writes a character to a file stream (function) | | [fputws](fputws "c/io/fputws") (C95) | writes a wide string to a file stream (function) | | [fgetwcgetwc](fgetwc "c/io/fgetwc") (C95) | gets a wide character from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fputwc "cpp/io/c/fputwc") for `fputwc` | c setvbuf setvbuf ======= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int setvbuf( FILE * stream, char * buffer, int mode, size_t size ); ``` | | (until C99) | | ``` int setvbuf( FILE *restrict stream, char *restrict buffer, int mode, size_t size ); ``` | | (since C99) | | ``` #define _IOFBF /*unspecified*/ #define _IOLBF /*unspecified*/ #define _IONBF /*unspecified*/ ``` | | | Changes the buffering mode of the given file stream `stream` as indicated by the argument `mode`. In addition, * If `buffer` is a null pointer, resizes the internal buffer to `size`. * If `buffer` is not a null pointer, instructs the stream to use the user-provided buffer of size `size` beginning at `buffer`. The stream must be closed (with `[fclose](fclose "c/io/fclose")`) before the [lifetime](../language/lifetime "c/language/lifetime") of the array pointed to by `buffer` ends. The contents of the array after a successful call to `setvbuf` are indeterminate and any attempt to use it is undefined behavior. ### Parameters | | | | | --- | --- | --- | | stream | - | the file stream to set the buffer to | | buffer | - | pointer to a buffer for the stream to use or null pointer to change size and mode only | | mode | - | buffering mode to use. It can be one of the following values: | | | | --- | --- | | `_IOFBF` | full buffering | | `_IOLBF` | line buffering | | `_IONBF` | no buffering | | | size | - | size of the buffer | ### Return value `​0​` on success or nonzero on failure. ### Notes This function may only be used after `stream` has been associated with an open file, but before any other operation (other than a failed call to `[setbuf](setbuf "c/io/setbuf")`/`setvbuf`). Not all `size` bytes will necessarily be used for buffering: the actual buffer size is usually rounded down to a multiple of 2, a multiple of page size, etc. On many implementations, line buffering is only available for terminal input streams. A common error is setting the buffer of stdin or stdout to an array whose lifetime ends before the program terminates: ``` int main(void) { char buf[BUFSIZ]; setbuf(stdin, buf); } // lifetime of buf ends, undefined behavior ``` The default buffer size `[BUFSIZ](../io "c/io")` is expected to be the most efficient buffer size for file I/O on the implementation, but POSIX [fstat](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html) often provides a better estimate. ### Example One use case for changing buffer size is when a better size is known. ``` #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> int main(void) { FILE* fp = fopen("/tmp/test.txt", "w+"); if(fp == NULL) { perror("fopen"); return EXIT_FAILURE; } struct stat stats; int fileno(FILE*); if(fstat(fileno(fp), &stats) == -1) { // POSIX only perror("fstat"); return EXIT_FAILURE; } printf("BUFSIZ is %d, but optimal block size is %ld\n", BUFSIZ, stats.st_blksize); if(setvbuf(fp, NULL, _IOFBF, stats.st_blksize) != 0) { perror("setvbuf failed"); // POSIX version sets errno return EXIT_FAILURE; } int ch; while((ch=fgetc(fp)) != EOF); // read entire file: use truss/strace to // observe the read(2) syscalls used fclose(fp); return EXIT_SUCCESS; } ``` Possible output: ``` BUFSIZ is 8192, but optimal block size is 65536 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.5.6 The setvbuf function (p: 225) * C11 standard (ISO/IEC 9899:2011): + 7.21.5.6 The setvbuf function (p: 308) * C99 standard (ISO/IEC 9899:1999): + 7.19.5.6 The setvbuf function (p: 273-274) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.5.6 The setvbuf function ### See also | | | | --- | --- | | [setbuf](setbuf "c/io/setbuf") | sets the buffer for a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/setvbuf "cpp/io/c/setvbuf") for `setvbuf` | c remove remove ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int remove( const char *fname ); ``` | | | Deletes the file identified by character string pointed to by `fname`. If the file is currently open by this or another process, the behavior of this function is implementation-defined (in particular, POSIX systems unlink the file name although the file system space is not reclaimed until the last running process closes the file; Windows does not allow the file to be deleted). ### Parameters | | | | | --- | --- | --- | | fname | - | pointer to a null-terminated string containing the path identifying the file to delete | ### Return value `​0​` upon success or non-zero value on error. ### Notes [POSIX specifies](http://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html) many additional details for the behavior of this function. ### Example ``` #include <stdio.h> int main(void) { FILE* fp = fopen("file1.txt", "w"); // create file if(!fp) { perror("file1.txt"); return 1; } puts("Created file1.txt"); fclose(fp); int rc = remove("file1.txt"); if(rc) { perror("remove"); return 1; } puts("Removed file1.txt"); fp = fopen("file1.txt", "r"); // Failure: file does not exist if(!fp) perror("Opening removed file failed"); rc = remove("file1.txt"); // Failure: file does not exist if(rc) perror("Double-remove failed"); } ``` Output: ``` Created file1.txt Removed file1.txt Opening removed file failed: No such file or directory Double-remove failed: No such file or directory ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.4.1 The remove function (p: 302) * C99 standard (ISO/IEC 9899:1999): + 7.19.4.1 The remove function (p: 268) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.4.1 The remove function ### See also | | | | --- | --- | | [rename](rename "c/io/rename") | renames a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/remove "cpp/io/c/remove") for `remove` | c stdin, stdout, stderr stdin, stdout, stderr ===================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` #define stdin /* implementation-defined */ ``` | (1) | | | ``` #define stdout /* implementation-defined */ ``` | (2) | | | ``` #define stderr /* implementation-defined */ ``` | (3) | | Three text streams are predefined. These streams are implicitly opened and unoriented at program startup. 1) Associated with the *standard input* stream, used for reading conventional input. At program startup, the stream is fully buffered if and only if the stream can be determined to not refer to an interactive device. 2) Associated with the *standard output* stream, used for writing conventional output. At program startup, the stream is fully buffered if and only if the stream can be determined to not refer to an interactive device. 3) Associated with the *standard error* stream, used for writing diagnostic output. At program startup, the stream is not fully buffered. What constitutes an interactive device is implementation-defined. These macros are expanded to expressions of type `[FILE](http://en.cppreference.com/w/c/io/FILE)\*`. ### Notes Although not mandated by POSIX, the UNIX convention is that `stdin` and `stdout` are line-buffered if associated with a terminal and `stderr` is unbuffered. These macros may be expanded to modifiable lvalues. If any of these `[FILE](http://en.cppreference.com/w/c/io/FILE)\*` lvalue is modified, subsequent operations on the corresponding stream result in unspecified or undefined behavior. ### Example This example shows a function equivalent to `[printf](fprintf "c/io/fprintf")`. ``` #include <stdarg.h> #include <stdio.h> int my_printf(const char * restrict fmt, ...) { va_list vl; va_start(vl, fmt); int ret = vfprintf(stdout, fmt, vl); va_end(vl); return ret; } int main(void) { my_printf("Rounding:\t%f %.0f %.32f\n", 1.5, 1.5, 1.3); my_printf("Padding:\t%05.2f %.2f %5.2f\n", 1.5, 1.5, 1.5); my_printf("Scientific:\t%E %e\n", 1.5, 1.5); my_printf("Hexadecimal:\t%a %A\n", 1.5, 1.5); } ``` Possible output: ``` Rounding: 1.500000 2 1.30000000000000004440892098500626 Padding: 01.50 1.50 1.50 Scientific: 1.500000E+00 1.500000e+00 Hexadecimal: 0x1.8p+0 0X1.8P+0 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.1 Introduction (p: 217-218) + 7.21.2 Streams (p: 217-219) + 7.21.2 Files (p: 219-221) * C11 standard (ISO/IEC 9899:2011): + 7.21.1 Introduction (p: 296-298) + 7.21.2 Streams (p: 298-299) + 7.21.2 Files (p: 300-302) * C99 standard (ISO/IEC 9899:1999): + 7.19.1 Introduction (p: 262-264) + 7.19.2 Streams (p: 264-265) + 7.19.2 Files (p: 266-268) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.1 Introduction + 4.9.2 Streams + 4.9.3 Files ### See also | | | | --- | --- | | [FILE](file "c/io/FILE") | object type, capable of holding all information needed to control a C I/O stream (typedef) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/std_streams "cpp/io/c/std streams") for `stdin, stdout, stderr` | c freopen, freopen_s freopen, freopen\_s =================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | | (1) | | | ``` FILE *freopen( const char *filename, const char *mode, FILE *stream ); ``` | (until C99) | | ``` FILE *freopen( const char *restrict filename, const char *restrict mode, FILE *restrict stream ); ``` | (since C99) | | ``` errno_t freopen_s( FILE *restrict *restrict newstreamptr, const char *restrict filename, const char *restrict mode, FILE *restrict stream ); ``` | (2) | (since C11) | 1) First, attempts to close the file associated with `stream`, ignoring any errors. Then, if `filename` is not null, attempts to open the file specified by `filename` using `mode` as if by `[fopen](fopen "c/io/fopen")`, and associates that file with the file stream pointed to by `stream`. If `filename` is a null pointer, then the function attempts to reopen the file that is already associated with `stream` (it is implementation defined which mode changes are allowed in this case). 2) Same as (1), except that `mode` is treated as in `fopen_s` and that the pointer to the file stream is written to `newstreamptr` and the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * `newstreamptr` is a null pointer * `stream` is a null pointer * `mode` is a null pointer As with all bounds-checked functions, `freopen_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | filename | - | file name to associate the file stream to | | mode | - | null-terminated character string determining new [file access mode](#File_access_flags) | | stream | - | the file stream to modify | | newstreamptr | - | pointer to a pointer where the function stores the result (an out-parameter) | ### File access flags | File access mode string | Meaning | Explanation | Action if file already exists | Action if file does not exist | | --- | --- | --- | --- | --- | | `"r"` | read | Open a file for reading | read from start | failure to open | | `"w"` | write | Create a file for writing | destroy contents | create new | | `"a"` | append | Append to a file | write to end | create new | | `"r+"` | read extended | Open a file for read/write | read from start | error | | `"w+"` | write extended | Create a file for read/write | destroy contents | create new | | `"a+"` | append extended | Open a file for read/write | write to end | create new | | File access mode flag `"b"` can optionally be specified to open a file in binary mode. This flag has no effect on POSIX systems, but on Windows it disables special handling of `'\n'` and `'\x1A'`. On the append file access modes, data is written to the end of the file regardless of the current position of the file position indicator. | | The behavior is undefined if the mode is not one of the strings listed above. Some implementations define additional supported modes (e.g. [Windows](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen)). | | In update mode (`'+'`), both input and output may be performed, but output cannot be followed by input without an intervening call to `[fflush](fflush "c/io/fflush")`, `[fseek](fseek "c/io/fseek")`, `[fsetpos](fsetpos "c/io/fsetpos")` or `[rewind](rewind "c/io/rewind")`, and input cannot be followed by output without an intervening call to `[fseek](fseek "c/io/fseek")`, `[fsetpos](fsetpos "c/io/fsetpos")` or `[rewind](rewind "c/io/rewind")`, unless the input operation encountered end of file. In update mode, implementations are permitted to use binary mode even when text mode is specified. | | File access mode flag `"x"` can optionally be appended to `"w"` or `"w+"` specifiers. This flag forces the function to fail if the file exists, instead of overwriting it. (C11) | | When using `fopen_s` or `freopen_s`, file access permissions for any file created with `"w"` or `"a"` prevents other users from accessing it. File access mode flag `"u"` can optionally be prepended to any specifier that begins with `"w"` or `"a"`, to enable the default `[fopen](fopen "c/io/fopen")` permissions. (C11) | ### Return value 1) A copy of the value of `stream` on success, null pointer on failure. 2) zero on success (and a copy of the value of `stream` is written to `*newstreamptr`, non-zero on error (and null pointer is written to `*newstreamptr` unless `newstreamptr` is itself a null pointer). ### Notes `freopen` is the only way to change the narrow/wide orientation of a stream once it has been established by an I/O operation or by `fwide`. Microsoft CRT version of `freopen` does not support any mode changes when `filename` is a null pointer and treats this as an error (see [documentation](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/freopen-wfreopen)). A possible workaround is the non-standard function [`_setmode()`](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode). ### Example The following code redirects `stdout` to a file. ``` #include <stdio.h> #include <stdlib.h> int main(void) { puts("stdout is printed to console"); if (freopen("redir.txt", "w", stdout) == NULL) { perror("freopen() failed"); return EXIT_FAILURE; } puts("stdout is redirected to a file"); // this is written to redir.txt fclose(stdout); return EXIT_SUCCESS; } ``` Output: ``` stdout is printed to console ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.5.4 The freopen function (p: 224-225) + K.3.5.2.2 The freopen\_s function (p: 429-430) * C11 standard (ISO/IEC 9899:2011): + 7.21.5.4 The freopen function (p: 307) + K.3.5.2.2 The freopen\_s function (p: 590) * C99 standard (ISO/IEC 9899:1999): + 7.19.5.4 The freopen function (p: 272-273) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.5.4 The freopen function ### See also | | | | --- | --- | | [fopenfopen\_s](fopen "c/io/fopen") (C11) | opens a file (function) | | [fclose](fclose "c/io/fclose") | closes a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/freopen "cpp/io/c/freopen") for `freopen` |
programming_docs
c fwrite fwrite ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` size_t fwrite( const void *buffer, size_t size, size_t count, FILE *stream ); ``` | | (until C99) | | ``` size_t fwrite( const void *restrict buffer, size_t size, size_t count, FILE *restrict stream ); ``` | | (since C99) | Writes `count` of objects from the given array `buffer` to the output stream `stream`. The objects are written as if by reinterpreting each object as an array of `unsigned char` and calling `[fputc](fputc "c/io/fputc")` `size` times for each object to write those `unsigned char`s into `stream`, in order. The file position indicator for the stream is advanced by the number of characters written. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. ### Parameters | | | | | --- | --- | --- | | buffer | - | pointer to the first object in the array to be written | | size | - | size of each object | | count | - | the number of the objects to be written | | stream | - | pointer to the output stream | ### Return value The number of objects written successfully, which may be less than `count` if an error occurs. If `size` or `count` is zero, `fwrite` returns zero and performs no other action. ### Example ``` #include <stdio.h> #include <stdlib.h> #include <assert.h> enum { SIZE = 5 }; int main(void) { double a[SIZE] = {1, 2, 3, 4, 5}; FILE *f1 = fopen("file.bin", "wb"); assert(f1); size_t r1 = fwrite(a, sizeof a[0], SIZE, f1); printf("wrote %zu elements out of %d requested\n", r1, SIZE); fclose(f1); double b[SIZE]; FILE *f2 = fopen("file.bin", "rb"); size_t r2 = fread(b, sizeof b[0], SIZE, f2); fclose(f2); printf("read back: "); for(size_t i = 0; i < r2; i++) printf("%0.2f ", b[i]); } ``` Output: ``` wrote 5 elements out of 5 requested read back: 1.00 2.00 3.00 4.00 5.00 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.8.2 The fwrite function (p: 335-336) * C99 standard (ISO/IEC 9899:1999): + 7.19.8.2 The fwrite function (p: 301-302) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.8.2 The fwrite function ### See also | | | | --- | --- | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [fputs](fputs "c/io/fputs") | writes a character string to a file stream (function) | | [fread](fread "c/io/fread") | reads from a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fwrite "cpp/io/c/fwrite") for `fwrite` | c fputc, putc fputc, putc =========== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fputc( int ch, FILE *stream ); ``` | | | | ``` int putc( int ch, FILE *stream ); ``` | | | Writes a character `ch` to the given output stream `stream`. `putc()` may be implemented as a macro and evaluate `stream` more than once, so the corresponding argument should never be an expression with side effects. Internally, the character is converted to `unsigned char` just before being written. ### Parameters | | | | | --- | --- | --- | | ch | - | character to be written | | stream | - | output stream | ### Return value On success, returns the written character. On failure, returns `[EOF](../io "c/io")` and sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. ### Example putc with error checking. ``` #include <stdio.h> #include <stdlib.h> int main(void) { int ret_code = 0; for (char c = 'a'; (ret_code != EOF) && (c != 'z'); c++) ret_code = putc(c, stdout); /* Test whether EOF was reached. */ if (ret_code == EOF) if (ferror(stdout)) { perror("putc()"); fprintf(stderr,"putc() failed in file %s at line # %d\n", __FILE__,__LINE__-7); exit(EXIT_FAILURE); } putc('\n', stdout); return EXIT_SUCCESS; } ``` Output: ``` abcdefghijklmnopqrstuvwxy ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.7.3 The fputc function (p: 331) + 7.21.7.7 The putc function (p: 333) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.3 The fputc function (p: 297) + 7.19.7.8 The putc function (p: 299) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.3 The fputc function + 4.9.7.8 The putc function ### See also | | | | --- | --- | | [putchar](putchar "c/io/putchar") | writes a character to `stdout` (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fputc "cpp/io/c/fputc") for `fputc, putc` | c fgetc, getc fgetc, getc =========== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fgetc( FILE *stream ); ``` | (1) | | | ``` int getc( FILE *stream ); ``` | (2) | | 1) Reads the next character from the given input stream. 2) Same as `fgetc`, except that if `getc` is implemented as a macro, it may evaluate stream more than once, so the corresponding argument should never be an expression with side effects. ### Parameters | | | | | --- | --- | --- | | stream | - | to read the character from | ### Return value On success, returns the obtained character as an `unsigned char` converted to an `int`. On failure, returns `[EOF](../io "c/io")`. If the failure has been caused by end-of-file condition, additionally sets the *eof* indicator (see `[feof()](feof "c/io/feof")`) on `stream`. If the failure has been caused by some other error, sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { int is_ok = EXIT_FAILURE; const char* fname = "/tmp/unique_name.txt"; // or tmpnam(NULL); FILE* fp = fopen(fname, "w+"); if(!fp) { perror("File opening failed"); return is_ok; } fputs("Hello, world!\n", fp); rewind(fp); int c; // note: int, not char, required to handle EOF while ((c = fgetc(fp)) != EOF) { // standard C I/O file reading loop putchar(c); } if (ferror(fp)) { puts("I/O error when reading"); } else if (feof(fp)) { puts("End of file reached successfully"); is_ok = EXIT_SUCCESS; } fclose(fp); remove(fname); return is_ok; } ``` Possible output: ``` Hello, world! End of file reached successfully ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.7.1 The fgetc function (p: 240-241) + 7.21.7.5 The getc function (p: 242) * C11 standard (ISO/IEC 9899:2011): + 7.21.7.1 The fgetc function (p: 330) + 7.21.7.5 The getc function (p: 332) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.1 The fgetc function (p: 296) + 7.19.7.5 The getc function (p: 297-298) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.1 The fgetc function + 4.9.7.5 The getc function ### See also | | | | --- | --- | | [getchar](getchar "c/io/getchar") | reads a character from `[stdin](std_streams "c/io/std streams")` (function) | | [getsgets\_s](gets "c/io/gets") (removed in C11)(C11) | reads a character string from `stdin` (function) | | [fputcputc](fputc "c/io/fputc") | writes a character to a file stream (function) | | [ungetc](ungetc "c/io/ungetc") | puts a character back into a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fgetc "cpp/io/c/fgetc") for `fgetc, getc` | c ftell ftell ===== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` long ftell( FILE *stream ); ``` | | | Returns the file position indicator for the file stream `stream`. If the stream is open in binary mode, the value obtained by this function is the number of bytes from the beginning of the file. If the stream is open in text mode, the value returned by this function is unspecified and is only meaningful as the input to `[fseek()](fseek "c/io/fseek")`. ### Parameters | | | | | --- | --- | --- | | stream | - | file stream to examine | ### Return value File position indicator on success or `-1L` if failure occurs. On error, the `errno` variable is set to implementation-defined positive value. ### Example Demonstrates `ftell()` with error checking. Writes then reads a few floating-point (FP) values to/from a file. ``` #include <stdio.h> #include <stdlib.h> /* If the condition is not met then exit the program with error message. */ void check(_Bool condition, const char* func, int line) { if (condition) return; perror(func); fprintf(stderr, "%s failed in file %s at line # %d\n", func, __FILE__, line - 1); exit(EXIT_FAILURE); } int main(void) { /* Prepare an array of FP values. */ #define SIZE 5 double A[SIZE] = {1.1,2.,3.,4.,5.}; /* Write array to a file. */ const char* fname = "/tmp/test.bin"; FILE* file = fopen(fname, "wb"); check(file != NULL, "fopen()", __LINE__); const int write_count = fwrite(A, sizeof(double), SIZE, file); check(write_count == SIZE, "fwrite()", __LINE__); fclose(file); /* Read the FP values into array B. */ double B[SIZE]; file = fopen(fname, "rb"); check(file != NULL, "fopen()", __LINE__); long int pos = ftell(file); /* position indicator at start of file */ check(pos != -1L, "ftell()", __LINE__); printf("pos: %ld\n", pos); const int read_count = fread(B, sizeof(double), 1, file); /* read one FP value */ check(read_count == 1, "fread()", __LINE__); pos = ftell(file); /* position indicator after reading one FP value */ check(pos != -1L, "ftell()", __LINE__); printf("pos: %ld\n", pos); printf("B[0]: %.1f\n", B[0]); /* print one FP value */ return EXIT_SUCCESS; } ``` Possible output: ``` pos: 0 pos: 8 B[0]: 1.1 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.9.4 The ftell function (p: 337-338) * C99 standard (ISO/IEC 9899:1999): + 7.19.9.4 The ftell function (p: 303-304) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.9.4 The ftell function ### See also | | | | --- | --- | | [fgetpos](fgetpos "c/io/fgetpos") | gets the file position indicator (function) | | [fseek](fseek "c/io/fseek") | moves the file position indicator to a specific location in a file (function) | | [fsetpos](fsetpos "c/io/fsetpos") | moves the file position indicator to a specific location in a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/ftell "cpp/io/c/ftell") for `ftell` | c vscanf, vfscanf, vsscanf, vscanf_s, vfscanf_s, vsscanf_s vscanf, vfscanf, vsscanf, vscanf\_s, vfscanf\_s, vsscanf\_s =========================================================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int vscanf( const char *restrict format, va_list vlist ); ``` | (1) | (since C99) | | ``` int vfscanf( FILE *restrict stream, const char *restrict format, va_list vlist ); ``` | (2) | (since C99) | | ``` int vsscanf( const char *restrict buffer, const char *restrict format, va_list vlist ); ``` | (3) | (since C99) | | ``` int vscanf_s(const char *restrict format, va_list vlist); ``` | (4) | (since C11) | | ``` int vfscanf_s( FILE *restrict stream, const char *restrict format, va_list vlist); ``` | (5) | (since C11) | | ``` int vsscanf_s( const char *restrict buffer, const char *restrict format, va_list vlist); ``` | (6) | (since C11) | Reads data from the a variety of sources, interprets it according to `format` and stores the results into locations defined by `vlist`. 1) Reads the data from `[stdin](std_streams "c/io/std streams")` 2) Reads the data from file stream `stream` 3) Reads the data from null-terminated character string `buffer`. Reaching the end of the string is equivalent to reaching the end-of-file condition for `fscanf` 4-6) Same as (1-3), except that `%c`, `%s`, and `%[` conversion specifiers each expect two arguments (the usual pointer and a value of type `rsize_t` indicating the size of the receiving array, which may be 1 when reading with a %c into a single char) and except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * any of the arguments of pointer type is a null pointer * `format`, `stream`, or `buffer` is a null pointer * the number of characters that would be written by %c, %s, or %[, plus the terminating null character, would exceed the second (rsize\_t) argument provided for each of those conversion specifiers * optionally, any other detectable error, such as unknown conversion specifier As with all bounds-checked functions, `vscanf_s` , `vfscanf_s`, and `vsscanf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | input file stream to read from | | buffer | - | pointer to a null-terminated character string to read from | | format | - | pointer to a null-terminated character string specifying how to read the input | | vlist | - | variable argument list containing the receiving arguments. | The **format** string consists of. * non-whitespace multibyte characters except `%`: each such character in the format string consumes exactly one identical character from the input stream, or causes the function to fail if the next character on the stream does not compare equal. * whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace characters from the input (determined as if by calling [`isspace`](../string/byte/isspace "c/string/byte/isspace") in a loop). Note that there is no difference between `"\n"`, `" "`, `"\t\t"`, or other whitespace in the format string. * conversion specifications. Each conversion specification has the following format: + introductory `%` character + (optional) assignment-suppressing character `*`. If this option is present, the function does not assign the result of the conversion to any receiving argument. + (optional) integer number (greater than zero) that specifies *maximum field width*, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that `%s` and `%[` may lead to buffer overflow if the width is not provided. + (optional) *length modifier* that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below). + conversion format specifier The following format specifiers are available: | Conversion specifier | Explanation | Argument type | | --- | --- | --- | | **Length modifier →** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | matches literal `%` | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | matches a **character** or a sequence of **characters** If a width specifier is used, matches exactly *width* characters (the argument must be a pointer to an array with sufficient room). Unlike %s and %[, does not append the null character to the array. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `s` | matches a sequence of non-whitespace characters (a **string**) If width specifier is used, matches up to *width* or until the first whitespace character, whichever appears first. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `[`set`]` | matches a non-empty sequence of character from set of characters. If the first character of the set is `^`, then all characters not in the set are matched. If the set begins with `]` or `^]` then the `]` character is also included into the set. It is implementation-defined whether the character `-` in the non-initial position in the scanset may be indicating a range, as in `[0-9]`. If width specifier is used, matches only up to *width*. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `d` | matches a **decimal integer**. The format of the number is the same as expected by [`strtol`](../string/byte/strtol "c/string/byte/strtol") with the value `10` for the `base` argument. | `signed char*` or `unsigned char*` | `signed short*` or `unsigned short*` | `signed int*` or `unsigned int*` | `signed long*` or `unsigned long*` | `signed long long*` or `unsigned long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` or `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `i` | matches an **integer**. The format of the number is the same as expected by [`strtol`](../string/byte/strtol "c/string/byte/strtol") with the value `​0​` for the `base` argument (base is determined by the first characters parsed). | | `u` | matches an unsigned **decimal integer**. The format of the number is the same as expected by [`strtoul`](../string/byte/strtoul "c/string/byte/strtoul") with the value `10` for the `base` argument. | | `o` | matches an unsigned **octal integer**. The format of the number is the same as expected by [`strtoul`](../string/byte/strtoul "c/string/byte/strtoul") with the value `8` for the `base` argument. | | `x`, `X` | matches an unsigned **hexadecimal integer**. The format of the number is the same as expected by [`strtoul`](../string/byte/strtoul "c/string/byte/strtoul") with the value `16` for the `base` argument. | | `n` | returns the **number of characters read so far**. No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined. | | `a`, `A`(C99) `e`, `E` `f`, `F` `g`, `G` | matches a **floating-point number**. The format of the number is the same as expected by [`strtof`](../string/byte/strtof "c/string/byte/strtof"). | N/A | N/A | `float*` | `double*` | N/A | N/A | N/A | N/A | `long double*` | | `p` | matches implementation defined character sequence defining a **pointer**. `printf` family of functions should produce the same sequence using `%p` format specifier. | N/A | N/A | `void**` | N/A | N/A | N/A | N/A | N/A | N/A | For every conversion specifier other than `n`, the longest sequence of input characters which does not exceed any specified field width and which either is exactly what the conversion specifier expects or is a prefix of a sequence it would expect, is what's consumed from the stream. The first character, if any, after this consumed sequence remains unread. If the consumed sequence has length zero or if the consumed sequence cannot be converted as specified above, the matching failure occurs unless end-of-file, an encoding error, or a read error prevented input from the stream, in which case it is an input failure. All conversion specifiers other than `[`, `c`, and `n` consume and discard all leading whitespace characters (determined as if by calling [`isspace`](../string/byte/isspace "c/string/byte/isspace")) before attempting to parse the input. These consumed characters do not count towards the specified maximum field width. The conversion specifiers `lc`, `ls`, and `l[` perform multibyte-to-wide character conversion as if by calling [`mbrtowc`](../string/multibyte/mbrtowc "c/string/multibyte/mbrtowc") with an [`mbstate_t`](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t") object initialized to zero before the first character is converted. The conversion specifiers `s` and `[` always store the null terminator in addition to the matched characters. The size of the destination array must be at least one greater than the specified field width. The use of `%s` or `%[`, without specifying the destination array size, is as unsafe as `[gets](gets "c/io/gets")`. The correct conversion specifications for the [fixed-width integer types](../types/integer "c/types/integer") (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although [`SCNdMAX`](../types/integer "c/types/integer"), [`SCNuMAX`](../types/integer "c/types/integer"), etc is synonymous with `%jd`, `%ju`, etc). There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple fields in the same "sink" variable. When parsing an incomplete floating-point value that ends in the exponent with no digits, such as parsing `"100er"` with the conversion specifier `%f`, the sequence `"100e"` (the longest prefix of a possibly valid floating-point number) is consumed, resulting in a matching error (the consumed sequence cannot be converted to a floating-point number), with `"r"` remaining. Some existing implementations do not follow this rule and roll back to consume only `"100"`, leaving `"er"`, e.g. [glibc bug 1765](https://sourceware.org/bugzilla/show_bug.cgi?id=1765). ### Return value 1-3) Number of receiving arguments successfully assigned, or `[EOF](../io "c/io")` if read failure occurs before the first receiving argument was assigned. 4-6) Same as (1-3), except that `[EOF](../io "c/io")` is also returned if there is a runtime constraint violation. ### Notes All these functions invoke `va_arg` at least once, the value of `arg` is indeterminate after the return. These functions to not invoke `va_end`, and it must be done by the caller. ### Example ``` #include <stdio.h> #include <stdbool.h> #include <stdarg.h> bool checked_sscanf(int count, const char* buf, const char *fmt, ...) { va_list ap; va_start(ap, fmt); int rc = vsscanf(buf, fmt, ap); va_end(ap); return rc == count; } int main(void) { int n, m; printf("Parsing '1 2'..."); if(checked_sscanf(2, "1 2", "%d %d", &n, &m)) puts("success"); else puts("failure"); printf("Parsing '1 a'..."); if(checked_sscanf(2, "1 a", "%d %d", &n, &m)) puts("success"); else puts("failure"); } ``` Output: ``` Parsing '1 2'...success Parsing '1 a'...failure ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.6.9 The vfscanf function (p: 327) + 7.21.6.11 The vscanf function (p: 328) + 7.21.6.14 The vsscanf function (p: 330) + K.3.5.3.9 The vfscanf\_s function (p: 597-598) + K.3.5.3.11 The vscanf\_s function (p: 599) + K.3.5.3.14 The vsscanf\_s function (p: 602) * C99 standard (ISO/IEC 9899:1999): + 7.19.6.9 The vfscanf function (p: 293) + 7.19.6.11 The vscanf function (p: 294) + 7.19.6.14 The vsscanf function (p: 295) ### See also | | | | --- | --- | | [scanffscanfsscanfscanf\_sfscanf\_ssscanf\_s](fscanf "c/io/fscanf") (C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vprintfvfprintfvsprintfvsnprintfvprintf\_svfprintf\_svsprintf\_svsnprintf\_s](vfprintf "c/io/vfprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/vfscanf "cpp/io/c/vfscanf") for `vscanf, vfscanf, vsscanf` |
programming_docs
c ferror ferror ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int ferror( FILE *stream ); ``` | | | Checks the given stream for errors. ### Parameters | | | | | --- | --- | --- | | stream | - | the file stream to check | ### Return value Nonzero value if the file stream has errors occurred, `​0​` otherwise. ### Example ``` #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <wchar.h> int main(void) { char* fname = tmpnam(NULL); FILE* f = fopen(fname, "wb"); fputs("\xff\xff\n", f); // not a valid UTF-8 character sequence fclose(f); setlocale(LC_ALL, "en_US.utf8"); f = fopen(fname, "rb"); wint_t ch; while ((ch=fgetwc(f)) != WEOF) // attempt to read as UTF-8 fails printf("%#x ", ch); if (feof(f)) puts("EOF indicator set"); if (ferror(f)) puts("Error indicator set"); } ``` Output: ``` Error indicator set ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.10.3 The ferror function (p: 339) * C99 standard (ISO/IEC 9899:1999): + 7.19.10.3 The ferror function (p: 305) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.10.3 The ferror function ### See also | | | | --- | --- | | [clearerr](clearerr "c/io/clearerr") | clears errors (function) | | [feof](feof "c/io/feof") | checks for the end-of-file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/ferror "cpp/io/c/ferror") for `ferror` | c vwprintf, vfwprintf, vswprintf, vwprintf_s, vfwprintf_s, vswprintf_s, vsnwprintf_s vwprintf, vfwprintf, vswprintf, vwprintf\_s, vfwprintf\_s, vswprintf\_s, vsnwprintf\_s ====================================================================================== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | | (1) | | | ``` int vwprintf( const wchar_t *format, va_list vlist ); ``` | (since C95) (until C99) | | ``` int vwprintf( const wchar_t *restrict format, va_list vlist ); ``` | (since C99) | | | (2) | | | ``` int vfwprintf( FILE* stream, const wchar_t *format, va_list vlist ); ``` | (since C95) (until C99) | | ``` int vfwprintf( FILE *restrict stream, const wchar_t *restrict format, va_list vlist ); ``` | (since C99) | | | (3) | | | ``` int vswprintf( wchar_t *buffer, size_t bufsz, const wchar_t *format, va_list vlist ); ``` | (since C95) (until C99) | | ``` int vswprintf( wchar_t *restrict buffer, size_t bufsz, const wchar_t *restrict format, va_list vlist ); ``` | (since C99) | | ``` int vwprintf_s( const wchar_t *restrict format, va_list vlist); ``` | (4) | (since C11) | | ``` int vfwprintf_s( FILE * restrict stream, const wchar_t *restrict format, va_list vlist); ``` | (5) | (since C11) | | ``` int vswprintf_s( wchar_t *restrict buffer, rsize_t bufsz, const wchar_t * restrict format, va_list vlist); ``` | (6) | (since C11) | | ``` int vsnwprintf_s( wchar_t *restrict buffer, rsize_t bufsz, const wchar_t *restrict format, va_list vlist); ``` | (7) | (since C11) | Loads the data from locations, defined by `vlist`, converts them to wide string equivalents and writes the results to a variety of sinks. 1) Writes the results to `[stdout](std_streams "c/io/std streams")`. 2) Writes the results to a file stream `stream`. 3) Writes the results to a wide string `buffer`. At most `bufsz-1` wide characters are written followed by null wide character. The resulting wide character string will be terminated with a null wide character, unless `bufsz` is zero. 4-6) Same as (1-3), except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * the conversion specifier `%n` is present in `format` * any of the arguments corresponding to `%s` is a null pointer * `format` or `buffer` is a null pointer * `bufsz` is zero or greater than `RSIZE_MAX/sizeof(wchar_t)` * encoding errors occur in any of string and character conversion specifiers * (for `vswprintf_s` only), the string to be stored in `buffer` (including the trailing wide null) would be exceed `bufsz` 7) Same as (6), except it will truncate the result to fit within the array pointed to by `buffer`. As with all bounds-checked functions, `vwprintf_s` , `vfwprintf_s`, `vswprintf_s`, and `vsnwprintf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | output wide stream to write to | | buffer | - | pointer to a wide string to write to | | bufsz | - | maximum number of wide characters to write | | format | - | pointer to a null-terminated wide string specifying how to interpret the data | | vlist | - | [variable argument list](../language/variadic "c/language/variadic") containing the data to print. | The **format** string consists of ordinary wide characters (except `%`), which are copied unchanged into the output stream, and conversion specifications. Each conversion specification has the following format: * introductory `%` character * (optional) one or more flags that modify the behavior of the conversion: + `-`: the result of the conversion is left-justified within the field (by default it is right-justified) + `+`: the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative) + *space*: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if `+` flag is present. + `#` : *alternative form* of the conversion is performed. See the table below for exact effects otherwise the behavior is undefined. + `0` : for integer and floating point number conversions, leading zeros are used to pad the field instead of *space* characters. For integer numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if `-` flag is present. * (optional) integer value or `*` that specifies minimum field width. The result is padded with *space* characters (by default), if required, on the left when right-justified, or on the right if left-justified. In the case when `*` is used, the width is specified by an additional argument of type `int`, which appears before the argument to be converted and the argument supplying precision if one is supplied. If the value of the argument is negative, it results with the `-` flag specified and positive field width. (Note: This is the minimum width: The value is never truncated.) + (optional) `.` followed by integer number or `*`, or neither that specifies *precision* of the conversion. In the case when `*` is used, the *precision* is specified by an additional argument of type `int`, which appears before the argument to be converted, but after the argument supplying minimum field width if one is supplied. If the value of this argument is negative, it is ignored. If neither a number nor `*` is used, the precision is taken as zero. See the table below for exact effects of *precision*. + (optional) *length modifier* that specifies the size of the argument (in combination with the conversion format specifier, it specifies the type of the corresponding argument) + conversion format specifier The following format specifiers are available: | ConversionSpecifier | Explanation | ExpectedArgument Type | | --- | --- | --- | | **LengthModifier****→** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | writes literal `%`. The full conversion specification must be `%%`. | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | writes a **single character**. The argument is first converted to `wchar_t` as if by calling `[btowc](../string/multibyte/btowc "c/string/multibyte/btowc")`. If the **l** modifier is used, the `wint_t` argument is first converted to `wchar_t`. | N/A | N/A | `int` | `wint_t` | N/A | N/A | N/A | N/A | N/A | | `s` | writes a **character string** The argument must be a pointer to the initial element of a character array containing a multibyte character sequence beginning in the initial shift state, which is converted to wide character array as if by a call to `[mbrtowc](../string/multibyte/mbrtowc "c/string/multibyte/mbrtowc")` with zero-initialized conversion state. *Precision* specifies the maximum number of wide characters to be written. If *Precision* is not specified, writes every wide characters up to and not including the first null terminator. If the **l** specifier is used, the argument must be a pointer to the initial element of an array of `wchar_t`. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `d` `i` | converts a **signed integer** into decimal representation *[-]dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | `signed char` | `short` | `int` | `long` | `long long` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `o` | converts an **unsigned integer** into octal representation *oooo*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* precision is increased if necessary, to write one leading zero. In that case if both the converted value and the precision are `​0​`, single `​0​` is written. | `unsigned char` | `unsigned short` | `unsigned int` | `unsigned long` | `unsigned long long` | `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | unsigned version of `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `x` `X` | converts an **unsigned integer** into hexadecimal representation *hhhh*. For the `x` conversion letters `abcdef` are used. For the `X` conversion letters `ABCDEF` are used. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* `0x` or `0X` is prefixed to results if the converted value is nonzero. | N/A | | `u` | converts an **unsigned integer** into decimal representation *dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | N/A | | `f` `F` | converts **floating-point number** to the decimal notation in the style *[-]ddd.ddd*. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | `double` | `double` (C99) | N/A | N/A | N/A | N/A | `long double` | | `e` `E` | converts **floating-point number** to the decimal exponent notation. For the `e` conversion style *[-]d.ddd*`e`*±dd* is used. For the `E` conversion style *[-]d.ddd*`E`*±dd* is used. The exponent contains at least two digits, more digits are used only if necessary. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `a` `A` (C99). | converts **floating-point number** to the hexadecimal exponent notation. For the `a` conversion style *[-]*`0x`*h.hhh*`p`*±d* is used. For the `A` conversion style *[-]*`0X`*h.hhh*`P`*±d* is used. The first hexadecimal digit is not `0` if the argument is a normalized floating point value. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the hexadecimal point character. The default precision is sufficient for exact representation of the value. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `g` `G` | converts **floating-point number** to decimal or decimal exponent notation depending on the value and the *precision*. For the `g` conversion style conversion with style `e` or `f` will be performed. For the `G` conversion style conversion with style `E` or `F` will be performed. Let `P` equal the precision if nonzero, `6` if the precision is not specified, or `1` if the precision is `​0​`. Then, if a conversion with style `E` would have an exponent of `X`:* if *P > X ≥ −4*, the conversion is with style `f` or `F` and precision *P − 1 − X*. * otherwise, the conversion is with style `e` or `E` and precision *P − 1*. Unless *alternative representation* is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `n` | returns the **number of characters written** so far by this call to the function. The result is *written* to the value pointed to by the argument. The specification may not contain any *flag*, *field width*, or *precision*. | `signed char*` | `short*` | `int*` | `long*` | `long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `p` | writes an implementation defined character sequence defining a **pointer**. | N/A | N/A | `void*` | N/A | N/A | N/A | N/A | N/A | N/A | The floating point conversion functions convert infinity to `inf` or `infinity`. Which one is used is implementation defined. Not-a-number is converted to `nan` or `nan(*char\_sequence*)`. Which one is used is implementation defined. The conversions `F`, `E`, `G`, `A` output `INF`, `INFINITY`, `NAN` instead. Even though `%c` expects `int` argument, it is safe to pass a `char` because of the integer promotion that takes place when a variadic function is called. The correct conversion specifications for the fixed-width character types (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although `[PRIdMAX](../types/integer "c/types/integer")`, `[PRIuMAX](../types/integer "c/types/integer")`, etc is synonymous with `%jd`, `%ju`, etc). The memory-writing conversion specifier `%n` is a common target of security exploits where format strings depend on user input and is not supported by the bounds-checked `printf_s` family of functions. There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple `%n` results in the same variable or, as an edge case, printing a string modified by an earlier `%n` within the same call. If a conversion specification is invalid, the behavior is undefined. ### Return value 1,4) The number of wide characters written if successful or negative value if an error occurred. 3) The number of wide characters written if successful or negative value if an error occurred. If the resulting string gets truncated due to `bufsz` limit, function returns the total number of characters (not including the terminating null wide character) which would have been written, if the limit were not imposed. 2,5) number of wide characters transmitted to the output stream or negative value if an output error, a runtime constraints violation error, or an encoding error occurred. 6) number of wide characters written to `buffer`, not counting the null wide character (which is always written as long as `buffer` is not a null pointer and `bufsz` is not zero and not greater than `RSIZE_MAX/sizeof(wchar_t)`), or zero on runtime constraint violations, and negative value on encoding errors. 7) number of wide characters not including the terminating null character (which is always written as long as `buffer` is not a null pointer and `bufsz` is not zero and not greater than `RSIZE_MAX/sizeof(wchar_t)`), which would have been written to `buffer` if `bufsz` was ignored, or a negative value if a runtime constraints violation or an encoding error occurred. ### Notes All these functions invoke `va_arg` at least once, the value of `arg` is indeterminate after the return. These functions to not invoke `va_end`, and it must be done by the caller. While narrow strings provide `[vsnprintf](vfprintf "c/io/vfprintf")`, which makes it possible to determine the required output buffer size, there is no equivalent for wide strings (until C11's vsnwprintf\_s), and in order to determine the buffer size, the program may need to call `vswprintf`, check the result value, and reallocate a larger buffer, trying again until successful. `vsnwprintf_s`, unlike `vswprintf_s`, will truncate the result to fit within the array pointed to by `buffer`, even though truncation is treated as an error by most bounds-checked functions. ### Example ``` #include <stdio.h> #include <time.h> #include <locale.h> #include <stdarg.h> #include <stddef.h> #include <wchar.h> void debug_wlog(const wchar_t *fmt, ...) { struct timespec ts; timespec_get(&ts, TIME_UTC); char time_buf[100]; size_t rc = strftime(time_buf, sizeof time_buf, "%D %T", gmtime(&ts.tv_sec)); snprintf(time_buf + rc, sizeof time_buf - rc, ".%06ld UTC", ts.tv_nsec / 1000); va_list args; va_start(args, fmt); wchar_t buf[1024]; int rc2 = vswprintf(buf, sizeof buf / sizeof *buf, fmt, args); va_end(args); if(rc2 > 0) wprintf(L"%s [debug]: %ls\n", time_buf, buf); else wprintf(L"%s [debug]: (string too long)\n", time_buf); } int main(void) { setlocale(LC_ALL, ""); debug_wlog(L"Logging, %d, %d, %d", 1, 2, 3); } ``` Possible output: ``` 02/20/15 22:12:38.476575 UTC [debug]: Logging, 1, 2, 3 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.2.5 The vfwprintf function (p: 417-418) + 7.29.2.7 The vswprintf function (p: 419) + 7.29.2.9 The vwprintf function (p: 420) + K.3.9.1.6 The vfwprintf\_s function (p: 632) + K.3.9.1.8 The vsnwprintf\_s function (p: 633-634) + K.3.9.1.9 The vswprintf\_s function (p: 634-635) + K.3.9.1.11 The vwprintf\_s function (p: 636) * C99 standard (ISO/IEC 9899:1999): + 7.24.2.5 The vfwprintf function (p: 363) + 7.24.2.7 The vswprintf function (p: 364) + 7.24.2.9 The vwprintf function (p: 365) ### See also | | | | --- | --- | | [vprintfvfprintfvsprintfvsnprintfvprintf\_svfprintf\_svsprintf\_svsnprintf\_s](vfprintf "c/io/vfprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [wprintffwprintfswprintfwprintf\_sfwprintf\_sswprintf\_ssnwprintf\_s](fwprintf "c/io/fwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/vfwprintf "cpp/io/c/vfwprintf") for `vwprintf, vfwprintf, vswprintf` |
programming_docs
c ungetc ungetc ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int ungetc( int ch, FILE *stream ); ``` | | | If `ch` does not equal `[EOF](../io "c/io")`, pushes the character `ch` (reinterpreted as `unsigned char`) into the input buffer associated with the stream `stream` in such a manner that subsequent read operation from `stream` will retrieve that character. The external device associated with the stream is not modified. Stream repositioning operations `[fseek](fseek "c/io/fseek")`, `[fsetpos](fsetpos "c/io/fsetpos")`, and `[rewind](rewind "c/io/rewind")` discard the effects of `ungetc`. If `ungetc` is called more than once without an intervening read or repositioning, it may fail (in other words, a pushback buffer of size 1 is guaranteed, but any larger buffer is implementation-defined). If multiple successful `ungetc` were performed, read operations retrieve the pushed-back characters in reverse order of `ungetc`. If `ch` equals `[EOF](../io "c/io")`, the operation fails and the stream is not affected. A successful call to `ungetc` clears the end of file status flag `[feof](feof "c/io/feof")`. A successful call to `ungetc` on a binary stream decrements the stream position indicator by one (the behavior is indeterminate if the stream position indicator was zero). A successful call to `ungetc` on a text stream modifies the stream position indicator in unspecified manner but guarantees that after all pushed-back characters are retrieved with a read operation, the stream position indicator is equal to its value before `ungetc`. ### Parameters | | | | | --- | --- | --- | | ch | - | character to be pushed into the input stream buffer | | stream | - | file stream to put the character back to | ### Return value On success `ch` is returned. On failure `[EOF](../io "c/io")` is returned and the given stream remains unchanged. ### Notes The size of the pushback buffer varies in practice from 4k (Linux, MacOS) to as little as 4 (Solaris) or the guaranteed minimum 1 (HPUX, AIX). The apparent size of the pushback buffer may be larger if the character that is pushed back equals the character existing at that location in the external character sequence (the implementation may simply decrement the read file position indicator and avoid maintaining a pushback buffer). ### Example demonstrates the original purpose of `ungetc`: implementation of `[scanf](fscanf "c/io/fscanf")`. ``` #include <ctype.h> #include <stdio.h> void demo_scanf(const char* fmt, FILE* s) { while (*fmt != '\0') { if (*fmt == '%') { int c; switch (*++fmt) { case 'u': while (isspace(c=getc(s))) {} unsigned int num = 0; while (isdigit(c)) { num = num*10 + c-'0'; c = getc(s); } printf("%%u scanned %u\n", num); ungetc(c, s); break; case 'c': c = getc(s); printf("%%c scanned '%c'\n", c); break; } } else { ++fmt; } } } int main(void) { FILE* f = fopen("input.txt", "w+"); if (f != NULL) { fputs("123x", f); rewind(f); demo_scanf("%u%c", f); fclose(f); } return 0; } ``` Output: ``` %u scanned 123 %c scanned 'x' ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.7.10 The ungetc function (p: 243) * C11 standard (ISO/IEC 9899:2011): + 7.21.7.10 The ungetc function (p: 334) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.11 The ungetc function (p: 300) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.11 The ungetc function ### See also | | | | --- | --- | | [fgetcgetc](fgetc "c/io/fgetc") | gets a character from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/ungetc "cpp/io/c/ungetc") for `ungetc` | c fgetpos fgetpos ======= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fgetpos( FILE *stream, fpos_t *pos ); ``` | | (until C99) | | ``` int fgetpos( FILE *restrict stream, fpos_t *restrict pos ); ``` | | (since C99) | Obtains the file position indicator and the current parse state (if any) for the file stream `stream` and stores them in the object pointed to by `pos`. The value stored is only meaningful as the input to `[fsetpos](fsetpos "c/io/fsetpos")`. ### Parameters | | | | | --- | --- | --- | | stream | - | file stream to examine | | pos | - | pointer to a `[fpos\_t](fpos_t "c/io/fpos t")` object to store the file position indicator to | ### Return value `​0​` upon success, nonzero value otherwise. ### Example ``` #include <stdio.h> #include <stdlib.h> #include <assert.h> int main(void) { // prepare a file holding 4 values of type double enum {SIZE = 4}; FILE* fp = fopen("test.bin", "wb"); assert(fp); int rc = fwrite((double[SIZE]){1.1, 2.2, 3.3, 4.4}, sizeof(double), SIZE, fp); assert(rc == SIZE); fclose(fp); // demo using fsetpos to return to the beginning of a file fp = fopen("test.bin", "rb"); fpos_t pos; fgetpos(fp, &pos); // store start of file in pos double d; rc = fread(&d, sizeof d, 1, fp); // read the first double assert(rc == 1); printf("First value in the file: %.1f\n", d); fsetpos(fp,&pos); // move file position back to the start of the file rc = fread(&d, sizeof d, 1, fp); // read the first double again assert(rc == 1); printf("First value in the file again: %.1f\n", d); fclose(fp); // demo error handling rc = fsetpos(stdin, &pos); if(rc) perror("could not fsetpos stdin"); } ``` Output: ``` First value in the file: 1.1 First value in the file again: 1.1 could not fsetpos stdin: Illegal seek ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.9.1 The fgetpos function (p: 336) * C99 standard (ISO/IEC 9899:1999): + 7.19.9.1 The fgetpos function (p: 302) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.9.1 The fgetpos function ### See also | | | | --- | --- | | [ftell](ftell "c/io/ftell") | returns the current file position indicator (function) | | [fseek](fseek "c/io/fseek") | moves the file position indicator to a specific location in a file (function) | | [fsetpos](fsetpos "c/io/fsetpos") | moves the file position indicator to a specific location in a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fgetpos "cpp/io/c/fgetpos") for `fgetpos` | c putchar putchar ======= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int putchar( int ch ); ``` | | | Writes a character `ch` to `stdout`. Internally, the character is converted to `unsigned char` just before being written. Equivalent to `[putc](http://en.cppreference.com/w/c/io/fputc)(ch, [stdout](http://en.cppreference.com/w/c/io/std_streams))`. ### Parameters | | | | | --- | --- | --- | | ch | - | character to be written | ### Return value On success, returns the written character. On failure, returns `[EOF](../io "c/io")` and sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `[stdout](std_streams "c/io/std streams")`. ### Example putchar with error checking. ``` #include <stdio.h> #include <stdlib.h> int main(void) { int ret_code = 0; for (char c = 'a'; (ret_code != EOF) && (c != 'z'); c++) ret_code = putchar(c); /* Test whether EOF was reached. */ if (ret_code == EOF) if (ferror(stdout)) { fprintf(stderr,"putchar() failed in file %s at line # %d\n", __FILE__,__LINE__-6); perror("putchar()"); exit(EXIT_FAILURE); } putchar('\n'); // putchar return value is not equal to the argument int r = 0x1070; printf("\n0x%x\n", r); r = putchar(r); printf("\n0x%x\n", r); } ``` Output: ``` abcdefghijklmnopqrstuvwxy 0x1070 p 0x70 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.7.8 The putchar function (p: 333) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.9 The putchar function (p: 299) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.9 The putchar function ### See also | | | | --- | --- | | [fputcputc](fputc "c/io/fputc") | writes a character to a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/putchar "cpp/io/c/putchar") for `putchar` | c scanf, fscanf, sscanf, scanf_s, fscanf_s, sscanf_s scanf, fscanf, sscanf, scanf\_s, fscanf\_s, sscanf\_s ===================================================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | | (1) | | | ``` int scanf( const char *format, ... ); ``` | (until C99) | | ``` int scanf( const char *restrict format, ... ); ``` | (since C99) | | | (2) | | | ``` int fscanf( FILE *stream, const char *format, ... ); ``` | (until C99) | | ``` int fscanf( FILE *restrict stream, const char *restrict format, ... ); ``` | (since C99) | | | (3) | | | ``` int sscanf( const char *buffer, const char *format, ... ); ``` | (until C99) | | ``` int sscanf( const char *restrict buffer, const char *restrict format, ... ); ``` | (since C99) | | ``` int scanf_s(const char *restrict format, ...); ``` | (4) | (since C11) | | ``` int fscanf_s(FILE *restrict stream, const char *restrict format, ...); ``` | (5) | (since C11) | | ``` int sscanf_s(const char *restrict buffer, const char *restrict format, ...); ``` | (6) | (since C11) | Reads data from a variety of sources, interprets it according to `format` and stores the results into given locations. 1) reads the data from `[stdin](std_streams "c/io/std streams")` 2) reads the data from file stream `stream` 3) reads the data from null-terminated character string `buffer`. Reaching the end of the string is equivalent to reaching the end-of-file condition for `fscanf` 4-6) Same as (1-3), except that `%c`, `%s`, and `%[` conversion specifiers each expect two arguments (the usual pointer and a value of type `rsize_t` indicating the size of the receiving array, which may be `1` when reading with a `%c` into a single char) and except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * any of the arguments of pointer type is a null pointer * `format`, `stream`, or `buffer` is a null pointer * the number of characters that would be written by `%c`, `%s`, or `%[`, plus the terminating null character, would exceed the second (`rsize_t`) argument provided for each of those conversion specifiers * optionally, any other detectable error, such as unknown conversion specifier As with all bounds-checked functions, `scanf_s` , `fscanf_s`, and `sscanf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | input file stream to read from | | buffer | - | pointer to a null-terminated character string to read from | | format | - | pointer to a null-terminated character string specifying how to read the input | | ... | - | receiving arguments. | The **format** string consists of. * non-whitespace multibyte characters except `%`: each such character in the format string consumes exactly one identical character from the input stream, or causes the function to fail if the next character on the stream does not compare equal. * whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace characters from the input (determined as if by calling [`isspace`](../string/byte/isspace "c/string/byte/isspace") in a loop). Note that there is no difference between `"\n"`, `" "`, `"\t\t"`, or other whitespace in the format string. * conversion specifications. Each conversion specification has the following format: + introductory `%` character + (optional) assignment-suppressing character `*`. If this option is present, the function does not assign the result of the conversion to any receiving argument. + (optional) integer number (greater than zero) that specifies *maximum field width*, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that `%s` and `%[` may lead to buffer overflow if the width is not provided. + (optional) *length modifier* that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below). + conversion format specifier The following format specifiers are available: | Conversion specifier | Explanation | Argument type | | --- | --- | --- | | **Length modifier →** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | matches literal `%` | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | matches a **character** or a sequence of **characters** If a width specifier is used, matches exactly *width* characters (the argument must be a pointer to an array with sufficient room). Unlike %s and %[, does not append the null character to the array. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `s` | matches a sequence of non-whitespace characters (a **string**) If width specifier is used, matches up to *width* or until the first whitespace character, whichever appears first. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `[`set`]` | matches a non-empty sequence of character from set of characters. If the first character of the set is `^`, then all characters not in the set are matched. If the set begins with `]` or `^]` then the `]` character is also included into the set. It is implementation-defined whether the character `-` in the non-initial position in the scanset may be indicating a range, as in `[0-9]`. If width specifier is used, matches only up to *width*. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `d` | matches a **decimal integer**. The format of the number is the same as expected by [`strtol`](../string/byte/strtol "c/string/byte/strtol") with the value `10` for the `base` argument. | `signed char*` or `unsigned char*` | `signed short*` or `unsigned short*` | `signed int*` or `unsigned int*` | `signed long*` or `unsigned long*` | `signed long long*` or `unsigned long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` or `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `i` | matches an **integer**. The format of the number is the same as expected by [`strtol`](../string/byte/strtol "c/string/byte/strtol") with the value `​0​` for the `base` argument (base is determined by the first characters parsed). | | `u` | matches an unsigned **decimal integer**. The format of the number is the same as expected by [`strtoul`](../string/byte/strtoul "c/string/byte/strtoul") with the value `10` for the `base` argument. | | `o` | matches an unsigned **octal integer**. The format of the number is the same as expected by [`strtoul`](../string/byte/strtoul "c/string/byte/strtoul") with the value `8` for the `base` argument. | | `x`, `X` | matches an unsigned **hexadecimal integer**. The format of the number is the same as expected by [`strtoul`](../string/byte/strtoul "c/string/byte/strtoul") with the value `16` for the `base` argument. | | `n` | returns the **number of characters read so far**. No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined. | | `a`, `A`(C99) `e`, `E` `f`, `F` `g`, `G` | matches a **floating-point number**. The format of the number is the same as expected by [`strtof`](../string/byte/strtof "c/string/byte/strtof"). | N/A | N/A | `float*` | `double*` | N/A | N/A | N/A | N/A | `long double*` | | `p` | matches implementation defined character sequence defining a **pointer**. `printf` family of functions should produce the same sequence using `%p` format specifier. | N/A | N/A | `void**` | N/A | N/A | N/A | N/A | N/A | N/A | For every conversion specifier other than `n`, the longest sequence of input characters which does not exceed any specified field width and which either is exactly what the conversion specifier expects or is a prefix of a sequence it would expect, is what's consumed from the stream. The first character, if any, after this consumed sequence remains unread. If the consumed sequence has length zero or if the consumed sequence cannot be converted as specified above, the matching failure occurs unless end-of-file, an encoding error, or a read error prevented input from the stream, in which case it is an input failure. All conversion specifiers other than `[`, `c`, and `n` consume and discard all leading whitespace characters (determined as if by calling [`isspace`](../string/byte/isspace "c/string/byte/isspace")) before attempting to parse the input. These consumed characters do not count towards the specified maximum field width. The conversion specifiers `lc`, `ls`, and `l[` perform multibyte-to-wide character conversion as if by calling [`mbrtowc`](../string/multibyte/mbrtowc "c/string/multibyte/mbrtowc") with an [`mbstate_t`](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t") object initialized to zero before the first character is converted. The conversion specifiers `s` and `[` always store the null terminator in addition to the matched characters. The size of the destination array must be at least one greater than the specified field width. The use of `%s` or `%[`, without specifying the destination array size, is as unsafe as `[gets](gets "c/io/gets")`. The correct conversion specifications for the [fixed-width integer types](../types/integer "c/types/integer") (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although [`SCNdMAX`](../types/integer "c/types/integer"), [`SCNuMAX`](../types/integer "c/types/integer"), etc is synonymous with `%jd`, `%ju`, etc). There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple fields in the same "sink" variable. When parsing an incomplete floating-point value that ends in the exponent with no digits, such as parsing `"100er"` with the conversion specifier `%f`, the sequence `"100e"` (the longest prefix of a possibly valid floating-point number) is consumed, resulting in a matching error (the consumed sequence cannot be converted to a floating-point number), with `"r"` remaining. Some existing implementations do not follow this rule and roll back to consume only `"100"`, leaving `"er"`, e.g. [glibc bug 1765](https://sourceware.org/bugzilla/show_bug.cgi?id=1765). If a conversion specification is invalid, the behavior is undefined. ### Return value 1-3) Number of receiving arguments successfully assigned (which may be zero in case a matching failure occurred before the first receiving argument was assigned), or `[EOF](../io "c/io")` if input failure occurs before the first receiving argument was assigned. 4-6) Same as (1-3), except that `[EOF](../io "c/io")` is also returned if there is a runtime constraint violation. ### Complexity Not guaranteed. Notably, some implementations of `sscanf` are O(N), where `N = [strlen](http://en.cppreference.com/w/c/string/byte/strlen)(buffer)` [[1]](https://sourceware.org/bugzilla/show_bug.cgi?id=17577). ### Notes Because most conversion specifiers first consume all consecutive whitespace, code such as. ``` scanf("%d", &a); scanf("%d", &b); ``` will read two integers that are entered on different lines (second `%d` will consume the newline left over by the first) or on the same line, separated by spaces or tabs (second `%d` will consume the spaces or tabs). The conversion specifiers that do not consume leading whitespace, such as `%c`, can be made to do so by using a whitespace character in the format string: ``` scanf("%d", &a); scanf(" %c", &c); // consume all consecutive whitespace after %d, then read a char ``` ### Example ``` #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> #include <stddef.h> #include <locale.h> int main(void) { int i, j; float x, y; char str1[10], str2[4]; wchar_t warr[2]; setlocale(LC_ALL, "en_US.utf8"); char input[] = "25 54.32E-1 Thompson 56789 0123 56ß水"; /* parse as follows: %d: an integer %f: a floating-point value %9s: a string of at most 9 non-whitespace characters %2d: two-digit integer (digits 5 and 6) %f: a floating-point value (digits 7, 8, 9) %*d: an integer which isn't stored anywhere ' ': all consecutive whitespace %3[0-9]: a string of at most 3 decimal digits (digits 5 and 6) %2lc: two wide characters, using multibyte to wide conversion */ int ret = sscanf(input, "%d%f%9s%2d%f%*d %3[0-9]%2lc", &i, &x, str1, &j, &y, str2, warr); printf("Converted %d fields:\n" "i = %d\n" "x = %f\n" "str1 = %s\n" "j = %d\n" "y = %f\n" "str2 = %s\n" "warr[0] = U+%x\n" "warr[1] = U+%x\n", ret, i, x, str1, j, y, str2, warr[0], warr[1]); #ifdef __STDC_LIB_EXT1__ int n = sscanf_s(input, "%d%f%s", &i, &x, str1, (rsize_t)sizeof str1); // writes 25 to i, 5.432 to x, the 9 bytes "Thompson\0" to str1, and 3 to n. #endif } ``` Possible output: ``` Converted 7 fields: i = 25 x = 5.432000 str1 = Thompson j = 56 y = 789.000000 str2 = 56 warr[0] = U+df warr[1] = U+6c34 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.6.2 The fscanf function (p: 231-236) + 7.21.6.4 The scanf function (p: 236-237) + 7.21.6.7 The sscanf function (p: 238-239) + K.3.5.3.2 The fscanf\_s function (p: 430-431) + K.3.5.3.4 The scanf\_s function (p: 432) + K.3.5.3.7 The sscanf\_s function (p: 433) * C11 standard (ISO/IEC 9899:2011): + 7.21.6.2 The fscanf function (p: 317-324) + 7.21.6.4 The scanf function (p: 325) + 7.21.6.7 The sscanf function (p: 326) + K.3.5.3.2 The fscanf\_s function (p: 592-593) + K.3.5.3.4 The scanf\_s function (p: 594) + K.3.5.3.7 The sscanf\_s function (p: 596) * C99 standard (ISO/IEC 9899:1999): + 7.19.6.2 The fscanf function (p: 282-289) + 7.19.6.4 The scanf function (p: 290) + 7.19.6.7 The sscanf function (p: 291) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.6.2 The fscanf function + 4.9.6.4 The scanf function + 4.9.6.6 The sscanf function ### See also | | | | --- | --- | | [vscanfvfscanfvsscanfvscanf\_svfscanf\_svsscanf\_s](vfscanf "c/io/vfscanf") (C99)(C99)(C99)(C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [fgets](fgets "c/io/fgets") | gets a character string from a file stream (function) | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fscanf "cpp/io/c/fscanf") for `scanf, fscanf, sscanf` |
programming_docs
c fgetws fgetws ====== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` wchar_t *fgetws( wchar_t *str, int count, FILE *stream ); ``` | | (since C95) (until C99) | | ``` wchar_t *fgetws( wchar_t * restrict str, int count, FILE * restrict stream ); ``` | | (since C99) | Reads at most `count - 1` wide characters from the given file stream and stores them in `str`. The produced wide string is always null-terminated. Parsing stops if end-of-file occurs or a newline wide character is found, in which case `str` will contain that wide newline character. ### Parameters | | | | | --- | --- | --- | | str | - | wide string to read the characters to | | count | - | the length of `str` | | stream | - | file stream to read the data from | ### Return value `str` on success, a null pointer on an error. ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.3.2 The fgetws function (p: 422) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.2 The fgetws function (p: 367-368) ### See also | | | | --- | --- | | [wscanffwscanfswscanfwscanf\_sfwscanf\_sswscanf\_s](fwscanf "c/io/fwscanf") (C95)(C95)(C95)(C11)(C11)(C11) | reads formatted wide character input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [fgetwcgetwc](fgetwc "c/io/fgetwc") (C95) | gets a wide character from a file stream (function) | | [fputws](fputws "c/io/fputws") (C95) | writes a wide string to a file stream (function) | | [getlinegetwlinegetdelimgetwdelim](https://en.cppreference.com/w/c/experimental/dynamic/getline "c/experimental/dynamic/getline") (dynamic memory TR) | read from a stream into a automatically resized buffer until delimiter/end of line (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fgetws "cpp/io/c/fgetws") for `fgetws` | c FILE FILE ==== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` typedef /* unspecified */ FILE; ``` | | | Each `FILE` object denotes a C stream. C standard does not specify whether `FILE` is a complete object type. While it may be possible to copy a valid `FILE`, using a pointer to such a copy as an argument for an I/O function invokes unspecified behavior. In other words, `FILE` may be semantically non-copyable. I/O streams can be used for both unformatted and formatted input and output. Furthermore, the functions that handle input and output can also be locale-sensitive, such that wide/multibyte conversions are performed as necessary. ### Stream state Besides the system-specific information necessary to access the device (*e.g.,* a POSIX file descriptor), each `FILE` object directly or indirectly holds the following: 1. (C95) Character width: unset, narrow, or wide. 2. (C95) Parse state for conversions between multibyte and wide characters (an object of type `[mbstate\_t](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t")`) 3. Buffering state: unbuffered, line-buffered, fully buffered. 4. The buffer, which may be replaced by an external, user-provided buffer. 5. I/O mode: input, output, or update (both input and output). 6. Binary/text mode indicator. 7. End-of-file status indicator. 8. Error status indicator. 9. File position indicator, accessible as an object of type `[fpos\_t](fpos_t "c/io/fpos t")`, which, for wide streams, includes parse state. 10. (C11) Reentrant lock used to prevent data races when multiple threads read, write, position, or query the position of a stream. #### Narrow and wide orientation A newly opened stream has no orientation. The first call to `fwide` or to any I/O function establishes the orientation: a wide I/O function makes the stream wide-oriented; a narrow I/O function makes the stream narrow-oriented. Once set, the orientation can be changed with only `[freopen](freopen "c/io/freopen")`. Narrow I/O functions cannot be called on a wide-oriented stream; wide I/O functions cannot be called on a narrow-oriented stream. Wide I/O functions convert between wide and multibyte characters as if by calling `[mbrtowc](../string/multibyte/mbrtowc "c/string/multibyte/mbrtowc")` or `[wcrtomb](../string/multibyte/wcrtomb "c/string/multibyte/wcrtomb")` with the coversion state as described by the stream. Unlike the multibyte character strings that are valid in a program, multibyte character sequences in the file may contain embedded nulls and do not have to begin or end in the initial shift state. The conversion state of a stream with wide orientation is established by the C locale that is installed at the time the stream's orientation is set. #### Binary and text modes A *text stream* is an ordered sequence of characters that can be composed into lines; a line can be decomposed into zero or more characters plus a terminating `'\n'` (“newline”) character. Whether the last line requires a terminating `'\n'` is implementation-defined. Furthermore, characters may have to be added, altered, or deleted on input and output to conform to the conventions for representing text in the OS (in particular, C streams on Windows OS convert `'\n'` to `'\r\n'` on output, and convert `'\r\n'` to `'\n'` on input). Data read in from a text stream is guaranteed to compare equal to the data that were earlier written out to that stream only if each of the following is true: * The data consist of only printing characters and/or the control characters `'\t'` and `'\n'` (in particular, on Windows OS, the character `'\0x1A'` terminates input). * No `'\n'` character is immediately preceded by space characters (such space characters may disappear when such output is later read as input). * The last character is `'\n'`. A *binary stream* is an ordered sequence of characters that can transparently record internal data. Data read in from a binary stream always equal the data that were earlier written out to that stream, except that an implementation is allowed to append an indeterminate number of null characters to the end of the stream. A wide binary stream doesn't need to end in the initial shift state. ### Notes POSIX explicitly requires that the `LC_CTYPE` facet of the currently installed C locale be stored within the `FILE` object the moment the stream's orientation becomes wide; POSIX requires that this `LC_CTYPE` facet be used for all future I/O on this stream until the orientation is changed, regardless of any subsequent call to `[setlocale](../locale/setlocale "c/locale/setlocale")`. It is intended that each line of text be composed of data that are essentially human-readable. POSIX implementations do not distinguish between text and binary streams (there is no special mapping for `'\n'` or any other characters). ### References * C17 standard (ISO/IEC 9899:2018): + 7.21 Input/output <stdio.h> (p: 217-247) + 7.29 Extended multibyte and wide character utilities <wchar.h> (p: 295-325) * C11 standard (ISO/IEC 9899:2011): + 7.21 Input/output <stdio.h> (p: 296-339) + 7.29 Extended multibyte and wide character utilities <wchar.h> (p: 402-446) * C99 standard (ISO/IEC 9899:1999): + 7.19 Input/output <stdio.h> (p: 262-305) + 7.24 Extended multibyte and wide character utilities <wchar.h> (p: 348-392) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9 INPUT/OUTPUT <stdio.h> ### See also | | | | --- | --- | | [stdinstdoutstderr](std_streams "c/io/std streams") | expression of type `FILE*` associated with the input streamexpression of type `FILE*` associated with the output streamexpression of type `FILE*` associated with the error output stream (macro constant) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/FILE "cpp/io/c/FILE") for `FILE` | c perror perror ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` void perror( const char *s ); ``` | | | Prints a textual description of the error code currently stored in the system variable `[errno](../error/errno "c/error/errno")` to `[stderr](std_streams "c/io/std streams")`. The description is formed by concatenating the following components: * the contents of the null-terminated byte string pointed to by `s`, followed by `": "` (unless `s` is a null pointer or the character pointed to by `s` is the null character) * implementation-defined error message string describing the error code stored in `errno`, followed by `'\n'`. The error message string is identical to the result of `[strerror](http://en.cppreference.com/w/c/string/byte/strerror)(errno)`. ### Parameters | | | | | --- | --- | --- | | s | - | pointer to a null-terminated string with explanatory message | ### Return value (none). ### Example ``` #include <stdio.h> int main(void) { FILE *f = fopen("non_existent", "r"); if (f == NULL) { perror("fopen() failed"); } else { fclose(f); } } ``` Possible output: ``` fopen() failed: No such file or directory ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.10.4 The perror function (p: 339) * C99 standard (ISO/IEC 9899:1999): + 7.19.10.4 The perror function (p: 305) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.10.4 The perror function ### See also | | | | --- | --- | | [strerrorstrerror\_sstrerrorlen\_s](../string/byte/strerror "c/string/byte/strerror") (C11)(C11) | returns a text version of a given error code (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/perror "cpp/io/c/perror") for `perror` | c getwchar getwchar ======== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` wint_t getwchar(void); ``` | | (since C95) | Reads the next wide character from `[stdin](std_streams "c/io/std streams")`. ### Parameters (none). ### Return value the obtained wide character or `WEOF` if an error has occurred or the end of file reached. ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.3.7 The getwchar function (p: 424) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.7 The getwchar function (p: 369-370) ### See also | | | | --- | --- | | [getchar](getchar "c/io/getchar") | reads a character from `[stdin](std_streams "c/io/std streams")` (function) | | [fgetwcgetwc](fgetwc "c/io/fgetwc") (C95) | gets a wide character from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/getwchar "cpp/io/c/getwchar") for `getwchar` | c fgets fgets ===== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` char *fgets( char *str, int count, FILE *stream ); ``` | | (until C99) | | ``` char *fgets( char *restrict str, int count, FILE *restrict stream ); ``` | | (since C99) | Reads at most `count - 1` characters from the given file stream and stores them in the character array pointed to by `str`. Parsing stops if a newline character is found, in which case `str` will contain that newline character, or if end-of-file occurs. If bytes are read and no errors occur, writes a null character at the position immediately after the last character written to `str`. ### Parameters | | | | | --- | --- | --- | | str | - | pointer to an element of a char array | | count | - | maximum number of characters to write (typically the length of `str`) | | stream | - | file stream to read the data from | ### Return value `str` on success, null pointer on failure. If the end-of-file condition is encountered, sets the *eof* indicator on `stream` (see `[feof()](feof "c/io/feof")`). This is only a failure if it causes no bytes to be read, in which case a null pointer is returned and the contents of the array pointed to by `str` are not altered (i.e. the first byte is not overwritten with a null character). If the failure has been caused by some other error, sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. The contents of the array pointed to by `str` are indeterminate (it may not even be null-terminated). ### Notes [POSIX additionally requires](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fgets.html) that `fgets` sets `[errno](../error/errno "c/error/errno")` if it encounters an failure other than the end-of-file condition. Although the standard specification is [unclear](https://stackoverflow.com/questions/23388620) in the cases where `count<=1`, common implementations do. * if `count < 1`, do nothing, report error * if `count == 1`, + some implementations do nothing, report error, + others read nothing, store zero in `str[0]`, report success ### Example ``` #include <stdio.h> #include <stdlib.h> int main(void) { FILE* tmpf = tmpfile(); fputs("Alan Turing\n", tmpf); fputs("John von Neumann\n", tmpf); fputs("Alonzo Church\n", tmpf); rewind(tmpf); char buf[8]; while (fgets(buf, sizeof buf, tmpf) != NULL) printf("\"%s\"\n", buf); if (feof(tmpf)) puts("End of file reached"); } ``` Output: ``` "Alan Tu" "ring " "John vo" "n Neuma" "nn " "Alonzo " "Church " End of file reached ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.7.2 The fgets function (p: 331) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.2 The fgets function (p: 296) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.2 The fgets function ### See also | | | | --- | --- | | [scanffscanfsscanfscanf\_sfscanf\_ssscanf\_s](fscanf "c/io/fscanf") (C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [getsgets\_s](gets "c/io/gets") (removed in C11)(C11) | reads a character string from `stdin` (function) | | [fputs](fputs "c/io/fputs") | writes a character string to a file stream (function) | | [getlinegetwlinegetdelimgetwdelim](https://en.cppreference.com/w/c/experimental/dynamic/getline "c/experimental/dynamic/getline") (dynamic memory TR) | read from a stream into a automatically resized buffer until delimiter/end of line (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fgets "cpp/io/c/fgets") for `fgets` | c rewind rewind ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` void rewind( FILE *stream ); ``` | | | Moves the file position indicator to the beginning of the given file stream. The function is equivalent to `[fseek](http://en.cppreference.com/w/c/io/fseek)(stream, 0, [SEEK\_SET](http://en.cppreference.com/w/c/io));`, except that end-of-file and error indicators are cleared. The function drops any effects from previous calls to `[ungetc](ungetc "c/io/ungetc")`. ### Parameters | | | | | --- | --- | --- | | stream | - | file stream to modify | ### Return value (none). ### Example This example shows how to read a file twice. ``` #include <stdio.h> char str[20]; int main(void) { FILE *f; char ch; f = fopen("file.txt", "w"); for (ch = '0'; ch <= '9'; ch++) { fputc(ch, f); } fclose(f); f = fopen("file.txt", "r"); fread(str, 1, 10, f); puts(str); rewind(f); fread(str, 1, 10, f); puts(str); fclose(f); return 0; } ``` Output: ``` 0123456789 0123456789 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.9.5 The rewind function (p: 338) * C99 standard (ISO/IEC 9899:1999): + 7.19.9.5 The rewind function (p: 304) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.9.5 The rewind function ### See also | | | | --- | --- | | [fseek](fseek "c/io/fseek") | moves the file position indicator to a specific location in a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/rewind "cpp/io/c/rewind") for `rewind` | c fputs fputs ===== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fputs( const char *str, FILE *stream ); ``` | | (until C99) | | ``` int fputs( const char *restrict str, FILE *restrict stream ); ``` | | (since C99) | Writes every character from the null-terminated string `str` to the output stream `stream`, as if by repeatedly executing `[fputc](fputc "c/io/fputc")`. The terminating null character from `str` is not written. ### Parameters | | | | | --- | --- | --- | | str | - | null-terminated character string to be written | | stream | - | output stream | ### Return value On success, returns a non-negative value. On failure, returns `[EOF](../io "c/io")` and sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `stream`. ### Notes The related function `[puts](puts "c/io/puts")` appends a newline character to the output, while `fputs` writes the string unmodified. Different implementations return different non-negative numbers: some return the last character written, some return the number of characters written (or INT\_MAX if the string was longer than that), some simply return a non-negative constant such as zero. ### Example ``` #include <stdio.h> int main(void) { int rc = fputs("Hello World", stdout); if (rc == EOF) perror("fputs()"); // POSIX requires that errno is set } ``` Output: ``` Hello World ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.7.4 The fputs function (p: 331-332) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.4 The fputs function (p: 297) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.4 The fputs function ### See also | | | | --- | --- | | [printffprintfsprintfsnprintfprintf\_sfprintf\_ssprintf\_ssnprintf\_s](fprintf "c/io/fprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [puts](puts "c/io/puts") | writes a character string to `[stdout](std_streams "c/io/std streams")` (function) | | [fgets](fgets "c/io/fgets") | gets a character string from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fputs "cpp/io/c/fputs") for `fputs` | c fsetpos fsetpos ======= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fsetpos( FILE *stream, const fpos_t *pos ); ``` | | | Sets the file position indicator and the multibyte parsing state (if any) for the file stream `stream` according to the value pointed to by `pos`. Besides establishing new parse state and position, a call to this function undoes the effects of `[ungetc](ungetc "c/io/ungetc")` and clears the end-of-file state, if it is set. If a read or write error occurs, the error indicator (`[ferror](ferror "c/io/ferror")`) for the stream is set. ### Parameters | | | | | --- | --- | --- | | stream | - | file stream to modify | | pos | - | pointer to a `[fpos\_t](fpos_t "c/io/fpos t")` object to use as new value of file position indicator | ### Return value `​0​` upon success, nonzero value otherwise. ### Notes After seeking to a non-end position in a wide stream, the next call to any output function may render the remainder of the file undefined, e.g. by outputting a multibyte sequence of a different length. ### Example fsetpos with error checking. ``` #include <stdio.h> #include <stdlib.h> int main(void) { /* Prepare an array of f-p values. */ #define SIZE 5 double A[SIZE] = {1.,2.,3.,4.,5.}; /* Write array to a file. */ FILE * fp = fopen("test.bin", "wb"); fwrite(A,sizeof(double),SIZE,fp); fclose (fp); /* Read the f-p values into array B. */ double B[SIZE]; fp = fopen("test.bin","rb"); fpos_t pos; if (fgetpos(fp,&pos) != 0) /* current position: start of file */ { perror("fgetpos()"); fprintf(stderr,"fgetpos() failed in file %s at line # %d\n", __FILE__,__LINE__-3); exit(EXIT_FAILURE); } int ret_code = fread(B,sizeof(double),1,fp); /* read one f-p value */ /* current position: after reading one f-p value */ printf("%.1f; read count = %d\n", B[0], ret_code); /* print one f-p value and ret_code */ if (fsetpos(fp,&pos) != 0) /* reset current position to start of file */ { if (ferror(fp)) { perror("fsetpos()"); fprintf(stderr,"fsetpos() failed in file %s at line # %d\n", __FILE__,__LINE__-5); exit(EXIT_FAILURE); } } ret_code = fread(B,sizeof(double),1,fp); /* reread first f-p value */ printf("%.1f; read count = %d\n", B[0], ret_code); /* print one f-p value and ret_code */ fclose(fp); return EXIT_SUCCESS; } ``` Output: ``` 1.0; read count = 1 1.0; read count = 1 ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.9.3 The fsetpos function (p: 337) * C99 standard (ISO/IEC 9899:1999): + 7.19.9.3 The fsetpos function (p: 303) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.9.3 The fsetpos function ### See also | | | | --- | --- | | [fgetpos](fgetpos "c/io/fgetpos") | gets the file position indicator (function) | | [ftell](ftell "c/io/ftell") | returns the current file position indicator (function) | | [fseek](fseek "c/io/fseek") | moves the file position indicator to a specific location in a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fsetpos "cpp/io/c/fsetpos") for `fsetpos` |
programming_docs
c vwscanf, vfwscanf, vswscanf, vwscanf_s, vfwscanf_s, vswscanf_s vwscanf, vfwscanf, vswscanf, vwscanf\_s, vfwscanf\_s, vswscanf\_s ================================================================= | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` int vwscanf( const wchar_t *restrict format, va_list vlist ); ``` | (1) | (since C99) | | ``` int vfwscanf( FILE *restrict stream, const wchar_t *restrict format, va_list vlist ); ``` | (2) | (since C99) | | ``` int vswscanf( const wchar_t *restrict buffer, const wchar_t *restrict format, va_list vlist ); ``` | (3) | (since C99) | | ``` int vwscanf_s( const wchar_t *restrict format, va_list vlist ); ``` | (4) | (since C11) | | ``` int vfwscanf_s( FILE *restrict stream, const wchar_t *restrict format, va_list vlist ); ``` | (5) | (since C11) | | ``` int vswscanf_s( const wchar_t *restrict buffer, const wchar_t *restrict format, va_list vlist ); ``` | (6) | (since C11) | Reads data from the a variety of sources, interprets it according to `format` and stores the results into locations defined by `vlist`. 1) Reads the data from `[stdin](std_streams "c/io/std streams")`. 2) Reads the data from file stream `stream`. 3) Reads the data from null-terminated wide string `buffer`. Reaching the end of the string is equivalent to reaching the end-of-file condition for `fwscanf` 4-6) Same as (1-3), except that `%c`, `%s`, and `%[` conversion specifiers each expect two arguments (the usual pointer and a value of type `rsize_t` indicating the size of the receiving array, which may be 1 when reading with a %lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * any of the arguments of pointer type is a null pointer * `format`, `stream`, or `buffer` is a null pointer * the number of characters that would be written by %c, %s, or %[, plus the terminating null character, would exceed the second (rsize\_t) argument provided for each of those conversion specifiers * optionally, any other detectable error, such as unknown conversion specifier As with all bounds-checked functions, `vwscanf_s` , `vfwscanf_s`, and `vswscanf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | input file stream to read from | | buffer | - | pointer to a null-terminated wide string to read from | | format | - | pointer to a null-terminated wide string specifying how to read the input | | vlist | - | variable argument list containing the receiving arguments. | The **format** string consists of. * non-whitespace wide characters except `%`: each such character in the format string consumes exactly one identical character from the input stream, or causes the function to fail if the next character on the stream does not compare equal. * whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace characters from the input (determined as if by calling [`iswspace`](../string/wide/iswspace "c/string/wide/iswspace") in a loop). Note that there is no difference between `"\n"`, `" "`, `"\t\t"`, or other whitespace in the format string. * conversion specifications. Each conversion specification has the following format: + introductory `%` character + (optional) assignment-suppressing character `*`. If this option is present, the function does not assign the result of the conversion to any receiving argument. + (optional) integer number (greater than zero) that specifies *maximum field width*, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that `%s` and `%[` may lead to buffer overflow if the width is not provided. + (optional) *length modifier* that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below). + conversion format specifier The following format specifiers are available: | Conversion specifier | Explanation | Argument type | | --- | --- | --- | | **Length modifier →** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | matches literal `%` | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | matches a **character** or a sequence of **characters** If a width specifier is used, matches exactly *width* wide characters (the argument must be a pointer to an array with sufficient room). Unlike %s and %[, does not append the null character to the array. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `s` | matches a sequence of non-whitespace characters (a **string**) If width specifier is used, matches up to *width* or until the first whitespace character, whichever appears first. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `[`set`]` | matches a non-empty sequence of character from set of characters. If the first character of the set is `^`, then all characters not in the set are matched. If the set begins with `]` or `^]` then the `]` character is also included into the set. It is implementation-defined whether the character `-` in the non-initial position in the scanset may be indicating a range, as in `[0-9]`. If width specifier is used, matches only up to *width*. Always stores a null character in addition to the characters matched (so the argument array must have room for at least *width+1* characters). | | `d` | matches a **decimal integer**. The format of the number is the same as expected by [`wcstol`](../string/wide/wcstol "c/string/wide/wcstol") with the value `10` for the `base` argument. | `signed char*` or `unsigned char*` | `signed short*` or `unsigned short*` | `signed int*` or `unsigned int*` | `signed long*` or `unsigned long*` | `signed long long*` or `unsigned long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` or `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `i` | matches an **integer**. The format of the number is the same as expected by [`wcstol`](../string/wide/wcstol "c/string/wide/wcstol") with the value `​0​` for the `base` argument (base is determined by the first characters parsed). | | `u` | matches an unsigned **decimal integer**. The format of the number is the same as expected by [`wcstoul`](../string/wide/wcstoul "c/string/wide/wcstoul") with the value `10` for the `base` argument. | | `o` | matches an unsigned **octal integer**. The format of the number is the same as expected by [`wcstoul`](../string/wide/wcstoul "c/string/wide/wcstoul") with the value `8` for the `base` argument. | | `x`, `X` | matches an unsigned **hexadecimal integer**. The format of the number is the same as expected by [`wcstoul`](../string/wide/wcstoul "c/string/wide/wcstoul") with the value `16` for the `base` argument. | | `n` | returns the **number of characters read so far**. No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined. | | `a`, `A`(C99) `e`, `E` `f`, `F` `g`, `G` | matches a **floating-point number**. The format of the number is the same as expected by [`wcstof`](../string/wide/wcstof "c/string/wide/wcstof"). | N/A | N/A | `float*` | `double*` | N/A | N/A | N/A | N/A | `long double*` | | `p` | matches implementation defined character sequence defining a **pointer**. `printf` family of functions should produce the same sequence using `%p` format specifier. | N/A | N/A | `void**` | N/A | N/A | N/A | N/A | N/A | N/A | For every conversion specifier other than `n`, the longest sequence of input characters which does not exceed any specified field width and which either is exactly what the conversion specifier expects or is a prefix of a sequence it would expect, is what's consumed from the stream. The first character, if any, after this consumed sequence remains unread. If the consumed sequence has length zero or if the consumed sequence cannot be converted as specified above, the matching failure occurs unless end-of-file, an encoding error, or a read error prevented input from the stream, in which case it is an input failure. All conversion specifiers other than `[`, `c`, and `n` consume and discard all leading whitespace characters (determined as if by calling [`iswspace`](../string/wide/iswspace "c/string/wide/iswspace")) before attempting to parse the input. These consumed characters do not count towards the specified maximum field width. If the length specifier `l` is not used, the conversion specifiers `c`, `s`, and `[` perform wide-to-multibyte character conversion as if by calling [`wcrtomb`](../string/multibyte/wcrtomb "c/string/multibyte/wcrtomb") with an [`mbstate_t`](../string/multibyte/mbstate_t "c/string/multibyte/mbstate t") object initialized to zero before the first character is converted. The conversion specifiers `s` and `[` always store the null terminator in addition to the matched characters. The size of the destination array must be at least one greater than the specified field width. The use of `%s` or `%[`, without specifying the destination array size, is as unsafe as `[gets](gets "c/io/gets")`. The correct conversion specifications for the [fixed-width integer types](../types/integer "c/types/integer") (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although [`SCNdMAX`](../types/integer "c/types/integer"), [`SCNuMAX`](../types/integer "c/types/integer"), etc is synonymous with `%jd`, `%ju`, etc). There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple fields in the same "sink" variable. When parsing an incomplete floating-point value that ends in the exponent with no digits, such as parsing `"100er"` with the conversion specifier `%f`, the sequence `"100e"` (the longest prefix of a possibly valid floating-point number) is consumed, resulting in a matching error (the consumed sequence cannot be converted to a floating-point number), with `"r"` remaining. Some existing implementations do not follow this rule and roll back to consume only `"100"`, leaving `"er"`, e.g. [glibc bug 1765](https://sourceware.org/bugzilla/show_bug.cgi?id=1765). ### Return value 1-3) Number of receiving arguments successfully assigned, or `[EOF](../io "c/io")` if read failure occurs before the first receiving argument was assigned. 4-6) Same as (1-3), except that `[EOF](../io "c/io")` is also returned if there is a runtime constraint violation. ### Notes All these functions may invoke `va_arg`, the value of `arg` is indeterminate after the return. These functions to not invoke `va_end`, and it must be done by the caller. ### Example ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.2.6 The vfwscanf function (p: 418) + 7.29.2.8 The vswscanf function (p: 419) + 7.29.2.10 The vwscanf function (p: 420) + K.3.9.1.7 The vfwscanf\_s function (p: 632-633) + K.3.9.1.10 The vswscanf\_s function (p: 635-636) + K.3.9.1.12 The vwscanf\_s function (p: 637) * C99 standard (ISO/IEC 9899:1999): + 7.24.2.6 The vfwscanf function (p: 364) + 7.24.2.8 The vswscanf function (p: 365) + 7.24.2.10 The vwscanf function (p: 366) ### See also | | | | --- | --- | | [wscanffwscanfswscanfwscanf\_sfwscanf\_sswscanf\_s](fwscanf "c/io/fwscanf") (C95)(C95)(C95)(C11)(C11)(C11) | reads formatted wide character input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/vfwscanf "cpp/io/c/vfwscanf") for `vwscanf, vfwscanf, vswscanf` | c tmpfile, tmpfile_s tmpfile, tmpfile\_s =================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` FILE *tmpfile(void); ``` | (1) | | | ``` errno_t tmpfile_s(FILE * restrict * restrict streamptr); ``` | (2) | (since C11) | 1) Creates and opens a temporary file. The file is opened as binary file for update (as if by `[fopen](fopen "c/io/fopen")` with `"wb+"` mode). The filename of the file is guaranteed to be unique within the filesystem. At least `[TMP\_MAX](../io "c/io")` files may be opened during the lifetime of a program (this limit may be shared with `[tmpnam](tmpnam "c/io/tmpnam")` and may be further limited by `[FOPEN\_MAX](../io "c/io")`). 2) Same as (1), except that at least `TMP_MAX_S` files may be opened (the limit may be shared with `tmpnam_s`), and if `streamptr` is a null pointer, the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function is called. As with all bounds-checked functions, `tmpfile_s` is only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. The temporary file created by this function is closed and deleted when the program exits normally. Whether it's deleted on abnormal termination is implementation-defined. ### Parameters 1) (none) 2) pointer to a pointer that will be updated by this function call ### Return value 1) Pointer to the file stream associated with the file or null pointer if an error has occurred. 2) Zero if the file was created and open successfully, non-zero if the file was not created or open or if `streamptr` was a null pointer. In addition, pointer to the associated file stream is stored in `*streamptr` on success, and a null pointer value is stored in `*streamptr` on error. ### Notes On some implementations (e.g. older Linux), this function actually creates, opens, and immediately deletes the file from the file system: as long as an open file descriptor to a deleted file is held by a program, the file exists, but since it was deleted, its name does not appear in any directory, so that no other process can open it. Once the file descriptor is closed, or once the program terminates (normally or abnormally), the space occupied by the file is reclaimed by the filesystem. Newer Linux (since 3.11 or later, depending on filesystem) creates such invisible temporary files in one step, via special flag in the [`open()`](https://man7.org/linux/man-pages/man2/open.2.html) syscall. On some implementations (e.g. Windows), elevated privileges are required as the function may create the temporary file in a system directory. ### Example ``` #define _POSIX_C_SOURCE 200112L #include <stdio.h> #include <unistd.h> int main(void) { printf("TMP_MAX = %d, FOPEN_MAX = %d\n", TMP_MAX, FOPEN_MAX); FILE* tmpf = tmpfile(); fputs("Hello, world", tmpf); rewind(tmpf); char buf[6]; fgets(buf, sizeof buf, tmpf); printf("got back from the file: '%s'\n", buf); // Linux-specific method to display the tmpfile name char fname[FILENAME_MAX], link[FILENAME_MAX] = {0}; sprintf(fname, "/proc/self/fd/%d", fileno(tmpf)); if(readlink(fname, link, sizeof link - 1) > 0) printf("File name: %s\n", link); } ``` Possible output: ``` TMP_MAX = 238328, FOPEN_MAX = 16 got back from the file: 'Hello' File name: /tmp/tmpfjptPe5 (deleted) ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.4.3 The tmpfile function (p: 222) + K.3.5.1.1 The tmpfile\_s function (p: 427) * C11 standard (ISO/IEC 9899:2011): + 7.21.4.3 The tmpfile function (p: 303) + K.3.5.1.1 The tmpfile\_s function (p: 586-587) * C99 standard (ISO/IEC 9899:1999): + 7.19.4.3 The tmpfile function (p: 269) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.4.3 The tmpfile function ### See also | | | | --- | --- | | [tmpnamtmpnam\_s](tmpnam "c/io/tmpnam") (C11) | returns a unique filename (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/tmpfile "cpp/io/c/tmpfile") for `tmpfile` | c setbuf setbuf ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` void setbuf( FILE *stream, char *buffer ); ``` | | (until C99) | | ``` void setbuf( FILE *restrict stream, char *restrict buffer ); ``` | | (since C99) | | ``` #define BUFSIZ /*unspecified*/ ``` | | | Sets the internal buffer to use for stream operations. It should be at least `BUFSIZ` characters long. If `buffer` is not null, equivalent to `[setvbuf](http://en.cppreference.com/w/c/io/setvbuf)(stream, buffer, [\_IOFBF](http://en.cppreference.com/w/c/io), [BUFSIZ](http://en.cppreference.com/w/c/io))`. If `buffer` is null, equivalent to `[setvbuf](http://en.cppreference.com/w/c/io/setvbuf)(stream, [NULL](http://en.cppreference.com/w/c/types/NULL), [\_IONBF](http://en.cppreference.com/w/c/io), 0)`, which turns off buffering. ### Parameters | | | | | --- | --- | --- | | stream | - | the file stream to set the buffer to | | buffer | - | pointer to a buffer for the stream to use. If a null pointer is supplied, the buffering is turned off | ### Return value None. ### Notes If `[BUFSIZ](../io "c/io")` is not the appropriate buffer size, `[setvbuf](setvbuf "c/io/setvbuf")` can be used to change it. `[setvbuf](setvbuf "c/io/setvbuf")` should also be used to detect errors, since `setbuf` does not indicate success or failure. This function may only be used after `stream` has been associated with an open file, but before any other operation (other than a failed call to `setbuf`/`setvbuf`). A common error is setting the buffer of stdin or stdout to an array whose lifetime ends before the program terminates: ``` int main(void) { char buf[BUFSIZ]; setbuf(stdin, buf); } // lifetime of buf ends, undefined behavior ``` ### Example `setbuf` may be used to disable buffering on streams that require immediate output. ``` #include <stdio.h> #include <threads.h> int main(void) { setbuf(stdout, NULL); // unbuffered stdout putchar('a'); // 'a' appears immediately if stdout is unbuffered thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec putchar('b'); } ``` Output: ``` ab ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.5.5 The setbuf function (p: 225) * C11 standard (ISO/IEC 9899:2011): + 7.21.5.5 The setbuf function (p: 307-308) * C99 standard (ISO/IEC 9899:1999): + 7.19.5.5 The setbuf function (p: 273) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.5.5 The setbuf function ### See also | | | | --- | --- | | [setvbuf](setvbuf "c/io/setvbuf") | sets the buffer and its size for a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/setbuf "cpp/io/c/setbuf") for `setbuf` | c ungetwc ungetwc ======= | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` wint_t ungetwc( wint_t ch, FILE *stream ); ``` | | (since C95) | If `ch` does not equal `WEOF`, pushes the wide character `ch` into the input buffer associated with the stream `stream` in such a manner that subsequent read operation from `stream` will retrieve that wide character. The external device associated with the stream is not modified. Stream repositioning operations `[fseek](fseek "c/io/fseek")`, `[fsetpos](fsetpos "c/io/fsetpos")`, and `[rewind](rewind "c/io/rewind")` discard the effects of `ungetwc`. If `ungetwc` is called more than once without an intervening read or repositioning, it may fail (in other words, a pushback buffer of size 1 is guaranteed, but any larger buffer is implementation-defined). If multiple successful `ungetwc` were performed, read operations retrieve the pushed-back wide characters in reverse order of `ungetwc`. If `ch` equals `WEOF`, the operation fails and the stream is not affected. A successful call to `ungetwc` clears the end of file status flag `[feof](feof "c/io/feof")`. A successful call to `ungetwc` on a stream (whether text or binary) modifies the stream position indicator in unspecified manner but guarantees that after all pushed-back wide characters are retrieved with a read operation, the stream position indicator is equal to its value before `ungetwc`. ### Parameters | | | | | --- | --- | --- | | ch | - | wide character to be put back | | stream | - | file stream to put the wide character back to | ### Return value On success `ch` is returned. On failure `WEOF` is returned and the given stream remains unchanged. ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.3.10 The ungetwc function (p: 425-426) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.10 The ungetwc function (p: 370-371) ### See also | | | | --- | --- | | [ungetc](ungetc "c/io/ungetc") | puts a character back into a file stream (function) | | [fgetwcgetwc](fgetwc "c/io/fgetwc") (C95) | gets a wide character from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/ungetwc "cpp/io/c/ungetwc") for `ungetwc` |
programming_docs
c getchar getchar ======= | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int getchar(void); ``` | | | Reads the next character from `[stdin](std_streams "c/io/std streams")`. Equivalent to `[getc](http://en.cppreference.com/w/c/io/fgetc)([stdin](http://en.cppreference.com/w/c/io/std_streams))`. ### Parameters (none). ### Return value The obtained character on success or `[EOF](../io "c/io")` on failure. If the failure has been caused by end-of-file condition, additionally sets the *eof* indicator (see `[feof()](feof "c/io/feof")`) on `[stdin](std_streams "c/io/std streams")`. If the failure has been caused by some other error, sets the *error* indicator (see `[ferror()](ferror "c/io/ferror")`) on `[stdin](std_streams "c/io/std streams")`. ### Example getchar with error checking. ``` #include <stdio.h> #include <stdlib.h> int main(void) { int ch; while ((ch=getchar()) != EOF) /* read/print "abcde" from stdin */ printf("%c", ch); /* Test reason for reaching EOF. */ if (feof(stdin)) /* if failure caused by end-of-file condition */ puts("End of file reached"); else if (ferror(stdin)) /* if failure caused by some other error */ { perror("getchar()"); fprintf(stderr,"getchar() failed in file %s at line # %d\n", __FILE__,__LINE__-9); exit(EXIT_FAILURE); } return EXIT_SUCCESS; } ``` Possible output: ``` abcde End of file reached ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.7.6 The getchar function (p: 332) * C99 standard (ISO/IEC 9899:1999): + 7.19.7.6 The getchar function (p: 298) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.7.6 The getchar function ### See also | | | | --- | --- | | [fgetcgetc](fgetc "c/io/fgetc") | gets a character from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/getchar "cpp/io/c/getchar") for `getchar` | c printf, fprintf, sprintf, snprintf, printf_s, fprintf_s, sprintf_s, snprintf_s printf, fprintf, sprintf, snprintf, printf\_s, fprintf\_s, sprintf\_s, snprintf\_s ================================================================================== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | | (1) | | | ``` int printf( const char *format, ... ); ``` | (until C99) | | ``` int printf( const char *restrict format, ... ); ``` | (since C99) | | | (2) | | | ``` int fprintf( FILE *stream, const char *format, ... ); ``` | (until C99) | | ``` int fprintf( FILE *restrict stream, const char *restrict format, ... ); ``` | (since C99) | | | (3) | | | ``` int sprintf( char *buffer, const char *format, ... ); ``` | (until C99) | | ``` int sprintf( char *restrict buffer, const char *restrict format, ... ); ``` | (since C99) | | ``` int snprintf( char *restrict buffer, size_t bufsz, const char *restrict format, ... ); ``` | (4) | (since C99) | | ``` int printf_s( const char *restrict format, ... ); ``` | (5) | (since C11) | | ``` int fprintf_s( FILE *restrict stream, const char *restrict format, ... ); ``` | (6) | (since C11) | | ``` int sprintf_s( char *restrict buffer, rsize_t bufsz, const char *restrict format, ... ); ``` | (7) | (since C11) | | ``` int snprintf_s( char *restrict buffer, rsize_t bufsz, const char *restrict format, ... ); ``` | (8) | (since C11) | Loads the data from the given locations, converts them to character string equivalents and writes the results to a variety of sinks/streams: 1) Writes the results to the output stream `[stdout](std_streams "c/io/std streams")`. 2) Writes the results to the output stream `stream`. 3) Writes the results to a character string `buffer`. The behavior is undefined if the string to be written (plus the terminating null character) exceeds the size of the array pointed to by `buffer`. 4) Writes the results to a character string `buffer`. At most `bufsz` - 1 characters are written. The resulting character string will be terminated with a null character, unless `bufsz` is zero. If `bufsz` is zero, nothing is written and `buffer` may be a null pointer, however the return value (number of bytes that would be written not including the null terminator) is still calculated and returned. 5-8) Same as (1-4), except that the following errors are detected at runtime and call the currently installed [constraint handler](../error/set_constraint_handler_s "c/error/set constraint handler s") function: * the conversion specifier `%n` is present in `format` * any of the arguments corresponding to `%s` is a null pointer * `stream` or `format` or `buffer` is a null pointer * `bufsz` is zero or greater than `RSIZE_MAX` * encoding errors occur in any of string and character conversion specifiers * (for `sprintf_s` only), the string to be stored in `buffer` (including the trailing null) would be exceed `bufsz` As with all bounds-checked functions, `printf_s` , `fprintf_s`, `sprintf_s`, and `snprintf_s` are only guaranteed to be available if `__STDC_LIB_EXT1__` is defined by the implementation and if the user defines `__STDC_WANT_LIB_EXT1__` to the integer constant `1` before including `<stdio.h>`. ### Parameters | | | | | --- | --- | --- | | stream | - | output file stream to write to | | buffer | - | pointer to a character string to write to | | bufsz | - | up to bufsz - 1 characters may be written, plus the null terminator | | format | - | pointer to a null-terminated multibyte string specifying how to interpret the data | | ... | - | arguments specifying data to print. If any argument after [default argument promotions](../language/conversion#Default_argument_promotions "c/language/conversion") is not the type expected by the corresponding conversion specifier, or if there are fewer arguments than required by `format`, the behavior is undefined. If there are more arguments than required by `format`, the extraneous arguments are evaluated and ignored. | The **format** string consists of ordinary multibyte characters (except `%`), which are copied unchanged into the output stream, and conversion specifications. Each conversion specification has the following format: * introductory `%` character * (optional) one or more flags that modify the behavior of the conversion: + `-`: the result of the conversion is left-justified within the field (by default it is right-justified) + `+`: the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative) + *space*: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if `+` flag is present. + `#` : *alternative form* of the conversion is performed. See the table below for exact effects otherwise the behavior is undefined. + `0` : for integer and floating point number conversions, leading zeros are used to pad the field instead of *space* characters. For integer numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if `-` flag is present. * (optional) integer value or `*` that specifies minimum field width. The result is padded with *space* characters (by default), if required, on the left when right-justified, or on the right if left-justified. In the case when `*` is used, the width is specified by an additional argument of type `int`, which appears before the argument to be converted and the argument supplying precision if one is supplied. If the value of the argument is negative, it results with the `-` flag specified and positive field width. (Note: This is the minimum width: The value is never truncated.) + (optional) `.` followed by integer number or `*`, or neither that specifies *precision* of the conversion. In the case when `*` is used, the *precision* is specified by an additional argument of type `int`, which appears before the argument to be converted, but after the argument supplying minimum field width if one is supplied. If the value of this argument is negative, it is ignored. If neither a number nor `*` is used, the precision is taken as zero. See the table below for exact effects of *precision*. + (optional) *length modifier* that specifies the size of the argument (in combination with the conversion format specifier, it specifies the type of the corresponding argument) + conversion format specifier The following format specifiers are available: | ConversionSpecifier | Explanation | ExpectedArgument Type | | --- | --- | --- | | **LengthModifier****→** | `hh` (C99). | `h` | (none) | `l` | `ll` (C99). | `j` (C99). | `z` (C99). | `t` (C99). | `L` | | `%` | writes literal `%`. The full conversion specification must be `%%`. | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | | `c` | writes a **single character**. The argument is first converted to `unsigned char`. If the **l** modifier is used, the argument is first converted to a character string as if by **%ls** with a `wchar_t[2]` argument. | N/A | N/A | `int` | `wint_t` | N/A | N/A | N/A | N/A | N/A | | `s` | writes a **character string** The argument must be a pointer to the initial element of an array of characters. *Precision* specifies the maximum number of bytes to be written. If *Precision* is not specified, writes every byte up to and not including the first null terminator. If the **l** specifier is used, the argument must be a pointer to the initial element of an array of `wchar_t`, which is converted to char array as if by a call to `[wcrtomb](../string/multibyte/wcrtomb "c/string/multibyte/wcrtomb")` with zero-initialized conversion state. | N/A | N/A | `char*` | `wchar_t*` | N/A | N/A | N/A | N/A | N/A | | `d` `i` | converts a **signed integer** into decimal representation *[-]dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | `signed char` | `short` | `int` | `long` | `long long` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `o` | converts an **unsigned integer** into octal representation *oooo*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* precision is increased if necessary, to write one leading zero. In that case if both the converted value and the precision are `​0​`, single `​0​` is written. | `unsigned char` | `unsigned short` | `unsigned int` | `unsigned long` | `unsigned long long` | `[uintmax\_t](http://en.cppreference.com/w/c/types/integer)` | `[size\_t](http://en.cppreference.com/w/c/types/size_t)` | unsigned version of `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)` | N/A | | `x` `X` | converts an **unsigned integer** into hexadecimal representation *hhhh*. For the `x` conversion letters `abcdef` are used. For the `X` conversion letters `ABCDEF` are used. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. In the *alternative implementation* `0x` or `0X` is prefixed to results if the converted value is nonzero. | N/A | | `u` | converts an **unsigned integer** into decimal representation *dddd*. *Precision* specifies the minimum number of digits to appear. The default precision is `1`. If both the converted value and the precision are `​0​` the conversion results in no characters. | N/A | | `f` `F` | converts **floating-point number** to the decimal notation in the style *[-]ddd.ddd*. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | `double` | `double` (C99) | N/A | N/A | N/A | N/A | `long double` | | `e` `E` | converts **floating-point number** to the decimal exponent notation. For the `e` conversion style *[-]d.ddd*`e`*±dd* is used. For the `E` conversion style *[-]d.ddd*`E`*±dd* is used. The exponent contains at least two digits, more digits are used only if necessary. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the decimal point character. The default precision is `6`. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `a` `A` (C99). | converts **floating-point number** to the hexadecimal exponent notation. For the `a` conversion style *[-]*`0x`*h.hhh*`p`*±d* is used. For the `A` conversion style *[-]*`0X`*h.hhh*`P`*±d* is used. The first hexadecimal digit is not `0` if the argument is a normalized floating point value. If the value is `​0​`, the exponent is also `​0​`. *Precision* specifies the exact number of digits to appear after the hexadecimal point character. The default precision is sufficient for exact representation of the value. In the *alternative implementation* decimal point character is written even if no digits follow it. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `g` `G` | converts **floating-point number** to decimal or decimal exponent notation depending on the value and the *precision*. For the `g` conversion style conversion with style `e` or `f` will be performed. For the `G` conversion style conversion with style `E` or `F` will be performed. Let `P` equal the precision if nonzero, `6` if the precision is not specified, or `1` if the precision is `​0​`. Then, if a conversion with style `E` would have an exponent of `X`:* if *P > X ≥ −4*, the conversion is with style `f` or `F` and precision *P − 1 − X*. * otherwise, the conversion is with style `e` or `E` and precision *P − 1*. Unless *alternative representation* is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left. For infinity and not-a-number conversion style see notes. | N/A | N/A | N/A | N/A | N/A | N/A | | `n` | returns the **number of characters written** so far by this call to the function. The result is *written* to the value pointed to by the argument. The specification may not contain any *flag*, *field width*, or *precision*. | `signed char*` | `short*` | `int*` | `long*` | `long long*` | `[intmax\_t](http://en.cppreference.com/w/c/types/integer)\*` | signed `[size\_t](http://en.cppreference.com/w/c/types/size_t)\*` | `[ptrdiff\_t](http://en.cppreference.com/w/c/types/ptrdiff_t)\*` | N/A | | `p` | writes an implementation defined character sequence defining a **pointer**. | N/A | N/A | `void*` | N/A | N/A | N/A | N/A | N/A | N/A | The floating point conversion functions convert infinity to `inf` or `infinity`. Which one is used is implementation defined. Not-a-number is converted to `nan` or `nan(*char\_sequence*)`. Which one is used is implementation defined. The conversions `F`, `E`, `G`, `A` output `INF`, `INFINITY`, `NAN` instead. Even though `%c` expects `int` argument, it is safe to pass a `char` because of the integer promotion that takes place when a variadic function is called. The correct conversion specifications for the fixed-width character types (`[int8\_t](../types/integer "c/types/integer")`, etc) are defined in the header [`<inttypes.h>`](../types/integer "c/types/integer") (although `[PRIdMAX](../types/integer "c/types/integer")`, `[PRIuMAX](../types/integer "c/types/integer")`, etc is synonymous with `%jd`, `%ju`, etc). The memory-writing conversion specifier `%n` is a common target of security exploits where format strings depend on user input and is not supported by the bounds-checked `printf_s` family of functions. There is a [sequence point](../language/eval_order "c/language/eval order") after the action of each conversion specifier; this permits storing multiple `%n` results in the same variable or, as an edge case, printing a string modified by an earlier `%n` within the same call. If a conversion specification is invalid, the behavior is undefined. ### Return value 1,2) number of characters transmitted to the output stream or negative value if an output error or an encoding error (for string and character conversion specifiers) occurred 3) number of characters written to `buffer` (not counting the terminating null character), or a negative value if an encoding error (for string and character conversion specifiers) occurred 4) number of characters (not including the terminating null character) which would have been written to `buffer` if `bufsz` was ignored, or a negative value if an encoding error (for string and character conversion specifiers) occurred 5,6) number of characters transmitted to the output stream or negative value if an output error, a runtime constraints violation error, or an encoding error occurred. 7) number of characters written to `buffer`, not counting the null character (which is always written as long as `buffer` is not a null pointer and `bufsz` is not zero and not greater than `RSIZE_MAX`), or zero on runtime constraint violations, and negative value on encoding errors 8) number of characters not including the terminating null character (which is always written as long as `buffer` is not a null pointer and `bufsz` is not zero and not greater than `RSIZE_MAX`), which would have been written to `buffer` if `bufsz` was ignored, or a negative value if a runtime constraints violation or an encoding error occurred ### Notes The C standard and [POSIX](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html) specify that the behavior of `sprintf` and its variants is undefined when an argument overlaps with the destination buffer. Example: ``` sprintf(dst, "%s and %s", dst, t); // <- broken: undefined behavior ``` [POSIX specifies](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html) that `[errno](../error/errno "c/error/errno")` is set on error. It also specifies additional conversion specifications, most notably support for argument reordering (`n$` immediately after `%` indicates `n`'th argument). Calling `snprintf` with zero `bufsz` and null pointer for `buffer` is useful to determine the necessary buffer size to contain the output: ``` const char fmt[] = "sqrt(2) = %f"; int sz = snprintf(NULL, 0, fmt, sqrt(2)); char buf[sz + 1]; // note +1 for terminating null byte snprintf(buf, sizeof buf, fmt, sqrt(2)); ``` `snprintf_s`, just like `snprintf`, but unlike `sprintf_s`, will truncate the output to fit in `bufsz-1`. ### Example ``` #include <stdio.h> int main(void) { const char s[] = "Hello"; printf("%s", "Strings - padding:\n"); printf("\t.%10s.\n\t.%-10s.\n\t.%*s.\n", s, s, 10, s); printf("%s", "Strings - truncating:\n"); printf("\t%.4s\n\t%.*s\n", s, 3, s); printf("Characters:\t%c %%\n", 65); printf("%s", "Integers\n"); printf("Decimal:\t%i %d %.6i %i %.0i %+i %i\n", 1, 2, 3, 0, 0, 4, -4); printf("Hexadecimal:\t%x %x %X %#x\n", 5, 10, 10, 6); printf("Octal:\t\t%o %#o %#o\n", 10, 10, 4); printf("%s", "Floating point\n"); printf("Rounding:\t%f %.0f %.32f\n", 1.5, 1.5, 1.3); printf("Padding:\t%05.2f %.2f %5.2f\n", 1.5, 1.5, 1.5); printf("Scientific:\t%E %e\n", 1.5, 1.5); printf("Hexadecimal:\t%a %A\n", 1.5, 1.5); } ``` Output: ``` Strings - padding: . Hello. .Hello . . Hello. Strings - truncating: Hell Hel Characters: A % Integers Decimal: 1 2 000003 0 +4 -4 Hexadecimal: 5 a A 0x6 Octal: 12 012 04 Floating point Rounding: 1.500000 2 1.30000000000000004440892098500626 Padding: 01.50 1.50 1.50 Scientific: 1.500000E+00 1.500000e+00 Hexadecimal: 0x1.8p+0 0X1.8P+0 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.6.1 The fprintf function (p: 225-230) + 7.21.6.3 The printf function (p: 236) + 7.21.6.5 The snprintf function (p: 237) + 7.21.6.6 The sprintf function (p: 237) + K.3.5.3.1 The fprintf\_s function (p: 430) + K.3.5.3.3 The printf\_s function (p: 432) + K.3.5.3.5 The snprintf\_s function (p: 432-433) + K.3.5.3.6 The sprintf\_s function (p: 433) * C11 standard (ISO/IEC 9899:2011): + 7.21.6.1 The fprintf function (p: 309-316) + 7.21.6.3 The printf function (p: 324) + 7.21.6.5 The snprintf function (p: 325) + 7.21.6.6 The sprintf function (p: 325-326) + K.3.5.3.1 The fprintf\_s function (p: 591) + K.3.5.3.3 The printf\_s function (p: 593-594) + K.3.5.3.5 The snprintf\_s function (p: 594-595) + K.3.5.3.6 The sprintf\_s function (p: 595-596) * C99 standard (ISO/IEC 9899:1999): + 7.19.6.1 The fprintf function (p: 274-282) + 7.19.6.3 The printf function (p: 290) + 7.19.6.5 The snprintf function (p: 290-291) + 7.19.6.6 The sprintf function (p: 291) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.6.1 The fprintf function + 4.9.6.3 The printf function + 4.9.6.5 The sprintf function ### See also | | | | --- | --- | | [wprintffwprintfswprintfwprintf\_sfwprintf\_sswprintf\_ssnwprintf\_s](fwprintf "c/io/fwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [vprintfvfprintfvsprintfvsnprintfvprintf\_svfprintf\_svsprintf\_svsnprintf\_s](vfprintf "c/io/vfprintf") (C99)(C11)(C11)(C11)(C11) | prints formatted output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer using variable argument list (function) | | [fputs](fputs "c/io/fputs") | writes a character string to a file stream (function) | | [scanffscanfsscanfscanf\_sfscanf\_ssscanf\_s](fscanf "c/io/fscanf") (C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fprintf "cpp/io/c/fprintf") for `printf, fprintf, sprintf, snprintf` |
programming_docs
c fflush fflush ====== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` int fflush( FILE *stream ); ``` | | | For output streams (and for update streams on which the last operation was output), writes any unwritten data from the `stream`'s buffer to the associated output device. For input streams (and for update streams on which the last operation was input), the behavior is undefined. If `stream` is a null pointer, all open output streams are flushed, including the ones manipulated within library packages or otherwise not directly accessible to the program. ### Parameters | | | | | --- | --- | --- | | stream | - | the file stream to write out | ### Return value Returns zero on success. Otherwise `[EOF](../io "c/io")` is returned and the error indicator of the file stream is set. ### Notes POSIX [extends the specification of fflush](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html) by defining its effects on an input stream, as long as that stream represents a file or another seekable device: in that case the POSIX file pointer is repositioned to match the C stream pointer (which effectively undoes any read buffering) and the effects of any `[ungetc](ungetc "c/io/ungetc")` or `[ungetwc](ungetwc "c/io/ungetwc")` that weren't yet read back from the stream are discarded. Microsoft also extends the specification of fflush by defining its effects on an input stream: in Visual Studio 2013 and prior, it [discarded the input buffer](https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/9yky46tz(v=vs.120)), in Visual Studio 2015 and newer, it [has no effect, buffers are retained](https://msdn.microsoft.com/en-us/library/9yky46tz.aspx). ### References * C11 standard (ISO/IEC 9899:2011): + 7.21.5.2 The fflush function (p: 305) * C99 standard (ISO/IEC 9899:1999): + 7.19.5.2 The fflush function (p: 270-271) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.5.2 The fflush function ### See also | | | | --- | --- | | [fopenfopen\_s](fopen "c/io/fopen") (C11) | opens a file (function) | | [fclose](fclose "c/io/fclose") | closes a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fflush "cpp/io/c/fflush") for `fflush` | c fputws fputws ====== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` int fputws( const wchar_t *str, FILE *stream ); ``` | | (since C95) (until C99) | | ``` int fputws( const wchar_t * restrict str, FILE * restrict stream ); ``` | | (since C99) | Writes every character from the null-terminated wide string `str` to the output stream `stream`, as if by repeatedly executing `[fputwc](fputwc "c/io/fputwc")`. The terminating null wide character from `str` is not written. ### Parameters | | | | | --- | --- | --- | | str | - | null-terminated wide string to be written | | stream | - | output stream | ### Return value On success, returns a non-negative value. On failure, returns `[EOF](../io "c/io")` and sets the *error* indicator (see `[ferror](ferror "c/io/ferror")`) on `stream`. ### Example ``` #include <locale.h> #include <stdio.h> #include <wchar.h> int main(void) { setlocale(LC_ALL, "en_US.utf8"); int rc = fputws(L"御休みなさい", stdout); if (rc == EOF) perror("fputws()"); // POSIX requires that errno is set } ``` Output: ``` 御休みなさい ``` ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.3.4 The fputws function (p: 423) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.4 The fputws function (p: 368) ### See also | | | | --- | --- | | [fputs](fputs "c/io/fputs") | writes a character string to a file stream (function) | | [wprintffwprintfswprintfwprintf\_sfwprintf\_sswprintf\_ssnwprintf\_s](fwprintf "c/io/fwprintf") (C95)(C95)(C95)(C11)(C11)(C11)(C11) | prints formatted wide character output to `[stdout](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | **fputws** (C95) | writes a wide string to a file stream (function) | | [fgetws](fgetws "c/io/fgetws") (C95) | gets a wide string from a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fputws "cpp/io/c/fputws") for `fputws` | c fread fread ===== | Defined in header `<stdio.h>` | | | | --- | --- | --- | | ``` size_t fread( void *buffer, size_t size, size_t count, FILE *stream ); ``` | | (until C99) | | ``` size_t fread( void *restrict buffer, size_t size, size_t count, FILE *restrict stream ); ``` | | (since C99) | Reads up to `count` objects into the array `buffer` from the given input stream `stream` as if by calling `[fgetc](fgetc "c/io/fgetc")` `size` times for each object, and storing the results, in the order obtained, into the successive positions of `buffer`, which is reinterpreted as an array of `unsigned char`. The file position indicator for the stream is advanced by the number of characters read. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. If a partial element is read, its value is indeterminate. ### Parameters | | | | | --- | --- | --- | | buffer | - | pointer to the array where the read objects are stored | | size | - | size of each object in bytes | | count | - | the number of the objects to be read | | stream | - | the stream to read | ### Return value Number of objects read successfully, which may be less than `count` if an error or end-of-file condition occurs. If `size` or `count` is zero, `fread` returns zero and performs no other action. `fread` does not distinguish between end-of-file and error, and callers must use `[feof](feof "c/io/feof")` and `[ferror](ferror "c/io/ferror")` to determine which occurred. ### Example ``` #include <stdio.h> enum { SIZE = 5 }; int main(void) { double a[SIZE] = {1.,2.,3.,4.,5.}; FILE *fp = fopen("test.bin", "wb"); // must use binary mode fwrite(a, sizeof *a, SIZE, fp); // writes an array of doubles fclose(fp); double b[SIZE]; fp = fopen("test.bin","rb"); size_t ret_code = fread(b, sizeof *b, SIZE, fp); // reads an array of doubles if(ret_code == SIZE) { puts("Array read successfully, contents: "); for(int n = 0; n < SIZE; ++n) printf("%f ", b[n]); putchar('\n'); } else { // error handling if (feof(fp)) printf("Error reading test.bin: unexpected end of file\n"); else if (ferror(fp)) { perror("Error reading test.bin"); } } fclose(fp); } ``` Output: ``` Array read successfully, contents: 1.000000 2.000000 3.000000 4.000000 5.000000 ``` ### References * C17 standard (ISO/IEC 9899:2018): + 7.21.8.1 The fread function (p: 243-244) * C11 standard (ISO/IEC 9899:2011): + 7.21.8.1 The fread function (p: 335) * C99 standard (ISO/IEC 9899:1999): + 7.19.8.1 The fread function (p: 301) * C89/C90 standard (ISO/IEC 9899:1990): + 4.9.8.1 The fread function ### See also | | | | --- | --- | | [scanffscanfsscanfscanf\_sfscanf\_ssscanf\_s](fscanf "c/io/fscanf") (C11)(C11)(C11) | reads formatted input from `[stdin](std_streams "c/io/std streams")`, a file stream or a buffer (function) | | [fgets](fgets "c/io/fgets") | gets a character string from a file stream (function) | | [fwrite](fwrite "c/io/fwrite") | writes to a file (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/fread "cpp/io/c/fread") for `fread` | c putwchar putwchar ======== | Defined in header `<wchar.h>` | | | | --- | --- | --- | | ``` wint_t putwchar( wchar_t ch ); ``` | | (since C95) | Writes a wide character `ch` to `stdout`. ### Parameters | | | | | --- | --- | --- | | ch | - | wide character to be written | ### Return value `ch` on success, `WEOF` on failure. ### References * C11 standard (ISO/IEC 9899:2011): + 7.29.3.9 The putwchar function (p: 425) * C99 standard (ISO/IEC 9899:1999): + 7.24.3.9 The putwchar function (p: 370) ### See also | | | | --- | --- | | [putchar](putchar "c/io/putchar") | writes a character to `stdout` (function) | | [fputwcputwc](fputwc "c/io/fputwc") (C95) | writes a wide character to a file stream (function) | | [C++ documentation](https://en.cppreference.com/w/cpp/io/c/putwchar "cpp/io/c/putwchar") for `putwchar` | c Implicit conversions Implicit conversions ==================== When an expression is used in the context where a value of a different type is expected, *conversion* may occur: ``` int n = 1L; // expression 1L has type long, int is expected n = 2.1; // expression 2.1 has type double, int is expected char *p = malloc(10); // expression malloc(10) has type void*, char* is expected ``` Conversions take place in the following situations: ### Conversion as if by assignment * In the [assignment](operator_assignment "c/language/operator assignment") operator, the value of the right-hand operand is converted to the unqualified type of the left-hand operand. * In [scalar initialization](scalar_initialization "c/language/scalar initialization"), the value of the initializer expression is converted to the unqualified type of the object being initialized * In a [function-call expression](operator_other "c/language/operator other"), to a function that has a prototype, the value of each argument expression is converted to the type of the unqualified declared types of the corresponding parameter * In a [return statement](return "c/language/return"), the value of the operand of `return` is converted to an object having the return type of the function Note that actual assignment, in addition to the conversion, also removes extra range and precision from floating-point types and prohibits overlaps; those characteristics do not apply to conversion as if by assignment. ### Default argument promotions In a [function call expression](operator_other#Function_call "c/language/operator other") when the call is made to. 1) a [function without a prototype](function_declaration "c/language/function declaration") 2) a [variadic function](variadic "c/language/variadic"), where the argument expression is one of the trailing arguments that are matched against the ellipsis parameter Each argument of integer type undergoes *integer promotion* (see below), and each argument of type `float` is implicitly converted to the type `double`. ``` int add_nums(int count, ...); int sum = add_nums(2, 'c', true); // add_nums is called with three ints: (2, 99, 1) ``` | | | | --- | --- | | Note that `float [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` and `float [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` are not promoted to `double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` and `double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` in this context. | (since C99) | ### Usual arithmetic conversions The arguments of the following arithmetic operators undergo implicit conversions for the purpose of obtaining the *common real type*, which is the type in which the calculation is performed: * [binary arithmetic](operator_arithmetic "c/language/operator arithmetic") \*, /, %, +, - * [relational operators](operator_comparison "c/language/operator comparison") <, >, <=, >=, ==, != * [binary bitwise arithmetic](operator_arithmetic "c/language/operator arithmetic") &, ^, |, * the [conditional operator](operator_other "c/language/operator other") ?: 1) If one operand is `long double`, `long double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`, or `long double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` (since C99), the other operand is implicitly converted as follows: * integer or real floating type to `long double` | | | | --- | --- | | * complex type to `long double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` * imaginary type to `long double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` | (since C99) | 2) Otherwise, if one operand is `double`, `double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`, or `double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` (since C99), the other operand is implicitly converted as follows: * integer or real floating type to `double` | | | | --- | --- | | * complex type to `double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` * imaginary type to `double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` | (since C99) | 3) Otherwise, if one operand is `float`, `float [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`, or `float [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` (since C99), the other operand is implicitly converted as follows: * integer type to `float` (the only real type possible is float, which remains as-is) | | | | --- | --- | | * complex type remains `float [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` * imaginary type remains `float [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` | (since C99) | 4) Otherwise, both operands are integers. Both operands undergo *integer promotions* (see below); then, after integer promotion, one of the following cases applies: * If the types are the same, that type is the common type. * Else, the types are different: + If the types have the same signedness (both signed or both unsigned), the operand whose type has the lesser *conversion rank*1 is implicitly converted2 to the other type. + Else, the operands have different signedness: - If the unsigned type has *conversion rank* greater than or equal to the rank of the signed type, then the operand with the signed type is implicitly converted to the unsigned type. - Else, the unsigned type has *conversion rank* less than the signed type: * If the signed type can represent all values of the unsigned type, then the operand with the unsigned type is implicitly converted to the signed type. * Else, both operands undergo implicit conversion to the unsigned type counterpart of the signed operand's type. --- 1. Refer to "integer promotions" below for the rules on ranking. 2. Refer to "integer conversions" under "implicit conversion semantics" below. ``` 1.f + 20000001; // int is converted to float, giving 20000000.00 // addition and then rounding to float gives 20000000.00 (char)'a' + 1L; // first, char 'a', which is 97, is promoted to int // different types: int and long // same signedness: both signed // different rank: long is of greater rank than int // therefore, int 97 is converted to long 97 // the result is 97 + 1 = 98 of type signed long 2u - 10; // different types: unsigned int and signed int // different signedness // same rank // therefore, signed int 10 is converted to unsigned int 10 // since the arithmetic operation is performed for unsigned integers (see "Arithmetic operators" topic), // the calculation performed is (2 - 10) modulo (2 raised to n), where n is the number of bits of unsigned int // if unsigned int is 32-bit long, then // the result is (-8) modulo (2 raised to 32) = 4294967288 of type unsigned int 5UL - 2ULL; // different types: unsigned long and unsigned long long // same signedness // different rank: rank of unsigned long long is greater // therefore, unsigned long 5 is converted to unsigned long long 5 // since the arithmetic operation is performed for unsigned integers (see "Arithmetic operators" topic), // if unsigned long long is 64-bit long, then // the result is (5 - 2) modulo (2 raised to 64) = 3 of type unsigned long long 0UL - 1LL; // different types: unsigned long and signed long long // different signedness // different rank: rank of signed long long is greater. // if ULONG_MAX > LLONG_MAX, then signed long long cannot represent all unsigned long // therefore, this is the last case: both operands are converted to unsigned long long // unsigned long 0 is converted to unsigned long long 0 // long long 1 is converted to unsigned long long 1 // since the arithmetic operation is performed for unsigned integers (see "Arithmetic operators" topic), // if unsigned long long is 64-bit long, then // the calculation is (0 - 1) modulo (2 raised to 64) // thus, the result is 18446744073709551615 (ULLONG_MAX) of type unsigned long long ``` | | | | --- | --- | | The result type is determined as follows:* if both operands are complex, the result type is complex * if both operands are imaginary, the result type is imaginary * if both operands are real, the result type is real * if the two floating-point operands have different type domains (complex vs. real, complex vs imaginary, or imaginary vs. real), the result type is complex ``` double complex z = 1 + 2*I; double f = 3.0; z + f; // z remains as-is, f is converted to double, the result is double complex ``` | (since C99) | As always, the result of a floating-point operator may have greater range and precision than is indicated by its type (see `[FLT\_EVAL\_METHOD](../types/limits/flt_eval_method "c/types/limits/FLT EVAL METHOD")`). | | | | --- | --- | | Note: real and imaginary operands are not implicitly converted to complex because doing so would require extra computation, while producing undesirable results in certain cases involving infinities, NaNs and signed zeros. For example, if reals were converted to complex, 2.0×(3.0+i∞) would evaluate as (2.0+i0.0)×(3.0+i∞) ⇒ (2.0×3.0–0.0×∞) + i(2.0×∞+0.0×3.0) ⇒ NaN+i∞ rather than the correct 6.0+i∞. If imaginaries were converted to complex, i2.0×(∞+i3.0) would evaluate as (0.0+i2.0) × (∞+i3.0) ⇒ (0.0×∞ – 2.0×3.0) + i(0.0×3.0 + 2.0×∞) ⇒ NaN + i∞ instead of –6.0 + i∞. | (since C99) | Note: regardless of usual arithmetic conversions, the calculation may always be performed in a narrower type than specified by these rules under the [as-if rule](as_if "c/language/as if"). ### Value transformations #### Lvalue conversion Any [lvalue expression](value_category "c/language/value category") of any non-array type, when used in any context other than. * as the operand of the [address-of operator](operator_member_access "c/language/operator member access") (if allowed) * as the operand of the pre/post [increment and decrement operators](operator_incdec "c/language/operator incdec"). * as the left-hand operand of the [member access](operator_member_access "c/language/operator member access") (dot) operator. * as the left-hand operand of the [assignment and compound assignment](operator_assignment "c/language/operator assignment") operators. * as the operand of [sizeof](sizeof "c/language/sizeof") undergoes *lvalue conversion*: the type remains the same, but loses [const](const "c/language/const")/[volatile](volatile "c/language/volatile")/[restrict](restrict "c/language/restrict")-qualifiers and [atomic](atomic "c/language/atomic") properties, if any. The value remains the same, but loses its lvalue properties (the address may no longer be taken). If the lvalue has incomplete type, the behavior is undefined. If the lvalue designates an object of automatic storage duration whose address was never taken and if that object was uninitialized (not declared with an initializer and no assignment to it has been performed prior to use), the behavior is undefined. This conversion models the memory load of the value of the object from its location. ``` volatile int n = 1; int x = n; // lvalue conversion on n reads the value of n volatile int* p = &n; // no lvalue conversion: does not read the value of n ``` #### Array to pointer conversion Any [lvalue expression](value_category "c/language/value category") of [array type](array "c/language/array"), when used in any context other than. * as the operand of the [address-of operator](operator_member_access "c/language/operator member access") * as the operand of [sizeof](sizeof "c/language/sizeof") * as the string literal used for [array initialization](array_initialization "c/language/array initialization") undergoes a conversion to the non-lvalue pointer to its first element. If the array was declared [register](storage_duration "c/language/storage duration"), the behavior is undefined. ``` int a[3], b[3][4]; int* p = a; // conversion to &a[0] int (*q)[4] = b; // conversion to &b[0] ``` #### Function to pointer conversion Any function designator expression, when used in any context other than. * as the operand of the [address-of operator](operator_member_access "c/language/operator member access") * as the operand of [sizeof](sizeof "c/language/sizeof") undergoes a conversion to the non-lvalue pointer to the function designated by the expression. ``` int f(int); int (*p)(int) = f; // conversion to &f (***p)(1); // repeated dereference to f and conversion back to &f ``` ### Implicit conversion semantics Implicit conversion, whether *as if by assignment* or a *usual arithmetic conversion*, consists of two stages: 1) value transformation (if applicable) 2) one of the conversions listed below (if it can produce the target type) #### Compatible types Conversion of a value of any type to any [compatible type](types#Compatible_types "c/language/types") is always a no-op and does not change the representation. ``` uint8_t (*a)[10]; // if uint8_t is a typedef to unsigned char unsigned char (*b)[] = a; // then these pointer types are compatible ``` #### Integer promotions Integer promotion is the implicit conversion of a value of any integer type with *rank* less or equal to *rank* of int or of a [bit field](bit_field "c/language/bit field") of type `_Bool`, `int`, `signed int`, `unsigned int`, to the value of type `int` or `unsigned int`. If `int` can represent the entire range of values of the original type (or the range of values of the original bit field), the value is converted to type `int`. Otherwise the value is converted to `unsigned int`. Integer promotions preserve the value, including the sign: ``` int main(void) { void f(); // old-style function declaration char x = 'a'; // integer conversion from int to char f(x); // integer promotion from char back to int } void f(x) int x; {} // the function expects int ``` *rank* above is a property of every [integer type](type "c/language/type") and is defined as follows: 1) the ranks of all signed integer types are different and increase with their precision: rank of `signed char` < rank of `short` < rank of `int` < rank of `long int` < rank of `long long int` 2) the ranks of all signed integer types equal the ranks of the corresponding unsigned integer types 3) the rank of any standard integer type is greater than the rank of any extended integer type of the same size (that is, rank of `__int64` < rank of `long long int`, but rank of `long long` < rank of `__int128` due to the rule (1)) 4) rank of char equals rank of `signed char` and rank of `unsigned char` 5) the rank of `_Bool` is less than the rank of any other standard integer type 6) the rank of any enumerated type equals the rank of its compatible integer type 7) ranking is transitive: if rank of T1 < rank of T2 and rank of T2 < rank of T3 then rank of T1 < rank of T3 8) any aspects of relative ranking of extended integer types not covered above are implementation defined. Note: integer promotions are applied only. * as part of *usual arithmetic conversions* (see above) * as part of *default argument promotions* (see above) * to the operand of the unary arithmetic operators `+` and `-` * to the operand of the unary bitwise operator `~` * to both operands of the shift operators `<<` and `>>` | | | | --- | --- | | Boolean conversion A value of any scalar type (including `[nullptr\_t](../types/nullptr_t "c/types/nullptr t")`) (since C23) can be implicitly converted to `_Bool`. The values that compare equal to an integer constant expression of value zero are converted to `​0​` (`false`), all other values are converted to `1` (`true`). ``` bool b1 = 0.5; // b1 == 1 (0.5 converted to int would be zero) bool b2 = 2.0*_Imaginary_I; // b2 == 1 (but converted to int would be zero) bool b3 = 0.0 + 3.0*I; // b3 == 1 (but converted to int would be zero) bool b4 = 0.0/0.0; // b4 == 1 (NaN does not compare equal to zero) bool b5 = nullptr; // b5 == 0 (since C23: nullptr is converted to false) ``` | (since C99) | #### Integer conversions A value of any integer type can be implicitly converted to any other integer type. Except where covered by promotions and boolean conversions above, the rules are: * if the target type can represent the value, the value is unchanged * otherwise, if the target type is unsigned, the value 2b , where b is the number of bits in the target type, is repeatedly subtracted or added to the source value until the result fits in the target type. In other words, unsigned integers implement modulo arithmetic. * otherwise, if the target type is signed, the behavior is implementation-defined (which may include raising a signal) ``` char x = 'a'; // int -> char, result unchanged unsigned char n = -123456; // target is unsigned, result is 192 (that is, -123456+483*256) signed char m = 123456; // target is signed, result is implementation-defined assert(sizeof(int) > -1); // assert fails: // operator > requests conversion of -1 to size_t, // target is unsigned, result is SIZE_MAX ``` #### Real floating-integer conversions A finite value of any real floating type can be implicitly converted to any integer type. Except where covered by boolean conversion above, the rules are: * The fractional part is discarded (truncated towards zero). + If the resulting value can be represented by the target type, that value is used + otherwise, the behavior is undefined ``` int n = 3.14; // n == 3 int x = 1e10; // undefined behavior for 32-bit int ``` A value of any integer type can be implicitly converted to any real floating type. * if the value can be represented exactly by the target type, it is unchanged * if the value can be represented, but cannot be represented exactly, the result is the nearest higher or the nearest lower value (in other words, rounding direction is implementation-defined), although if IEEE arithmetic is supported, rounding is to nearest. It is unspecified whether `[FE\_INEXACT](../numeric/fenv/fe_exceptions "c/numeric/fenv/FE exceptions")` is raised in this case. * if the value cannot be represented, the behavior is undefined, although if IEEE arithmetic is supported, `[FE\_INVALID](../numeric/fenv/fe_exceptions "c/numeric/fenv/FE exceptions")` is raised and the result value is unspecified. The result of this conversion may have greater range and precision than its target type indicates (see `[FLT\_EVAL\_METHOD](../types/limits/flt_eval_method "c/types/limits/FLT EVAL METHOD")`. If control over `[FE\_INEXACT](../numeric/fenv/fe_exceptions "c/numeric/fenv/FE exceptions")` is needed in floating-to-integer conversions, `[rint](../numeric/math/rint "c/numeric/math/rint")` and `[nearbyint](../numeric/math/nearbyint "c/numeric/math/nearbyint")` may be used. ``` double d = 10; // d = 10.00 float f = 20000001; // f = 20000000.00 (FE_INEXACT) float x = 1+(long long)FLT_MAX; // undefined behavior ``` #### Real floating point conversions A value of any real floating type can be implicitly converted to any other real floating type. * If the value can be represented by the target type exactly, it is unchanged * if the value can be represented, but cannot be represented exactly, the result is the nearest higher or the nearest lower value (in other words, rounding direction is implementation-defined), although if IEEE arithmetic is supported, rounding is to nearest * if the value cannot be represented, the behavior is undefined The result of this conversion may have greater range and precision than its target type indicates (see `[FLT\_EVAL\_METHOD](../types/limits/flt_eval_method "c/types/limits/FLT EVAL METHOD")`. ``` double d = 0.1; // d = 0.1000000000000000055511151231257827021181583404541015625 float f = d; // f = 0.100000001490116119384765625 float x = 2*(double)FLT_MAX; // undefined ``` | | | | --- | --- | | Complex type conversions A value of any complex type can be implicitly converted to any other complex type. The real part and the imaginary part individually follow the conversion rules for the real floating types. ``` double complex d = 0.1 + 0.1*I; float complex f = d; // f is (0.100000001490116119384765625, 0.100000001490116119384765625) ``` Imaginary type conversions A value of any imaginary type can be implicitly converted to any other imaginary type. The imaginary part follows the conversion rules for the real floating types. ``` double imaginary d = 0.1*_Imaginary_I; float imaginary f = d; // f is 0.100000001490116119384765625*I ``` Real-complex conversions A value of any real floating type can be implicitly converted to any complex type.* The real part of the result is determined by the conversion rules for the real floating types * The imaginary part of the result is positive zero (or unsigned zero on non-IEEE systems) A value of any complex type can be implicitly converted to any real floating type.* The real part is converted following the rules for the real floating types * The imaginary part is discarded Note: in complex-to-real conversion, a NaN in the imaginary part will not propagate to the real result. ``` double complex z = 0.5 + 3*I; float f = z; // the imaginary part is discarded, f is set to 0.5 z = f; // sets z to 0.5 + 0*I ``` Real-imaginary conversions A value of any imaginary type can be implicitly converted to any real type (integer or floating-point). The result is always a positive (or unsigned) zero, except when the target type is \_Bool, in which case boolean conversion rules apply. A value of any real type can be implicitly converted to any imaginary type. The result is always a positive imaginary zero. ``` double imaginary z = 3*I; bool b = z; // Boolean conversion: sets b to true float f = z; // Real-imaginary conversion: sets f to 0.0 z = 3.14; // Imaginary-real conversion: sets z to 0*_Imaginary_I ``` Complex-imaginary conversions A value of any imaginary type can be implicitly converted to any complex type.* The real part of the result is the positive zero * The imaginary part of the result follows the conversion rules for the corresponding real types A value of any complex type can be implicitly converted to any imaginary type.* The real part is discarded * The imaginary part of the result follows the conversion rules for the corresponding real types ``` double imaginary z = I * (3*I); // the complex result -3.0+0i loses real part // sets z to 0*_Imaginary_I ``` | (since C99) | #### Pointer conversions A pointer to `void` can be implicitly converted to and from any pointer to object type with the following semantics: * If a pointer to object is converted to a pointer to void and back, its value compares equal to the original pointer. * No other guarantees are offered ``` int* p = malloc(10 * sizeof(int)); // malloc returns void* ``` A pointer to an unqualified type may be implicitly converted to the pointer to qualified version of that type (in other words, [const](const "c/language/const"), [volatile](volatile "c/language/volatile"), and [restrict](restrict "c/language/restrict") qualifiers can be added. The original pointer and the result compare equal. ``` int n; const int* p = &n; // &n has type int* ``` Any integer [constant expression](constant_expression "c/language/constant expression") with value `​0​` as well as integer pointer expression with value zero cast to the type `void*` can be implicitly converted to any pointer type (both pointer to object and pointer to function). The result is the null pointer value of its type, guaranteed to compare unequal to any non-null pointer value of that type. This integer or void\* expression is known as *null pointer constant* and the standard library provides one definition of this constant as the macro `[NULL](../types/null "c/types/NULL")` . ``` int* p = 0; double* q = NULL; ``` ### Notes Although signed integer overflow in any arithmetic operator is undefined behavior, overflowing a signed integer type in an integer conversion is merely unspecified behavior. On the other hand, although unsigned integer overflow in any arithmetic operator (and in integer conversion) is a well-defined operation and follows the rules of modulo arithmetic, overflowing an unsigned integer in a floating-to-integer conversion is undefined behavior: the values of real floating type that can be converted to unsigned integer are the values from the open interval (-1; Unnn\_MAX+1). ``` unsigned int n = -1.0; // undefined behavior ``` Conversions between pointers and integers (except from pointer to \_Bool and (since C99)from integer constant expression with the value zero to pointer), between pointers to objects (except where either to or from is a pointer to void) and conversions between pointers to functions (except when the functions have compatible types) are never implicit and require a [cast operator](cast "c/language/cast"). There are no conversions (implicit or explicit) between pointers to functions and pointers to objects (including void\*) or integers. ### References * C17 standard (ISO/IEC 9899:2018): + 6.3 Conversions (p: 37-41) * C11 standard (ISO/IEC 9899:2011): + 6.3 Conversions (p: 50-56) * C99 standard (ISO/IEC 9899:1999): + 6.3 Conversions (p: 42-48) * C89/C90 standard (ISO/IEC 9899:1990): + 3.2 Conversions ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/implicit_cast "cpp/language/implicit cast") for Implicit conversions |
programming_docs
c Other operators Other operators =============== A collection of operators that do not fit into any of the other major categories. | Operator | Operator name | Example | Description | | --- | --- | --- | --- | | `(...)` | [function call](#Function_call) | `f(...)` | call the function **f**(), with zero or more arguments | | `,` | [comma operator](#Comma_operator) | `a, b` | evaluate expression **a**, disregard its return value and complete any side-effects, then evaluate expression **b**, returning the type and the result of this evaluation | | `(type)` | [type cast](cast "c/language/cast") | `(type)a` | cast the type of **a** to **type** | | `? :` | [conditional operator](#Conditional_operator) | `a ? b : c` | if **a** is logically true (does not evaluate to zero) then evaluate expression **b**, otherwise evaluate expression **c** | | `sizeof` | [sizeof operator](sizeof "c/language/sizeof") | `sizeof a` | the size in bytes of **a** | | `_Alignof`(since C11) | [\_Alignof operator](_alignof "c/language/ Alignof") | `_Alignof(type)` | the alignment required of **type** | ### Function call The function call expression has the form. | | | | | --- | --- | --- | | expression `(` argument-list(optional) `)` | | | where. | | | | | --- | --- | --- | | expression | - | any expression of pointer-to-function type (after [lvalue conversions](conversion#Lvalue_conversions "c/language/conversion")) | | argument-list | - | comma-separated list of expressions (which cannot be comma operators) of any complete object type. May be omitted when calling functions that take no arguments. | The behavior of the function call expression depends on whether the prototype of the function being called is [in scope](scope "c/language/scope") at the point of call. #### Call to a function with a prototype 1) The number of parameters must equal the number of arguments (unless the ellipsis parameter is used). 2) The type of each parameter must be a type such that [implicit conversion as if by assignment](conversion "c/language/conversion") exists that converts the unqualified type of the corresponding argument to the type of the parameter. | | | | --- | --- | | Additionally, for every parameter of [array type](array "c/language/array") that uses the keyword `static` between `[` and `]`, the argument expression must designate a pointer to the element of an array with at least that many elements as specified in the size expression of the parameter. | (since C99) | 3) The arguments are evaluated [in unspecified order and without sequencing](eval_order "c/language/eval order"). 4) [Assignment](operator_assignment "c/language/operator assignment") is performed to copy the value of each argument to the corresponding function parameter, ignoring any type qualifiers on the parameter type and its possibly rescursive elements or members, if any (note: the function can modify its parameters, and those changes do not affect the arguments; C function calls are only call-by-value). * if there is a [trailing ellipsis](variadic "c/language/variadic") parameter, [Default argument promotions](conversion#Default_argument_promotions "c/language/conversion") are performed on the remaining arguments, which are made available to `va_list`. 5) Function is executed, and the value it returns becomes the value of the function call expression (if the function returns void, the function call expression is a void expression) ``` void f(char* p, int x) {} int main(void) { f("abc", 3.14); // array to pointer and float to int conversions } ``` | | | | --- | --- | | Call to a function without a prototype 1) The arguments are evaluated [in unspecified order and without sequencing](eval_order "c/language/eval order"). 2) [Default argument promotions](conversion#Default_argument_promotions "c/language/conversion") are performed on every argument expression. 3) [Assignment](operator_assignment "c/language/operator assignment") is performed to copy the value of each argument to the corresponding function parameter, ignoring any type qualifiers on the parameter type and its possibly rescursive elements or members, if any. 4) Function is executed, and the value it returns becomes the value of the function call expression (if the function returns void, the function call expression is a void expression) ``` void f(); // no prototype int main(void) { f(1, 1.0f); // UB unless f is defined to take an int and a double } void f(int a, double c) {} ``` The behavior of a function call to a function without a prototype is undefined if.* the number of arguments does not match the number of parameters. * the promoted types of the arguments are not [compatible](type#Compatible_types "c/language/type") with the promoted types of the parameters except that + signed and unsigned versions of the same integer type are considered compatible if the value of the argument is representable by both types. + pointers to void and pointers to (possibly cvr-qualified) character types are considered compatible | (until C23) | #### Notes The evaluations of expression that designates the function to be called and all arguments are [unsequenced](eval_order "c/language/eval order") with respect to each other (but there is a sequence point before the body of the function begins executing). ``` (*pf[f1()]) (f2(), f3() + f4()); // f1, f2, f3, f4 may be called in any order ``` Although function call is only defined for pointers to functions, it works with function designators due to the [function-to-pointer implicit conversion](conversion#Function_to_pointer_conversion "c/language/conversion"). ``` int f(void) { return 1; } int (*pf)(void) = f; int main(void) { f(); // convert f to pointer, then call (&f)(); // create a pointer to function, then call pf(); // call the function (*pf)(); // obtain the function designator, convert to pointer, then calls (****f)(); // convert to pointer, obtain the function, repeat 4x, then call (****pf)(); // also OK } ``` Functions that ignore unused arguments, such as `[printf](../io/fprintf "c/io/fprintf")`, must be called with a prototype in scope (the prototype of such functions necessarily uses the [trailing ellipsis](variadic "c/language/variadic") parameter) to avoid invoking undefined behavior. The current standard wording of the semantics of preparing function parameters is defective, because it specifies that parameters are assigned from arguments while calling, which incorrectly rejects const-qualified paratemeter or member types, and inappropriately applies the semantics of volatile which is unimplementable for function parameters on many platforms. A post-C11 defect report [DR 427](https://open-std.org/JTC1/SC22/WG14/www/docs/n2396.htm#dr_427) proposed change of such semantics from assignment to initialization, but was closed as not-a-defect. | | | | --- | --- | | A function call expression where expression consists entirely of an identifier and that identifier is undeclared acts as though the identifier is declared as. ``` extern int identifier(); // returns int and has no prototype ``` So the following complete program is valid C89: ``` main() { int n = atoi("123"); // implicitly declares atoi as int atoi() } ``` | (until C99) | ### Comma operator The comma operator expression has the form. | | | | | --- | --- | --- | | lhs `,` rhs | | | where. | | | | | --- | --- | --- | | lhs | - | any expression | | rhs | - | any expression other than another comma operator (in other words, comma operator's [associativity](operator_precedence "c/language/operator precedence") is left-to-right) | First, the left operand, lhs, is evaluated and its result value is discarded. Then, a [sequence point](eval_order "c/language/eval order") takes place, so that all side effects of lhs are complete. Then, the right operand, rhs, is evaluated and its result is returned by the comma operator as a [non-lvalue](value_category "c/language/value category"). ### Notes The type of the lhs may be `void` (that is, it may be a call to a function that returns `void`, or it can be an expression [cast](cast "c/language/cast") to `void`). The comma operator may be lvalue in C++, but never in C. The comma operator may return a struct (the only other expressions that return structs are compound literals, function calls, assignments, and the conditional operator). In the following contexts, the comma operator cannot appear at the top level of an expression because the comma has a different meaning: * argument list in a function call * initializer expression or [initializer list](initialization "c/language/initialization") * [generic selection](generic "c/language/generic") If the comma operator has to be used in such context, it must be parenthesized: ``` // int n = 2,3; // error, comma assumed to begin the next declarator // int a[2] = {1,2,3}; // error: more initializers than elements int n = (2,3), a[2] = {(1,2),3}; // OK f(a, (t=3, t+2), c); // OK, first, stores 3 in t, then calls f with three arguments ``` Top-level comma operator is also disallowed in array bounds. ``` // int a[2,3]; // error int a[(2,3)]; // OK, VLA array of size 3 (VLA because (2,3) is not a constant expression) ``` Comma operator is not allowed in [constant expressions](constant_expression "c/language/constant expression"), regardless of whether it's on the top level or not. ``` // static int n = (1,2); // Error: constant expression cannot call the comma operator ``` ### Cast operator See [cast operator](cast "c/language/cast"). ### Conditional operator The conditional operator expression has the form. | | | | | --- | --- | --- | | condition `?` expression-true `:` expression-false | | | where. | | | | | --- | --- | --- | | condition | - | an expression of scalar type | | expression-true | - | the expression that will be evaluated if condition compares unequal to zero | | expression-false | - | the expression that will be evaluated if condition compares equal to zero | Only the following expressions are allowed as expression-true and expression-false. * two expressions of any [arithmetic type](arithmetic_types "c/language/arithmetic types") * two expressions of the same [struct](struct "c/language/struct") or [union](union "c/language/union") type * two expressions of void type * two expressions of pointer type, pointing to types that are [compatible](type#Compatible_types "c/language/type"), ignoring cvr-qualifiers | | | | --- | --- | | * two expressions of `[nullptr\_t](../types/nullptr_t "c/types/nullptr t")` type | (since C23) | * one expression is a pointer and the other is the null pointer constant (such as `[NULL](../types/null "c/types/NULL")`) or a `[nullptr\_t](../types/nullptr_t "c/types/nullptr t")` value (since C23) * one expression is a pointer to object and the other is a pointer to void (possibly qualified) 1) First, evaluates condition. There is a [sequence point](eval_order "c/language/eval order") after this evaluation. 2) If the result of condition compares unequal to zero, executes expression-true, otherwise executes expression-false 3) Performs a [conversion](conversion "c/language/conversion") from the result of the evaluation to the *common type*, defined as follows: 1) if the expressions have arithmetic type, the common type is the type after [usual arithmetic conversions](conversion#Usual_arithmetic_conversions "c/language/conversion") 2) if the expressions have struct/union type, the common type is that struct/union type 3) if the expressions are both void, the entire conditional operator expression is a void expression 4) if one is a pointer and the other is a null pointer constant or a `[nullptr\_t](../types/nullptr_t "c/types/nullptr t")` value (since C23), the type is the type of that pointer 5) if both are pointers, the result is the pointer to the type that combines cvr-qualifiers of both pointed-to types (that is, if one is `const int*` and the other is `volatile int*`, the result is `const volatile int*`), and if the types were different, the pointed-to type is the [composite type](types#Composite_type "c/language/types"). 6) if one is a pointer to void, the result is a pointer to void with combined cvr-qualifiers | | | | --- | --- | | 7) if both have `[nullptr\_t](../types/nullptr_t "c/types/nullptr t")` type, the common type is also `[nullptr\_t](../types/nullptr_t "c/types/nullptr t")` | (since C23) | ``` #define ICE(x) (sizeof(*(1 ? ((void*)((x) * 0l)) : (int*)1))) // if x is an Integer Constant Expression then macro expands to sizeof(*(1 ? NULL : (int *) 1)) // (void *)((x)*0l)) -> NULL // according to point (4) this further converts into sizeof(int) // if x is not an Integer Constant Expression then macro expands to // according to point (6) (sizeof(*(void *)(x)) // Error due incomplete type ``` #### Notes The conditional operator is never an [lvalue expression](value_category "c/language/value category"), although it may return objects of struct/union type. The only other expressions that may return stucts are [assignment](operator_assignment "c/language/operator assignment"), [comma](#Comma_operator), [function call](#Function_call), and [compound literal](compound_literal "c/language/compound literal"). Note that in C++, it may be an lvalue expression. See [operator precedence](operator_precedence "c/language/operator precedence") for the details on the relative precedence of this operator and assignment. Conditional operator has right-to-left associativity, which allows chaining. ``` #include <assert.h> enum vehicle { bus, airplane, train, car, horse, feet }; enum vehicle choose(char arg) { return arg == 'B' ? bus : arg == 'A' ? airplane : arg == 'T' ? train : arg == 'C' ? car : arg == 'H' ? horse : feet ; } int main(void) { assert(choose('H') == horse && choose('F') == feet); } ``` ### sizeof operator See [sizeof operator](sizeof "c/language/sizeof"). ### \_Alignof operator See [\_Alignof operator](_alignof "c/language/ Alignof"). ### References * C17 standard (ISO/IEC 9899:2018): + 6.5.2.2 Function calls (p: 58-59) + 6.5.3.4 The sizeof and \_Alignof operators (p: 64-65) + 6.5.4 Cast operators (p: 65-66) + 6.5.15 Conditional operator (p: 71-72) + 6.5.17 Comma operator (p: 75) * C11 standard (ISO/IEC 9899:2011): + 6.5.2.2 Function calls (p: 81-82) + 6.5.3.4 The sizeof and \_Alignof operators (p: 90-91) + 6.5.4 Cast operators (p: 91) + 6.5.15 Conditional operator (p: 100) + 6.5.17 Comma operator (p: 105) * C99 standard (ISO/IEC 9899:1999): + 6.5.2.2 Function calls (p: 71-72) + 6.5.3.4 The sizeof operator (p: 80-81) + 6.5.4 Cast operators (p: 81) + 6.5.15 Conditional operator (p: 90-91) + 6.5.17 Comma operator (p: 94) * C89/C90 standard (ISO/IEC 9899:1990): + 3.3.2.2 Function calls + 3.3.3.4 The sizeof operator + 3.3.4 Cast operators + 3.3.15 Conditional operator + 3.3.17 Comma operator ### See also * [Operator precedence](operator_precedence "c/language/operator precedence") | Common operators | | --- | | [assignment](operator_assignment "c/language/operator assignment") | [incrementdecrement](operator_incdec "c/language/operator incdec") | [arithmetic](operator_arithmetic "c/language/operator arithmetic") | [logical](operator_logical "c/language/operator logical") | [comparison](operator_comparison "c/language/operator comparison") | [memberaccess](operator_member_access "c/language/operator member access") | **other** | | `a = b a += b a -= b a *= b a /= b a %= b a &= b a |= b a ^= b a <<= b a >>= b`. | `++a --a a++ a--` | `+a -a a + b a - b a * b a / b a % b ~a a & b a | b a ^ b a << b a >> b`. | `!a a && b a || b`. | `a == b a != b a < b a > b a <= b a >= b`. | `a[b] *a &a a->b a.b`. | `a(...) a, b (type) a ? : sizeof _Alignof` (since C11). | | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/operator_other "cpp/language/operator other") for Other operators | c Inline assembly Inline assembly =============== Inline assembly (typically introduced by the `asm` keyword) gives the ability to embed assembly language source code within a C program. Unlike in C++, inline assembly is treated as an extension in C. It is conditionally supported and implementation defined, meaning that it may not be present and, even when provided by the implementation, it does not have a fixed meaning. ### Syntax | | | | | --- | --- | --- | | `asm (` string\_literal `)` `;` | | | ### Explanation This kind of inline assembly syntax is accepted by the C++ standard and called *asm-declaration* in C++. The string\_literal is typically a short program written in assembly language, which is executed whenever this declaration is executed. Different C compilers have wildly varying rules for asm-declarations, and different conventions for the interaction with the surrounding C code. asm-declaration can appear inside a block (a function body or another compound statement), and, as all other declarations, this declaration can also appear outside a block. ### Notes MSVC does not support inline assembly on the ARM and x64 processors, and only support the form introduced by `__asm` on x86 processors. When compiling in ISO C mode by GCC or Clang (e.g. with option `-std=c11`), `__asm__` must be used instead of `asm`. ### Examples Demonstrates two kinds of inline assembly syntax offered by the GCC compiler. This program will only work correctly on x86-64 platform under Linux. Note that the "standard inline assembly" is also treated as an extension in the C standard. ``` #include <stdio.h> extern int func(void); // the definition of func is written in assembly language __asm__(".globl func\n\t" ".type func, @function\n\t" "func:\n\t" ".cfi_startproc\n\t" "movl $7, %eax\n\t" "ret\n\t" ".cfi_endproc"); int main(void) { int n = func(); // gcc's extended inline assembly __asm__ ("leal (%0,%0,4),%0" : "=r" (n) : "0" (n)); printf("7*5 = %d\n", n); fflush(stdout); // flush is intentional // standard inline assembly in C++ __asm__ ("movq $60, %rax\n\t" // the exit syscall number on Linux "movq $2, %rdi\n\t" // this program returns 2 "syscall"); } ``` Output: ``` 7*5 = 35 ``` ### External links * [GCC Inline Assembly HOWTO](http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html) * [IBM XL C/C++ Inline Assembly](http://pic.dhe.ibm.com/infocenter/comphelp/v121v141/topic/com.ibm.xlcpp121.aix.doc/language_ref/asm.html) * [Intel C++ Inline Assembly](https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-inline-assembly) * [Visual Studio 2013 Inline Assembler](http://msdn.microsoft.com/en-us/library/4ks26t93(v=vs.120).aspx) * [Sun Studio 12 Asm Statements](https://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support) * [Inline assembly for Itanium-based HP-UX](http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=4308e2f5bde02110e2f5bde02110275d6e10RCRD) ### References * C11 standard (ISO/IEC 9899:2011): + J.5.10 The asm keyword (p: 580) * C99 standard (ISO/IEC 9899:1999): + J.5.10 The asm keyword (p: 512) * C89/C90 standard (ISO/IEC 9899:1990): + G.5.10 The asm keyword ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/asm "cpp/language/asm") for `asm` declaration | c Arithmetic types Arithmetic types ================ (See also [type](type "c/language/type") for type system overview and [the list of type-related utilities](../types "c/types") that are provided by the C library). | | | | --- | --- | | Boolean type* `_Bool` (also accessible as the macro [`bool`](../types "c/types")) - type, capable of holding one of the two values: 1 and 0 (also accessible as the macros [`true`](../types "c/types") and [`false`](../types "c/types")). Note that [conversion](conversion "c/language/conversion") to \_Bool does not work the same as conversion to other integer types: `(bool)0.5` evaluates to `1`, whereas `(int)0.5` evaluates to `​0​`. | (since C99) | ### Character types * `signed char` - type for signed character representation. * `unsigned char` - type for unsigned character representation. Also used to inspect [object representations](object "c/language/object") (raw memory). * `char` - type for character representation. Equivalent to either `signed char` or `unsigned char` (which one is implementation-defined and may be controlled by a compiler commandline switch), but `char` is a distinct type, different from both `signed char` and `unsigned char` Note that the standard library also defines [typedef](typedef "c/language/typedef") names [`wchar_t`](../string/wide "c/string/wide") , [`char16_t`](../string/multibyte "c/string/multibyte"), and [`char32_t`](../string/multibyte "c/string/multibyte") (since C11) to represent wide characters. ### Integer types * `short int` (also accessible as `short`, may use the keyword `signed`) * `unsigned short int` (also accessible as `unsigned short`) * `int` (also accessible as `signed int`) * `unsigned int` (also accessible as `unsigned`), the unsigned counterpart of `int`, implementing modulo arithmetic. Suitable for bit manipulations. * `long int` (also accessible as `long`) * `unsigned long int` (also accessible as `unsigned long`) This is the most optimal integer type for the platform, and is guaranteed to be at least 16 bits. Most current systems use 32 bits (see Data models below). | | | | --- | --- | | * `long long int` (also accessible as `long long`) * `unsigned long long int` (also accessible as `unsigned long long`) | (since C99) | Note: as with all type specifiers, any order is permitted: `unsigned long long int` and `long int unsigned long` name the same type. The following table summarizes all available integer types and their properties: | Type specifier | Equivalent type | Width in bits by data model | | --- | --- | --- | | C standard | LP32 | ILP32 | LLP64 | LP64 | | `short` | `short int` | at least **16** | **16** | **16** | **16** | **16** | | `short int` | | `signed short` | | `signed short int` | | `unsigned short` | `unsigned short int` | | `unsigned short int` | | `int` | `int` | at least **16** | **16** | **32** | **32** | **32** | | `signed` | | `signed int` | | `unsigned` | `unsigned int` | | `unsigned int` | | `long` | `long int` | at least **32** | **32** | **32** | **32** | **64** | | `long int` | | `signed long` | | `signed long int` | | `unsigned long` | `unsigned long int` | | `unsigned long int` | | `long long` | `long long int` (C99) | at least **64** | **64** | **64** | **64** | **64** | | `long long int` | | `signed long long` | | `signed long long int` | | `unsigned long long` | `unsigned long long int` (C99) | | `unsigned long long int` | Besides the minimal bit counts, the C Standard guarantees that `1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)`. Note: this allows the extreme case in which [bytes](https://en.wikipedia.org/wiki/Byte "enwiki:Byte") are sized 64 bits, all types (including `char`) are 64 bits wide, and `sizeof` returns 1 for every type. Note: integer arithmetic is defined differently for the signed and unsigned integer types. See [arithmetic operators](operator_arithmetic "c/language/operator arithmetic"), in particular [integer overflows](operator_arithmetic#Overflows "c/language/operator arithmetic"). #### Data models The choices made by each implementation about the sizes of the fundamental types are collectively known as *data model*. Four data models found wide acceptance: 32 bit systems: * **LP32** or **2/4/4** (int is 16-bit, long and pointer are 32-bit) + Win16 API * **ILP32** or **4/4/4** (int, long, and pointer are 32-bit); + Win32 API + Unix and Unix-like systems (Linux, Mac OS X) 64 bit systems: * **LLP64** or **4/4/8** (int and long are 32-bit, pointer is 64-bit) + Win64 API * **LP64** or **4/8/8** (int is 32-bit, long and pointer are 64-bit) + Unix and Unix-like systems (Linux, Mac OS X) Other models are very rare. For example, **ILP64** (**8/8/8**: int, long, and pointer are 64-bit) only appeared in some early 64-bit Unix systems (e.g. Unicos on Cray). Note that exact-width integer types are available in [<stdint.h>](../types/integer "c/types/integer") since C99. ### Real floating types C has three or six (since C23) types for representing real floating-point values: * `float` - single precision floating point type. Matches [IEEE-754 binary32 format](https://en.wikipedia.org/wiki/Single-precision_floating-point_format "enwiki:Single-precision floating-point format") if supported. * `double` - double precision floating point type. Matches [IEEE-754 binary64 format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format "enwiki:Double-precision floating-point format") if supported. * `long double` - extended precision floating point type. Matches [IEEE-754 binary128 format](https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format "enwiki:Quadruple-precision floating-point format") if supported, otherwise matches [IEEE-754 binary64-extended format](https://en.wikipedia.org/wiki/Extended_precision "enwiki:Extended precision") if supported, otherwise matches some non-IEEE-754 extended floating-point format as long as its precision is better than binary64 and range is at least as good as binary64, otherwise matches IEEE-754 binary64 format. + binary128 format is used by some HP-UX, SPARC, MIPS, ARM64, and z/OS implementations. + The most well known IEEE-754 binary64-extended format is 80-bit x87 extended precision format. It is used by many x86 and x86-64 implementations (a notable exception is MSVC, which implements `long double` in the same format as `double`, i.e. binary64). | | | | --- | --- | | If the implementation predefines the macro constant `__STDC_IEC_60559_DFP__`, the following decimal floating-point types are also supported. * `_Decimal32` - Represents [IEEE-754 decimal32 format](https://en.wikipedia.org/wiki/decimal32_floating-point_format "enwiki:decimal32 floating-point format"). * `_Decimal64` - Represents [IEEE-754 decimal64 format](https://en.wikipedia.org/wiki/decimal64_floating-point_format "enwiki:decimal64 floating-point format"). * `_Decimal128` - Represents [IEEE-754 decimal128 format](https://en.wikipedia.org/wiki/decimal128_floating-point_format "enwiki:decimal128 floating-point format"). Otherwise, these decimal floating-point types are not supported. | (since C23) | Floating-point types may support special values: * *infinity* (positive and negative), see [`INFINITY`](../numeric/math/infinity "c/numeric/math/INFINITY") * the *negative zero*, `-0.0`. It compares equal to the positive zero, but is meaningful in some arithmetic operations, e.g. `1.0/0.0 == INFINITY`, but `1.0/-0.0 == -INFINITY`) * *not-a-number* (NaN), which does not compare equal with anything (including itself). Multiple bit patterns represent NaNs, see `[nan](../numeric/math/nan "c/numeric/math/nan")`, [`NAN`](../numeric/math/nan "c/numeric/math/NAN"). Note that C takes no special notice of signaling NaNs (specified by IEEE-754), and treats all NaNs as quiet. Real floating-point numbers may be used with [arithmetic operators](operator_arithmetic "c/language/operator arithmetic") + - / \* and various mathematical functions from [`<math.h>`](../numeric/math "c/numeric/math"). Both built-in operators and library functions may raise floating-point exceptions and set `[errno](../error/errno "c/error/errno")` as described in [`math_errhandling`](../numeric/math/math_errhandling "c/numeric/math/math errhandling"). Floating-point expressions may have greater range and precision than indicated by their types, see `[FLT\_EVAL\_METHOD](../types/limits/flt_eval_method "c/types/limits/FLT EVAL METHOD")`. [Assignment](operator_assignment "c/language/operator assignment"), [return](return "c/language/return"), and [cast](cast "c/language/cast") force the range and precision to the one associated with the declared type. Floating-point expressions may also be *contracted*, that is, calculated as if all intermediate values have infinite range and precision, see [`#pragma STDC FP_CONTRACT`](../preprocessor/impl#Standard_pragmas "c/preprocessor/impl"). Some operations on floating-point numbers are affected by and modify the state of [the floating-point environment](../numeric/fenv "c/numeric/fenv") (most notably, the rounding direction). [Implicit conversions](conversion "c/language/conversion") are defined between real floating types and integer, complex, and imaginary types. See [Limits of floating point types](../types/limits#Limits_of_floating_point_types "c/types/limits") and [the `math.h` library](../numeric/math "c/numeric/math") for additional details, limits, and properties of the floating-point types. | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | | Complex floating types Complex floating types model the mathematical [complex numbers](https://en.wikipedia.org/wiki/Complex_number "enwiki:Complex number"), that is the numbers that can be written as a sum of a real number and a real number multiplied by the imaginary unit: a + bi. The three complex types are.* `float _Complex` (also available as `float [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` if [`<complex.h>`](../numeric/complex "c/numeric/complex") is included) * `double _Complex` (also available as `double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` if [`<complex.h>`](../numeric/complex "c/numeric/complex") is included) * `long double _Complex` (also available as `long double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)` if [`<complex.h>`](../numeric/complex "c/numeric/complex") is included) Note: as with all type specifiers, any order is permitted: `long double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`, `[complex](http://en.cppreference.com/w/c/numeric/complex/complex) long double`, and even `double [complex](http://en.cppreference.com/w/c/numeric/complex/complex) long` name the same type. ``` #include <complex.h> #include <stdio.h> int main(void) { double complex z = 1 + 2*I; z = 1/z; printf("1/(1.0+2.0i) = %.1f%+.1fi\n", creal(z), cimag(z)); } ``` Output: ``` 1/(1.0+2.0i) = 0.2-0.4i ``` | | | | --- | --- | | If the macro constant `__STDC_NO_COMPLEX__` is defined by the implementation, the complex types (as well as the library header `<complex.h>`) are not provided. | (since C11) | Each complex type has the same [object representation](object "c/language/object") and [alignment requirements](object "c/language/object") as an [array](array "c/language/array") of two elements of the corresponding real type (`float` for `float [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`, `double` for `double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`, `long double` for `long double [complex](http://en.cppreference.com/w/c/numeric/complex/complex)`). The first element of the array holds the real part, and the second element of the array holds the imaginary component. ``` float a[4] = {1, 2, 3, 4}; float complex z1, z2; memcpy(&z1, a, sizeof z1); // z1 becomes 1.0 + 2.0i memcpy(&z2, a+2, sizeof z2); // z2 becomes 3.0 + 4.0i ``` Complex numbers may be used with [arithmetic operators](operator_arithmetic "c/language/operator arithmetic") + - \* and /, possibly mixed with imaginary and real numbers. There are many mathematical functions defined for complex numbers in [`<complex.h>`](../numeric/complex "c/numeric/complex"). Both built-in operators and library functions may raise floating-point exceptions and set `[errno](../error/errno "c/error/errno")` as described in [`math_errhandling`](../numeric/math/math_errhandling "c/numeric/math/math errhandling"). Increment and decrement are not defined for complex types. Relational operators are not defined for complex types (there is no notion of "less than") [Implicit conversions](conversion "c/language/conversion") are defined between complex types and other arithmetic types. In order to support the one-infinity model of complex number arithmetic, C regards any complex value with at least one infinite part as an infinity even if its other part is a NaN, guarantees that all operators and functions honor basic properties of inifinities and provides `[cproj](../numeric/complex/cproj "c/numeric/complex/cproj")` to map all infinities to the canonical one (see [arithmetic operators](operator_arithmetic "c/language/operator arithmetic") for the exact rules). ``` #include <stdio.h> #include <complex.h> #include <math.h> int main(void) { double complex z = (1 + 0*I) * (INFINITY + I*INFINITY); // textbook formula would give // (1+i0)(∞+i∞) ⇒ (1×∞ – 0×∞) + i(0×∞+1×∞) ⇒ NaN + I*NaN // but C gives a complex infinity printf("%f + i*%f\n", creal(z), cimag(z)); // textbook formula would give // cexp(∞+iNaN) ⇒ exp(∞)×(cis(NaN)) ⇒ NaN + I*NaN // but C gives ±∞+i*nan double complex y = cexp(INFINITY + I*NAN); printf("%f + i*%f\n", creal(y), cimag(y)); } ``` Possible output: ``` inf + i*inf inf + i*nan ``` C also treats multiple infinities so as to preserve directional information where possible, despite the inherent limitations of the Cartesian representation: multiplying the imaginary unit by real infinity gives the correctly-signed imaginary infinity: i × ∞ = i∞. Also, i × (∞ – i∞) = ∞ + i∞ indicates the reasonable quadrant. Imaginary floating types Imaginary floating types model the mathematical [imaginary numbers](https://en.wikipedia.org/wiki/Imaginary_number "enwiki:Imaginary number"), that is numbers that can be written as a real number multiplied by the imaginary unit: bi The three imaginary types are.* `float _Imaginary` (also available as `float [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` if [`<complex.h>`](../numeric/complex "c/numeric/complex") is included) * `double _Imaginary` (also available as `double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` if [`<complex.h>`](../numeric/complex "c/numeric/complex") is included) * `long double _Imaginary` (also available as `long double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)` if [`<complex.h>`](../numeric/complex "c/numeric/complex") is included) Note: as with all type specifiers, any order is permitted: `long double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)`, `[imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary) long double`, and even `double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary) long` name the same type. ``` #include <complex.h> #include <stdio.h> int main(void) { double imaginary z = 3*I; z = 1/z; printf("1/(3.0i) = %+.1fi\n", cimag(z)); } ``` Output: ``` 1/(3.0i) = -0.3i ``` | | | | --- | --- | | An implementation that defines `__STDC_IEC_559_COMPLEX__` is recommended, but not required to support imaginary numbers. POSIX recommends checking if the macro `[\_Imaginary\_I](../numeric/complex/imaginary_i "c/numeric/complex/Imaginary I")` is defined to identify imaginary number support. | (until C11) | | Imaginary numbers are supported if `__STDC_IEC_559_COMPLEX__` (until C23)`__STDC_IEC_60559_COMPLEX__` (since C23) is defined. | (since C11) | Each of the three imaginary types has the same [object representation](object "c/language/object") and [alignment requirement](object "c/language/object") as its *corresponding real type* (`float` for `float [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)`, `double` for `double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)`, `long double` for `long double [imaginary](http://en.cppreference.com/w/c/numeric/complex/imaginary)`). Note: despite that, imaginary types are distinct and [not compatible](type#Compatible_types "c/language/type") with their corresponding real types, which prohibits aliasing. Imaginary numbers may be used with [arithmetic operators](operator_arithmetic "c/language/operator arithmetic") + - \* and /, possibly mixed with complex and real numbers. There are many mathematical functions defined for imaginary numbers in [`<complex.h>`](../numeric/complex "c/numeric/complex"). Both built-in operators and library functions may raise floating-point exceptions and set `[errno](../error/errno "c/error/errno")` as described in [`math_errhandling`](../numeric/math/math_errhandling "c/numeric/math/math errhandling"). Increment and decrement are not defined for imaginary types [Implicit conversions](conversion "c/language/conversion") are defined between imaginary types and other arithmetic types. The imaginary numbers make it possible to express all complex numbers using the natural notation `x + I*y` (where `I` is defined as `[\_Imaginary\_I](../numeric/complex/imaginary_i "c/numeric/complex/Imaginary I")`). Without imaginary types, certain special complex values cannot be created naturally. For example, if `I` is defined as `[\_Complex\_I](../numeric/complex/complex_i "c/numeric/complex/Complex I")`, then writing `0.0 + I*INFINITY` gives NaN as the real part, and `[CMPLX](http://en.cppreference.com/w/c/numeric/complex/CMPLX)(0.0, INFINITY)` must be used instead. Same goes for the numbers with the negative zero imaginary component, which are meaningful when working with the library functions with branch cuts, such as `[csqrt](../numeric/complex/csqrt "c/numeric/complex/csqrt")`: `1.0 - 0.0*I` results in the positive zero imaginary component if `I` is defined as `[\_Complex\_I](../numeric/complex/complex_i "c/numeric/complex/Complex I")` and the negative zero imaginary part requires the use of `[CMPLX](../numeric/complex/cmplx "c/numeric/complex/CMPLX")` or `[conj](../numeric/complex/conj "c/numeric/complex/conj")`. Imaginary types also simplify implementations; multiplication of an imaginary by a complex can be implemented straightforwardly with two multiplications if the imaginary types are supported, instead of four multiplications and two additions. | (since C99) | ### Keywords [`char`](../keyword/char "c/keyword/char"), [`int`](../keyword/int "c/keyword/int"), [`short`](../keyword/short "c/keyword/short"), [`long`](../keyword/long "c/keyword/long"), [`signed`](../keyword/signed "c/keyword/signed"), [`unsigned`](../keyword/unsigned "c/keyword/unsigned"), [`float`](../keyword/float "c/keyword/float"), [`double`](../keyword/double "c/keyword/double"). [`_Bool`](../keyword/_bool "c/keyword/ Bool"), [`_Complex`](../keyword/_complex "c/keyword/ Complex"), [`_Imaginary`](../keyword/_imaginary "c/keyword/ Imaginary"), [`_Decimal32`](../keyword/_decimal32 "c/keyword/ Decimal32"), [`_Decimal64`](../keyword/_decimal64 "c/keyword/ Decimal64"), [`_Decimal128`](../keyword/_decimal128 "c/keyword/ Decimal128"). ### Range of values The following table provides a reference for the limits of common numeric representations. Prior to C23, the C Standard allowed any signed integer representation, and the minimum guaranteed range of N-bit signed integers was from \(\scriptsize -(2^{N-1}-1)\)-(2N-1 -1) to \(\scriptsize +2^{N-1}-1\)+2N-1 -1 (e.g. **-127** to **127** for a signed 8-bit type), which corresponds to the limits of [one's complement](https://en.wikipedia.org/wiki/One%27s_complement "enwiki:One's complement") or [sign-and-magnitude](https://en.wikipedia.org/wiki/Signed_number_representations#Sign-and-magnitude_method "enwiki:Signed number representations"). However, all popular data models (including all of ILP32, LP32, LP64, LLP64) and almost all C compilers use [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement "enwiki:Two's complement") representation (the only known exceptions are some compliers for UNISYS), and as of C23, it is the only representation allowed by the standard, with the guaranteed range from \(\scriptsize -2^{N-1}\)-2N-1 to \(\scriptsize +2^{N-1}-1\)+2N-1 -1 (e.g. **-128** to **127** for a signed 8-bit type). | Type | Size in bits | Format | Value range | | --- | --- | --- | --- | | Approximate | Exact | | character | 8 | signed | | **-128** to **127** | | unsigned | | **0** to **255** | | 16 | UTF-16 | | **0** to **65535** | | 32 | UTF-32 | | **0** to **1114111** (**0x10ffff**) | | integer | 16 | signed | **± 3.27 · 104** | **-32768** to **32767** | | unsigned | **0** to **6.55 · 104** | **0** to **65535** | | 32 | signed | **± 2.14 · 109** | **-2,147,483,648** to **2,147,483,647** | | unsigned | **0** to **4.29 · 109** | **0** to **4,294,967,295** | | 64 | signed | **± 9.22 · 1018** | **-9,223,372,036,854,775,808** to **9,223,372,036,854,775,807** | | unsigned | **0** to **1.84 · 1019** | **0** to **18,446,744,073,709,551,615** | | binary floating point | 32 | [IEEE-754](https://en.wikipedia.org/wiki/Single-precision_floating-point_format "enwiki:Single-precision floating-point format") | * min subnormal:**± 1.401,298,4 · 10-45** * min normal:**± 1.175,494,3 · 10-38** * max:**± 3.402,823,4 · 1038** | * min subnormal:**±0x1p-149** * min normal:**±0x1p-126** * max:**±0x1.fffffep+127** | | 64 | [IEEE-754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format "enwiki:Double-precision floating-point format") | * min subnormal:**± 4.940,656,458,412 · 10-324** * min normal:**± 2.225,073,858,507,201,4 · 10-308** * max:**± 1.797,693,134,862,315,7 · 10308** | * min subnormal:**±0x1p-1074** * min normal:**±0x1p-1022** * max:**±0x1.fffffffffffffp+1023** | | 80[[note 1]](#cite_note-1) | [x86](https://en.wikipedia.org/wiki/Extended_precision "enwiki:Extended precision") | * min subnormal:**± 3.645,199,531,882,474,602,528 · 10-4951** * min normal:**± 3.362,103,143,112,093,506,263 · 10-4932** * max:**± 1.189,731,495,357,231,765,021 · 104932** | * min subnormal:**±0x1p-16446** * min normal:**±0x1p-16382** * max:**±0x1.fffffffffffffffep+16383** | | 128 | [IEEE-754](https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format "enwiki:Quadruple-precision floating-point format") | * min subnormal:**± 6.475,175,119,438,025,110,924,438,958,227,646,552,5 · 10-4966** * min normal:**± 3.362,103,143,112,093,506,262,677,817,321,752,602,6 · 10-4932** * max:**± 1.189,731,495,357,231,765,085,759,326,628,007,016,2 · 104932** | * min subnormal:**±0x1p-16494** * min normal:**±0x1p-16382** * max:**±0x1.ffffffffffffffffffffffffffffp+16383** | | decimal floating point | 32 | [IEEE-754](https://en.wikipedia.org/wiki/decimal32_floating-point_format "enwiki:decimal32 floating-point format") | | * min subnormal:**± 1 · 10-101** * min normal:**± 1 · 10-95** * max:**± 9.999'999 · 1096** | | 64 | [IEEE-754](https://en.wikipedia.org/wiki/decimal64_floating-point_format "enwiki:decimal64 floating-point format") | | * min subnormal:**± 1 · 10-398** * min normal:**± 1 · 10-383** * max:**± 9.999'999'999'999'999 · 10384** | | 128 | [IEEE-754](https://en.wikipedia.org/wiki/decimal128_floating-point_format "enwiki:decimal128 floating-point format") | | * min subnormal:**± 1 · 10-6176** * min normal:**± 1 · 10-6143** * max:**± 9.999'999'999'999'999'999'999'999'999'999'999 · 106144** | 1. The object representation usually occupies 96/128 bits on 32/64-bit platforms respectively. Note: actual (as opposed to guaranteed minimal) ranges are available in the library headers [`<limits.h>` and `<float.h>`](../types/limits "c/types/limits"). ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/types "cpp/language/types") for Fundamental types |
programming_docs
c Identifier Identifier ========== An *identifier* is an arbitrarily long sequence of digits, underscores, lowercase and uppercase Latin letters, and Unicode characters specified using `\u` and `\U` [escape](escape "c/language/escape") notation (since C99). A valid identifier must begin with a non-digit character (Latin letter, underscore, or Unicode non-digit character (since C99)). Identifiers are case-sensitive (lowercase and uppercase letters are distinct). | | | | --- | --- | | It is implementation-defined if raw (not escaped) Unicode characters are allowed in identifiers: ``` char *\U0001f431 = "cat"; // supported char *🐱 = "cat"; // implementation-defined // (e.g. works with Clang, but not GCC prior to version 10) ``` | (since C99) | Identifiers can denote the following types of entities: * [objects](object "c/language/object") * [functions](functions "c/language/functions") * tags ([struct](struct "c/language/struct"), [union](union "c/language/union"), or [enumerations](enum "c/language/enum")) * structure or union members * enumeration constants * [typedef](typedef "c/language/typedef") names * [label](statements#Labels "c/language/statements") names * [macro](../preprocessor/replace "c/preprocessor/replace") names * [macro parameter](../preprocessor/replace "c/preprocessor/replace") names Every identifier other than macro names or macro parameter names has [scope](scope "c/language/scope"), belongs to a [name space](name_space "c/language/name space"), and may have [linkage](storage_duration "c/language/storage duration"). The same identifier can denote different entities at different points in the program, or may denote different entities at the same point if the entities are in different name spaces. ### Reserved identifiers The following identifiers are *reserved* and may not be declared in a program (doing so invokes undefined behavior): 1. The identifiers that are [keywords](../keyword "c/keyword") cannot be used for other purposes. In particular #define or #undef of an identifier that is identical to a keyword is not allowed. 2. All external identifiers that begin with an underscore. 3. All identifiers that begin with an underscore followed by a capital letter or by another underscore (these reserved identifiers allow the library to use numerous behind-the-scenes non-external macros and functions). 4. All external identifiers defined by the standard library (in hosted environment). This means that no user-supplied external names are allowed to match any library names, not even if declaring a function that is identical to a library function. 5. Identifiers declared as reserved for the implementation or future use by the standard library (see below). 6. Identifiers declared as potentially reserved and provided by the implementation (see below). (since C23) All other identifiers are available. Identifiers that are not reserved or potentially reserved (since C23) can be used with no fear of unexpected collisions when moving programs from one compiler and library to another. Note: in C++, identifiers with a double underscore anywhere are reserved everywhere; in C, only the ones that begin with a double underscore are reserved. #### Reserved and potentially reserved identifiers in the library The standard library reserves every identifiers it provides. Reserved identifiers that have [external linkage](storage_duration "c/language/storage duration") (e.g. name of every standard function) are reserved regardless which header is included. Other reserved identifiers are reserved when any of its associated headers is included. | | | | --- | --- | | Potentially reserved identifiers are intended to be used by the implementation and future revision of standard. If a potentially reserved identifier is provided by the implementation, it becomes reserved. Implementations are only allowed to provide [external definitions](extern "c/language/extern") of potentially reserved identifiers that are reserved as function names. Potentially reserved identifiers that are not provided by the implementation are not reserved. They can be declared or defined by the user without undefined behavior. However, such usage is not portable. | (since C23) | Following identifiers are reserved or potentially reserved (since C23) for the implementation or future use by the standard library. * *function names*, all of which are potentially reserved (since C23) + `cerf`, `cerfc`, `cexp2`, `cexpm1`, `clog10`, `clog1p`, `clog2`, `clgamma`, `ctgamma`, `csinpi`, `ccospi`, `ctanpi`, `casinpi`, `cacospi`, `catanpi`, `ccompoundn`, `cpown`, `cpowr`, `crootn`, `crsqrt`, `cexp10m1`, `cexp10`, `cexp2m1`, `clog10p1`, `clog2p1`, `clogp1` (since C23) and their -f and -l suffixed variants, in [`<complex.h>`](../numeric/complex "c/numeric/complex") (since C99) + beginning with `is` or `to` followed by a lowercase letter, in [`<ctype.h>`](../string/byte "c/string/byte") and [`<wctype.h>`](../string/wide "c/string/wide") (since C95) + beginning with `str` or `wcs` (since C23) followed by a lowercase letter, in [`<stdlib.h>`](../string/byte "c/string/byte") and [`<inttypes.h>`](../types/integer "c/types/integer") (since C23) + beginning with `cr_`, in [`<math.h>`](../numeric/math "c/numeric/math") (since C23) + beginning with `wcs` followed by a lowercase letter, in [`<wchar.h>`](../string/wide "c/string/wide") (since C95) + beginning with `atomic_` followed by a lowercase letter, in [`<stdatomic.h>`](../thread "c/thread") (since C11) + beginning with `cnd_`, `mtx_`, `thrd_` or `tss_` followed by a lowercase letter, in [`<threads.h>`](../thread "c/thread") (since C11) * *typedef names*, all of which are potentially reserved (since C23) + beginning with `int` or `uint` and ending with `_t`, in [`<stdint.h>`](../types/integer "c/types/integer") (since C99) + beginning with `atomic_` or `memory_` followed by a lowercase letter, in [`<stdatomic.h>`](../thread "c/thread") (since C11) + beginning with `cnd_`, `mtx_`, `thrd_` or `tss_` followed by a lowercase letter, in [`<threads.h>`](../thread "c/thread") (since C11) * *macro names* + beginning with `E` followed by a digit or an uppercase letter, in [`<errno.h>`](../error/errno_macros "c/error/errno macros") + beginning with `FE_` followed by an uppercase letter, in [`<fenv.h>`](../numeric/fenv "c/numeric/fenv") (since C99) + beginning with `DBL_`, `DEC32_`, `DEC64_`, `DEC128_`, `DEC_`, `FLT_`, or `LDBL_` followed by an uppercase letter, in [`<float.h>`](../types/limits "c/types/limits"); these identifiers are potentially reserved (since C23) + beginning with `INT` or `UINT` and ending with `_MAX`, `_MIN`, `_WIDTH` (since C23), or `_C`, in [`<stdint.h>`](../types/integer "c/types/integer"); these identifiers are potentially reserved (since C23) (since C99) + beginning with `PRI` or `SCN` followed by lowercase letter or the letter `X`, in [`<inttypes.h>`](../types/integer "c/types/integer"); these identifiers are potentially reserved (since C23) (since C99) + beginning with `LC_` followed by an uppercase letter, in [`<locale.h>`](../locale/lc_categories "c/locale/LC categories") + beginning with `FP_` followed by an uppercase letter, in [`<math.h>`](../numeric/math "c/numeric/math") (since C23) + beginning with `MATH_` followed by an uppercase letter, in [`<math.h>`](../numeric/math "c/numeric/math"); these identifiers are potentially reserved (since C23) + beginning with `SIG` or `SIG_` followed by an uppercase letter, in [`<signal.h>`](../program "c/program") + beginning with `TIME_` followed by an uppercase letter, in [`<time.h>`](../chrono/timespec_get "c/chrono/timespec get") (since C11) + beginning with `ATOMIC_` followed by an uppercase letter, in [`<stdatomic.h>`](../thread "c/thread"); these identifiers are potentially reserved (since C23) (since C11) * *enumeration constants*, all of which are potentially reserved (since C23) + beginning with `memory_order_` followed by a lowercase letter, in [`<stdatomic.h>`](../thread "c/thread") (since C11) + beginning with `cnd_`, `mtx_`, `thrd_` or `tss_` followed by a lowercase letter, in [`<threads.h>`](../thread "c/thread") (since C11) | | | | --- | --- | | Implementations are recommended to warn when on declaration or definition of potentially reserved identifiers, except when.* the declaration is a non-definition declaration of an identifier with external linkage provided by the implementation, and * the type used in the declaration is [compatible](types#Compatible_types "c/language/types") with that used in the definition. | (since C23) | ### Translation limits Even though there is no specific limit on the length of identifiers, early compilers had limits on the number of significant initial characters in identifiers and the linkers imposed stricter limits on the names with [external linkage](storage_duration "c/language/storage duration"). C requires that at least the following limits are supported by any standard-compliant implementation: | | | | --- | --- | | * 31 significant initial characters in an internal identifier or a macro name * 6 significant initial characters in an external identifier * 511 external identifiers in one translation unit * 127 identifiers with block scope declared in one block * 1024 macro identifiers simultaneously defined in one preprocessing translation unit | (until C99) | | * 63 significant initial characters in an internal identifier or a macro name * 31 significant initial characters in an external identifier * 4095 external identifiers in one translation unit * 511 identifiers with block scope declared in one block * 4095 macro identifiers simultaneously defined in one preprocessing translation unit | (since C99) | ### References * C17 standard (ISO/IEC 9899:2018): + 5.2.4.1 Translation limits (p: 19-20) + 6.4.2 Identifiers (p: 43) + 6.10.8 Predefined macro names (p: 127-129) + 6.11.9 Predefined macro names (p: 130) + 7.31 Future library directions (p: 332-333) + K.3.1.2 Reserved identifiers (p: 425) * C11 standard (ISO/IEC 9899:2011): + 5.2.4.1 Translation limits (p: 25-26) + 6.4.2 Identifiers (p: 59-60) + 6.10.8 Predefined macro names (p: 175-176) + 6.11.9 Predefined macro names (p: 179) + 7.31 Future library directions (p: 455-457) + K.3.1.2 Reserved identifiers (p: 584) * C99 standard (ISO/IEC 9899:1999): + 5.2.4.1 Translation limits (p: 20-21) + 6.4.2 Identifiers (p: 51-52) + 6.10.8 Predefined macro names (p: 160-161) + 6.11.9 Predefined macro names (p: 163) + 7.26 Future library directions (p: 401-402) * C89/C90 standard (ISO/IEC 9899:1990): + 2.2.4.1 Translation limits + 3.1.2 Identifiers + 3.8.8 Predefined macro names ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/identifiers "cpp/language/identifiers") for Identifiers | c Attribute specifier sequence(since C23) Attribute specifier sequence(since C23) ======================================= Introduces implementation-defined attributes for types, objects, expressions, etc. `[[` attr`]]` `[[`attr1, attr2, attr3`(`args`)``]]` `[[`attribute-prefix`::`attr`(`args`)``]]` Formally, the syntax is. | | | | | --- | --- | --- | | `[[` attribute-list `]]` | | (since C23) | where attribute-list is a comma-separated sequence of zero or more attribute-tokens. | | | | | --- | --- | --- | | standard-attribute | (1) | | | attribute-prefix `::` identifier | (2) | | | standard-attribute `(` argument-list `)` | (3) | | | attribute-prefix `::` identifier `(` argument-list `)` | (4) | | 1) standard attribute, such as [[fallthrough]] 2) attribute with a namespace, such as [[gnu::unused]] 3) standard attribute with arguments, such as [[deprecated("reason")]] 4) attribute with both a namespace and an argument list, such as [[gnu::nonnull(1)]] ### Explanation Attributes provide the unified standard syntax for implementation-defined language extensions, such as the GNU and IBM language extensions `__attribute__((...))`, Microsoft extension `__declspec()`, etc. An attribute can be used almost everywhere in the C program, and can be applied to almost everything: to types, to variables, to functions, to names, to code blocks, to entire translation units, although each particular attribute is only valid where it is permitted by the implementation: `[[expect_true]]` could be an attribute that can only be used with an `if`, and not with a class declaration. `[[omp::parallel()]]` could be an attribute that applies to a code block or to a `for` loop, but not to the type `int`, etc. (note these two attributes are fictional examples, see below for the standard and some non-standard attributes). In declarations, attributes may appear both before the whole declaration and directly after the name of the entity that is declared, in which case they are combined. In most other situations, attributes apply to the directly preceding entity. Two consecutive left square bracket tokens (`[[`) may only appear when introducing an attribute-specifier or inside an attribute argument. Besides the standard attributes listed below, implementations may support arbitrary non-standard attributes with implementation-defined behavior. All attributes unknown to an implementation are ignored without causing an error. Every standard-attribute is reserved for standardization. That is, every non-standard attribute is prefixed by a attribute-prefix provided by the implementation, e.g. `[[gnu::may_alias]]` and `[[clang::no_sanitize]]`. ### Standard attributes Only the following attributes are defined by the C standard. Every standard attribute whose name is of form `attr` can be also spelled as `__attr__` and its meaning is not changed. | | | | --- | --- | | `[[[deprecated](attributes/deprecated "c/language/attributes/deprecated")]]`(C23)`[[deprecated("reason")]]`(C23) | indicates that the use of the name or entity declared with this attribute is allowed, but discouraged for some reason | | `[[[fallthrough](attributes/fallthrough "c/language/attributes/fallthrough")]]`(C23) | indicates that the fall through from the previous case label is intentional and should not be diagnosed by a compiler that warns on fall-through | | `[[[nodiscard](attributes/nodiscard "c/language/attributes/nodiscard")]]`(C23)`[[nodiscard("reason")]]`(C23) | encourages the compiler to issue a warning if the return value is discarded | | `[[[maybe\_unused](attributes/maybe_unused "c/language/attributes/maybe unused")]]`(C23) | suppresses compiler warnings on unused entities, if any | | `[[[noreturn](attributes/noreturn "c/language/attributes/noreturn")]]`(C23)`[[[\_Noreturn](attributes/noreturn "c/language/attributes/noreturn")]]`(C23)(deprecated) | indicates that the function does not return | | `[[[unsequenced](https://en.cppreference.com/mwiki/index.php?title=c/language/attributes/unsequenced&action=edit&redlink=1 "c/language/attributes/unsequenced(页面不存在)")]]`(C23) | indicates that a function is stateless, effectless, idempotent and independent | | `[[[reproducible](https://en.cppreference.com/mwiki/index.php?title=c/language/attributes/reproducible&action=edit&redlink=1 "c/language/attributes/reproducible(页面不存在)")]]`(C23) | indicates that a funcition is effectless and idempotent | ### Attribute testing | | | | | --- | --- | --- | | `__has_c_attribute(` attribute-token `)` | | | Checks for the presence of an attribute token named by attribute-token. For standard attributes, it will expand to the year and month in which the attribute was added to the working draft (see table below), the presence of vendor-specific attributes is determined by a non-zero integer constant. `__has_c_attribute` can be expanded in the expression of [`#if`](../preprocessor/conditional "c/preprocessor/conditional") and [`#elif`](../preprocessor/conditional "c/preprocessor/conditional"). It is treated as a defined macro by [`#ifdef`](../preprocessor/conditional "c/preprocessor/conditional"), [`#ifndef`](../preprocessor/conditional "c/preprocessor/conditional") and [`defined`](../preprocessor/conditional "c/preprocessor/conditional") but cannot be used anywhere else. | attribute-token | Attribute | Value | Standard | | --- | --- | --- | --- | | `deprecated` | `[[[deprecated](attributes/deprecated "c/language/attributes/deprecated")]]` | `201904L` | (C23) | | `fallthrough` | `[[[fallthrough](attributes/fallthrough "c/language/attributes/fallthrough")]]` | `201904L` | (C23) | | `maybe_unused` | `[[[maybe\_unused](attributes/maybe_unused "c/language/attributes/maybe unused")]]` | `201904L` | (C23) | | `nodiscard` | `[[[nodiscard](attributes/nodiscard "c/language/attributes/nodiscard")]]` | `202003L` | (C23) | | `noreturn``_Noreturn` | `[[[noreturn](attributes/noreturn "c/language/attributes/noreturn")]]``[[[\_Noreturn](attributes/noreturn "c/language/attributes/noreturn")]]` | `202202L` | (C23) | | `unsequenced` | `[[[unsequenced](https://en.cppreference.com/mwiki/index.php?title=c/language/attributes/unsequenced&action=edit&redlink=1 "c/language/attributes/unsequenced(页面不存在)")]]` | `202207L` | (C23) | | `reproducible` | `[[[reproducible](https://en.cppreference.com/mwiki/index.php?title=c/language/attributes/reproducible&action=edit&redlink=1 "c/language/attributes/reproducible(页面不存在)")]]` | `202207L` | (C23) | ### Example ``` [[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]] int f(void); // declare f with four attributes [[gnu::always_inline, gnu::const, gnu::hot, nodiscard]] int f(void); // same as above, but uses a single attr specifier that contains four attributes int f(void) { return 0; } int main(void) { } ``` ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/attributes "cpp/language/attributes") for Attribute specifier sequence | ### External links * [Attributes in GCC](https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax) * [Attributes in Clang](https://clang.llvm.org/docs/AttributeReference.html). c ASCII Chart ASCII Chart =========== The following chart contains all 128 ASCII decimal **(dec)**, octal **(oct)**, hexadecimal **(hex)** and character **(ch)** codes. | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `dec` | `oct` | `hex` | `ch` | | `dec` | `oct` | `hex` | `ch` | | `dec` | `oct` | `hex` | `ch` | | `dec` | `oct` | `hex` | `ch` | | `0` | `0` | `00` | `NUL` (null) | `32` | `40` | `20` | (space) | `64` | `100` | `40` | `@` | `96` | `140` | `60` | ``` | | `1` | `1` | `01` | `SOH` (start of header) | `33` | `41` | `21` | `!` | `65` | `101` | `41` | `A` | `97` | `141` | `61` | `a` | | `2` | `2` | `02` | `STX` (start of text) | `34` | `42` | `22` | `"` | `66` | `102` | `42` | `B` | `98` | `142` | `62` | `b` | | `3` | `3` | `03` | `ETX` (end of text) | `35` | `43` | `23` | `#` | `67` | `103` | `43` | `C` | `99` | `143` | `63` | `c` | | `4` | `4` | `04` | `EOT` (end of transmission) | `36` | `44` | `24` | `$` | `68` | `104` | `44` | `D` | `100` | `144` | `64` | `d` | | `5` | `5` | `05` | `ENQ` (enquiry) | `37` | `45` | `25` | `%` | `69` | `105` | `45` | `E` | `101` | `145` | `65` | `e` | | `6` | `6` | `06` | `ACK` (acknowledge) | `38` | `46` | `26` | `&` | `70` | `106` | `46` | `F` | `102` | `146` | `66` | `f` | | `7` | `7` | `07` | `BEL` (bell) | `39` | `47` | `27` | `'` | `71` | `107` | `47` | `G` | `103` | `147` | `67` | `g` | | `8` | `10` | `08` | `BS` (backspace) | `40` | `50` | `28` | `(` | `72` | `110` | `48` | `H` | `104` | `150` | `68` | `h` | | `9` | `11` | `09` | `HT` (horizontal tab) | `41` | `51` | `29` | `)` | `73` | `111` | `49` | `I` | `105` | `151` | `69` | `i` | | `10` | `12` | `0a` | `LF` (line feed - new line) | `42` | `52` | `2a` | `*` | `74` | `112` | `4a` | `J` | `106` | `152` | `6a` | `j` | | `11` | `13` | `0b` | `VT` (vertical tab) | `43` | `53` | `2b` | `+` | `75` | `113` | `4b` | `K` | `107` | `153` | `6b` | `k` | | `12` | `14` | `0c` | `FF` (form feed - new page) | `44` | `54` | `2c` | `,` | `76` | `114` | `4c` | `L` | `108` | `154` | `6c` | `l` | | `13` | `15` | `0d` | `CR` (carriage return) | `45` | `55` | `2d` | `-` | `77` | `115` | `4d` | `M` | `109` | `155` | `6d` | `m` | | `14` | `16` | `0e` | `SO` (shift out) | `46` | `56` | `2e` | `.` | `78` | `116` | `4e` | `N` | `110` | `156` | `6e` | `n` | | `15` | `17` | `0f` | `SI` (shift in) | `47` | `57` | `2f` | `/` | `79` | `117` | `4f` | `O` | `111` | `157` | `6f` | `o` | | `16` | `20` | `10` | `DLE` (data link escape) | `48` | `60` | `30` | `0` | `80` | `120` | `50` | `P` | `112` | `160` | `70` | `p` | | `17` | `21` | `11` | `DC1` (device control 1) | `49` | `61` | `31` | `1` | `81` | `121` | `51` | `Q` | `113` | `161` | `71` | `q` | | `18` | `22` | `12` | `DC2` (device control 2) | `50` | `62` | `32` | `2` | `82` | `122` | `52` | `R` | `114` | `162` | `72` | `r` | | `19` | `23` | `13` | `DC3` (device control 3) | `51` | `63` | `33` | `3` | `83` | `123` | `53` | `S` | `115` | `163` | `73` | `s` | | `20` | `24` | `14` | `DC4` (device control 4) | `52` | `64` | `34` | `4` | `84` | `124` | `54` | `T` | `116` | `164` | `74` | `t` | | `21` | `25` | `15` | `NAK` (negative acknowledge) | `53` | `65` | `35` | `5` | `85` | `125` | `55` | `U` | `117` | `165` | `75` | `u` | | `22` | `26` | `16` | `SYN` (synchronous idle) | `54` | `66` | `36` | `6` | `86` | `126` | `56` | `V` | `118` | `166` | `76` | `v` | | `23` | `27` | `17` | `ETB` (end of transmission block) | `55` | `67` | `37` | `7` | `87` | `127` | `57` | `W` | `119` | `167` | `77` | `w` | | `24` | `30` | `18` | `CAN` (cancel) | `56` | `70` | `38` | `8` | `88` | `130` | `58` | `X` | `120` | `170` | `78` | `x` | | `25` | `31` | `19` | `EM` (end of medium) | `57` | `71` | `39` | `9` | `89` | `131` | `59` | `Y` | `121` | `171` | `79` | `y` | | `26` | `32` | `1a` | `SUB` (substitute) | `58` | `72` | `3a` | `:` | `90` | `132` | `5a` | `Z` | `122` | `172` | `7a` | `z` | | `27` | `33` | `1b` | `ESC` (escape) | `59` | `73` | `3b` | `;` | `91` | `133` | `5b` | `[` | `123` | `173` | `7b` | `{` | | `28` | `34` | `1c` | `FS` (file separator) | `60` | `74` | `3c` | `<` | `92` | `134` | `5c` | `\` | `124` | `174` | `7c` | `|` | | `29` | `35` | `1d` | `GS` (group separator) | `61` | `75` | `3d` | `=` | `93` | `135` | `5d` | `]` | `125` | `175` | `7d` | `}` | | `30` | `36` | `1e` | `RS` (record separator) | `62` | `76` | `3e` | `>` | `94` | `136` | `5e` | `^` | `126` | `176` | `7e` | `~` | | `31` | `37` | `1f` | `US` (unit separator) | `63` | `77` | `3f` | `?` | `95` | `137` | `5f` | `_` | `127` | `177` | `7f` | `DEL` (delete) | Note: in Unicode, the ASCII character block is known as [`U+0000..U+007F` Basic Latin](http://www.unicode.org/charts/PDF/U0000.pdf). ### Example ``` #include <stdio.h> int main(void) { puts("Printable ASCII:"); for (int i = 32; i < 127; ++i) { putchar(i); putchar(i % 16 == 15 ? '\n' : ' '); } } ``` Possible output: ``` Printable ASCII: ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ ``` ### See also | | | --- | | [C++ documentation](https://en.cppreference.com/w/cpp/language/ascii "cpp/language/ascii") for ASCII Chart |
programming_docs