Split Row and Column into separate files.

Introduce a notion of RowVector (typedef for Matriw with 1 row)
Make row() return a row vector instead of a "column vector"
Introduce operator[] to access elements of row/column vectors uniformly
Remove default arguments in operator(), these were for vectors, now use operator[] instead
This commit is contained in:
Benoit Jacob
2007-10-01 07:45:30 +00:00
parent 3cf6caba1a
commit 96524fc573
6 changed files with 45 additions and 84 deletions

View File

@@ -33,7 +33,7 @@
template<typename _Scalar, int _Rows, int _Cols>
class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >,
public EiMatrixStorage<_Scalar, _Rows, _Cols>
public EiMatrixStorage<_Scalar, _Rows, _Cols>
{
public:
friend class EiObject<_Scalar, EiMatrix>;
@@ -57,13 +57,13 @@ class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >,
Ref _ref() { return Ref(*this); }
ConstRef _constRef() const { return ConstRef(*this); }
const Scalar& _read(int row, int col = 0) const
const Scalar& _read(int row, int col) const
{
EI_CHECK_RANGES(*this, row, col);
return array()[row + col * Storage::_rows()];
}
Scalar& _write(int row, int col = 0)
Scalar& _write(int row, int col)
{
EI_CHECK_RANGES(*this, row, col);
return array()[row + col * Storage::_rows()];
@@ -103,7 +103,8 @@ class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >,
#define EI_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
typedef EiMatrix<Type, Size, Size> EiMatrix##SizeSuffix##TypeSuffix; \
typedef EiMatrix<Type, Size, 1> EiVector##SizeSuffix##TypeSuffix;
typedef EiMatrix<Type, Size, 1> EiVector##SizeSuffix##TypeSuffix; \
typedef EiMatrix<Type, 1, Size> EiRowVector##SizeSuffix##TypeSuffix;
#define EI_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
EI_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
@@ -124,6 +125,5 @@ EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
#include "Eval.h"
#include "MatrixOps.h"
#include "ScalarOps.h"
#include "RowAndCol.h"
#endif // EI_MATRIX_H