From 1d52bd4cad64d8d8662f40c11210b705351b43ab Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 8 Jan 2009 15:20:21 +0000 Subject: 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 --- doc/InsideEigenExample.dox | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/InsideEigenExample.dox') 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(size)), m_rows(rows) {} +inline ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_new(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. -- cgit v1.2.3