diff options
author | 2008-08-20 15:58:01 +0000 | |
---|---|---|
committer | 2008-08-20 15:58:01 +0000 | |
commit | c501c7a4efb78a458c66c1333d52dde429c6e81e (patch) | |
tree | f7faa0de74b11551ea16cb8c508b64074fe0b71e /Eigen/src/Core/Product.h | |
parent | 752ec27293827b5aebf15af54d808656c38f13bf (diff) |
* Fix CMakeLists.txt issue with SVD
* Fix on stack memory allocation issues
Diffstat (limited to 'Eigen/src/Core/Product.h')
-rw-r--r-- | Eigen/src/Core/Product.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 6d965e611..8c15a3852 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -550,7 +550,7 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,HasDirect _res = &res.coeffRef(0); else { - _res = (Scalar*)ei_alloca_or_malloc(true, sizeof(Scalar)*res.size()); + _res = ei_alloc_stack(Scalar,res.size()); Map<Matrix<Scalar,DestDerived::RowsAtCompileTime,1> >(_res, res.size()) = res; } ei_cache_friendly_product_colmajor_times_vector(res.size(), @@ -558,9 +558,10 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,HasDirect product.rhs(), _res); if (!EvalToRes) + { res = Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1> >(_res, res.size()); - - if(!EIGEN_USE_ALLOCA) free(_res); + ei_free_stack(_res, Scalar, res.size()); + } } }; @@ -595,7 +596,7 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo _res = &res.coeffRef(0); else { - _res = (Scalar*)ei_alloca_or_malloc(true, sizeof(Scalar)*res.size()); + _res = ei_alloc_stack(Scalar, res.size()); Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1> >(_res, res.size()) = res; } ei_cache_friendly_product_colmajor_times_vector(res.size(), @@ -603,9 +604,10 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo product.lhs().transpose(), _res); if (!EvalToRes) + { res = Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1> >(_res, res.size()); - - if(!EIGEN_USE_ALLOCA) free(_res); + ei_free_stack(_res, Scalar, res.size()); + } } }; @@ -627,13 +629,13 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,RowMajor,HasDirect _rhs = &product.rhs().const_cast_derived().coeffRef(0); else { - _rhs = (Scalar*)ei_alloca_or_malloc(true, sizeof(Scalar)*product.rhs().size()); + _rhs = ei_alloc_stack(Scalar, product.rhs().size()); Map<Matrix<Scalar,Rhs::SizeAtCompileTime,1> >(_rhs, product.rhs().size()) = product.rhs(); } ei_cache_friendly_product_rowmajor_times_vector(&product.lhs().const_cast_derived().coeffRef(0,0), product.lhs().stride(), _rhs, product.rhs().size(), res); - if(!EIGEN_USE_ALLOCA) free(_rhs); + if (!UseRhsDirectly) ei_free_stack(_rhs, Scalar, product.rhs().size()); } }; @@ -655,13 +657,13 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo _lhs = &product.lhs().const_cast_derived().coeffRef(0); else { - _lhs = (Scalar*)ei_alloca_or_malloc(true, sizeof(Scalar)*product.lhs().size()); + _lhs = ei_alloc_stack(Scalar, product.lhs().size()); Map<Matrix<Scalar,Lhs::SizeAtCompileTime,1> >(_lhs, product.lhs().size()) = product.lhs(); } ei_cache_friendly_product_rowmajor_times_vector(&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(), _lhs, product.lhs().size(), res); - if(!EIGEN_USE_ALLOCA) free(_lhs); + if(!UseLhsDirectly) ei_free_stack(_lhs, Scalar, product.lhs().size()); } }; |