// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// discard stack allocation as that too bypasses malloc #define EIGEN_STACK_ALLOCATION_LIMIT 0 // heap allocation will raise an assert if enabled at runtime #define EIGEN_RUNTIME_NO_MALLOC
template<typename MatrixType> void nomalloc(const MatrixType& m)
{ /* this test check no dynamic memory allocation are issued with fixed-size matrices
*/ typedeftypename MatrixType::Scalar Scalar;
// LU module
Eigen::PartialPivLU<Matrix> ppLU; ppLU.compute(A);
X = ppLU.solve(B);
x = ppLU.solve(b);
Eigen::FullPivLU<Matrix> fpLU; fpLU.compute(A);
X = fpLU.solve(B);
x = fpLU.solve(b);
// QR module
Eigen::HouseholderQR<Matrix> hQR; hQR.compute(A);
X = hQR.solve(B);
x = hQR.solve(b);
Eigen::ColPivHouseholderQR<Matrix> cpQR; cpQR.compute(A);
X = cpQR.solve(B);
x = cpQR.solve(b);
Eigen::FullPivHouseholderQR<Matrix> fpQR; fpQR.compute(A); // FIXME X = fpQR.solve(B);
x = fpQR.solve(b);
// Copy constructors shall also never malloc
Ref r8 = r1;
RefT r9 = r3;
// Initializing from a compatible Ref shall also never malloc
Eigen::Ref<const MatrixX, Unaligned, Stride<Dynamic, Dynamic> > r10=r8, r11=m;
// Initializing from an incompatible Ref will malloc: typedef Eigen::Ref<const MatrixX, Aligned> RefAligned;
VERIFY_RAISES_ASSERT(RefAligned r12=r10);
VERIFY_RAISES_ASSERT(Ref r13=r10); // r10 has more dynamic strides
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.