iMSTK
Interactive Medical Simulation Toolkit
imstkLinearSystem.cpp
1 /*=========================================================================
2 
3  Library: iMSTK
4 
5  Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
6  & Imaging in Medicine, Rensselaer Polytechnic Institute.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0.txt
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =========================================================================*/
21 
22 #include "imstkLinearSystem.h"
23 
24 namespace imstk
25 {
26 //template<typename SystemMatrixType>
27 //LinearSystem<SystemMatrixType>::LinearSystem(const SystemMatrixType &matrix, const Vectord &b)
28 //{
29 // if (m_A.size() == m_b.size())
30 // {
31 // m_A = &matrix;
32 // m_b = &b;
33 // }
34 // else
35 // {
36 // LOG(ERROR) << "LinearSystem::LinearSystem: The size of the matrix and the r.h.s doesn't match.";
37 // }
38 //
39 // this->F = [this](const Vectord& x) -> Vectord&
40 // {
41 // this->m_f = this->m_A * x;
42 // return this->m_f;
43 // };
44 //}
45 
46 template<typename SystemMatrixType>
47 Eigen::TriangularView<SystemMatrixType, Eigen::Lower>
49 {
50  return m_A.template triangularView<Eigen::Lower>();
51 }
52 
53 template<typename SystemMatrixType>
54 Eigen::TriangularView<SystemMatrixType, Eigen::StrictlyLower>
56 {
57  return m_A.template triangularView<Eigen::StrictlyLower>();
58 }
59 
60 template<typename SystemMatrixType>
61 Eigen::TriangularView<SystemMatrixType, Eigen::Upper>
63 {
64  return m_A.template triangularView<Eigen::Upper>();
65 }
66 
67 template<typename SystemMatrixType>
68 Eigen::TriangularView<SystemMatrixType, Eigen::StrictlyUpper>
70 {
71  return m_A.template triangularView<Eigen::StrictlyUpper>();
72 }
73 
74 template<typename SystemMatrixType>
75 Vectord&
77 {
78  return m_f;
79 }
80 
81 template<typename SystemMatrixType> size_t
83 {
84  return m_A.size();
85 }
86 } // namespace imstk
Eigen::TriangularView< SystemMatrixType, Eigen::Lower > getLowerTriangular() const
Returns template expression for the lower triangular part of A.
Compound Geometry.
Vectord & getFunctionValue()
Get the value of the function F.
Eigen::TriangularView< SystemMatrixType, Eigen::StrictlyUpper > getStrictUpperTriangular() const
Returns template expression for the strict upper triangular part of A.
Eigen::TriangularView< SystemMatrixType, Eigen::Upper > getUpperTrianglular() const
Returns template expression for the upper triangular part of A.
Eigen::TriangularView< SystemMatrixType, Eigen::StrictlyLower > getStrictLowerTriangular() const
Returns template expression for the strict lower triangular part of A.
size_t getSize()
Returns the size of the system.