mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 17:33:15 +08:00
bug fix in gemv:
solution always use a temporary in dst.innerStride != 1 even though this is not needed when packet_size == 1....
This commit is contained in:
parent
7e836ccb4c
commit
b22fc6cdc3
@ -330,9 +330,10 @@ template<> struct ei_gemv_selector<OnTheRight,ColMajor,true>
|
|||||||
* RhsBlasTraits::extractScalarFactor(prod.rhs());
|
* RhsBlasTraits::extractScalarFactor(prod.rhs());
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
EvalToDest = (ei_packet_traits<Scalar>::size==1)
|
// FIXME find a way to allow an inner stride on the result if ei_packet_traits<Scalar>::size==1
|
||||||
||((Dest::Flags&ActualPacketAccessBit) && (!(Dest::Flags & RowMajorBit)))
|
EvalToDest = (Dest::Flags&ActualPacketAccessBit) && (Dest::InnerStrideAtCompileTime==1)
|
||||||
};
|
};
|
||||||
|
|
||||||
Scalar* EIGEN_RESTRICT actualDest;
|
Scalar* EIGEN_RESTRICT actualDest;
|
||||||
if (EvalToDest)
|
if (EvalToDest)
|
||||||
actualDest = &dest.coeffRef(0);
|
actualDest = &dest.coeffRef(0);
|
||||||
|
@ -45,7 +45,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
|||||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> RowSquareMatrixType;
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> RowSquareMatrixType;
|
||||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> ColSquareMatrixType;
|
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> ColSquareMatrixType;
|
||||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
|
||||||
MatrixType::Flags&RowMajorBit> OtherMajorMatrixType;
|
MatrixType::Flags&RowMajorBit?ColMajor:RowMajor> OtherMajorMatrixType;
|
||||||
|
|
||||||
Index rows = m.rows();
|
Index rows = m.rows();
|
||||||
Index cols = m.cols();
|
Index cols = m.cols();
|
||||||
@ -152,6 +152,9 @@ template<typename MatrixType> void product(const MatrixType& m)
|
|||||||
VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1));
|
VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VERIFY_IS_APPROX(res.col(r).noalias() = square.adjoint() * square.col(r), (square.adjoint() * square.col(r)).eval());
|
||||||
|
VERIFY_IS_APPROX(res.col(r).noalias() = square * square.col(r), (square * square.col(r)).eval());
|
||||||
|
|
||||||
// inner product
|
// inner product
|
||||||
Scalar x = square2.row(c) * square2.col(c2);
|
Scalar x = square2.row(c) * square2.col(c2);
|
||||||
VERIFY_IS_APPROX(x, square2.row(c).transpose().cwiseProduct(square2.col(c2)).sum());
|
VERIFY_IS_APPROX(x, square2.row(c).transpose().cwiseProduct(square2.col(c2)).sum());
|
||||||
|
@ -30,7 +30,7 @@ void test_product_large()
|
|||||||
CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||||
CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||||
CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||||
CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
|
CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,150), ei_random<int>(1,150))) );
|
||||||
CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user