mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Put code in monospace (typewriter) style.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
02a0e79c70
commit
c86ac71b4f
@@ -151,14 +151,14 @@ The numbering starts at 0. This example is self-explanatory:
|
||||
\verbinclude tut_matrix_coefficient_accessors.out
|
||||
</td></tr></table>
|
||||
|
||||
Note that the syntax <tt> m(index) </tt>
|
||||
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 matrices default to
|
||||
column-major storage order, but this can be changed to row-major, see \ref TopicStorageOrders "Storage orders".
|
||||
|
||||
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] !
|
||||
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]`!
|
||||
|
||||
\section TutorialMatrixCommaInitializer Comma-initialization
|
||||
|
||||
@@ -186,8 +186,8 @@ The current size of a matrix can be retrieved by \link EigenBase::rows() rows()\
|
||||
<td>\verbinclude tut_matrix_resize.out </td>
|
||||
</tr></table>
|
||||
|
||||
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 \link PlainObjectBase::conservativeResize() conservativeResize()\endlink, see \ref TopicResizing "this page" for more details.
|
||||
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 \link PlainObjectBase::conservativeResize() conservativeResize()\endlink, see \ref TopicResizing "this page" 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;
|
||||
@@ -234,7 +234,7 @@ is always allocated on the heap, so doing
|
||||
\code MatrixXf mymatrix(rows,columns); \endcode
|
||||
amounts to doing
|
||||
\code float *mymatrix = new float[rows*columns]; \endcode
|
||||
and in addition to that, the MatrixXf object stores its number of rows and columns as
|
||||
and in addition to that, the \c 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
|
||||
@@ -276,14 +276,14 @@ Matrix<typename Scalar,
|
||||
\section TutorialMatrixTypedefs Convenience typedefs
|
||||
|
||||
Eigen defines the following Matrix typedefs:
|
||||
\li MatrixNt for Matrix<type, N, N>. For example, MatrixXi for Matrix<int, Dynamic, Dynamic>.
|
||||
\li VectorNt for Matrix<type, N, 1>. For example, Vector2f for Matrix<float, 2, 1>.
|
||||
\li RowVectorNt for Matrix<type, 1, N>. For example, RowVector3d for Matrix<double, 1, 3>.
|
||||
\li \c MatrixNt for `Matrix<type, N, N>`. For example, \c MatrixXi for `Matrix<int, Dynamic, Dynamic>`.
|
||||
\li \c VectorNt for `Matrix<type, N, 1>`. For example, \c Vector2f for `Matrix<float, 2, 1>`.
|
||||
\li \c RowVectorNt for `Matrix<type, 1, N>`. For example, \c RowVector3d for `Matrix<double, 1, 3>`.
|
||||
|
||||
Where:
|
||||
\li N can be any one of \c 2, \c 3, \c 4, or \c X (meaning \c Dynamic).
|
||||
\li t can be any one of \c i (meaning int), \c f (meaning float), \c d (meaning double),
|
||||
\c cf (meaning complex<float>), or \c cd (meaning complex<double>). The fact that typedefs are only
|
||||
\li \c N can be any one of \c 2, \c 3, \c 4, or \c X (meaning \c Dynamic).
|
||||
\li \c t can be any one of \c i (meaning \c int), \c f (meaning \c float), \c d (meaning \c double),
|
||||
\c cf (meaning `complex<float>`), or \c cd (meaning `complex<double>`). The fact that `typedef`s 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 \ref TopicScalarTypes "Scalar types".
|
||||
|
||||
|
||||
Reference in New Issue
Block a user