1 /*
2   HMat-OSS (HMatrix library, open source software)
3 
4   Copyright (C) 2014-2015 Airbus Group SAS
5 
6   This program is free software; you can redistribute it and/or
7   modify it under the terms of the GNU General Public License
8   as published by the Free Software Foundation; either version 2
9   of the License, or (at your option) any later version.
10 
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15 
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 
20   http://github.com/jeromerobert/hmat-oss
21 */
22 
23 #ifndef _DEFAULT_ENGINE_HPP
24 #define _DEFAULT_ENGINE_HPP
25 #include "h_matrix.hpp"
26 #include "uncompressed_block.hpp"
27 #include "uncompressed_values.hpp"
28 #include "iengine.hpp"
29 
30 namespace hmat {
31 
32 template<typename T> class DefaultEngine : public IEngine<T>
33 {
34   NullSettings settings;
35 public:
~DefaultEngine()36   ~DefaultEngine(){}
37   typedef hmat::UncompressedBlock<T> UncompressedBlock;
38   typedef hmat::UncompressedValues<T> UncompressedValues;
destroy()39   void destroy(){}
GetSettings()40   EngineSettings& GetSettings(){ return settings;}
41   static int init();
finalize()42   static void finalize(){}
43   void assembly(Assembly<T>& f, SymmetryFlag sym, bool ownAssembly);
44   void factorization(Factorization);
45   void inverse();
46   void gemv(char trans, T alpha, ScalarArray<T>& x, T beta, ScalarArray<T>& y) const;
47   void gemm(char transA, char transB, T alpha, const IEngine<T>& a, const IEngine<T>& b, T beta);
48   void trsm(char side, char uplo, char trans, char diag, T alpha, IEngine<T> &B) const;
49   void trsm(char side, char uplo, char trans, char diag, T alpha, ScalarArray<T> &B) const;
50   void addIdentity(T alpha);
51   void addRand(double epsilon);
52   void solve(ScalarArray<T>& b, Factorization) const;
53   void solve(IEngine<T>& b, Factorization) const;
54   void solveLower(ScalarArray<T>& b, Factorization t, bool transpose=false) const;
55   void copy(IEngine<T> & result, bool structOnly) const;
56   void transpose();
57   void applyOnLeaf(const hmat::LeafProcedure<hmat::HMatrix<T> >&f);
clone() const58   IEngine<T>* clone() const { return new DefaultEngine();};
getHandle() const59   HMatrix<T> * getHandle() const { return IEngine<T>::hmat; }
60   void scale(T alpha);
61   void info(hmat_info_t &i) const;
62 };
63 
64 }  // end namespace hmat
65 
66 #endif
67