FEMTIC
RougheningMatrix.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------------
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2021 Yoshiya Usui
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //-------------------------------------------------------------------------------------------------------
24 #ifndef DBLDEF_ROUGHENING_MATRIX
25 #define DBLDEF_ROUGHENING_MATRIX
26 
27 #include "DoubleSparseMatrix.h"
29 
31 
32 public:
33 
34  //Default Constructer
35  explicit RougheningMatrix();
36 
37  //Constructer
38  explicit RougheningMatrix( const int nrows, const int ncols, const int nRhs = 1 );
39 
40  //Destructer
41  virtual ~RougheningMatrix();
42 
43  //Input component of matrix.
44  virtual void setStructureByTripletFormat( const int row, const int col );
45 
46  // Set matrix structure ( locations of non-zero components ) and add values by triplet format
47  virtual void setStructureAndAddValueByTripletFormat( const int row, const int col, const double val );
48 
49  //Add non-zero value to matrix
50  virtual void addNonZeroValues( const int row, const int col, const double val );
51 
52  //Make [R]T[R] matrix, where [R] is a constraining matrix
53  void makeRTRMatrix( DoubleSparseSquareSymmetricMatrix& RTRMatrix, const double smallValueOnDiagonals = 0.0 ) const;
54 
55  // Calculate model roughness
56  double calcModelRoughness( const double* modelVec ) const;
57 
58  // Calculate vector of model roughness
59  void calcVectorOfModelRoughness( const double* modelVec, double* roughnessVec ) const;
60 
61  // Postmultiply diagonal matrix
62  void postmultiplyDiagonalMatrix( const double* diagMatrix );
63 
64  // Output roughneing matrix
65  void outputRougheningMatrix( const std::string& fileName ) const;
66 
67 private:
68  //Copy constructer
69  RougheningMatrix(const RougheningMatrix &matrix );
70 
71  // Assignment operator
73 
74 };
75 
76 #endif
Definition: DoubleSparseMatrix.h:29
Definition: DoubleSparseSquareSymmetricMatrix.h:31
Definition: RougheningMatrix.h:30
virtual void setStructureByTripletFormat(const int row, const int col)
Definition: RougheningMatrix.cpp:52
RougheningMatrix & operator=(const RougheningMatrix &rhs)
Definition: RougheningMatrix.cpp:149
virtual void setStructureAndAddValueByTripletFormat(const int row, const int col, const double val)
Definition: RougheningMatrix.cpp:57
RougheningMatrix()
Definition: RougheningMatrix.cpp:37
void postmultiplyDiagonalMatrix(const double *diagMatrix)
Definition: RougheningMatrix.cpp:130
void outputRougheningMatrix(const std::string &fileName) const
Definition: RougheningMatrix.cpp:155
void makeRTRMatrix(DoubleSparseSquareSymmetricMatrix &RTRMatrix, const double smallValueOnDiagonals=0.0) const
Definition: RougheningMatrix.cpp:68
virtual void addNonZeroValues(const int row, const int col, const double val)
Definition: RougheningMatrix.cpp:63
void calcVectorOfModelRoughness(const double *modelVec, double *roughnessVec) const
Definition: RougheningMatrix.cpp:117
double calcModelRoughness(const double *modelVec) const
Definition: RougheningMatrix.cpp:94
virtual ~RougheningMatrix()
Definition: RougheningMatrix.cpp:47