deal.II version GIT relicensing-1929-g70a5450eef 2024-10-03 18:00:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
petsc_matrix_base.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2004 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
16
17#ifdef DEAL_II_WITH_PETSC
18
24
26
27namespace PETScWrappers
28{
29 namespace MatrixIterators
30 {
31# ifndef DOXYGEN
32 void
33 MatrixBase::const_iterator::Accessor::visit_present_row()
34 {
35 // if we are asked to visit the past-the-end line (or a line that is not
36 // stored on the current processor), then simply release all our caches
37 // and go on with life
38 if (matrix->in_local_range(this->a_row) == false)
39 {
40 colnum_cache.reset();
41 value_cache.reset();
42
43 return;
44 }
45
46 // get a representation of the present row
47 PetscInt ncols;
48 const PetscInt *colnums;
49 const PetscScalar *values;
50
51 PetscErrorCode ierr =
52 MatGetRow(*matrix, this->a_row, &ncols, &colnums, &values);
53 AssertThrow(ierr == 0, ExcPETScError(ierr));
54
55 // copy it into our caches if the line
56 // isn't empty. if it is, then we've
57 // done something wrong, since we
58 // shouldn't have initialized an
59 // iterator for an empty line (what
60 // would it point to?)
61 Assert(ncols != 0, ExcInternalError());
62# ifdef DEBUG
63 for (PetscInt j = 0; j < ncols; ++j)
64 {
65 const auto column = static_cast<PetscInt>(colnums[j]);
66 AssertIntegerConversion(column, colnums[j]);
67 }
68# endif
69 colnum_cache =
70 std::make_shared<std::vector<size_type>>(colnums, colnums + ncols);
71 value_cache =
72 std::make_shared<std::vector<PetscScalar>>(values, values + ncols);
73
74 // and finally restore the matrix
75 ierr = MatRestoreRow(*matrix, this->a_row, &ncols, &colnums, &values);
76 AssertThrow(ierr == 0, ExcPETScError(ierr));
77 }
78# endif
79 } // namespace MatrixIterators
80
81
82
84 : matrix(nullptr)
85 , last_action(VectorOperation::unknown)
86 {}
87
88
90 : matrix(A)
91 , last_action(VectorOperation::unknown)
92 {
93 const PetscErrorCode ierr =
94 PetscObjectReference(reinterpret_cast<PetscObject>(matrix));
95 AssertThrow(ierr == 0, ExcPETScError(ierr));
96 }
97
98 void
100 {
102 ExcMessage("Cannot assign a new Mat."));
103 PetscErrorCode ierr =
104 PetscObjectReference(reinterpret_cast<PetscObject>(A));
105 AssertThrow(ierr == 0, ExcPETScError(ierr));
106 ierr = MatDestroy(&matrix);
107 AssertThrow(ierr == 0, ExcPETScError(ierr));
108 matrix = A;
109 }
110
112 {
113 PetscErrorCode ierr = MatDestroy(&matrix);
114 (void)ierr;
115 AssertNothrow(ierr == 0, ExcPETScError(ierr));
116 }
117
118 void
120 {
121 // destroy the matrix...
122 {
123 const PetscErrorCode ierr = MatDestroy(&matrix);
124 AssertThrow(ierr == 0, ExcPETScError(ierr));
125 }
126
127 // ...and replace it by an empty
128 // sequential matrix
129 const int m = 0, n = 0, n_nonzero_per_row = 0;
130 const PetscErrorCode ierr = MatCreateSeqAIJ(
131 PETSC_COMM_SELF, m, n, n_nonzero_per_row, nullptr, &matrix);
132 AssertThrow(ierr == 0, ExcPETScError(ierr));
133 }
134
135
136
137 MatrixBase &
139 {
140 (void)d;
142
144
145 const PetscErrorCode ierr = MatZeroEntries(matrix);
146 AssertThrow(ierr == 0, ExcPETScError(ierr));
147
148 return *this;
149 }
150
151
152
153 void
154 MatrixBase::clear_row(const size_type row, const PetscScalar new_diag_value)
155 {
156 clear_rows(ArrayView<const size_type>(row), new_diag_value);
157 }
158
159
160
161 void
163 const PetscScalar new_diag_value)
164 {
166
167 // now set all the entries of these rows to zero
168# ifdef DEBUG
169 for (const auto &row : rows)
170 AssertIntegerConversion(static_cast<PetscInt>(row), row);
171# endif
172 const std::vector<PetscInt> petsc_rows(rows.begin(), rows.end());
173
174 // call the functions. note that we have
175 // to call them even if #rows is empty,
176 // since this is a collective operation
177 IS index_set;
178
179 PetscErrorCode ierr;
180 ierr = ISCreateGeneral(get_mpi_communicator(),
181 rows.size(),
182 petsc_rows.data(),
183 PETSC_COPY_VALUES,
184 &index_set);
185 AssertThrow(ierr == 0, ExcPETScError(ierr));
186
187 ierr = MatZeroRowsIS(matrix, index_set, new_diag_value, nullptr, nullptr);
188 AssertThrow(ierr == 0, ExcPETScError(ierr));
189 ierr = ISDestroy(&index_set);
190 AssertThrow(ierr == 0, ExcPETScError(ierr));
191 }
192
193 void
194 MatrixBase::clear_rows_columns(const std::vector<size_type> &rows,
195 const PetscScalar new_diag_value)
196 {
198
199 // now set all the entries of these rows to zero
200# ifdef DEBUG
201 for (const auto &row : rows)
202 AssertIntegerConversion(static_cast<PetscInt>(row), row);
203# endif
204 const std::vector<PetscInt> petsc_rows(rows.begin(), rows.end());
205
206 // call the functions. note that we have
207 // to call them even if #rows is empty,
208 // since this is a collective operation
209 IS index_set;
210
211 PetscErrorCode ierr;
212 ierr = ISCreateGeneral(get_mpi_communicator(),
213 rows.size(),
214 petsc_rows.data(),
215 PETSC_COPY_VALUES,
216 &index_set);
217 AssertThrow(ierr == 0, ExcPETScError(ierr));
218
219 ierr =
220 MatZeroRowsColumnsIS(matrix, index_set, new_diag_value, nullptr, nullptr);
221 AssertThrow(ierr == 0, ExcPETScError(ierr));
222 ierr = ISDestroy(&index_set);
223 AssertThrow(ierr == 0, ExcPETScError(ierr));
224 }
225
226
227
228 PetscScalar
229 MatrixBase::el(const size_type i, const size_type j) const
230 {
231 const auto petsc_i = static_cast<PetscInt>(i);
232 AssertIntegerConversion(petsc_i, i);
233 const auto petsc_j = static_cast<PetscInt>(j);
234 AssertIntegerConversion(petsc_j, j);
235
236 PetscScalar value;
237
238 const PetscErrorCode ierr =
239 MatGetValues(matrix, 1, &petsc_i, 1, &petsc_j, &value);
240 AssertThrow(ierr == 0, ExcPETScError(ierr));
241
242 return value;
243 }
244
245
246
247 PetscScalar
249 {
250 Assert(m() == n(), ExcNotQuadratic());
251
252 // this doesn't seem to work any
253 // different than any other element
254 return el(i, i);
255 }
256
257
258
259 void
261 {
262 {
263# ifdef DEBUG
264 // Check that all processors agree that last_action is the same (or none!)
265
266 int my_int_last_action = last_action;
267 int all_int_last_action;
268
269 const int ierr = MPI_Allreduce(&my_int_last_action,
270 &all_int_last_action,
271 1,
272 MPI_INT,
273 MPI_BOR,
275 AssertThrowMPI(ierr);
276
277 AssertThrow(all_int_last_action !=
279 ExcMessage("Error: not all processors agree on the last "
280 "VectorOperation before this compress() call."));
281# endif
282 }
283
287 "Missing compress() or calling with wrong VectorOperation argument."));
288
289 // flush buffers
290 PetscErrorCode ierr = MatAssemblyBegin(matrix, MAT_FINAL_ASSEMBLY);
291 AssertThrow(ierr == 0, ExcPETScError(ierr));
292
293 ierr = MatAssemblyEnd(matrix, MAT_FINAL_ASSEMBLY);
294 AssertThrow(ierr == 0, ExcPETScError(ierr));
295
297 }
298
299
300
303 {
304 PetscInt n_rows, n_cols;
305
306 const PetscErrorCode ierr = MatGetSize(matrix, &n_rows, &n_cols);
307 AssertThrow(ierr == 0, ExcPETScError(ierr));
308
309 return n_rows;
310 }
311
312
313
316 {
317 PetscInt n_rows, n_cols;
318
319 const PetscErrorCode ierr = MatGetSize(matrix, &n_rows, &n_cols);
320 AssertThrow(ierr == 0, ExcPETScError(ierr));
321
322 return n_cols;
323 }
324
325
326
329 {
330 PetscInt n_rows;
331
332 const PetscErrorCode ierr = MatGetLocalSize(matrix, &n_rows, nullptr);
333 AssertThrow(ierr == 0, ExcPETScError(ierr));
334
335 return n_rows;
336 }
337
338
339
340 std::pair<MatrixBase::size_type, MatrixBase::size_type>
342 {
343 PetscInt begin, end;
344
345 const PetscErrorCode ierr =
346 MatGetOwnershipRange(static_cast<const Mat &>(matrix), &begin, &end);
347 AssertThrow(ierr == 0, ExcPETScError(ierr));
348
349 return {begin, end};
350 }
351
352
353
356 {
357 PetscInt n_cols;
358
359 const PetscErrorCode ierr = MatGetLocalSize(matrix, nullptr, &n_cols);
360 AssertThrow(ierr == 0, ExcPETScError(ierr));
361
362 return n_cols;
363 }
364
365
366
367 std::pair<MatrixBase::size_type, MatrixBase::size_type>
369 {
370 PetscInt begin, end;
371
372 const PetscErrorCode ierr =
373 MatGetOwnershipRangeColumn(static_cast<const Mat &>(matrix),
374 &begin,
375 &end);
376 AssertThrow(ierr == 0, ExcPETScError(ierr));
377
378 return {begin, end};
379 }
380
381
382
383 std::uint64_t
385 {
386 MatInfo mat_info;
387 const PetscErrorCode ierr = MatGetInfo(matrix, MAT_GLOBAL_SUM, &mat_info);
388 AssertThrow(ierr == 0, ExcPETScError(ierr));
389
390 // MatInfo logs quantities as PetscLogDouble. So we need to cast it to match
391 // our interface.
392 return static_cast<std::uint64_t>(mat_info.nz_used);
393 }
394
395
396
399 {
400 // TODO: this function will probably only work if compress() was called on
401 // the matrix previously. however, we can't do this here, since it would
402 // impose global communication and one would have to make sure that this
403 // function is called the same number of times from all processors,
404 // something that is unreasonable. there should simply be a way in PETSc to
405 // query the number of entries in a row bypassing the call to compress(),
406 // but I can't find one
407 AssertIndexRange(row, m());
408
409 // get a representation of the present
410 // row
411 PetscInt ncols;
412 const PetscInt *colnums;
413 const PetscScalar *values;
414
415 // TODO: this is probably horribly inefficient; we should lobby for a way to
416 // query this information from PETSc
417 PetscErrorCode ierr = MatGetRow(*this, row, &ncols, &colnums, &values);
418 AssertThrow(ierr == 0, ExcPETScError(ierr));
419
420 // then restore the matrix and return the number of columns in this row as
421 // queried previously. Starting with PETSc 3.4, MatRestoreRow actually
422 // resets the last three arguments to nullptr, to avoid abuse of pointers
423 // now dangling. as a consequence, we need to save the size of the array
424 // and return the saved value.
425 const PetscInt ncols_saved = ncols;
426 ierr = MatRestoreRow(*this, row, &ncols, &colnums, &values);
427 AssertThrow(ierr == 0, ExcPETScError(ierr));
428
429 return ncols_saved;
430 }
431
432
433 PetscReal
435 {
436 PetscReal result;
437
438 const PetscErrorCode ierr = MatNorm(matrix, NORM_1, &result);
439 AssertThrow(ierr == 0, ExcPETScError(ierr));
440
441 return result;
442 }
443
444
445
446 PetscReal
448 {
449 PetscReal result;
450
451 const PetscErrorCode ierr = MatNorm(matrix, NORM_INFINITY, &result);
452 AssertThrow(ierr == 0, ExcPETScError(ierr));
453
454 return result;
455 }
456
457
458
459 PetscReal
461 {
462 PetscReal result;
463
464 const PetscErrorCode ierr = MatNorm(matrix, NORM_FROBENIUS, &result);
465 AssertThrow(ierr == 0, ExcPETScError(ierr));
466
467 return result;
468 }
469
470
471 PetscScalar
473 {
474 AssertDimension(m(), v.size());
475
476 VectorBase tmp(v);
477 vmult(tmp, v);
478 return tmp * v;
479 }
480
481
482 PetscScalar
484 const VectorBase &v) const
485 {
486 AssertDimension(m(), u.size());
487 AssertDimension(m(), v.size());
488
489 VectorBase tmp(u);
490 vmult(tmp, v);
491 return u * tmp;
492 }
493
494
495 PetscScalar
497 {
498 PetscScalar result;
499
500 const PetscErrorCode ierr = MatGetTrace(matrix, &result);
501 AssertThrow(ierr == 0, ExcPETScError(ierr));
502
503 return result;
504 }
505
506
507
508 MatrixBase &
509 MatrixBase::operator*=(const PetscScalar a)
510 {
511 const PetscErrorCode ierr = MatScale(matrix, a);
512 AssertThrow(ierr == 0, ExcPETScError(ierr));
513
514 return *this;
515 }
516
517
518
519 MatrixBase &
520 MatrixBase::operator/=(const PetscScalar a)
521 {
522 const PetscScalar factor = 1. / a;
523 const PetscErrorCode ierr = MatScale(matrix, factor);
524 AssertThrow(ierr == 0, ExcPETScError(ierr));
525
526 return *this;
527 }
528
529
530
531 MatrixBase &
532 MatrixBase::add(const PetscScalar factor, const MatrixBase &other)
533 {
534 const PetscErrorCode ierr =
535 MatAXPY(matrix, factor, other, DIFFERENT_NONZERO_PATTERN);
536 AssertThrow(ierr == 0, ExcPETScError(ierr));
537
538 return *this;
539 }
540
541
542 void
544 {
545 Assert(&src != &dst, ExcSourceEqualsDestination());
546
547 const PetscErrorCode ierr = MatMult(matrix, src, dst);
548 AssertThrow(ierr == 0, ExcPETScError(ierr));
549 }
550
551
552
553 void
555 {
556 Assert(&src != &dst, ExcSourceEqualsDestination());
557
558 const PetscErrorCode ierr = MatMultTranspose(matrix, src, dst);
559 AssertThrow(ierr == 0, ExcPETScError(ierr));
560 }
561
562
563
564 void
566 {
567 Assert(&src != &dst, ExcSourceEqualsDestination());
568
569 const PetscErrorCode ierr = MatMultAdd(matrix, src, dst, dst);
570 AssertThrow(ierr == 0, ExcPETScError(ierr));
571 }
572
573
574
575 void
577 {
578 Assert(&src != &dst, ExcSourceEqualsDestination());
579
580 const PetscErrorCode ierr = MatMultTransposeAdd(matrix, src, dst, dst);
581 AssertThrow(ierr == 0, ExcPETScError(ierr));
582 }
583
584
585 namespace internals
586 {
587 void
588 perform_mmult(const MatrixBase &inputleft,
589 const MatrixBase &inputright,
590 MatrixBase &result,
591 const VectorBase &V,
592 const bool transpose_left)
593 {
594 const bool use_vector = (V.size() == inputright.m() ? true : false);
595 if (transpose_left == false)
596 {
597 Assert(inputleft.n() == inputright.m(),
598 ExcDimensionMismatch(inputleft.n(), inputright.m()));
599 }
600 else
601 {
602 Assert(inputleft.m() == inputright.m(),
603 ExcDimensionMismatch(inputleft.m(), inputright.m()));
604 }
605
606 result.clear();
607
608 PetscErrorCode ierr;
609
610 if (use_vector == false)
611 {
612 if (transpose_left)
613 {
614 ierr = MatTransposeMatMult(inputleft,
615 inputright,
616 MAT_INITIAL_MATRIX,
617 PETSC_DEFAULT,
618 &result.petsc_matrix());
619 AssertThrow(ierr == 0, ExcPETScError(ierr));
620 }
621 else
622 {
623 ierr = MatMatMult(inputleft,
624 inputright,
625 MAT_INITIAL_MATRIX,
626 PETSC_DEFAULT,
627 &result.petsc_matrix());
628 AssertThrow(ierr == 0, ExcPETScError(ierr));
629 }
630 }
631 else
632 {
633 Mat tmp;
634 ierr = MatDuplicate(inputleft, MAT_COPY_VALUES, &tmp);
635 AssertThrow(ierr == 0, ExcPETScError(ierr));
636 if (transpose_left)
637 {
638# if DEAL_II_PETSC_VERSION_LT(3, 8, 0)
639 ierr = MatTranspose(tmp, MAT_REUSE_MATRIX, &tmp);
640# else
641 ierr = MatTranspose(tmp, MAT_INPLACE_MATRIX, &tmp);
642# endif
643 AssertThrow(ierr == 0, ExcPETScError(ierr));
644 }
645 ierr = MatDiagonalScale(tmp, nullptr, V);
646 AssertThrow(ierr == 0, ExcPETScError(ierr));
647 ierr = MatMatMult(tmp,
648 inputright,
649 MAT_INITIAL_MATRIX,
650 PETSC_DEFAULT,
651 &result.petsc_matrix());
652 AssertThrow(ierr == 0, ExcPETScError(ierr));
653 ierr = MatDestroy(&tmp);
654 AssertThrow(ierr == 0, ExcPETScError(ierr));
655 }
656 }
657 } // namespace internals
658
659 void
661 const MatrixBase &B,
662 const VectorBase &V) const
663 {
664 internals::perform_mmult(*this, B, C, V, false);
665 }
666
667 void
669 const MatrixBase &B,
670 const VectorBase &V) const
671 {
672 internals::perform_mmult(*this, B, C, V, true);
673 }
674
675 PetscScalar
677 const VectorBase &x,
678 const VectorBase &b) const
679 {
680 // avoid the use of a temporary, and
681 // rather do one negation pass more than
682 // necessary
683 vmult(dst, x);
684 dst -= b;
685 dst *= -1;
686
687 return dst.l2_norm();
688 }
689
690
691
692 MatrixBase::operator Mat() const
693 {
694 return matrix;
695 }
696
697 Mat &
699 {
700 return matrix;
701 }
702
703 void
705 {
706# if DEAL_II_PETSC_VERSION_LT(3, 8, 0)
707 const PetscErrorCode ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix);
708# else
709 const PetscErrorCode ierr =
710 MatTranspose(matrix, MAT_INPLACE_MATRIX, &matrix);
711# endif
712 AssertThrow(ierr == 0, ExcPETScError(ierr));
713 }
714
715 PetscBool
716 MatrixBase::is_symmetric(const double tolerance)
717 {
718 PetscBool truth;
720 const PetscErrorCode ierr = MatIsSymmetric(matrix, tolerance, &truth);
721 AssertThrow(ierr == 0, ExcPETScError(ierr));
722 return truth;
723 }
724
725 PetscBool
726 MatrixBase::is_hermitian(const double tolerance)
727 {
728 PetscBool truth;
729
731 const PetscErrorCode ierr = MatIsHermitian(matrix, tolerance, &truth);
732 AssertThrow(ierr == 0, ExcPETScError(ierr));
733
734 return truth;
735 }
736
737 void
738 MatrixBase::write_ascii(const PetscViewerFormat format)
739 {
741 MPI_Comm comm = PetscObjectComm(reinterpret_cast<PetscObject>(matrix));
742
743 // Set options
744 PetscErrorCode ierr =
745 PetscViewerPushFormat(PETSC_VIEWER_STDOUT_(comm), format);
746 AssertThrow(ierr == 0, ExcPETScError(ierr));
747
748 // Write to screen
749 ierr = MatView(matrix, PETSC_VIEWER_STDOUT_(comm));
750 AssertThrow(ierr == 0, ExcPETScError(ierr));
751 ierr = PetscViewerPopFormat(PETSC_VIEWER_STDOUT_(comm));
752 AssertThrow(ierr == 0, ExcPETScError(ierr));
753 }
754
755 void
756 MatrixBase::print(std::ostream &out, const bool /*alternative_output*/) const
757 {
758 PetscBool has;
759
760 PetscErrorCode ierr = MatHasOperation(matrix, MATOP_GET_ROW, &has);
761 AssertThrow(ierr == 0, ExcPETScError(ierr));
762
763 Mat vmatrix = matrix;
764 if (!has)
765 {
766 ierr = MatConvert(matrix, MATAIJ, MAT_INITIAL_MATRIX, &vmatrix);
767 AssertThrow(ierr == 0, ExcPETScError(ierr));
768 }
769
770 std::pair<MatrixBase::size_type, MatrixBase::size_type> loc_range =
771 local_range();
772
773 PetscInt ncols;
774 const PetscInt *colnums;
775 const PetscScalar *values;
776
778 for (row = loc_range.first; row < loc_range.second; ++row)
779 {
780 ierr = MatGetRow(vmatrix, row, &ncols, &colnums, &values);
781 AssertThrow(ierr == 0, ExcPETScError(ierr));
782
783 for (PetscInt col = 0; col < ncols; ++col)
784 {
785 out << "(" << row << "," << colnums[col] << ") " << values[col]
786 << std::endl;
787 }
788
789 ierr = MatRestoreRow(vmatrix, row, &ncols, &colnums, &values);
790 AssertThrow(ierr == 0, ExcPETScError(ierr));
791 }
792 if (vmatrix != matrix)
793 {
794 ierr = MatDestroy(&vmatrix);
795 AssertThrow(ierr == 0, ExcPETScError(ierr));
796 }
797 AssertThrow(out.fail() == false, ExcIO());
798 }
799
800
801
802 std::size_t
804 {
805 MatInfo info;
806 const PetscErrorCode ierr = MatGetInfo(matrix, MAT_LOCAL, &info);
807 AssertThrow(ierr == 0, ExcPETScError(ierr));
808
809 return sizeof(*this) + static_cast<size_type>(info.memory);
810 }
811
812} // namespace PETScWrappers
813
815
816#endif // DEAL_II_WITH_PETSC
iterator begin() const
Definition array_view.h:702
iterator end() const
Definition array_view.h:711
std::size_t size() const
Definition array_view.h:684
void add(const size_type i, const size_type j, const PetscScalar value)
size_type row_length(const size_type row) const
std::size_t memory_consumption() const
VectorOperation::values last_action
void vmult(VectorBase &dst, const VectorBase &src) const
MPI_Comm get_mpi_communicator() const
PetscScalar diag_element(const size_type i) const
size_type local_domain_size() const
const_iterator begin() const
MatrixBase & operator/=(const PetscScalar factor)
void mmult(MatrixBase &C, const MatrixBase &B, const VectorBase &V) const
PetscBool is_symmetric(const double tolerance=1.e-12)
std::pair< size_type, size_type > local_domain() const
const_iterator end() const
void Tvmult_add(VectorBase &dst, const VectorBase &src) const
void print(std::ostream &out, const bool alternative_output=false) const
PetscScalar el(const size_type i, const size_type j) const
MatrixBase & operator=(const MatrixBase &)=delete
PetscBool is_hermitian(const double tolerance=1.e-12)
PetscScalar matrix_scalar_product(const VectorBase &u, const VectorBase &v) const
void Tvmult(VectorBase &dst, const VectorBase &src) const
void clear_rows_columns(const std::vector< size_type > &row_and_column_indices, const PetscScalar new_diag_value=0)
MatrixBase & operator*=(const PetscScalar factor)
PetscScalar residual(VectorBase &dst, const VectorBase &x, const VectorBase &b) const
void Tmmult(MatrixBase &C, const MatrixBase &B, const VectorBase &V) const
void write_ascii(const PetscViewerFormat format=PETSC_VIEWER_DEFAULT)
void vmult_add(VectorBase &dst, const VectorBase &src) const
std::pair< size_type, size_type > local_range() const
void compress(const VectorOperation::values operation)
PetscScalar matrix_norm_square(const VectorBase &v) const
void clear_rows(const ArrayView< const size_type > &rows, const PetscScalar new_diag_value=0)
std::uint64_t n_nonzero_elements() const
void clear_row(const size_type row, const PetscScalar new_diag_value=0)
size_type size() const override
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertNothrow(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcSourceEqualsDestination()
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcNotQuadratic()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
#define AssertIntegerConversion(index1, index2)
@ matrix
Contents is actually a matrix.
void perform_mmult(const MatrixBase &inputleft, const MatrixBase &inputright, MatrixBase &result, const VectorBase &V, const bool transpose_left)
*braid_SplitCommworld & comm