refactoring with ECS
This commit is contained in:
parent
4078cdea8f
commit
e25625998c
20 changed files with 176 additions and 770 deletions
|
@ -70,7 +70,6 @@ struct matrix_ : matrixbase_<T, matrix_<R, C, T>>
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// //! get cell count
|
||||
// inline std::size_t coefficients() const { return this->size(); }
|
||||
|
||||
|
|
|
@ -116,121 +116,8 @@ struct matrixbase_ {
|
|||
inline const Derived operator - (const T& b) const { Derived r(derived()); for (auto & e : r) e -= b; return r; }
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
///**
|
||||
// * \brief base class for all matrix and vector operations
|
||||
// */
|
||||
//template <typename T> class matrixbase {
|
||||
//public:
|
||||
|
||||
// typedef T value_type;
|
||||
// typedef int offset_type;
|
||||
// typedef unsigned int size_type;
|
||||
|
||||
|
||||
// matrixbase() {}
|
||||
|
||||
// //! assignment constructor
|
||||
// explicit matrixbase(int rows, int cols,T* ptr,bool row_major,int data_offset = 0)
|
||||
// : _data(ptr)
|
||||
// , _data_offset(data_offset)
|
||||
// , _rows(rows)
|
||||
// , _cols(cols)
|
||||
// , _row_stride(row_major ? 1 : cols)
|
||||
// , _col_stride(row_major ? rows : 1)
|
||||
// {
|
||||
// }
|
||||
|
||||
// inline const T& get_element(int e) const { return this->at(e); }
|
||||
// inline void set_element(int e,const T &v) { this->at(e) = v; }
|
||||
|
||||
// //! return number of rows
|
||||
// inline unsigned int rows() const { return _rows; }
|
||||
// //! return number of columns
|
||||
// inline unsigned int cols() const { return _cols; }
|
||||
|
||||
// //! get cell count
|
||||
// inline unsigned int cells() const { return _rows * _cols; }
|
||||
|
||||
// //! get data
|
||||
// inline T* data() { return _data + _data_offset; }
|
||||
|
||||
// //! get data
|
||||
// inline const T* data() const { return _data + _data_offset; }
|
||||
|
||||
// //! get item at index
|
||||
// inline T& at(unsigned int idx) { return data()[idx]; }
|
||||
|
||||
// //! get item at index
|
||||
// inline const T& at(unsigned int idx) const { return data()[idx]; }
|
||||
|
||||
// //! get item at position
|
||||
// inline T& at(unsigned int r,unsigned int c) { return data()[r * _row_stride + c * _col_stride]; }
|
||||
|
||||
// //! get item at position
|
||||
// inline const T& at(unsigned int r,unsigned int c) const { return data()[r * _row_stride + c * _col_stride]; }
|
||||
|
||||
// //! fill data
|
||||
// inline matrixbase& fill(const T& val) {
|
||||
// for (unsigned int r = 0; r < this->rows(); r++)
|
||||
// for (unsigned int c = 0; c < this->cols(); c++)
|
||||
// this->at(r,c) = val;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
// //! set identity
|
||||
// inline matrixbase& set_identity() {
|
||||
// for (unsigned int r = 0;r < rows(); r++)
|
||||
// for (unsigned int c = 0; c < cols(); c++)
|
||||
// this->at(r,c) = (c == r) ? T(1) : T(0);
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
// //! set strides for row and column
|
||||
// inline void set_stride(int row_stride,int col_stride) {
|
||||
// _row_stride = row_stride; _col_stride = col_stride;
|
||||
// }
|
||||
|
||||
// //! return row stride (elements between consequtive rows)
|
||||
// inline int row_stride() const { return _row_stride; }
|
||||
|
||||
// //! return column stride (elements between consequtive columns)
|
||||
// inline int col_stride() const { return _col_stride; }
|
||||
|
||||
// //! get row major
|
||||
// inline bool is_row_major() const { return row_stride() > col_stride(); }
|
||||
|
||||
// //! check if squared
|
||||
// inline bool is_square() const { return (_rows == _cols); }
|
||||
|
||||
// //! flip row/column order
|
||||
// inline void flip_order() { set_stride(col_stride(),row_stride()); }
|
||||
|
||||
// //! get the offset for data in the matrix
|
||||
// inline int get_data_offset(int r,int c) const { return (r * _row_stride + c * _col_stride) + _data_offset; }
|
||||
|
||||
//protected:
|
||||
|
||||
// T* _data;
|
||||
// int _data_offset;
|
||||
|
||||
// int _cols;
|
||||
// int _rows;
|
||||
|
||||
// int _row_stride;
|
||||
// int _col_stride;
|
||||
|
||||
//};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue