mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Finish prefixing everything with "Ei"
This commit is contained in:
parent
5160e9d029
commit
28c44a95c2
@ -4,7 +4,7 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int, char **)
|
int main(int, char **)
|
||||||
{
|
{
|
||||||
Matrix<double,2,2> m; // 2x2 fixed-size matrix with uninitialized entries
|
EiMatrix<double,2,2> m; // 2x2 fixed-size matrix with uninitialized entries
|
||||||
m(0,0) = 1;
|
m(0,0) = 1;
|
||||||
m(0,1) = 2;
|
m(0,1) = 2;
|
||||||
m(1,0) = 3;
|
m(1,0) = 3;
|
||||||
@ -35,7 +35,7 @@ int main(int, char **)
|
|||||||
cout << "We want to store that into m, i.e. do \"m = m * m;\"" << endl;
|
cout << "We want to store that into m, i.e. do \"m = m * m;\"" << endl;
|
||||||
cout << "Here we must be very careful. For if we do \"m = m * m;\"," << endl
|
cout << "Here we must be very careful. For if we do \"m = m * m;\"," << endl
|
||||||
<< "the matrix m becomes" << endl;
|
<< "the matrix m becomes" << endl;
|
||||||
Matrix<double,2,2> m_save = m;
|
EiMatrix<double,2,2> m_save = m;
|
||||||
m = m * m; // the bogus operation
|
m = m * m; // the bogus operation
|
||||||
cout << m << "," << endl;
|
cout << m << "," << endl;
|
||||||
cout << "which is not what was wanted!" << endl
|
cout << "which is not what was wanted!" << endl
|
||||||
|
6
src/All
6
src/All
@ -23,10 +23,10 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_ALL_H
|
#ifndef EI_ALL_H
|
||||||
#define EIGEN_ALL_H
|
#define EI_ALL_H
|
||||||
|
|
||||||
#include "Core"
|
#include "Core"
|
||||||
#include "Manip"
|
#include "Manip"
|
||||||
|
|
||||||
#endif // EIGEN_ALL_H
|
#endif // EI_ALL_H
|
||||||
|
6
src/Core
6
src/Core
@ -23,10 +23,10 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_CORE_H
|
#ifndef EI_CORE_H
|
||||||
#define EIGEN_CORE_H
|
#define EI_CORE_H
|
||||||
|
|
||||||
//#include "internal/Vector.h"
|
//#include "internal/Vector.h"
|
||||||
#include "internal/Matrix.h"
|
#include "internal/Matrix.h"
|
||||||
|
|
||||||
#endif // EIGEN_CORE_H
|
#endif // EI_CORE_H
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_MANIP_H
|
#ifndef EI_MANIP_H
|
||||||
#define EIGEN_MANIP_H
|
#define EI_MANIP_H
|
||||||
|
|
||||||
#include "internal/RowAndCol.h"
|
#include "internal/RowAndCol.h"
|
||||||
#include "internal/Block.h"
|
#include "internal/Block.h"
|
||||||
#include "internal/Minor.h"
|
#include "internal/Minor.h"
|
||||||
|
|
||||||
#endif // EIGEN_MANIP_H
|
#endif // EI_MANIP_H
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_BLOCK_H
|
#ifndef EI_BLOCK_H
|
||||||
#define EIGEN_BLOCK_H
|
#define EI_BLOCK_H
|
||||||
|
|
||||||
template<typename MatrixType> class EiBlock
|
template<typename MatrixType> class EiBlock
|
||||||
: public EiObject<typename MatrixType::Scalar, EiBlock<MatrixType> >
|
: public EiObject<typename MatrixType::Scalar, EiBlock<MatrixType> >
|
||||||
@ -52,7 +52,7 @@ template<typename MatrixType> class EiBlock
|
|||||||
: m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow),
|
: m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow),
|
||||||
m_startCol(other.m_startCol), m_endCol(other.m_endCol) {}
|
m_startCol(other.m_startCol), m_endCol(other.m_endCol) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(EiBlock)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiBlock)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -81,4 +81,4 @@ EiObject<Scalar, Derived>::block(int startRow, int endRow, int startCol, int end
|
|||||||
return EiBlock<EiObject>(ref(), startRow, endRow, startCol, endCol);
|
return EiBlock<EiObject>(ref(), startRow, endRow, startCol, endCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_BLOCK_H
|
#endif // EI_BLOCK_H
|
||||||
|
@ -23,30 +23,27 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_MATRIX_H
|
#ifndef EI_MATRIX_H
|
||||||
#define EIGEN_MATRIX_H
|
#define EI_MATRIX_H
|
||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "EiObject.h"
|
#include "Object.h"
|
||||||
#include "MatrixRef.h"
|
#include "MatrixRef.h"
|
||||||
#include "MatrixStorage.h"
|
#include "MatrixStorage.h"
|
||||||
|
|
||||||
template<typename _Scalar, int _Rows, int _Cols>
|
template<typename _Scalar, int _Rows, int _Cols>
|
||||||
class EiMatrix : public EiObject<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
|
class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >,
|
||||||
public MatrixStorage<_Scalar, _Rows, _Cols>
|
public EiMatrixStorage<_Scalar, _Rows, _Cols>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class EiObject<_Scalar, Matrix>;
|
friend class EiObject<_Scalar, EiMatrix>;
|
||||||
typedef EiObject<_Scalar, Matrix> Base;
|
typedef EiObject<_Scalar, EiMatrix> Base;
|
||||||
typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage;
|
typedef EiMatrixStorage<_Scalar, _Rows, _Cols> Storage;
|
||||||
typedef _Scalar Scalar;
|
typedef _Scalar Scalar;
|
||||||
typedef MatrixRef<Matrix> Ref;
|
typedef EiMatrixRef<EiMatrix> Ref;
|
||||||
typedef MatrixAlias<Matrix> Alias;
|
|
||||||
|
|
||||||
static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols;
|
static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols;
|
||||||
|
|
||||||
Alias alias();
|
|
||||||
|
|
||||||
const Scalar* array() const
|
const Scalar* array() const
|
||||||
{ return Storage::m_array; }
|
{ return Storage::m_array; }
|
||||||
|
|
||||||
@ -54,80 +51,81 @@ class EiMatrix : public EiObject<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
|
|||||||
{ return Storage::m_array; }
|
{ return Storage::m_array; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ref _ref() const { return Ref(*const_cast<Matrix*>(this)); }
|
Ref _ref() const { return Ref(*const_cast<EiMatrix*>(this)); }
|
||||||
|
|
||||||
const Scalar& _read(int row, int col = 0) const
|
const Scalar& _read(int row, int col = 0) const
|
||||||
{
|
{
|
||||||
EIGEN_CHECK_RANGES(*this, row, col);
|
EI_CHECK_RANGES(*this, row, col);
|
||||||
return array()[row + col * Storage::_rows()];
|
return array()[row + col * Storage::_rows()];
|
||||||
}
|
}
|
||||||
|
|
||||||
Scalar& _write(int row, int col = 0)
|
Scalar& _write(int row, int col = 0)
|
||||||
{
|
{
|
||||||
EIGEN_CHECK_RANGES(*this, row, col);
|
EI_CHECK_RANGES(*this, row, col);
|
||||||
return array()[row + col * Storage::_rows()];
|
return array()[row + col * Storage::_rows()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Matrix& operator=(const EiObject<Scalar, OtherDerived>& other)
|
EiMatrix& operator=(const EiObject<Scalar, OtherDerived>& other)
|
||||||
{
|
|
||||||
resize(other.rows(), other.cols());
|
|
||||||
return Base::operator=(other);
|
|
||||||
}
|
|
||||||
Matrix& operator=(const Matrix& other)
|
|
||||||
{
|
{
|
||||||
resize(other.rows(), other.cols());
|
resize(other.rows(), other.cols());
|
||||||
return Base::operator=(other);
|
return Base::operator=(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=)
|
EiMatrix& operator=(const EiMatrix& other)
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=)
|
{
|
||||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=)
|
resize(other.rows(), other.cols());
|
||||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, /=)
|
return Base::operator=(other);
|
||||||
|
}
|
||||||
|
|
||||||
explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {}
|
EI_INHERIT_ASSIGNMENT_OPERATOR(EiMatrix, +=)
|
||||||
|
EI_INHERIT_ASSIGNMENT_OPERATOR(EiMatrix, -=)
|
||||||
|
EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(EiMatrix, *=)
|
||||||
|
EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(EiMatrix, /=)
|
||||||
|
|
||||||
|
explicit EiMatrix(int rows = 1, int cols = 1) : Storage(rows, cols) {}
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Matrix(const EiObject<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols())
|
EiMatrix(const EiObject<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols())
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
Matrix(const Matrix& other) : Storage(other.rows(), other.cols())
|
EiMatrix(const EiMatrix& other) : Storage(other.rows(), other.cols())
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
~Matrix() {}
|
~EiMatrix() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>
|
EiMatrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>
|
||||||
eval(const EiObject<Scalar, Derived>& expression)
|
eval(const EiObject<Scalar, Derived>& expression)
|
||||||
{
|
{
|
||||||
return Matrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression);
|
return EiMatrix<Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime>(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
|
#define EI_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
|
||||||
typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \
|
typedef EiMatrix<Type, Size, Size> EiMatrix##SizeSuffix##TypeSuffix; \
|
||||||
typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix;
|
typedef EiMatrix<Type, Size, 1> EiVector##SizeSuffix##TypeSuffix;
|
||||||
|
|
||||||
#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
|
#define EI_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
|
||||||
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
|
EI_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
|
||||||
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
|
EI_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
|
||||||
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
|
EI_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
|
||||||
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, EiDynamic, X)
|
EI_MAKE_TYPEDEFS(Type, TypeSuffix, EiDynamic, X)
|
||||||
|
|
||||||
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i)
|
EI_MAKE_TYPEDEFS_ALL_SIZES(int, i)
|
||||||
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f)
|
EI_MAKE_TYPEDEFS_ALL_SIZES(float, f)
|
||||||
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d)
|
EI_MAKE_TYPEDEFS_ALL_SIZES(double, d)
|
||||||
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<int>, ci)
|
EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<int>, ci)
|
||||||
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf)
|
EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf)
|
||||||
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
|
EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
|
||||||
|
|
||||||
#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
|
#undef EI_MAKE_TYPEDEFS_ALL_SIZES
|
||||||
#undef EIGEN_MAKE_TYPEDEFS
|
#undef EI_MAKE_TYPEDEFS
|
||||||
|
|
||||||
#include "MatrixOps.h"
|
#include "MatrixOps.h"
|
||||||
#include "ScalarOps.h"
|
#include "ScalarOps.h"
|
||||||
#include "RowAndCol.h"
|
#include "RowAndCol.h"
|
||||||
|
|
||||||
#endif // EIGEN_MATRIX_H
|
#endif // EI_MATRIX_H
|
||||||
|
@ -23,32 +23,32 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_MATRIXOPS_H
|
#ifndef EI_MATRIXOPS_H
|
||||||
#define EIGEN_MATRIXOPS_H
|
#define EI_MATRIXOPS_H
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs> class EiSum
|
template<typename Lhs, typename Rhs> class EiSum
|
||||||
: public EiObject<typename Lhs::Scalar, MatrixSum<Lhs, Rhs> >
|
: public EiObject<typename Lhs::Scalar, EiSum<Lhs, Rhs> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Lhs::Scalar Scalar;
|
typedef typename Lhs::Scalar Scalar;
|
||||||
typedef typename Lhs::Ref LhsRef;
|
typedef typename Lhs::Ref LhsRef;
|
||||||
typedef typename Rhs::Ref RhsRef;
|
typedef typename Rhs::Ref RhsRef;
|
||||||
friend class EiObject<Scalar, MatrixSum>;
|
friend class EiObject<Scalar, EiSum>;
|
||||||
typedef EiSum Ref;
|
typedef EiSum Ref;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
||||||
|
|
||||||
MatrixSum(const LhsRef& lhs, const RhsRef& rhs)
|
EiSum(const LhsRef& lhs, const RhsRef& rhs)
|
||||||
: m_lhs(lhs), m_rhs(rhs)
|
: m_lhs(lhs), m_rhs(rhs)
|
||||||
{
|
{
|
||||||
assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixSum(const MatrixSum& other)
|
EiSum(const EiSum& other)
|
||||||
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixSum)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiSum)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -67,28 +67,28 @@ template<typename Lhs, typename Rhs> class EiSum
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs> class EiDifference
|
template<typename Lhs, typename Rhs> class EiDifference
|
||||||
: public EiObject<typename Lhs::Scalar, MatrixDifference<Lhs, Rhs> >
|
: public EiObject<typename Lhs::Scalar, EiDifference<Lhs, Rhs> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Lhs::Scalar Scalar;
|
typedef typename Lhs::Scalar Scalar;
|
||||||
typedef typename Lhs::Ref LhsRef;
|
typedef typename Lhs::Ref LhsRef;
|
||||||
typedef typename Rhs::Ref RhsRef;
|
typedef typename Rhs::Ref RhsRef;
|
||||||
friend class EiObject<Scalar, MatrixDifference>;
|
friend class EiObject<Scalar, EiDifference>;
|
||||||
typedef EiDifference Ref;
|
typedef EiDifference Ref;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
||||||
|
|
||||||
MatrixDifference(const LhsRef& lhs, const RhsRef& rhs)
|
EiDifference(const LhsRef& lhs, const RhsRef& rhs)
|
||||||
: m_lhs(lhs), m_rhs(rhs)
|
: m_lhs(lhs), m_rhs(rhs)
|
||||||
{
|
{
|
||||||
assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixDifference(const MatrixDifference& other)
|
EiDifference(const EiDifference& other)
|
||||||
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixDifference)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiDifference)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -106,28 +106,28 @@ template<typename Lhs, typename Rhs> class EiDifference
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs> class EiMatrixProduct
|
template<typename Lhs, typename Rhs> class EiMatrixProduct
|
||||||
: public EiObject<typename Lhs::Scalar, MatrixProduct<Lhs, Rhs> >
|
: public EiObject<typename Lhs::Scalar, EiMatrixProduct<Lhs, Rhs> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename Lhs::Scalar Scalar;
|
typedef typename Lhs::Scalar Scalar;
|
||||||
typedef typename Lhs::Ref LhsRef;
|
typedef typename Lhs::Ref LhsRef;
|
||||||
typedef typename Rhs::Ref RhsRef;
|
typedef typename Rhs::Ref RhsRef;
|
||||||
friend class EiObject<Scalar, MatrixProduct>;
|
friend class EiObject<Scalar, EiMatrixProduct>;
|
||||||
typedef EiMatrixProduct Ref;
|
typedef EiMatrixProduct Ref;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
ColsAtCompileTime = Rhs::ColsAtCompileTime;
|
||||||
|
|
||||||
MatrixProduct(const LhsRef& lhs, const RhsRef& rhs)
|
EiMatrixProduct(const LhsRef& lhs, const RhsRef& rhs)
|
||||||
: m_lhs(lhs), m_rhs(rhs)
|
: m_lhs(lhs), m_rhs(rhs)
|
||||||
{
|
{
|
||||||
assert(lhs.cols() == rhs.rows());
|
assert(lhs.cols() == rhs.rows());
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixProduct(const MatrixProduct& other)
|
EiMatrixProduct(const EiMatrixProduct& other)
|
||||||
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
: m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixProduct)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixProduct)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -148,24 +148,24 @@ template<typename Lhs, typename Rhs> class EiMatrixProduct
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar, typename Derived1, typename Derived2>
|
template<typename Scalar, typename Derived1, typename Derived2>
|
||||||
MatrixSum<Derived1, Derived2>
|
EiSum<Derived1, Derived2>
|
||||||
operator+(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
|
operator+(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
|
||||||
{
|
{
|
||||||
return MatrixSum<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
return EiSum<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Derived1, typename Derived2>
|
template<typename Scalar, typename Derived1, typename Derived2>
|
||||||
MatrixDifference<Derived1, Derived2>
|
EiDifference<Derived1, Derived2>
|
||||||
operator-(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
|
operator-(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
|
||||||
{
|
{
|
||||||
return MatrixDifference<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
return EiDifference<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Derived1, typename Derived2>
|
template<typename Scalar, typename Derived1, typename Derived2>
|
||||||
MatrixProduct<Derived1, Derived2>
|
EiMatrixProduct<Derived1, Derived2>
|
||||||
operator*(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
|
operator*(const EiObject<Scalar, Derived1> &mat1, const EiObject<Scalar, Derived2> &mat2)
|
||||||
{
|
{
|
||||||
return MatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
return EiMatrixProduct<Derived1, Derived2>(mat1.ref(), mat2.ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
@ -195,4 +195,4 @@ EiObject<Scalar, Derived>::operator*=(const EiObject<Scalar, OtherDerived> &othe
|
|||||||
return *static_cast<Derived*>(this);
|
return *static_cast<Derived*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_MATRIXOPS_H
|
#endif // EI_MATRIXOPS_H
|
||||||
|
@ -23,21 +23,21 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_MATRIXREF_H
|
#ifndef EI_MATRIXREF_H
|
||||||
#define EIGEN_MATRIXREF_H
|
#define EI_MATRIXREF_H
|
||||||
|
|
||||||
template<typename MatrixType> class EiMatrixRef
|
template<typename MatrixType> class EiMatrixRef
|
||||||
: public EiObject<typename MatrixType::Scalar, MatrixRef<MatrixType> >
|
: public EiObject<typename MatrixType::Scalar, EiMatrixRef<MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
friend class EiObject<Scalar, MatrixRef>;
|
friend class EiObject<Scalar, EiMatrixRef>;
|
||||||
|
|
||||||
MatrixRef(MatrixType& matrix) : m_matrix(matrix) {}
|
EiMatrixRef(MatrixType& matrix) : m_matrix(matrix) {}
|
||||||
MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {}
|
EiMatrixRef(const EiMatrixRef& other) : m_matrix(other.m_matrix) {}
|
||||||
~MatrixRef() {}
|
~EiMatrixRef() {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixRef)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _rows() const { return m_matrix.rows(); }
|
int _rows() const { return m_matrix.rows(); }
|
||||||
@ -57,4 +57,4 @@ template<typename MatrixType> class EiMatrixRef
|
|||||||
MatrixType& m_matrix;
|
MatrixType& m_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EIGEN_MATRIXREF_H
|
#endif // EI_MATRIXREF_H
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_MATRIXSTORAGE_H
|
#ifndef EI_MATRIXSTORAGE_H
|
||||||
#define EIGEN_MATRIXSTORAGE_H
|
#define EI_MATRIXSTORAGE_H
|
||||||
|
|
||||||
template<typename Scalar,
|
template<typename Scalar,
|
||||||
int RowsAtCompileTime,
|
int RowsAtCompileTime,
|
||||||
@ -44,18 +44,18 @@ class EiMatrixStorage
|
|||||||
{ return ColsAtCompileTime; }
|
{ return ColsAtCompileTime; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MatrixStorage(int rows, int cols)
|
EiMatrixStorage(int rows, int cols)
|
||||||
{
|
{
|
||||||
EIGEN_UNUSED(rows);
|
EI_UNUSED(rows);
|
||||||
EIGEN_UNUSED(cols);
|
EI_UNUSED(cols);
|
||||||
assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0);
|
assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
~MatrixStorage() {};
|
~EiMatrixStorage() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
class MatrixStorage<Scalar, EiDynamic, 1>
|
class EiMatrixStorage<Scalar, EiDynamic, 1>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int m_rows;
|
int m_rows;
|
||||||
@ -77,18 +77,18 @@ class MatrixStorage<Scalar, EiDynamic, 1>
|
|||||||
{ return 1; }
|
{ return 1; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MatrixStorage(int rows, int cols) : m_rows(rows)
|
EiMatrixStorage(int rows, int cols) : m_rows(rows)
|
||||||
{
|
{
|
||||||
assert(m_rows > 0 && cols == 1);
|
assert(m_rows > 0 && cols == 1);
|
||||||
m_array = new Scalar[m_rows];
|
m_array = new Scalar[m_rows];
|
||||||
}
|
}
|
||||||
|
|
||||||
~MatrixStorage()
|
~EiMatrixStorage()
|
||||||
{ delete[] m_array; }
|
{ delete[] m_array; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
class MatrixStorage<Scalar, EiDynamic, EiDynamic>
|
class EiMatrixStorage<Scalar, EiDynamic, EiDynamic>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int m_rows, m_cols;
|
int m_rows, m_cols;
|
||||||
@ -113,14 +113,14 @@ class MatrixStorage<Scalar, EiDynamic, EiDynamic>
|
|||||||
{ return m_cols; }
|
{ return m_cols; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols)
|
EiMatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols)
|
||||||
{
|
{
|
||||||
assert(m_rows > 0 && m_cols > 0);
|
assert(m_rows > 0 && m_cols > 0);
|
||||||
m_array = new Scalar[m_rows * m_cols];
|
m_array = new Scalar[m_rows * m_cols];
|
||||||
}
|
}
|
||||||
|
|
||||||
~MatrixStorage()
|
~EiMatrixStorage()
|
||||||
{ delete[] m_array; }
|
{ delete[] m_array; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EIGEN_MATRIXSTORAGE_H
|
#endif // EI_MATRIXSTORAGE_H
|
||||||
|
@ -23,32 +23,32 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_MINOR_H
|
#ifndef EI_MINOR_H
|
||||||
#define EIGEN_MINOR_H
|
#define EI_MINOR_H
|
||||||
|
|
||||||
template<typename MatrixType> class EiMinor
|
template<typename MatrixType> class EiMinor
|
||||||
: public EiObject<typename MatrixType::Scalar, MatrixMinor<MatrixType> >
|
: public EiObject<typename MatrixType::Scalar, EiMinor<MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Ref MatRef;
|
typedef typename MatrixType::Ref MatRef;
|
||||||
friend class EiObject<Scalar, MatrixMinor<MatrixType> >;
|
friend class EiObject<Scalar, EiMinor<MatrixType> >;
|
||||||
typedef EiMinor Ref;
|
typedef EiMinor Ref;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1,
|
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime - 1,
|
||||||
ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1;
|
ColsAtCompileTime = MatrixType::ColsAtCompileTime - 1;
|
||||||
|
|
||||||
MatrixMinor(const MatRef& matrix,
|
EiMinor(const MatRef& matrix,
|
||||||
int row, int col = 0)
|
int row, int col = 0)
|
||||||
: m_matrix(matrix), m_row(row), m_col(col)
|
: m_matrix(matrix), m_row(row), m_col(col)
|
||||||
{
|
{
|
||||||
EIGEN_CHECK_RANGES(matrix, row, col);
|
EI_CHECK_RANGES(matrix, row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixMinor(const MatrixMinor& other)
|
EiMinor(const EiMinor& other)
|
||||||
: m_matrix(other.m_matrix), m_row(other.m_row), m_col(other.m_col) {}
|
: m_matrix(other.m_matrix), m_row(other.m_row), m_col(other.m_col) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixMinor)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiMinor)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -71,10 +71,10 @@ template<typename MatrixType> class EiMinor
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
MatrixMinor<EiObject<Scalar, Derived> >
|
EiMinor<EiObject<Scalar, Derived> >
|
||||||
EiObject<Scalar, Derived>::minor(int row, int col)
|
EiObject<Scalar, Derived>::minor(int row, int col)
|
||||||
{
|
{
|
||||||
return MatrixMinor<EiObject>(ref(), row, col);
|
return EiMinor<EiObject>(ref(), row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_MINOR_H
|
#endif // EI_MINOR_H
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_EIGENBASE_H
|
#ifndef EI_EIGENBASE_H
|
||||||
#define EIGEN_EIGENBASE_H
|
#define EI_EIGENBASE_H
|
||||||
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ template<typename _Scalar, typename Derived> class EiObject
|
|||||||
static const int RowsAtCompileTime = Derived::RowsAtCompileTime,
|
static const int RowsAtCompileTime = Derived::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = Derived::ColsAtCompileTime;
|
ColsAtCompileTime = Derived::ColsAtCompileTime;
|
||||||
public:
|
public:
|
||||||
typedef typename ForwardDecl<Derived>::Ref Ref;
|
typedef typename EiForwardDecl<Derived>::Ref Ref;
|
||||||
typedef _Scalar Scalar;
|
typedef _Scalar Scalar;
|
||||||
|
|
||||||
int rows() const { return static_cast<const Derived *>(this)->_rows(); }
|
int rows() const { return static_cast<const Derived *>(this)->_rows(); }
|
||||||
@ -77,9 +77,9 @@ template<typename _Scalar, typename Derived> class EiObject
|
|||||||
return *static_cast<Derived*>(this);
|
return *static_cast<Derived*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixRow<EiObject> row(int i);
|
EiRow<EiObject> row(int i);
|
||||||
MatrixCol<EiObject> col(int i);
|
EiColumn<EiObject> col(int i);
|
||||||
MatrixMinor<EiObject> minor(int row, int col);
|
EiMinor<EiObject> minor(int row, int col);
|
||||||
EiBlock<EiObject>
|
EiBlock<EiObject>
|
||||||
block(int startRow, int endRow, int startCol= 0, int endCol = 0);
|
block(int startRow, int endRow, int startCol= 0, int endCol = 0);
|
||||||
|
|
||||||
@ -127,4 +127,4 @@ std::ostream & operator <<
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_EIGENBASE_H
|
#endif // EI_EIGENBASE_H
|
@ -23,37 +23,37 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_ROWANDCOL_H
|
#ifndef EI_ROWANDCOL_H
|
||||||
#define EIGEN_ROWANDCOL_H
|
#define EI_ROWANDCOL_H
|
||||||
|
|
||||||
template<typename MatrixType> class EiRow
|
template<typename MatrixType> class EiRow
|
||||||
: public EiObject<typename MatrixType::Scalar, MatrixRow<MatrixType> >
|
: public EiObject<typename MatrixType::Scalar, EiRow<MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Ref MatRef;
|
typedef typename MatrixType::Ref MatRef;
|
||||||
friend class EiObject<Scalar, MatrixRow<MatrixType> >;
|
friend class EiObject<Scalar, EiRow<MatrixType> >;
|
||||||
typedef EiRow Ref;
|
typedef EiRow Ref;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime,
|
static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime,
|
||||||
ColsAtCompileTime = 1;
|
ColsAtCompileTime = 1;
|
||||||
|
|
||||||
MatrixRow(const MatRef& matrix, int row)
|
EiRow(const MatRef& matrix, int row)
|
||||||
: m_matrix(matrix), m_row(row)
|
: m_matrix(matrix), m_row(row)
|
||||||
{
|
{
|
||||||
EIGEN_CHECK_ROW_RANGE(matrix, row);
|
EI_CHECK_ROW_RANGE(matrix, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixRow(const MatrixRow& other)
|
EiRow(const EiRow& other)
|
||||||
: m_matrix(other.m_matrix), m_row(other.m_row) {}
|
: m_matrix(other.m_matrix), m_row(other.m_row) {}
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
MatrixRow& operator=(const EiObject<Scalar, OtherDerived>& other)
|
EiRow& operator=(const EiObject<Scalar, OtherDerived>& other)
|
||||||
{
|
{
|
||||||
return EiObject<Scalar, MatrixRow<MatrixType> >::operator=(other);
|
return EiObject<Scalar, EiRow<MatrixType> >::operator=(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRow)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiRow)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -63,15 +63,15 @@ template<typename MatrixType> class EiRow
|
|||||||
|
|
||||||
Scalar& _write(int row, int col=0)
|
Scalar& _write(int row, int col=0)
|
||||||
{
|
{
|
||||||
EIGEN_UNUSED(col);
|
EI_UNUSED(col);
|
||||||
EIGEN_CHECK_ROW_RANGE(*this, row);
|
EI_CHECK_ROW_RANGE(*this, row);
|
||||||
return m_matrix.write(m_row, row);
|
return m_matrix.write(m_row, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scalar _read(int row, int col=0) const
|
Scalar _read(int row, int col=0) const
|
||||||
{
|
{
|
||||||
EIGEN_UNUSED(col);
|
EI_UNUSED(col);
|
||||||
EIGEN_CHECK_ROW_RANGE(*this, row);
|
EI_CHECK_ROW_RANGE(*this, row);
|
||||||
return m_matrix.read(m_row, row);
|
return m_matrix.read(m_row, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,28 +80,28 @@ template<typename MatrixType> class EiRow
|
|||||||
const int m_row;
|
const int m_row;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MatrixType> class MatrixCol
|
template<typename MatrixType> class EiColumn
|
||||||
: public EiObject<typename MatrixType::Scalar, MatrixCol<MatrixType> >
|
: public EiObject<typename MatrixType::Scalar, EiColumn<MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Ref MatRef;
|
typedef typename MatrixType::Ref MatRef;
|
||||||
friend class EiObject<Scalar, MatrixCol<MatrixType> >;
|
friend class EiObject<Scalar, EiColumn<MatrixType> >;
|
||||||
typedef MatrixCol Ref;
|
typedef EiColumn Ref;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = 1;
|
ColsAtCompileTime = 1;
|
||||||
|
|
||||||
MatrixCol(const MatRef& matrix, int col)
|
EiColumn(const MatRef& matrix, int col)
|
||||||
: m_matrix(matrix), m_col(col)
|
: m_matrix(matrix), m_col(col)
|
||||||
{
|
{
|
||||||
EIGEN_CHECK_COL_RANGE(matrix, col);
|
EI_CHECK_COL_RANGE(matrix, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixCol(const MatrixCol& other)
|
EiColumn(const EiColumn& other)
|
||||||
: m_matrix(other.m_matrix), m_col(other.m_col) {}
|
: m_matrix(other.m_matrix), m_col(other.m_col) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixCol)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiColumn)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -110,15 +110,15 @@ template<typename MatrixType> class MatrixCol
|
|||||||
|
|
||||||
Scalar& _write(int row, int col=0)
|
Scalar& _write(int row, int col=0)
|
||||||
{
|
{
|
||||||
EIGEN_UNUSED(col);
|
EI_UNUSED(col);
|
||||||
EIGEN_CHECK_ROW_RANGE(*this, row);
|
EI_CHECK_ROW_RANGE(*this, row);
|
||||||
return m_matrix.write(row, m_col);
|
return m_matrix.write(row, m_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scalar _read(int row, int col=0) const
|
Scalar _read(int row, int col=0) const
|
||||||
{
|
{
|
||||||
EIGEN_UNUSED(col);
|
EI_UNUSED(col);
|
||||||
EIGEN_CHECK_ROW_RANGE(*this, row);
|
EI_CHECK_ROW_RANGE(*this, row);
|
||||||
return m_matrix.read(row, m_col);
|
return m_matrix.read(row, m_col);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,17 +128,17 @@ template<typename MatrixType> class MatrixCol
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
MatrixRow<EiObject<Scalar, Derived> >
|
EiRow<EiObject<Scalar, Derived> >
|
||||||
EiObject<Scalar, Derived>::row(int i)
|
EiObject<Scalar, Derived>::row(int i)
|
||||||
{
|
{
|
||||||
return MatrixRow<EiObject>(ref(), i);
|
return EiRow<EiObject>(ref(), i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Derived>
|
template<typename Scalar, typename Derived>
|
||||||
MatrixCol<EiObject<Scalar, Derived> >
|
EiColumn<EiObject<Scalar, Derived> >
|
||||||
EiObject<Scalar, Derived>::col(int i)
|
EiObject<Scalar, Derived>::col(int i)
|
||||||
{
|
{
|
||||||
return MatrixCol<EiObject>(ref(), i);
|
return EiColumn<EiObject>(ref(), i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_ROWANDCOL_H
|
#endif // EI_ROWANDCOL_H
|
||||||
|
@ -23,28 +23,28 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_SCALAROPS_H
|
#ifndef EI_SCALAROPS_H
|
||||||
#define EIGEN_SCALAROPS_H
|
#define EI_SCALAROPS_H
|
||||||
|
|
||||||
template<typename MatrixType> class EiScalarProduct
|
template<typename MatrixType> class EiScalarProduct
|
||||||
: public EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >
|
: public EiObject<typename MatrixType::Scalar, EiScalarProduct<MatrixType> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Ref MatRef;
|
typedef typename MatrixType::Ref MatRef;
|
||||||
typedef EiScalarProduct Ref;
|
typedef EiScalarProduct Ref;
|
||||||
friend class EiObject<typename MatrixType::Scalar, ScalarProduct<MatrixType> >;
|
friend class EiObject<typename MatrixType::Scalar, EiScalarProduct<MatrixType> >;
|
||||||
|
|
||||||
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = MatrixType::ColsAtCompileTime;
|
ColsAtCompileTime = MatrixType::ColsAtCompileTime;
|
||||||
|
|
||||||
ScalarProduct(const MatRef& matrix, Scalar scalar)
|
EiScalarProduct(const MatRef& matrix, Scalar scalar)
|
||||||
: m_matrix(matrix), m_scalar(scalar) {}
|
: m_matrix(matrix), m_scalar(scalar) {}
|
||||||
|
|
||||||
ScalarProduct(const ScalarProduct& other)
|
EiScalarProduct(const EiScalarProduct& other)
|
||||||
: m_matrix(other.m_matrix), m_scalar(other.m_scalar) {}
|
: m_matrix(other.m_matrix), m_scalar(other.m_scalar) {}
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ScalarProduct)
|
EI_INHERIT_ASSIGNMENT_OPERATORS(EiScalarProduct)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Ref& _ref() const { return *this; }
|
const Ref& _ref() const { return *this; }
|
||||||
@ -61,25 +61,25 @@ template<typename MatrixType> class EiScalarProduct
|
|||||||
const Scalar m_scalar;
|
const Scalar m_scalar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \
|
#define EI_MAKE_SCALAR_OPS(OtherScalar) \
|
||||||
template<typename Scalar, typename Derived> \
|
template<typename Scalar, typename Derived> \
|
||||||
ScalarProduct<Derived> \
|
EiScalarProduct<Derived> \
|
||||||
operator*(const EiObject<Scalar, Derived>& matrix, \
|
operator*(const EiObject<Scalar, Derived>& matrix, \
|
||||||
OtherScalar scalar) \
|
OtherScalar scalar) \
|
||||||
{ \
|
{ \
|
||||||
return ScalarProduct<Derived>(matrix.ref(), scalar); \
|
return EiScalarProduct<Derived>(matrix.ref(), scalar); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
template<typename Scalar, typename Derived> \
|
template<typename Scalar, typename Derived> \
|
||||||
ScalarProduct<Derived> \
|
EiScalarProduct<Derived> \
|
||||||
operator*(OtherScalar scalar, \
|
operator*(OtherScalar scalar, \
|
||||||
const EiObject<Scalar, Derived>& matrix) \
|
const EiObject<Scalar, Derived>& matrix) \
|
||||||
{ \
|
{ \
|
||||||
return ScalarProduct<Derived>(matrix.ref(), scalar); \
|
return EiScalarProduct<Derived>(matrix.ref(), scalar); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
template<typename Scalar, typename Derived> \
|
template<typename Scalar, typename Derived> \
|
||||||
ScalarProduct<Derived> \
|
EiScalarProduct<Derived> \
|
||||||
operator/(const EiObject<Scalar, Derived>& matrix, \
|
operator/(const EiObject<Scalar, Derived>& matrix, \
|
||||||
OtherScalar scalar) \
|
OtherScalar scalar) \
|
||||||
{ \
|
{ \
|
||||||
@ -102,13 +102,13 @@ EiObject<Scalar, Derived>::operator/=(const OtherScalar &other) \
|
|||||||
return *static_cast<Derived*>(this); \
|
return *static_cast<Derived*>(this); \
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_MAKE_SCALAR_OPS(int)
|
EI_MAKE_SCALAR_OPS(int)
|
||||||
EIGEN_MAKE_SCALAR_OPS(float)
|
EI_MAKE_SCALAR_OPS(float)
|
||||||
EIGEN_MAKE_SCALAR_OPS(double)
|
EI_MAKE_SCALAR_OPS(double)
|
||||||
EIGEN_MAKE_SCALAR_OPS(std::complex<int>)
|
EI_MAKE_SCALAR_OPS(std::complex<int>)
|
||||||
EIGEN_MAKE_SCALAR_OPS(std::complex<float>)
|
EI_MAKE_SCALAR_OPS(std::complex<float>)
|
||||||
EIGEN_MAKE_SCALAR_OPS(std::complex<double>)
|
EI_MAKE_SCALAR_OPS(std::complex<double>)
|
||||||
|
|
||||||
#undef EIGEN_MAKE_SCALAR_OPS
|
#undef EI_MAKE_SCALAR_OPS
|
||||||
|
|
||||||
#endif // EIGEN_SCALAROPS_H
|
#endif // EI_SCALAROPS_H
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_UTIL_H
|
#ifndef EI_UTIL_H
|
||||||
#define EIGEN_UTIL_H
|
#define EI_UTIL_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <complex>
|
#include <complex>
|
||||||
@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
#undef minor
|
#undef minor
|
||||||
|
|
||||||
#define EIGEN_UNUSED(x) (void)x
|
#define EI_UNUSED(x) (void)x
|
||||||
#define EIGEN_CHECK_RANGES(matrix, row, col) \
|
#define EI_CHECK_RANGES(matrix, row, col) \
|
||||||
assert(row >= 0 && row < (matrix).rows() && col >= 0 && col < (matrix).cols())
|
assert(row >= 0 && row < (matrix).rows() && col >= 0 && col < (matrix).cols())
|
||||||
#define EIGEN_CHECK_ROW_RANGE(matrix, row) \
|
#define EI_CHECK_ROW_RANGE(matrix, row) \
|
||||||
assert(row >= 0 && row < (matrix).rows())
|
assert(row >= 0 && row < (matrix).rows())
|
||||||
#define EIGEN_CHECK_COL_RANGE(matrix, col) \
|
#define EI_CHECK_COL_RANGE(matrix, col) \
|
||||||
assert(col >= 0 && col < (matrix).cols())
|
assert(col >= 0 && col < (matrix).cols())
|
||||||
|
|
||||||
//forward declarations
|
//forward declarations
|
||||||
@ -65,9 +65,9 @@ struct EiForwardDecl<EiMatrix<_Scalar, _Rows, _Cols> >
|
|||||||
|
|
||||||
const int EiDynamic = -1;
|
const int EiDynamic = -1;
|
||||||
|
|
||||||
#define EIGEN_UNUSED(x) (void)x
|
#define EI_UNUSED(x) (void)x
|
||||||
|
|
||||||
#define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
|
#define EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \
|
||||||
template<typename OtherScalar, typename OtherDerived> \
|
template<typename OtherScalar, typename OtherDerived> \
|
||||||
Derived& operator Op(const EiObject<OtherScalar, OtherDerived>& other) \
|
Derived& operator Op(const EiObject<OtherScalar, OtherDerived>& other) \
|
||||||
{ \
|
{ \
|
||||||
@ -78,18 +78,18 @@ Derived& operator Op(const Derived& other) \
|
|||||||
return EiObject<Scalar, Derived>::operator Op(other); \
|
return EiObject<Scalar, Derived>::operator Op(other); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
|
#define EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \
|
||||||
template<typename Other> \
|
template<typename Other> \
|
||||||
Derived& operator Op(const Other& scalar) \
|
Derived& operator Op(const Other& scalar) \
|
||||||
{ \
|
{ \
|
||||||
return EiObject<Scalar, Derived>::operator Op(scalar); \
|
return EiObject<Scalar, Derived>::operator Op(scalar); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
|
#define EI_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \
|
EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \
|
EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
|
EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \
|
||||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
|
EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \
|
||||||
EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
|
EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=)
|
||||||
|
|
||||||
#endif // EIGEN_UTIL_H
|
#endif // EI_UTIL_H
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// License. This exception does not invalidate any other reasons why a work
|
// License. This exception does not invalidate any other reasons why a work
|
||||||
// based on this file might be covered by the GNU General Public License.
|
// based on this file might be covered by the GNU General Public License.
|
||||||
|
|
||||||
#ifndef EIGEN_TEST_MAIN_H
|
#ifndef EI_TEST_MAIN_H
|
||||||
#define EIGEN_TEST_MAIN_H
|
#define EI_TEST_MAIN_H
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include <All>
|
#include <All>
|
||||||
@ -47,4 +47,4 @@ class EigenTest : public QObject
|
|||||||
void testMatrixManip();
|
void testMatrixManip();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EIGEN_TEST_MAIN_H
|
#endif // EI_TEST_MAIN_H
|
||||||
|
@ -44,9 +44,9 @@ template<typename MatrixType> void matrixManip(const MatrixType& m)
|
|||||||
|
|
||||||
void EigenTest::testMatrixManip()
|
void EigenTest::testMatrixManip()
|
||||||
{
|
{
|
||||||
matrixManip(Matrix<int, 2, 3>());
|
matrixManip(EiMatrix<int, 2, 3>());
|
||||||
matrixManip(Matrix<double, 3, 3>());
|
matrixManip(EiMatrix<double, 3, 3>());
|
||||||
matrixManip(Matrix<complex<float>, 4,3>());
|
matrixManip(EiMatrix<complex<float>, 4,3>());
|
||||||
matrixManip(EiMatrixXi(2, 2));
|
matrixManip(EiMatrixXi(2, 2));
|
||||||
matrixManip(EiMatrixXd(3, 5));
|
matrixManip(EiMatrixXd(3, 5));
|
||||||
matrixManip(EiMatrixXcf(4, 4));
|
matrixManip(EiMatrixXcf(4, 4));
|
||||||
|
@ -58,14 +58,14 @@ template<typename MatrixType1,
|
|||||||
|
|
||||||
void EigenTest::testMatrixOps()
|
void EigenTest::testMatrixOps()
|
||||||
{
|
{
|
||||||
matrixOps(Matrix<float, 1, 1>(), Matrix<float, 1, 1>());
|
matrixOps(EiMatrix<float, 1, 1>(), EiMatrix<float, 1, 1>());
|
||||||
matrixOps(Matrix<int, 2, 3>(), Matrix<int, 3, 1>());
|
matrixOps(EiMatrix<int, 2, 3>(), EiMatrix<int, 3, 1>());
|
||||||
matrixOps(Matrix<double, 3, 3>(), Matrix<double, 3, 3>());
|
matrixOps(EiMatrix<double, 3, 3>(), EiMatrix<double, 3, 3>());
|
||||||
matrixOps(Matrix<complex<float>, 4,3>(), Matrix<complex<float>, 3,4>());
|
matrixOps(EiMatrix<complex<float>, 4,3>(), EiMatrix<complex<float>, 3,4>());
|
||||||
matrixOps(EiMatrixXf(1, 1), EiMatrixXf(1, 3));
|
matrixOps(EiMatrixXf(1, 1), EiMatrixXf(1, 3));
|
||||||
matrixOps(EiMatrixXi(2, 2), EiMatrixXi(2, 2));
|
matrixOps(EiMatrixXi(2, 2), EiMatrixXi(2, 2));
|
||||||
matrixOps(EiMatrixXd(3, 5), EiMatrixXd(5, 1));
|
matrixOps(EiMatrixXd(3, 5), EiMatrixXd(5, 1));
|
||||||
matrixOps(EiMatrixXcf(4, 4), EiMatrixXcf(4, 4));
|
matrixOps(EiMatrixXcf(4, 4), EiMatrixXcf(4, 4));
|
||||||
matrixOps(EiMatrixXd(3, 5), Matrix<double, 5, 1>());
|
matrixOps(EiMatrixXd(3, 5), EiMatrix<double, 5, 1>());
|
||||||
matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4));
|
matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4));
|
||||||
}
|
}
|
||||||
|
@ -53,11 +53,11 @@ template<typename VectorType> void vectorOps(const VectorType& v)
|
|||||||
|
|
||||||
void EigenTest::testVectorOps()
|
void EigenTest::testVectorOps()
|
||||||
{
|
{
|
||||||
vectorOps(Vector2i());
|
vectorOps(EiVector2i());
|
||||||
vectorOps(Vector3d());
|
vectorOps(EiVector3d());
|
||||||
vectorOps(Vector4cf());
|
vectorOps(EiVector4cf());
|
||||||
vectorOps(VectorXf(1));
|
vectorOps(EiVectorXf(1));
|
||||||
vectorOps(VectorXi(2));
|
vectorOps(EiVectorXi(2));
|
||||||
vectorOps(VectorXd(3));
|
vectorOps(EiVectorXd(3));
|
||||||
vectorOps(VectorXcf(4));
|
vectorOps(EiVectorXcf(4));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user