diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-01-08 15:20:21 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-01-08 15:20:21 +0000 |
commit | 1d52bd4cad64d8d8662f40c11210b705351b43ab (patch) | |
tree | c8fe83368e8e13ba7e8ec0c4ef078f5293cfea4d /doc/InsideEigenExample.dox | |
parent | e2d2a7d2226b85569a9360b9738c15498fb454ac (diff) |
the big memory changes. the most important changes are:
ei_aligned_malloc now really behaves like a malloc
(untyped, doesn't call ctor)
ei_aligned_new is the typed variant calling ctor
EIGEN_MAKE_ALIGNED_OPERATOR_NEW now takes the class name as parameter
Diffstat (limited to 'doc/InsideEigenExample.dox')
-rw-r--r-- | doc/InsideEigenExample.dox | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/InsideEigenExample.dox b/doc/InsideEigenExample.dox index 22635120b..3242acf4a 100644 --- a/doc/InsideEigenExample.dox +++ b/doc/InsideEigenExample.dox @@ -101,10 +101,10 @@ with size=50, rows=50, columns=1. Here is this constructor: \code -inline ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_malloc<T>(size)), m_rows(rows) {} +inline ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_new<T>(size)), m_rows(rows) {} \endcode -Here, the \a 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 ei_aligned_malloc defined in src/Core/util/Memory.h. 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[]. +Here, the \a 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 ei_aligned_new defined in src/Core/util/Memory.h. 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 \a m_rows member to \a size. Notice that there is no \a m_columns member: indeed, in this partial specialization of ei_matrix_storage, 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. |