mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
a matrix (or array) does not always have the LinearAccessBit!
=> fixes in outerStride and matrix flags
This commit is contained in:
parent
0ed5edd24d
commit
2f3d685e0c
@ -213,9 +213,6 @@ class Array
|
|||||||
void swap(ArrayBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other)
|
void swap(ArrayBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other)
|
||||||
{ this->_swap(other.derived()); }
|
{ this->_swap(other.derived()); }
|
||||||
|
|
||||||
inline int innerStride() const { return 1; }
|
|
||||||
inline int outerStride() const { return this->innerSize(); }
|
|
||||||
|
|
||||||
#ifdef EIGEN_ARRAY_PLUGIN
|
#ifdef EIGEN_ARRAY_PLUGIN
|
||||||
#include EIGEN_ARRAY_PLUGIN
|
#include EIGEN_ARRAY_PLUGIN
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,6 +139,13 @@ class DenseStorageBase : public _Base<Derived>
|
|||||||
EIGEN_STRONG_INLINE Scalar *data()
|
EIGEN_STRONG_INLINE Scalar *data()
|
||||||
{ return m_storage.data(); }
|
{ return m_storage.data(); }
|
||||||
|
|
||||||
|
inline int innerStride() const { return 1; }
|
||||||
|
inline int outerStride() const
|
||||||
|
{
|
||||||
|
static const int MaxInnerSize = Base::IsRowMajor ? MaxColsAtCompileTime : MaxRowsAtCompileTime;
|
||||||
|
return (!IsVectorAtCompileTime) && MaxInnerSize!=Dynamic ? MaxInnerSize : this->innerSize();
|
||||||
|
}
|
||||||
|
|
||||||
/** Resizes \c *this to a \a rows x \a cols matrix.
|
/** Resizes \c *this to a \a rows x \a cols matrix.
|
||||||
*
|
*
|
||||||
* This method is intended for dynamic-size matrices, although it is legal to call it on any
|
* This method is intended for dynamic-size matrices, although it is legal to call it on any
|
||||||
@ -601,7 +608,7 @@ struct ei_conservative_resize_like_impl<Derived,OtherDerived,true>
|
|||||||
const int new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows();
|
const int new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows();
|
||||||
const int new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1;
|
const int new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1;
|
||||||
_this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols);
|
_this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols);
|
||||||
|
|
||||||
if (num_new_elements > 0)
|
if (num_new_elements > 0)
|
||||||
_this.tail(num_new_elements) = other.tail(num_new_elements);
|
_this.tail(num_new_elements) = other.tail(num_new_elements);
|
||||||
}
|
}
|
||||||
|
@ -318,9 +318,6 @@ class Matrix
|
|||||||
void swap(MatrixBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other)
|
void swap(MatrixBase<OtherDerived> EIGEN_REF_TO_TEMPORARY other)
|
||||||
{ this->_swap(other.derived()); }
|
{ this->_swap(other.derived()); }
|
||||||
|
|
||||||
inline int innerStride() const { return 1; }
|
|
||||||
inline int outerStride() const { return this->innerSize(); }
|
|
||||||
|
|
||||||
/////////// Geometry module ///////////
|
/////////// Geometry module ///////////
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
|
@ -90,14 +90,19 @@ class ei_compute_matrix_flags
|
|||||||
inner_max_size = MaxCols==1 ? MaxRows
|
inner_max_size = MaxCols==1 ? MaxRows
|
||||||
: MaxRows==1 ? MaxCols
|
: MaxRows==1 ? MaxCols
|
||||||
: row_major_bit ? MaxCols : MaxRows,
|
: row_major_bit ? MaxCols : MaxRows,
|
||||||
|
inner_size = Cols==1 ? Rows
|
||||||
|
: Rows==1 ? Cols
|
||||||
|
: row_major_bit ? Cols : Rows,
|
||||||
is_big = inner_max_size == Dynamic,
|
is_big = inner_max_size == Dynamic,
|
||||||
|
is_matrix = Cols!=1 && Rows!=1,
|
||||||
is_packet_size_multiple = MaxRows==Dynamic || MaxCols==Dynamic || ((MaxCols*MaxRows) % ei_packet_traits<Scalar>::size) == 0,
|
is_packet_size_multiple = MaxRows==Dynamic || MaxCols==Dynamic || ((MaxCols*MaxRows) % ei_packet_traits<Scalar>::size) == 0,
|
||||||
aligned_bit = (((Options&DontAlign)==0) && (is_big || is_packet_size_multiple)) ? AlignedBit : 0,
|
aligned_bit = (((Options&DontAlign)==0) && (is_big || is_packet_size_multiple)) ? AlignedBit : 0,
|
||||||
packet_access_bit = ei_packet_traits<Scalar>::size > 1 && aligned_bit ? PacketAccessBit : 0
|
packet_access_bit = ei_packet_traits<Scalar>::size > 1 && aligned_bit ? PacketAccessBit : 0,
|
||||||
|
linear_access_bit = (inner_max_size!=Dynamic && inner_size!=inner_max_size && is_matrix) ? 0 : LinearAccessBit
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { ret = LinearAccessBit | DirectAccessBit | NestByRefBit | packet_access_bit | row_major_bit | aligned_bit };
|
enum { ret = DirectAccessBit | NestByRefBit | packet_access_bit | row_major_bit | aligned_bit | linear_access_bit };
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int _Rows, int _Cols> struct ei_size_at_compile_time
|
template<int _Rows, int _Cols> struct ei_size_at_compile_time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user