Reference documentation for deal.II version 8.4.2
full_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2016 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 
134  size_type a_row;
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:
157  const size_type row,
158  const size_type col);
159 
163  const_iterator &operator++ ();
164 
168  const_iterator &operator++ (int);
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 
238  FullMatrix (const FullMatrix &);
239 
244  FullMatrix (const size_type rows,
245  const size_type cols,
246  const number *entries);
247 
256  FullMatrix (const IdentityMatrix &id);
275 
279  template <typename number2>
282 
291  operator = (const number d);
292 
302  operator = (const IdentityMatrix &id);
303 
308  template <typename number2>
311 
312 
318  template <typename MatrixType>
319  void copy_from (const MatrixType &);
320 
326  template <typename MatrixType>
327  void copy_transposed (const MatrixType &);
328 
336  template <int dim>
337  void
338  copy_from (const Tensor<2,dim> &T,
339  const size_type src_r_i=0,
340  const size_type src_r_j=dim-1,
341  const size_type src_c_i=0,
342  const size_type src_c_j=dim-1,
343  const size_type dst_r=0,
344  const size_type dst_c=0);
345 
353  template <int dim>
354  void
356  const size_type src_r_i=0,
357  const size_type src_r_j=dim-1,
358  const size_type src_c_i=0,
359  const size_type src_c_j=dim-1,
360  const size_type dst_r=0,
361  const size_type dst_c=0) const;
362 
375  template <typename MatrixType, typename index_type>
376  void extract_submatrix_from (const MatrixType &matrix,
377  const std::vector<index_type> &row_index_set,
378  const std::vector<index_type> &column_index_set);
379 
392  template <typename MatrixType, typename index_type>
393  void
394  scatter_matrix_to (const std::vector<index_type> &row_index_set,
395  const std::vector<index_type> &column_index_set,
396  MatrixType &matrix) const;
397 
408  template <typename number2>
409  void fill (const FullMatrix<number2> &src,
410  const size_type dst_offset_i = 0,
411  const size_type dst_offset_j = 0,
412  const size_type src_offset_i = 0,
413  const size_type src_offset_j = 0);
414 
415 
419  template <typename number2>
420  void fill (const number2 *);
421 
433  template <typename number2>
434  void fill_permutation (const FullMatrix<number2> &src,
435  const std::vector<size_type> &p_rows,
436  const std::vector<size_type> &p_cols);
437 
448  void set (const size_type i,
449  const size_type j,
450  const number value);
466  bool operator == (const FullMatrix<number> &) const;
467 
472  size_type m () const;
473 
478  size_type n () const;
479 
485  bool all_zero () const;
486 
502  template <typename number2>
503  number2 matrix_norm_square (const Vector<number2> &v) const;
504 
514  template <typename number2>
515  number2 matrix_scalar_product (const Vector<number2> &u,
516  const Vector<number2> &v) const;
517 
522  real_type l1_norm () const;
523 
528  real_type linfty_norm () const;
529 
537  real_type frobenius_norm () const;
538 
547  real_type relative_symmetry_norm2 () const;
548 
554  number determinant () const;
555 
561  number trace () const;
562 
569  template <class StreamType>
570  void print (StreamType &s,
571  const unsigned int width=5,
572  const unsigned int precision=2) const;
573 
596  void print_formatted (std::ostream &out,
597  const unsigned int precision=3,
598  const bool scientific = true,
599  const unsigned int width = 0,
600  const char *zero_string = " ",
601  const double denominator = 1.,
602  const double threshold = 0.) const;
603 
608  std::size_t memory_consumption () const;
609 
611 
613 
617  const_iterator begin () const;
618 
622  const_iterator end () const;
623 
627  const_iterator begin (const size_type r) const;
628 
632  const_iterator end (const size_type r) const;
633 
635 
637 
641  FullMatrix &operator *= (const number factor);
642 
646  FullMatrix &operator /= (const number factor);
647 
655  template <typename number2>
656  void add (const number a,
657  const FullMatrix<number2> &A);
658 
666  template <typename number2>
667  void add (const number a,
668  const FullMatrix<number2> &A,
669  const number b,
670  const FullMatrix<number2> &B);
671 
680  template <typename number2>
681  void add (const number a,
682  const FullMatrix<number2> &A,
683  const number b,
684  const FullMatrix<number2> &B,
685  const number c,
686  const FullMatrix<number2> &C);
687 
699  template <typename number2>
700  void add (const FullMatrix<number2> &src,
701  const number factor,
702  const size_type dst_offset_i = 0,
703  const size_type dst_offset_j = 0,
704  const size_type src_offset_i = 0,
705  const size_type src_offset_j = 0);
706 
712  template <typename number2>
713  void Tadd (const number s,
714  const FullMatrix<number2> &B);
715 
727  template <typename number2>
728  void Tadd (const FullMatrix<number2> &src,
729  const number factor,
730  const size_type dst_offset_i = 0,
731  const size_type dst_offset_j = 0,
732  const size_type src_offset_i = 0,
733  const size_type src_offset_j = 0);
734 
738  void add (const size_type row,
739  const size_type column,
740  const number value);
741 
751  template <typename number2, typename index_type>
752  void add (const size_type row,
753  const unsigned int n_cols,
754  const index_type *col_indices,
755  const number2 *values,
756  const bool elide_zero_values = true,
757  const bool col_indices_are_sorted = false);
758 
762  void add_row (const size_type i,
763  const number s,
764  const size_type j);
765 
770  void add_row (const size_type i,
771  const number s, const size_type j,
772  const number t, const size_type k);
773 
777  void add_col (const size_type i,
778  const number s,
779  const size_type j);
780 
785  void add_col (const size_type i,
786  const number s, const size_type j,
787  const number t, const size_type k);
788 
792  void swap_row (const size_type i,
793  const size_type j);
794 
798  void swap_col (const size_type i,
799  const size_type j);
800 
805  void diagadd (const number s);
806 
810  template <typename number2>
811  void equ (const number a,
812  const FullMatrix<number2> &A);
813 
817  template <typename number2>
818  void equ (const number a,
819  const FullMatrix<number2> &A,
820  const number b,
821  const FullMatrix<number2> &B);
822 
826  template <typename number2>
827  void equ (const number a,
828  const FullMatrix<number2> &A,
829  const number b,
830  const FullMatrix<number2> &B,
831  const number c,
832  const FullMatrix<number2> &C);
833 
840  void symmetrize ();
841 
856  void gauss_jordan ();
857 
864  template <typename number2>
865  void invert (const FullMatrix<number2> &M);
866 
874  template <typename number2>
875  void cholesky (const FullMatrix<number2> &A);
876 
881  template <typename number2>
882  void outer_product (const Vector<number2> &V,
883  const Vector<number2> &W);
884 
890  template <typename number2>
891  void left_invert (const FullMatrix<number2> &M);
892 
898  template <typename number2>
899  void right_invert (const FullMatrix<number2> &M);
900 
902 
904 
923  template <typename number2>
924  void mmult (FullMatrix<number2> &C,
925  const FullMatrix<number2> &B,
926  const bool adding=false) const;
927 
946  template <typename number2>
947  void Tmmult (FullMatrix<number2> &C,
948  const FullMatrix<number2> &B,
949  const bool adding=false) const;
950 
969  template <typename number2>
970  void mTmult (FullMatrix<number2> &C,
971  const FullMatrix<number2> &B,
972  const bool adding=false) const;
973 
993  template <typename number2>
994  void TmTmult (FullMatrix<number2> &C,
995  const FullMatrix<number2> &B,
996  const bool adding=false) const;
997 
1008  void triple_product(const FullMatrix<number> &A,
1009  const FullMatrix<number> &B,
1010  const FullMatrix<number> &D,
1011  const bool transpose_B = false,
1012  const bool transpose_D = false,
1013  const number scaling = number(1.));
1014 
1027  template <typename number2>
1028  void vmult (Vector<number2> &w,
1029  const Vector<number2> &v,
1030  const bool adding=false) const;
1031 
1037  template <typename number2>
1038  void vmult_add (Vector<number2> &w,
1039  const Vector<number2> &v) const;
1040 
1054  template <typename number2>
1055  void Tvmult (Vector<number2> &w,
1056  const Vector<number2> &v,
1057  const bool adding=false) const;
1058 
1065  template <typename number2>
1066  void Tvmult_add (Vector<number2> &w,
1067  const Vector<number2> &v) const;
1068 
1074  template <typename somenumber>
1076  const Vector<somenumber> &src,
1077  const number omega = 1.) const;
1078 
1085  template <typename number2, typename number3>
1086  number residual (Vector<number2> &dst,
1087  const Vector<number2> &x,
1088  const Vector<number3> &b) const;
1089 
1100  template <typename number2>
1101  void forward (Vector<number2> &dst,
1102  const Vector<number2> &src) const;
1103 
1111  template <typename number2>
1112  void backward (Vector<number2> &dst,
1113  const Vector<number2> &src) const;
1114 
1116 
1125  DeclException0 (ExcEmptyMatrix);
1126 
1130  DeclException1 (ExcNotRegular,
1131  number,
1132  << "The maximal pivot is " << arg1
1133  << ", which is below the threshold. The matrix may be singular.");
1137  DeclException3 (ExcInvalidDestination,
1138  size_type, size_type, size_type,
1139  << "Target region not in matrix: size in this direction="
1140  << arg1 << ", size of new matrix=" << arg2
1141  << ", offset=" << arg3);
1145  DeclException0 (ExcSourceEqualsDestination);
1149  DeclException0 (ExcMatrixNotPositiveDefinite);
1151 
1152  friend class Accessor;
1153 };
1154 
1157 #ifndef DOXYGEN
1158 /*-------------------------Inline functions -------------------------------*/
1159 
1160 
1161 
1162 
1163 template <typename number>
1164 inline
1166 FullMatrix<number>::m() const
1167 {
1168  return this->n_rows();
1169 }
1170 
1171 
1172 
1173 template <typename number>
1174 inline
1176 FullMatrix<number>::n() const
1177 {
1178  return this->n_cols();
1179 }
1180 
1181 
1182 
1183 template <typename number>
1185 FullMatrix<number>::operator = (const number d)
1186 {
1187  Assert (d==number(0), ExcScalarAssignmentOnlyForZeroValue());
1188  (void)d; // removes -Wunused-parameter warning in optimized mode
1189 
1190  if (this->n_elements() != 0)
1191  this->reset_values();
1192 
1193  return *this;
1194 }
1195 
1196 
1197 
1198 template <typename number>
1199 template <typename number2>
1200 inline
1201 void FullMatrix<number>::fill (const number2 *src)
1202 {
1203  Table<2,number>::fill(src);
1204 }
1205 
1206 
1207 
1208 template <typename number>
1209 template <typename MatrixType>
1210 void
1211 FullMatrix<number>::copy_from (const MatrixType &M)
1212 {
1213  this->reinit (M.m(), M.n());
1214 
1215  // loop over the elements of the argument matrix row by row, as suggested
1216  // in the documentation of the sparse matrix iterator class, and
1217  // copy them into the current object
1218  for (size_type row = 0; row < M.m(); ++row)
1219  {
1220  const typename MatrixType::const_iterator end_row = M.end(row);
1221  for (typename MatrixType::const_iterator entry = M.begin(row);
1222  entry != end_row; ++entry)
1223  this->el(row, entry->column()) = entry->value();
1224  }
1225 }
1226 
1227 
1228 
1229 template <typename number>
1230 template <typename MatrixType>
1231 void
1232 FullMatrix<number>::copy_transposed (const MatrixType &M)
1233 {
1234  this->reinit (M.n(), M.m());
1235 
1236  // loop over the elements of the argument matrix row by row, as suggested
1237  // in the documentation of the sparse matrix iterator class, and
1238  // copy them into the current object
1239  for (size_type row = 0; row < M.m(); ++row)
1240  {
1241  const typename MatrixType::const_iterator end_row = M.end(row);
1242  for (typename MatrixType::const_iterator entry = M.begin(row);
1243  entry != end_row; ++entry)
1244  this->el(entry->column(), row) = entry->value();
1245  }
1246 }
1247 
1248 
1249 
1250 template <typename number>
1251 template <typename MatrixType, typename index_type>
1252 inline
1253 void
1255  const std::vector<index_type> &row_index_set,
1256  const std::vector<index_type> &column_index_set)
1257 {
1258  AssertDimension(row_index_set.size(), this->n_rows());
1259  AssertDimension(column_index_set.size(), this->n_cols());
1260 
1261  const size_type n_rows_submatrix = row_index_set.size();
1262  const size_type n_cols_submatrix = column_index_set.size();
1263 
1264  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1265  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1266  (*this)(sub_row, sub_col) = matrix.el(row_index_set[sub_row], column_index_set[sub_col]);
1267 }
1268 
1269 
1270 
1271 template <typename number>
1272 template <typename MatrixType, typename index_type>
1273 inline
1274 void
1275 FullMatrix<number>::scatter_matrix_to (const std::vector<index_type> &row_index_set,
1276  const std::vector<index_type> &column_index_set,
1277  MatrixType &matrix) const
1278 {
1279  AssertDimension(row_index_set.size(), this->n_rows());
1280  AssertDimension(column_index_set.size(), this->n_cols());
1281 
1282  const size_type n_rows_submatrix = row_index_set.size();
1283  const size_type n_cols_submatrix = column_index_set.size();
1284 
1285  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1286  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1287  matrix.set(row_index_set[sub_row],
1288  column_index_set[sub_col],
1289  (*this)(sub_row, sub_col));
1290 }
1291 
1292 
1293 template <typename number>
1294 inline
1295 void
1296 FullMatrix<number>::set (const size_type i,
1297  const size_type j,
1298  const number value)
1299 {
1300  (*this)(i,j) = value;
1301 }
1302 
1303 
1304 
1305 template <typename number>
1306 template <typename number2>
1307 void
1309  const Vector<number2> &v) const
1310 {
1311  vmult(w, v, true);
1312 }
1313 
1314 
1315 template <typename number>
1316 template <typename number2>
1317 void
1319  const Vector<number2> &v) const
1320 {
1321  Tvmult(w, v, true);
1322 }
1323 
1324 
1325 //---------------------------------------------------------------------------
1326 
1327 
1328 template <typename number>
1329 inline
1331 Accessor (const FullMatrix<number> *matrix,
1332  const size_type r,
1333  const size_type c)
1334  :
1335  matrix(matrix),
1336  a_row(r),
1337  a_col(c)
1338 {}
1339 
1340 
1341 template <typename number>
1342 inline
1345 {
1346  return a_row;
1347 }
1348 
1349 
1350 template <typename number>
1351 inline
1354 {
1355  return a_col;
1356 }
1357 
1358 
1359 template <typename number>
1360 inline
1361 number
1363 {
1364  AssertIsFinite(matrix->el(a_row, a_col));
1365  return matrix->el(a_row, a_col);
1366 }
1367 
1368 
1369 template <typename number>
1370 inline
1372 const_iterator(const FullMatrix<number> *matrix,
1373  const size_type r,
1374  const size_type c)
1375  :
1376  accessor(matrix, r, c)
1377 {}
1378 
1379 
1380 template <typename number>
1381 inline
1384 {
1385  Assert (accessor.a_row < accessor.matrix->m(), ExcIteratorPastEnd());
1386 
1387  ++accessor.a_col;
1388  if (accessor.a_col >= accessor.matrix->n())
1389  {
1390  accessor.a_col = 0;
1391  accessor.a_row++;
1392  }
1393  return *this;
1394 }
1395 
1396 
1397 template <typename number>
1398 inline
1399 const typename FullMatrix<number>::Accessor &
1401 {
1402  return accessor;
1403 }
1404 
1405 
1406 template <typename number>
1407 inline
1408 const typename FullMatrix<number>::Accessor *
1410 {
1411  return &accessor;
1412 }
1413 
1414 
1415 template <typename number>
1416 inline
1417 bool
1419 operator == (const const_iterator &other) const
1420 {
1421  return (accessor.row() == other.accessor.row() &&
1422  accessor.column() == other.accessor.column());
1423 }
1424 
1425 
1426 template <typename number>
1427 inline
1428 bool
1430 operator != (const const_iterator &other) const
1431 {
1432  return ! (*this == other);
1433 }
1434 
1435 
1436 template <typename number>
1437 inline
1438 bool
1440 operator < (const const_iterator &other) const
1441 {
1442  return (accessor.row() < other.accessor.row() ||
1443  (accessor.row() == other.accessor.row() &&
1444  accessor.column() < other.accessor.column()));
1445 }
1446 
1447 
1448 template <typename number>
1449 inline
1450 bool
1452 operator > (const const_iterator &other) const
1453 {
1454  return (other < *this);
1455 }
1456 
1457 
1458 template <typename number>
1459 inline
1462 {
1463  return const_iterator(this, 0, 0);
1464 }
1465 
1466 
1467 template <typename number>
1468 inline
1470 FullMatrix<number>::end () const
1471 {
1472  return const_iterator(this, m(), 0);
1473 }
1474 
1475 
1476 template <typename number>
1477 inline
1479 FullMatrix<number>::begin (const size_type r) const
1480 {
1481  Assert (r<m(), ExcIndexRange(r,0,m()));
1482  return const_iterator(this, r, 0);
1483 }
1484 
1485 
1486 
1487 template <typename number>
1488 inline
1490 FullMatrix<number>::end (const size_type r) const
1491 {
1492  Assert (r<m(), ExcIndexRange(r,0,m()));
1493  return const_iterator(this, r+1, 0);
1494 }
1495 
1496 
1497 
1498 template <typename number>
1499 inline
1500 void
1501 FullMatrix<number>::add (const size_type r, const size_type c, const number v)
1502 {
1503  AssertIndexRange(r, this->m());
1504  AssertIndexRange(c, this->n());
1505 
1506  this->operator()(r,c) += v;
1507 }
1508 
1509 
1510 
1511 template <typename number>
1512 template <typename number2, typename index_type>
1513 inline
1514 void
1515 FullMatrix<number>::add (const size_type row,
1516  const unsigned int n_cols,
1517  const index_type *col_indices,
1518  const number2 *values,
1519  const bool,
1520  const bool)
1521 {
1522  AssertIndexRange(row, this->m());
1523  for (size_type col=0; col<n_cols; ++col)
1524  {
1525  AssertIndexRange(col_indices[col], this->n());
1526  this->operator()(row,col_indices[col]) += values[col];
1527  }
1528 }
1529 
1530 
1531 template <typename number>
1532 template <class StreamType>
1533 inline
1534 void
1535 FullMatrix<number>::print (StreamType &s,
1536  const unsigned int w,
1537  const unsigned int p) const
1538 {
1539  Assert (!this->empty(), ExcEmptyMatrix());
1540 
1541  // save the state of out stream
1542  const unsigned int old_precision = s.precision (p);
1543  const unsigned int old_width = s.width (w);
1544 
1545  for (size_type i=0; i<this->m(); ++i)
1546  {
1547  for (size_type j=0; j<this->n(); ++j)
1548  {
1549  s.width(w);
1550  s.precision(p);
1551  s << this->el(i,j);
1552  }
1553  s << std::endl;
1554  }
1555 
1556  // reset output format
1557  s.precision(old_precision);
1558  s.width(old_width);
1559 }
1560 
1561 
1562 #endif // DOXYGEN
1563 
1564 DEAL_II_NAMESPACE_CLOSE
1565 
1566 #endif
size_type m() const
number determinant() const
const Accessor & operator*() const
void diagadd(const number s)
bool operator==(const FullMatrix< number > &) const
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1052
void vmult_add(Vector< number2 > &w, const Vector< number2 > &v) 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()
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:1081
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 invert(const FullMatrix< number2 > &M)
void left_invert(const FullMatrix< number2 > &M)
void Tadd(const number s, const FullMatrix< number2 > &B)
void Tvmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void copy_transposed(const MatrixType &)
size_type n_elements() const
void mTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
real_type l1_norm() const
FullMatrix & operator*=(const number factor)
const_iterator & operator++()
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
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
DeclException3(ExcInvalidDestination, size_type, size_type, size_type,<< "Target region not in matrix: size in this direction="<< arg1<< ", size of new matrix="<< arg2<< ", offset="<< arg3)
const FullMatrix< number > * matrix
Definition: full_matrix.h:129
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)
real_type linfty_norm() const
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
Definition: exceptions.h:294
bool operator!=(const const_iterator &) const
DeclException0(ExcEmptyMatrix)
bool operator<(const const_iterator &) const
AlignedVector< T >::reference el(const TableIndices< N > &indices)
void mmult(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_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
number2 matrix_norm_square(const Vector< number2 > &v) const
void add_col(const size_type i, const number s, const size_type j)
number trace() const
std::size_t memory_consumption() const
void forward(Vector< number2 > &dst, const Vector< number2 > &src) const
number value_type
Definition: full_matrix.h:79
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
DeclException1(ExcNotRegular, number,<< "The maximal pivot is "<< arg1<< ", which is below the threshold. The matrix may be singular.")
FullMatrix< number > & operator=(const FullMatrix< number > &)
void reset_values()
void add(const number a, const FullMatrix< number2 > &A)
void TmTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
void precondition_Jacobi(Vector< somenumber > &dst, const Vector< somenumber > &src, const number omega=1.) const
void Tmmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) 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()
AlignedVector< T >::reference operator()(const TableIndices< N > &indices)
AlignedVector< T > values
Definition: table.h:634
void equ(const number a, const FullMatrix< number2 > &A)
#define AssertIsFinite(number)
Definition: exceptions.h:1096
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)
size_type column() const
bool all_zero() const