123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #pragma once
- template <typename T>
- class AbstractDense {
- public:
- AbstractDense() = default;
- AbstractDense(int rows, int columns, const T &data) :
- m_rows(rows)
- , m_columns(columns)
- , m_data(data) {}
- void setDimentions(int rows, int columns) {
- m_rows = rows;
- m_columns = columns;
- }
- void setData(const T &data) {
- m_data = data;
- }
- int rows() const {
- return m_rows;
- }
- int columns() const {
- return m_columns;
- }
- template<typename R>
- R value(int row, int column) const {
- return m_data[(m_columns - 1) * row + column + row];
- }
- protected:
- int m_rows;
- int m_columns;
- T m_data;
- };
|