FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
saddle_point_matrix.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
9#include <kernel/lafem/tuple_vector.hpp>
10#include <kernel/lafem/dense_vector.hpp>
11#include <kernel/lafem/container.hpp>
12
13
14// includes, system
15#include <type_traits>
16#include <fstream>
17
18namespace FEAT
19{
20 namespace LAFEM
21 {
29 template<
30 typename MatrixA_,
31 typename MatrixB_,
32 typename MatrixD_,
33 int i_,
34 int j_>
36
61 template<
62 typename MatrixA_,
63 typename MatrixB_ = MatrixA_,
64 typename MatrixD_ = MatrixB_>
66 {
67 public:
69 typedef MatrixA_ MatrixTypeA;
71 typedef MatrixB_ MatrixTypeB;
73 typedef MatrixD_ MatrixTypeD;
74
75 // ensure that all matrices have the same and data-types
76 static_assert(std::is_same<typename MatrixA_::DataType, typename MatrixB_::DataType>::value,
77 "A and B have different data-types");
78 static_assert(std::is_same<typename MatrixA_::DataType, typename MatrixD_::DataType>::value,
79 "A and D have different data-types");
80
81 // ensure that the compatible vector types are the same
82 static_assert(std::is_same<typename MatrixA_::VectorTypeL, typename MatrixB_::VectorTypeL>::value,
83 "A and B have different compatible L-vectors");
84 static_assert(std::is_same<typename MatrixA_::VectorTypeR, typename MatrixD_::VectorTypeR>::value,
85 "A and D have different compatible R-vectors");
86
88 typedef typename MatrixTypeA::DataType DataType;
90 typedef typename MatrixTypeA::IndexType IndexType;
91
97 template <typename DT2_ = DataType, typename IT2_ = IndexType>
99 typename MatrixB_::template ContainerType<DT2_, IT2_>,
100 typename MatrixD_::template ContainerType<DT2_, IT2_> >;
101
103 template <typename DataType2_, typename IndexType2_>
105
107 static constexpr int num_row_blocks = 2;
109 static constexpr int num_col_blocks = 2;
110
111 protected:
118
119 public:
121 SaddlePointMatrix() = default;
122
129 explicit SaddlePointMatrix(MatrixTypeA&& matrix_a, MatrixTypeB&& matrix_b, MatrixTypeD&& matrix_d) :
130 _matrix_a(std::forward<MatrixTypeA>(matrix_a)),
131 _matrix_b(std::forward<MatrixTypeB>(matrix_b)),
132 _matrix_d(std::forward<MatrixTypeD>(matrix_d))
133 {
134 XASSERT(_matrix_a.num_rows() == _matrix_b.num_rows());
135 XASSERT(_matrix_a.num_cols() == _matrix_d.num_cols());
136 }
137
140 _matrix_a(std::forward<MatrixTypeA>(other._matrix_a)),
141 _matrix_b(std::forward<MatrixTypeB>(other._matrix_b)),
142 _matrix_d(std::forward<MatrixTypeD>(other._matrix_d))
143 {
144 }
145
146 void init_workspace() const
147 {
148 _matrix_a.init_workspace();
149 _matrix_b.init_workspace();
150 _matrix_d.init_workspace();
151 }
152
153 void reset_workspace() const
154 {
155 _matrix_a.reset_workspace();
156 _matrix_b.reset_workspace();
157 _matrix_d.reset_workspace();
158 }
159
168 explicit SaddlePointMatrix(FileMode mode, const String& filename)
169 {
170 read_from(mode, filename);
171 }
172
179 void read_from(FileMode mode, const String& filename)
180 {
181 String directory;
182 auto found = filename.rfind("/");
183 if (found != std::string::npos)
184 {
185 directory = filename.substr(0, found + 1);
186 }
187
188 std::ifstream file(filename.c_str(), std::ifstream::in);
189 if (! file.is_open())
190 XABORTM("Unable to open Matrix file " + filename);
191
192 String line;
193 std::getline(file, line);
194 if (line.find("%%MatrixMarket saddlepointmatrix coordinate real general") == String::npos)
195 XABORTM("Input-file is not a complatible file");
196
197 do {
198 if (file.eof())
199 XABORTM("Wrong Input-file");
200 std::getline(file, line);
201 line.trim_me();
202 } while (line.find("%%") == 0 || line == "");
203
204 MatrixA_ tmp_a(mode, directory + line);
205 _matrix_a = std::move(tmp_a);
206
207 std::getline(file, line);
208 line.trim_me();
209 MatrixB_ tmp_b(mode, directory + line);
210 _matrix_b = std::move(tmp_b);
211
212 std::getline(file, line);
213 line.trim_me();
214 MatrixD_ tmp_d(mode, directory + line);
215 _matrix_d = std::move(tmp_d);
216
217 file.close();
218 }
219
222 {
223 if(this == &other)
224 return *this;
225 _matrix_a = std::forward<MatrixTypeA>(other._matrix_a);
226 _matrix_b = std::forward<MatrixTypeB>(other._matrix_b);
227 _matrix_d = std::forward<MatrixTypeD>(other._matrix_d);
228 return *this;
229 }
230
233 {
234 }
235
242 void write_out(FileMode mode, String filename) const
243 {
244 std::ofstream file(filename.c_str(), std::ofstream::out);
245 if (! file.is_open())
246 XABORTM("Unable to open Matrix file " + filename);
247
248 String suffix, directory;
249 auto found = filename.rfind(".");
250 if (found != std::string::npos)
251 {
252 suffix = filename.substr(found);
253 filename.erase(found);
254 }
255 found = filename.rfind("/");
256 if (found != std::string::npos)
257 {
258 directory = filename.substr(0, found + 1);
259 filename.erase(0, found + 1);
260 }
261
262 file << "%%MatrixMarket saddlepointmatrix coordinate real general\n";
263 file << filename << "_a" << suffix << "\n";
264 file << filename << "_b" << suffix << "\n";
265 file << filename << "_d" << suffix << "\n";
266
267 file.close();
268
269 _matrix_a.write_out(mode, directory + filename + "_a" + suffix);
270 _matrix_b.write_out(mode, directory + filename + "_b" + suffix);
271 _matrix_d.write_out(mode, directory + filename + "_d" + suffix);
272 }
273
278 {
279 return SaddlePointMatrix(_matrix_a.clone(mode), _matrix_b.clone(mode), _matrix_d.clone(mode));
280 }
281
283 std::size_t bytes() const
284 {
285 return _matrix_a.bytes() + _matrix_b.bytes() + _matrix_d.bytes();
286 }
287
290 {
291 return _matrix_a;
292 }
293
295 const MatrixTypeA& block_a() const
296 {
297 return _matrix_a;
298 }
299
302 {
303 return _matrix_b;
304 }
305
307 const MatrixTypeB& block_b() const
308 {
309 return _matrix_b;
310 }
311
314 {
315 return _matrix_d;
316 }
317
319 const MatrixTypeD& block_d() const
320 {
321 return _matrix_d;
322 }
323
336 template<int i_, int j_>
338 {
339 static_assert((0 <= i_) && (0 <= j_), "invalid sub-matrix index");
340 static_assert((i_ <= 1) && (j_ <= 1), "invalid sub-matrix index");
341 static_assert((i_ < 1) || (j_ < 1), "sub-matrix block (1,1) does not exist in SaddlePointMatrix");
343 }
344
346 template<int i_, int j_>
348 {
349 static_assert((0 <= i_) && (0 <= j_), "invalid sub-matrix index");
350 static_assert((i_ <= 1) && (j_ <= 1), "invalid sub-matrix index");
351 static_assert((i_ < 1) || (j_ < 1), "sub-matrix block (1,1) does not exist in SaddlePointMatrix");
353 }
354
359 {
360 return _matrix_a.num_rows() + _matrix_d.num_rows();
361 }
362
367 {
368 return _matrix_a.num_cols() + _matrix_b.num_cols();
369 }
370
375 {
376 return _matrix_a.num_nzes() + _matrix_b.num_nzes() + _matrix_d.num_nzes();
377 }
378
383 {
384 return _matrix_a.num_rows_raw() + _matrix_d.num_rows_raw();
385 }
386
391 {
392 return _matrix_a.num_cols_raw() + _matrix_b.num_cols_raw();
393 }
394
399 {
400 return _matrix_a.num_nzes_raw() + _matrix_b.num_nzes_raw() + _matrix_d.num_nzes_raw();
401 }
402
404 static String name()
405 {
406 return String("SaddePointMatrix<") + MatrixTypeA::name() + "," + MatrixTypeB::name() + "," + MatrixTypeD::name() + ">";
407 }
408
415 void format()
416 {
417 block_a().format();
418 block_b().format();
419 block_d().format();
420 }
421
422 void format(DataType value)
423 {
424 block_a().format(value);
425 block_b().format(value);
426 block_d().format(value);
427 }
428
432 void clear()
433 {
434 block_a().clear();
435 block_b().clear();
436 block_d().clear();
437 }
438
440 void extract_diag(VectorTypeL& diag) const
441 {
442 _matrix_a.extract_diag(diag.first());
443 diag.rest().format();
444 }
445
446 void lump_rows(VectorTypeL& lump, bool /*sync*/ = true) const
447 {
448 _matrix_a.lump_rows(lump.first());
449 lump.rest().format();
450 }
451
464 void apply(VectorTypeL& r, const VectorTypeR& x) const
465 {
466 block_a().apply(r.template at<0>(), x.template at<0>());
467 block_b().apply(r.template at<0>(), x.template at<1>(), r.template at<0>(), DataType(1));
468 block_d().apply(r.template at<1>(), x.template at<0>());
469 }
470
472 {
473 XASSERTM(r.size() == this->num_rows(), "Vector size of r does not match!");
474 XASSERTM(x.size() == this->num_cols(), "Vector size of x does not match!");
475
478
481
482 block_a().apply(r_first, x_first);
483 block_b().apply(r_first, x_rest, r_first, DataType(1));
484 block_d().apply(r_rest, x_first);
485 }
486
499 void apply_transposed(VectorTypeR& r, const VectorTypeL& x) const
500 {
501 block_a().apply_transposed(r.template at<0>(), x.template at<0>());
502 block_d().apply_transposed(r.template at<0>(), x.template at<1>(), r.template at<0>(), DataType(1));
503 block_b().apply_transposed(r.template at<1>(), x.template at<0>());
504 }
505
507 {
508 XASSERTM(r.size() == this->num_cols(), "Vector size of r does not match!");
509 XASSERTM(x.size() == this->num_rows(), "Vector size of x does not match!");
510
513
516
517 block_a().apply_transposed(r_first, x_first);
518 block_d().apply_transposed(r_first, x_rest, r_first, DataType(1));
519 block_b().applytransposed(r_rest, x_first);
520 }
521
539 void apply(VectorTypeL& r, const VectorTypeR& x, const VectorTypeL& y, DataType alpha = DataType(1)) const
540 {
541 block_a().apply(r.template at<0>(), x.template at<0>(), y.template at<0>(), alpha);
542 block_b().apply(r.template at<0>(), x.template at<1>(), r.template at<0>(), alpha);
543 block_d().apply(r.template at<1>(), x.template at<0>(), y.template at<1>(), alpha);
544 }
545
547 const DenseVector<DataType, IndexType>& y, DataType alpha = DataType(1)) const
548 {
549 XASSERTM(r.size() == this->num_rows(), "Vector size of r does not match!");
550 XASSERTM(x.size() == this->num_cols(), "Vector size of x does not match!");
551 XASSERTM(y.size() == this->num_rows(), "Vector size of y does not match!");
552
555
558
561
562 block_a().apply(r_first, x_first, y_first, alpha);
563 block_b().apply(r_first, x_rest, r_first, alpha);
564 block_d().apply(r_rest, x_first, y_rest, alpha);
565 }
566
584 void apply_transposed(VectorTypeR& r, const VectorTypeL& x, const VectorTypeR& y, DataType alpha = DataType(1)) const
585 {
586 block_a().apply_transposed(r.template at<0>(), x.template at<0>(), y.template at<0>(), alpha);
587 block_d().apply_transposed(r.template at<0>(), x.template at<1>(), r.template at<0>(), alpha);
588 block_b().apply_transposed(r.template at<1>(), x.template at<0>(), y.template at<1>(), alpha);
589 }
590
592 const DenseVector<DataType, IndexType>& y, DataType alpha = DataType(1)) const
593 {
594 XASSERTM(r.size() == this->num_cols(), "Vector size of r does not match!");
595 XASSERTM(x.size() == this->num_rows(), "Vector size of x does not match!");
596 XASSERTM(y.size() == this->num_cols(), "Vector size of y does not match!");
597
600
603
606
607 block_a().apply_transposed(r_first, x_first, y_first, alpha);
608 block_d().apply_transposed(r_first, x_rest, r_first, alpha);
609 block_b().apply_transposed(r_rest, x_first, y_rest, alpha);
610 }
611
619 {
620 DataType max_rel_diff = Math::max(this->block_a().max_rel_diff(x.block_a()), this->block_b().max_rel_diff(x.block_b()));
622
623 return max_rel_diff;
624 }
625
634 bool same_layout(const SaddlePointMatrix& x) const
635 {
636 return (this->name() == x.name()) && (this->block_a().same_layout(x.block_a()))
637 && (this->block_b().same_layout(x.block_b())) && (this->block_d().same_layout(x.block_d()));
638 }
639
642 {
644 }
645
648 {
650 }
651
652 Index row_degree(const Index row) const
653 {
654 const Index rows_a = block_a().num_rows_raw();
655 if(row < rows_a)
656 return block_a().row_degree(row) + block_b().row_degree(row);
657 else
658 return block_d().row_degree(row - rows_a);
659 }
660
661 template<typename IT2_>
662 Index get_row_col_indices(const Index row, IT2_* const pcol_idx, const IT2_ col_offset) const
663 {
664 const Index rows_a = block_a().num_rows_raw();
665 const Index cols_a = block_a().num_cols_raw();
666 if(row < rows_a)
667 {
668 Index degree_a = block_a().get_row_col_indices(row, pcol_idx, col_offset);
669 return degree_a + block_b().get_row_col_indices(row, pcol_idx + degree_a, col_offset + IT2_(cols_a));
670 }
671 else
672 return block_d().get_row_col_indices(row - rows_a, pcol_idx, col_offset);
673 }
674
675 template<typename DT2_>
676 Index get_row_values(const Index row, DT2_ * const pvals) const
677 {
678 const Index rows_a = block_a().num_rows_raw();
679 if(row < rows_a)
680 {
681 Index degree_a = block_a().get_row_values(row, pvals);
682 return degree_a + block_b().get_row_values(row, pvals + degree_a);
683 }
684 else
685 return block_d().get_row_values(row - rows_a, pvals);
686 }
687
688 template<typename DT2_>
689 Index set_row_values(const Index row, const DT2_ * const pvals)
690 {
691 const Index rows_a = block_a().num_rows_raw();
692 if(row < rows_a)
693 {
694 Index degree_a = block_a().set_row_values(row, pvals);
695 return degree_a + block_b().set_row_values(row, pvals + degree_a);
696 }
697 else
698 return block_d().set_row_values(row - rows_a, pvals);
699 }
700
702
704 std::uint64_t get_checkpoint_size(SerialConfig& config)
705 {
706 return (3 * sizeof(std::uint64_t)) + this->block_a().get_checkpoint_size(config) + this->block_b().get_checkpoint_size(config) + this->block_d().get_checkpoint_size(config);
707 }
708
710 void restore_from_checkpoint_data(std::vector<char> & data)
711 {
712 std::uint64_t isize = *(std::uint64_t*) data.data(); //get size of checkpointed block a
713 std::vector<char>::iterator start = std::begin(data) + sizeof(std::uint64_t); //get iterator at the beginning of block a
714 std::vector<char>::iterator end = std::begin(data) + sizeof(std::uint64_t) + (int) isize; //get iterator at the beginning of block a
715 std::vector<char> buffer_a(start, end); //copy the data of block a to fresh vector
716 this->block_a().restore_from_checkpoint_data(buffer_a);
717
718 data.erase(std::begin(data), end);
719 isize = *(std::uint64_t*) data.data();
720 start = std::begin(data) + sizeof(std::uint64_t);
721 end = std::begin(data) + sizeof(std::uint64_t) + (int) isize;
722 std::vector<char> buffer_b(start, end);
723 this->block_b().restore_from_checkpoint_data(buffer_b);
724
725 data.erase(std::begin(data), end);
726 this->block_d().restore_from_checkpoint_data(data);
727 }
728
730 std::uint64_t set_checkpoint_data(std::vector<char>& data, SerialConfig& config)
731 {
732 std::size_t old_size = data.size();
733 data.insert(std::end(data), sizeof(std::uint64_t),0); //add placeholder
734 std::uint64_t ireal_size = this->block_a().set_checkpoint_data(data, config); //add data of block a to the overall checkpoint
735 std::uint64_t ret_size = ireal_size;
736 char* csize = reinterpret_cast<char*>(&ireal_size);
737 for(std::size_t i(0) ; i < sizeof(std::uint64_t) ; ++i) //overwrite the guessed datalength
738 {
739 data[old_size + i] = csize[i];
740 }
741
742 old_size = data.size();
743 data.insert(std::end(data), sizeof(std::uint64_t), 0); //add placeholder
744 ireal_size = this->block_b().set_checkpoint_data(data, config); //add data of block b to the overall checkpoint
745 ret_size += ireal_size;
746 csize = reinterpret_cast<char*>(&ireal_size);
747 for(std::size_t i(0) ; i < sizeof(std::uint64_t) ; ++i) //overwrite the guessed datalength
748 {
749 data[old_size + i] = csize[i];
750 }
751
752 return 2*sizeof(std::uint64_t) + ret_size + this->block_d().set_checkpoint_data(data, config); //add data of block d to the overall checkpoint
753 }
754
762 template <typename MatrixA2_, typename MatrixB2_, typename MatrixD2_>
764 {
765 this->block_a().convert(other.block_a());
766 this->block_b().convert(other.block_b());
767 this->block_d().convert(other.block_d());
768 }
769
770 template <typename MatrixA2_, typename MatrixB2_, typename MatrixD2_>
772 {
773 this->block_a().copy(other.block_a());
774 this->block_b().copy(other.block_b());
775 this->block_d().copy(other.block_d());
776 }
777
778 template <typename MatrixA2_, typename MatrixB2_, typename MatrixD2_>
779 void copy_to(SaddlePointMatrix<MatrixA2_, MatrixB2_, MatrixD2_> & other) const
780 {
781 this->block_a().copy_to(other.block_a());
782 this->block_b().copy_to(other.block_b());
783 this->block_d().copy_to(other.block_d());
784 }
785 }; // class SaddlePointMatrix<...>
786
788 template<typename MatrixA_, typename MatrixB_, typename MatrixD_>
789 struct SaddlePointMatrixElement<MatrixA_, MatrixB_, MatrixD_, 0, 0>
790 {
791 typedef MatrixA_ Type;
792 static Type& get(SaddlePointMatrix<MatrixA_, MatrixB_, MatrixD_>& matrix)
793 {
794 return matrix.block_a();
795 }
796 static const Type& get(const SaddlePointMatrix<MatrixA_, MatrixB_, MatrixD_>& matrix)
797 {
798 return matrix.block_a();
799 }
800 };
801
802 template<typename MatrixA_, typename MatrixB_, typename MatrixD_>
803 struct SaddlePointMatrixElement<MatrixA_, MatrixB_, MatrixD_, 0, 1>
804 {
805 typedef MatrixB_ Type;
806 static Type& get(SaddlePointMatrix<MatrixA_, MatrixB_, MatrixD_>& matrix)
807 {
808 return matrix.block_b();
809 }
810 static const Type& get(const SaddlePointMatrix<MatrixA_, MatrixB_, MatrixD_>& matrix)
811 {
812 return matrix.block_b();
813 }
814 };
815
816 template<typename MatrixA_, typename MatrixB_, typename MatrixD_>
817 struct SaddlePointMatrixElement<MatrixA_, MatrixB_, MatrixD_, 1, 0>
818 {
819 typedef MatrixD_ Type;
820 static Type& get(SaddlePointMatrix<MatrixA_, MatrixB_, MatrixD_>& matrix)
821 {
822 return matrix.block_d();
823 }
824 static const Type& get(const SaddlePointMatrix<MatrixA_, MatrixB_, MatrixD_>& matrix)
825 {
826 return matrix.block_d();
827 }
828 };
830 } // namespace LAFEM
831} // namespace FEAT
#define XABORTM(msg)
Abortion macro definition with custom message.
Definition: assertion.hpp:192
#define XASSERT(expr)
Assertion macro definition.
Definition: assertion.hpp:262
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Definition: assertion.hpp:263
Dense data vector class template.
Index size() const
Returns the size of this vector, i.e. its number of entries.
Saddle-Point matrix meta class template.
Index num_nzes_raw() const
Returns the total number of non-zeros in this matrix.
SaddlePointMatrix clone(LAFEM::CloneMode mode=LAFEM::CloneMode::Weak) const
Creates and returns a deep copy of this matrix.
void apply(VectorTypeL &r, const VectorTypeR &x, const VectorTypeL &y, DataType alpha=DataType(1)) const
Applies this matrix onto a vector.
MatrixD_ MatrixTypeD
type of sub-matrix D
const SaddlePointMatrixElement< MatrixA_, MatrixB_, MatrixD_, i_, j_ >::Type & at() const
Returns a sub-matrix block.
VectorTypeL create_vector_l() const
Returns a new compatible L-Vector.
MatrixB_ MatrixTypeB
type of sub-matrix B
static constexpr int num_row_blocks
number of row blocks (vertical size)
bool same_layout(const SaddlePointMatrix &x) const
Checks if the structural layout of this matrix matches that of another matrix. This excludes comparis...
Index num_cols() const
Returns the total number of columns in this matrix.
DataType max_rel_diff(const SaddlePointMatrix &x) const
Retrieve the maximum relative difference of this matrix and another one y.max_rel_diff(x) returns .
std::uint64_t set_checkpoint_data(std::vector< char > &data, SerialConfig &config)
SaddlePointMatrix()=default
default CTOR
void apply_transposed(VectorTypeR &r, const VectorTypeL &x) const
Applies this matrix onto a vector.
MatrixTypeA::DataType DataType
data type
void write_out(FileMode mode, String filename) const
Write out matrix to file.
MatrixTypeA & block_a()
Returns the sub-matrix block A.
SaddlePointMatrix(SaddlePointMatrix &&other)
move ctor
VectorTypeR create_vector_r() const
Returns a new compatible R-Vector.
void apply(VectorTypeL &r, const VectorTypeR &x) const
Applies this matrix onto a vector.
const MatrixTypeB & block_b() const
Returns the sub-matrix block B.
MatrixTypeA::IndexType IndexType
index type
Index num_cols_raw() const
Returns the total number of columns in this matrix.
MatrixA_ MatrixTypeA
type of sub-matrix A
static constexpr int num_col_blocks
number of column blocks (horizontal size)
std::uint64_t get_checkpoint_size(SerialConfig &config)
Calculate size.
TupleVector< typename MatrixTypeA::VectorTypeL, typename MatrixTypeD::VectorTypeL > VectorTypeL
Compatible L-vector type.
const MatrixTypeA & block_a() const
Returns the sub-matrix block A.
Index num_nzes() const
Returns the total number of non-zeros in this matrix.
void clear()
Free all allocated arrays.
SaddlePointMatrix & operator=(SaddlePointMatrix &&other)
move-assign operator
static String name()
Returns a descriptive string for this container.
void convert(const SaddlePointMatrix< MatrixA2_, MatrixB2_, MatrixD2_ > &other)
Conversion method.
void extract_diag(VectorTypeL &diag) const
extract main diagonal vector from matrix
std::size_t bytes() const
Returns the total amount of bytes allocated.
void restore_from_checkpoint_data(std::vector< char > &data)
Extract object from checkpoint.
Index num_rows_raw() const
Returns the total number of rows in this matrix.
const MatrixTypeD & block_d() const
Returns the sub-matrix block D.
TupleVector< typename MatrixTypeA::VectorTypeR, typename MatrixTypeB::VectorTypeR > VectorTypeR
Compatible R-vector type.
void format()
Reset all elements of the container to a given value or zero if missing.
MatrixTypeB & block_b()
Returns the sub-matrix block B.
SaddlePointMatrix(FileMode mode, const String &filename)
Constructor.
void read_from(FileMode mode, const String &filename)
Read in matrix from file.
SaddlePointMatrixElement< MatrixA_, MatrixB_, MatrixD_, i_, j_ >::Type & at()
Returns a sub-matrix block.
void apply_transposed(VectorTypeR &r, const VectorTypeL &x, const VectorTypeR &y, DataType alpha=DataType(1)) const
Applies this matrix onto a vector.
virtual ~SaddlePointMatrix()
virtual destructor
MatrixTypeD & block_d()
Returns the sub-matrix block D.
Index num_rows() const
Returns the total number of rows in this matrix.
SaddlePointMatrix(MatrixTypeA &&matrix_a, MatrixTypeB &&matrix_b, MatrixTypeD &&matrix_d)
Sub-Matrix move constructor.
Config class for serialize parameter.
Definition: container.hpp:50
Variadic TupleVector class template.
void format()
Reset all elements of the container to a given value or zero if missing.
String class implementation.
Definition: string.hpp:47
String & trim_me(const String &charset)
Trims this string.
Definition: string.hpp:359
T_ max(T_ a, T_ b)
Returns the maximum of two values.
Definition: math.hpp:137
Type
Type enumeration.
Definition: pack.hpp:70
FEAT namespace.
Definition: adjactor.hpp:12
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.
Saddle-Point matrix element helper class template.