00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LSIMPLEMATRIX_H
00016 #define LSIMPLEMATRIX_H
00017
00018 #include "pandabase.h"
00019
00020 #ifdef HAVE_EIGEN
00021 #include <Eigen/Dense>
00022 #endif
00023
00024
00025
00026
00027
00028
00029
00030
00031 template <class FloatType, int NumRows, int NumCols>
00032 class LSimpleMatrix {
00033 public:
00034 INLINE LSimpleMatrix();
00035 INLINE LSimpleMatrix(const LSimpleMatrix<FloatType, NumRows, NumCols> ©);
00036 INLINE void operator = (const LSimpleMatrix<FloatType, NumRows, NumCols> ©);
00037 INLINE const FloatType &operator () (int row, int col) const;
00038 INLINE FloatType &operator () (int row, int col);
00039 INLINE const FloatType &operator () (int col) const;
00040 INLINE FloatType &operator () (int col);
00041
00042 private:
00043 FloatType _array[NumRows][NumCols];
00044 };
00045
00046 #include "lsimpleMatrix.I"
00047
00048
00049 #ifdef HAVE_EIGEN
00050 #define UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols) Eigen::Matrix<FloatType, NumRows, NumCols, Eigen::DontAlign | Eigen::RowMajor>
00051
00052 #ifdef LINMATH_ALIGN
00053 #define LINMATH_MATRIX(FloatType, NumRows, NumCols) Eigen::Matrix<FloatType, NumRows, NumCols, Eigen::RowMajor>
00054 #else // LINMATH_ALIGN
00055 #define LINMATH_MATRIX(FloatType, NumRows, NumCols) UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols)
00056 #endif // LINMATH_ALIGN
00057
00058 #else // HAVE_EIGEN
00059 #define UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols) LSimpleMatrix<FloatType, NumRows, NumCols>
00060 #define LINMATH_MATRIX(FloatType, NumRows, NumCols) UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols)
00061 #endif // HAVE_EIGEN
00062
00063
00064 #ifdef LINMATH_ALIGN
00065 #define ALIGN_LINMATH ALIGN_16BYTE
00066 #else
00067 #define ALIGN_LINMATH
00068 #endif // LINMATH_ALIGN
00069
00070 #endif
00071
00072