Reference documentation for deal.II version 9.1.0-pre
full_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_full_matrix_h
17 #define dealii_full_matrix_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/numbers.h>
23 #include <deal.II/base/table.h>
24 #include <deal.II/base/tensor.h>
25 
26 #include <deal.II/differentiation/ad/ad_number_traits.h>
27 
28 #include <deal.II/lac/exceptions.h>
29 #include <deal.II/lac/identity_matrix.h>
30 
31 #include <cstring>
32 #include <iomanip>
33 #include <vector>
34 
35 DEAL_II_NAMESPACE_OPEN
36 
37 
38 // forward declarations
39 template <typename number>
40 class Vector;
41 template <typename number>
43 
44 
69 template <typename number>
70 class FullMatrix : public Table<2, number>
71 {
72 public:
73  // The assertion in full_matrix.templates.h for whether or not a number is
74  // finite is not compatible for AD number types.
75  static_assert(
77  "The FullMatrix class does not support auto-differentiable numbers.");
78 
82  using size_type = std::size_t;
83 
88  using value_type = number;
89 
90 
101 
102 
103  class const_iterator;
104 
108  class Accessor
109  {
110  public:
116  const size_type row,
117  const size_type col);
118 
122  size_type
123  row() const;
124 
128  size_type
129  column() const;
130 
134  number
135  value() const;
136 
137  protected:
142 
147 
152 
153  /*
154  * Make enclosing class a friend.
155  */
156  friend class const_iterator;
157  };
158 
163  {
164  public:
169  const size_type row,
170  const size_type col);
171 
176  operator++();
177 
182  operator++(int);
183 
187  const Accessor &operator*() const;
188 
192  const Accessor *operator->() const;
193 
197  bool
198  operator==(const const_iterator &) const;
202  bool
203  operator!=(const const_iterator &) const;
204 
209  bool
210  operator<(const const_iterator &) const;
211 
216  bool
217  operator>(const const_iterator &) const;
218 
219  private:
224  };
229 
239  explicit FullMatrix(const size_type n = 0);
240 
244  FullMatrix(const size_type rows, const size_type cols);
245 
250  FullMatrix(const size_type rows, const size_type cols, const number *entries);
251 
260  FullMatrix(const IdentityMatrix &id);
275  template <typename number2>
278 
287  operator=(const number d);
288 
298  operator=(const IdentityMatrix &id);
299 
304  template <typename number2>
307 
308 
314  template <typename MatrixType>
315  void
316  copy_from(const MatrixType &);
317 
323  template <typename MatrixType>
324  void
325  copy_transposed(const MatrixType &);
326 
334  template <int dim>
335  void
336  copy_from(const Tensor<2, dim> &T,
337  const unsigned int src_r_i = 0,
338  const unsigned int src_r_j = dim - 1,
339  const unsigned int src_c_i = 0,
340  const unsigned int src_c_j = dim - 1,
341  const size_type dst_r = 0,
342  const size_type dst_c = 0);
343 
351  template <int dim>
352  void copy_to(Tensor<2, dim> & T,
353  const size_type src_r_i = 0,
354  const size_type src_r_j = dim - 1,
355  const size_type src_c_i = 0,
356  const size_type src_c_j = dim - 1,
357  const unsigned int dst_r = 0,
358  const unsigned int dst_c = 0) const;
359 
372  template <typename MatrixType, typename index_type>
373  void
374  extract_submatrix_from(const MatrixType & matrix,
375  const std::vector<index_type> &row_index_set,
376  const std::vector<index_type> &column_index_set);
377 
390  template <typename MatrixType, typename index_type>
391  void
392  scatter_matrix_to(const std::vector<index_type> &row_index_set,
393  const std::vector<index_type> &column_index_set,
394  MatrixType & matrix) const;
395 
406  template <typename number2>
407  void
408  fill(const FullMatrix<number2> &src,
409  const size_type dst_offset_i = 0,
410  const size_type dst_offset_j = 0,
411  const size_type src_offset_i = 0,
412  const size_type src_offset_j = 0);
413 
414 
418  template <typename number2>
419  void
420  fill(const number2 *);
421 
433  template <typename number2>
434  void
436  const std::vector<size_type> &p_rows,
437  const std::vector<size_type> &p_cols);
438 
449  void
450  set(const size_type i, const size_type j, const number value);
466  bool
467  operator==(const FullMatrix<number> &) const;
468 
473  size_type
474  m() const;
475 
480  size_type
481  n() const;
482 
488  bool
489  all_zero() const;
490 
506  template <typename number2>
507  number2
508  matrix_norm_square(const Vector<number2> &v) const;
509 
519  template <typename number2>
520  number2
521  matrix_scalar_product(const Vector<number2> &u,
522  const Vector<number2> &v) const;
523 
528  real_type
529  l1_norm() const;
530 
535  real_type
536  linfty_norm() const;
537 
545  real_type
546  frobenius_norm() const;
547 
556  real_type
557  relative_symmetry_norm2() const;
558 
564  number
565  determinant() const;
566 
572  number
573  trace() const;
574 
581  template <class StreamType>
582  void
583  print(StreamType & s,
584  const unsigned int width = 5,
585  const unsigned int precision = 2) const;
586 
609  void
610  print_formatted(std::ostream & out,
611  const unsigned int precision = 3,
612  const bool scientific = true,
613  const unsigned int width = 0,
614  const char * zero_string = " ",
615  const double denominator = 1.,
616  const double threshold = 0.) const;
617 
622  std::size_t
623  memory_consumption() const;
624 
626 
628 
633  begin() const;
634 
639  end() const;
640 
645  begin(const size_type r) const;
646 
651  end(const size_type r) const;
652 
654 
656 
660  FullMatrix &
661  operator*=(const number factor);
662 
666  FullMatrix &
667  operator/=(const number factor);
668 
676  template <typename number2>
677  void
678  add(const number a, const FullMatrix<number2> &A);
679 
687  template <typename number2>
688  void
689  add(const number a,
690  const FullMatrix<number2> &A,
691  const number b,
692  const FullMatrix<number2> &B);
693 
702  template <typename number2>
703  void
704  add(const number a,
705  const FullMatrix<number2> &A,
706  const number b,
707  const FullMatrix<number2> &B,
708  const number c,
709  const FullMatrix<number2> &C);
710 
722  template <typename number2>
723  void
724  add(const FullMatrix<number2> &src,
725  const number factor,
726  const size_type dst_offset_i = 0,
727  const size_type dst_offset_j = 0,
728  const size_type src_offset_i = 0,
729  const size_type src_offset_j = 0);
730 
736  template <typename number2>
737  void
738  Tadd(const number s, const FullMatrix<number2> &B);
739 
751  template <typename number2>
752  void
753  Tadd(const FullMatrix<number2> &src,
754  const number factor,
755  const size_type dst_offset_i = 0,
756  const size_type dst_offset_j = 0,
757  const size_type src_offset_i = 0,
758  const size_type src_offset_j = 0);
759 
763  void
764  add(const size_type row, const size_type column, const number value);
765 
775  template <typename number2, typename index_type>
776  void
777  add(const size_type row,
778  const size_type n_cols,
779  const index_type *col_indices,
780  const number2 * values,
781  const bool elide_zero_values = true,
782  const bool col_indices_are_sorted = false);
783 
787  void
788  add_row(const size_type i, const number s, const size_type j);
789 
794  void
795  add_row(const size_type i,
796  const number s,
797  const size_type j,
798  const number t,
799  const size_type k);
800 
804  void
805  add_col(const size_type i, const number s, const size_type j);
806 
811  void
812  add_col(const size_type i,
813  const number s,
814  const size_type j,
815  const number t,
816  const size_type k);
817 
821  void
822  swap_row(const size_type i, const size_type j);
823 
827  void
828  swap_col(const size_type i, const size_type j);
829 
834  void
835  diagadd(const number s);
836 
840  template <typename number2>
841  void
842  equ(const number a, const FullMatrix<number2> &A);
843 
847  template <typename number2>
848  void
849  equ(const number a,
850  const FullMatrix<number2> &A,
851  const number b,
852  const FullMatrix<number2> &B);
853 
857  template <typename number2>
858  void
859  equ(const number a,
860  const FullMatrix<number2> &A,
861  const number b,
862  const FullMatrix<number2> &B,
863  const number c,
864  const FullMatrix<number2> &C);
865 
872  void
873  symmetrize();
874 
889  void
890  gauss_jordan();
891 
898  template <typename number2>
899  void
900  invert(const FullMatrix<number2> &M);
901 
910  template <typename number2>
911  void
912  cholesky(const FullMatrix<number2> &A);
913 
918  template <typename number2>
919  void
920  outer_product(const Vector<number2> &V, const Vector<number2> &W);
921 
927  template <typename number2>
928  void
930 
936  template <typename number2>
937  void
939 
941 
943 
962  template <typename number2>
963  void
965  const FullMatrix<number2> &B,
966  const bool adding = false) const;
967 
986  template <typename number2>
987  void
989  const FullMatrix<number2> &B,
990  const bool adding = false) const;
991 
1010  template <typename number2>
1011  void
1013  const FullMatrix<number2> &B,
1014  const bool adding = false) const;
1015 
1035  template <typename number2>
1036  void
1038  const FullMatrix<number2> &B,
1039  const bool adding = false) const;
1040 
1051  void
1053  const FullMatrix<number> &B,
1054  const FullMatrix<number> &D,
1055  const bool transpose_B = false,
1056  const bool transpose_D = false,
1057  const number scaling = number(1.));
1058 
1071  template <typename number2>
1072  void
1073  vmult(Vector<number2> & w,
1074  const Vector<number2> &v,
1075  const bool adding = false) const;
1076 
1082  template <typename number2>
1083  void
1084  vmult_add(Vector<number2> &w, const Vector<number2> &v) const;
1085 
1099  template <typename number2>
1100  void
1101  Tvmult(Vector<number2> & w,
1102  const Vector<number2> &v,
1103  const bool adding = false) const;
1104 
1111  template <typename number2>
1112  void
1113  Tvmult_add(Vector<number2> &w, const Vector<number2> &v) const;
1114 
1120  template <typename somenumber>
1121  void
1122  precondition_Jacobi(Vector<somenumber> & dst,
1123  const Vector<somenumber> &src,
1124  const number omega = 1.) const;
1125 
1132  template <typename number2, typename number3>
1133  number
1134  residual(Vector<number2> & dst,
1135  const Vector<number2> &x,
1136  const Vector<number3> &b) const;
1137 
1148  template <typename number2>
1149  void
1150  forward(Vector<number2> &dst, const Vector<number2> &src) const;
1151 
1159  template <typename number2>
1160  void
1161  backward(Vector<number2> &dst, const Vector<number2> &src) const;
1162 
1164 
1174 
1179  ExcNotRegular,
1180  number,
1181  << "The maximal pivot is " << arg1
1182  << ", which is below the threshold. The matrix may be singular.");
1187  size_type,
1188  size_type,
1189  size_type,
1190  << "Target region not in matrix: size in this direction="
1191  << arg1 << ", size of new matrix=" << arg2
1192  << ", offset=" << arg3);
1197  "You are attempting an operation on two matrices that "
1198  "are the same object, but the operation requires that the "
1199  "two objects are in fact different.");
1205 
1206  friend class Accessor;
1207 };
1208 
1211 #ifndef DOXYGEN
1212 /*-------------------------Inline functions -------------------------------*/
1213 
1214 
1215 
1216 template <typename number>
1217 inline typename FullMatrix<number>::size_type
1218 FullMatrix<number>::m() const
1219 {
1220  return this->n_rows();
1221 }
1222 
1223 
1224 
1225 template <typename number>
1226 inline typename FullMatrix<number>::size_type
1227 FullMatrix<number>::n() const
1228 {
1229  return this->n_cols();
1230 }
1231 
1232 
1233 
1234 template <typename number>
1236 FullMatrix<number>::operator=(const number d)
1237 {
1238  Assert(d == number(0), ExcScalarAssignmentOnlyForZeroValue());
1239  (void)d; // removes -Wunused-parameter warning in optimized mode
1240 
1241  if (this->n_elements() != 0)
1242  this->reset_values();
1243 
1244  return *this;
1245 }
1246 
1247 
1248 
1249 template <typename number>
1250 template <typename number2>
1251 inline void
1252 FullMatrix<number>::fill(const number2 *src)
1253 {
1255 }
1256 
1257 
1258 
1259 template <typename number>
1260 template <typename MatrixType>
1261 void
1262 FullMatrix<number>::copy_from(const MatrixType &M)
1263 {
1264  this->reinit(M.m(), M.n());
1265 
1266  // loop over the elements of the argument matrix row by row, as suggested
1267  // in the documentation of the sparse matrix iterator class, and
1268  // copy them into the current object
1269  for (size_type row = 0; row < M.m(); ++row)
1270  {
1271  const typename MatrixType::const_iterator end_row = M.end(row);
1272  for (typename MatrixType::const_iterator entry = M.begin(row);
1273  entry != end_row;
1274  ++entry)
1275  this->el(row, entry->column()) = entry->value();
1276  }
1277 }
1278 
1279 
1280 
1281 template <typename number>
1282 template <typename MatrixType>
1283 void
1284 FullMatrix<number>::copy_transposed(const MatrixType &M)
1285 {
1286  this->reinit(M.n(), M.m());
1287 
1288  // loop over the elements of the argument matrix row by row, as suggested
1289  // in the documentation of the sparse matrix iterator class, and
1290  // copy them into the current object
1291  for (size_type row = 0; row < M.m(); ++row)
1292  {
1293  const typename MatrixType::const_iterator end_row = M.end(row);
1294  for (typename MatrixType::const_iterator entry = M.begin(row);
1295  entry != end_row;
1296  ++entry)
1297  this->el(entry->column(), row) = entry->value();
1298  }
1299 }
1300 
1301 
1302 
1303 template <typename number>
1304 template <typename MatrixType, typename index_type>
1305 inline void
1307  const MatrixType & matrix,
1308  const std::vector<index_type> &row_index_set,
1309  const std::vector<index_type> &column_index_set)
1310 {
1311  AssertDimension(row_index_set.size(), this->n_rows());
1312  AssertDimension(column_index_set.size(), this->n_cols());
1313 
1314  const size_type n_rows_submatrix = row_index_set.size();
1315  const size_type n_cols_submatrix = column_index_set.size();
1316 
1317  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1318  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1319  (*this)(sub_row, sub_col) =
1320  matrix.el(row_index_set[sub_row], column_index_set[sub_col]);
1321 }
1322 
1323 
1324 
1325 template <typename number>
1326 template <typename MatrixType, typename index_type>
1327 inline void
1329  const std::vector<index_type> &row_index_set,
1330  const std::vector<index_type> &column_index_set,
1331  MatrixType & matrix) const
1332 {
1333  AssertDimension(row_index_set.size(), this->n_rows());
1334  AssertDimension(column_index_set.size(), this->n_cols());
1335 
1336  const size_type n_rows_submatrix = row_index_set.size();
1337  const size_type n_cols_submatrix = column_index_set.size();
1338 
1339  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1340  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1341  matrix.set(row_index_set[sub_row],
1342  column_index_set[sub_col],
1343  (*this)(sub_row, sub_col));
1344 }
1345 
1346 
1347 template <typename number>
1348 inline void
1350  const size_type j,
1351  const number value)
1352 {
1353  (*this)(i, j) = value;
1354 }
1355 
1356 
1357 
1358 template <typename number>
1359 template <typename number2>
1360 void
1361 FullMatrix<number>::vmult_add(Vector<number2> & w,
1362  const Vector<number2> &v) const
1363 {
1364  vmult(w, v, true);
1365 }
1366 
1367 
1368 template <typename number>
1369 template <typename number2>
1370 void
1371 FullMatrix<number>::Tvmult_add(Vector<number2> & w,
1372  const Vector<number2> &v) const
1373 {
1374  Tvmult(w, v, true);
1375 }
1376 
1377 
1378 //---------------------------------------------------------------------------
1379 
1380 
1381 template <typename number>
1383  const size_type r,
1384  const size_type c)
1385  : matrix(matrix)
1386  , a_row(r)
1387  , a_col(c)
1388 {}
1389 
1390 
1391 template <typename number>
1392 inline typename FullMatrix<number>::size_type
1394 {
1395  return a_row;
1396 }
1397 
1398 
1399 template <typename number>
1400 inline typename FullMatrix<number>::size_type
1402 {
1403  return a_col;
1404 }
1405 
1406 
1407 template <typename number>
1408 inline number
1410 {
1411  AssertIsFinite(matrix->el(a_row, a_col));
1412  return matrix->el(a_row, a_col);
1413 }
1414 
1415 
1416 template <typename number>
1418  const FullMatrix<number> *matrix,
1419  const size_type r,
1420  const size_type c)
1421  : accessor(matrix, r, c)
1422 {}
1423 
1424 
1425 template <typename number>
1426 inline typename FullMatrix<number>::const_iterator &
1428 {
1430 
1431  ++accessor.a_col;
1432  if (accessor.a_col >= accessor.matrix->n())
1433  {
1434  accessor.a_col = 0;
1435  accessor.a_row++;
1436  }
1437  return *this;
1438 }
1439 
1440 
1441 template <typename number>
1442 inline typename FullMatrix<number>::const_iterator
1444 {
1445  const typename FullMatrix<number>::const_iterator current = *this;
1446  ++(*this);
1447 
1448  return current;
1449 }
1450 
1451 
1452 template <typename number>
1453 inline const typename FullMatrix<number>::Accessor &
1455 {
1456  return accessor;
1457 }
1458 
1459 
1460 template <typename number>
1461 inline const typename FullMatrix<number>::Accessor *
1463 {
1464  return &accessor;
1465 }
1466 
1467 
1468 template <typename number>
1469 inline bool
1471 operator==(const const_iterator &other) const
1472 {
1473  return (accessor.row() == other.accessor.row() &&
1474  accessor.column() == other.accessor.column());
1475 }
1476 
1477 
1478 template <typename number>
1479 inline bool
1481 operator!=(const const_iterator &other) const
1482 {
1483  return !(*this == other);
1484 }
1485 
1486 
1487 template <typename number>
1488 inline bool
1490 {
1491  return (accessor.row() < other.accessor.row() ||
1492  (accessor.row() == other.accessor.row() &&
1493  accessor.column() < other.accessor.column()));
1494 }
1495 
1496 
1497 template <typename number>
1498 inline bool
1500 {
1501  return (other < *this);
1502 }
1503 
1504 
1505 template <typename number>
1506 inline typename FullMatrix<number>::const_iterator
1508 {
1509  return const_iterator(this, 0, 0);
1510 }
1511 
1512 
1513 template <typename number>
1514 inline typename FullMatrix<number>::const_iterator
1516 {
1517  return const_iterator(this, m(), 0);
1518 }
1519 
1520 
1521 template <typename number>
1522 inline typename FullMatrix<number>::const_iterator
1523 FullMatrix<number>::begin(const size_type r) const
1524 {
1525  AssertIndexRange(r, m());
1526  return const_iterator(this, r, 0);
1527 }
1528 
1529 
1530 
1531 template <typename number>
1532 inline typename FullMatrix<number>::const_iterator
1533 FullMatrix<number>::end(const size_type r) const
1534 {
1535  AssertIndexRange(r, m());
1536  return const_iterator(this, r + 1, 0);
1537 }
1538 
1539 
1540 
1541 template <typename number>
1542 inline void
1543 FullMatrix<number>::add(const size_type r, const size_type c, const number v)
1544 {
1545  AssertIndexRange(r, this->m());
1546  AssertIndexRange(c, this->n());
1547 
1548  this->operator()(r, c) += v;
1549 }
1550 
1551 
1552 
1553 template <typename number>
1554 template <typename number2, typename index_type>
1555 inline void
1557  const size_type n_cols,
1558  const index_type *col_indices,
1559  const number2 * values,
1560  const bool,
1561  const bool)
1562 {
1563  AssertIndexRange(row, this->m());
1564  for (size_type col = 0; col < n_cols; ++col)
1565  {
1566  AssertIndexRange(col_indices[col], this->n());
1567  this->operator()(row, col_indices[col]) += values[col];
1568  }
1569 }
1570 
1571 
1572 template <typename number>
1573 template <class StreamType>
1574 inline void
1575 FullMatrix<number>::print(StreamType & s,
1576  const unsigned int w,
1577  const unsigned int p) const
1578 {
1579  Assert(!this->empty(), ExcEmptyMatrix());
1580 
1581  // save the state of out stream
1582  const std::streamsize old_precision = s.precision(p);
1583  const std::streamsize old_width = s.width(w);
1584 
1585  for (size_type i = 0; i < this->m(); ++i)
1586  {
1587  for (size_type j = 0; j < this->n(); ++j)
1588  {
1589  s.width(w);
1590  s.precision(p);
1591  s << this->el(i, j);
1592  }
1593  s << std::endl;
1594  }
1595 
1596  // reset output format
1597  s.precision(old_precision);
1598  s.width(old_width);
1599 }
1600 
1601 
1602 #endif // DOXYGEN
1603 
1604 DEAL_II_NAMESPACE_CLOSE
1605 
1606 #endif
void vmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
size_type column() const
void diagadd(const number s)
void copy_to(Tensor< 2, dim > &T, const size_type src_r_i=0, const size_type src_r_j=dim-1, const size_type src_c_i=0, const size_type src_c_j=dim-1, const unsigned int dst_r=0, const unsigned int dst_c=0) const
static::ExceptionBase & ExcEmptyMatrix()
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1366
void TmTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
real_type linfty_norm() const
typename numbers::NumberTraits< std::complex< double > >::real_type real_type
Definition: full_matrix.h:100
void backward(Vector< number2 > &dst, const Vector< number2 > &src) const
const_iterator(const FullMatrix< number > *matrix, const size_type row, const size_type col)
FullMatrix(const size_type n=0)
FullMatrix & operator/=(const number factor)
const Accessor & operator*() const
std::size_t size_type
Definition: full_matrix.h:82
number value() const
bool operator<(const const_iterator &) const
void gauss_jordan()
static::ExceptionBase & ExcNotRegular(number arg1)
static::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
bool operator==(const FullMatrix< number > &) const
void cholesky(const FullMatrix< number2 > &A)
void add_row(const size_type i, const number s, const size_type j)
size_type row() const
number residual(Vector< number2 > &dst, const Vector< number2 > &x, const Vector< number3 > &b) const
void outer_product(const Vector< number2 > &V, const Vector< number2 > &W)
#define AssertIndexRange(index, range)
Definition: exceptions.h:1407
void right_invert(const FullMatrix< number2 > &M)
void Tvmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
void fill_permutation(const FullMatrix< number2 > &src, const std::vector< size_type > &p_rows, const std::vector< size_type > &p_cols)
number trace() const
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void left_invert(const FullMatrix< number2 > &M)
void Tadd(const number s, const FullMatrix< number2 > &B)
bool operator!=(const const_iterator &) const
void copy_transposed(const MatrixType &)
void scatter_matrix_to(const std::vector< index_type > &row_index_set, const std::vector< index_type > &column_index_set, MatrixType &matrix) const
SymmetricTensor< rank_, dim, Number > operator*(const SymmetricTensor< rank_, dim, Number > &t, const Number &factor)
real_type relative_symmetry_norm2() const
FullMatrix & operator*=(const number factor)
const_iterator & operator++()
void set(const size_type i, const size_type j, const number value)
void triple_product(const FullMatrix< number > &A, const FullMatrix< number > &B, const FullMatrix< number > &D, const bool transpose_B=false, const bool transpose_D=false, const number scaling=number(1.))
void forward(Vector< number2 > &dst, const Vector< number2 > &src) const
number2 matrix_scalar_product(const Vector< number2 > &u, const Vector< number2 > &v) const
const FullMatrix< number > * matrix
Definition: full_matrix.h:141
std::size_t memory_consumption() const
size_type n() const
Accessor(const FullMatrix< number > *matrix, const size_type row, const size_type col)
void swap_row(const size_type i, const size_type j)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:408
number2 matrix_norm_square(const Vector< number2 > &v) const
void invert(const FullMatrix< number2 > &M)
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
Definition: exceptions.h:1227
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:397
#define DeclException0(Exception0)
Definition: exceptions.h:385
AlignedVector< T >::reference el(const TableIndices< N > &indices)
void mTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
void extract_submatrix_from(const MatrixType &matrix, const std::vector< index_type > &row_index_set, const std::vector< index_type > &column_index_set)
void Tvmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void mmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
bool operator==(const const_iterator &) const
void print_formatted(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const unsigned int width=0, const char *zero_string=" ", const double denominator=1., const double threshold=0.) const
size_type m() const
FullMatrix< number > & operator=(const FullMatrix< number2 > &)
const_iterator begin() const
void Tmmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
void add_col(const size_type i, const number s, const size_type j)
static::ExceptionBase & ExcIteratorPastEnd()
size_type n_elements() const
static::ExceptionBase & ExcSourceEqualsDestination()
void swap_col(const size_type i, const size_type j)
const Accessor * operator->() const
void copy_from(const MatrixType &)
typename AlignedVector< T >::size_type size_type
Definition: table.h:429
real_type l1_norm() const
void reset_values()
void add(const number a, const FullMatrix< number2 > &A)
static::ExceptionBase & ExcInvalidDestination(size_type arg1, size_type arg2, size_type arg3)
real_type frobenius_norm() const
Definition: table.h:37
void symmetrize()
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:432
number determinant() const
bool operator>(const const_iterator &) const
static::ExceptionBase & ExcMatrixNotPositiveDefinite()
AlignedVector< T >::reference operator()(const TableIndices< N > &indices)
const_iterator end() const
AlignedVector< T > values
Definition: table.h:681
void equ(const number a, const FullMatrix< number2 > &A)
#define AssertIsFinite(number)
Definition: exceptions.h:1428
void fill(const FullMatrix< number2 > &src, const size_type dst_offset_i=0, const size_type dst_offset_j=0, const size_type src_offset_i=0, const size_type src_offset_j=0)
void fill(InputIterator entries, const bool C_style_indexing=true)
void print(StreamType &s, const unsigned int width=5, const unsigned int precision=2) const
bool all_zero() const
void precondition_Jacobi(Vector< somenumber > &dst, const Vector< somenumber > &src, const number omega=1.) const
bool empty() const