mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Fixes #104.
This commit is contained in:
parent
d2d7465bcf
commit
e40852d282
@ -92,7 +92,7 @@ class PartialReduxExpr : ei_no_assignment_operator,
|
|||||||
Index rows() const { return (Direction==Vertical ? 1 : m_matrix.rows()); }
|
Index rows() const { return (Direction==Vertical ? 1 : m_matrix.rows()); }
|
||||||
Index cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); }
|
Index cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); }
|
||||||
|
|
||||||
const Scalar coeff(Index i, Index j) const
|
EIGEN_STRONG_INLINE const Scalar coeff(Index i, Index j) const
|
||||||
{
|
{
|
||||||
if (Direction==Vertical)
|
if (Direction==Vertical)
|
||||||
return m_functor(m_matrix.col(j));
|
return m_functor(m_matrix.col(j));
|
||||||
@ -121,7 +121,7 @@ class PartialReduxExpr : ei_no_assignment_operator,
|
|||||||
template<typename Scalar, int Size> struct Cost \
|
template<typename Scalar, int Size> struct Cost \
|
||||||
{ enum { value = COST }; }; \
|
{ enum { value = COST }; }; \
|
||||||
template<typename XprType> \
|
template<typename XprType> \
|
||||||
inline ResultType operator()(const XprType& mat) const \
|
EIGEN_STRONG_INLINE ResultType operator()(const XprType& mat) const \
|
||||||
{ return mat.MEMBER(); } \
|
{ return mat.MEMBER(); } \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool HasDirectAccess> c
|
|||||||
.coeffRef(row + m_startRow.value(), col + m_startCol.value());
|
.coeffRef(row + m_startRow.value(), col + m_startCol.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const CoeffReturnType coeff(Index row, Index col) const
|
EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const
|
||||||
{
|
{
|
||||||
return m_xpr.coeff(row + m_startRow.value(), col + m_startCol.value());
|
return m_xpr.coeff(row + m_startRow.value(), col + m_startCol.value());
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
|
|||||||
*
|
*
|
||||||
* \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)
|
* \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)
|
||||||
*/
|
*/
|
||||||
inline void resize(Index rows, Index cols)
|
EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO
|
#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO
|
||||||
Index size = rows*cols;
|
Index size = rows*cols;
|
||||||
@ -471,7 +471,9 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
|
|||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase<OtherDerived>& other)
|
EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
_resize_to_match(other);
|
// I don't think we need this resize call since the lazyAssign will anyways resize
|
||||||
|
// and lazyAssign will be called by the assign selector.
|
||||||
|
//_resize_to_match(other);
|
||||||
// the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
|
// the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
|
||||||
// it wouldn't allow to copy a row-vector into a column-vector.
|
// it wouldn't allow to copy a row-vector into a column-vector.
|
||||||
return ei_assign_selector<Derived,OtherDerived,false>::run(this->derived(), other.derived());
|
return ei_assign_selector<Derived,OtherDerived,false>::run(this->derived(), other.derived());
|
||||||
|
@ -85,7 +85,7 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
|
|||||||
* \sa dot(), norm()
|
* \sa dot(), norm()
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
|
EIGEN_STRONG_INLINE typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const
|
||||||
{
|
{
|
||||||
return ei_real((*this).cwiseAbs2().sum());
|
return ei_real((*this).cwiseAbs2().sum());
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ template<typename T, int _Rows, int _Options> class ei_matrix_storage<T, Dynamic
|
|||||||
m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
|
m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
|
||||||
m_cols = cols;
|
m_cols = cols;
|
||||||
}
|
}
|
||||||
void resize(DenseIndex size, DenseIndex, DenseIndex cols)
|
EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex cols)
|
||||||
{
|
{
|
||||||
if(size != _Rows*m_cols)
|
if(size != _Rows*m_cols)
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ template<typename T, int _Cols, int _Options> class ei_matrix_storage<T, Dynamic
|
|||||||
m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
|
m_data = ei_conditional_aligned_realloc_new<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
|
||||||
m_rows = rows;
|
m_rows = rows;
|
||||||
}
|
}
|
||||||
void resize(DenseIndex size, DenseIndex rows, DenseIndex)
|
EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex rows, DenseIndex)
|
||||||
{
|
{
|
||||||
if(size != m_rows*_Cols)
|
if(size != m_rows*_Cols)
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@ struct ei_redux_impl<Func, Derived, DefaultTraversal, NoUnrolling>
|
|||||||
{
|
{
|
||||||
typedef typename Derived::Scalar Scalar;
|
typedef typename Derived::Scalar Scalar;
|
||||||
typedef typename Derived::Index Index;
|
typedef typename Derived::Index Index;
|
||||||
static Scalar run(const Derived& mat, const Func& func)
|
static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func)
|
||||||
{
|
{
|
||||||
ei_assert(mat.rows()>0 && mat.cols()>0 && "you are using a non initialized matrix");
|
ei_assert(mat.rows()>0 && mat.cols()>0 && "you are using a non initialized matrix");
|
||||||
Scalar res;
|
Scalar res;
|
||||||
@ -307,7 +307,7 @@ struct ei_redux_impl<Func, Derived, LinearVectorizedTraversal, CompleteUnrolling
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename Func>
|
template<typename Func>
|
||||||
inline typename ei_result_of<Func(typename ei_traits<Derived>::Scalar)>::type
|
EIGEN_STRONG_INLINE typename ei_result_of<Func(typename ei_traits<Derived>::Scalar)>::type
|
||||||
DenseBase<Derived>::redux(const Func& func) const
|
DenseBase<Derived>::redux(const Func& func) const
|
||||||
{
|
{
|
||||||
typedef typename ei_cleantype<typename Derived::Nested>::type ThisNested;
|
typedef typename ei_cleantype<typename Derived::Nested>::type ThisNested;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user