Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
full_matrix.h
1 // ---------------------------------------------------------------------
2 // @f$Id: full_matrix.h 31917 2013-12-07 16:30:01Z bangerth @f$
3 //
4 // Copyright (C) 1999 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__full_matrix_h
18 #define __deal2__full_matrix_h
19 
20 
21 #include <deal.II/base/config.h>
22 #include <deal.II/base/numbers.h>
23 #include <deal.II/base/table.h>
24 #include <deal.II/lac/exceptions.h>
25 #include <deal.II/lac/identity_matrix.h>
26 #include <deal.II/base/tensor.h>
27 
28 #include <vector>
29 #include <iomanip>
30 #include <cstring>
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 
35 // forward declarations
36 template <typename number> class Vector;
37 template <typename number> class LAPACKFullMatrix;
38 
39 
64 template <typename number>
65 class FullMatrix : public Table<2,number>
66 {
67 public:
74  typedef unsigned int size_type;
75 
80  typedef number value_type;
81 
82 
103 
104 
105  class const_iterator;
106 
110  class Accessor
111  {
112  public:
120  const size_type row,
121  const size_type col);
122 
128  size_type row() const;
129 
135  size_type column() const;
136 
140  number value() const;
141 
142  protected:
147 
152 
156  unsigned short a_col;
157 
158  /*
159  * Make enclosing class a
160  * friend.
161  */
162  friend class const_iterator;
163  };
164 
169  {
170  public:
174  const_iterator(const FullMatrix<number> *matrix,
175  const size_type row,
176  const size_type col);
177 
182 
187 
191  const Accessor &operator* () const;
192 
196  const Accessor *operator-> () const;
197 
204  bool operator == (const const_iterator &) const;
208  bool operator != (const const_iterator &) const;
209 
217  bool operator < (const const_iterator &) const;
218 
224  bool operator > (const const_iterator &) const;
225 
226  private:
232  };
238 
253  explicit FullMatrix (const size_type n = 0);
254 
260  FullMatrix (const size_type rows,
261  const size_type cols);
262 
282  FullMatrix (const FullMatrix &);
283 
290  FullMatrix (const size_type rows,
291  const size_type cols,
292  const number *entries);
293 
306  FullMatrix (const IdentityMatrix &id);
323 
327  template <typename number2>
330 
342  operator = (const number d);
343 
356  operator = (const IdentityMatrix &id);
357 
364  template <typename number2>
367 
368 
377  template <class MATRIX>
378  void copy_from (const MATRIX &);
379 
388  template <class MATRIX>
389  void copy_transposed (const MATRIX &);
390 
404  template <int dim>
405  void
406  copy_from (const Tensor<2,dim> &T,
407  const size_type src_r_i=0,
408  const size_type src_r_j=dim-1,
409  const size_type src_c_i=0,
410  const size_type src_c_j=dim-1,
411  const size_type dst_r=0,
412  const size_type dst_c=0);
413 
427  template <int dim>
428  void
430  const size_type src_r_i=0,
431  const size_type src_r_j=dim-1,
432  const size_type src_c_i=0,
433  const size_type src_c_j=dim-1,
434  const size_type dst_r=0,
435  const size_type dst_c=0) const;
436 
449  template <typename MatrixType, typename index_type>
450  void extract_submatrix_from (const MatrixType &matrix,
451  const std::vector<index_type> &row_index_set,
452  const std::vector<index_type> &column_index_set);
453 
466  template <typename MatrixType, typename index_type>
467  void
468  scatter_matrix_to (const std::vector<index_type> &row_index_set,
469  const std::vector<index_type> &column_index_set,
470  MatrixType &matrix) const;
471 
490  template <typename number2>
491  void fill (const FullMatrix<number2> &src,
492  const size_type dst_offset_i = 0,
493  const size_type dst_offset_j = 0,
494  const size_type src_offset_i = 0,
495  const size_type src_offset_j = 0);
496 
497 
502  template <typename number2>
503  void fill (const number2 *);
504 
523  template <typename number2>
524  void fill_permutation (const FullMatrix<number2> &src,
525  const std::vector<size_type> &p_rows,
526  const std::vector<size_type> &p_cols);
527 
538  void set (const size_type i,
539  const size_type j,
540  const number value);
560  bool operator == (const FullMatrix<number> &) const;
561 
567  size_type m () const;
568 
574  size_type n () const;
575 
586  bool all_zero () const;
587 
615  template <typename number2>
616  number2 matrix_norm_square (const Vector<number2> &v) const;
617 
633  template <typename number2>
634  number2 matrix_scalar_product (const Vector<number2> &u,
635  const Vector<number2> &v) const;
636 
645  real_type l1_norm () const;
646 
654  real_type linfty_norm () const;
655 
668  real_type frobenius_norm () const;
669 
684 
695  number determinant () const;
696 
705  number trace () const;
706 
713  template <class STREAM>
714  void print (STREAM &s,
715  const unsigned int width=5,
716  const unsigned int precision=2) const;
717 
759  void print_formatted (std::ostream &out,
760  const unsigned int precision=3,
761  const bool scientific = true,
762  const unsigned int width = 0,
763  const char *zero_string = " ",
764  const double denominator = 1.,
765  const double threshold = 0.) const;
766 
772  std::size_t memory_consumption () const;
773 
775 
777 
782  const_iterator begin () const;
783 
787  const_iterator end () const;
788 
793  const_iterator begin (const size_type r) const;
794 
798  const_iterator end (const size_type r) const;
799 
801 
803 
808  FullMatrix &operator *= (const number factor);
809 
814  FullMatrix &operator /= (const number factor);
815 
828  template <typename number2>
829  void add (const number a,
830  const FullMatrix<number2> &A);
831 
845  template <typename number2>
846  void add (const number a,
847  const FullMatrix<number2> &A,
848  const number b,
849  const FullMatrix<number2> &B);
850 
864  template <typename number2>
865  void add (const number a,
866  const FullMatrix<number2> &A,
867  const number b,
868  const FullMatrix<number2> &B,
869  const number c,
870  const FullMatrix<number2> &C);
871 
889  template <typename number2>
890  void add (const FullMatrix<number2> &src,
891  const number factor,
892  const size_type dst_offset_i = 0,
893  const size_type dst_offset_j = 0,
894  const size_type src_offset_i = 0,
895  const size_type src_offset_j = 0);
896 
904  template <typename number2>
905  void Tadd (const number s,
906  const FullMatrix<number2> &B);
907 
930  template <typename number2>
931  void Tadd (const FullMatrix<number2> &src,
932  const number factor,
933  const size_type dst_offset_i = 0,
934  const size_type dst_offset_j = 0,
935  const size_type src_offset_i = 0,
936  const size_type src_offset_j = 0);
937 
942  void add (const size_type row,
943  const size_type column,
944  const number value);
945 
962  template <typename number2, typename index_type>
963  void add (const size_type row,
964  const unsigned int n_cols,
965  const index_type *col_indices,
966  const number2 *values,
967  const bool elide_zero_values = true,
968  const bool col_indices_are_sorted = false);
969 
975  void add_row (const size_type i,
976  const number s,
977  const size_type j);
978 
984  void add_row (const size_type i,
985  const number s, const size_type j,
986  const number t, const size_type k);
987 
992  void add_col (const size_type i,
993  const number s,
994  const size_type j);
995 
1001  void add_col (const size_type i,
1002  const number s, const size_type j,
1003  const number t, const size_type k);
1004 
1010  void swap_row (const size_type i,
1011  const size_type j);
1012 
1018  void swap_col (const size_type i,
1019  const size_type j);
1020 
1027  void diagadd (const number s);
1028 
1033  template <typename number2>
1034  void equ (const number a,
1035  const FullMatrix<number2> &A);
1036 
1041  template <typename number2>
1042  void equ (const number a,
1043  const FullMatrix<number2> &A,
1044  const number b,
1045  const FullMatrix<number2> &B);
1046 
1051  template <typename number2>
1052  void equ (const number a,
1053  const FullMatrix<number2> &A,
1054  const number b,
1055  const FullMatrix<number2> &B,
1056  const number c,
1057  const FullMatrix<number2> &C);
1058 
1069  void symmetrize ();
1070 
1094  void gauss_jordan ();
1095 
1106  template <typename number2>
1107  void invert (const FullMatrix<number2> &M);
1108 
1119  template <typename number2>
1120  void cholesky (const FullMatrix<number2> &A);
1121 
1127  template <typename number2>
1128  void outer_product (const Vector<number2> &V,
1129  const Vector<number2> &W);
1130 
1137  template <typename number2>
1138  void left_invert (const FullMatrix<number2> &M);
1139 
1146  template <typename number2>
1147  void right_invert (const FullMatrix<number2> &M);
1148 
1150 
1152 
1179  template <typename number2>
1180  void mmult (FullMatrix<number2> &C,
1181  const FullMatrix<number2> &B,
1182  const bool adding=false) const;
1183 
1211  template <typename number2>
1212  void Tmmult (FullMatrix<number2> &C,
1213  const FullMatrix<number2> &B,
1214  const bool adding=false) const;
1215 
1243  template <typename number2>
1244  void mTmult (FullMatrix<number2> &C,
1245  const FullMatrix<number2> &B,
1246  const bool adding=false) const;
1247 
1276  template <typename number2>
1277  void TmTmult (FullMatrix<number2> &C,
1278  const FullMatrix<number2> &B,
1279  const bool adding=false) const;
1280 
1301  void triple_product(const FullMatrix<number> &A,
1302  const FullMatrix<number> &B,
1303  const FullMatrix<number> &D,
1304  const bool transpose_B = false,
1305  const bool transpose_D = false,
1306  const number scaling = number(1.));
1307 
1325  template <typename number2>
1326  void vmult (Vector<number2> &w,
1327  const Vector<number2> &v,
1328  const bool adding=false) const;
1329 
1337  template <typename number2>
1338  void vmult_add (Vector<number2> &w,
1339  const Vector<number2> &v) const;
1340 
1360  template <typename number2>
1361  void Tvmult (Vector<number2> &w,
1362  const Vector<number2> &v,
1363  const bool adding=false) const;
1364 
1373  template <typename number2>
1374  void Tvmult_add (Vector<number2> &w,
1375  const Vector<number2> &v) const;
1376 
1387  template <typename somenumber>
1389  const Vector<somenumber> &src,
1390  const number omega = 1.) const;
1391 
1401  template <typename number2, typename number3>
1402  number residual (Vector<number2> &dst,
1403  const Vector<number2> &x,
1404  const Vector<number3> &b) const;
1405 
1423  template <typename number2>
1424  void forward (Vector<number2> &dst,
1425  const Vector<number2> &src) const;
1426 
1437  template <typename number2>
1438  void backward (Vector<number2> &dst,
1439  const Vector<number2> &src) const;
1440 
1442 
1449  DeclException0 (ExcEmptyMatrix);
1450 
1454  DeclException1 (ExcNotRegular,
1455  number,
1456  << "The maximal pivot is " << arg1
1457  << ", which is below the threshold. The matrix may be singular.");
1461  DeclException3 (ExcInvalidDestination,
1463  << "Target region not in matrix: size in this direction="
1464  << arg1 << ", size of new matrix=" << arg2
1465  << ", offset=" << arg3);
1469  DeclException0 (ExcSourceEqualsDestination);
1473  DeclException0 (ExcMatrixNotPositiveDefinite);
1475 
1476  friend class Accessor;
1477 };
1478 
1481 #ifndef DOXYGEN
1482 /*-------------------------Inline functions -------------------------------*/
1483 
1484 
1485 
1486 
1487 template <typename number>
1488 inline
1490 FullMatrix<number>::m() const
1491 {
1492  return this->n_rows();
1493 }
1494 
1495 
1496 
1497 template <typename number>
1498 inline
1500 FullMatrix<number>::n() const
1501 {
1502  return this->n_cols();
1503 }
1504 
1505 
1506 
1507 template <typename number>
1509 FullMatrix<number>::operator = (const number d)
1510 {
1511  Assert (d==number(0), ExcScalarAssignmentOnlyForZeroValue());
1512  (void)d; // removes -Wunused-parameter warning in optimized mode
1513 
1514  if (this->n_elements() != 0)
1515  std::memset (&this->values[0], 0, this->n_elements()*sizeof(number));
1516 
1517  return *this;
1518 }
1519 
1520 
1521 
1522 template <typename number>
1523 template <typename number2>
1524 inline
1525 void FullMatrix<number>::fill (const number2 *src)
1526 {
1527  Table<2,number>::fill(src);
1528 }
1529 
1530 
1531 
1532 template <typename number>
1533 template <class MATRIX>
1534 void
1536 {
1537  this->reinit (M.m(), M.n());
1538 
1539  // loop over the elements of the argument matrix row by row, as suggested
1540  // in the documentation of the sparse matrix iterator class, and
1541  // copy them into the current object
1542  for (size_type row = 0; row < M.m(); ++row)
1543  {
1544  const typename MATRIX::const_iterator end_row = M.end(row);
1545  for (typename MATRIX::const_iterator entry = M.begin(row);
1546  entry != end_row; ++entry)
1547  this->el(row, entry->column()) = entry->value();
1548  }
1549 }
1550 
1551 
1552 
1553 template <typename number>
1554 template <class MATRIX>
1555 void
1557 {
1558  this->reinit (M.n(), M.m());
1559 
1560  // loop over the elements of the argument matrix row by row, as suggested
1561  // in the documentation of the sparse matrix iterator class, and
1562  // copy them into the current object
1563  for (size_type row = 0; row < M.m(); ++row)
1564  {
1565  const typename MATRIX::const_iterator end_row = M.end(row);
1566  for (typename MATRIX::const_iterator entry = M.begin(row);
1567  entry != end_row; ++entry)
1568  this->el(entry->column(), row) = entry->value();
1569  }
1570 }
1571 
1572 
1573 
1574 template <typename number>
1575 template <typename MatrixType, typename index_type>
1576 inline
1577 void
1578 FullMatrix<number>::extract_submatrix_from (const MatrixType &matrix,
1579  const std::vector<index_type> &row_index_set,
1580  const std::vector<index_type> &column_index_set)
1581 {
1582  AssertDimension(row_index_set.size(), this->n_rows());
1583  AssertDimension(column_index_set.size(), this->n_cols());
1584 
1585  const size_type n_rows_submatrix = row_index_set.size();
1586  const size_type n_cols_submatrix = column_index_set.size();
1587 
1588  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1589  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1590  (*this)(sub_row, sub_col) = matrix.el(row_index_set[sub_row], column_index_set[sub_col]);
1591 }
1592 
1593 
1594 
1595 template <typename number>
1596 template <typename MatrixType, typename index_type>
1597 inline
1598 void
1599 FullMatrix<number>::scatter_matrix_to (const std::vector<index_type> &row_index_set,
1600  const std::vector<index_type> &column_index_set,
1601  MatrixType &matrix) const
1602 {
1603  AssertDimension(row_index_set.size(), this->n_rows());
1604  AssertDimension(column_index_set.size(), this->n_cols());
1605 
1606  const size_type n_rows_submatrix = row_index_set.size();
1607  const size_type n_cols_submatrix = column_index_set.size();
1608 
1609  for (size_type sub_row = 0; sub_row < n_rows_submatrix; ++sub_row)
1610  for (size_type sub_col = 0; sub_col < n_cols_submatrix; ++sub_col)
1611  matrix.set(row_index_set[sub_row],
1612  column_index_set[sub_col],
1613  (*this)(sub_row, sub_col));
1614 }
1615 
1616 
1617 template <typename number>
1618 inline
1619 void
1621  const size_type j,
1622  const number value)
1623 {
1624  (*this)(i,j) = value;
1625 }
1626 
1627 
1628 
1629 template <typename number>
1630 template <typename number2>
1631 void
1633  const Vector<number2> &v) const
1634 {
1635  vmult(w, v, true);
1636 }
1637 
1638 
1639 template <typename number>
1640 template <typename number2>
1641 void
1643  const Vector<number2> &v) const
1644 {
1645  Tvmult(w, v, true);
1646 }
1647 
1648 
1649 //---------------------------------------------------------------------------
1650 
1651 
1652 template <typename number>
1653 inline
1655 Accessor (const FullMatrix<number> *matrix,
1656  const size_type r,
1657  const size_type c)
1658  :
1659  matrix(matrix),
1660  a_row(r),
1661  a_col(c)
1662 {}
1663 
1664 
1665 template <typename number>
1666 inline
1669 {
1670  return a_row;
1671 }
1672 
1673 
1674 template <typename number>
1675 inline
1678 {
1679  return a_col;
1680 }
1681 
1682 
1683 template <typename number>
1684 inline
1685 number
1687 {
1688  Assert (numbers::is_finite( matrix->el(a_row, a_col) ), ExcNumberNotFinite());
1689  return matrix->el(a_row, a_col);
1690 }
1691 
1692 
1693 template <typename number>
1694 inline
1696 const_iterator(const FullMatrix<number> *matrix,
1697  const size_type r,
1698  const size_type c)
1699  :
1700  accessor(matrix, r, c)
1701 {}
1702 
1703 
1704 template <typename number>
1705 inline
1708 {
1709  Assert (accessor.a_row < accessor.matrix->m(), ExcIteratorPastEnd());
1710 
1711  ++accessor.a_col;
1712  if (accessor.a_col >= accessor.matrix->n())
1713  {
1714  accessor.a_col = 0;
1715  accessor.a_row++;
1716  }
1717  return *this;
1718 }
1719 
1720 
1721 template <typename number>
1722 inline
1723 const typename FullMatrix<number>::Accessor &
1725 {
1726  return accessor;
1727 }
1728 
1729 
1730 template <typename number>
1731 inline
1732 const typename FullMatrix<number>::Accessor *
1734 {
1735  return &accessor;
1736 }
1737 
1738 
1739 template <typename number>
1740 inline
1741 bool
1743 operator == (const const_iterator &other) const
1744 {
1745  return (accessor.row() == other.accessor.row() &&
1746  accessor.column() == other.accessor.column());
1747 }
1748 
1749 
1750 template <typename number>
1751 inline
1752 bool
1754 operator != (const const_iterator &other) const
1755 {
1756  return ! (*this == other);
1757 }
1758 
1759 
1760 template <typename number>
1761 inline
1762 bool
1764 operator < (const const_iterator &other) const
1765 {
1766  return (accessor.row() < other.accessor.row() ||
1767  (accessor.row() == other.accessor.row() &&
1768  accessor.column() < other.accessor.column()));
1769 }
1770 
1771 
1772 template <typename number>
1773 inline
1774 bool
1776 operator > (const const_iterator &other) const
1777 {
1778  return (other < *this);
1779 }
1780 
1781 
1782 template <typename number>
1783 inline
1786 {
1787  return const_iterator(this, 0, 0);
1788 }
1789 
1790 
1791 template <typename number>
1792 inline
1794 FullMatrix<number>::end () const
1795 {
1796  return const_iterator(this, m(), 0);
1797 }
1798 
1799 
1800 template <typename number>
1801 inline
1803 FullMatrix<number>::begin (const size_type r) const
1804 {
1805  Assert (r<m(), ExcIndexRange(r,0,m()));
1806  return const_iterator(this, r, 0);
1807 }
1808 
1809 
1810 
1811 template <typename number>
1812 inline
1814 FullMatrix<number>::end (const size_type r) const
1815 {
1816  Assert (r<m(), ExcIndexRange(r,0,m()));
1817  return const_iterator(this, r+1, 0);
1818 }
1819 
1820 
1821 
1822 template <typename number>
1823 inline
1824 void
1825 FullMatrix<number>::add (const size_type r, const size_type c, const number v)
1826 {
1827  AssertIndexRange(r, this->m());
1828  AssertIndexRange(c, this->n());
1829 
1830  this->operator()(r,c) += v;
1831 }
1832 
1833 
1834 
1835 template <typename number>
1836 template <typename number2, typename index_type>
1837 inline
1838 void
1840  const unsigned int n_cols,
1841  const index_type *col_indices,
1842  const number2 *values,
1843  const bool,
1844  const bool)
1845 {
1846  AssertIndexRange(row, this->m());
1847  for (size_type col=0; col<n_cols; ++col)
1848  {
1849  AssertIndexRange(col_indices[col], this->n());
1850  this->operator()(row,col_indices[col]) += values[col];
1851  }
1852 }
1853 
1854 
1855 template <typename number>
1856 template <class STREAM>
1857 inline
1858 void
1859 FullMatrix<number>::print (STREAM &s,
1860  const unsigned int w,
1861  const unsigned int p) const
1862 {
1863  Assert (!this->empty(), ExcEmptyMatrix());
1864 
1865  // save the state of out stream
1866  const unsigned int old_precision = s.precision (p);
1867  const unsigned int old_width = s.width (w);
1868 
1869  for (size_type i=0; i<this->m(); ++i)
1870  {
1871  for (size_type j=0; j<this->n(); ++j)
1872  {
1873  s.width(w);
1874  s.precision(p);
1875  s << this->el(i,j);
1876  }
1877  s << std::endl;
1878  }
1879 
1880  // reset output format
1881  s.precision(old_precision);
1882  s.width(old_width);
1883 }
1884 
1885 
1886 #endif // DOXYGEN
1887 
1888 DEAL_II_NAMESPACE_CLOSE
1889 
1890 #endif
void vmult_add(Vector< number2 > &w, const Vector< number2 > &v) const
real_type l1_norm() const
size_type column() const
void diagadd(const number s)
FullMatrix< number > & operator=(const FullMatrix< number > &)
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:858
void backward(Vector< number2 > &dst, const Vector< number2 > &src) const
const_iterator(const FullMatrix< number > *matrix, const size_type row, const size_type col)
unsigned int size_type
Definition: full_matrix.h:74
const Accessor & operator*() const
FullMatrix & operator*=(const number factor)
number value() const
bool operator<(const const_iterator &) const
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)
real_type linfty_norm() const
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:888
void copy_transposed(const MATRIX &)
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 invert(const FullMatrix< number2 > &M)
void left_invert(const FullMatrix< number2 > &M)
void Tadd(const number s, const FullMatrix< number2 > &B)
bool operator!=(const const_iterator &) const
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void scatter_matrix_to(const std::vector< index_type > &row_index_set, const std::vector< index_type > &column_index_set, MatrixType &matrix) const
bool is_finite(const double x)
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
real_type relative_symmetry_norm2() 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)
number2 matrix_scalar_product(const Vector< number2 > &u, const Vector< number2 > &v) const
const FullMatrix< number > * matrix
Definition: full_matrix.h:146
std::size_t memory_consumption() const
size_type n() const
numbers::NumberTraits< number >::real_type real_type
Definition: full_matrix.h:102
Accessor(const FullMatrix< number > *matrix, const size_type row, const size_type col)
void swap_row(const size_type i, const size_type j)
number2 matrix_norm_square(const Vector< number2 > &v) const
std::vector< number >::reference operator()(const TableIndices< N > &indices)
#define Assert(cond, exc)
Definition: exceptions.h:299
DeclException0(ExcEmptyMatrix)
real_type frobenius_norm() const
void extract_submatrix_from(const MatrixType &matrix, const std::vector< index_type > &row_index_set, const std::vector< index_type > &column_index_set)
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void Tvmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
unsigned short a_col
Definition: full_matrix.h:156
void print(STREAM &s, const unsigned int width=5, const unsigned int precision=2) 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
const_iterator begin() const
void add_col(const size_type i, const number s, const size_type j)
::ExceptionBase & ExcIteratorPastEnd()
void mTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
FullMatrix & operator/=(const number factor)
number value_type
Definition: full_matrix.h:80
void swap_col(const size_type i, const size_type j)
::ExceptionBase & ExcNumberNotFinite()
const Accessor * operator->() const
DeclException1(ExcNotRegular, number,<< "The maximal pivot is "<< arg1<< ", which is below the threshold. The matrix may be singular.")
void fill(const T2 *entries)
void add(const number a, const FullMatrix< number2 > &A)
void TmTmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
void Tmmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
FullMatrix(const size_type n=0)
std::vector< number >::reference el(const TableIndices< N > &indices)
number determinant() const
bool operator>(const const_iterator &) const
void mmult(FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const
void copy_from(const MATRIX &)
::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
const_iterator end() const
std::vector< number > values
Definition: table.h:726
void equ(const number a, const FullMatrix< number2 > &A)
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)
bool all_zero() const
void precondition_Jacobi(Vector< somenumber > &dst, const Vector< somenumber > &src, const number omega=1.) const
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