1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#ifndef _BLASR_MATRIX_HPP_
#define _BLASR_MATRIX_HPP_
#include <vector>
#include <pbdata/Types.h>
template <typename T>
void CreateMatrix(int rows, int cols, std::vector<T*> matrix);
/*
* Implement a matrix as an array into a large allocated buffer of size
* nRows * nCols.
*/
template <typename T>
class Matrix
{
private:
VectorIndex nRows;
VectorIndex nCols;
T** matrix;
VectorIndex matrixBufferSize;
VectorIndex matrixSize;
VectorIndex rowsBufferSize;
public:
Matrix();
unsigned int size();
unsigned int GetNCols();
unsigned int GetNRows();
void Resize(VectorIndex nRowsP, VectorIndex nColsP);
Matrix(VectorIndex nRowsP, VectorIndex nColsP);
void Reference(Matrix<T>& rhs);
void Initialize(T value);
T* operator[](VectorIndex rowIndex);
void Free();
void Print(std::ofstream& out);
};
#include "MatrixImpl.hpp"
#endif // _BLASR_MATRIX_HPP_
|