aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Product.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/Product.h')
-rw-r--r--Eigen/src/Core/Product.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index d57c9d241..9bdbe3f26 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -548,7 +548,7 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,HasDirect
_res = &res.coeffRef(0);
else
{
- _res = (Scalar*)alloca(sizeof(Scalar)*res.size());
+ _res = (Scalar*)ei_alloca_or_malloc(true, sizeof(Scalar)*res.size());
Map<Matrix<Scalar,DestDerived::RowsAtCompileTime,1> >(_res, res.size()) = res;
}
ei_cache_friendly_product_colmajor_times_vector(res.size(),
@@ -557,6 +557,8 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,ColMajor,HasDirect
if (!EvalToRes)
res = Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1> >(_res, res.size());
+
+ if(!EIGEN_USE_ALLOCA) free(_res);
}
};
@@ -591,7 +593,7 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
_res = &res.coeffRef(0);
else
{
- _res = (Scalar*)alloca(sizeof(Scalar)*res.size());
+ _res = (Scalar*)ei_alloca_or_malloc(true, sizeof(Scalar)*res.size());
Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1> >(_res, res.size()) = res;
}
ei_cache_friendly_product_colmajor_times_vector(res.size(),
@@ -600,6 +602,8 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
if (!EvalToRes)
res = Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1> >(_res, res.size());
+
+ if(!EIGEN_USE_ALLOCA) free(_res);
}
};
@@ -621,11 +625,13 @@ struct ei_cache_friendly_product_selector<ProductType,LhsRows,RowMajor,HasDirect
_rhs = &product.rhs().const_cast_derived().coeffRef(0);
else
{
- _rhs = (Scalar*)alloca(sizeof(Scalar)*product.rhs().size());
+ _rhs = (Scalar*)ei_alloca_or_malloc(true, sizeof(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);
}
};
@@ -647,11 +653,13 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
_lhs = &product.lhs().const_cast_derived().coeffRef(0);
else
{
- _lhs = (Scalar*)alloca(sizeof(Scalar)*product.lhs().size());
+ _lhs = (Scalar*)ei_alloca_or_malloc(true, sizeof(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);
}
};