/usr/include/pbdata/matrix/FlatMatrix.hpp is in libpbdata-dev 0~20151014+gitbe5d1bf-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #ifndef _BLASR_FLAT_MATRIX_HPP_
#define _BLASR_FLAT_MATRIX_HPP_
#define rc2index(r, c, rowSize) ( (r) * (rowSize) + c)
template<typename T>
void CreateFlatMatrix(int rows, int cols, std::vector<T> &matrix);
template<typename T>
void PrintFlatMatrix(std::vector<T> &matrix, int rows, int cols, std::ostream &out, int width=6);
template<typename T>
void PrintFlatMatrix(const T* matrix, int rows, int cols, std::ostream &out, int width=6);
template<typename T>
class FlatMatrix2D {
public:
T* matrix;
int nRows, nCols;
int totalSize;
int RC2Index(int row, int col);
FlatMatrix2D();
~FlatMatrix2D();
T* operator[](int row);
T operator()(int row, int col);
unsigned int Size();
void Fill(T value) {
fill(matrix, &matrix[totalSize], value);
}
void Resize(int _nRows, int _nCols) {
Grow(_nRows, _nCols);
}
void Resize(unsigned int totalSize);
FlatMatrix2D(int _nRows, int _nCols);
void Clear() {
if (matrix) {delete[] matrix;}
matrix = NULL;
nRows = nCols = 0;
totalSize = 0;
}
void Grow(int _nRows, int _nCols);
T Get(int r, int c);
T Set(int r, int c, T v);
int Index(int r, int c);
void Print(std::ostream &out);
void Allocate(UInt _nRows, UInt _nCols);
void Initialize(T value);
};
template<typename T>
class FlatMatrix3D {
public:
T* matrix;
//
// For some reason it makes sense to go from rows,cols to x,y,z
// for referencing coordinates.
//
int nx, ny, nz;
int xy;
int totalSize;
FlatMatrix3D();
FlatMatrix3D(int _nx, int _ny, int _nz);
void Grow(int _nx, int _ny, int _nz);
int Index(int x, int y, int z);
T Get(int x, int y, int z);
T Set(int x, int y, int z, T v);
~FlatMatrix3D();
};
#include "FlatMatrixImpl.hpp"
#endif // _BLASR_FLAT_MATRIX_HPP_
|