put inline keywords everywhere appropriate. So we don't need anymore to pass

-finline-limit=1000 to gcc to get good performance. By the way some cleanup.
This commit is contained in:
Benoit Jacob 2008-05-12 17:34:46 +00:00
parent f0eb3d2d3b
commit 678f18fce4
28 changed files with 410 additions and 395 deletions

View File

@ -58,6 +58,10 @@ namespace Eigen {
#include "src/Core/arch/AltiVec/PacketMath.h" #include "src/Core/arch/AltiVec/PacketMath.h"
#endif #endif
#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 16
#endif
#include "src/Core/Functors.h" #include "src/Core/Functors.h"
#include "src/Core/MatrixBase.h" #include "src/Core/MatrixBase.h"
#include "src/Core/Coeffs.h" #include "src/Core/Coeffs.h"

View File

@ -35,7 +35,7 @@ struct ei_matrix_assignment_unroller
row = (UnrollCount-1) % Derived1::RowsAtCompileTime row = (UnrollCount-1) % Derived1::RowsAtCompileTime
}; };
static void run(Derived1 &dst, const Derived2 &src) inline static void run(Derived1 &dst, const Derived2 &src)
{ {
ei_matrix_assignment_unroller<Derived1, Derived2, UnrollCount-1>::run(dst, src); ei_matrix_assignment_unroller<Derived1, Derived2, UnrollCount-1>::run(dst, src);
dst.coeffRef(row, col) = src.coeff(row, col); dst.coeffRef(row, col) = src.coeff(row, col);
@ -45,7 +45,7 @@ struct ei_matrix_assignment_unroller
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct ei_matrix_assignment_unroller<Derived1, Derived2, 1> struct ei_matrix_assignment_unroller<Derived1, Derived2, 1>
{ {
static void run(Derived1 &dst, const Derived2 &src) inline static void run(Derived1 &dst, const Derived2 &src)
{ {
dst.coeffRef(0, 0) = src.coeff(0, 0); dst.coeffRef(0, 0) = src.coeff(0, 0);
} }
@ -55,13 +55,13 @@ struct ei_matrix_assignment_unroller<Derived1, Derived2, 1>
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct ei_matrix_assignment_unroller<Derived1, Derived2, 0> struct ei_matrix_assignment_unroller<Derived1, Derived2, 0>
{ {
static void run(Derived1 &, const Derived2 &) {} inline static void run(Derived1 &, const Derived2 &) {}
}; };
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct ei_matrix_assignment_unroller<Derived1, Derived2, Dynamic> struct ei_matrix_assignment_unroller<Derived1, Derived2, Dynamic>
{ {
static void run(Derived1 &, const Derived2 &) {} inline static void run(Derived1 &, const Derived2 &) {}
}; };
//---- //----
@ -74,7 +74,7 @@ struct ei_matrix_assignment_packet_unroller
col = Derived1::Flags&RowMajorBit ? Index % Derived1::ColsAtCompileTime : Index / Derived1::RowsAtCompileTime col = Derived1::Flags&RowMajorBit ? Index % Derived1::ColsAtCompileTime : Index / Derived1::RowsAtCompileTime
}; };
static void run(Derived1 &dst, const Derived2 &src) inline static void run(Derived1 &dst, const Derived2 &src)
{ {
ei_matrix_assignment_packet_unroller<Derived1, Derived2, ei_matrix_assignment_packet_unroller<Derived1, Derived2,
Index-ei_packet_traits<typename Derived1::Scalar>::size>::run(dst, src); Index-ei_packet_traits<typename Derived1::Scalar>::size>::run(dst, src);
@ -85,7 +85,7 @@ struct ei_matrix_assignment_packet_unroller
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, 0 > struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, 0 >
{ {
static void run(Derived1 &dst, const Derived2 &src) inline static void run(Derived1 &dst, const Derived2 &src)
{ {
dst.template writePacketCoeff<Aligned>(0, 0, src.template packetCoeff<Aligned>(0, 0)); dst.template writePacketCoeff<Aligned>(0, 0, src.template packetCoeff<Aligned>(0, 0));
} }
@ -94,7 +94,8 @@ struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, 0 >
template<typename Derived1, typename Derived2> template<typename Derived1, typename Derived2>
struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, Dynamic> struct ei_matrix_assignment_packet_unroller<Derived1, Derived2, Dynamic>
{ {
static void run(Derived1 &, const Derived2 &) { ei_internal_assert(false && "ei_matrix_assignment_packet_unroller"); } inline static void run(Derived1 &, const Derived2 &)
{ ei_internal_assert(false && "ei_matrix_assignment_packet_unroller"); }
}; };
template <typename Derived, typename OtherDerived, template <typename Derived, typename OtherDerived,
@ -109,7 +110,7 @@ struct ei_assignment_impl;
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived& MatrixBase<Derived> inline Derived& MatrixBase<Derived>
::lazyAssign(const MatrixBase<OtherDerived>& other) ::lazyAssign(const MatrixBase<OtherDerived>& other)
{ {
// std::cout << typeid(OtherDerived).name() << "\n"; // std::cout << typeid(OtherDerived).name() << "\n";
@ -121,7 +122,7 @@ Derived& MatrixBase<Derived>
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived& MatrixBase<Derived> inline Derived& MatrixBase<Derived>
::operator=(const MatrixBase<OtherDerived>& other) ::operator=(const MatrixBase<OtherDerived>& other)
{ {
const bool need_to_transpose = Derived::IsVectorAtCompileTime const bool need_to_transpose = Derived::IsVectorAtCompileTime

View File

@ -85,7 +85,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
/** Column or Row constructor /** Column or Row constructor
*/ */
Block(const MatrixType& matrix, int i) inline Block(const MatrixType& matrix, int i)
: m_matrix(matrix), : m_matrix(matrix),
// It is a row if and only if BlockRows==1 and BlockCols==MatrixType::ColsAtCompileTime, // It is a row if and only if BlockRows==1 and BlockCols==MatrixType::ColsAtCompileTime,
// and it is a column if and only if BlockRows==MatrixType::RowsAtCompileTime and BlockCols==1, // and it is a column if and only if BlockRows==MatrixType::RowsAtCompileTime and BlockCols==1,
@ -103,7 +103,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
/** Fixed-size constructor /** Fixed-size constructor
*/ */
Block(const MatrixType& matrix, int startRow, int startCol) inline Block(const MatrixType& matrix, int startRow, int startCol)
: m_matrix(matrix), m_startRow(startRow), m_startCol(startCol) : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol)
{ {
ei_assert(RowsAtCompileTime!=Dynamic && RowsAtCompileTime!=Dynamic); ei_assert(RowsAtCompileTime!=Dynamic && RowsAtCompileTime!=Dynamic);
@ -113,7 +113,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
/** Dynamic-size constructor /** Dynamic-size constructor
*/ */
Block(const MatrixType& matrix, inline Block(const MatrixType& matrix,
int startRow, int startCol, int startRow, int startCol,
int blockRows, int blockCols) int blockRows, int blockCols)
: m_matrix(matrix), m_startRow(startRow), m_startCol(startCol), : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol),
@ -129,30 +129,30 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
private: private:
int _rows() const { return m_blockRows.value(); } inline int _rows() const { return m_blockRows.value(); }
int _cols() const { return m_blockCols.value(); } inline int _cols() const { return m_blockCols.value(); }
int _stride(void) const { return m_matrix.stride(); } inline int _stride(void) const { return m_matrix.stride(); }
Scalar& _coeffRef(int row, int col) inline Scalar& _coeffRef(int row, int col)
{ {
return m_matrix.const_cast_derived() return m_matrix.const_cast_derived()
.coeffRef(row + m_startRow.value(), col + m_startCol.value()); .coeffRef(row + m_startRow.value(), col + m_startCol.value());
} }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value()); return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value());
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline PacketScalar _packetCoeff(int row, int col) const
{ {
return m_matrix.template packetCoeff<UnAligned>(row + m_startRow.value(), col + m_startCol.value()); return m_matrix.template packetCoeff<UnAligned>(row + m_startRow.value(), col + m_startCol.value());
} }
template<int LoadMode> template<int LoadMode>
void _writePacketCoeff(int row, int col, const PacketScalar& x) inline void _writePacketCoeff(int row, int col, const PacketScalar& x)
{ {
m_matrix.const_cast_derived().template writePacketCoeff<UnAligned>(row + m_startRow.value(), col + m_startCol.value(), x); m_matrix.const_cast_derived().template writePacketCoeff<UnAligned>(row + m_startRow.value(), col + m_startCol.value(), x);
} }
@ -183,7 +183,7 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
* \sa class Block, block(int,int) * \sa class Block, block(int,int)
*/ */
template<typename Derived> template<typename Derived>
Block<Derived> MatrixBase<Derived> inline Block<Derived> MatrixBase<Derived>
::block(int startRow, int startCol, int blockRows, int blockCols) ::block(int startRow, int startCol, int blockRows, int blockCols)
{ {
return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols); return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
@ -191,7 +191,7 @@ Block<Derived> MatrixBase<Derived>
/** This is the const version of block(int,int,int,int). */ /** This is the const version of block(int,int,int,int). */
template<typename Derived> template<typename Derived>
const Block<Derived> MatrixBase<Derived> inline const Block<Derived> MatrixBase<Derived>
::block(int startRow, int startCol, int blockRows, int blockCols) const ::block(int startRow, int startCol, int blockRows, int blockCols) const
{ {
return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols); return Block<Derived>(derived(), startRow, startCol, blockRows, blockCols);
@ -214,7 +214,7 @@ const Block<Derived> MatrixBase<Derived>
* \sa class Block, block(int) * \sa class Block, block(int)
*/ */
template<typename Derived> template<typename Derived>
Block<Derived> MatrixBase<Derived> inline Block<Derived> MatrixBase<Derived>
::block(int start, int size) ::block(int start, int size)
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
@ -226,7 +226,7 @@ Block<Derived> MatrixBase<Derived>
/** This is the const version of block(int,int).*/ /** This is the const version of block(int,int).*/
template<typename Derived> template<typename Derived>
const Block<Derived> MatrixBase<Derived> inline const Block<Derived> MatrixBase<Derived>
::block(int start, int size) const ::block(int start, int size) const
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
@ -252,7 +252,7 @@ const Block<Derived> MatrixBase<Derived>
* \sa class Block, block(int,int) * \sa class Block, block(int,int)
*/ */
template<typename Derived> template<typename Derived>
Block<Derived> MatrixBase<Derived>::start(int size) inline Block<Derived> MatrixBase<Derived>::start(int size)
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
return Block<Derived>(derived(), 0, 0, return Block<Derived>(derived(), 0, 0,
@ -262,7 +262,7 @@ Block<Derived> MatrixBase<Derived>::start(int size)
/** This is the const version of start(int).*/ /** This is the const version of start(int).*/
template<typename Derived> template<typename Derived>
const Block<Derived> MatrixBase<Derived>::start(int size) const inline const Block<Derived> MatrixBase<Derived>::start(int size) const
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
return Block<Derived>(derived(), 0, 0, return Block<Derived>(derived(), 0, 0,
@ -286,7 +286,7 @@ const Block<Derived> MatrixBase<Derived>::start(int size) const
* \sa class Block, block(int,int) * \sa class Block, block(int,int)
*/ */
template<typename Derived> template<typename Derived>
Block<Derived> MatrixBase<Derived>::end(int size) inline Block<Derived> MatrixBase<Derived>::end(int size)
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
return Block<Derived>(derived(), return Block<Derived>(derived(),
@ -298,7 +298,7 @@ Block<Derived> MatrixBase<Derived>::end(int size)
/** This is the const version of end(int).*/ /** This is the const version of end(int).*/
template<typename Derived> template<typename Derived>
const Block<Derived> MatrixBase<Derived>::end(int size) const inline const Block<Derived> MatrixBase<Derived>::end(int size) const
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
return Block<Derived>(derived(), return Block<Derived>(derived(),
@ -321,7 +321,7 @@ const Block<Derived> MatrixBase<Derived>::end(int size) const
*/ */
template<typename Derived> template<typename Derived>
template<int Size> template<int Size>
Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, inline Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size,
ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size>
MatrixBase<Derived>::start() MatrixBase<Derived>::start()
{ {
@ -333,7 +333,7 @@ MatrixBase<Derived>::start()
/** This is the const version of start<int>().*/ /** This is the const version of start<int>().*/
template<typename Derived> template<typename Derived>
template<int Size> template<int Size>
const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, inline const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size,
ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size>
MatrixBase<Derived>::start() const MatrixBase<Derived>::start() const
{ {
@ -355,7 +355,7 @@ MatrixBase<Derived>::start() const
*/ */
template<typename Derived> template<typename Derived>
template<int Size> template<int Size>
Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, inline Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size,
ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size>
MatrixBase<Derived>::end() MatrixBase<Derived>::end()
{ {
@ -370,7 +370,7 @@ MatrixBase<Derived>::end()
/** This is the const version of end<int>.*/ /** This is the const version of end<int>.*/
template<typename Derived> template<typename Derived>
template<int Size> template<int Size>
const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size, inline const Block<Derived, ei_traits<Derived>::RowsAtCompileTime == 1 ? 1 : Size,
ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size> ei_traits<Derived>::ColsAtCompileTime == 1 ? 1 : Size>
MatrixBase<Derived>::end() const MatrixBase<Derived>::end() const
{ {
@ -399,7 +399,7 @@ MatrixBase<Derived>::end() const
* \sa class Block, block(int,int,int,int) * \sa class Block, block(int,int,int,int)
*/ */
template<typename Derived> template<typename Derived>
Block<Derived> MatrixBase<Derived> inline Block<Derived> MatrixBase<Derived>
::corner(CornerType type, int cRows, int cCols) ::corner(CornerType type, int cRows, int cCols)
{ {
switch(type) switch(type)
@ -419,7 +419,7 @@ Block<Derived> MatrixBase<Derived>
/** This is the const version of corner(CornerType, int, int).*/ /** This is the const version of corner(CornerType, int, int).*/
template<typename Derived> template<typename Derived>
const Block<Derived> MatrixBase<Derived> inline const Block<Derived> MatrixBase<Derived>
::corner(CornerType type, int cRows, int cCols) const ::corner(CornerType type, int cRows, int cCols) const
{ {
switch(type) switch(type)
@ -451,7 +451,7 @@ const Block<Derived> MatrixBase<Derived>
*/ */
template<typename Derived> template<typename Derived>
template<int CRows, int CCols> template<int CRows, int CCols>
Block<Derived, CRows, CCols> MatrixBase<Derived> inline Block<Derived, CRows, CCols> MatrixBase<Derived>
::corner(CornerType type) ::corner(CornerType type)
{ {
switch(type) switch(type)
@ -472,7 +472,7 @@ Block<Derived, CRows, CCols> MatrixBase<Derived>
/** This is the const version of corner<int, int>(CornerType).*/ /** This is the const version of corner<int, int>(CornerType).*/
template<typename Derived> template<typename Derived>
template<int CRows, int CCols> template<int CRows, int CCols>
const Block<Derived, CRows, CCols> MatrixBase<Derived> inline const Block<Derived, CRows, CCols> MatrixBase<Derived>
::corner(CornerType type) const ::corner(CornerType type) const
{ {
switch(type) switch(type)
@ -508,7 +508,7 @@ const Block<Derived, CRows, CCols> MatrixBase<Derived>
*/ */
template<typename Derived> template<typename Derived>
template<int BlockRows, int BlockCols> template<int BlockRows, int BlockCols>
Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> inline Block<Derived, BlockRows, BlockCols> MatrixBase<Derived>
::block(int startRow, int startCol) ::block(int startRow, int startCol)
{ {
return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
@ -517,7 +517,7 @@ Block<Derived, BlockRows, BlockCols> MatrixBase<Derived>
/** This is the const version of block<>(int, int). */ /** This is the const version of block<>(int, int). */
template<typename Derived> template<typename Derived>
template<int BlockRows, int BlockCols> template<int BlockRows, int BlockCols>
const Block<Derived, BlockRows, BlockCols> MatrixBase<Derived> inline const Block<Derived, BlockRows, BlockCols> MatrixBase<Derived>
::block(int startRow, int startCol) const ::block(int startRow, int startCol) const
{ {
return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol); return Block<Derived, BlockRows, BlockCols>(derived(), startRow, startCol);
@ -530,7 +530,7 @@ const Block<Derived, BlockRows, BlockCols> MatrixBase<Derived>
* *
* \sa row(), class Block */ * \sa row(), class Block */
template<typename Derived> template<typename Derived>
Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> inline Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>
MatrixBase<Derived>::col(int i) MatrixBase<Derived>::col(int i)
{ {
return Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>(derived(), i); return Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>(derived(), i);
@ -538,7 +538,7 @@ MatrixBase<Derived>::col(int i)
/** This is the const version of col(). */ /** This is the const version of col(). */
template<typename Derived> template<typename Derived>
const Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1> inline const Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>
MatrixBase<Derived>::col(int i) const MatrixBase<Derived>::col(int i) const
{ {
return Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>(derived(), i); return Block<Derived, ei_traits<Derived>::RowsAtCompileTime, 1>(derived(), i);
@ -551,7 +551,7 @@ MatrixBase<Derived>::col(int i) const
* *
* \sa col(), class Block */ * \sa col(), class Block */
template<typename Derived> template<typename Derived>
Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> inline Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>
MatrixBase<Derived>::row(int i) MatrixBase<Derived>::row(int i)
{ {
return Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>(derived(), i); return Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>(derived(), i);
@ -559,7 +559,7 @@ MatrixBase<Derived>::row(int i)
/** This is the const version of row(). */ /** This is the const version of row(). */
template<typename Derived> template<typename Derived>
const Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime> inline const Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>
MatrixBase<Derived>::row(int i) const MatrixBase<Derived>::row(int i) const
{ {
return Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>(derived(), i); return Block<Derived, 1, ei_traits<Derived>::ColsAtCompileTime>(derived(), i);

View File

@ -40,7 +40,7 @@
* \sa operator()(int,int) const, coeffRef(int,int), coeff(int) const * \sa operator()(int,int) const, coeffRef(int,int), coeff(int) const
*/ */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::coeff(int row, int col) const ::coeff(int row, int col) const
{ {
ei_internal_assert(row >= 0 && row < rows() ei_internal_assert(row >= 0 && row < rows()
@ -53,7 +53,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
* \sa operator()(int,int), operator[](int) const * \sa operator()(int,int), operator[](int) const
*/ */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::operator()(int row, int col) const ::operator()(int row, int col) const
{ {
ei_assert(row >= 0 && row < rows() ei_assert(row >= 0 && row < rows()
@ -76,7 +76,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
* \sa operator()(int,int), coeff(int, int) const, coeffRef(int) * \sa operator()(int,int), coeff(int, int) const, coeffRef(int)
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::coeffRef(int row, int col) ::coeffRef(int row, int col)
{ {
ei_internal_assert(row >= 0 && row < rows() ei_internal_assert(row >= 0 && row < rows()
@ -89,7 +89,7 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator()(int,int) const, operator[](int) * \sa operator()(int,int) const, operator[](int)
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::operator()(int row, int col) ::operator()(int row, int col)
{ {
ei_assert(row >= 0 && row < rows() ei_assert(row >= 0 && row < rows()
@ -112,7 +112,7 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator[](int) const, coeffRef(int), coeff(int,int) const * \sa operator[](int) const, coeffRef(int), coeff(int,int) const
*/ */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::coeff(int index) const ::coeff(int index) const
{ {
ei_internal_assert(IsVectorAtCompileTime); ei_internal_assert(IsVectorAtCompileTime);
@ -136,7 +136,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
* z() const, w() const * z() const, w() const
*/ */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::operator[](int index) const ::operator[](int index) const
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
@ -167,7 +167,7 @@ const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
* \sa operator[](int), coeff(int) const, coeffRef(int,int) * \sa operator[](int), coeff(int) const, coeffRef(int,int)
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::coeffRef(int index) ::coeffRef(int index)
{ {
ei_internal_assert(IsVectorAtCompileTime); ei_internal_assert(IsVectorAtCompileTime);
@ -190,7 +190,7 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
* \sa operator[](int) const, operator()(int,int), x(), y(), z(), w() * \sa operator[](int) const, operator()(int,int), x(), y(), z(), w()
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::operator[](int index) ::operator[](int index)
{ {
ei_assert(IsVectorAtCompileTime); ei_assert(IsVectorAtCompileTime);
@ -208,42 +208,55 @@ typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
/** equivalent to operator[](0). \only_for_vectors */ /** equivalent to operator[](0). \only_for_vectors */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::x() const { return (*this)[0]; } ::x() const { return (*this)[0]; }
/** equivalent to operator[](1). \only_for_vectors */ /** equivalent to operator[](1). \only_for_vectors */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::y() const { return (*this)[1]; } ::y() const { return (*this)[1]; }
/** equivalent to operator[](2). \only_for_vectors */ /** equivalent to operator[](2). \only_for_vectors */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::z() const { return (*this)[2]; } ::z() const { return (*this)[2]; }
/** equivalent to operator[](3). \only_for_vectors */ /** equivalent to operator[](3). \only_for_vectors */
template<typename Derived> template<typename Derived>
const typename ei_traits<Derived>::Scalar MatrixBase<Derived> inline const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
::w() const { return (*this)[3]; } ::w() const { return (*this)[3]; }
/** equivalent to operator[](0). \only_for_vectors */ /** equivalent to operator[](0). \only_for_vectors */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::x() { return (*this)[0]; } ::x() { return (*this)[0]; }
/** equivalent to operator[](1). \only_for_vectors */ /** equivalent to operator[](1). \only_for_vectors */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::y() { return (*this)[1]; } ::y() { return (*this)[1]; }
/** equivalent to operator[](2). \only_for_vectors */ /** equivalent to operator[](2). \only_for_vectors */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::z() { return (*this)[2]; } ::z() { return (*this)[2]; }
/** equivalent to operator[](3). \only_for_vectors */ /** equivalent to operator[](3). \only_for_vectors */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar& MatrixBase<Derived> inline typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
::w() { return (*this)[3]; } ::w() { return (*this)[3]; }
template<typename Derived>
template<int LoadMode>
inline typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type
MatrixBase<Derived>::packetCoeff(int row, int col) const
{ return derived().template _packetCoeff<LoadMode>(row,col); }
template<typename Derived>
template<int StoreMode>
inline void MatrixBase<Derived>::writePacketCoeff
(int row, int col, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x)
{ return derived().template _writePacketCoeff<StoreMode>(row,col,x); }
#endif // EIGEN_COEFFS_H #endif // EIGEN_COEFFS_H

View File

@ -32,14 +32,14 @@
template<typename Derived> template<typename Derived>
struct MatrixBase<Derived>::CommaInitializer struct MatrixBase<Derived>::CommaInitializer
{ {
CommaInitializer(Derived& mat, const Scalar& s) inline CommaInitializer(Derived& mat, const Scalar& s)
: m_matrix(mat), m_row(0), m_col(1), m_currentBlockRows(1) : m_matrix(mat), m_row(0), m_col(1), m_currentBlockRows(1)
{ {
m_matrix.coeffRef(0,0) = s; m_matrix.coeffRef(0,0) = s;
} }
template<typename OtherDerived> template<typename OtherDerived>
CommaInitializer(Derived& mat, const MatrixBase<OtherDerived>& other) inline CommaInitializer(Derived& mat, const MatrixBase<OtherDerived>& other)
: m_matrix(mat), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) : m_matrix(mat), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
{ {
m_matrix.block(0, 0, other.rows(), other.cols()) = other; m_matrix.block(0, 0, other.rows(), other.cols()) = other;
@ -86,7 +86,7 @@ struct MatrixBase<Derived>::CommaInitializer
return *this; return *this;
} }
~CommaInitializer(void) inline ~CommaInitializer()
{ {
ei_assert((m_row+m_currentBlockRows) == m_matrix.rows() ei_assert((m_row+m_currentBlockRows) == m_matrix.rows()
&& m_col == m_matrix.cols() && m_col == m_matrix.cols()
@ -108,14 +108,14 @@ struct MatrixBase<Derived>::CommaInitializer
* Output: \verbinclude MatrixBase_set.out * Output: \verbinclude MatrixBase_set.out
*/ */
template<typename Derived> template<typename Derived>
typename MatrixBase<Derived>::CommaInitializer MatrixBase<Derived>::operator<< (const Scalar& s) inline typename MatrixBase<Derived>::CommaInitializer MatrixBase<Derived>::operator<< (const Scalar& s)
{ {
return CommaInitializer(*static_cast<Derived*>(this), s); return CommaInitializer(*static_cast<Derived*>(this), s);
} }
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
typename MatrixBase<Derived>::CommaInitializer inline typename MatrixBase<Derived>::CommaInitializer
MatrixBase<Derived>::operator<<(const MatrixBase<OtherDerived>& other) MatrixBase<Derived>::operator<<(const MatrixBase<OtherDerived>& other)
{ {
return CommaInitializer(*static_cast<Derived *>(this), other); return CommaInitializer(*static_cast<Derived *>(this), other);

View File

@ -87,7 +87,7 @@ class CwiseBinaryOp : ei_no_assignment_operator,
typedef typename ei_traits<CwiseBinaryOp>::LhsNested LhsNested; typedef typename ei_traits<CwiseBinaryOp>::LhsNested LhsNested;
typedef typename ei_traits<CwiseBinaryOp>::RhsNested RhsNested; typedef typename ei_traits<CwiseBinaryOp>::RhsNested RhsNested;
CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) inline CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp())
: m_lhs(lhs), m_rhs(rhs), m_functor(func) : m_lhs(lhs), m_rhs(rhs), m_functor(func)
{ {
ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
@ -95,16 +95,16 @@ class CwiseBinaryOp : ei_no_assignment_operator,
private: private:
int _rows() const { return m_lhs.rows(); } inline int _rows() const { return m_lhs.rows(); }
int _cols() const { return m_lhs.cols(); } inline int _cols() const { return m_lhs.cols(); }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_functor(m_lhs.coeff(row, col), m_rhs.coeff(row, col)); return m_functor(m_lhs.coeff(row, col), m_rhs.coeff(row, col));
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline PacketScalar _packetCoeff(int row, int col) const
{ {
return m_functor.packetOp(m_lhs.template packetCoeff<LoadMode>(row, col), m_rhs.template packetCoeff<LoadMode>(row, col)); return m_functor.packetOp(m_lhs.template packetCoeff<LoadMode>(row, col), m_rhs.template packetCoeff<LoadMode>(row, col));
} }
@ -121,7 +121,7 @@ class CwiseBinaryOp : ei_no_assignment_operator,
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>, inline const CwiseBinaryOp<ei_scalar_difference_op<typename ei_traits<Derived>::Scalar>,
Derived, OtherDerived> Derived, OtherDerived>
MatrixBase<Derived>::operator-(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::operator-(const MatrixBase<OtherDerived> &other) const
{ {
@ -135,7 +135,7 @@ MatrixBase<Derived>::operator-(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & inline Derived &
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other) MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
{ {
return *this = *this - other; return *this = *this - other;
@ -149,7 +149,7 @@ MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<ei_scalar_sum_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::operator+(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::operator+(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); return CwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
@ -161,7 +161,7 @@ MatrixBase<Derived>::operator+(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & inline Derived &
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
{ {
return *this = *this + other; return *this = *this + other;
@ -173,7 +173,7 @@ MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ei_scalar_product_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<ei_scalar_product_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); return CwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
@ -185,7 +185,7 @@ MatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ei_scalar_quotient_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<ei_scalar_quotient_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); return CwiseBinaryOp<ei_scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
@ -197,7 +197,7 @@ MatrixBase<Derived>::cwiseQuotient(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ei_scalar_min_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<ei_scalar_min_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseMin(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseMin(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ei_scalar_min_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); return CwiseBinaryOp<ei_scalar_min_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
@ -209,7 +209,7 @@ MatrixBase<Derived>::cwiseMin(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<ei_scalar_max_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<ei_scalar_max_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseMax(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseMax(const MatrixBase<OtherDerived> &other) const
{ {
return CwiseBinaryOp<ei_scalar_max_op<Scalar>, Derived, OtherDerived>(derived(), other.derived()); return CwiseBinaryOp<ei_scalar_max_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
@ -224,7 +224,7 @@ MatrixBase<Derived>::cwiseMax(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename CustomBinaryOp, typename OtherDerived> template<typename CustomBinaryOp, typename OtherDerived>
const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived> inline const CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>
MatrixBase<Derived>::cwise(const MatrixBase<OtherDerived> &other, const CustomBinaryOp& func) const MatrixBase<Derived>::cwise(const MatrixBase<OtherDerived> &other, const CustomBinaryOp& func) const
{ {
return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(derived(), other.derived(), func); return CwiseBinaryOp<CustomBinaryOp, Derived, OtherDerived>(derived(), other.derived(), func);
@ -236,7 +236,7 @@ MatrixBase<Derived>::cwise(const MatrixBase<OtherDerived> &other, const CustomBi
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<std::less<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<std::less<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseLessThan(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseLessThan(const MatrixBase<OtherDerived> &other) const
{ {
return cwise(other, std::less<Scalar>()); return cwise(other, std::less<Scalar>());
@ -248,7 +248,7 @@ MatrixBase<Derived>::cwiseLessThan(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<std::less_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<std::less_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseLessEqual(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseLessEqual(const MatrixBase<OtherDerived> &other) const
{ {
return cwise(other, std::less_equal<Scalar>()); return cwise(other, std::less_equal<Scalar>());
@ -260,7 +260,7 @@ MatrixBase<Derived>::cwiseLessEqual(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<std::greater<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<std::greater<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseGreaterThan(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseGreaterThan(const MatrixBase<OtherDerived> &other) const
{ {
return cwise(other, std::greater<Scalar>()); return cwise(other, std::greater<Scalar>());
@ -272,7 +272,7 @@ MatrixBase<Derived>::cwiseGreaterThan(const MatrixBase<OtherDerived> &other) con
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<std::greater_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<std::greater_equal<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseGreaterEqual(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseGreaterEqual(const MatrixBase<OtherDerived> &other) const
{ {
return cwise(other, std::greater_equal<Scalar>()); return cwise(other, std::greater_equal<Scalar>());
@ -284,7 +284,7 @@ MatrixBase<Derived>::cwiseGreaterEqual(const MatrixBase<OtherDerived> &other) co
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<std::equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<std::equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseEqualTo(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseEqualTo(const MatrixBase<OtherDerived> &other) const
{ {
return cwise(other, std::equal_to<Scalar>()); return cwise(other, std::equal_to<Scalar>());
@ -296,7 +296,7 @@ MatrixBase<Derived>::cwiseEqualTo(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const CwiseBinaryOp<std::not_equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived> inline const CwiseBinaryOp<std::not_equal_to<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
MatrixBase<Derived>::cwiseNotEqualTo(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::cwiseNotEqualTo(const MatrixBase<OtherDerived> &other) const
{ {
return cwise(other, std::not_equal_to<Scalar>()); return cwise(other, std::not_equal_to<Scalar>());

View File

@ -440,7 +440,7 @@ Derived& MatrixBase<Derived>::setOnes()
* \sa ei_random(), ei_random(int) * \sa ei_random(), ei_random(int)
*/ */
template<typename Derived> template<typename Derived>
const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::random(int rows, int cols) MatrixBase<Derived>::random(int rows, int cols)
{ {
return create(rows, cols, ei_scalar_random_op<Scalar>()); return create(rows, cols, ei_scalar_random_op<Scalar>());
@ -463,7 +463,7 @@ MatrixBase<Derived>::random(int rows, int cols)
* \sa ei_random(), ei_random(int,int) * \sa ei_random(), ei_random(int,int)
*/ */
template<typename Derived> template<typename Derived>
const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::random(int size) MatrixBase<Derived>::random(int size)
{ {
return create(size, ei_scalar_random_op<Scalar>()); return create(size, ei_scalar_random_op<Scalar>());
@ -481,7 +481,7 @@ MatrixBase<Derived>::random(int size)
* \sa ei_random(int), ei_random(int,int) * \sa ei_random(int), ei_random(int,int)
*/ */
template<typename Derived> template<typename Derived>
const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseNullaryOp<ei_scalar_random_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::random() MatrixBase<Derived>::random()
{ {
return create(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_random_op<Scalar>()); return create(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_random_op<Scalar>());
@ -495,7 +495,7 @@ MatrixBase<Derived>::random()
* \sa class CwiseNullaryOp, ei_random() * \sa class CwiseNullaryOp, ei_random()
*/ */
template<typename Derived> template<typename Derived>
Derived& MatrixBase<Derived>::setRandom() inline Derived& MatrixBase<Derived>::setRandom()
{ {
return *this = random(rows(), cols()); return *this = random(rows(), cols());
} }
@ -517,7 +517,7 @@ Derived& MatrixBase<Derived>::setRandom()
* \sa identity(), setIdentity(), isIdentity() * \sa identity(), setIdentity(), isIdentity()
*/ */
template<typename Derived> template<typename Derived>
const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::identity(int rows, int cols) MatrixBase<Derived>::identity(int rows, int cols)
{ {
return create(rows, cols, ei_scalar_identity_op<Scalar>()); return create(rows, cols, ei_scalar_identity_op<Scalar>());
@ -534,7 +534,7 @@ MatrixBase<Derived>::identity(int rows, int cols)
* \sa identity(int,int), setIdentity(), isIdentity() * \sa identity(int,int), setIdentity(), isIdentity()
*/ */
template<typename Derived> template<typename Derived>
const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseNullaryOp<ei_scalar_identity_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::identity() MatrixBase<Derived>::identity()
{ {
return create(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_identity_op<Scalar>()); return create(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_identity_op<Scalar>());
@ -580,7 +580,7 @@ bool MatrixBase<Derived>::isIdentity
* \sa class CwiseNullaryOp, identity(), identity(int,int), isIdentity() * \sa class CwiseNullaryOp, identity(), identity(int,int), isIdentity()
*/ */
template<typename Derived> template<typename Derived>
Derived& MatrixBase<Derived>::setIdentity() inline Derived& MatrixBase<Derived>::setIdentity()
{ {
return *this = identity(rows(), cols()); return *this = identity(rows(), cols());
} }

View File

@ -69,21 +69,21 @@ class CwiseUnaryOp : ei_no_assignment_operator,
EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp)
CwiseUnaryOp(const MatrixType& mat, const UnaryOp& func = UnaryOp()) inline CwiseUnaryOp(const MatrixType& mat, const UnaryOp& func = UnaryOp())
: m_matrix(mat), m_functor(func) {} : m_matrix(mat), m_functor(func) {}
private: private:
int _rows() const { return m_matrix.rows(); } inline int _rows() const { return m_matrix.rows(); }
int _cols() const { return m_matrix.cols(); } inline int _cols() const { return m_matrix.cols(); }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_functor(m_matrix.coeff(row, col)); return m_functor(m_matrix.coeff(row, col));
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline PacketScalar _packetCoeff(int row, int col) const
{ {
return m_functor.packetOp(m_matrix.template packetCoeff<LoadMode>(row, col)); return m_functor.packetOp(m_matrix.template packetCoeff<LoadMode>(row, col));
} }
@ -105,7 +105,7 @@ class CwiseUnaryOp : ei_no_assignment_operator,
*/ */
template<typename Derived> template<typename Derived>
template<typename CustomUnaryOp> template<typename CustomUnaryOp>
const CwiseUnaryOp<CustomUnaryOp, Derived> inline const CwiseUnaryOp<CustomUnaryOp, Derived>
MatrixBase<Derived>::cwise(const CustomUnaryOp& func) const MatrixBase<Derived>::cwise(const CustomUnaryOp& func) const
{ {
return CwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func); return CwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func);
@ -114,7 +114,7 @@ MatrixBase<Derived>::cwise(const CustomUnaryOp& func) const
/** \returns an expression of the opposite of \c *this /** \returns an expression of the opposite of \c *this
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived> inline const CwiseUnaryOp<ei_scalar_opposite_op<typename ei_traits<Derived>::Scalar>,Derived>
MatrixBase<Derived>::operator-() const MatrixBase<Derived>::operator-() const
{ {
return CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, Derived>(derived());
@ -123,7 +123,7 @@ MatrixBase<Derived>::operator-() const
/** \returns an expression of the coefficient-wise absolute value of \c *this /** \returns an expression of the coefficient-wise absolute value of \c *this
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_abs_op<typename ei_traits<Derived>::Scalar>,Derived> inline const CwiseUnaryOp<ei_scalar_abs_op<typename ei_traits<Derived>::Scalar>,Derived>
MatrixBase<Derived>::cwiseAbs() const MatrixBase<Derived>::cwiseAbs() const
{ {
return CwiseUnaryOp<ei_scalar_abs_op<Scalar>,Derived>(derived()); return CwiseUnaryOp<ei_scalar_abs_op<Scalar>,Derived>(derived());
@ -132,7 +132,7 @@ MatrixBase<Derived>::cwiseAbs() const
/** \returns an expression of the coefficient-wise squared absolute value of \c *this /** \returns an expression of the coefficient-wise squared absolute value of \c *this
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_abs2_op<typename ei_traits<Derived>::Scalar>,Derived> inline const CwiseUnaryOp<ei_scalar_abs2_op<typename ei_traits<Derived>::Scalar>,Derived>
MatrixBase<Derived>::cwiseAbs2() const MatrixBase<Derived>::cwiseAbs2() const
{ {
return CwiseUnaryOp<ei_scalar_abs2_op<Scalar>,Derived>(derived()); return CwiseUnaryOp<ei_scalar_abs2_op<Scalar>,Derived>(derived());
@ -142,7 +142,7 @@ MatrixBase<Derived>::cwiseAbs2() const
* *
* \sa adjoint() */ * \sa adjoint() */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::conjugate() const MatrixBase<Derived>::conjugate() const
{ {
return CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>(derived());
@ -157,7 +157,7 @@ MatrixBase<Derived>::conjugate() const
*/ */
template<typename Derived> template<typename Derived>
template<typename NewType> template<typename NewType>
const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> inline const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived>
MatrixBase<Derived>::cast() const MatrixBase<Derived>::cast() const
{ {
return CwiseUnaryOp<ei_scalar_cast_op<Scalar, NewType>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_cast_op<Scalar, NewType>, Derived>(derived());
@ -165,7 +165,7 @@ MatrixBase<Derived>::cast() const
/** \relates MatrixBase */ /** \relates MatrixBase */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::operator*(const Scalar& scalar) const MatrixBase<Derived>::operator*(const Scalar& scalar) const
{ {
return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived> return CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, Derived>
@ -174,7 +174,7 @@ MatrixBase<Derived>::operator*(const Scalar& scalar) const
/** \relates MatrixBase */ /** \relates MatrixBase */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::operator/(const Scalar& scalar) const MatrixBase<Derived>::operator/(const Scalar& scalar) const
{ {
return CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived> return CwiseUnaryOp<ei_scalar_quotient1_op<Scalar>, Derived>
@ -182,14 +182,14 @@ MatrixBase<Derived>::operator/(const Scalar& scalar) const
} }
template<typename Derived> template<typename Derived>
Derived& inline Derived&
MatrixBase<Derived>::operator*=(const Scalar& other) MatrixBase<Derived>::operator*=(const Scalar& other)
{ {
return *this = *this * other; return *this = *this * other;
} }
template<typename Derived> template<typename Derived>
Derived& inline Derived&
MatrixBase<Derived>::operator/=(const Scalar& other) MatrixBase<Derived>::operator/=(const Scalar& other)
{ {
return *this = *this / other; return *this = *this / other;
@ -197,7 +197,7 @@ MatrixBase<Derived>::operator/=(const Scalar& other)
/** \returns an expression of the coefficient-wise square root of *this. */ /** \returns an expression of the coefficient-wise square root of *this. */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_sqrt_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_sqrt_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::cwiseSqrt() const MatrixBase<Derived>::cwiseSqrt() const
{ {
return CwiseUnaryOp<ei_scalar_sqrt_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_sqrt_op<Scalar>, Derived>(derived());
@ -205,7 +205,7 @@ MatrixBase<Derived>::cwiseSqrt() const
/** \returns an expression of the coefficient-wise exponential of *this. */ /** \returns an expression of the coefficient-wise exponential of *this. */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_exp_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_exp_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::cwiseExp() const MatrixBase<Derived>::cwiseExp() const
{ {
return CwiseUnaryOp<ei_scalar_exp_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_exp_op<Scalar>, Derived>(derived());
@ -213,7 +213,7 @@ MatrixBase<Derived>::cwiseExp() const
/** \returns an expression of the coefficient-wise logarithm of *this. */ /** \returns an expression of the coefficient-wise logarithm of *this. */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_log_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_log_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::cwiseLog() const MatrixBase<Derived>::cwiseLog() const
{ {
return CwiseUnaryOp<ei_scalar_log_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_log_op<Scalar>, Derived>(derived());
@ -221,7 +221,7 @@ MatrixBase<Derived>::cwiseLog() const
/** \returns an expression of the coefficient-wise cosine of *this. */ /** \returns an expression of the coefficient-wise cosine of *this. */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_cos_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_cos_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::cwiseCos() const MatrixBase<Derived>::cwiseCos() const
{ {
return CwiseUnaryOp<ei_scalar_cos_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_cos_op<Scalar>, Derived>(derived());
@ -229,7 +229,7 @@ MatrixBase<Derived>::cwiseCos() const
/** \returns an expression of the coefficient-wise sine of *this. */ /** \returns an expression of the coefficient-wise sine of *this. */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_sin_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_sin_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::cwiseSin() const MatrixBase<Derived>::cwiseSin() const
{ {
return CwiseUnaryOp<ei_scalar_sin_op<Scalar>, Derived>(derived()); return CwiseUnaryOp<ei_scalar_sin_op<Scalar>, Derived>(derived());
@ -237,7 +237,7 @@ MatrixBase<Derived>::cwiseSin() const
/** \relates MatrixBase */ /** \relates MatrixBase */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_pow_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_pow_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::cwisePow(const Scalar& exponent) const MatrixBase<Derived>::cwisePow(const Scalar& exponent) const
{ {
return CwiseUnaryOp<ei_scalar_pow_op<Scalar>, Derived> return CwiseUnaryOp<ei_scalar_pow_op<Scalar>, Derived>

View File

@ -68,21 +68,21 @@ template<typename MatrixType> class DiagonalCoeffs
EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalCoeffs) EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalCoeffs)
DiagonalCoeffs(const MatrixType& matrix) : m_matrix(matrix) {} inline DiagonalCoeffs(const MatrixType& matrix) : m_matrix(matrix) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs)
private: private:
int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); } inline int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); }
int _cols() const { return 1; } inline int _cols() const { return 1; }
Scalar& _coeffRef(int row, int) inline Scalar& _coeffRef(int row, int)
{ {
return m_matrix.const_cast_derived().coeffRef(row, row); return m_matrix.const_cast_derived().coeffRef(row, row);
} }
const Scalar _coeff(int row, int) const inline const Scalar _coeff(int row, int) const
{ {
return m_matrix.coeff(row, row); return m_matrix.coeff(row, row);
} }
@ -102,14 +102,14 @@ template<typename MatrixType> class DiagonalCoeffs
* \sa class DiagonalCoeffs */ * \sa class DiagonalCoeffs */
template<typename Derived> template<typename Derived>
DiagonalCoeffs<Derived> DiagonalCoeffs<Derived>
MatrixBase<Derived>::diagonal() inline MatrixBase<Derived>::diagonal()
{ {
return DiagonalCoeffs<Derived>(derived()); return DiagonalCoeffs<Derived>(derived());
} }
/** This is the const version of diagonal(). */ /** This is the const version of diagonal(). */
template<typename Derived> template<typename Derived>
const DiagonalCoeffs<Derived> inline const DiagonalCoeffs<Derived>
MatrixBase<Derived>::diagonal() const MatrixBase<Derived>::diagonal() const
{ {
return DiagonalCoeffs<Derived>(derived()); return DiagonalCoeffs<Derived>(derived());

View File

@ -62,7 +62,7 @@ class DiagonalMatrix : ei_no_assignment_operator,
EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalMatrix) EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalMatrix)
DiagonalMatrix(const CoeffsVectorType& coeffs) : m_coeffs(coeffs) inline DiagonalMatrix(const CoeffsVectorType& coeffs) : m_coeffs(coeffs)
{ {
ei_assert(CoeffsVectorType::IsVectorAtCompileTime ei_assert(CoeffsVectorType::IsVectorAtCompileTime
&& coeffs.size() > 0); && coeffs.size() > 0);
@ -70,10 +70,10 @@ class DiagonalMatrix : ei_no_assignment_operator,
private: private:
int _rows() const { return m_coeffs.size(); } inline int _rows() const { return m_coeffs.size(); }
int _cols() const { return m_coeffs.size(); } inline int _cols() const { return m_coeffs.size(); }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return row == col ? m_coeffs.coeff(row) : static_cast<Scalar>(0); return row == col ? m_coeffs.coeff(row) : static_cast<Scalar>(0);
} }
@ -92,7 +92,7 @@ class DiagonalMatrix : ei_no_assignment_operator,
* \sa class DiagonalMatrix, isDiagonal() * \sa class DiagonalMatrix, isDiagonal()
**/ **/
template<typename Derived> template<typename Derived>
const DiagonalMatrix<Derived> inline const DiagonalMatrix<Derived>
MatrixBase<Derived>::asDiagonal() const MatrixBase<Derived>::asDiagonal() const
{ {
return DiagonalMatrix<Derived>(derived()); return DiagonalMatrix<Derived>(derived());

View File

@ -28,7 +28,7 @@
template<int Index, int Size, typename Derived1, typename Derived2> template<int Index, int Size, typename Derived1, typename Derived2>
struct ei_dot_unroller struct ei_dot_unroller
{ {
static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) inline static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot)
{ {
ei_dot_unroller<Index-1, Size, Derived1, Derived2>::run(v1, v2, dot); ei_dot_unroller<Index-1, Size, Derived1, Derived2>::run(v1, v2, dot);
dot += v1.coeff(Index) * ei_conj(v2.coeff(Index)); dot += v1.coeff(Index) * ei_conj(v2.coeff(Index));
@ -38,7 +38,7 @@ struct ei_dot_unroller
template<int Size, typename Derived1, typename Derived2> template<int Size, typename Derived1, typename Derived2>
struct ei_dot_unroller<0, Size, Derived1, Derived2> struct ei_dot_unroller<0, Size, Derived1, Derived2>
{ {
static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) inline static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot)
{ {
dot = v1.coeff(0) * ei_conj(v2.coeff(0)); dot = v1.coeff(0) * ei_conj(v2.coeff(0));
} }
@ -47,14 +47,14 @@ struct ei_dot_unroller<0, Size, Derived1, Derived2>
template<int Index, typename Derived1, typename Derived2> template<int Index, typename Derived1, typename Derived2>
struct ei_dot_unroller<Index, Dynamic, Derived1, Derived2> struct ei_dot_unroller<Index, Dynamic, Derived1, Derived2>
{ {
static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} inline static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {}
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<int Index, typename Derived1, typename Derived2> template<int Index, typename Derived1, typename Derived2>
struct ei_dot_unroller<Index, 0, Derived1, Derived2> struct ei_dot_unroller<Index, 0, Derived1, Derived2>
{ {
static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {} inline static void run(const Derived1&, const Derived2&, typename Derived1::Scalar&) {}
}; };
/** \returns the dot product of *this with other. /** \returns the dot product of *this with other.
@ -108,7 +108,7 @@ MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
* \sa dot(), norm() * \sa dot(), norm()
*/ */
template<typename Derived> template<typename Derived>
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm2() const inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm2() const
{ {
return ei_real(dot(*this)); return ei_real(dot(*this));
} }
@ -120,7 +120,7 @@ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived
* \sa dot(), norm2() * \sa dot(), norm2()
*/ */
template<typename Derived> template<typename Derived>
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const inline typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
{ {
return ei_sqrt(norm2()); return ei_sqrt(norm2());
} }
@ -132,7 +132,7 @@ typename NumTraits<typename ei_traits<Derived>::Scalar>::Real MatrixBase<Derived
* \sa norm() * \sa norm()
*/ */
template<typename Derived> template<typename Derived>
const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> inline const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::normalized() const MatrixBase<Derived>::normalized() const
{ {
return (*this) * (Scalar(1)/norm()); return (*this) * (Scalar(1)/norm());

View File

@ -33,9 +33,9 @@
* \sa class CwiseBinaryOp, MatrixBase::operator+, class PartialRedux, MatrixBase::sum() * \sa class CwiseBinaryOp, MatrixBase::operator+, class PartialRedux, MatrixBase::sum()
*/ */
template<typename Scalar> struct ei_scalar_sum_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_sum_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; }
template<typename PacketScalar> template<typename PacketScalar>
PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const
{ return ei_padd(a,b); } { return ei_padd(a,b); }
}; };
template<typename Scalar> template<typename Scalar>
@ -52,9 +52,9 @@ struct ei_functor_traits<ei_scalar_sum_op<Scalar> > {
* \sa class CwiseBinaryOp, MatrixBase::cwiseProduct(), class PartialRedux, MatrixBase::redux() * \sa class CwiseBinaryOp, MatrixBase::cwiseProduct(), class PartialRedux, MatrixBase::redux()
*/ */
template<typename Scalar> struct ei_scalar_product_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_product_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; } inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a * b; }
template<typename PacketScalar> template<typename PacketScalar>
PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const
{ return ei_pmul(a,b); } { return ei_pmul(a,b); }
}; };
template<typename Scalar> template<typename Scalar>
@ -71,9 +71,9 @@ struct ei_functor_traits<ei_scalar_product_op<Scalar> > {
* \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class PartialRedux, MatrixBase::minCoeff() * \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class PartialRedux, MatrixBase::minCoeff()
*/ */
template<typename Scalar> struct ei_scalar_min_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_min_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::min(a, b); } inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::min(a, b); }
template<typename PacketScalar> template<typename PacketScalar>
PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const
{ return ei_pmin(a,b); } { return ei_pmin(a,b); }
}; };
template<typename Scalar> template<typename Scalar>
@ -90,9 +90,9 @@ struct ei_functor_traits<ei_scalar_min_op<Scalar> > {
* \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class PartialRedux, MatrixBase::maxCoeff() * \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class PartialRedux, MatrixBase::maxCoeff()
*/ */
template<typename Scalar> struct ei_scalar_max_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_max_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::max(a, b); } inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return std::max(a, b); }
template<typename PacketScalar> template<typename PacketScalar>
PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const
{ return ei_pmax(a,b); } { return ei_pmax(a,b); }
}; };
template<typename Scalar> template<typename Scalar>
@ -112,9 +112,9 @@ struct ei_functor_traits<ei_scalar_max_op<Scalar> > {
* \sa class CwiseBinaryOp, MatrixBase::operator- * \sa class CwiseBinaryOp, MatrixBase::operator-
*/ */
template<typename Scalar> struct ei_scalar_difference_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_difference_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; }
template<typename PacketScalar> template<typename PacketScalar>
PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const
{ return ei_psub(a,b); } { return ei_psub(a,b); }
}; };
template<typename Scalar> template<typename Scalar>
@ -131,7 +131,7 @@ struct ei_functor_traits<ei_scalar_difference_op<Scalar> > {
* \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient() * \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient()
*/ */
template<typename Scalar> struct ei_scalar_quotient_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_quotient_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; } inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a / b; }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_quotient_op<Scalar> > struct ei_functor_traits<ei_scalar_quotient_op<Scalar> >
@ -146,7 +146,7 @@ struct ei_functor_traits<ei_scalar_quotient_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::operator- * \sa class CwiseUnaryOp, MatrixBase::operator-
*/ */
template<typename Scalar> struct ei_scalar_opposite_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_opposite_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return -a; } inline const Scalar operator() (const Scalar& a) const { return -a; }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_opposite_op<Scalar> > struct ei_functor_traits<ei_scalar_opposite_op<Scalar> >
@ -159,7 +159,7 @@ struct ei_functor_traits<ei_scalar_opposite_op<Scalar> >
*/ */
template<typename Scalar> struct ei_scalar_abs_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_abs_op EIGEN_EMPTY_STRUCT {
typedef typename NumTraits<Scalar>::Real result_type; typedef typename NumTraits<Scalar>::Real result_type;
const result_type operator() (const Scalar& a) const { return ei_abs(a); } inline const result_type operator() (const Scalar& a) const { return ei_abs(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_abs_op<Scalar> > struct ei_functor_traits<ei_scalar_abs_op<Scalar> >
@ -172,7 +172,7 @@ struct ei_functor_traits<ei_scalar_abs_op<Scalar> >
*/ */
template<typename Scalar> struct ei_scalar_abs2_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_abs2_op EIGEN_EMPTY_STRUCT {
typedef typename NumTraits<Scalar>::Real result_type; typedef typename NumTraits<Scalar>::Real result_type;
const result_type operator() (const Scalar& a) const { return ei_abs2(a); } inline const result_type operator() (const Scalar& a) const { return ei_abs2(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_abs2_op<Scalar> > struct ei_functor_traits<ei_scalar_abs2_op<Scalar> >
@ -184,7 +184,7 @@ struct ei_functor_traits<ei_scalar_abs2_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::conjugate() * \sa class CwiseUnaryOp, MatrixBase::conjugate()
*/ */
template<typename Scalar> struct ei_scalar_conjugate_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_conjugate_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return ei_conj(a); } inline const Scalar operator() (const Scalar& a) const { return ei_conj(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> > struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> >
@ -198,7 +198,7 @@ struct ei_functor_traits<ei_scalar_conjugate_op<Scalar> >
template<typename Scalar, typename NewType> template<typename Scalar, typename NewType>
struct ei_scalar_cast_op EIGEN_EMPTY_STRUCT { struct ei_scalar_cast_op EIGEN_EMPTY_STRUCT {
typedef NewType result_type; typedef NewType result_type;
const NewType operator() (const Scalar& a) const { return static_cast<NewType>(a); } inline const NewType operator() (const Scalar& a) const { return static_cast<NewType>(a); }
}; };
template<typename Scalar, typename NewType> template<typename Scalar, typename NewType>
struct ei_functor_traits<ei_scalar_cast_op<Scalar,NewType> > struct ei_functor_traits<ei_scalar_cast_op<Scalar,NewType> >
@ -215,16 +215,16 @@ template<typename Scalar, bool IsVectorizable = (int(ei_packet_traits<Scalar>::s
template<typename Scalar> template<typename Scalar>
struct ei_scalar_multiple_op<Scalar,true> { struct ei_scalar_multiple_op<Scalar,true> {
typedef typename ei_packet_traits<Scalar>::type PacketScalar; typedef typename ei_packet_traits<Scalar>::type PacketScalar;
ei_scalar_multiple_op(const Scalar& other) : m_other(ei_pset1(other)) { } inline ei_scalar_multiple_op(const Scalar& other) : m_other(ei_pset1(other)) { }
Scalar operator() (const Scalar& a) const { return a * ei_pfirst(m_other); } inline Scalar operator() (const Scalar& a) const { return a * ei_pfirst(m_other); }
PacketScalar packetOp(const PacketScalar& a) const inline const PacketScalar packetOp(const PacketScalar& a) const
{ return ei_pmul(a, m_other); } { return ei_pmul(a, m_other); }
const PacketScalar m_other; const PacketScalar m_other;
}; };
template<typename Scalar> template<typename Scalar>
struct ei_scalar_multiple_op<Scalar,false> { struct ei_scalar_multiple_op<Scalar,false> {
ei_scalar_multiple_op(const Scalar& other) : m_other(other) { } inline ei_scalar_multiple_op(const Scalar& other) : m_other(other) { }
Scalar operator() (const Scalar& a) const { return a * m_other; } inline Scalar operator() (const Scalar& a) const { return a * m_other; }
const Scalar m_other; const Scalar m_other;
}; };
template<typename Scalar> template<typename Scalar>
@ -233,8 +233,8 @@ struct ei_functor_traits<ei_scalar_multiple_op<Scalar> >
template<typename Scalar, bool HasFloatingPoint> template<typename Scalar, bool HasFloatingPoint>
struct ei_scalar_quotient1_impl { struct ei_scalar_quotient1_impl {
ei_scalar_quotient1_impl(const Scalar& other) : m_other(static_cast<Scalar>(1) / other) {} inline ei_scalar_quotient1_impl(const Scalar& other) : m_other(static_cast<Scalar>(1) / other) {}
Scalar operator() (const Scalar& a) const { return a * m_other; } inline Scalar operator() (const Scalar& a) const { return a * m_other; }
const Scalar m_other; const Scalar m_other;
}; };
template<typename Scalar> template<typename Scalar>
@ -243,8 +243,8 @@ struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,true> >
template<typename Scalar> template<typename Scalar>
struct ei_scalar_quotient1_impl<Scalar,false> { struct ei_scalar_quotient1_impl<Scalar,false> {
ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {} inline ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {}
Scalar operator() (const Scalar& a) const { return a / m_other; } inline Scalar operator() (const Scalar& a) const { return a / m_other; }
const Scalar m_other; const Scalar m_other;
enum { Cost = 2 * NumTraits<Scalar>::MulCost }; enum { Cost = 2 * NumTraits<Scalar>::MulCost };
}; };
@ -262,7 +262,7 @@ struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,false> >
*/ */
template<typename Scalar> template<typename Scalar>
struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint > { struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint > {
ei_scalar_quotient1_op(const Scalar& other) inline ei_scalar_quotient1_op(const Scalar& other)
: ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint >(other) {} : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint >(other) {}
}; };
@ -272,7 +272,7 @@ struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scala
* \sa class CwiseUnaryOp, MatrixBase::cwiseSqrt() * \sa class CwiseUnaryOp, MatrixBase::cwiseSqrt()
*/ */
template<typename Scalar> struct ei_scalar_sqrt_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_sqrt_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return ei_sqrt(a); } inline const Scalar operator() (const Scalar& a) const { return ei_sqrt(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> > struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> >
@ -284,7 +284,7 @@ struct ei_functor_traits<ei_scalar_sqrt_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::cwiseExp() * \sa class CwiseUnaryOp, MatrixBase::cwiseExp()
*/ */
template<typename Scalar> struct ei_scalar_exp_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_exp_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return ei_exp(a); } inline const Scalar operator() (const Scalar& a) const { return ei_exp(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_exp_op<Scalar> > struct ei_functor_traits<ei_scalar_exp_op<Scalar> >
@ -296,7 +296,7 @@ struct ei_functor_traits<ei_scalar_exp_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::cwiseLog() * \sa class CwiseUnaryOp, MatrixBase::cwiseLog()
*/ */
template<typename Scalar> struct ei_scalar_log_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_log_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return ei_log(a); } inline const Scalar operator() (const Scalar& a) const { return ei_log(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_log_op<Scalar> > struct ei_functor_traits<ei_scalar_log_op<Scalar> >
@ -308,7 +308,7 @@ struct ei_functor_traits<ei_scalar_log_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::cwiseCos() * \sa class CwiseUnaryOp, MatrixBase::cwiseCos()
*/ */
template<typename Scalar> struct ei_scalar_cos_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_cos_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return ei_cos(a); } inline const Scalar operator() (const Scalar& a) const { return ei_cos(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_cos_op<Scalar> > struct ei_functor_traits<ei_scalar_cos_op<Scalar> >
@ -320,7 +320,7 @@ struct ei_functor_traits<ei_scalar_cos_op<Scalar> >
* \sa class CwiseUnaryOp, MatrixBase::cwiseSin() * \sa class CwiseUnaryOp, MatrixBase::cwiseSin()
*/ */
template<typename Scalar> struct ei_scalar_sin_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_sin_op EIGEN_EMPTY_STRUCT {
const Scalar operator() (const Scalar& a) const { return ei_sin(a); } inline const Scalar operator() (const Scalar& a) const { return ei_sin(a); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_sin_op<Scalar> > struct ei_functor_traits<ei_scalar_sin_op<Scalar> >
@ -333,8 +333,8 @@ struct ei_functor_traits<ei_scalar_sin_op<Scalar> >
*/ */
template<typename Scalar> template<typename Scalar>
struct ei_scalar_pow_op { struct ei_scalar_pow_op {
ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} inline ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {}
Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); } inline Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); }
const Scalar m_exponent; const Scalar m_exponent;
}; };
template<typename Scalar> template<typename Scalar>
@ -348,16 +348,16 @@ template<typename Scalar, bool IsVectorizable = (int(ei_packet_traits<Scalar>::s
template<typename Scalar> template<typename Scalar>
struct ei_scalar_constant_op<Scalar,true> { struct ei_scalar_constant_op<Scalar,true> {
typedef typename ei_packet_traits<Scalar>::type PacketScalar; typedef typename ei_packet_traits<Scalar>::type PacketScalar;
ei_scalar_constant_op(const Scalar& other) : m_other(ei_pset1(other)) { } inline ei_scalar_constant_op(const Scalar& other) : m_other(ei_pset1(other)) { }
Scalar operator() (int, int) const { return ei_pfirst(m_other); } inline const Scalar operator() (int, int) const { return ei_pfirst(m_other); }
PacketScalar packetOp() const inline const PacketScalar packetOp() const
{ return m_other; } { return m_other; }
const PacketScalar m_other; const PacketScalar m_other;
}; };
template<typename Scalar> template<typename Scalar>
struct ei_scalar_constant_op<Scalar,false> { struct ei_scalar_constant_op<Scalar,false> {
ei_scalar_constant_op(const Scalar& other) : m_other(other) { } inline ei_scalar_constant_op(const Scalar& other) : m_other(other) { }
Scalar operator() (int, int) const { return m_other; } inline const Scalar operator() (int, int) const { return m_other; }
const Scalar m_other; const Scalar m_other;
}; };
template<typename Scalar> template<typename Scalar>
@ -366,8 +366,8 @@ struct ei_functor_traits<ei_scalar_constant_op<Scalar> >
template<typename Scalar> struct ei_scalar_random_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_random_op EIGEN_EMPTY_STRUCT {
ei_scalar_random_op(void) {} inline ei_scalar_random_op(void) {}
Scalar operator() (int, int) const { return ei_random<Scalar>(); } inline const Scalar operator() (int, int) const { return ei_random<Scalar>(); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_random_op<Scalar> > struct ei_functor_traits<ei_scalar_random_op<Scalar> >
@ -375,8 +375,8 @@ struct ei_functor_traits<ei_scalar_random_op<Scalar> >
template<typename Scalar> struct ei_scalar_identity_op EIGEN_EMPTY_STRUCT { template<typename Scalar> struct ei_scalar_identity_op EIGEN_EMPTY_STRUCT {
ei_scalar_identity_op(void) {} inline ei_scalar_identity_op(void) {}
Scalar operator() (int row, int col) const { return row==col ? Scalar(1) : Scalar(0); } inline const Scalar operator() (int row, int col) const { return row==col ? Scalar(1) : Scalar(0); }
}; };
template<typename Scalar> template<typename Scalar>
struct ei_functor_traits<ei_scalar_identity_op<Scalar> > struct ei_functor_traits<ei_scalar_identity_op<Scalar> >

View File

@ -58,22 +58,22 @@ template<typename ExpressionType> class Lazy
EIGEN_GENERIC_PUBLIC_INTERFACE(Lazy) EIGEN_GENERIC_PUBLIC_INTERFACE(Lazy)
Lazy(const ExpressionType& matrix) : m_expression(matrix) {} inline Lazy(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Lazy) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Lazy)
private: private:
int _rows() const { return m_expression.rows(); } inline int _rows() const { return m_expression.rows(); }
int _cols() const { return m_expression.cols(); } inline int _cols() const { return m_expression.cols(); }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_expression.coeff(row, col); return m_expression.coeff(row, col);
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline PacketScalar _packetCoeff(int row, int col) const
{ {
return m_expression.template packetCoeff<LoadMode>(row, col); return m_expression.template packetCoeff<LoadMode>(row, col);
} }
@ -88,7 +88,7 @@ template<typename ExpressionType> class Lazy
* Output: \verbinclude MatrixBase_lazy.out * Output: \verbinclude MatrixBase_lazy.out
*/ */
template<typename Derived> template<typename Derived>
const Lazy<Derived> inline const Lazy<Derived>
MatrixBase<Derived>::lazy() const MatrixBase<Derived>::lazy() const
{ {
return Lazy<Derived>(derived()); return Lazy<Derived>(derived());

View File

@ -61,10 +61,10 @@ template<typename MatrixType> class Map
private: private:
int _rows() const { return m_rows; } inline int _rows() const { return m_rows; }
int _cols() const { return m_cols; } inline int _cols() const { return m_cols; }
const Scalar& _coeff(int row, int col) const inline const Scalar& _coeff(int row, int col) const
{ {
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
return m_data[col + row * m_cols]; return m_data[col + row * m_cols];
@ -72,7 +72,7 @@ template<typename MatrixType> class Map
return m_data[row + col * m_rows]; return m_data[row + col * m_rows];
} }
Scalar& _coeffRef(int row, int col) inline Scalar& _coeffRef(int row, int col)
{ {
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
return const_cast<Scalar*>(m_data)[col + row * m_cols]; return const_cast<Scalar*>(m_data)[col + row * m_cols];
@ -81,7 +81,7 @@ template<typename MatrixType> class Map
} }
public: public:
Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols) inline Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols)
{ {
ei_assert(rows > 0 ei_assert(rows > 0
&& (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
@ -98,7 +98,7 @@ template<typename MatrixType> class Map
/** This is the const version of map(Scalar*,int,int). */ /** This is the const version of map(Scalar*,int,int). */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > inline const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> >
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data, int rows, int cols) Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data, int rows, int cols)
{ {
return Map<Matrix>(data, rows, cols); return Map<Matrix>(data, rows, cols);
@ -106,7 +106,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* dat
/** This is the const version of map(Scalar*,int). */ /** This is the const version of map(Scalar*,int). */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > inline const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> >
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data, int size) Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data, int size)
{ {
ei_assert(_Cols == 1 || _Rows ==1); ei_assert(_Cols == 1 || _Rows ==1);
@ -118,7 +118,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* dat
/** This is the const version of map(Scalar*). */ /** This is the const version of map(Scalar*). */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > inline const Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> >
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data) Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* data)
{ {
return Map<Matrix>(data, _Rows, _Cols); return Map<Matrix>(data, _Rows, _Cols);
@ -136,7 +136,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(const Scalar* dat
* \sa map(const Scalar*, int, int), map(Scalar*, int), map(Scalar*), class Map * \sa map(const Scalar*, int, int), map(Scalar*, int), map(Scalar*), class Map
*/ */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > inline Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> >
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int rows, int cols) Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int rows, int cols)
{ {
return Map<Matrix>(data, rows, cols); return Map<Matrix>(data, rows, cols);
@ -155,7 +155,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int
* \sa map(const Scalar*, int), map(Scalar*, int, int), map(Scalar*), class Map * \sa map(const Scalar*, int), map(Scalar*, int, int), map(Scalar*), class Map
*/ */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > inline Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> >
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int size) Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int size)
{ {
ei_assert(_Cols == 1 || _Rows ==1); ei_assert(_Cols == 1 || _Rows ==1);
@ -175,7 +175,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data, int
* \sa map(const Scalar*), map(Scalar*, int), map(Scalar*, int, int), class Map * \sa map(const Scalar*), map(Scalar*, int), map(Scalar*, int, int), class Map
*/ */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> > inline Map<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> >
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data) Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data)
{ {
return Map<Matrix>(data, _Rows, _Cols); return Map<Matrix>(data, _Rows, _Cols);
@ -190,7 +190,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>::map(Scalar* data)
* \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int, int) * \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int, int)
*/ */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> inline Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>
::Matrix(const Scalar *data, int rows, int cols) ::Matrix(const Scalar *data, int rows, int cols)
: m_storage(rows*cols, rows, cols) : m_storage(rows*cols, rows, cols)
{ {
@ -208,7 +208,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>
* \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int) * \sa Matrix(const Scalar *), Matrix::map(const Scalar *, int)
*/ */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> inline Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>
::Matrix(const Scalar *data, int size) ::Matrix(const Scalar *data, int size)
: m_storage(size, RowsAtCompileTime == 1 ? 1 : size, ColsAtCompileTime == 1 ? 1 : size) : m_storage(size, RowsAtCompileTime == 1 ? 1 : size, ColsAtCompileTime == 1 ? 1 : size)
{ {
@ -226,7 +226,7 @@ Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>
* Matrix::map(const Scalar *) * Matrix::map(const Scalar *)
*/ */
template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols> template<typename _Scalar, int _Rows, int _Cols, unsigned int _Flags, int _MaxRows, int _MaxCols>
Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols> inline Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows, _MaxCols>
::Matrix(const Scalar *data) ::Matrix(const Scalar *data)
{ {
*this = map(data); *this = map(data);

View File

@ -97,10 +97,10 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage; ei_matrix_storage<Scalar, MaxSizeAtCompileTime, RowsAtCompileTime, ColsAtCompileTime> m_storage;
int _rows() const { return m_storage.rows(); } inline int _rows() const { return m_storage.rows(); }
int _cols() const { return m_storage.cols(); } inline int _cols() const { return m_storage.cols(); }
int _stride(void) const inline int _stride(void) const
{ {
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
return m_storage.cols(); return m_storage.cols();
@ -108,7 +108,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
return m_storage.rows(); return m_storage.rows();
} }
const Scalar& _coeff(int row, int col) const inline const Scalar& _coeff(int row, int col) const
{ {
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
return m_storage.data()[col + row * m_storage.cols()]; return m_storage.data()[col + row * m_storage.cols()];
@ -116,7 +116,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
return m_storage.data()[row + col * m_storage.rows()]; return m_storage.data()[row + col * m_storage.rows()];
} }
Scalar& _coeffRef(int row, int col) inline Scalar& _coeffRef(int row, int col)
{ {
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
return m_storage.data()[col + row * m_storage.cols()]; return m_storage.data()[col + row * m_storage.cols()];
@ -125,7 +125,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline PacketScalar _packetCoeff(int row, int col) const
{ {
ei_internal_assert(Flags & VectorizableBit); ei_internal_assert(Flags & VectorizableBit);
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
@ -141,7 +141,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
} }
template<int StoreMode> template<int StoreMode>
void _writePacketCoeff(int row, int col, const PacketScalar& x) inline void _writePacketCoeff(int row, int col, const PacketScalar& x)
{ {
ei_internal_assert(Flags & VectorizableBit); ei_internal_assert(Flags & VectorizableBit);
if(Flags & RowMajorBit) if(Flags & RowMajorBit)
@ -158,14 +158,14 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
public: public:
/** \returns a const pointer to the data array of this matrix */ /** \returns a const pointer to the data array of this matrix */
const Scalar *data() const inline const Scalar *data() const
{ return m_storage.data(); } { return m_storage.data(); }
/** \returns a pointer to the data array of this matrix */ /** \returns a pointer to the data array of this matrix */
Scalar *data() inline Scalar *data()
{ return m_storage.data(); } { return m_storage.data(); }
void resize(int rows, int cols) inline void resize(int rows, int cols)
{ {
ei_assert(rows > 0 ei_assert(rows > 0
&& (MaxRowsAtCompileTime == Dynamic || MaxRowsAtCompileTime >= rows) && (MaxRowsAtCompileTime == Dynamic || MaxRowsAtCompileTime >= rows)
@ -185,7 +185,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
* row-vectors remain row-vectors and vectors remain vectors. * row-vectors remain row-vectors and vectors remain vectors.
*/ */
template<typename OtherDerived> template<typename OtherDerived>
Matrix& operator=(const MatrixBase<OtherDerived>& other) inline Matrix& operator=(const MatrixBase<OtherDerived>& other)
{ {
if(RowsAtCompileTime == 1) if(RowsAtCompileTime == 1)
{ {
@ -204,7 +204,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
/** This is a special case of the templated operator=. Its purpose is to /** This is a special case of the templated operator=. Its purpose is to
* prevent a default operator= from hiding the templated operator=. * prevent a default operator= from hiding the templated operator=.
*/ */
Matrix& operator=(const Matrix& other) inline Matrix& operator=(const Matrix& other)
{ {
return operator=<Matrix>(other); return operator=<Matrix>(other);
} }
@ -225,7 +225,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
* For dynamic-size matrices and vectors, this constructor is forbidden (guarded by * For dynamic-size matrices and vectors, this constructor is forbidden (guarded by
* an assertion) because it would leave the matrix without an allocated data buffer. * an assertion) because it would leave the matrix without an allocated data buffer.
*/ */
explicit Matrix() inline explicit Matrix()
{ {
ei_assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0); ei_assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0);
} }
@ -236,7 +236,8 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
* it is redundant to pass the dimension here, so it makes more sense to use the default * it is redundant to pass the dimension here, so it makes more sense to use the default
* constructor Matrix() instead. * constructor Matrix() instead.
*/ */
explicit Matrix(int dim) : m_storage(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) inline explicit Matrix(int dim)
: m_storage(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim)
{ {
ei_assert(dim > 0); ei_assert(dim > 0);
ei_assert((RowsAtCompileTime == 1 ei_assert((RowsAtCompileTime == 1
@ -255,7 +256,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
* it is redundant to pass these parameters, so one should use the default constructor * it is redundant to pass these parameters, so one should use the default constructor
* Matrix() instead. * Matrix() instead.
*/ */
Matrix(int x, int y) : m_storage(x*y, x, y) inline Matrix(int x, int y) : m_storage(x*y, x, y)
{ {
if((RowsAtCompileTime == 1 && ColsAtCompileTime == 2) if((RowsAtCompileTime == 1 && ColsAtCompileTime == 2)
|| (RowsAtCompileTime == 2 && ColsAtCompileTime == 1)) || (RowsAtCompileTime == 2 && ColsAtCompileTime == 1))
@ -270,7 +271,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
} }
} }
/** constructs an initialized 2D vector with given coefficients */ /** constructs an initialized 2D vector with given coefficients */
Matrix(const float& x, const float& y) inline Matrix(const float& x, const float& y)
{ {
ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 2) ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 2)
|| (RowsAtCompileTime == 2 && ColsAtCompileTime == 1)); || (RowsAtCompileTime == 2 && ColsAtCompileTime == 1));
@ -278,7 +279,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
m_storage.data()[1] = y; m_storage.data()[1] = y;
} }
/** constructs an initialized 2D vector with given coefficients */ /** constructs an initialized 2D vector with given coefficients */
Matrix(const double& x, const double& y) inline Matrix(const double& x, const double& y)
{ {
ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 2) ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 2)
|| (RowsAtCompileTime == 2 && ColsAtCompileTime == 1)); || (RowsAtCompileTime == 2 && ColsAtCompileTime == 1));
@ -286,7 +287,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
m_storage.data()[1] = y; m_storage.data()[1] = y;
} }
/** constructs an initialized 3D vector with given coefficients */ /** constructs an initialized 3D vector with given coefficients */
Matrix(const Scalar& x, const Scalar& y, const Scalar& z) inline Matrix(const Scalar& x, const Scalar& y, const Scalar& z)
{ {
ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 3) ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 3)
|| (RowsAtCompileTime == 3 && ColsAtCompileTime == 1)); || (RowsAtCompileTime == 3 && ColsAtCompileTime == 1));
@ -295,7 +296,7 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
m_storage.data()[2] = z; m_storage.data()[2] = z;
} }
/** constructs an initialized 4D vector with given coefficients */ /** constructs an initialized 4D vector with given coefficients */
Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) inline Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w)
{ {
ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 4) ei_assert((RowsAtCompileTime == 1 && ColsAtCompileTime == 4)
|| (RowsAtCompileTime == 4 && ColsAtCompileTime == 1)); || (RowsAtCompileTime == 4 && ColsAtCompileTime == 1));
@ -310,19 +311,19 @@ class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Flags, _MaxRows,
/** Constructor copying the value of the expression \a other */ /** Constructor copying the value of the expression \a other */
template<typename OtherDerived> template<typename OtherDerived>
Matrix(const MatrixBase<OtherDerived>& other) inline Matrix(const MatrixBase<OtherDerived>& other)
: m_storage(other.rows() * other.cols(), other.rows(), other.cols()) : m_storage(other.rows() * other.cols(), other.rows(), other.cols())
{ {
Base::lazyAssign(other.derived()); Base::lazyAssign(other.derived());
} }
/** Copy constructor */ /** Copy constructor */
Matrix(const Matrix& other) inline Matrix(const Matrix& other)
: m_storage(other.rows() * other.cols(), other.rows(), other.cols()) : m_storage(other.rows() * other.cols(), other.rows(), other.cols())
{ {
Base::lazyAssign(other); Base::lazyAssign(other);
} }
/** Destructor */ /** Destructor */
~Matrix() {} inline ~Matrix() {}
}; };
#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \

View File

@ -151,17 +151,17 @@ template<typename Derived> class MatrixBase
/// \name Run-time traits /// \name Run-time traits
//@{ //@{
/** \returns the number of rows. \sa cols(), RowsAtCompileTime */ /** \returns the number of rows. \sa cols(), RowsAtCompileTime */
int rows() const { return derived()._rows(); } inline int rows() const { return derived()._rows(); }
/** \returns the number of columns. \sa row(), ColsAtCompileTime*/ /** \returns the number of columns. \sa row(), ColsAtCompileTime*/
int cols() const { return derived()._cols(); } inline int cols() const { return derived()._cols(); }
/** \returns the number of coefficients, which is \a rows()*cols(). /** \returns the number of coefficients, which is \a rows()*cols().
* \sa rows(), cols(), SizeAtCompileTime. */ * \sa rows(), cols(), SizeAtCompileTime. */
int size() const { return rows() * cols(); } inline int size() const { return rows() * cols(); }
/** \returns true if either the number of rows or the number of columns is equal to 1. /** \returns true if either the number of rows or the number of columns is equal to 1.
* In other words, this function returns * In other words, this function returns
* \code rows()==1 || cols()==1 \endcode * \code rows()==1 || cols()==1 \endcode
* \sa rows(), cols(), IsVectorAtCompileTime. */ * \sa rows(), cols(), IsVectorAtCompileTime. */
bool isVector() const { return rows()==1 || cols()==1; } inline bool isVector() const { return rows()==1 || cols()==1; }
//@} //@}
/// \name Copying and initialization /// \name Copying and initialization
@ -178,7 +178,7 @@ template<typename Derived> class MatrixBase
/** Special case of the template operator=, in order to prevent the compiler /** Special case of the template operator=, in order to prevent the compiler
* from generating a default operator= (issue hit with g++ 4.1) * from generating a default operator= (issue hit with g++ 4.1)
*/ */
Derived& operator=(const MatrixBase& other) inline Derived& operator=(const MatrixBase& other)
{ {
return this->operator=<Derived>(other); return this->operator=<Derived>(other);
} }
@ -208,9 +208,9 @@ template<typename Derived> class MatrixBase
Scalar& operator[](int index); Scalar& operator[](int index);
template<int LoadMode> template<int LoadMode>
PacketScalar packetCoeff(int row, int col) const { return derived().template _packetCoeff<LoadMode>(row,col); } PacketScalar packetCoeff(int row, int col) const;
template<int StoreMode> template<int StoreMode>
void writePacketCoeff(int row, int col, const PacketScalar& x) { return derived().template _writePacketCoeff<StoreMode>(row,col,x); } void writePacketCoeff(int row, int col, const PacketScalar& x);
const Scalar x() const; const Scalar x() const;
const Scalar y() const; const Scalar y() const;
@ -244,10 +244,12 @@ template<typename Derived> class MatrixBase
Derived& operator*=(const Scalar& other); Derived& operator*=(const Scalar& other);
Derived& operator/=(const Scalar& other); Derived& operator/=(const Scalar& other);
const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> operator*(const Scalar& scalar) const; const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived> operator/(const Scalar& scalar) const; operator*(const Scalar& scalar) const;
const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
operator/(const Scalar& scalar) const;
friend const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived> inline friend const CwiseUnaryOp<ei_scalar_multiple_op<typename ei_traits<Derived>::Scalar>, Derived>
operator*(const Scalar& scalar, const MatrixBase& matrix) operator*(const Scalar& scalar, const MatrixBase& matrix)
{ return matrix*scalar; } { return matrix*scalar; }
//@} //@}
@ -396,11 +398,11 @@ template<typename Derived> class MatrixBase
bool isOrtho(RealScalar prec = precision<Scalar>()) const; bool isOrtho(RealScalar prec = precision<Scalar>()) const;
template<typename OtherDerived> template<typename OtherDerived>
bool operator==(const MatrixBase<OtherDerived>& other) const inline bool operator==(const MatrixBase<OtherDerived>& other) const
{ return derived().cwiseEqualTo(other.derived()).all(); } { return derived().cwiseEqualTo(other.derived()).all(); }
template<typename OtherDerived> template<typename OtherDerived>
bool operator!=(const MatrixBase<OtherDerived>& other) const inline bool operator!=(const MatrixBase<OtherDerived>& other) const
{ return derived().cwiseNotEqualTo(other.derived()).all(); } { return derived().cwiseNotEqualTo(other.derived()).all(); }
//@} //@}
@ -409,7 +411,7 @@ template<typename Derived> class MatrixBase
template<typename NewType> template<typename NewType>
const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const; const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const;
EIGEN_INLINE const typename ei_eval<Derived>::type eval() const EIGEN_ALWAYS_INLINE const typename ei_eval<Derived>::type eval() const
{ {
return typename ei_eval<Derived>::type(derived()); return typename ei_eval<Derived>::type(derived());
} }
@ -522,9 +524,9 @@ template<typename Derived> class MatrixBase
/// \name Casting to the derived type /// \name Casting to the derived type
//@{ //@{
const Derived& derived() const { return *static_cast<const Derived*>(this); } inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
Derived& derived() { return *static_cast<Derived*>(this); } inline Derived& derived() { return *static_cast<Derived*>(this); }
Derived& const_cast_derived() const inline Derived& const_cast_derived() const
{ return *static_cast<Derived*>(const_cast<MatrixBase*>(this)); } { return *static_cast<Derived*>(const_cast<MatrixBase*>(this)); }
//@} //@}
@ -562,13 +564,6 @@ template<typename Derived> class MatrixBase
const QR<typename ei_eval<Derived>::type> qr() const; const QR<typename ei_eval<Derived>::type> qr() const;
//@} //@}
private:
template<int LoadMode>
PacketScalar _packetCoeff(int , int) const { ei_internal_assert(false && "_packetCoeff not defined"); }
template<int StoreMode>
void _writePacketCoeff(int , int, const PacketScalar&) { ei_internal_assert(false && "_packetCoeff not defined"); }
}; };
#endif // EIGEN_MATRIXBASE_H #endif // EIGEN_MATRIXBASE_H

View File

@ -50,7 +50,7 @@ template <typename T, int Size> struct ei_aligned_array<T,Size,false>
}; };
template<typename T> template<typename T>
T* ei_aligned_malloc(size_t size) inline T* ei_aligned_malloc(size_t size)
{ {
#ifdef EIGEN_VECTORIZE #ifdef EIGEN_VECTORIZE
if (ei_packet_traits<T>::size>1) if (ei_packet_traits<T>::size>1)
@ -67,7 +67,7 @@ T* ei_aligned_malloc(size_t size)
} }
template<typename T> template<typename T>
void ei_aligned_free(T* ptr) inline void ei_aligned_free(T* ptr)
{ {
#ifdef EIGEN_VECTORIZE #ifdef EIGEN_VECTORIZE
if (ei_packet_traits<T>::size>1) if (ei_packet_traits<T>::size>1)
@ -82,13 +82,13 @@ template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage
{ {
ei_aligned_array<T,Size,((Size*sizeof(T))%16)==0> m_data; ei_aligned_array<T,Size,((Size*sizeof(T))%16)==0> m_data;
public: public:
ei_matrix_storage() {} inline ei_matrix_storage() {}
ei_matrix_storage(int,int,int) {} inline ei_matrix_storage(int,int,int) {}
static int rows(void) {return _Rows;} inline static int rows(void) {return _Rows;}
static int cols(void) {return _Cols;} inline static int cols(void) {return _Cols;}
void resize(int,int,int) {} inline void resize(int,int,int) {}
const T *data() const { return m_data.array; } inline const T *data() const { return m_data.array; }
T *data() { return m_data.array; } inline T *data() { return m_data.array; }
}; };
// dynamic-size matrix with fixed-size storage // dynamic-size matrix with fixed-size storage
@ -98,17 +98,17 @@ template<typename T, int Size> class ei_matrix_storage<T, Size, Dynamic, Dynamic
int m_rows; int m_rows;
int m_cols; int m_cols;
public: public:
ei_matrix_storage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {} inline ei_matrix_storage(int, int rows, int cols) : m_rows(rows), m_cols(cols) {}
~ei_matrix_storage() {} inline ~ei_matrix_storage() {}
int rows(void) const {return m_rows;} inline int rows(void) const {return m_rows;}
int cols(void) const {return m_cols;} inline int cols(void) const {return m_cols;}
void resize(int, int rows, int cols) inline void resize(int, int rows, int cols)
{ {
m_rows = rows; m_rows = rows;
m_cols = cols; m_cols = cols;
} }
const T *data() const { return m_data; } inline const T *data() const { return m_data; }
T *data() { return m_data; } inline T *data() { return m_data; }
}; };
// dynamic-size matrix with fixed-size storage and fixed width // dynamic-size matrix with fixed-size storage and fixed width
@ -117,16 +117,16 @@ template<typename T, int Size, int _Cols> class ei_matrix_storage<T, Size, Dynam
T m_data[Size]; T m_data[Size];
int m_rows; int m_rows;
public: public:
ei_matrix_storage(int, int rows, int) : m_rows(rows) {} inline ei_matrix_storage(int, int rows, int) : m_rows(rows) {}
~ei_matrix_storage() {} inline ~ei_matrix_storage() {}
int rows(void) const {return m_rows;} inline int rows(void) const {return m_rows;}
int cols(void) const {return _Cols;} inline int cols(void) const {return _Cols;}
void resize(int size, int rows, int) inline void resize(int size, int rows, int)
{ {
m_rows = rows; m_rows = rows;
} }
const T *data() const { return m_data; } inline const T *data() const { return m_data; }
T *data() { return m_data; } inline T *data() { return m_data; }
}; };
// dynamic-size matrix with fixed-size storage and fixed height // dynamic-size matrix with fixed-size storage and fixed height
@ -135,16 +135,16 @@ template<typename T, int Size, int _Rows> class ei_matrix_storage<T, Size, _Rows
T m_data[Size]; T m_data[Size];
int m_cols; int m_cols;
public: public:
ei_matrix_storage(int, int, int cols) : m_cols(cols) {} inline ei_matrix_storage(int, int, int cols) : m_cols(cols) {}
~ei_matrix_storage() {} inline ~ei_matrix_storage() {}
int rows(void) const {return _Rows;} inline int rows(void) const {return _Rows;}
int cols(void) const {return m_cols;} inline int cols(void) const {return m_cols;}
void resize(int size, int, int cols) inline void resize(int size, int, int cols)
{ {
m_cols = cols; m_cols = cols;
} }
const T *data() const { return m_data; } inline const T *data() const { return m_data; }
T *data() { return m_data; } inline T *data() { return m_data; }
}; };
// purely dynamic matrix. // purely dynamic matrix.
@ -154,11 +154,11 @@ template<typename T> class ei_matrix_storage<T, Dynamic, Dynamic, Dynamic>
int m_rows; int m_rows;
int m_cols; int m_cols;
public: public:
ei_matrix_storage(int size, int rows, int cols) inline ei_matrix_storage(int size, int rows, int cols)
: m_data(ei_aligned_malloc<T>(size)), m_rows(rows), m_cols(cols) {} : m_data(ei_aligned_malloc<T>(size)), m_rows(rows), m_cols(cols) {}
~ei_matrix_storage() { delete[] m_data; } inline ~ei_matrix_storage() { delete[] m_data; }
int rows(void) const {return m_rows;} inline int rows(void) const {return m_rows;}
int cols(void) const {return m_cols;} inline int cols(void) const {return m_cols;}
void resize(int size, int rows, int cols) void resize(int size, int rows, int cols)
{ {
if(size != m_rows*m_cols) if(size != m_rows*m_cols)
@ -169,8 +169,8 @@ template<typename T> class ei_matrix_storage<T, Dynamic, Dynamic, Dynamic>
m_rows = rows; m_rows = rows;
m_cols = cols; m_cols = cols;
} }
const T *data() const { return m_data; } inline const T *data() const { return m_data; }
T *data() { return m_data; } inline T *data() { return m_data; }
}; };
// matrix with dynamic width and fixed height (so that matrix has dynamic size). // matrix with dynamic width and fixed height (so that matrix has dynamic size).
@ -179,10 +179,10 @@ template<typename T, int _Rows> class ei_matrix_storage<T, Dynamic, _Rows, Dynam
T *m_data; T *m_data;
int m_cols; int m_cols;
public: public:
ei_matrix_storage(int size, int, int cols) : m_data(ei_aligned_malloc<T>(size)), m_cols(cols) {} inline ei_matrix_storage(int size, int, int cols) : m_data(ei_aligned_malloc<T>(size)), m_cols(cols) {}
~ei_matrix_storage() { delete[] m_data; } inline ~ei_matrix_storage() { delete[] m_data; }
static int rows(void) {return _Rows;} inline static int rows(void) {return _Rows;}
int cols(void) const {return m_cols;} inline int cols(void) const {return m_cols;}
void resize(int size, int, int cols) void resize(int size, int, int cols)
{ {
if(size != _Rows*m_cols) if(size != _Rows*m_cols)
@ -192,8 +192,8 @@ template<typename T, int _Rows> class ei_matrix_storage<T, Dynamic, _Rows, Dynam
} }
m_cols = cols; m_cols = cols;
} }
const T *data() const { return m_data; } inline const T *data() const { return m_data; }
T *data() { return m_data; } inline T *data() { return m_data; }
}; };
// matrix with dynamic height and fixed width (so that matrix has dynamic size). // matrix with dynamic height and fixed width (so that matrix has dynamic size).
@ -202,10 +202,10 @@ template<typename T, int _Cols> class ei_matrix_storage<T, Dynamic, Dynamic, _Co
T *m_data; T *m_data;
int m_rows; int m_rows;
public: public:
ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_malloc<T>(size)), m_rows(rows) {} inline ei_matrix_storage(int size, int rows, int) : m_data(ei_aligned_malloc<T>(size)), m_rows(rows) {}
~ei_matrix_storage() { delete[] m_data; } inline ~ei_matrix_storage() { delete[] m_data; }
int rows(void) const {return m_rows;} inline int rows(void) const {return m_rows;}
static int cols(void) {return _Cols;} inline static int cols(void) {return _Cols;}
void resize(int size, int rows, int) void resize(int size, int rows, int)
{ {
if(size != m_rows*_Cols) if(size != m_rows*_Cols)
@ -215,8 +215,8 @@ template<typename T, int _Cols> class ei_matrix_storage<T, Dynamic, Dynamic, _Co
} }
m_rows = rows; m_rows = rows;
} }
const T *data() const { return m_data; } inline const T *data() const { return m_data; }
T *data() { return m_data; } inline T *data() { return m_data; }
}; };
#endif // EIGEN_MATRIX_H #endif // EIGEN_MATRIX_H

View File

@ -64,7 +64,7 @@ template<typename MatrixType> class Minor
EIGEN_GENERIC_PUBLIC_INTERFACE(Minor) EIGEN_GENERIC_PUBLIC_INTERFACE(Minor)
Minor(const MatrixType& matrix, inline Minor(const MatrixType& matrix,
int row, int col) int row, int col)
: m_matrix(matrix), m_row(row), m_col(col) : m_matrix(matrix), m_row(row), m_col(col)
{ {
@ -76,15 +76,15 @@ template<typename MatrixType> class Minor
private: private:
int _rows() const { return m_matrix.rows() - 1; } inline int _rows() const { return m_matrix.rows() - 1; }
int _cols() const { return m_matrix.cols() - 1; } inline int _cols() const { return m_matrix.cols() - 1; }
Scalar& _coeffRef(int row, int col) inline Scalar& _coeffRef(int row, int col)
{ {
return m_matrix.const_cast_derived().coeffRef(row + (row >= m_row), col + (col >= m_col)); return m_matrix.const_cast_derived().coeffRef(row + (row >= m_row), col + (col >= m_col));
} }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_matrix.coeff(row + (row >= m_row), col + (col >= m_col)); return m_matrix.coeff(row + (row >= m_row), col + (col >= m_col));
} }
@ -104,7 +104,7 @@ template<typename MatrixType> class Minor
* \sa class Minor * \sa class Minor
*/ */
template<typename Derived> template<typename Derived>
Minor<Derived> inline Minor<Derived>
MatrixBase<Derived>::minor(int row, int col) MatrixBase<Derived>::minor(int row, int col)
{ {
return Minor<Derived>(derived(), row, col); return Minor<Derived>(derived(), row, col);
@ -112,7 +112,7 @@ MatrixBase<Derived>::minor(int row, int col)
/** This is the const version of minor(). */ /** This is the const version of minor(). */
template<typename Derived> template<typename Derived>
const Minor<Derived> inline const Minor<Derived>
MatrixBase<Derived>::minor(int row, int col) const MatrixBase<Derived>::minor(int row, int col) const
{ {
return Minor<Derived>(derived(), row, col); return Minor<Derived>(derived(), row, col);

View File

@ -29,7 +29,7 @@
template<int Index, int Size, typename Lhs, typename Rhs> template<int Index, int Size, typename Lhs, typename Rhs>
struct ei_product_unroller struct ei_product_unroller
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs,
typename Lhs::Scalar &res) typename Lhs::Scalar &res)
{ {
ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res); ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res);
@ -40,7 +40,7 @@ struct ei_product_unroller
template<int Size, typename Lhs, typename Rhs> template<int Size, typename Lhs, typename Rhs>
struct ei_product_unroller<0, Size, Lhs, Rhs> struct ei_product_unroller<0, Size, Lhs, Rhs>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs,
typename Lhs::Scalar &res) typename Lhs::Scalar &res)
{ {
res = lhs.coeff(row, 0) * rhs.coeff(0, col); res = lhs.coeff(row, 0) * rhs.coeff(0, col);
@ -50,14 +50,14 @@ struct ei_product_unroller<0, Size, Lhs, Rhs>
template<int Index, typename Lhs, typename Rhs> template<int Index, typename Lhs, typename Rhs>
struct ei_product_unroller<Index, Dynamic, Lhs, Rhs> struct ei_product_unroller<Index, Dynamic, Lhs, Rhs>
{ {
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<int Index, typename Lhs, typename Rhs> template<int Index, typename Lhs, typename Rhs>
struct ei_product_unroller<Index, 0, Lhs, Rhs> struct ei_product_unroller<Index, 0, Lhs, Rhs>
{ {
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
}; };
template<typename Lhs, typename Rhs> template<typename Lhs, typename Rhs>
@ -72,7 +72,7 @@ struct ei_packet_product_unroller;
template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
ei_packet_product_unroller<true, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); ei_packet_product_unroller<true, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res);
res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packetCoeff<Aligned>(Index, col), res); res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packetCoeff<Aligned>(Index, col), res);
@ -82,7 +82,7 @@ struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar>
template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
ei_packet_product_unroller<false, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); ei_packet_product_unroller<false, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res);
res = ei_pmadd(lhs.template packetCoeff<Aligned>(row, Index), ei_pset1(rhs.coeff(Index, col)), res); res = ei_pmadd(lhs.template packetCoeff<Aligned>(row, Index), ei_pset1(rhs.coeff(Index, col)), res);
@ -92,7 +92,7 @@ struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar>
template<int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packetCoeff<Aligned>(0, col)); res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packetCoeff<Aligned>(0, col));
} }
@ -101,7 +101,7 @@ struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar>
template<int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
res = ei_pmul(lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(rhs.coeff(0, col))); res = ei_pmul(lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(rhs.coeff(0, col)));
} }
@ -110,13 +110,13 @@ struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar>
template<bool RowMajor, int Index, typename Lhs, typename Rhs, typename PacketScalar> template<bool RowMajor, int Index, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<RowMajor, Index, Dynamic, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<RowMajor, Index, Dynamic, Lhs, Rhs, PacketScalar>
{ {
static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {}
}; };
template<int Index, typename Lhs, typename Rhs, typename PacketScalar> template<int Index, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<false, Index, Dynamic, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<false, Index, Dynamic, Lhs, Rhs, PacketScalar>
{ {
static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {}
}; };
template<typename Lhs, typename Rhs, typename PacketScalar> template<typename Lhs, typename Rhs, typename PacketScalar>
@ -207,7 +207,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
typedef typename ei_traits<Product>::_LhsNested _LhsNested; typedef typename ei_traits<Product>::_LhsNested _LhsNested;
typedef typename ei_traits<Product>::_RhsNested _RhsNested; typedef typename ei_traits<Product>::_RhsNested _RhsNested;
Product(const Lhs& lhs, const Rhs& rhs) inline Product(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs) : m_lhs(lhs), m_rhs(rhs)
{ {
ei_assert(lhs.cols() == rhs.rows()); ei_assert(lhs.cols() == rhs.rows());
@ -223,8 +223,8 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
private: private:
int _rows() const { return m_lhs.rows(); } inline int _rows() const { return m_lhs.rows(); }
int _cols() const { return m_rhs.cols(); } inline int _cols() const { return m_rhs.cols(); }
const Scalar _coeff(int row, int col) const const Scalar _coeff(int row, int col) const
{ {
@ -247,7 +247,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const const PacketScalar _packetCoeff(int row, int col) const
{ {
if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT) if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT)
{ {
@ -263,7 +263,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
return ProductPacketCoeffImpl<Product,Flags&RowMajorBit>::execute(*this, row, col); return ProductPacketCoeffImpl<Product,Flags&RowMajorBit>::execute(*this, row, col);
} }
PacketScalar _packetCoeffRowMajor(int row, int col) const const PacketScalar _packetCoeffRowMajor(int row, int col) const
{ {
PacketScalar res; PacketScalar res;
res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packetCoeff<Aligned>(0, col)); res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packetCoeff<Aligned>(0, col));
@ -272,7 +272,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
return res; return res;
} }
PacketScalar _packetCoeffColumnMajor(int row, int col) const const PacketScalar _packetCoeffColumnMajor(int row, int col) const
{ {
PacketScalar res; PacketScalar res;
res = ei_pmul(m_lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(m_rhs.coeff(0, col))); res = ei_pmul(m_lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(m_rhs.coeff(0, col)));
@ -304,7 +304,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const Product<Derived,OtherDerived> inline const Product<Derived,OtherDerived>
MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
{ {
return Product<Derived,OtherDerived>(derived(), other.derived()); return Product<Derived,OtherDerived>(derived(), other.derived());
@ -316,7 +316,7 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & inline Derived &
MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other)
{ {
return *this = *this * other; return *this = *this * other;
@ -324,7 +324,7 @@ MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other)
template<typename Derived> template<typename Derived>
template<typename Lhs, typename Rhs> template<typename Lhs, typename Rhs>
Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product) inline Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product)
{ {
product.template _cacheOptimalEval<Derived, Aligned>(derived(), product.template _cacheOptimalEval<Derived, Aligned>(derived(),
#ifdef EIGEN_VECTORIZE #ifdef EIGEN_VECTORIZE

View File

@ -31,7 +31,7 @@
template<int Index, int Size, typename Lhs, typename Rhs> template<int Index, int Size, typename Lhs, typename Rhs>
struct ei_product_unroller struct ei_product_unroller
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs,
typename Lhs::Scalar &res) typename Lhs::Scalar &res)
{ {
ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res); ei_product_unroller<Index-1, Size, Lhs, Rhs>::run(row, col, lhs, rhs, res);
@ -42,7 +42,7 @@ struct ei_product_unroller
template<int Size, typename Lhs, typename Rhs> template<int Size, typename Lhs, typename Rhs>
struct ei_product_unroller<0, Size, Lhs, Rhs> struct ei_product_unroller<0, Size, Lhs, Rhs>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs,
typename Lhs::Scalar &res) typename Lhs::Scalar &res)
{ {
res = lhs.coeff(row, 0) * rhs.coeff(0, col); res = lhs.coeff(row, 0) * rhs.coeff(0, col);
@ -52,14 +52,14 @@ struct ei_product_unroller<0, Size, Lhs, Rhs>
template<int Index, typename Lhs, typename Rhs> template<int Index, typename Lhs, typename Rhs>
struct ei_product_unroller<Index, Dynamic, Lhs, Rhs> struct ei_product_unroller<Index, Dynamic, Lhs, Rhs>
{ {
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
}; };
// prevent buggy user code from causing an infinite recursion // prevent buggy user code from causing an infinite recursion
template<int Index, typename Lhs, typename Rhs> template<int Index, typename Lhs, typename Rhs>
struct ei_product_unroller<Index, 0, Lhs, Rhs> struct ei_product_unroller<Index, 0, Lhs, Rhs>
{ {
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
}; };
template<bool RowMajor, int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> template<bool RowMajor, int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar>
@ -68,7 +68,7 @@ struct ei_packet_product_unroller;
template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
ei_packet_product_unroller<true, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); ei_packet_product_unroller<true, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res);
res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packetCoeff<Aligned>(Index, col), res); res = ei_pmadd(ei_pset1(lhs.coeff(row, Index)), rhs.template packetCoeff<Aligned>(Index, col), res);
@ -78,7 +78,7 @@ struct ei_packet_product_unroller<true, Index, Size, Lhs, Rhs, PacketScalar>
template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Index, int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
ei_packet_product_unroller<false, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res); ei_packet_product_unroller<false, Index-1, Size, Lhs, Rhs, PacketScalar>::run(row, col, lhs, rhs, res);
res = ei_pmadd(lhs.template packetCoeff<Aligned>(row, Index), ei_pset1(rhs.coeff(Index, col)), res); res = ei_pmadd(lhs.template packetCoeff<Aligned>(row, Index), ei_pset1(rhs.coeff(Index, col)), res);
@ -88,7 +88,7 @@ struct ei_packet_product_unroller<false, Index, Size, Lhs, Rhs, PacketScalar>
template<int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packetCoeff<Aligned>(0, col)); res = ei_pmul(ei_pset1(lhs.coeff(row, 0)),rhs.template packetCoeff<Aligned>(0, col));
} }
@ -97,7 +97,7 @@ struct ei_packet_product_unroller<true, 0, Size, Lhs, Rhs, PacketScalar>
template<int Size, typename Lhs, typename Rhs, typename PacketScalar> template<int Size, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar>
{ {
static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res) inline static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, PacketScalar &res)
{ {
res = ei_pmul(lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(rhs.coeff(0, col))); res = ei_pmul(lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(rhs.coeff(0, col)));
} }
@ -106,13 +106,13 @@ struct ei_packet_product_unroller<false, 0, Size, Lhs, Rhs, PacketScalar>
template<bool RowMajor, int Index, typename Lhs, typename Rhs, typename PacketScalar> template<bool RowMajor, int Index, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<RowMajor, Index, Dynamic, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<RowMajor, Index, Dynamic, Lhs, Rhs, PacketScalar>
{ {
static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {}
}; };
template<int Index, typename Lhs, typename Rhs, typename PacketScalar> template<int Index, typename Lhs, typename Rhs, typename PacketScalar>
struct ei_packet_product_unroller<false, Index, Dynamic, Lhs, Rhs, PacketScalar> struct ei_packet_product_unroller<false, Index, Dynamic, Lhs, Rhs, PacketScalar>
{ {
static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {} inline static void run(int, int, const Lhs&, const Rhs&, PacketScalar&) {}
}; };
template<typename Product, bool RowMajor = true> struct ProductPacketCoeffImpl { template<typename Product, bool RowMajor = true> struct ProductPacketCoeffImpl {
@ -260,7 +260,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
PacketSize = ei_packet_traits<Scalar>::size PacketSize = ei_packet_traits<Scalar>::size
}; };
Product(const Lhs& lhs, const Rhs& rhs) inline Product(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs) : m_lhs(lhs), m_rhs(rhs)
{ {
ei_assert(lhs.cols() == rhs.rows()); ei_assert(lhs.cols() == rhs.rows());
@ -272,8 +272,8 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
private: private:
int _rows() const { return m_lhs.rows(); } inline int _rows() const { return m_lhs.rows(); }
int _cols() const { return m_rhs.cols(); } inline int _cols() const { return m_rhs.cols(); }
const Scalar _coeff(int row, int col) const const Scalar _coeff(int row, int col) const
{ {
@ -296,7 +296,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const const PacketScalar _packetCoeff(int row, int col) const
{ {
if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT) if(Lhs::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT)
{ {
@ -312,7 +312,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
return ProductPacketCoeffImpl<Product,Flags&RowMajorBit>::execute(*this, row, col); return ProductPacketCoeffImpl<Product,Flags&RowMajorBit>::execute(*this, row, col);
} }
PacketScalar _packetCoeffRowMajor(int row, int col) const const PacketScalar _packetCoeffRowMajor(int row, int col) const
{ {
PacketScalar res; PacketScalar res;
res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packetCoeff<Aligned>(0, col)); res = ei_pmul(ei_pset1(m_lhs.coeff(row, 0)),m_rhs.template packetCoeff<Aligned>(0, col));
@ -321,7 +321,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
return res; return res;
} }
PacketScalar _packetCoeffColumnMajor(int row, int col) const const PacketScalar _packetCoeffColumnMajor(int row, int col) const
{ {
PacketScalar res; PacketScalar res;
res = ei_pmul(m_lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(m_rhs.coeff(0, col))); res = ei_pmul(m_lhs.template packetCoeff<Aligned>(row, 0), ei_pset1(m_rhs.coeff(0, col)));
@ -348,7 +348,7 @@ template<typename Lhs, typename Rhs, int EvalMode> class Product : ei_no_assignm
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
const Product<Derived,OtherDerived> inline const Product<Derived,OtherDerived>
MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
{ {
return Product<Derived,OtherDerived>(derived(), other.derived()); return Product<Derived,OtherDerived>(derived(), other.derived());
@ -360,7 +360,7 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
Derived & inline Derived &
MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other)
{ {
return *this = *this * other; return *this = *this * other;
@ -368,7 +368,7 @@ MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other)
template<typename Derived> template<typename Derived>
template<typename Lhs, typename Rhs> template<typename Lhs, typename Rhs>
Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product) inline Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProduct>& product)
{ {
product._cacheFriendlyEval(derived()); product._cacheFriendlyEval(derived());
return derived(); return derived();
@ -376,7 +376,7 @@ Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFriendlyProd
template<typename Lhs, typename Rhs, int EvalMode> template<typename Lhs, typename Rhs, int EvalMode>
template<typename DestDerived> template<typename DestDerived>
void Product<Lhs,Rhs,EvalMode>::_cacheFriendlyEval(DestDerived& res) const inline void Product<Lhs,Rhs,EvalMode>::_cacheFriendlyEval(DestDerived& res) const
{ {
#ifndef EIGEN_WIP_PRODUCT_DIRTY #ifndef EIGEN_WIP_PRODUCT_DIRTY
res.setZero(); res.setZero();

View File

@ -203,7 +203,7 @@ MatrixBase<Derived>::redux(const BinaryOp& func) const
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar typename ei_traits<Derived>::Scalar
MatrixBase<Derived>::sum() const inline MatrixBase<Derived>::sum() const
{ {
return this->redux(Eigen::ei_scalar_sum_op<Scalar>()); return this->redux(Eigen::ei_scalar_sum_op<Scalar>());
} }
@ -216,7 +216,7 @@ MatrixBase<Derived>::sum() const
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar typename ei_traits<Derived>::Scalar
MatrixBase<Derived>::trace() const inline MatrixBase<Derived>::trace() const
{ {
return diagonal().sum(); return diagonal().sum();
} }
@ -225,7 +225,7 @@ MatrixBase<Derived>::trace() const
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar typename ei_traits<Derived>::Scalar
MatrixBase<Derived>::minCoeff() const inline MatrixBase<Derived>::minCoeff() const
{ {
return this->redux(Eigen::ei_scalar_min_op<Scalar>()); return this->redux(Eigen::ei_scalar_min_op<Scalar>());
} }
@ -234,7 +234,7 @@ MatrixBase<Derived>::minCoeff() const
*/ */
template<typename Derived> template<typename Derived>
typename ei_traits<Derived>::Scalar typename ei_traits<Derived>::Scalar
MatrixBase<Derived>::maxCoeff() const inline MatrixBase<Derived>::maxCoeff() const
{ {
return this->redux(Eigen::ei_scalar_max_op<Scalar>()); return this->redux(Eigen::ei_scalar_max_op<Scalar>());
} }
@ -249,7 +249,7 @@ struct ei_all_unroller
row = (UnrollCount-1) % Derived::RowsAtCompileTime row = (UnrollCount-1) % Derived::RowsAtCompileTime
}; };
static bool run(const Derived &mat) inline static bool run(const Derived &mat)
{ {
return ei_all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col); return ei_all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
} }
@ -258,13 +258,13 @@ struct ei_all_unroller
template<typename Derived> template<typename Derived>
struct ei_all_unroller<Derived, 1> struct ei_all_unroller<Derived, 1>
{ {
static bool run(const Derived &mat) { return mat.coeff(0, 0); } inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
}; };
template<typename Derived> template<typename Derived>
struct ei_all_unroller<Derived, Dynamic> struct ei_all_unroller<Derived, Dynamic>
{ {
static bool run(const Derived &) { return false; } inline static bool run(const Derived &) { return false; }
}; };
template<typename Derived, int UnrollCount> template<typename Derived, int UnrollCount>
@ -275,7 +275,7 @@ struct ei_any_unroller
row = (UnrollCount-1) % Derived::RowsAtCompileTime row = (UnrollCount-1) % Derived::RowsAtCompileTime
}; };
static bool run(const Derived &mat) inline static bool run(const Derived &mat)
{ {
return ei_any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col); return ei_any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
} }
@ -284,13 +284,13 @@ struct ei_any_unroller
template<typename Derived> template<typename Derived>
struct ei_any_unroller<Derived, 1> struct ei_any_unroller<Derived, 1>
{ {
static bool run(const Derived &mat) { return mat.coeff(0, 0); } inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
}; };
template<typename Derived> template<typename Derived>
struct ei_any_unroller<Derived, Dynamic> struct ei_any_unroller<Derived, Dynamic>
{ {
static bool run(const Derived &) { return false; } inline static bool run(const Derived &) { return false; }
}; };
/** \returns true if all coefficients are true /** \returns true if all coefficients are true

View File

@ -59,20 +59,20 @@ template<typename ExpressionType> class Temporary
EIGEN_GENERIC_PUBLIC_INTERFACE(Temporary) EIGEN_GENERIC_PUBLIC_INTERFACE(Temporary)
Temporary(const ExpressionType& matrix) : m_expression(matrix) {} inline Temporary(const ExpressionType& matrix) : m_expression(matrix) {}
private: private:
int _rows() const { return m_expression.rows(); } inline int _rows() const { return m_expression.rows(); }
int _cols() const { return m_expression.cols(); } inline int _cols() const { return m_expression.cols(); }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_expression.coeff(row, col); return m_expression.coeff(row, col);
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline const PacketScalar _packetCoeff(int row, int col) const
{ {
return m_expression.template packetCoeff<LoadMode>(row, col); return m_expression.template packetCoeff<LoadMode>(row, col);
} }
@ -84,7 +84,7 @@ template<typename ExpressionType> class Temporary
/** \returns an expression of the temporary version of *this. /** \returns an expression of the temporary version of *this.
*/ */
template<typename Derived> template<typename Derived>
const Temporary<Derived> inline const Temporary<Derived>
MatrixBase<Derived>::temporary() const MatrixBase<Derived>::temporary() const
{ {
return Temporary<Derived>(derived()); return Temporary<Derived>(derived());

View File

@ -60,35 +60,35 @@ template<typename MatrixType> class Transpose
EIGEN_GENERIC_PUBLIC_INTERFACE(Transpose) EIGEN_GENERIC_PUBLIC_INTERFACE(Transpose)
Transpose(const MatrixType& matrix) : m_matrix(matrix) {} inline Transpose(const MatrixType& matrix) : m_matrix(matrix) {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
private: private:
int _rows() const { return m_matrix.cols(); } inline int _rows() const { return m_matrix.cols(); }
int _cols() const { return m_matrix.rows(); } inline int _cols() const { return m_matrix.rows(); }
int _stride(void) const { return m_matrix.stride(); } inline int _stride(void) const { return m_matrix.stride(); }
Scalar& _coeffRef(int row, int col) inline Scalar& _coeffRef(int row, int col)
{ {
return m_matrix.const_cast_derived().coeffRef(col, row); return m_matrix.const_cast_derived().coeffRef(col, row);
} }
const Scalar _coeff(int row, int col) const inline const Scalar _coeff(int row, int col) const
{ {
return m_matrix.coeff(col, row); return m_matrix.coeff(col, row);
} }
template<int LoadMode> template<int LoadMode>
PacketScalar _packetCoeff(int row, int col) const inline const PacketScalar _packetCoeff(int row, int col) const
{ {
return m_matrix.template packetCoeff<LoadMode>(col, row); return m_matrix.template packetCoeff<LoadMode>(col, row);
} }
template<int LoadMode> template<int LoadMode>
void _writePacketCoeff(int row, int col, const PacketScalar& x) inline void _writePacketCoeff(int row, int col, const PacketScalar& x)
{ {
m_matrix.const_cast_derived().template writePacketCoeff<LoadMode>(col, row, x); m_matrix.const_cast_derived().template writePacketCoeff<LoadMode>(col, row, x);
} }
@ -104,7 +104,7 @@ template<typename MatrixType> class Transpose
* *
* \sa adjoint(), class DiagonalCoeffs */ * \sa adjoint(), class DiagonalCoeffs */
template<typename Derived> template<typename Derived>
Transpose<Derived> inline Transpose<Derived>
MatrixBase<Derived>::transpose() MatrixBase<Derived>::transpose()
{ {
return Transpose<Derived>(derived()); return Transpose<Derived>(derived());
@ -112,7 +112,7 @@ MatrixBase<Derived>::transpose()
/** This is the const version of transpose(). \sa adjoint() */ /** This is the const version of transpose(). \sa adjoint() */
template<typename Derived> template<typename Derived>
const Transpose<Derived> inline const Transpose<Derived>
MatrixBase<Derived>::transpose() const MatrixBase<Derived>::transpose() const
{ {
return Transpose<Derived>(derived()); return Transpose<Derived>(derived());
@ -125,7 +125,9 @@ MatrixBase<Derived>::transpose() const
* *
* \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */ * \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
template<typename Derived> template<typename Derived>
const Transpose<Temporary<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived > > > inline const Transpose<Temporary<
CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived >
> >
MatrixBase<Derived>::adjoint() const MatrixBase<Derived>::adjoint() const
{ {
return conjugate().temporary().transpose(); return conjugate().temporary().transpose();

View File

@ -79,7 +79,7 @@ template<int Mode, typename MatrixType> class Triangular
EIGEN_GENERIC_PUBLIC_INTERFACE(Triangular) EIGEN_GENERIC_PUBLIC_INTERFACE(Triangular)
Triangular(const MatrixType& matrix) inline Triangular(const MatrixType& matrix)
: m_matrix(matrix) : m_matrix(matrix)
{ {
assert(!( (Flags&UnitDiagBit) && (Flags&NullDiagBit))); assert(!( (Flags&UnitDiagBit) && (Flags&NullDiagBit)));
@ -89,15 +89,15 @@ template<int Mode, typename MatrixType> class Triangular
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Triangular) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Triangular)
/** Overloaded to keep a Triangular expression */ /** Overloaded to keep a Triangular expression */
Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > > transpose() inline Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > > transpose()
{ {
return Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary())); return Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary()));
} }
/** Overloaded to keep a Triangular expression */ /** Overloaded to keep a Triangular expression */
const Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > > transpose() const inline const Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > > transpose() const
{ {
return Triangular<(Upper | Lower) xor Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary())); return Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary()));
} }
/** \returns the product of the inverse of *this with \a other. /** \returns the product of the inverse of *this with \a other.
@ -154,16 +154,16 @@ template<int Mode, typename MatrixType> class Triangular
private: private:
int _rows() const { return m_matrix.rows(); } inline int _rows() const { return m_matrix.rows(); }
int _cols() const { return m_matrix.cols(); } inline int _cols() const { return m_matrix.cols(); }
Scalar& _coeffRef(int row, int col) inline Scalar& _coeffRef(int row, int col)
{ {
ei_assert( ((! (Flags & Lower)) && row<=col) || (Flags & Lower && col<=row)); ei_assert( ((! (Flags & Lower)) && row<=col) || (Flags & Lower && col<=row));
return m_matrix.const_cast_derived().coeffRef(row, col); return m_matrix.const_cast_derived().coeffRef(row, col);
} }
Scalar _coeff(int row, int col) const inline Scalar _coeff(int row, int col) const
{ {
if ((Flags & Lower) ? col>row : row>col) if ((Flags & Lower) ? col>row : row>col)
return 0; return 0;
@ -185,14 +185,14 @@ template<int Mode, typename MatrixType> class Triangular
* \sa isUpper(), upperWithNullDiagBit(), upperWithNullDiagBit(), lower() * \sa isUpper(), upperWithNullDiagBit(), upperWithNullDiagBit(), lower()
*/ */
template<typename Derived> template<typename Derived>
Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) inline Triangular<Upper, Derived> MatrixBase<Derived>::upper(void)
{ {
return Triangular<Upper,Derived>(derived()); return Triangular<Upper,Derived>(derived());
} }
/** This is the const version of upper(). */ /** This is the const version of upper(). */
template<typename Derived> template<typename Derived>
const Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) const inline const Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) const
{ {
return Triangular<Upper,Derived>(derived()); return Triangular<Upper,Derived>(derived());
} }
@ -202,14 +202,14 @@ const Triangular<Upper, Derived> MatrixBase<Derived>::upper(void) const
* \sa isLower(), lowerWithUnitDiag(), lowerWithNullDiag(), upper() * \sa isLower(), lowerWithUnitDiag(), lowerWithNullDiag(), upper()
*/ */
template<typename Derived> template<typename Derived>
Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) inline Triangular<Lower, Derived> MatrixBase<Derived>::lower(void)
{ {
return Triangular<Lower,Derived>(derived()); return Triangular<Lower,Derived>(derived());
} }
/** This is the const version of lower().*/ /** This is the const version of lower().*/
template<typename Derived> template<typename Derived>
const Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) const inline const Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) const
{ {
return Triangular<Lower,Derived>(derived()); return Triangular<Lower,Derived>(derived());
} }
@ -219,7 +219,7 @@ const Triangular<Lower, Derived> MatrixBase<Derived>::lower(void) const
* \sa upper(), lowerWithUnitDiagBit() * \sa upper(), lowerWithUnitDiagBit()
*/ */
template<typename Derived> template<typename Derived>
const Triangular<Upper|UnitDiagBit, Derived> MatrixBase<Derived>::upperWithUnitDiag(void) const inline const Triangular<Upper|UnitDiagBit, Derived> MatrixBase<Derived>::upperWithUnitDiag(void) const
{ {
return Triangular<Upper|UnitDiagBit, Derived>(derived()); return Triangular<Upper|UnitDiagBit, Derived>(derived());
} }
@ -230,7 +230,7 @@ const Triangular<Upper|UnitDiagBit, Derived> MatrixBase<Derived>::upperWithUnitD
* \sa upper(), lowerWithNullDiag() * \sa upper(), lowerWithNullDiag()
*/ */
template<typename Derived> template<typename Derived>
const Triangular<Upper|NullDiagBit, Derived> MatrixBase<Derived>::upperWithNullDiag(void) const inline const Triangular<Upper|NullDiagBit, Derived> MatrixBase<Derived>::upperWithNullDiag(void) const
{ {
return Triangular<Upper|NullDiagBit, Derived>(derived()); return Triangular<Upper|NullDiagBit, Derived>(derived());
} }
@ -240,7 +240,7 @@ const Triangular<Upper|NullDiagBit, Derived> MatrixBase<Derived>::upperWithNullD
* \sa lower(), upperWithUnitDiag() * \sa lower(), upperWithUnitDiag()
*/ */
template<typename Derived> template<typename Derived>
const Triangular<Lower|UnitDiagBit, Derived> MatrixBase<Derived>::lowerWithUnitDiag(void) const inline const Triangular<Lower|UnitDiagBit, Derived> MatrixBase<Derived>::lowerWithUnitDiag(void) const
{ {
return Triangular<Lower|UnitDiagBit, Derived>(derived()); return Triangular<Lower|UnitDiagBit, Derived>(derived());
} }
@ -251,7 +251,7 @@ const Triangular<Lower|UnitDiagBit, Derived> MatrixBase<Derived>::lowerWithUnitD
* \sa lower(), upperWithNullDiag() * \sa lower(), upperWithNullDiag()
*/ */
template<typename Derived> template<typename Derived>
const Triangular<Lower|NullDiagBit, Derived> MatrixBase<Derived>::lowerWithNullDiag(void) const inline const Triangular<Lower|NullDiagBit, Derived> MatrixBase<Derived>::lowerWithNullDiag(void) const
{ {
return Triangular<Lower|NullDiagBit, Derived>(derived()); return Triangular<Lower|NullDiagBit, Derived>(derived());
} }
@ -300,5 +300,4 @@ bool MatrixBase<Derived>::isLower(RealScalar prec) const
return true; return true;
} }
#endif // EIGEN_TRIANGULAR_H #endif // EIGEN_TRIANGULAR_H

View File

@ -33,7 +33,7 @@ struct ei_triangular_assign_unroller
row = (UnrollCount-1) % Derived1::RowsAtCompileTime row = (UnrollCount-1) % Derived1::RowsAtCompileTime
}; };
static void run(Derived1 &dst, const Derived2 &src) inline static void run(Derived1 &dst, const Derived2 &src)
{ {
ei_triangular_assign_unroller<Derived1, Derived2, ei_triangular_assign_unroller<Derived1, Derived2,
(Mode & Lower) ? (Mode & Lower) ?
@ -47,7 +47,7 @@ struct ei_triangular_assign_unroller
template<typename Derived1, typename Derived2, int Mode> template<typename Derived1, typename Derived2, int Mode>
struct ei_triangular_assign_unroller<Derived1, Derived2, 1, Mode> struct ei_triangular_assign_unroller<Derived1, Derived2, 1, Mode>
{ {
static void run(Derived1 &dst, const Derived2 &src) inline static void run(Derived1 &dst, const Derived2 &src)
{ {
dst.coeffRef(0, 0) = src.coeff(0, 0); dst.coeffRef(0, 0) = src.coeff(0, 0);
} }
@ -57,13 +57,13 @@ struct ei_triangular_assign_unroller<Derived1, Derived2, 1, Mode>
template<typename Derived1, typename Derived2, int Mode> template<typename Derived1, typename Derived2, int Mode>
struct ei_triangular_assign_unroller<Derived1, Derived2, 0, Mode> struct ei_triangular_assign_unroller<Derived1, Derived2, 0, Mode>
{ {
static void run(Derived1 &, const Derived2 &) {} inline static void run(Derived1 &, const Derived2 &) {}
}; };
template<typename Derived1, typename Derived2, int Mode> template<typename Derived1, typename Derived2, int Mode>
struct ei_triangular_assign_unroller<Derived1, Derived2, Dynamic, Mode> struct ei_triangular_assign_unroller<Derived1, Derived2, Dynamic, Mode>
{ {
static void run(Derived1 &, const Derived2 &) {} inline static void run(Derived1 &, const Derived2 &) {}
}; };

View File

@ -33,7 +33,7 @@ struct ei_visitor_unroller
row = (UnrollCount-1) % Derived::RowsAtCompileTime row = (UnrollCount-1) % Derived::RowsAtCompileTime
}; };
static void run(const Derived &mat, Visitor& visitor) inline static void run(const Derived &mat, Visitor& visitor)
{ {
ei_visitor_unroller<Visitor, Derived, UnrollCount-1>::run(mat, visitor); ei_visitor_unroller<Visitor, Derived, UnrollCount-1>::run(mat, visitor);
visitor(mat.coeff(row, col), row, col); visitor(mat.coeff(row, col), row, col);
@ -43,7 +43,7 @@ struct ei_visitor_unroller
template<typename Visitor, typename Derived> template<typename Visitor, typename Derived>
struct ei_visitor_unroller<Visitor, Derived, 1> struct ei_visitor_unroller<Visitor, Derived, 1>
{ {
static void run(const Derived &mat, Visitor& visitor) inline static void run(const Derived &mat, Visitor& visitor)
{ {
return visitor.init(mat.coeff(0, 0), 0, 0); return visitor.init(mat.coeff(0, 0), 0, 0);
} }
@ -52,7 +52,7 @@ struct ei_visitor_unroller<Visitor, Derived, 1>
template<typename Visitor, typename Derived> template<typename Visitor, typename Derived>
struct ei_visitor_unroller<Visitor, Derived, Dynamic> struct ei_visitor_unroller<Visitor, Derived, Dynamic>
{ {
static void run(const Derived &, Visitor&) {} inline static void run(const Derived &, Visitor&) {}
}; };
@ -100,7 +100,7 @@ struct ei_coeff_visitor
{ {
int row, col; int row, col;
Scalar res; Scalar res;
void init(const Scalar& value, int i, int j) inline void init(const Scalar& value, int i, int j)
{ {
res = value; res = value;
row = i; row = i;

View File

@ -46,7 +46,7 @@ inline vector int ei_psub(const vector int a, const vector int b) { r
inline vector float ei_pmul(const vector float a, const vector float b) { return vec_madd(a,b, v0f); } inline vector float ei_pmul(const vector float a, const vector float b) { return vec_madd(a,b, v0f); }
inline vector int ei_pmul(const vector int a, const vector int b) inline vector int ei_pmul(const vector int a, const vector int b)
{ {
// Taken from http:// // Taken from http://developer.apple.com/hardwaredrivers/ve/algorithms.html#Multiply32
//Set up constants //Set up constants
vector int bswap, lowProduct, highProduct; vector int bswap, lowProduct, highProduct;

View File

@ -86,9 +86,9 @@ using Eigen::MatrixBase;
// Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const' // Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
// : function body not available // : function body not available
#if EIGEN_GNUC_AT_LEAST(4,0) #if EIGEN_GNUC_AT_LEAST(4,0)
#define EIGEN_INLINE __attribute__((always_inline)) #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
#else #else
#define EIGEN_INLINE inline #define EIGEN_ALWAYS_INLINE inline
#endif #endif
#if (defined __GNUC__) #if (defined __GNUC__)