SuiteSparseSolver
The GeMA Suite Sparse Numeric Solver Plugin
Loading...
Searching...
No Matches
spqrSolver.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_SPQR_SOLVER_H_
25#define _GEMA_SPQR_SOLVER_H_
26
27#include "cholmodSolver.h"
28
31{
32public:
33
35 virtual ~SpqrSolver();
36
37 // Comments on the base class
38 virtual const char* pluginType() const { return "spqr"; }
39
40 virtual bool loadPrivateData(LuaTable& table);
41
42 // Comments on the base class.
43 virtual bool solveImpl(GmSolverMatrix* A, const GmVector& b, GmVector& x, bool xIsGuess = false) const
44 {
45 Q_UNUSED(xIsGuess);
46 return _i64 ? intSolve<int64_t>(A, b, x) : intSolve<int32_t>(A, b, x);
47 }
48
49 virtual void printParameters(const GmLogCategory& logger);
50
51private:
52 template <class INT> bool intSolve(GmSolverMatrix* A, const GmVector& b, GmVector& x) const;
53
54 QString errorStr() const { return CholmodSolver::errorStr(_context.status); }
55
56 mutable cholmod_common _context;
57 bool _gpu;
60 double _tol;
61
62 static int _numSolvers;
63};
64
65
66#endif
Declaration of the CholmodSolver class.
virtual const GmLogCategory & logger() const
QString description() const
A class for creating a GeMA solver based on the SPQR solver from the SuiteSparse library.
Definition spqrSolver.h:31
double _tol
The tolerance.
Definition spqrSolver.h:60
static int _numSolvers
The number of instanced solvers.
Definition spqrSolver.h:62
QString _orderStr
The requested ordering option.
Definition spqrSolver.h:59
SpqrSolver(GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
Constructor. Will be called by the plugin loading code.
Definition spqrSolver.cpp:49
cholmod_common _context
The Cholmod library context.
Definition spqrSolver.h:56
bool _gpu
Are we using the GPU?
Definition spqrSolver.h:57
bool intSolve(GmSolverMatrix *A, const GmVector &b, GmVector &x) const
Worker function for solve() parameterized on the int type (64 or 32 bits)
Definition spqrSolver.cpp:176
int _ordering
The requested ordering option.
Definition spqrSolver.h:58
virtual ~SpqrSolver()
Destructor.
Definition spqrSolver.cpp:72
A base class with the common behavior for creating a GeMA solver based on one of the following SuiteS...
Definition suiteSparseSolver.h:44
bool _i64
Are we using 64 bit indices for sparse matrices?
Definition suiteSparseSolver.h:80
arma::vec GmVector