mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-16 14:49:39 +08:00
Improve counting of sparse temporaries
This commit is contained in:
parent
1879917d35
commit
6100d1ae64
@ -665,8 +665,15 @@ class SparseMatrix
|
||||
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
|
||||
check_template_parameters();
|
||||
const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator<OtherDerived>::Flags & RowMajorBit);
|
||||
if (needToTranspose) *this = other.derived();
|
||||
else internal::call_assignment_no_alias(*this, other.derived());
|
||||
if (needToTranspose)
|
||||
*this = other.derived();
|
||||
else
|
||||
{
|
||||
#ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
|
||||
EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
|
||||
#endif
|
||||
internal::call_assignment_no_alias(*this, other.derived());
|
||||
}
|
||||
}
|
||||
|
||||
/** Constructs a sparse matrix from the sparse selfadjoint view \a other */
|
||||
|
@ -64,6 +64,7 @@ void call_ref()
|
||||
const SparseMatrix<float>& Ac(A);
|
||||
Block<SparseMatrix<float> > Ab(A,0,1, 3,3);
|
||||
const Block<SparseMatrix<float> > Abc(A,0,1,3,3);
|
||||
SparseMatrix<float> AA = A*A;
|
||||
|
||||
|
||||
VERIFY_EVALUATION_COUNT( call_ref_1(A, A), 0);
|
||||
@ -80,8 +81,8 @@ void call_ref()
|
||||
VERIFY_EVALUATION_COUNT( call_ref_3(B, B), 1);
|
||||
VERIFY_EVALUATION_COUNT( call_ref_2(B.transpose(), B.transpose()), 0);
|
||||
VERIFY_EVALUATION_COUNT( call_ref_3(B.transpose(), B.transpose()), 0);
|
||||
VERIFY_EVALUATION_COUNT( call_ref_2(A*A, A*A), 1);
|
||||
VERIFY_EVALUATION_COUNT( call_ref_3(A*A, A*A), 1);
|
||||
VERIFY_EVALUATION_COUNT( call_ref_2(A*A, AA), 1);
|
||||
VERIFY_EVALUATION_COUNT( call_ref_3(A*A, AA), 1);
|
||||
|
||||
VERIFY(!C.isCompressed());
|
||||
VERIFY_EVALUATION_COUNT( call_ref_3(C, C), 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user