ArmadilloSolver
The GeMA Armadillo Numeric Solver Plugin
Loading...
Searching...
No Matches
gmpArmadilloSolver.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_PLUGIN_ARMADILLO_SOLVER_H_
25#define _GEMA_PLUGIN_ARMADILLO_SOLVER_H_
26
27
28#include <gmNumSolver.h>
29#include <gmSparseMatrix.h>
30
38{
39public:
41 virtual ~GmpArmadilloSolver();
42
43 // Comments on the base class
44 virtual const char* pluginName() const { return "ArmadilloSolver"; }
45
46 // Comments on the base class
47 virtual const char* pluginType() const { return "ns"; }
48
49 virtual bool loadPrivateData(LuaTable& table);
50
51 virtual GmSolverMatrix* newMatrix(int nlin, int ncol, const GmSolverMatrix* sharedLayout,
52 int numThreads = -1) const;
53
54 // Comments on the base class
55 virtual bool setSolverTolerance(double tol) { Q_UNUSED(tol); return false; }
56
57 virtual bool solveImpl(GmSolverMatrix* A, const GmVector& b, GmVector& x, bool xIsGuess = false) const;
58
59 virtual void printParameters(const GmLogCategory& logger);
60
61 // TODO: This should be removed. Used to temporarily help crisms to get hold of a
62 // native Armadillo matrix
63 const arma::sp_mat& armaMatrix(GmSolverMatrix* A) const;
64
65 // Comments on the base class
66 virtual QString quickDescription() const { return tr("Armadillo (%1) direct solver [%2]").arg(_useSparseMatrices ? "SuperLU" : "Lapack").arg(id()); }
67
68 // Comments on the base class
69 virtual int trackItemId() const { return _trackSolveItem; }
70
71private:
72#ifdef ENABLE_TESTS
73 friend Q_DECL_EXPORT void TEST_GmpArmadilloSolver(const GmLogCategory&, GmLogLevel);
74#endif
75
78 arma::superlu_opts _superLuOptions;
80
81 static int _numSolvers;
82 int _trackSolveItem = -1;
83};
84
85#endif
86
virtual const GmLogCategory & logger() const
QString description() const
Basic class for the standard numeric solver plugin object.
Definition gmpArmadilloSolver.h:38
bool _hasUserOptions
Set to true if _superLuOptions is not the default. Controls whether options should be printed or not.
Definition gmpArmadilloSolver.h:79
bool _useSparseMatrices
Defines weather we should use sparse or full matrices.
Definition gmpArmadilloSolver.h:76
virtual ~GmpArmadilloSolver()
Destructor.
Definition gmpArmadilloSolver.cpp:74
static int _numSolvers
The number of instanced solvers.
Definition gmpArmadilloSolver.h:81
const arma::sp_mat & armaMatrix(GmSolverMatrix *A) const
This should be removed. Used to temporarily help crisms to get hold of a native Armadillo matrix.
Definition gmpArmadilloSolver.cpp:299
GmSparseMatrixOptions _armaMatrixOptions
The set of options used for building the sparse matrix.
Definition gmpArmadilloSolver.h:77
GmpArmadilloSolver(GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
Constructor. Will be called by the plugin loading code.
Definition gmpArmadilloSolver.cpp:46
arma::superlu_opts _superLuOptions
The configured set of SuperLU options.
Definition gmpArmadilloSolver.h:78
GmLogLevel
arma::vec GmVector
QString tr(const char *sourceText, const char *disambiguation, int n)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const