File: Matrix.hpp

package info (click to toggle)
pbseqlib 5.3.4%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,020 kB
  • sloc: cpp: 77,246; python: 331; sh: 103; makefile: 42
file content (53 lines) | stat: -rw-r--r-- 933 bytes parent folder | download | duplicates (4)
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_