Reference documentation for deal.II version 8.5.1
full_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2017 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/numbers.h>
22 #include <deal.II/base/table.h>
23 #include <deal.II/lac/exceptions.h>
24 #include <deal.II/lac/identity_matrix.h>
25 #include <deal.II/base/tensor.h>
26 
27 #include <vector>
28 #include <iomanip>
29 #include <cstring>
30 
31 DEAL_II_NAMESPACE_OPEN
32 
33 
34 // forward declarations
35 template <typename number> class Vector;
36 template <typename number> class LAPACKFullMatrix;
37 
38 
63 template <typename number>
64 class FullMatrix : public Table<2,number>
65 {
66 public:
73  typedef unsigned int size_type;
74 
79  typedef number value_type;
80 
81 
92 
93 
94  class const_iterator;
95 
99  class Accessor
100  {
101  public:
107  const size_type row,
108  const size_type col);
109 
113  size_type row() const;
114 
118  size_type column() const;
119 
123  number value() const;
124 
125  protected:
130 
135 
139  unsigned short a_col;
140 
141  /*
142  * Make enclosing class a friend.
143  */
144  friend class const_iterator;
145  };
146 
151  {
152  public:
156  const_iterator(const FullMatrix<number> *matrix,
157  const size_type row,
158  const size_type col);
159 
164 
169 
173  const Accessor &operator* () const;
174 
178  const Accessor *operator-> () const;
179 
183  bool operator == (const const_iterator &) const;
187  bool operator != (const const_iterator &) const;
188 
193  bool operator < (const const_iterator &) const;
194 
199  bool operator > (const const_iterator &) const;
200 
201  private:
206  };
211 
221  explicit FullMatrix (const size_type n = 0);
222 
226  FullMatrix (const size_type rows,
227  const size_type cols);
228 
233  FullMatrix (const size_type rows,
234  const size_type cols,
235  const number *entries);
236 
245  FullMatrix (const IdentityMatrix &id);
260  template <typename number2>
263 
272  operator = (const number d);
273 
283  operator = (const IdentityMatrix &id);
284 
289  template <typename number2>
292 
293 
299  template <typename MatrixType>
300  void copy_from (const MatrixType &);
301 
307  template <typename MatrixType>
308  void copy_transposed (const MatrixType &);
309 
317  template <int dim>
318  void
319  copy_from (const Tensor<2,dim> &T,
320  const size_type src_r_i=0,
321  const size_type src_r_j=dim-1,
322  const size_type src_c_i=0,
323  const size_type src_c_j=dim-1,
324  const size_type dst_r=0,
325  const size_type dst_c=0);
326 
334  template <int dim>
335  void
337  const size_type src_r_i=0,
338  const size_type src_r_j=dim-1,
339  const size_type src_c_i=0,
340  const size_type src_c_j=dim-1,
341  const size_type dst_r=0,
342  const size_type dst_c=0) const;
343 
356  template <typename MatrixType, typename index_type>
357  void extract_submatrix_from (const MatrixType &matrix,
358  const std::vector<index_type> &row_index_set,
359  const std::vector<index_type> &column_index_set);
360 
373  template <typename MatrixType, typename index_type>
374  void
375  scatter_matrix_to (const std::vector<index_type> &row_index_set,
376  const std::vector<index_type> &column_index_set,
377  MatrixType &matrix) const;
378 
389  template <typename number2>
390  void fill (const FullMatrix<number2> &src,
391  const size_type dst_offset_i = 0,
392  const size_type dst_offset_j = 0,
393  const size_type src_offset_i = 0,
394  const size_type src_offset_j = 0);
395 
396 
400  template <typename number2>
401  void fill (const number2 *);
402 
414  template <typename number2>
415  void fill_permutation (const FullMatrix<number2> &src,
416  const std::vector<size_type> &p_rows,
417  const std::vector<size_type> &p_cols);
418 
429  void set (const size_type i,
430  const size_type j,
431  const number value);
447  bool operator == (const FullMatrix<number> &) const;
448 
453  size_type m () const;
454 
459  size_type n () const;
460 
466  bool all_zero () const;
467 
483  template <typename number2>
484  number2 matrix_norm_square (const Vector<number2> &v) const;
485 
495  template <typename number2>
496  number2 matrix_scalar_product (const Vector<number2> &u,
497  const Vector<number2> &v) const;
498 
503  real_type l1_norm () const;
504 
509  real_type linfty_norm () const;
510 
518  real_type frobenius_norm () const;
519 
529 
535  number determinant () const;
536 
542  number trace () const;
543 
550  template <class StreamType>
551  void print (StreamType &s,
552  const unsigned int width=5,
553  const unsigned int precision=2) const;
554 
577  void print_formatted (std::ostream &out,
578  const unsigned int precision=3,
579  const bool scientific = true,
580  const unsigned int width = 0,
581  const char *zero_string = " ",
582  const double denominator = 1.,
583  const double threshold = 0.) const;
584 
589  std::size_t memory_consumption () const;
590 
592 
594 
598  const_iterator begin () const;
599 
603  const_iterator end () const;
604 
608  const_iterator begin (const size_type r) const;
609 
613  const_iterator end (const size_type r) const;
614 
616 
618 
622  FullMatrix &operator *= (const number factor);
623 
627  FullMatrix &operator /= (const number factor);
628 
636  template <typename number2>
637  void add (const number a,
638  const FullMatrix<number2> &A);
639 
647  template <typename number2>
648  void add (const number a,
649  const FullMatrix<number2> &A,
650  const number b,
651  const FullMatrix<number2> &B);
652 
661  template <typename number2>
662  void add (const number a,
663  const FullMatrix<number2> &A,
664  const number b,
665  const FullMatrix<number2> &B,
666  const number c,
667  const FullMatrix<number2> &C);
668 
680  template <typename number2>
681  void add (const FullMatrix<number2> &src,
682  const number factor,
683  const size_type dst_offset_i = 0,
684  const size_type dst_offset_j = 0,
685  const size_type src_offset_i = 0,
686  const size_type src_offset_j = 0);
687 
693  template <typename number2>
694  void Tadd (const number s,
695  const FullMatrix<number2> &B);
696 
708  template <typename number2>
709  void Tadd (const FullMatrix<number2> &src,
710  const number factor,
711  const size_type dst_offset_i = 0,
712  const size_type dst_offset_j = 0,
713  const size_type src_offset_i = 0,
714  const size_type src_offset_j = 0);
715 
719  void add (const size_type row,
720  const size_type column,
721  const number value);
722 
732  template <typename number2, typename index_type>
733  void add (const size_type row,
734  const unsigned int n_cols,
735  const index_type *col_indices,
736  const number2 *values,
737  const bool elide_zero_values = true,
738  const bool col_indices_are_sorted = false);
739 
743  void add_row (const size_type i,
744  const number s,
745  const size_type j);
746 
751  void add_row (const size_type i,
752  const number s, const size_type j,
753  const number t, const size_type k);
754 
758  void add_col (const size_type i,
759  const number s,
760  const size_type j);
761 
766  void add_col (const size_type i,
767  const number s, const size_type j,
768  const number t, const size_type k);
769 
773  void swap_row (const size_type i,
774  const size_type j);
775 
779  void swap_col (const size_type i,
780  const size_type j);
781 
786  void diagadd (const number s);
787 
791  template <typename number2>
792  void equ (const number a,
793  const FullMatrix<number2> &A);
794 
798  template <typename number2>
799  void equ (const number a,
800  const FullMatrix<number2> &A,
801  const number b,
802  const FullMatrix<number2> &B);
803 
807  template <typename number2>
808  void equ (const number a,
809  const FullMatrix<number2> &A,
810  const number b,
811  const FullMatrix<number2> &B,
812  const number c,
813  const FullMatrix<number2> &C);
814 
821  void symmetrize ();
822 
837  void gauss_jordan ();
838 
845  template <typename number2>
846  void invert (const FullMatrix<number2> &M);
847 
855  template <typename number2>
856  void cholesky (const FullMatrix<number2> &A);
857 
862  template <typename number2>
863  void outer_product (const Vector<number2> &V,
864  const Vector<number2> &W);
865 
871  template <typename number2>
872  void left_invert (const FullMatrix<number2> &M);
873 
879  template <typename number2>
880  void right_invert (const FullMatrix<number2> &M);
881 
883 
885 
904  template <typename number2>
905  void mmult (FullMatrix<number2> &C,
906  const FullMatrix<number2> &B,
907  const bool adding=false) const;
908 
927  template <typename number2>
928  void Tmmult (FullMatrix<number2> &C,
929  const FullMatrix<number2> &B,
930  const bool adding=false) const;
931 
950  template <typename number2>
951  void mTmult (FullMatrix<number2> &C,
952  const FullMatrix<number2> &B,
953  const bool adding=false) const;
954 
974  template <typename number2>
975  void TmTmult (FullMatrix<number2> &C,
976  const FullMatrix<number2> &B,
977  const bool adding=false) const;
978 
989  void triple_product(const FullMatrix<number> &A,
990  const FullMatrix<number> &B,
991  const FullMatrix<number> &D,
992  const bool transpose_B = false,
993  const bool transpose_D = false,
994  const number scaling = number(1.));
995 
1008  template <typename number2>
1009  void vmult (Vector<number2> &w,
1010  const Vector<number2> &v,
1011  const bool adding=false) const;
1012 
1018  template <typename number2>
1019  void vmult_add (Vector<number2> &w,
1020  const Vector<number2> &v) const;
1021 
1035  template <typename number2>
1036  void Tvmult (Vector<number2> &w,
1037  const Vector<number2> &v,
1038  const bool adding=false) const;
1039 
1046  template <typename number2>
1047  void Tvmult_add (Vector<number2> &w,
1048  const Vector<number2> &v) const;
1049 
1055  template <typename somenumber>
1057  const Vector<somenumber> &src,
1058  const number omega = 1.) const;
1059 
1066  template <typename number2, typename number3>
1067  number residual (Vector<number2> &dst,
1068  const Vector<number2> &x,
1069  const Vector<number3> &b) const;
1070 
1081  template <typename number2>
1082  void forward (Vector<number2> &dst,
1083  const Vector<number2> &src) const;
1084 
1092  template <typename number2>
1093  void backward (Vector<number2> &dst,
1094  const Vector<number2> &src) const;
1095 
1097 
1107 
1112  number,
1113  << "The maximal pivot is " << arg1
1114  << ", which is below the threshold. The matrix may be singular.");
1120  << "Target region not in matrix: size in this direction="
1121  << arg1 << ", size of new matrix=" << arg2
1122  << ", offset=" << arg3);
1132 
1133  friend class Accessor;
1134 };
1135 
1138 #ifndef DOXYGEN
1139 /*-------------------------Inline functions -------------------------------*/
1140 
1141 
1142 
1143 
1144 template <typename number>
1145 inline
1147 FullMatrix<number>::m() const
1148 {
1149  return this->n_rows();
1150 }
1151 
1152 
1153 
1154 template <typename number>
1155 inline
1157 FullMatrix<number>::n() const
1158 {
1159  return this->n_cols();
1160 }
1161 
1162 
1163 
1164 template <typename number>
1166 FullMatrix<number>::operator = (const number d)
1167 {
1168  Assert (d==number(0), ExcScalarAssignmentOnlyForZeroValue());
1169  (void)d; // removes -Wunused-parameter warning in optimized mode
1170 
1171  if (this->n_elements() != 0)
1172  this->reset_values();
1173 
1174  return *this;
1175 }
1176 
1177 
1178 
1179 template <typename number>
1180 template <typename number2>
1181 inline
1182 void FullMatrix<number>::fill (const number2 *src)
1183 {
1184  Table<2,number>::fill(src);
1185 }
1186 
1187 
1188 
1189 template <typename number>
1190 template <typename MatrixType>
1191 void
1192 FullMatrix<number>::copy_from (const MatrixType &M)
1193 {
1194  this->reinit (M.m(), M.n());
1195 
1196  // loop over the elements of the argument matrix row by row, as suggested
1197  // in the documentation of the sparse matrix iterator class, and
1198  // copy them into the current object
1199  for (size_type row = 0; row < M.m(); ++row)
1200  {
1201  const typename MatrixType::const_iterator end_row = M.end(row);
1202  for (typename MatrixType::const_iterator entry = M.begin(row);
1203  entry != end_row; ++entry)
1204  this->el(row, entry->column()) = entry->value();
1205  }
1206 }
1207 
1208 
1209 
1210 template <typename number>
1211 template <typename MatrixType>
1212 void
1213 FullMatrix<number>::copy_transposed (const MatrixType &M)
1214 {
1215  this->reinit (M.n(), M.m());
1216 
1217  // loop over the elements of the argument matrix row by row, as suggested
1218  // in the documentation of the sparse matrix iterator class, and
1219  // copy them into the current object
1220  for (size_type row = 0; row < M.m(); ++row)
1221  {
1222  const typename MatrixType::const_iterator end_row = M.end(row);
1223  for (typename MatrixType::const_iterator entry = M.begin(row);
1224  entry != end_row; ++entry)
1225  this->el(entry->column(), row) = entry->value();
1226  }
1227 }
1228 
1229 
1230 
1231 template <typename number>
1232 template <typename MatrixType, typename index_type>
1233 inline
1234 void
1235 FullMatrix<number>::extract_submatrix_from (const MatrixType &matrix,
1236  const std::vector<index_type> &row_index_set,
1237  const std::vector<index_type> &column_index_set)
1238 {
1239  AssertDimension(row_index_set.size(), this->n_rows());
1240  AssertDimension(column_index_set.size(), this->n_cols());
1241 
1242  const size_type n_rows_submatrix = row_index_set.size();
1243  const size_type n_cols_submatrix = column_index_set.size();
1244 
1245  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1246  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1247  (*this)(sub_row, sub_col) = matrix.el(row_index_set[sub_row], column_index_set[sub_col]);
1248 }
1249 
1250 
1251 
1252 template <typename number>
1253 template <typename MatrixType, typename index_type>
1254 inline
1255 void
1256 FullMatrix<number>::scatter_matrix_to (const std::vector<index_type> &row_index_set,
1257  const std::vector<index_type> &column_index_set,
1258  MatrixType &matrix) const
1259 {
1260  AssertDimension(row_index_set.size(), this->n_rows());
1261  AssertDimension(column_index_set.size(), this->n_cols());
1262 
1263  const size_type n_rows_submatrix = row_index_set.size();
1264  const size_type n_cols_submatrix = column_index_set.size();
1265 
1266  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1267  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1268  matrix.set(row_index_set[sub_row],
1269  column_index_set[sub_col],
1270  (*this)(sub_row, sub_col));
1271 }
1272 
1273 
1274 template <typename number>
1275 inline
1276 void
1277 FullMatrix<number>::set (const size_type i,
1278  const size_type j,
1279  const number value)
1280 {
1281  (*this)(i,j) = value;
1282 }
1283 
1284 
1285 
1286 template <typename number>
1287 template <typename number2>
1288 void
1290  const Vector<number2> &v) const
1291 {
1292  vmult(w, v, true);
1293 }
1294 
1295 
1296 template <typename number>
1297 template <typename number2>
1298 void
1300  const Vector<number2> &v) const
1301 {
1302  Tvmult(w, v, true);
1303 }
1304 
1305 
1306 //---------------------------------------------------------------------------
1307 
1308 
1309 template <typename number>
1310 inline
1312 Accessor (const FullMatrix<number> *matrix,
1313  const size_type r,
1314  const size_type c)
1315  :
1316  matrix(matrix),
1317  a_row(r),
1318  a_col(c)
1319 {}
1320 
1321 
1322 template <typename number>
1323 inline
1326 {
1327  return a_row;
1328 }
1329 
1330 
1331 template <typename number>
1332 inline
1335 {
1336  return a_col;
1337 }
1338 
1339 
1340 template <typename number>
1341 inline
1342 number
1344 {
1345  AssertIsFinite(matrix->el(a_row, a_col));
1346  return matrix->el(a_row, a_col);
1347 }
1348 
1349 
1350 template <typename number>
1351 inline
1353 const_iterator(const FullMatrix<number> *matrix,
1354  const size_type r,
1355  const size_type c)
1356  :
1357  accessor(matrix, r, c)
1358 {}
1359 
1360 
1361 template <typename number>
1362 inline
1365 {
1366  Assert (accessor.a_row < accessor.matrix->m(), ExcIteratorPastEnd());
1367 
1368  ++accessor.a_col;
1369  if (accessor.a_col >= accessor.matrix->n())
1370  {
1371  accessor.a_col = 0;
1372  accessor.a_row++;
1373  }
1374  return *this;
1375 }
1376 
1377 
1378 template <typename number>
1379 inline
1380 const typename FullMatrix<number>::Accessor &
1382 {
1383  return accessor;
1384 }
1385 
1386 
1387 template <typename number>
1388 inline
1389 const typename FullMatrix<number>::Accessor *
1391 {
1392  return &accessor;
1393 }
1394 
1395 
1396 template <typename number>
1397 inline
1398 bool
1400 operator == (const const_iterator &other) const
1401 {
1402  return (accessor.row() == other.accessor.row() &&
1403  accessor.column() == other.accessor.column());
1404 }
1405 
1406 
1407 template <typename number>
1408 inline
1409 bool
1411 operator != (const const_iterator &other) const
1412 {
1413  return ! (*this == other);
1414 }
1415 
1416 
1417 template <typename number>
1418 inline
1419 bool
1421 operator < (const const_iterator &other) const
1422 {
1423  return (accessor.row() < other.accessor.row() ||
1424  (accessor.row() == other.accessor.row() &&
1425  accessor.column() < other.accessor.column()));
1426 }
1427 
1428 
1429 template <typename number>
1430 inline
1431 bool
1433 operator > (const const_iterator &other) const
1434 {
1435  return (other < *this);
1436 }
1437 
1438 
1439 template <typename number>
1440 inline
1443 {
1444  return const_iterator(this, 0, 0);
1445 }
1446 
1447 
1448 template <typename number>
1449 inline
1451 FullMatrix<number>::end () const
1452 {
1453  return const_iterator(this, m(), 0);
1454 }
1455 
1456 
1457 template <typename number>
1458 inline
1460 FullMatrix<number>::begin (const size_type r) const
1461 {
1462  Assert (r<m(), ExcIndexRange(r,0,m()));
1463  return const_iterator(this, r, 0);
1464 }
1465 
1466 
1467 
1468 template <typename number>
1469 inline
1471 FullMatrix<number>::end (const size_type r) const
1472 {
1473  Assert (r<m(), ExcIndexRange(r,0,m()));
1474  return const_iterator(this, r+1, 0);
1475 }
1476 
1477 
1478 
1479 template <typename number>
1480 inline
1481 void
1482 FullMatrix<number>::add (const size_type r, const size_type c, const number v)
1483 {
1484  AssertIndexRange(r, this->m());
1485  AssertIndexRange(c, this->n());
1486 
1487  this->operator()(r,c) += v;
1488 }
1489 
1490 
1491 
1492 template <typename number>
1493 template <typename number2, typename index_type>
1494 inline
1495 void
1497  const unsigned int n_cols,
1498  const index_type *col_indices,
1499  const number2 *values,
1500  const bool,
1501  const bool)
1502 {
1503  AssertIndexRange(row, this->m());
1504  for (size_type col=0; col<n_cols; ++col)
1505  {
1506  AssertIndexRange(col_indices[col], this->n());
1507  this->operator()(row,col_indices[col]) += values[col];
1508  }
1509 }
1510 
1511 
1512 template <typename number>
1513 template <class StreamType>
1514 inline
1515 void
1516 FullMatrix<number>::print (StreamType &s,
1517  const unsigned int w,
1518  const unsigned int p) const
1519 {
1520  Assert (!this->empty(), ExcEmptyMatrix());
1521 
1522  // save the state of out stream
1523  const unsigned int old_precision = s.precision (p);
1524  const unsigned int old_width = s.width (w);
1525 
1526  for (size_type i=0; i<this->m(); ++i)
1527  {
1528  for (size_type j=0; j<this->n(); ++j)
1529  {
1530  s.width(w);
1531  s.precision(p);
1532  s << this->el(i,j);
1533  }
1534  s << std::endl;
1535  }
1536 
1537  // reset output format
1538  s.precision(old_precision);
1539  s.width(old_width);
1540 }
1541 
1542 
1543 #endif // DOXYGEN
1544 
1545 DEAL_II_NAMESPACE_CLOSE
1546 
1547 #endif
size_type m() const
number determinant() const
const Accessor & operator*() const
void diagadd(const number s)
bool operator==(const FullMatrix< number > &) const
static ::ExceptionBase & ExcEmptyMatrix()
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1146
void vmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
const_iterator(const FullMatrix< number > *matrix, const size_type row, const size_type col)
unsigned int size_type
Definition: full_matrix.h:73
number2 matrix_scalar_product(const Vector< number2 > &u, const Vector< number2 > &v) const
FullMatrix(const size_type n=0)
bool operator==(const const_iterator &) const
FullMatrix & operator/=(const number factor)
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
void gauss_jordan()
static ::ExceptionBase & ExcNotRegular(number arg1)
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
void cholesky(const FullMatrix< number2 > &A)
void add_row(const size_type i, const number s, const size_type j)
bool operator>(const const_iterator &) const
const_iterator begin() const
void outer_product(const Vector< number2 > &V, const Vector< number2 > &W)
#define AssertIndexRange(index, range)
Definition: exceptions.h:1170
void right_invert(const FullMatrix< number2 > &M)
void scatter_matrix_to(const std::vector< index_type > &row_index_set, const std::vector< index_type > &column_index_set, MatrixType &matrix) const
void fill_permutation(const FullMatrix< number2 > &src, const std::vector< size_type > &p_rows, const std::vector< size_type > &p_cols)
void left_invert(const FullMatrix< number2 > &M)
void Tadd(const number s, const FullMatrix< number2 > &B)
void copy_transposed(const MatrixType &)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
real_type l1_norm() 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.))
const Accessor * operator->() const
real_type frobenius_norm() const
const FullMatrix< number > * matrix
Definition: full_matrix.h:129
void Tmmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
void backward(Vector< number2 > &dst, const Vector< number2 > &src) const
size_type row() const
numbers::NumberTraits< number >::real_type real_type
Definition: full_matrix.h:91
Accessor(const FullMatrix< number > *matrix, const size_type row, const size_type col)
size_type n() const
void swap_row(const size_type i, const size_type j)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:564
real_type linfty_norm() const
void invert(const FullMatrix< number2 > &M)
#define Assert(cond, exc)
Definition: exceptions.h:313
bool operator!=(const const_iterator &) const
bool operator<(const const_iterator &) const
#define DeclException0(Exception0)
Definition: exceptions.h:541
AlignedVector< T >::reference el(const TableIndices< N > &indices)
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_add(Vector< number2 > &w, const Vector< number2 > &v) const
number value() const
unsigned short a_col
Definition: full_matrix.h:139
const_iterator end() const
real_type relative_symmetry_norm2() const
number residual(Vector< number2 > &dst, const Vector< number2 > &x, const Vector< number3 > &b) const
FullMatrix< number > & operator=(const FullMatrix< number2 > &)
void TmTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
number2 matrix_norm_square(const Vector< number2 > &v) const
void add_col(const size_type i, const number s, const size_type j)
static ::ExceptionBase & ExcIteratorPastEnd()
number trace() const
void mmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
std::size_t memory_consumption() const
void Tvmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void forward(Vector< number2 > &dst, const Vector< number2 > &src) const
number value_type
Definition: full_matrix.h:79
static ::ExceptionBase & ExcSourceEqualsDestination()
void swap_col(const size_type i, const size_type j)
void copy_from(const MatrixType &)
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 size_type dst_r=0, const size_type dst_c=0) const
void add(const number a, const FullMatrix< number2 > &A)
static ::ExceptionBase & ExcInvalidDestination(size_type arg1, size_type arg2, size_type arg3)
void precondition_Jacobi(Vector< somenumber > &dst, const Vector< somenumber > &src, const number omega=1.) const
Definition: table.h:33
void print(StreamType &s, const unsigned int width=5, const unsigned int precision=2) const
bool empty() const
void symmetrize()
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:588
static ::ExceptionBase & ExcMatrixNotPositiveDefinite()
AlignedVector< T >::size_type size_type
Definition: table.h:411
AlignedVector< T >::reference operator()(const TableIndices< N > &indices)
AlignedVector< T > values
Definition: table.h:654
void equ(const number a, const FullMatrix< number2 > &A)
#define AssertIsFinite(number)
Definition: exceptions.h:1197
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 mTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
size_type column() const
bool all_zero() const