mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
Fix bug #654: allow implicit transposition in Array to Matrix and Matrix to Array constructors
(grafted from 07417bd03f
)
This commit is contained in:
parent
811ec5bfcb
commit
a443b3d98d
@ -210,7 +210,7 @@ class Array
|
||||
: Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
|
||||
{
|
||||
Base::_check_template_params();
|
||||
Base::resize(other.rows(), other.cols());
|
||||
Base::_resize_to_match(other);
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ class Matrix
|
||||
: Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
|
||||
{
|
||||
Base::_check_template_params();
|
||||
Base::resize(other.rows(), other.cols());
|
||||
Base::_resize_to_match(other);
|
||||
// FIXME/CHECK: isn't *this = other.derived() more efficient. it allows to
|
||||
// go for pure _set() implementations, right?
|
||||
*this = other;
|
||||
|
@ -202,6 +202,12 @@ template<typename MatrixTraits> void resize(const MatrixTraits& t)
|
||||
VERIFY(a1.size()==cols);
|
||||
}
|
||||
|
||||
void regression_bug_654()
|
||||
{
|
||||
ArrayXf a = RowVectorXf(3);
|
||||
VectorXf v = Array<float,1,Dynamic>(3);
|
||||
}
|
||||
|
||||
void test_array_for_matrix()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
@ -239,4 +245,5 @@ void test_array_for_matrix()
|
||||
CALL_SUBTEST_5( resize(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
|
||||
CALL_SUBTEST_6( resize(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
|
||||
}
|
||||
CALL_SUBTEST_6( regression_bug_654() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user