* remove set(), revert to old behavior where = resizes

* try to be clever in matrix ctors and operator=: be lazy when we can, always allow
  to copy rowvector into columnvector, check the template parameters,
  try to factor the code better
* add missing copy ctor in UnalignedType
* fix bug in the traits of DiagonalProduct
* renaming: EIGEN_TUNE_FOR_CPU_CACHE_SIZE
* update the dox a little
This commit is contained in:
Benoit Jacob
2009-01-21 17:10:23 +00:00
parent a5fbf27843
commit 5f43a42ee7
17 changed files with 170 additions and 114 deletions

View File

@@ -32,13 +32,24 @@ template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int
class ei_unaligned_type<Matrix<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols> >
: public Matrix<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols>
{
private:
template<typename Other> void _unaligned_copy(const Other& other)
{
if(other.size() == 0) return;
resize(other.rows(), other.cols());
ei_assign_impl<ei_unaligned_type,aligned_base,NoVectorization>::run(*this, other);
}
public:
typedef Matrix<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols> aligned_base;
ei_unaligned_type() : aligned_base(ei_constructor_without_unaligned_array_assert()) {}
ei_unaligned_type(const aligned_base& other) : aligned_base(ei_constructor_without_unaligned_array_assert())
{
resize(other.rows(), other.cols());
ei_assign_impl<ei_unaligned_type,aligned_base,NoVectorization>::run(*this, other);
_unaligned_copy(other);
}
ei_unaligned_type(const ei_unaligned_type& other) : aligned_base(ei_constructor_without_unaligned_array_assert())
{
_unaligned_copy(other);
}
};
@@ -46,14 +57,23 @@ template<typename _Scalar, int _Dim>
class ei_unaligned_type<Transform<_Scalar,_Dim> >
: public Transform<_Scalar,_Dim>
{
private:
template<typename Other> void _unaligned_copy(const Other& other)
{
// no resizing here, it's fixed-size anyway
ei_assign_impl<MatrixType,MatrixType,NoVectorization>::run(this->matrix(), other.matrix());
}
public:
typedef Transform<_Scalar,_Dim> aligned_base;
typedef typename aligned_base::MatrixType MatrixType;
ei_unaligned_type() : aligned_base(ei_constructor_without_unaligned_array_assert()) {}
ei_unaligned_type(const aligned_base& other) : aligned_base(ei_constructor_without_unaligned_array_assert())
{
// no resizing here, it's fixed-size anyway
ei_assign_impl<MatrixType,MatrixType,NoVectorization>::run(this->matrix(), other.matrix());
_unaligned_copy(other);
}
ei_unaligned_type(const ei_unaligned_type& other) : aligned_base(ei_constructor_without_unaligned_array_assert())
{
_unaligned_copy(other);
}
};
@@ -61,14 +81,23 @@ template<typename _Scalar>
class ei_unaligned_type<Quaternion<_Scalar> >
: public Quaternion<_Scalar>
{
private:
template<typename Other> void _unaligned_copy(const Other& other)
{
// no resizing here, it's fixed-size anyway
ei_assign_impl<Coefficients,Coefficients,NoVectorization>::run(this->coeffs(), other.coeffs());
}
public:
typedef Quaternion<_Scalar> aligned_base;
typedef typename aligned_base::Coefficients Coefficients;
ei_unaligned_type() : aligned_base(ei_constructor_without_unaligned_array_assert()) {}
ei_unaligned_type(const aligned_base& other) : aligned_base(ei_constructor_without_unaligned_array_assert())
{
// no resizing here, it's fixed-size anyway
ei_assign_impl<Coefficients,Coefficients,NoVectorization>::run(this->coeffs(), other.coeffs());
_unaligned_copy(other);
}
ei_unaligned_type(const ei_unaligned_type& other) : aligned_base(ei_constructor_without_unaligned_array_assert())
{
_unaligned_copy(other);
}
};