29 #ifndef __SPARSEMATRIX_HPP
30 #define __SPARSEMATRIX_HPP
33 # pragma GCC system_header
37 #include "allocator.h"
57 int _maxEntriesPerRow;
74 void Resize(
int rows ,
int maxEntriesPerRow );
109 bool write( FILE* fp )
const;
110 bool write(
const char* fileName )
const;
111 bool read( FILE* fp );
112 bool read(
const char* fileName );
125 if( _dim )
for(
int t=0 ; t<int(
out.size()) ; t++ )
delete[]
out[t];
135 for(
int t=0 ; t<int(
out.size()) ; t++ )
delete[]
out[t];
137 for(
int t=0 ; t<int(
out.size()) ; t++ )
out[t] =
new T2[dim];
169 #if defined _WIN32 && !defined __MINGW32__
185 #include "sparse_matrix.hpp"
This templated class assists in memory allocation and is well suited for instances when it is known t...
MatrixEntry< T > * operator[](int idx)
MatrixEntry< T > ** m_ppElements
SparseMatrix< T > Multiply(const SparseMatrix< T > &M) const
SparseMatrix< T > Transpose() const
static void SetAllocator(int blockSize)
SparseMatrix< T > & operator*=(const T &V)
SparseMatrix< T > MultiplyTranspose(const SparseMatrix< T > &Mt) const
SparseMatrix< T > & operator=(const SparseMatrix< T > &M)
bool write(FILE *fp) const
static int SolveSymmetric(const SparseMatrix< T > &M, const Vector< T2 > &b, int iters, Vector< T2 > &solution, const T2 eps=1e-8, int reset=1, int threads=1)
void SetRowSize(int row, int count)
static int Solve(const SparseMatrix< T > &M, const Vector< T > &b, int iters, Vector< T > &solution, const T eps=1e-8)
SparseMatrix< T > operator*(const T &V) const
static int UseAllocator(void)
static Allocator< MatrixEntry< T > > internalAllocator
static int Solve(const SparseSymmetricMatrix< T > &M, const Vector< T2 > &b, int iters, Vector< T2 > &solution, T2 eps=1e-8, int reset=1, int threads=0, bool addDCTerm=false, bool solveNormal=false)
void getDiagonal(Vector< T2 > &diagonal) const
Vector< T2 > operator*(const Vector< T2 > &V) const
Vector< T2 > Multiply(const Vector< T2 > &V) const
static int SolveAtomic(const SparseSymmetricMatrix< T > &M, const Vector< T2 > &b, int iters, Vector< T2 > &solution, T2 eps=1e-8, int reset=1, int threads=0, bool solveNormal=false)
void resize(int threads, int dim)
const T2 * operator[](int t) const