# メモ

理工系の数理 線形代数 永井敏隆 永井敦 裳華房

を読む。

# ベクトルの基本演算

```
# ベクトルの基本演算
%%latex
\bm{a} = \begin{pmatrix}
    a_1 \\
    \vdots \\
    a_n
\end{pmatrix}, \quad
\bm{b} = \begin{pmatrix}
    b_1 \\
    \vdots \\
    b_n
\end{pmatrix}
\in \mathrm{R}^n , \quad p \in \mathrm{R} \
に対して、\\
\\
和 \quad \bm{a} + \bm{b} =
\begin{pmatrix}
    a_1 + b_1 \\
    \vdots \\
    a_n + b_n
\end{pmatrix}, \quad
スカラー倍 \quad p\bm{a}=
\begin{pmatrix}
    pa_1\\
    \vdots \\
    pa_n
\end{pmatrix}, \quad \\
\\
内積 \quad (\bm{a}, \  \bm{b}) = a_1 b_1 + \dots + a_n b_n , \quad
大きさ \quad ||\bm{a}|| = \sqrt {a_1^2 +\dots + a_n^2 } \\
\\
(n=3 のとき) \ 外積 \quad \bm{a} \times \bm{b} =
\begin{pmatrix}
    a_2 b_3 - a_3 b_2 \\
    a_3 b_1 - a_1 b_3 \\
    a_1 b_2 - a_2 b_1
\end{pmatrix}
```

\bm{a} = \begin{pmatrix}
    a_1 \\
    \vdots \\
    a_n
\end{pmatrix}, \quad
\bm{b} = \begin{pmatrix}
    b_1 \\
    \vdots \\
    b_n
\end{pmatrix}
\in \mathrm{R}^n , \quad p \in \mathrm{R} \
に対して、\\
\\
和 \quad \bm{a} + \bm{b} =
\begin{pmatrix}
    a_1 + b_1 \\
    \vdots \\
    a_n + b_n
\end{pmatrix}, \quad
スカラー倍 \quad p\bm{a}=
\begin{pmatrix}
    pa_1\\
    \vdots \\
    pa_n
\end{pmatrix}, \quad \\
\\
内積 \quad (\bm{a}, \  \bm{b}) = a_1 b_1 + \dots + a_n b_n , \quad
大きさ \quad ||\bm{a}|| = \sqrt {a_1^2 +\dots + a_n^2 } \\
\\
(n=3 のとき) \ 外積 \quad \bm{a} \times \bm{b} =
\begin{pmatrix}
    a_2 b_3 - a_3 b_2 \\
    a_3 b_1 - a_1 b_3 \\
    a_1 b_2 - a_2 b_1
\end{pmatrix}

```
# ベクトルの基本演算
from sympy import *
a, a_1, a_2, a_3 = symbols ('a, a_1, a_2, a_3')
a = Matrix([a_1, a_2, a_3])
b, b_1, b_2, b_3 = symbols ('b, b_1, b_2, b_3')
b = Matrix([b_1, b_2, b_3])
p = symbols('p')
display (a)
display (b)
display(a+b)
display(p*a)
display(a.dot(b))
display(a.norm())
display(a.cross(b))

```

$\displaystyle \left[\begin{matrix}a_{1}\\a_{2}\\a_{3}\end{matrix}\right]$

$\displaystyle \left[\begin{matrix}b_{1}\\b_{2}\\b_{3}\end{matrix}\right]$

$\displaystyle \left[\begin{matrix}a_{1} + b_{1}\\a_{2} + b_{2}\\a_{3} + b_{3}\end{matrix}\right]$

$\displaystyle \left[\begin{matrix}a_{1} p\\a_{2} p\\a_{3} p\end{matrix}\right]$

$\displaystyle a_{1} b_{1} + a_{2} b_{2} + a_{3} b_{3}$

$\displaystyle \sqrt{\left|{a_{1}}\right|^{2} + \left|{a_{2}}\right|^{2} + \left|{a_{3}}\right|^{2}}$

$\displaystyle \left[\begin{matrix}a_{2} b_{3} - a_{3} b_{2}\\- a_{1} b_{3} + a_{3} b_{1}\\a_{1} b_{2} - a_{2} b_{1}\end{matrix}\right]$

```
# 行列の基本演算
%%latex
\displaystyle
A = (a_{ij}),\quad B= (b_{ij}) \quad (1 \leq i, j \leq n) \ に対して、\\
\\
AB = (a_{ij})(b_{ij}) = (c_{ij}), \quad c_ij=\sum_{k=1}^{n}a_{ik}b_{kj} \\
\\
転置行列 \quad {}^t\!A (a_{ij}) \quad (行と列の入れ替え) \\
\\
A が対称 (反対称) 行列 \quad \overset{定義}{\Longleftrightarrow} \quad {}^t\!A = A \quad (-A)\\
\\
A が直交行列 \quad \overset{定義}{\Longleftrightarrow} \quad {}^t\!AA = E

```

\displaystyle
A = (a_{ij}),\quad B= (b_{ij}) \quad (1 \leq i, j \leq n) \ に対して、\\
\\
AB = (a_{ij})(b_{ij}) = (c_{ij}), \quad c_ij=\sum_{k=1}^{n}a_{ik}b_{kj} \\
\\
転置行列 \quad {}^t\!A (a_{ij}) \quad (行と列の入れ替え) \\
\\
A が対称 (反対称) 行列 \quad \overset{定義}{\Longleftrightarrow} \quad {}^t\!A = A \quad (-A)\\
\\
A が直交行列 \quad \overset{定義}{\Longleftrightarrow} \quad {}^t\!AA = E

```
from sympy import *
a_ij,b_ij,c_ij=symbols('a_ij,b_ij,c_ij')
A,B,i,j = symbols('A,B,i,j')
A= MatrixSymbol('A',3,3)
display(Eq(A, (a_ij)))
display(Eq(B, (b_ij)))
display(1 <= i)
display(j<= n)
display(A*B)
display(Eq(a_ij * b_ij, c_ij))
display(Eq(c_ij, Sum(a_ij * b_ij, (k, 1, n))))
display(A.T*A)
display(Eq(A.T*A, A))
display(Eq(A.T*A, -A))
E = MatrixSymbol('E',3,3)
display(Eq(A.T*A, E))

```

$\displaystyle \text{False}$

$\displaystyle B = b_{ij}$

$\displaystyle i \geq 1$

$\displaystyle j \leq n$

$\displaystyle B A$

$\displaystyle a_{ij} b_{ij} = c_{ij}$

$\displaystyle c_{ij} = \sum_{k=1}^{n} a_{ij} b_{ij}$

$\displaystyle A^{T} A$

$\displaystyle A^{T} A = A$

$\displaystyle A^{T} A = - A$

$\displaystyle A^{T} A = E$

行基本変形

1. ある行と他の行を入れ替える。
1. ある行を何倍かして他の行に加える。
1. ある行を定数 (0 でない) 倍する。

```
# 2,3次行列式
%%latex
\left|
\begin{array}{ccc}
    a_1 & a_2 \\
    b_1 & b_2
\end{array}
\right| = a_1 b_2 - a_2 b_1 \\
\  \\
\left|
\begin{array}{ccc}
    a_1 & a_2 & a_3 \\
    b_1 & b_2 & b_3 \\
    c_1 & c_2 & c_3
\end{array}
\right| = a_1 b_2 c_3 + a_2 b_3 c_1 + a_3 b_1 c_2 - a_1 b_3 c_2 - a_2 b_1 c_3 - a_3 b_2 c_1

```

\left|
\begin{array}{ccc}
    a_1 & a_2 \\
    b_1 & b_2
\end{array}
\right| = a_1 b_2 - a_2 b_1 \\
\  \\
\left|
\begin{array}{ccc}
    a_1 & a_2 & a_3 \\
    b_1 & b_2 & b_3 \\
    c_1 & c_2 & c_3
\end{array}
\right| = a_1 b_2 c_3 + a_2 b_3 c_1 + a_3 b_1 c_2 - a_1 b_3 c_2 - a_2 b_1 c_3 - a_3 b_2 c_1

```
# 2,3次行列式
from sympy import *
a1,a2,a3,b1,b2,b3,c1,c2,c3 = symbols('a1,a2,a3,b1,b2,b3,c1,c2,c3')
A=Matrix([[a1,a2],[b1,b2]])
display(Eq(Determinant(A), det(A)))
B=Matrix([[a1,a2,a3],[b1,b2,b3],[c1,c2,c3]])
display(Eq(Determinant(B), det(B)))
```

$\displaystyle \left|{\left[\begin{matrix}a_{1} & a_{2}\\b_{1} & b_{2}\end{matrix}\right]}\right| = a_{1} b_{2} - a_{2} b_{1}$

$\displaystyle \left|{\left[\begin{matrix}a_{1} & a_{2} & a_{3}\\b_{1} & b_{2} & b_{3}\\c_{1} & c_{2} & c_{3}\end{matrix}\right]}\right| = a_{1} b_{2} c_{3} - a_{1} b_{3} c_{2} - a_{2} b_{1} c_{3} + a_{2} b_{3} c_{1} + a_{3} b_{1} c_{2} - a_{3} b_{2} c_{1}$

```
# 余因子展開 (4次行列式、1行目での余因子展開)
%%latex
\left|
\begin{array}{ccc}
    a_1 & a_2 & a_3 & a_4 \\
    b_1 & b_2 & b_3 & b_4 \\
    c_1 & c_2 & c_3 & c_4 \\
    d_1 & d_2 & d_3 & d_4
\end{array}
\right|
= a_1 \varDelta_{11} + a_2 \varDelta_{12} + a_3 \varDelta_{13} + a_4 \varDelta_{14} \\
\  \\
= a_1
\left|
\begin{array}{ccc}
    b_2 & b_3 & b_4 \\
    c_2 & c_3 & c_4 \\
    d_2 & d_3 & d_4
\end{array}
\right| - a_2
\left|
\begin{array}{ccc}
    b_1 & b_3 & b_4 \\
    c_1 & c_3 & c_4 \\
    d_1 & d_3 & d_4
\end{array}
\right| + a_3
\left|
\begin{array}{ccc}
    b_1 & b_2 & b_4 \\
    c_1 & c_2 & c_4 \\
    d_1 & d_2 & d_4
\end{array}
\right| - a_4
\left|
\begin{array}{ccc}
    b_1 & b_2 & b_3 \\
    c_1 & c_2 & c_3 \\
    d_1 & d_2 & d_3
\end{array}
\right|
```

\left|
\begin{array}{ccc}
    a_1 & a_2 & a_3 & a_4 \\
    b_1 & b_2 & b_3 & b_4 \\
    c_1 & c_2 & c_3 & c_4 \\
    d_1 & d_2 & d_3 & d_4
\end{array}
\right|
= a_1 \varDelta_{11} + a_2 \varDelta_{12} + a_3 \varDelta_{13} + a_4 \varDelta_{14} \\
\  \\
= a_1
\left|
\begin{array}{ccc}
    b_2 & b_3 & b_4 \\
    c_2 & c_3 & c_4 \\
    d_2 & d_3 & d_4
\end{array}
\right| - a_2
\left|
\begin{array}{ccc}
    b_1 & b_3 & b_4 \\
    c_1 & c_3 & c_4 \\
    d_1 & d_3 & d_4
\end{array}
\right| + a_3
\left|
\begin{array}{ccc}
    b_1 & b_2 & b_4 \\
    c_1 & c_2 & c_4 \\
    d_1 & d_2 & d_4
\end{array}
\right| - a_4
\left|
\begin{array}{ccc}
    b_1 & b_2 & b_3 \\
    c_1 & c_2 & c_3 \\
    d_1 & d_2 & d_3
\end{array}
\right|

```
# 余因子展開 cofactor expansion の sympy での対応がわからない
# 余因子展開について学んだあとで再挑戦しよう
import sympy.matrices
# help(sympy.matrices.Matrix.cofactor_matrix)
help(sympy.matrices.Matrix)
```

    Help on class MutableDenseMatrix in module sympy.matrices.dense:

    class MutableDenseMatrix(DenseMatrix, sympy.matrices.matrices.MatrixBase)
     |  MutableDenseMatrix(*args, **kwargs)
     |
     |  Base class for matrix objects.
     |
     |  Method resolution order:
     |      MutableDenseMatrix
     |      DenseMatrix
     |      sympy.matrices.matrices.MatrixBase
     |      sympy.matrices.matrices.MatrixDeprecated
     |      sympy.matrices.matrices.MatrixCalculus
     |      sympy.matrices.matrices.MatrixEigen
     |      sympy.matrices.matrices.MatrixSubspaces
     |      sympy.matrices.matrices.MatrixReductions
     |      sympy.matrices.matrices.MatrixDeterminant
     |      sympy.matrices.common.MatrixCommon
     |      sympy.matrices.common.MatrixArithmetic
     |      sympy.matrices.common.MatrixOperations
     |      sympy.matrices.common.MatrixProperties
     |      sympy.matrices.common.MatrixSpecial
     |      sympy.matrices.common.MatrixShaping
     |      sympy.matrices.common.MatrixRequired
     |      sympy.printing.defaults.Printable
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __setitem__(self, key, value)
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, I, zeros, ones
     |      >>> m = Matrix(((1, 2+I), (3, 4)))
     |      >>> m
     |      Matrix([
     |      [1, 2 + I],
     |      [3,     4]])
     |      >>> m[1, 0] = 9
     |      >>> m
     |      Matrix([
     |      [1, 2 + I],
     |      [9,     4]])
     |      >>> m[1, 0] = [[0, 1]]
     |
     |      To replace row r you assign to position r*m where m
     |      is the number of columns:
     |
     |      >>> M = zeros(4)
     |      >>> m = M.cols
     |      >>> M[3*m] = ones(1, m)*2; M
     |      Matrix([
     |      [0, 0, 0, 0],
     |      [0, 0, 0, 0],
     |      [0, 0, 0, 0],
     |      [2, 2, 2, 2]])
     |
     |      And to replace column c you can assign to position c:
     |
     |      >>> M[2] = ones(m, 1)*4; M
     |      Matrix([
     |      [0, 0, 4, 0],
     |      [0, 0, 4, 0],
     |      [0, 0, 4, 0],
     |      [2, 2, 4, 2]])
     |
     |  as_mutable(self)
     |      Returns a mutable version of this matrix
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import ImmutableMatrix
     |      >>> X = ImmutableMatrix([[1, 2], [3, 4]])
     |      >>> Y = X.as_mutable()
     |      >>> Y[1, 1] = 5 # Can set values in Y
     |      >>> Y
     |      Matrix([
     |      [1, 2],
     |      [3, 5]])
     |
     |  col_op(self, j, f)
     |      In-place operation on col j using two-arg functor whose args are
     |      interpreted as (self[i, j], i).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import eye
     |      >>> M = eye(3)
     |      >>> M.col_op(1, lambda v, i: v + 2*M[i, 0]); M
     |      Matrix([
     |      [1, 2, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |
     |      See Also
     |      ========
     |      col
     |      row_op
     |
     |  col_swap(self, i, j)
     |      Swap the two given columns of the matrix in-place.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix([[1, 0], [1, 0]])
     |      >>> M
     |      Matrix([
     |      [1, 0],
     |      [1, 0]])
     |      >>> M.col_swap(0, 1)
     |      >>> M
     |      Matrix([
     |      [0, 1],
     |      [0, 1]])
     |
     |      See Also
     |      ========
     |
     |      col
     |      row_swap
     |
     |  copyin_list(self, key, value)
     |      Copy in elements from a list.
     |
     |      Parameters
     |      ==========
     |
     |      key : slice
     |          The section of this matrix to replace.
     |      value : iterable
     |          The iterable to copy values from.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import eye
     |      >>> I = eye(3)
     |      >>> I[:2, 0] = [1, 2] # col
     |      >>> I
     |      Matrix([
     |      [1, 0, 0],
     |      [2, 1, 0],
     |      [0, 0, 1]])
     |      >>> I[1, :2] = [[3, 4]]
     |      >>> I
     |      Matrix([
     |      [1, 0, 0],
     |      [3, 4, 0],
     |      [0, 0, 1]])
     |
     |      See Also
     |      ========
     |
     |      copyin_matrix
     |
     |  copyin_matrix(self, key, value)
     |      Copy in values from a matrix into the given bounds.
     |
     |      Parameters
     |      ==========
     |
     |      key : slice
     |          The section of this matrix to replace.
     |      value : Matrix
     |          The matrix to copy values from.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> M = Matrix([[0, 1], [2, 3], [4, 5]])
     |      >>> I = eye(3)
     |      >>> I[:3, :2] = M
     |      >>> I
     |      Matrix([
     |      [0, 1, 0],
     |      [2, 3, 0],
     |      [4, 5, 1]])
     |      >>> I[0, 1] = M
     |      >>> I
     |      Matrix([
     |      [0, 0, 1],
     |      [2, 2, 3],
     |      [4, 4, 5]])
     |
     |      See Also
     |      ========
     |
     |      copyin_list
     |
     |  fill(self, value)
     |      Fill the matrix with the scalar value.
     |
     |      See Also
     |      ========
     |
     |      zeros
     |      ones
     |
     |  row_op(self, i, f)
     |      In-place operation on row ``i`` using two-arg functor whose args are
     |      interpreted as ``(self[i, j], j)``.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import eye
     |      >>> M = eye(3)
     |      >>> M.row_op(1, lambda v, j: v + 2*M[0, j]); M
     |      Matrix([
     |      [1, 0, 0],
     |      [2, 1, 0],
     |      [0, 0, 1]])
     |
     |      See Also
     |      ========
     |      row
     |      zip_row_op
     |      col_op
     |
     |  row_swap(self, i, j)
     |      Swap the two given rows of the matrix in-place.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix([[0, 1], [1, 0]])
     |      >>> M
     |      Matrix([
     |      [0, 1],
     |      [1, 0]])
     |      >>> M.row_swap(0, 1)
     |      >>> M
     |      Matrix([
     |      [1, 0],
     |      [0, 1]])
     |
     |      See Also
     |      ========
     |
     |      row
     |      col_swap
     |
     |  simplify(self, **kwargs)
     |      Applies simplify to the elements of a matrix in place.
     |
     |      This is a shortcut for M.applyfunc(lambda x: simplify(x, ratio, measure))
     |
     |      See Also
     |      ========
     |
     |      sympy.simplify.simplify.simplify
     |
     |  zip_row_op(self, i, k, f)
     |      In-place operation on row ``i`` using two-arg functor whose args are
     |      interpreted as ``(self[i, j], self[k, j])``.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import eye
     |      >>> M = eye(3)
     |      >>> M.zip_row_op(1, 0, lambda v, u: v + 2*u); M
     |      Matrix([
     |      [1, 0, 0],
     |      [2, 1, 0],
     |      [0, 0, 1]])
     |
     |      See Also
     |      ========
     |      row
     |      row_op
     |      col_op
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  __new__(cls, *args, **kwargs)
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __hash__ = None
     |
     |  is_zero = False
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from DenseMatrix:
     |
     |  LDLdecomposition(self, hermitian=True)
     |      Returns the LDL Decomposition (L, D) of matrix A,
     |      such that L * D * L.H == A if hermitian flag is True, or
     |      L * D * L.T == A if hermitian is False.
     |      This method eliminates the use of square root.
     |      Further this ensures that all the diagonal entries of L are 1.
     |      A must be a Hermitian positive-definite matrix if hermitian is True,
     |      or a symmetric matrix otherwise.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> A = Matrix(((25, 15, -5), (15, 18, 0), (-5, 0, 11)))
     |      >>> L, D = A.LDLdecomposition()
     |      >>> L
     |      Matrix([
     |      [   1,   0, 0],
     |      [ 3/5,   1, 0],
     |      [-1/5, 1/3, 1]])
     |      >>> D
     |      Matrix([
     |      [25, 0, 0],
     |      [ 0, 9, 0],
     |      [ 0, 0, 9]])
     |      >>> L * D * L.T * A.inv() == eye(A.rows)
     |      True
     |
     |      The matrix can have complex entries:
     |
     |      >>> from sympy import I
     |      >>> A = Matrix(((9, 3*I), (-3*I, 5)))
     |      >>> L, D = A.LDLdecomposition()
     |      >>> L
     |      Matrix([
     |      [   1, 0],
     |      [-I/3, 1]])
     |      >>> D
     |      Matrix([
     |      [9, 0],
     |      [0, 4]])
     |      >>> L*D*L.H == A
     |      True
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.cholesky
     |      LUdecomposition
     |      QRdecomposition
     |
     |  __eq__(self, other)
     |      Return self==value.
     |
     |  __getitem__(self, key)
     |      Return portion of self defined by key. If the key involves a slice
     |      then a list will be returned (if key is a single slice) or a matrix
     |      (if key was a tuple involving a slice).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, I
     |      >>> m = Matrix([
     |      ... [1, 2 + I],
     |      ... [3, 4    ]])
     |
     |      If the key is a tuple that doesn't involve a slice then that element
     |      is returned:
     |
     |      >>> m[1, 0]
     |      3
     |
     |      When a tuple key involves a slice, a matrix is returned. Here, the
     |      first column is selected (all rows, column 0):
     |
     |      >>> m[:, 0]
     |      Matrix([
     |      [1],
     |      [3]])
     |
     |      If the slice is not a tuple then it selects from the underlying
     |      list of elements that are arranged in row order and a list is
     |      returned if a slice is involved:
     |
     |      >>> m[0]
     |      1
     |      >>> m[::2]
     |      [1, 3]
     |
     |  as_immutable(self)
     |      Returns an Immutable version of this Matrix
     |
     |  cholesky(self, hermitian=True)
     |      Returns the Cholesky-type decomposition L of a matrix A
     |      such that L * L.H == A if hermitian flag is True,
     |      or L * L.T == A if hermitian is False.
     |
     |      A must be a Hermitian positive-definite matrix if hermitian is True,
     |      or a symmetric matrix if it is False.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> A = Matrix(((25, 15, -5), (15, 18, 0), (-5, 0, 11)))
     |      >>> A.cholesky()
     |      Matrix([
     |      [ 5, 0, 0],
     |      [ 3, 3, 0],
     |      [-1, 1, 3]])
     |      >>> A.cholesky() * A.cholesky().T
     |      Matrix([
     |      [25, 15, -5],
     |      [15, 18,  0],
     |      [-5,  0, 11]])
     |
     |      The matrix can have complex entries:
     |
     |      >>> from sympy import I
     |      >>> A = Matrix(((9, 3*I), (-3*I, 5)))
     |      >>> A.cholesky()
     |      Matrix([
     |      [ 3, 0],
     |      [-I, 2]])
     |      >>> A.cholesky() * A.cholesky().H
     |      Matrix([
     |      [   9, 3*I],
     |      [-3*I,   5]])
     |
     |      Non-hermitian Cholesky-type decomposition may be useful when the
     |      matrix is not positive-definite.
     |
     |      >>> A = Matrix([[1, 2], [2, 1]])
     |      >>> L = A.cholesky(hermitian=False)
     |      >>> L
     |      Matrix([
     |      [1,         0],
     |      [2, sqrt(3)*I]])
     |      >>> L*L.T == A
     |      True
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.LDLdecomposition
     |      LUdecomposition
     |      QRdecomposition
     |
     |  equals(self, other, failing_expression=False)
     |      Applies ``equals`` to corresponding elements of the matrices,
     |      trying to prove that the elements are equivalent, returning True
     |      if they are, False if any pair is not, and None (or the first
     |      failing expression if failing_expression is True) if it cannot
     |      be decided if the expressions are equivalent or not. This is, in
     |      general, an expensive operation.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> from sympy.abc import x
     |      >>> A = Matrix([x*(x - 1), 0])
     |      >>> B = Matrix([x**2 - x, 0])
     |      >>> A == B
     |      False
     |      >>> A.simplify() == B.simplify()
     |      True
     |      >>> A.equals(B)
     |      True
     |      >>> A.equals(2)
     |      False
     |
     |      See Also
     |      ========
     |      sympy.core.expr.Expr.equals
     |
     |  lower_triangular_solve(self, rhs)
     |      Solves ``Ax = B``, where A is a lower triangular matrix.
     |
     |      See Also
     |      ========
     |
     |      upper_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LDLsolve
     |      LUsolve
     |      QRsolve
     |      pinv_solve
     |
     |  upper_triangular_solve(self, rhs)
     |      Solves ``Ax = B``, where A is an upper triangular matrix.
     |
     |      See Also
     |      ========
     |
     |      lower_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LDLsolve
     |      LUsolve
     |      QRsolve
     |      pinv_solve
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from DenseMatrix:
     |
     |  is_MatrixExpr = False
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixBase:
     |
     |  LDLsolve(self, rhs)
     |      Solves ``Ax = B`` using LDL decomposition,
     |      for a general square and non-singular matrix.
     |
     |      For a non-square matrix with rows > cols,
     |      the least squares solution is returned.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> A = eye(2)*2
     |      >>> B = Matrix([[1, 2], [3, 4]])
     |      >>> A.LDLsolve(B) == B/2
     |      True
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.LDLdecomposition
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LUsolve
     |      QRsolve
     |      pinv_solve
     |
     |  LUdecomposition(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, simpfunc=None, rankcheck=False)
     |      Returns (L, U, perm) where L is a lower triangular matrix with unit
     |      diagonal, U is an upper triangular matrix, and perm is a list of row
     |      swap index pairs. If A is the original matrix, then
     |      A = (L*U).permuteBkwd(perm), and the row permutation matrix P such
     |      that P*A = L*U can be computed by P=eye(A.row).permuteFwd(perm).
     |
     |      See documentation for LUCombined for details about the keyword argument
     |      rankcheck, iszerofunc, and simpfunc.
     |
     |      Parameters
     |      ==========
     |
     |      rankcheck : bool, optional
     |          Determines if this function should detect the rank
     |          deficiency of the matrixis and should raise a
     |          ``ValueError``.
     |
     |      iszerofunc : function, optional
     |          A function which determines if a given expression is zero.
     |
     |          The function should be a callable that takes a single
     |          sympy expression and returns a 3-valued boolean value
     |          ``True``, ``False``, or ``None``.
     |
     |          It is internally used by the pivot searching algorithm.
     |          See the notes section for a more information about the
     |          pivot searching algorithm.
     |
     |      simpfunc : function or None, optional
     |          A function that simplifies the input.
     |
     |          If this is specified as a function, this function should be
     |          a callable that takes a single sympy expression and returns
     |          an another sympy expression that is algebraically
     |          equivalent.
     |
     |          If ``None``, it indicates that the pivot search algorithm
     |          should not attempt to simplify any candidate pivots.
     |
     |          It is internally used by the pivot searching algorithm.
     |          See the notes section for a more information about the
     |          pivot searching algorithm.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> a = Matrix([[4, 3], [6, 3]])
     |      >>> L, U, _ = a.LUdecomposition()
     |      >>> L
     |      Matrix([
     |      [  1, 0],
     |      [3/2, 1]])
     |      >>> U
     |      Matrix([
     |      [4,    3],
     |      [0, -3/2]])
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.cholesky
     |      sympy.matrices.dense.DenseMatrix.LDLdecomposition
     |      QRdecomposition
     |      LUdecomposition_Simple
     |      LUdecompositionFF
     |      LUsolve
     |
     |  LUdecompositionFF(self)
     |      Compute a fraction-free LU decomposition.
     |
     |      Returns 4 matrices P, L, D, U such that PA = L D**-1 U.
     |      If the elements of the matrix belong to some integral domain I, then all
     |      elements of L, D and U are guaranteed to belong to I.
     |
     |      See Also
     |      ========
     |
     |      LUdecomposition
     |      LUdecomposition_Simple
     |      LUsolve
     |
     |      References
     |      ==========
     |
     |      .. [1] W. Zhou & D.J. Jeffrey, "Fraction-free matrix factors: new forms
     |          for LU and QR factors". Frontiers in Computer Science in China,
     |          Vol 2, no. 1, pp. 67-80, 2008.
     |
     |  LUdecomposition_Simple(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, simpfunc=None, rankcheck=False)
     |      Compute the PLU decomposition of the matrix.
     |
     |      Parameters
     |      ==========
     |
     |      rankcheck : bool, optional
     |          Determines if this function should detect the rank
     |          deficiency of the matrixis and should raise a
     |          ``ValueError``.
     |
     |      iszerofunc : function, optional
     |          A function which determines if a given expression is zero.
     |
     |          The function should be a callable that takes a single
     |          sympy expression and returns a 3-valued boolean value
     |          ``True``, ``False``, or ``None``.
     |
     |          It is internally used by the pivot searching algorithm.
     |          See the notes section for a more information about the
     |          pivot searching algorithm.
     |
     |      simpfunc : function or None, optional
     |          A function that simplifies the input.
     |
     |          If this is specified as a function, this function should be
     |          a callable that takes a single sympy expression and returns
     |          an another sympy expression that is algebraically
     |          equivalent.
     |
     |          If ``None``, it indicates that the pivot search algorithm
     |          should not attempt to simplify any candidate pivots.
     |
     |          It is internally used by the pivot searching algorithm.
     |          See the notes section for a more information about the
     |          pivot searching algorithm.
     |
     |      Returns
     |      =======
     |
     |      (lu, row_swaps) : (Matrix, list)
     |          If the original matrix is a $m, n$ matrix:
     |
     |          *lu* is a $m, n$ matrix, which contains result of the
     |          decomposition in a compresed form. See the notes section
     |          to see how the matrix is compressed.
     |
     |          *row_swaps* is a $m$-element list where each element is a
     |          pair of row exchange indices.
     |
     |          ``A = (L*U).permute_backward(perm)``, and the row
     |          permutation matrix $P$ from the formula $P A = L U$ can be
     |          computed by ``P=eye(A.row).permute_forward(perm)``.
     |
     |      Raises
     |      ======
     |
     |      ValueError
     |          Raised if ``rankcheck=True`` and the matrix is found to
     |          be rank deficient during the computation.
     |
     |      Notes
     |      =====
     |
     |      About the PLU decomposition:
     |
     |      PLU decomposition is a generalization of a LU decomposition
     |      which can be extended for rank-deficient matrices.
     |
     |      It can further be generalized for non-square matrices, and this
     |      is the notation that SymPy is using.
     |
     |      PLU decomposition is a decomposition of a $m, n$ matrix $A$ in
     |      the form of $P A = L U$ where
     |
     |      * $L$ is a $m, m$ lower triangular matrix with unit diagonal
     |          entries.
     |      * $U$ is a $m, n$ upper triangular matrix.
     |      * $P$ is a $m, m$ permutation matrix.
     |
     |      So, for a square matrix, the decomposition would look like:
     |
     |      .. math::
     |          L = \begin{bmatrix}
     |          1 & 0 & 0 & \cdots & 0 \\
     |          L_{1, 0} & 1 & 0 & \cdots & 0 \\
     |          L_{2, 0} & L_{2, 1} & 1 & \cdots & 0 \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          L_{n-1, 0} & L_{n-1, 1} & L_{n-1, 2} & \cdots & 1
     |          \end{bmatrix}
     |
     |      .. math::
     |          U = \begin{bmatrix}
     |          U_{0, 0} & U_{0, 1} & U_{0, 2} & \cdots & U_{0, n-1} \\
     |          0 & U_{1, 1} & U_{1, 2} & \cdots & U_{1, n-1} \\
     |          0 & 0 & U_{2, 2} & \cdots & U_{2, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          0 & 0 & 0 & \cdots & U_{n-1, n-1}
     |          \end{bmatrix}
     |
     |      And for a matrix with more rows than the columns,
     |      the decomposition would look like:
     |
     |      .. math::
     |          L = \begin{bmatrix}
     |          1 & 0 & 0 & \cdots & 0 & 0 & \cdots & 0 \\
     |          L_{1, 0} & 1 & 0 & \cdots & 0 & 0 & \cdots & 0 \\
     |          L_{2, 0} & L_{2, 1} & 1 & \cdots & 0 & 0 & \cdots & 0 \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \ddots
     |          & \vdots \\
     |          L_{n-1, 0} & L_{n-1, 1} & L_{n-1, 2} & \cdots & 1 & 0
     |          & \cdots & 0 \\
     |          L_{n, 0} & L_{n, 1} & L_{n, 2} & \cdots & L_{n, n-1} & 1
     |          & \cdots & 0 \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots & \vdots
     |          & \ddots & \vdots \\
     |          L_{m-1, 0} & L_{m-1, 1} & L_{m-1, 2} & \cdots & L_{m-1, n-1}
     |          & 0 & \cdots & 1 \\
     |          \end{bmatrix}
     |
     |      .. math::
     |          U = \begin{bmatrix}
     |          U_{0, 0} & U_{0, 1} & U_{0, 2} & \cdots & U_{0, n-1} \\
     |          0 & U_{1, 1} & U_{1, 2} & \cdots & U_{1, n-1} \\
     |          0 & 0 & U_{2, 2} & \cdots & U_{2, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          0 & 0 & 0 & \cdots & U_{n-1, n-1} \\
     |          0 & 0 & 0 & \cdots & 0 \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          0 & 0 & 0 & \cdots & 0
     |          \end{bmatrix}
     |
     |      Finally, for a matrix with more columns than the rows, the
     |      decomposition would look like:
     |
     |      .. math::
     |          L = \begin{bmatrix}
     |          1 & 0 & 0 & \cdots & 0 \\
     |          L_{1, 0} & 1 & 0 & \cdots & 0 \\
     |          L_{2, 0} & L_{2, 1} & 1 & \cdots & 0 \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          L_{m-1, 0} & L_{m-1, 1} & L_{m-1, 2} & \cdots & 1
     |          \end{bmatrix}
     |
     |      .. math::
     |          U = \begin{bmatrix}
     |          U_{0, 0} & U_{0, 1} & U_{0, 2} & \cdots & U_{0, m-1}
     |          & \cdots & U_{0, n-1} \\
     |          0 & U_{1, 1} & U_{1, 2} & \cdots & U_{1, m-1}
     |          & \cdots & U_{1, n-1} \\
     |          0 & 0 & U_{2, 2} & \cdots & U_{2, m-1}
     |          & \cdots & U_{2, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots
     |          & \cdots & \vdots \\
     |          0 & 0 & 0 & \cdots & U_{m-1, m-1}
     |          & \cdots & U_{m-1, n-1} \\
     |          \end{bmatrix}
     |
     |      About the compressed LU storage:
     |
     |      The results of the decomposition are often stored in compressed
     |      forms rather than returning $L$ and $U$ matrices individually.
     |
     |      It may be less intiuitive, but it is commonly used for a lot of
     |      numeric libraries because of the efficiency.
     |
     |      The storage matrix is defined as following for this specific
     |      method:
     |
     |      * The subdiagonal elements of $L$ are stored in the subdiagonal
     |          portion of $LU$, that is $LU_{i, j} = L_{i, j}$ whenever
     |          $i > j$.
     |      * The elements on the diagonal of $L$ are all 1, and are not
     |          explicitly stored.
     |      * $U$ is stored in the upper triangular portion of $LU$, that is
     |          $LU_{i, j} = U_{i, j}$ whenever $i <= j$.
     |      * For a case of $m > n$, the right side of the $L$ matrix is
     |          trivial to store.
     |      * For a case of $m < n$, the below side of the $U$ matrix is
     |          trivial to store.
     |
     |      So, for a square matrix, the compressed output matrix would be:
     |
     |      .. math::
     |          LU = \begin{bmatrix}
     |          U_{0, 0} & U_{0, 1} & U_{0, 2} & \cdots & U_{0, n-1} \\
     |          L_{1, 0} & U_{1, 1} & U_{1, 2} & \cdots & U_{1, n-1} \\
     |          L_{2, 0} & L_{2, 1} & U_{2, 2} & \cdots & U_{2, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          L_{n-1, 0} & L_{n-1, 1} & L_{n-1, 2} & \cdots & U_{n-1, n-1}
     |          \end{bmatrix}
     |
     |      For a matrix with more rows than the columns, the compressed
     |      output matrix would be:
     |
     |      .. math::
     |          LU = \begin{bmatrix}
     |          U_{0, 0} & U_{0, 1} & U_{0, 2} & \cdots & U_{0, n-1} \\
     |          L_{1, 0} & U_{1, 1} & U_{1, 2} & \cdots & U_{1, n-1} \\
     |          L_{2, 0} & L_{2, 1} & U_{2, 2} & \cdots & U_{2, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          L_{n-1, 0} & L_{n-1, 1} & L_{n-1, 2} & \cdots
     |          & U_{n-1, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots \\
     |          L_{m-1, 0} & L_{m-1, 1} & L_{m-1, 2} & \cdots
     |          & L_{m-1, n-1} \\
     |          \end{bmatrix}
     |
     |      For a matrix with more columns than the rows, the compressed
     |      output matrix would be:
     |
     |      .. math::
     |          LU = \begin{bmatrix}
     |          U_{0, 0} & U_{0, 1} & U_{0, 2} & \cdots & U_{0, m-1}
     |          & \cdots & U_{0, n-1} \\
     |          L_{1, 0} & U_{1, 1} & U_{1, 2} & \cdots & U_{1, m-1}
     |          & \cdots & U_{1, n-1} \\
     |          L_{2, 0} & L_{2, 1} & U_{2, 2} & \cdots & U_{2, m-1}
     |          & \cdots & U_{2, n-1} \\
     |          \vdots & \vdots & \vdots & \ddots & \vdots
     |          & \cdots & \vdots \\
     |          L_{m-1, 0} & L_{m-1, 1} & L_{m-1, 2} & \cdots & U_{m-1, m-1}
     |          & \cdots & U_{m-1, n-1} \\
     |          \end{bmatrix}
     |
     |      About the pivot searching algorithm:
     |
     |      When a matrix contains symbolic entries, the pivot search algorithm
     |      differs from the case where every entry can be categorized as zero or
     |      nonzero.
     |      The algorithm searches column by column through the submatrix whose
     |      top left entry coincides with the pivot position.
     |      If it exists, the pivot is the first entry in the current search
     |      column that iszerofunc guarantees is nonzero.
     |      If no such candidate exists, then each candidate pivot is simplified
     |      if simpfunc is not None.
     |      The search is repeated, with the difference that a candidate may be
     |      the pivot if ``iszerofunc()`` cannot guarantee that it is nonzero.
     |      In the second search the pivot is the first candidate that
     |      iszerofunc can guarantee is nonzero.
     |      If no such candidate exists, then the pivot is the first candidate
     |      for which iszerofunc returns None.
     |      If no such candidate exists, then the search is repeated in the next
     |      column to the right.
     |      The pivot search algorithm differs from the one in ``rref()``, which
     |      relies on ``_find_reasonable_pivot()``.
     |      Future versions of ``LUdecomposition_simple()`` may use
     |      ``_find_reasonable_pivot()``.
     |
     |      See Also
     |      ========
     |
     |      LUdecomposition
     |      LUdecompositionFF
     |      LUsolve
     |
     |  LUsolve(self, rhs, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Solve the linear system ``Ax = rhs`` for ``x`` where ``A = M``.
     |
     |      This is for symbolic matrices, for real or complex ones use
     |      mpmath.lu_solve or mpmath.qr_solve.
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LDLsolve
     |      QRsolve
     |      pinv_solve
     |      LUdecomposition
     |
     |  QRdecomposition(self)
     |      Returns a QR decomposition.
     |
     |      Explanation
     |      ===========
     |
     |      A QR decomposition is a decomposition in the form $A = Q R$
     |      where
     |
     |      - $Q$ is a column orthogonal matrix.
     |      - $R$ is a upper triangular (trapezoidal) matrix.
     |
     |      A column orthogonal matrix satisfies
     |      $\mathbb{I} = Q^H Q$ while a full orthogonal matrix satisfies
     |      relation $\mathbb{I} = Q Q^H = Q^H Q$ where $I$ is an identity
     |      matrix with matching dimensions.
     |
     |      For matrices which are not square or are rank-deficient, it is
     |      sufficient to return a column orthogonal matrix because augmenting
     |      them may introduce redundant computations.
     |      And an another advantage of this is that you can easily inspect the
     |      matrix rank by counting the number of columns of $Q$.
     |
     |      If you want to augment the results to return a full orthogonal
     |      decomposition, you should use the following procedures.
     |
     |      - Augment the $Q$ matrix with columns that are orthogonal to every
     |        other columns and make it square.
     |      - Augument the $R$ matrix with zero rows to make it have the same
     |        shape as the original matrix.
     |
     |      The procedure will be illustrated in the examples section.
     |
     |      Examples
     |      ========
     |
     |      A full rank matrix example:
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix([[12, -51, 4], [6, 167, -68], [-4, 24, -41]])
     |      >>> Q, R = A.QRdecomposition()
     |      >>> Q
     |      Matrix([
     |      [ 6/7, -69/175, -58/175],
     |      [ 3/7, 158/175,   6/175],
     |      [-2/7,    6/35,  -33/35]])
     |      >>> R
     |      Matrix([
     |      [14,  21, -14],
     |      [ 0, 175, -70],
     |      [ 0,   0,  35]])
     |
     |      If the matrix is square and full rank, the $Q$ matrix becomes
     |      orthogonal in both directions, and needs no augmentation.
     |
     |      >>> Q * Q.H
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |      >>> Q.H * Q
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |
     |      >>> A == Q*R
     |      True
     |
     |      A rank deficient matrix example:
     |
     |      >>> A = Matrix([[12, -51, 0], [6, 167, 0], [-4, 24, 0]])
     |      >>> Q, R = A.QRdecomposition()
     |      >>> Q
     |      Matrix([
     |      [ 6/7, -69/175],
     |      [ 3/7, 158/175],
     |      [-2/7,    6/35]])
     |      >>> R
     |      Matrix([
     |      [14,  21, 0],
     |      [ 0, 175, 0]])
     |
     |      QRdecomposition might return a matrix Q that is rectangular.
     |      In this case the orthogonality condition might be satisfied as
     |      $\mathbb{I} = Q.H*Q$ but not in the reversed product
     |      $\mathbb{I} = Q * Q.H$.
     |
     |      >>> Q.H * Q
     |      Matrix([
     |      [1, 0],
     |      [0, 1]])
     |      >>> Q * Q.H
     |      Matrix([
     |      [27261/30625,   348/30625, -1914/6125],
     |      [  348/30625, 30589/30625,   198/6125],
     |      [ -1914/6125,    198/6125,   136/1225]])
     |
     |      If you want to augment the results to be a full orthogonal
     |      decomposition, you should augment $Q$ with an another orthogonal
     |      column.
     |
     |      You are able to append an arbitrary standard basis that are linearly
     |      independent to every other columns and you can run the Gram-Schmidt
     |      process to make them augmented as orthogonal basis.
     |
     |      >>> Q_aug = Q.row_join(Matrix([0, 0, 1]))
     |      >>> Q_aug = Q_aug.QRdecomposition()[0]
     |      >>> Q_aug
     |      Matrix([
     |      [ 6/7, -69/175, 58/175],
     |      [ 3/7, 158/175, -6/175],
     |      [-2/7,    6/35,  33/35]])
     |      >>> Q_aug.H * Q_aug
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |      >>> Q_aug * Q_aug.H
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |
     |      Augmenting the $R$ matrix with zero row is straightforward.
     |
     |      >>> R_aug = R.col_join(Matrix([[0, 0, 0]]))
     |      >>> R_aug
     |      Matrix([
     |      [14,  21, 0],
     |      [ 0, 175, 0],
     |      [ 0,   0, 0]])
     |      >>> Q_aug * R_aug == A
     |      True
     |
     |      A zero matrix example:
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix.zeros(3, 4)
     |      >>> Q, R = A.QRdecomposition()
     |
     |      They may return matrices with zero rows and columns.
     |
     |      >>> Q
     |      Matrix(3, 0, [])
     |      >>> R
     |      Matrix(0, 4, [])
     |      >>> Q*R
     |      Matrix([
     |      [0, 0, 0, 0],
     |      [0, 0, 0, 0],
     |      [0, 0, 0, 0]])
     |
     |      As the same augmentation rule described above, $Q$ can be augmented
     |      with columns of an identity matrix and $R$ can be augmented with
     |      rows of a zero matrix.
     |
     |      >>> Q_aug = Q.row_join(Matrix.eye(3))
     |      >>> R_aug = R.col_join(Matrix.zeros(3, 4))
     |      >>> Q_aug * Q_aug.T
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |      >>> R_aug
     |      Matrix([
     |      [0, 0, 0, 0],
     |      [0, 0, 0, 0],
     |      [0, 0, 0, 0]])
     |      >>> Q_aug * R_aug == A
     |      True
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.cholesky
     |      sympy.matrices.dense.DenseMatrix.LDLdecomposition
     |      LUdecomposition
     |      QRsolve
     |
     |  QRsolve(self, b)
     |      Solve the linear system ``Ax = b``.
     |
     |      ``M`` is the matrix ``A``, the method argument is the vector
     |      ``b``.  The method returns the solution vector ``x``.  If ``b`` is a
     |      matrix, the system is solved for each column of ``b`` and the
     |      return value is a matrix of the same shape as ``b``.
     |
     |      This method is slower (approximately by a factor of 2) but
     |      more stable for floating-point arithmetic than the LUsolve method.
     |      However, LUsolve usually uses an exact arithmetic, so you don't need
     |      to use QRsolve.
     |
     |      This is mainly for educational purposes and symbolic matrices, for real
     |      (or complex) matrices use mpmath.qr_solve.
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LDLsolve
     |      LUsolve
     |      pinv_solve
     |      QRdecomposition
     |
     |  __array__(self, dtype=<class 'object'>)
     |
     |  __len__(self)
     |      Return the number of elements of ``self``.
     |
     |      Implemented mainly so bool(Matrix()) == False.
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  add(self, b)
     |      Return self + b
     |
     |  analytic_func(self, f, x)
     |      Computes f(A) where A is a Square Matrix
     |      and f is an analytic function.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Symbol, Matrix, S, log
     |
     |      >>> x = Symbol('x')
     |      >>> m = Matrix([[S(5)/4, S(3)/4], [S(3)/4, S(5)/4]])
     |      >>> f = log(x)
     |      >>> m.analytic_func(f, x)
     |      Matrix([
     |      [     0, log(2)],
     |      [log(2),      0]])
     |
     |      Parameters
     |      ==========
     |
     |      f : Expr
     |          Analytic Function
     |      x : Symbol
     |          parameter of f
     |
     |  cholesky_solve(self, rhs)
     |      Solves ``Ax = B`` using Cholesky decomposition,
     |      for a general square non-singular matrix.
     |      For a non-square matrix with rows > cols,
     |      the least squares solution is returned.
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      gauss_jordan_solve
     |      diagonal_solve
     |      LDLsolve
     |      LUsolve
     |      QRsolve
     |      pinv_solve
     |
     |  condition_number(self)
     |      Returns the condition number of a matrix.
     |
     |      This is the maximum singular value divided by the minimum singular value
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, S
     |      >>> A = Matrix([[1, 0, 0], [0, 10, 0], [0, 0, S.One/10]])
     |      >>> A.condition_number()
     |      100
     |
     |      See Also
     |      ========
     |
     |      singular_values
     |
     |  connected_components(self)
     |      Returns the list of connected vertices of the graph when
     |      a square matrix is viewed as a weighted graph.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import symbols, Matrix
     |      >>> a, b, c, d, e, f, g, h = symbols('a:h')
     |      >>> A = Matrix([
     |      ...     [a, 0, b, 0],
     |      ...     [0, e, 0, f],
     |      ...     [c, 0, d, 0],
     |      ...     [0, g, 0, h]])
     |      >>> A.connected_components()
     |      [[0, 2], [1, 3]]
     |
     |      Notes
     |      =====
     |
     |      Even if any symbolic elements of the matrix can be indeterminate
     |      to be zero mathematically, this only takes the account of the
     |      structural aspect of the matrix, so they will considered to be
     |      nonzero.
     |
     |  connected_components_decomposition(self)
     |      Decomposes a square matrix into block diagonal form only
     |      using the permutations.
     |
     |      Explanation
     |      ===========
     |
     |      The decomposition is in a form of $A = P B P^{-1}$ where $P$ is a
     |      permutation matrix and $B$ is a block diagonal matrix.
     |
     |      Returns
     |      =======
     |
     |      P, B : PermutationMatrix, BlockDiagMatrix
     |          *P* is a permutation matrix for the similarity transform
     |          as in the explanation. And *B* is the block diagonal matrix of
     |          the result of the permutation.
     |
     |          If you would like to get the diagonal blocks from the
     |          BlockDiagMatrix, see
     |          :meth:`~sympy.matrices.expressions.blockmatrix.BlockDiagMatrix.get_diag_blocks`.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import symbols, Matrix
     |      >>> a, b, c, d, e, f, g, h = symbols('a:h')
     |      >>> A = Matrix([
     |      ...     [a, 0, b, 0],
     |      ...     [0, e, 0, f],
     |      ...     [c, 0, d, 0],
     |      ...     [0, g, 0, h]])
     |
     |      >>> P, B = A.connected_components_decomposition()
     |      >>> P = P.as_explicit()
     |      >>> P_inv = P.inv().as_explicit()
     |      >>> B = B.as_explicit()
     |
     |      >>> P
     |      Matrix([
     |      [1, 0, 0, 0],
     |      [0, 0, 1, 0],
     |      [0, 1, 0, 0],
     |      [0, 0, 0, 1]])
     |      >>> B
     |      Matrix([
     |      [a, b, 0, 0],
     |      [c, d, 0, 0],
     |      [0, 0, e, f],
     |      [0, 0, g, h]])
     |      >>> P * B * P_inv
     |      Matrix([
     |      [a, 0, b, 0],
     |      [0, e, 0, f],
     |      [c, 0, d, 0],
     |      [0, g, 0, h]])
     |
     |      Notes
     |      =====
     |
     |      This problem corresponds to the finding of the connected components
     |      of a graph, when a matrix is viewed as a weighted graph.
     |
     |  copy(self)
     |      Returns the copy of a matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix(2, 2, [1, 2, 3, 4])
     |      >>> A.copy()
     |      Matrix([
     |      [1, 2],
     |      [3, 4]])
     |
     |  cross(self, b)
     |      Return the cross product of ``self`` and ``b`` relaxing the condition
     |      of compatible dimensions: if each has 3 elements, a matrix of the
     |      same type and shape as ``self`` will be returned. If ``b`` has the same
     |      shape as ``self`` then common identities for the cross product (like
     |      `a \times b = - b \times a`) will hold.
     |
     |      Parameters
     |      ==========
     |          b : 3x1 or 1x3 Matrix
     |
     |      See Also
     |      ========
     |
     |      dot
     |      multiply
     |      multiply_elementwise
     |
     |  diagonal_solve(self, rhs)
     |      Solves ``Ax = B`` efficiently, where A is a diagonal Matrix,
     |      with non-zero diagonal entries.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> A = eye(2)*2
     |      >>> B = Matrix([[1, 2], [3, 4]])
     |      >>> A.diagonal_solve(B) == B/2
     |      True
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      LDLsolve
     |      LUsolve
     |      QRsolve
     |      pinv_solve
     |
     |  dot(self, b, hermitian=None, conjugate_convention=None)
     |      Return the dot or inner product of two vectors of equal length.
     |      Here ``self`` must be a ``Matrix`` of size 1 x n or n x 1, and ``b``
     |      must be either a matrix of size 1 x n, n x 1, or a list/tuple of length n.
     |      A scalar is returned.
     |
     |      By default, ``dot`` does not conjugate ``self`` or ``b``, even if there are
     |      complex entries. Set ``hermitian=True`` (and optionally a ``conjugate_convention``)
     |      to compute the hermitian inner product.
     |
     |      Possible kwargs are ``hermitian`` and ``conjugate_convention``.
     |
     |      If ``conjugate_convention`` is ``"left"``, ``"math"`` or ``"maths"``,
     |      the conjugate of the first vector (``self``) is used.  If ``"right"``
     |      or ``"physics"`` is specified, the conjugate of the second vector ``b`` is used.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     |      >>> v = Matrix([1, 1, 1])
     |      >>> M.row(0).dot(v)
     |      6
     |      >>> M.col(0).dot(v)
     |      12
     |      >>> v = [3, 2, 1]
     |      >>> M.row(0).dot(v)
     |      10
     |
     |      >>> from sympy import I
     |      >>> q = Matrix([1*I, 1*I, 1*I])
     |      >>> q.dot(q, hermitian=False)
     |      -3
     |
     |      >>> q.dot(q, hermitian=True)
     |      3
     |
     |      >>> q1 = Matrix([1, 1, 1*I])
     |      >>> q.dot(q1, hermitian=True, conjugate_convention="maths")
     |      1 - 2*I
     |      >>> q.dot(q1, hermitian=True, conjugate_convention="physics")
     |      1 + 2*I
     |
     |
     |      See Also
     |      ========
     |
     |      cross
     |      multiply
     |      multiply_elementwise
     |
     |  dual(self)
     |      Returns the dual of a matrix, which is:
     |
     |      ``(1/2)*levicivita(i, j, k, l)*M(k, l)`` summed over indices `k` and `l`
     |
     |      Since the levicivita method is anti_symmetric for any pairwise
     |      exchange of indices, the dual of a symmetric matrix is the zero
     |      matrix. Strictly speaking the dual defined here assumes that the
     |      'matrix' `M` is a contravariant anti_symmetric second rank tensor,
     |      so that the dual is a covariant second rank tensor.
     |
     |  exp(self)
     |      Return the exponential of a square matrix
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Symbol, Matrix
     |
     |      >>> t = Symbol('t')
     |      >>> m = Matrix([[0, 1], [-1, 0]]) * t
     |      >>> m.exp()
     |      Matrix([
     |      [    exp(I*t)/2 + exp(-I*t)/2, -I*exp(I*t)/2 + I*exp(-I*t)/2],
     |      [I*exp(I*t)/2 - I*exp(-I*t)/2,      exp(I*t)/2 + exp(-I*t)/2]])
     |
     |  gauss_jordan_solve(self, B, freevar=False)
     |      Solves ``Ax = B`` using Gauss Jordan elimination.
     |
     |      There may be zero, one, or infinite solutions.  If one solution
     |      exists, it will be returned. If infinite solutions exist, it will
     |      be returned parametrically. If no solutions exist, It will throw
     |      ValueError.
     |
     |      Parameters
     |      ==========
     |
     |      B : Matrix
     |          The right hand side of the equation to be solved for.  Must have
     |          the same number of rows as matrix A.
     |
     |      freevar : boolean, optional
     |          Flag, when set to `True` will return the indices of the free
     |          variables in the solutions (column Matrix), for a system that is
     |          undetermined (e.g. A has more columns than rows), for which
     |          infinite solutions are possible, in terms of arbitrary
     |          values of free variables. Default `False`.
     |
     |      Returns
     |      =======
     |
     |      x : Matrix
     |          The matrix that will satisfy ``Ax = B``.  Will have as many rows as
     |          matrix A has columns, and as many columns as matrix B.
     |
     |      params : Matrix
     |          If the system is underdetermined (e.g. A has more columns than
     |          rows), infinite solutions are possible, in terms of arbitrary
     |          parameters. These arbitrary parameters are returned as params
     |          Matrix.
     |
     |      free_var_index : List, optional
     |          If the system is underdetermined (e.g. A has more columns than
     |          rows), infinite solutions are possible, in terms of arbitrary
     |          values of free variables. Then the indices of the free variables
     |          in the solutions (column Matrix) are returned by free_var_index,
     |          if the flag `freevar` is set to `True`.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix([[1, 2, 1, 1], [1, 2, 2, -1], [2, 4, 0, 6]])
     |      >>> B = Matrix([7, 12, 4])
     |      >>> sol, params = A.gauss_jordan_solve(B)
     |      >>> sol
     |      Matrix([
     |      [-2*tau0 - 3*tau1 + 2],
     |      [                 tau0],
     |      [           2*tau1 + 5],
     |      [                 tau1]])
     |      >>> params
     |      Matrix([
     |      [tau0],
     |      [tau1]])
     |      >>> taus_zeroes = { tau:0 for tau in params }
     |      >>> sol_unique = sol.xreplace(taus_zeroes)
     |      >>> sol_unique
     |          Matrix([
     |      [2],
     |      [0],
     |      [5],
     |      [0]])
     |
     |
     |      >>> A = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 10]])
     |      >>> B = Matrix([3, 6, 9])
     |      >>> sol, params = A.gauss_jordan_solve(B)
     |      >>> sol
     |      Matrix([
     |      [-1],
     |      [ 2],
     |      [ 0]])
     |      >>> params
     |      Matrix(0, 1, [])
     |
     |      >>> A = Matrix([[2, -7], [-1, 4]])
     |      >>> B = Matrix([[-21, 3], [12, -2]])
     |      >>> sol, params = A.gauss_jordan_solve(B)
     |      >>> sol
     |      Matrix([
     |      [0, -2],
     |      [3, -1]])
     |      >>> params
     |      Matrix(0, 2, [])
     |
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix([[1, 2, 1, 1], [1, 2, 2, -1], [2, 4, 0, 6]])
     |      >>> B = Matrix([7, 12, 4])
     |      >>> sol, params, freevars = A.gauss_jordan_solve(B, freevar=True)
     |      >>> sol
     |      Matrix([
     |      [-2*tau0 - 3*tau1 + 2],
     |      [                 tau0],
     |      [           2*tau1 + 5],
     |      [                 tau1]])
     |      >>> params
     |      Matrix([
     |      [tau0],
     |      [tau1]])
     |      >>> freevars
     |      [1, 3]
     |
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LDLsolve
     |      LUsolve
     |      QRsolve
     |      pinv
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Gaussian_elimination
     |
     |  inv(self, method=None, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, try_block_diag=False)
     |      Return the inverse of a matrix using the method indicated. Default for
     |      dense matrices is is Gauss elimination, default for sparse matrices is LDL.
     |
     |      Parameters
     |      ==========
     |
     |      method : ('GE', 'LU', 'ADJ', 'CH', 'LDL')
     |
     |      iszerofunc : function, optional
     |          Zero-testing function to use.
     |
     |      try_block_diag : bool, optional
     |          If True then will try to form block diagonal matrices using the
     |          method get_diag_blocks(), invert these individually, and then
     |          reconstruct the full inverse matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import SparseMatrix, Matrix
     |      >>> A = SparseMatrix([
     |      ... [ 2, -1,  0],
     |      ... [-1,  2, -1],
     |      ... [ 0,  0,  2]])
     |      >>> A.inv('CH')
     |      Matrix([
     |      [2/3, 1/3, 1/6],
     |      [1/3, 2/3, 1/3],
     |      [  0,   0, 1/2]])
     |      >>> A.inv(method='LDL') # use of 'method=' is optional
     |      Matrix([
     |      [2/3, 1/3, 1/6],
     |      [1/3, 2/3, 1/3],
     |      [  0,   0, 1/2]])
     |      >>> A * _
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 1, 0],
     |      [0, 0, 1]])
     |      >>> A = Matrix(A)
     |      >>> A.inv('CH')
     |      Matrix([
     |      [2/3, 1/3, 1/6],
     |      [1/3, 2/3, 1/3],
     |      [  0,   0, 1/2]])
     |      >>> A.inv('ADJ') == A.inv('GE') == A.inv('LU') == A.inv('CH') == A.inv('LDL') == A.inv('QR')
     |      True
     |
     |      Notes
     |      =====
     |
     |      According to the ``method`` keyword, it calls the appropriate method:
     |
     |          GE .... inverse_GE(); default for dense matrices
     |          LU .... inverse_LU()
     |          ADJ ... inverse_ADJ()
     |          CH ... inverse_CH()
     |          LDL ... inverse_LDL(); default for sparse matrices
     |          QR ... inverse_QR()
     |
     |      Note, the GE and LU methods may require the matrix to be simplified
     |      before it is inverted in order to properly detect zeros during
     |      pivoting. In difficult cases a custom zero detection function can
     |      be provided by setting the ``iszerofunc`` argument to a function that
     |      should return True if its argument is zero. The ADJ routine computes
     |      the determinant and uses that to detect singular matrices in addition
     |      to testing for zeros on the diagonal.
     |
     |      See Also
     |      ========
     |
     |      inverse_ADJ
     |      inverse_GE
     |      inverse_LU
     |      inverse_CH
     |      inverse_LDL
     |
     |      Raises
     |      ======
     |
     |      ValueError
     |          If the determinant of the matrix is zero.
     |
     |  inv_mod(self, m)
     |      Returns the inverse of the matrix `K` (mod `m`), if it exists.
     |
     |      Method to find the matrix inverse of `K` (mod `m`) implemented in this function:
     |
     |      * Compute `\mathrm{adj}(K) = \mathrm{cof}(K)^t`, the adjoint matrix of `K`.
     |
     |      * Compute `r = 1/\mathrm{det}(K) \pmod m`.
     |
     |      * `K^{-1} = r\cdot \mathrm{adj}(K) \pmod m`.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix(2, 2, [1, 2, 3, 4])
     |      >>> A.inv_mod(5)
     |      Matrix([
     |      [3, 1],
     |      [4, 2]])
     |      >>> A.inv_mod(3)
     |      Matrix([
     |      [1, 1],
     |      [0, 1]])
     |
     |  inverse_ADJ(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using the adjugate matrix and a determinant.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_GE
     |      inverse_LU
     |      inverse_CH
     |      inverse_LDL
     |
     |  inverse_BLOCK(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using BLOCKWISE inversion.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_ADJ
     |      inverse_GE
     |      inverse_CH
     |      inverse_LDL
     |
     |  inverse_CH(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using cholesky decomposition.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_ADJ
     |      inverse_GE
     |      inverse_LU
     |      inverse_LDL
     |
     |  inverse_GE(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using Gaussian elimination.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_ADJ
     |      inverse_LU
     |      inverse_CH
     |      inverse_LDL
     |
     |  inverse_LDL(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using LDL decomposition.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_ADJ
     |      inverse_GE
     |      inverse_LU
     |      inverse_CH
     |
     |  inverse_LU(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using LU decomposition.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_ADJ
     |      inverse_GE
     |      inverse_CH
     |      inverse_LDL
     |
     |  inverse_QR(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Calculates the inverse using QR decomposition.
     |
     |      See Also
     |      ========
     |
     |      inv
     |      inverse_ADJ
     |      inverse_GE
     |      inverse_CH
     |      inverse_LDL
     |
     |  is_nilpotent(self)
     |      Checks if a matrix is nilpotent.
     |
     |      A matrix B is nilpotent if for some integer k, B**k is
     |      a zero matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> a = Matrix([[0, 0, 0], [1, 0, 0], [1, 1, 0]])
     |      >>> a.is_nilpotent()
     |      True
     |
     |      >>> a = Matrix([[1, 0, 1], [1, 0, 0], [1, 1, 0]])
     |      >>> a.is_nilpotent()
     |      False
     |
     |  key2bounds(self, keys)
     |      Converts a key with potentially mixed types of keys (integer and slice)
     |      into a tuple of ranges and raises an error if any index is out of ``self``'s
     |      range.
     |
     |      See Also
     |      ========
     |
     |      key2ij
     |
     |  key2ij(self, key)
     |      Converts key into canonical form, converting integers or indexable
     |      items into valid integers for ``self``'s range or returning slices
     |      unchanged.
     |
     |      See Also
     |      ========
     |
     |      key2bounds
     |
     |  log(self, simplify=<function cancel at 0x7f71f3e44ef0>)
     |      Return the logarithm of a square matrix
     |
     |      Parameters
     |      ==========
     |
     |      simplify : function, bool
     |          The function to simplify the result with.
     |
     |          Default is ``cancel``, which is effective to reduce the
     |          expression growing for taking reciprocals and inverses for
     |          symbolic matrices.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import S, Matrix
     |
     |      Examples for positive-definite matrices:
     |
     |      >>> m = Matrix([[1, 1], [0, 1]])
     |      >>> m.log()
     |      Matrix([
     |      [0, 1],
     |      [0, 0]])
     |
     |      >>> m = Matrix([[S(5)/4, S(3)/4], [S(3)/4, S(5)/4]])
     |      >>> m.log()
     |      Matrix([
     |      [     0, log(2)],
     |      [log(2),      0]])
     |
     |      Examples for non positive-definite matrices:
     |
     |      >>> m = Matrix([[S(3)/4, S(5)/4], [S(5)/4, S(3)/4]])
     |      >>> m.log()
     |      Matrix([
     |      [         I*pi/2, log(2) - I*pi/2],
     |      [log(2) - I*pi/2,          I*pi/2]])
     |
     |      >>> m = Matrix(
     |      ...     [[0, 0, 0, 1],
     |      ...      [0, 0, 1, 0],
     |      ...      [0, 1, 0, 0],
     |      ...      [1, 0, 0, 0]])
     |      >>> m.log()
     |      Matrix([
     |      [ I*pi/2,       0,       0, -I*pi/2],
     |      [      0,  I*pi/2, -I*pi/2,       0],
     |      [      0, -I*pi/2,  I*pi/2,       0],
     |      [-I*pi/2,       0,       0,  I*pi/2]])
     |
     |  norm(self, ord=None)
     |      Return the Norm of a Matrix or Vector.
     |      In the simplest case this is the geometric size of the vector
     |      Other norms can be specified by the ord parameter
     |
     |
     |      =====  ============================  ==========================
     |      ord    norm for matrices             norm for vectors
     |      =====  ============================  ==========================
     |      None   Frobenius norm                2-norm
     |      'fro'  Frobenius norm                - does not exist
     |      inf    maximum row sum               max(abs(x))
     |      -inf   --                            min(abs(x))
     |      1      maximum column sum            as below
     |      -1     --                            as below
     |      2      2-norm (largest sing. value)  as below
     |      -2     smallest singular value       as below
     |      other  - does not exist              sum(abs(x)**ord)**(1./ord)
     |      =====  ============================  ==========================
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, Symbol, trigsimp, cos, sin, oo
     |      >>> x = Symbol('x', real=True)
     |      >>> v = Matrix([cos(x), sin(x)])
     |      >>> trigsimp( v.norm() )
     |      1
     |      >>> v.norm(10)
     |      (sin(x)**10 + cos(x)**10)**(1/10)
     |      >>> A = Matrix([[1, 1], [1, 1]])
     |      >>> A.norm(1) # maximum sum of absolute values of A is 2
     |      2
     |      >>> A.norm(2) # Spectral norm (max of |Ax|/|x| under 2-vector-norm)
     |      2
     |      >>> A.norm(-2) # Inverse spectral norm (smallest singular value)
     |      0
     |      >>> A.norm() # Frobenius Norm
     |      2
     |      >>> A.norm(oo) # Infinity Norm
     |      2
     |      >>> Matrix([1, -2]).norm(oo)
     |      2
     |      >>> Matrix([-1, 2]).norm(-oo)
     |      1
     |
     |      See Also
     |      ========
     |
     |      normalized
     |
     |  normalized(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Return the normalized version of ``self``.
     |
     |      Parameters
     |      ==========
     |
     |      iszerofunc : Function, optional
     |          A function to determine whether ``self`` is a zero vector.
     |          The default ``_iszero`` tests to see if each element is
     |          exactly zero.
     |
     |      Returns
     |      =======
     |
     |      Matrix
     |          Normalized vector form of ``self``.
     |          It has the same length as a unit vector. However, a zero vector
     |          will be returned for a vector with norm 0.
     |
     |      Raises
     |      ======
     |
     |      ShapeError
     |          If the matrix is not in a vector form.
     |
     |      See Also
     |      ========
     |
     |      norm
     |
     |  pinv(self, method='RD')
     |      Calculate the Moore-Penrose pseudoinverse of the matrix.
     |
     |      The Moore-Penrose pseudoinverse exists and is unique for any matrix.
     |      If the matrix is invertible, the pseudoinverse is the same as the
     |      inverse.
     |
     |      Parameters
     |      ==========
     |
     |      method : String, optional
     |          Specifies the method for computing the pseudoinverse.
     |
     |          If ``'RD'``, Rank-Decomposition will be used.
     |
     |          If ``'ED'``, Diagonalization will be used.
     |
     |      Examples
     |      ========
     |
     |      Computing pseudoinverse by rank decomposition :
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix([[1, 2, 3], [4, 5, 6]])
     |      >>> A.pinv()
     |      Matrix([
     |      [-17/18,  4/9],
     |      [  -1/9,  1/9],
     |      [ 13/18, -2/9]])
     |
     |      Computing pseudoinverse by diagonalization :
     |
     |      >>> B = A.pinv(method='ED')
     |      >>> B.simplify()
     |      >>> B
     |      Matrix([
     |      [-17/18,  4/9],
     |      [  -1/9,  1/9],
     |      [ 13/18, -2/9]])
     |
     |      See Also
     |      ========
     |
     |      inv
     |      pinv_solve
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Moore-Penrose_pseudoinverse
     |
     |  pinv_solve(self, B, arbitrary_matrix=None)
     |      Solve ``Ax = B`` using the Moore-Penrose pseudoinverse.
     |
     |      There may be zero, one, or infinite solutions.  If one solution
     |      exists, it will be returned.  If infinite solutions exist, one will
     |      be returned based on the value of arbitrary_matrix.  If no solutions
     |      exist, the least-squares solution is returned.
     |
     |      Parameters
     |      ==========
     |
     |      B : Matrix
     |          The right hand side of the equation to be solved for.  Must have
     |          the same number of rows as matrix A.
     |      arbitrary_matrix : Matrix
     |          If the system is underdetermined (e.g. A has more columns than
     |          rows), infinite solutions are possible, in terms of an arbitrary
     |          matrix.  This parameter may be set to a specific matrix to use
     |          for that purpose; if so, it must be the same shape as x, with as
     |          many rows as matrix A has columns, and as many columns as matrix
     |          B.  If left as None, an appropriate matrix containing dummy
     |          symbols in the form of ``wn_m`` will be used, with n and m being
     |          row and column position of each symbol.
     |
     |      Returns
     |      =======
     |
     |      x : Matrix
     |          The matrix that will satisfy ``Ax = B``.  Will have as many rows as
     |          matrix A has columns, and as many columns as matrix B.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix([[1, 2, 3], [4, 5, 6]])
     |      >>> B = Matrix([7, 8])
     |      >>> A.pinv_solve(B)
     |      Matrix([
     |      [ _w0_0/6 - _w1_0/3 + _w2_0/6 - 55/18],
     |      [-_w0_0/3 + 2*_w1_0/3 - _w2_0/3 + 1/9],
     |      [ _w0_0/6 - _w1_0/3 + _w2_0/6 + 59/18]])
     |      >>> A.pinv_solve(B, arbitrary_matrix=Matrix([0, 0, 0]))
     |      Matrix([
     |      [-55/18],
     |      [   1/9],
     |      [ 59/18]])
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.dense.DenseMatrix.lower_triangular_solve
     |      sympy.matrices.dense.DenseMatrix.upper_triangular_solve
     |      gauss_jordan_solve
     |      cholesky_solve
     |      diagonal_solve
     |      LDLsolve
     |      LUsolve
     |      QRsolve
     |      pinv
     |
     |      Notes
     |      =====
     |
     |      This may return either exact solutions or least squares solutions.
     |      To determine which, check ``A * A.pinv() * B == B``.  It will be
     |      True if exact solutions exist, and False if only a least-squares
     |      solution exists.  Be aware that the left hand side of that equation
     |      may need to be simplified to correctly compare to the right hand
     |      side.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Moore-Penrose_pseudoinverse#Obtaining_all_solutions_of_a_linear_system
     |
     |  print_nonzero(self, symb='X')
     |      Shows location of non-zero entries for fast shape lookup.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> m = Matrix(2, 3, lambda i, j: i*3+j)
     |      >>> m
     |      Matrix([
     |      [0, 1, 2],
     |      [3, 4, 5]])
     |      >>> m.print_nonzero()
     |      [ XX]
     |      [XXX]
     |      >>> m = eye(4)
     |      >>> m.print_nonzero("x")
     |      [x   ]
     |      [ x  ]
     |      [  x ]
     |      [   x]
     |
     |  project(self, v)
     |      Return the projection of ``self`` onto the line containing ``v``.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, S, sqrt
     |      >>> V = Matrix([sqrt(3)/2, S.Half])
     |      >>> x = Matrix([[1, 0]])
     |      >>> V.project(x)
     |      Matrix([[sqrt(3)/2, 0]])
     |      >>> V.project(-x)
     |      Matrix([[sqrt(3)/2, 0]])
     |
     |  rank_decomposition(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, simplify=False)
     |      Returns a pair of matrices (`C`, `F`) with matching rank
     |      such that `A = C F`.
     |
     |      Parameters
     |      ==========
     |
     |      iszerofunc : Function, optional
     |          A function used for detecting whether an element can
     |          act as a pivot.  ``lambda x: x.is_zero`` is used by default.
     |
     |      simplify : Bool or Function, optional
     |          A function used to simplify elements when looking for a
     |          pivot. By default SymPy's ``simplify`` is used.
     |
     |      Returns
     |      =======
     |
     |      (C, F) : Matrices
     |          `C` and `F` are full-rank matrices with rank as same as `A`,
     |          whose product gives `A`.
     |
     |          See Notes for additional mathematical details.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> A = Matrix([
     |      ...     [1, 3, 1, 4],
     |      ...     [2, 7, 3, 9],
     |      ...     [1, 5, 3, 1],
     |      ...     [1, 2, 0, 8]
     |      ... ])
     |      >>> C, F = A.rank_decomposition()
     |      >>> C
     |      Matrix([
     |      [1, 3, 4],
     |      [2, 7, 9],
     |      [1, 5, 1],
     |      [1, 2, 8]])
     |      >>> F
     |      Matrix([
     |      [1, 0, -2, 0],
     |      [0, 1,  1, 0],
     |      [0, 0,  0, 1]])
     |      >>> C * F == A
     |      True
     |
     |      Notes
     |      =====
     |
     |      Obtaining `F`, an RREF of `A`, is equivalent to creating a
     |      product
     |
     |      .. math::
     |          E_n E_{n-1} ... E_1 A = F
     |
     |      where `E_n, E_{n-1}, ... , E_1` are the elimination matrices or
     |      permutation matrices equivalent to each row-reduction step.
     |
     |      The inverse of the same product of elimination matrices gives
     |      `C`:
     |
     |      .. math::
     |          C = (E_n E_{n-1} ... E_1)^{-1}
     |
     |      It is not necessary, however, to actually compute the inverse:
     |      the columns of `C` are those from the original matrix with the
     |      same column indices as the indices of the pivot columns of `F`.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Rank_factorization
     |
     |      .. [2] Piziak, R.; Odell, P. L. (1 June 1999).
     |          "Full Rank Factorization of Matrices".
     |          Mathematics Magazine. 72 (3): 193. doi:10.2307/2690882
     |
     |      See Also
     |      ========
     |
     |      rref
     |
     |  solve(self, rhs, method='GJ')
     |      Solves linear equation where the unique solution exists.
     |
     |      Parameters
     |      ==========
     |
     |      rhs : Matrix
     |          Vector representing the right hand side of the linear equation.
     |
     |      method : string, optional
     |          If set to ``'GJ'`` or ``'GE'``, the Gauss-Jordan elimination will be
     |          used, which is implemented in the routine ``gauss_jordan_solve``.
     |
     |          If set to ``'LU'``, ``LUsolve`` routine will be used.
     |
     |          If set to ``'QR'``, ``QRsolve`` routine will be used.
     |
     |          If set to ``'PINV'``, ``pinv_solve`` routine will be used.
     |
     |          It also supports the methods available for special linear systems
     |
     |          For positive definite systems:
     |
     |          If set to ``'CH'``, ``cholesky_solve`` routine will be used.
     |
     |          If set to ``'LDL'``, ``LDLsolve`` routine will be used.
     |
     |          To use a different method and to compute the solution via the
     |          inverse, use a method defined in the .inv() docstring.
     |
     |      Returns
     |      =======
     |
     |      solutions : Matrix
     |          Vector representing the solution.
     |
     |      Raises
     |      ======
     |
     |      ValueError
     |          If there is not a unique solution then a ``ValueError`` will be
     |          raised.
     |
     |          If ``M`` is not square, a ``ValueError`` and a different routine
     |          for solving the system will be suggested.
     |
     |  solve_least_squares(self, rhs, method='CH')
     |      Return the least-square fit to the data.
     |
     |      Parameters
     |      ==========
     |
     |      rhs : Matrix
     |          Vector representing the right hand side of the linear equation.
     |
     |      method : string or boolean, optional
     |          If set to ``'CH'``, ``cholesky_solve`` routine will be used.
     |
     |          If set to ``'LDL'``, ``LDLsolve`` routine will be used.
     |
     |          If set to ``'QR'``, ``QRsolve`` routine will be used.
     |
     |          If set to ``'PINV'``, ``pinv_solve`` routine will be used.
     |
     |          Otherwise, the conjugate of ``M`` will be used to create a system
     |          of equations that is passed to ``solve`` along with the hint
     |          defined by ``method``.
     |
     |      Returns
     |      =======
     |
     |      solutions : Matrix
     |          Vector representing the solution.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, ones
     |      >>> A = Matrix([1, 2, 3])
     |      >>> B = Matrix([2, 3, 4])
     |      >>> S = Matrix(A.row_join(B))
     |      >>> S
     |      Matrix([
     |      [1, 2],
     |      [2, 3],
     |      [3, 4]])
     |
     |      If each line of S represent coefficients of Ax + By
     |      and x and y are [2, 3] then S*xy is:
     |
     |      >>> r = S*Matrix([2, 3]); r
     |      Matrix([
     |      [ 8],
     |      [13],
     |      [18]])
     |
     |      But let's add 1 to the middle value and then solve for the
     |      least-squares value of xy:
     |
     |      >>> xy = S.solve_least_squares(Matrix([8, 14, 18])); xy
     |      Matrix([
     |      [ 5/3],
     |      [10/3]])
     |
     |      The error is given by S*xy - r:
     |
     |      >>> S*xy - r
     |      Matrix([
     |      [1/3],
     |      [1/3],
     |      [1/3]])
     |      >>> _.norm().n(2)
     |      0.58
     |
     |      If a different xy is used, the norm will be higher:
     |
     |      >>> xy += ones(2, 1)/10
     |      >>> (S*xy - r).norm().n(2)
     |      1.5
     |
     |  table(self, printer, rowstart='[', rowend=']', rowsep='\n', colsep=', ', align='right')
     |      String form of Matrix as a table.
     |
     |      ``printer`` is the printer to use for on the elements (generally
     |      something like StrPrinter())
     |
     |      ``rowstart`` is the string used to start each row (by default '[').
     |
     |      ``rowend`` is the string used to end each row (by default ']').
     |
     |      ``rowsep`` is the string used to separate rows (by default a newline).
     |
     |      ``colsep`` is the string used to separate columns (by default ', ').
     |
     |      ``align`` defines how the elements are aligned. Must be one of 'left',
     |      'right', or 'center'.  You can also use '<', '>', and '^' to mean the
     |      same thing, respectively.
     |
     |      This is used by the string printer for Matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> from sympy.printing.str import StrPrinter
     |      >>> M = Matrix([[1, 2], [-33, 4]])
     |      >>> printer = StrPrinter()
     |      >>> M.table(printer)
     |      '[  1, 2]\n[-33, 4]'
     |      >>> print(M.table(printer))
     |      [  1, 2]
     |      [-33, 4]
     |      >>> print(M.table(printer, rowsep=',\n'))
     |      [  1, 2],
     |      [-33, 4]
     |      >>> print('[%s]' % M.table(printer, rowsep=',\n'))
     |      [[  1, 2],
     |      [-33, 4]]
     |      >>> print(M.table(printer, colsep=' '))
     |      [  1 2]
     |      [-33 4]
     |      >>> print(M.table(printer, align='center'))
     |      [ 1 , 2]
     |      [-33, 4]
     |      >>> print(M.table(printer, rowstart='{', rowend='}'))
     |      {  1, 2}
     |      {-33, 4}
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from sympy.matrices.matrices.MatrixBase:
     |
     |  irregular(ntop, *matrices, **kwargs) from builtins.type
     |      Return a matrix filled by the given matrices which
     |      are listed in order of appearance from left to right, top to
     |      bottom as they first appear in the matrix. They must fill the
     |      matrix completely.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import ones, Matrix
     |      >>> Matrix.irregular(3, ones(2,1), ones(3,3)*2, ones(2,2)*3,
     |      ...   ones(1,1)*4, ones(2,2)*5, ones(1,2)*6, ones(1,2)*7)
     |      Matrix([
     |        [1, 2, 2, 2, 3, 3],
     |        [1, 2, 2, 2, 3, 3],
     |        [4, 2, 2, 2, 5, 5],
     |        [6, 6, 7, 7, 5, 5]])
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.matrices.MatrixBase:
     |
     |  D
     |      Return Dirac conjugate (if ``self.rows == 4``).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, I, eye
     |      >>> m = Matrix((0, 1 + I, 2, 3))
     |      >>> m.D
     |      Matrix([[0, 1 - I, -2, -3]])
     |      >>> m = (eye(4) + I*eye(4))
     |      >>> m[0, 3] = 2
     |      >>> m.D
     |      Matrix([
     |      [1 - I,     0,      0,      0],
     |      [    0, 1 - I,      0,      0],
     |      [    0,     0, -1 + I,      0],
     |      [    2,     0,      0, -1 + I]])
     |
     |      If the matrix does not have 4 rows an AttributeError will be raised
     |      because this property is only defined for matrices with 4 rows.
     |
     |      >>> Matrix(eye(2)).D
     |      Traceback (most recent call last):
     |      ...
     |      AttributeError: Matrix has no attribute D.
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.common.MatrixCommon.conjugate: By-element conjugation
     |      sympy.matrices.common.MatrixCommon.H: Hermite conjugation
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from sympy.matrices.matrices.MatrixBase:
     |
     |  __array_priority__ = 11
     |
     |  is_Matrix = True
     |
     |  one = 1
     |
     |  zero = 0
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixDeprecated:
     |
     |  berkowitz(self)
     |
     |  berkowitz_charpoly(self, x=_lambda, simplify=<function simplify at 0x7f71f3b033b0>)
     |
     |  berkowitz_det(self)
     |      Computes determinant using Berkowitz method.
     |
     |      See Also
     |      ========
     |
     |      det
     |      berkowitz
     |
     |  berkowitz_eigenvals(self, **flags)
     |      Computes eigenvalues of a Matrix using Berkowitz method.
     |
     |      See Also
     |      ========
     |
     |      berkowitz
     |
     |  berkowitz_minors(self)
     |      Computes principal minors using Berkowitz method.
     |
     |      See Also
     |      ========
     |
     |      berkowitz
     |
     |  cofactorMatrix(self, method='berkowitz')
     |
     |  det_LU_decomposition(self)
     |      Compute matrix determinant using LU decomposition
     |
     |
     |      Note that this method fails if the LU decomposition itself
     |      fails. In particular, if the matrix has no inverse this method
     |      will fail.
     |
     |      TODO: Implement algorithm for sparse matrices (SFF),
     |      http://www.eecis.udel.edu/~saunders/papers/sffge/it5.ps.
     |
     |      See Also
     |      ========
     |
     |
     |      det
     |      det_bareiss
     |      berkowitz_det
     |
     |  det_bareis(self)
     |
     |  jordan_cell(self, eigenval, n)
     |
     |  jordan_cells(self, calc_transformation=True)
     |
     |  minorEntry(self, i, j, method='berkowitz')
     |
     |  minorMatrix(self, i, j)
     |
     |  permuteBkwd(self, perm)
     |      Permute the rows of the matrix with the given permutation in reverse.
     |
     |  permuteFwd(self, perm)
     |      Permute the rows of the matrix with the given permutation.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixCalculus:
     |
     |  diff(self, *args, **kwargs)
     |      Calculate the derivative of each element in the matrix.
     |      ``args`` will be passed to the ``integrate`` function.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> from sympy.abc import x, y
     |      >>> M = Matrix([[x, y], [1, 0]])
     |      >>> M.diff(x)
     |      Matrix([
     |      [1, 0],
     |      [0, 0]])
     |
     |      See Also
     |      ========
     |
     |      integrate
     |      limit
     |
     |  integrate(self, *args, **kwargs)
     |      Integrate each element of the matrix.  ``args`` will
     |      be passed to the ``integrate`` function.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> from sympy.abc import x, y
     |      >>> M = Matrix([[x, y], [1, 0]])
     |      >>> M.integrate((x, ))
     |      Matrix([
     |      [x**2/2, x*y],
     |      [     x,   0]])
     |      >>> M.integrate((x, 0, 2))
     |      Matrix([
     |      [2, 2*y],
     |      [2,   0]])
     |
     |      See Also
     |      ========
     |
     |      limit
     |      diff
     |
     |  jacobian(self, X)
     |      Calculates the Jacobian matrix (derivative of a vector-valued function).
     |
     |      Parameters
     |      ==========
     |
     |      ``self`` : vector of expressions representing functions f_i(x_1, ..., x_n).
     |      X : set of x_i's in order, it can be a list or a Matrix
     |
     |      Both ``self`` and X can be a row or a column matrix in any order
     |      (i.e., jacobian() should always work).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import sin, cos, Matrix
     |      >>> from sympy.abc import rho, phi
     |      >>> X = Matrix([rho*cos(phi), rho*sin(phi), rho**2])
     |      >>> Y = Matrix([rho, phi])
     |      >>> X.jacobian(Y)
     |      Matrix([
     |      [cos(phi), -rho*sin(phi)],
     |      [sin(phi),  rho*cos(phi)],
     |      [   2*rho,             0]])
     |      >>> X = Matrix([rho*cos(phi), rho*sin(phi)])
     |      >>> X.jacobian(Y)
     |      Matrix([
     |      [cos(phi), -rho*sin(phi)],
     |      [sin(phi),  rho*cos(phi)]])
     |
     |      See Also
     |      ========
     |
     |      hessian
     |      wronskian
     |
     |  limit(self, *args)
     |      Calculate the limit of each element in the matrix.
     |      ``args`` will be passed to the ``limit`` function.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> from sympy.abc import x, y
     |      >>> M = Matrix([[x, y], [1, 0]])
     |      >>> M.limit(x, 2)
     |      Matrix([
     |      [2, y],
     |      [1, 0]])
     |
     |      See Also
     |      ========
     |
     |      integrate
     |      diff
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixEigen:
     |
     |  bidiagonal_decomposition(self, upper=True)
     |      Returns (U,B,V.H)
     |
     |      $A = UBV^{H}$
     |
     |      where A is the input matrix, and B is its Bidiagonalized form
     |
     |      Note: Bidiagonal Computation can hang for symbolic matrices.
     |
     |      Parameters
     |      ==========
     |
     |      upper : bool. Whether to do upper bidiagnalization or lower.
     |                  True for upper and False for lower.
     |
     |      References
     |      ==========
     |
     |      1. Algorith 5.4.2, Matrix computations by Golub and Van Loan, 4th edition
     |      2. Complex Matrix Bidiagonalization : https://github.com/vslobody/Householder-Bidiagonalization
     |
     |  bidiagonalize(self, upper=True)
     |      Returns $B$, the Bidiagonalized form of the input matrix.
     |
     |      Note: Bidiagonal Computation can hang for symbolic matrices.
     |
     |      Parameters
     |      ==========
     |
     |      upper : bool. Whether to do upper bidiagnalization or lower.
     |                  True for upper and False for lower.
     |
     |      References
     |      ==========
     |
     |      1. Algorith 5.4.2, Matrix computations by Golub and Van Loan, 4th edition
     |      2. Complex Matrix Bidiagonalization : https://github.com/vslobody/Householder-Bidiagonalization
     |
     |  diagonalize(self, reals_only=False, sort=False, normalize=False)
     |      Return (P, D), where D is diagonal and
     |
     |          D = P^-1 * M * P
     |
     |      where M is current matrix.
     |
     |      Parameters
     |      ==========
     |
     |      reals_only : bool. Whether to throw an error if complex numbers are need
     |                      to diagonalize. (Default: False)
     |
     |      sort : bool. Sort the eigenvalues along the diagonal. (Default: False)
     |
     |      normalize : bool. If True, normalize the columns of P. (Default: False)
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix(3, 3, [1, 2, 0, 0, 3, 0, 2, -4, 2])
     |      >>> M
     |      Matrix([
     |      [1,  2, 0],
     |      [0,  3, 0],
     |      [2, -4, 2]])
     |      >>> (P, D) = M.diagonalize()
     |      >>> D
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 2, 0],
     |      [0, 0, 3]])
     |      >>> P
     |      Matrix([
     |      [-1, 0, -1],
     |      [ 0, 0, -1],
     |      [ 2, 1,  2]])
     |      >>> P.inv() * M * P
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 2, 0],
     |      [0, 0, 3]])
     |
     |      See Also
     |      ========
     |
     |      is_diagonal
     |      is_diagonalizable
     |
     |  eigenvals(self, error_when_incomplete=True, **flags)
     |      Return eigenvalues using the Berkowitz algorithm to compute
     |      the characteristic polynomial.
     |
     |      Parameters
     |      ==========
     |
     |      error_when_incomplete : bool, optional
     |          If it is set to ``True``, it will raise an error if not all
     |          eigenvalues are computed. This is caused by ``roots`` not returning
     |          a full list of eigenvalues.
     |
     |      simplify : bool or function, optional
     |          If it is set to ``True``, it attempts to return the most
     |          simplified form of expressions returned by applying default
     |          simplification method in every routine.
     |
     |          If it is set to ``False``, it will skip simplification in this
     |          particular routine to save computation resources.
     |
     |          If a function is passed to, it will attempt to apply
     |          the particular function as simplification method.
     |
     |      rational : bool, optional
     |          If it is set to ``True``, every floating point numbers would be
     |          replaced with rationals before computation. It can solve some
     |          issues of ``roots`` routine not working well with floats.
     |
     |      multiple : bool, optional
     |          If it is set to ``True``, the result will be in the form of a
     |          list.
     |
     |          If it is set to ``False``, the result will be in the form of a
     |          dictionary.
     |
     |      Returns
     |      =======
     |
     |      eigs : list or dict
     |          Eigenvalues of a matrix. The return format would be specified by
     |          the key ``multiple``.
     |
     |      Raises
     |      ======
     |
     |      MatrixError
     |          If not enough roots had got computed.
     |
     |      NonSquareMatrixError
     |          If attempted to compute eigenvalues from a non-square matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix(3, 3, [0, 1, 1, 1, 0, 0, 1, 1, 1])
     |      >>> M.eigenvals()
     |      {-1: 1, 0: 1, 2: 1}
     |
     |      See Also
     |      ========
     |
     |      MatrixDeterminant.charpoly
     |      eigenvects
     |
     |      Notes
     |      =====
     |
     |      Eigenvalues of a matrix $A$ can be computed by solving a matrix
     |      equation $\det(A - \lambda I) = 0$
     |
     |  eigenvects(self, error_when_incomplete=True, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, **flags)
     |      Return list of triples (eigenval, multiplicity, eigenspace).
     |
     |      Parameters
     |      ==========
     |
     |      error_when_incomplete : bool, optional
     |          Raise an error when not all eigenvalues are computed. This is
     |          caused by ``roots`` not returning a full list of eigenvalues.
     |
     |      iszerofunc : function, optional
     |          Specifies a zero testing function to be used in ``rref``.
     |
     |          Default value is ``_iszero``, which uses SymPy's naive and fast
     |          default assumption handler.
     |
     |          It can also accept any user-specified zero testing function, if it
     |          is formatted as a function which accepts a single symbolic argument
     |          and returns ``True`` if it is tested as zero and ``False`` if it
     |          is tested as non-zero, and ``None`` if it is undecidable.
     |
     |      simplify : bool or function, optional
     |          If ``True``, ``as_content_primitive()`` will be used to tidy up
     |          normalization artifacts.
     |
     |          It will also be used by the ``nullspace`` routine.
     |
     |      chop : bool or positive number, optional
     |          If the matrix contains any Floats, they will be changed to Rationals
     |          for computation purposes, but the answers will be returned after
     |          being evaluated with evalf. The ``chop`` flag is passed to ``evalf``.
     |          When ``chop=True`` a default precision will be used; a number will
     |          be interpreted as the desired level of precision.
     |
     |      Returns
     |      =======
     |      ret : [(eigenval, multiplicity, eigenspace), ...]
     |          A ragged list containing tuples of data obtained by ``eigenvals``
     |          and ``nullspace``.
     |
     |          ``eigenspace`` is a list containing the ``eigenvector`` for each
     |          eigenvalue.
     |
     |          ``eigenvector`` is a vector in the form of a ``Matrix``. e.g.
     |          a vector of length 3 is returned as ``Matrix([a_1, a_2, a_3])``.
     |
     |      Raises
     |      ======
     |
     |      NotImplementedError
     |          If failed to compute nullspace.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix(3, 3, [0, 1, 1, 1, 0, 0, 1, 1, 1])
     |      >>> M.eigenvects()
     |      [(-1, 1, [Matrix([
     |      [-1],
     |      [ 1],
     |      [ 0]])]), (0, 1, [Matrix([
     |      [ 0],
     |      [-1],
     |      [ 1]])]), (2, 1, [Matrix([
     |      [2/3],
     |      [1/3],
     |      [  1]])])]
     |
     |      See Also
     |      ========
     |
     |      eigenvals
     |      MatrixSubspaces.nullspace
     |
     |  is_diagonalizable(self, reals_only=False, **kwargs)
     |      Returns ``True`` if a matrix is diagonalizable.
     |
     |      Parameters
     |      ==========
     |
     |      reals_only : bool, optional
     |          If ``True``, it tests whether the matrix can be diagonalized
     |          to contain only real numbers on the diagonal.
     |
     |
     |          If ``False``, it tests whether the matrix can be diagonalized
     |          at all, even with numbers that may not be real.
     |
     |      Examples
     |      ========
     |
     |      Example of a diagonalizable matrix:
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2, 0], [0, 3, 0], [2, -4, 2]])
     |      >>> M.is_diagonalizable()
     |      True
     |
     |      Example of a non-diagonalizable matrix:
     |
     |      >>> M = Matrix([[0, 1], [0, 0]])
     |      >>> M.is_diagonalizable()
     |      False
     |
     |      Example of a matrix that is diagonalized in terms of non-real entries:
     |
     |      >>> M = Matrix([[0, 1], [-1, 0]])
     |      >>> M.is_diagonalizable(reals_only=False)
     |      True
     |      >>> M.is_diagonalizable(reals_only=True)
     |      False
     |
     |      See Also
     |      ========
     |
     |      is_diagonal
     |      diagonalize
     |
     |  jordan_form(self, calc_transform=True, **kwargs)
     |      Return $(P, J)$ where $J$ is a Jordan block
     |      matrix and $P$ is a matrix such that $M = P J P^{-1}$
     |
     |      Parameters
     |      ==========
     |
     |      calc_transform : bool
     |          If ``False``, then only $J$ is returned.
     |
     |      chop : bool
     |          All matrices are converted to exact types when computing
     |          eigenvalues and eigenvectors.  As a result, there may be
     |          approximation errors.  If ``chop==True``, these errors
     |          will be truncated.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix([[ 6,  5, -2, -3], [-3, -1,  3,  3], [ 2,  1, -2, -3], [-1,  1,  5,  5]])
     |      >>> P, J = M.jordan_form()
     |      >>> J
     |      Matrix([
     |      [2, 1, 0, 0],
     |      [0, 2, 0, 0],
     |      [0, 0, 2, 1],
     |      [0, 0, 0, 2]])
     |
     |      See Also
     |      ========
     |
     |      jordan_block
     |
     |  left_eigenvects(self, **flags)
     |      Returns left eigenvectors and eigenvalues.
     |
     |      This function returns the list of triples (eigenval, multiplicity,
     |      basis) for the left eigenvectors. Options are the same as for
     |      eigenvects(), i.e. the ``**flags`` arguments gets passed directly to
     |      eigenvects().
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix([[0, 1, 1], [1, 0, 0], [1, 1, 1]])
     |      >>> M.eigenvects()
     |      [(-1, 1, [Matrix([
     |      [-1],
     |      [ 1],
     |      [ 0]])]), (0, 1, [Matrix([
     |      [ 0],
     |      [-1],
     |      [ 1]])]), (2, 1, [Matrix([
     |      [2/3],
     |      [1/3],
     |      [  1]])])]
     |      >>> M.left_eigenvects()
     |      [(-1, 1, [Matrix([[-2, 1, 1]])]), (0, 1, [Matrix([[-1, -1, 1]])]), (2,
     |      1, [Matrix([[1, 1, 1]])])]
     |
     |  singular_values(self)
     |      Compute the singular values of a Matrix
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, Symbol
     |      >>> x = Symbol('x', real=True)
     |      >>> M = Matrix([[0, 1, 0], [0, x, 0], [-1, 0, 0]])
     |      >>> M.singular_values()
     |      [sqrt(x**2 + 1), 1, 0]
     |
     |      See Also
     |      ========
     |
     |      condition_number
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.matrices.MatrixEigen:
     |
     |  is_indefinite
     |      Finds out the definiteness of a matrix.
     |
     |      Explanation
     |      ===========
     |
     |      A square real matrix $A$ is:
     |
     |      - A positive definite matrix if $x^T A x > 0$
     |        for all non-zero real vectors $x$.
     |      - A positive semidefinite matrix if $x^T A x \geq 0$
     |        for all non-zero real vectors $x$.
     |      - A negative definite matrix if $x^T A x < 0$
     |        for all non-zero real vectors $x$.
     |      - A negative semidefinite matrix if $x^T A x \leq 0$
     |        for all non-zero real vectors $x$.
     |      - An indefinite matrix if there exists non-zero real vectors
     |        $x, y$ with $x^T A x > 0 > y^T A y$.
     |
     |      A square complex matrix $A$ is:
     |
     |      - A positive definite matrix if $\text{re}(x^H A x) > 0$
     |        for all non-zero complex vectors $x$.
     |      - A positive semidefinite matrix if $\text{re}(x^H A x) \geq 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative definite matrix if $\text{re}(x^H A x) < 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative semidefinite matrix if $\text{re}(x^H A x) \leq 0$
     |        for all non-zero complex vectors $x$.
     |      - An indefinite matrix if there exists non-zero complex vectors
     |        $x, y$ with $\text{re}(x^H A x) > 0 > \text{re}(y^H A y)$.
     |
     |      A matrix need not be symmetric or hermitian to be positive definite.
     |
     |      - A real non-symmetric matrix is positive definite if and only if
     |        $\frac{A + A^T}{2}$ is positive definite.
     |      - A complex non-hermitian matrix is positive definite if and only if
     |        $\frac{A + A^H}{2}$ is positive definite.
     |
     |      And this extension can apply for all the definitions above.
     |
     |      However, for complex cases, you can restrict the definition of
     |      $\text{re}(x^H A x) > 0$ to $x^H A x > 0$ and require the matrix
     |      to be hermitian.
     |      But we do not present this restriction for computation because you
     |      can check ``M.is_hermitian`` independently with this and use
     |      the same procedure.
     |
     |      Examples
     |      ========
     |
     |      An example of symmetric positive definite matrix:
     |
     |      .. plot::
     |          :context: reset
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> from sympy import Matrix, symbols
     |          >>> from sympy.plotting import plot3d
     |          >>> a, b = symbols('a b')
     |          >>> x = Matrix([a, b])
     |
     |          >>> A = Matrix([[1, 0], [0, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric positive semidefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, -1], [-1, 1]])
     |          >>> A.is_positive_definite
     |          False
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric negative definite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[-1, 0], [0, -1]])
     |          >>> A.is_negative_definite
     |          True
     |          >>> A.is_negative_semidefinite
     |          True
     |          >>> A.is_indefinite
     |          False
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric indefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [2, -1]])
     |          >>> A.is_indefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of non-symmetric positive definite matrix.
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [-2, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      Notes
     |      =====
     |
     |      Although some people trivialize the definition of positive definite
     |      matrices only for symmetric or hermitian matrices, this restriction
     |      is not correct because it does not classify all instances of
     |      positive definite matrices from the definition $x^T A x > 0$ or
     |      $\text{re}(x^H A x) > 0$.
     |
     |      For instance, ``Matrix([[1, 2], [-2, 1]])`` presented in
     |      the example above is an example of real positive definite matrix
     |      that is not symmetric.
     |
     |      However, since the following formula holds true;
     |
     |      .. math::
     |          \text{re}(x^H A x) > 0 \iff
     |          \text{re}(x^H \frac{A + A^H}{2} x) > 0
     |
     |      We can classify all positive definite matrices that may or may not
     |      be symmetric or hermitian by transforming the matrix to
     |      $\frac{A + A^T}{2}$ or $\frac{A + A^H}{2}$
     |      (which is guaranteed to be always real symmetric or complex
     |      hermitian) and we can defer most of the studies to symmetric or
     |      hermitian positive definite matrices.
     |
     |      But it is a different problem for the existance of Cholesky
     |      decomposition. Because even though a non symmetric or a non
     |      hermitian matrix can be positive definite, Cholesky or LDL
     |      decomposition does not exist because the decompositions require the
     |      matrix to be symmetric or hermitian.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Definiteness_of_a_matrix#Eigenvalues
     |
     |      .. [2] http://mathworld.wolfram.com/PositiveDefiniteMatrix.html
     |
     |      .. [3] Johnson, C. R. "Positive Definite Matrices." Amer.
     |          Math. Monthly 77, 259-264 1970.
     |
     |  is_negative_definite
     |      Finds out the definiteness of a matrix.
     |
     |      Explanation
     |      ===========
     |
     |      A square real matrix $A$ is:
     |
     |      - A positive definite matrix if $x^T A x > 0$
     |        for all non-zero real vectors $x$.
     |      - A positive semidefinite matrix if $x^T A x \geq 0$
     |        for all non-zero real vectors $x$.
     |      - A negative definite matrix if $x^T A x < 0$
     |        for all non-zero real vectors $x$.
     |      - A negative semidefinite matrix if $x^T A x \leq 0$
     |        for all non-zero real vectors $x$.
     |      - An indefinite matrix if there exists non-zero real vectors
     |        $x, y$ with $x^T A x > 0 > y^T A y$.
     |
     |      A square complex matrix $A$ is:
     |
     |      - A positive definite matrix if $\text{re}(x^H A x) > 0$
     |        for all non-zero complex vectors $x$.
     |      - A positive semidefinite matrix if $\text{re}(x^H A x) \geq 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative definite matrix if $\text{re}(x^H A x) < 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative semidefinite matrix if $\text{re}(x^H A x) \leq 0$
     |        for all non-zero complex vectors $x$.
     |      - An indefinite matrix if there exists non-zero complex vectors
     |        $x, y$ with $\text{re}(x^H A x) > 0 > \text{re}(y^H A y)$.
     |
     |      A matrix need not be symmetric or hermitian to be positive definite.
     |
     |      - A real non-symmetric matrix is positive definite if and only if
     |        $\frac{A + A^T}{2}$ is positive definite.
     |      - A complex non-hermitian matrix is positive definite if and only if
     |        $\frac{A + A^H}{2}$ is positive definite.
     |
     |      And this extension can apply for all the definitions above.
     |
     |      However, for complex cases, you can restrict the definition of
     |      $\text{re}(x^H A x) > 0$ to $x^H A x > 0$ and require the matrix
     |      to be hermitian.
     |      But we do not present this restriction for computation because you
     |      can check ``M.is_hermitian`` independently with this and use
     |      the same procedure.
     |
     |      Examples
     |      ========
     |
     |      An example of symmetric positive definite matrix:
     |
     |      .. plot::
     |          :context: reset
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> from sympy import Matrix, symbols
     |          >>> from sympy.plotting import plot3d
     |          >>> a, b = symbols('a b')
     |          >>> x = Matrix([a, b])
     |
     |          >>> A = Matrix([[1, 0], [0, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric positive semidefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, -1], [-1, 1]])
     |          >>> A.is_positive_definite
     |          False
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric negative definite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[-1, 0], [0, -1]])
     |          >>> A.is_negative_definite
     |          True
     |          >>> A.is_negative_semidefinite
     |          True
     |          >>> A.is_indefinite
     |          False
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric indefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [2, -1]])
     |          >>> A.is_indefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of non-symmetric positive definite matrix.
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [-2, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      Notes
     |      =====
     |
     |      Although some people trivialize the definition of positive definite
     |      matrices only for symmetric or hermitian matrices, this restriction
     |      is not correct because it does not classify all instances of
     |      positive definite matrices from the definition $x^T A x > 0$ or
     |      $\text{re}(x^H A x) > 0$.
     |
     |      For instance, ``Matrix([[1, 2], [-2, 1]])`` presented in
     |      the example above is an example of real positive definite matrix
     |      that is not symmetric.
     |
     |      However, since the following formula holds true;
     |
     |      .. math::
     |          \text{re}(x^H A x) > 0 \iff
     |          \text{re}(x^H \frac{A + A^H}{2} x) > 0
     |
     |      We can classify all positive definite matrices that may or may not
     |      be symmetric or hermitian by transforming the matrix to
     |      $\frac{A + A^T}{2}$ or $\frac{A + A^H}{2}$
     |      (which is guaranteed to be always real symmetric or complex
     |      hermitian) and we can defer most of the studies to symmetric or
     |      hermitian positive definite matrices.
     |
     |      But it is a different problem for the existance of Cholesky
     |      decomposition. Because even though a non symmetric or a non
     |      hermitian matrix can be positive definite, Cholesky or LDL
     |      decomposition does not exist because the decompositions require the
     |      matrix to be symmetric or hermitian.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Definiteness_of_a_matrix#Eigenvalues
     |
     |      .. [2] http://mathworld.wolfram.com/PositiveDefiniteMatrix.html
     |
     |      .. [3] Johnson, C. R. "Positive Definite Matrices." Amer.
     |          Math. Monthly 77, 259-264 1970.
     |
     |  is_negative_semidefinite
     |      Finds out the definiteness of a matrix.
     |
     |      Explanation
     |      ===========
     |
     |      A square real matrix $A$ is:
     |
     |      - A positive definite matrix if $x^T A x > 0$
     |        for all non-zero real vectors $x$.
     |      - A positive semidefinite matrix if $x^T A x \geq 0$
     |        for all non-zero real vectors $x$.
     |      - A negative definite matrix if $x^T A x < 0$
     |        for all non-zero real vectors $x$.
     |      - A negative semidefinite matrix if $x^T A x \leq 0$
     |        for all non-zero real vectors $x$.
     |      - An indefinite matrix if there exists non-zero real vectors
     |        $x, y$ with $x^T A x > 0 > y^T A y$.
     |
     |      A square complex matrix $A$ is:
     |
     |      - A positive definite matrix if $\text{re}(x^H A x) > 0$
     |        for all non-zero complex vectors $x$.
     |      - A positive semidefinite matrix if $\text{re}(x^H A x) \geq 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative definite matrix if $\text{re}(x^H A x) < 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative semidefinite matrix if $\text{re}(x^H A x) \leq 0$
     |        for all non-zero complex vectors $x$.
     |      - An indefinite matrix if there exists non-zero complex vectors
     |        $x, y$ with $\text{re}(x^H A x) > 0 > \text{re}(y^H A y)$.
     |
     |      A matrix need not be symmetric or hermitian to be positive definite.
     |
     |      - A real non-symmetric matrix is positive definite if and only if
     |        $\frac{A + A^T}{2}$ is positive definite.
     |      - A complex non-hermitian matrix is positive definite if and only if
     |        $\frac{A + A^H}{2}$ is positive definite.
     |
     |      And this extension can apply for all the definitions above.
     |
     |      However, for complex cases, you can restrict the definition of
     |      $\text{re}(x^H A x) > 0$ to $x^H A x > 0$ and require the matrix
     |      to be hermitian.
     |      But we do not present this restriction for computation because you
     |      can check ``M.is_hermitian`` independently with this and use
     |      the same procedure.
     |
     |      Examples
     |      ========
     |
     |      An example of symmetric positive definite matrix:
     |
     |      .. plot::
     |          :context: reset
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> from sympy import Matrix, symbols
     |          >>> from sympy.plotting import plot3d
     |          >>> a, b = symbols('a b')
     |          >>> x = Matrix([a, b])
     |
     |          >>> A = Matrix([[1, 0], [0, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric positive semidefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, -1], [-1, 1]])
     |          >>> A.is_positive_definite
     |          False
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric negative definite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[-1, 0], [0, -1]])
     |          >>> A.is_negative_definite
     |          True
     |          >>> A.is_negative_semidefinite
     |          True
     |          >>> A.is_indefinite
     |          False
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric indefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [2, -1]])
     |          >>> A.is_indefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of non-symmetric positive definite matrix.
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [-2, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      Notes
     |      =====
     |
     |      Although some people trivialize the definition of positive definite
     |      matrices only for symmetric or hermitian matrices, this restriction
     |      is not correct because it does not classify all instances of
     |      positive definite matrices from the definition $x^T A x > 0$ or
     |      $\text{re}(x^H A x) > 0$.
     |
     |      For instance, ``Matrix([[1, 2], [-2, 1]])`` presented in
     |      the example above is an example of real positive definite matrix
     |      that is not symmetric.
     |
     |      However, since the following formula holds true;
     |
     |      .. math::
     |          \text{re}(x^H A x) > 0 \iff
     |          \text{re}(x^H \frac{A + A^H}{2} x) > 0
     |
     |      We can classify all positive definite matrices that may or may not
     |      be symmetric or hermitian by transforming the matrix to
     |      $\frac{A + A^T}{2}$ or $\frac{A + A^H}{2}$
     |      (which is guaranteed to be always real symmetric or complex
     |      hermitian) and we can defer most of the studies to symmetric or
     |      hermitian positive definite matrices.
     |
     |      But it is a different problem for the existance of Cholesky
     |      decomposition. Because even though a non symmetric or a non
     |      hermitian matrix can be positive definite, Cholesky or LDL
     |      decomposition does not exist because the decompositions require the
     |      matrix to be symmetric or hermitian.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Definiteness_of_a_matrix#Eigenvalues
     |
     |      .. [2] http://mathworld.wolfram.com/PositiveDefiniteMatrix.html
     |
     |      .. [3] Johnson, C. R. "Positive Definite Matrices." Amer.
     |          Math. Monthly 77, 259-264 1970.
     |
     |  is_positive_definite
     |      Finds out the definiteness of a matrix.
     |
     |      Explanation
     |      ===========
     |
     |      A square real matrix $A$ is:
     |
     |      - A positive definite matrix if $x^T A x > 0$
     |        for all non-zero real vectors $x$.
     |      - A positive semidefinite matrix if $x^T A x \geq 0$
     |        for all non-zero real vectors $x$.
     |      - A negative definite matrix if $x^T A x < 0$
     |        for all non-zero real vectors $x$.
     |      - A negative semidefinite matrix if $x^T A x \leq 0$
     |        for all non-zero real vectors $x$.
     |      - An indefinite matrix if there exists non-zero real vectors
     |        $x, y$ with $x^T A x > 0 > y^T A y$.
     |
     |      A square complex matrix $A$ is:
     |
     |      - A positive definite matrix if $\text{re}(x^H A x) > 0$
     |        for all non-zero complex vectors $x$.
     |      - A positive semidefinite matrix if $\text{re}(x^H A x) \geq 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative definite matrix if $\text{re}(x^H A x) < 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative semidefinite matrix if $\text{re}(x^H A x) \leq 0$
     |        for all non-zero complex vectors $x$.
     |      - An indefinite matrix if there exists non-zero complex vectors
     |        $x, y$ with $\text{re}(x^H A x) > 0 > \text{re}(y^H A y)$.
     |
     |      A matrix need not be symmetric or hermitian to be positive definite.
     |
     |      - A real non-symmetric matrix is positive definite if and only if
     |        $\frac{A + A^T}{2}$ is positive definite.
     |      - A complex non-hermitian matrix is positive definite if and only if
     |        $\frac{A + A^H}{2}$ is positive definite.
     |
     |      And this extension can apply for all the definitions above.
     |
     |      However, for complex cases, you can restrict the definition of
     |      $\text{re}(x^H A x) > 0$ to $x^H A x > 0$ and require the matrix
     |      to be hermitian.
     |      But we do not present this restriction for computation because you
     |      can check ``M.is_hermitian`` independently with this and use
     |      the same procedure.
     |
     |      Examples
     |      ========
     |
     |      An example of symmetric positive definite matrix:
     |
     |      .. plot::
     |          :context: reset
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> from sympy import Matrix, symbols
     |          >>> from sympy.plotting import plot3d
     |          >>> a, b = symbols('a b')
     |          >>> x = Matrix([a, b])
     |
     |          >>> A = Matrix([[1, 0], [0, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric positive semidefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, -1], [-1, 1]])
     |          >>> A.is_positive_definite
     |          False
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric negative definite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[-1, 0], [0, -1]])
     |          >>> A.is_negative_definite
     |          True
     |          >>> A.is_negative_semidefinite
     |          True
     |          >>> A.is_indefinite
     |          False
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric indefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [2, -1]])
     |          >>> A.is_indefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of non-symmetric positive definite matrix.
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [-2, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      Notes
     |      =====
     |
     |      Although some people trivialize the definition of positive definite
     |      matrices only for symmetric or hermitian matrices, this restriction
     |      is not correct because it does not classify all instances of
     |      positive definite matrices from the definition $x^T A x > 0$ or
     |      $\text{re}(x^H A x) > 0$.
     |
     |      For instance, ``Matrix([[1, 2], [-2, 1]])`` presented in
     |      the example above is an example of real positive definite matrix
     |      that is not symmetric.
     |
     |      However, since the following formula holds true;
     |
     |      .. math::
     |          \text{re}(x^H A x) > 0 \iff
     |          \text{re}(x^H \frac{A + A^H}{2} x) > 0
     |
     |      We can classify all positive definite matrices that may or may not
     |      be symmetric or hermitian by transforming the matrix to
     |      $\frac{A + A^T}{2}$ or $\frac{A + A^H}{2}$
     |      (which is guaranteed to be always real symmetric or complex
     |      hermitian) and we can defer most of the studies to symmetric or
     |      hermitian positive definite matrices.
     |
     |      But it is a different problem for the existance of Cholesky
     |      decomposition. Because even though a non symmetric or a non
     |      hermitian matrix can be positive definite, Cholesky or LDL
     |      decomposition does not exist because the decompositions require the
     |      matrix to be symmetric or hermitian.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Definiteness_of_a_matrix#Eigenvalues
     |
     |      .. [2] http://mathworld.wolfram.com/PositiveDefiniteMatrix.html
     |
     |      .. [3] Johnson, C. R. "Positive Definite Matrices." Amer.
     |          Math. Monthly 77, 259-264 1970.
     |
     |  is_positive_semidefinite
     |      Finds out the definiteness of a matrix.
     |
     |      Explanation
     |      ===========
     |
     |      A square real matrix $A$ is:
     |
     |      - A positive definite matrix if $x^T A x > 0$
     |        for all non-zero real vectors $x$.
     |      - A positive semidefinite matrix if $x^T A x \geq 0$
     |        for all non-zero real vectors $x$.
     |      - A negative definite matrix if $x^T A x < 0$
     |        for all non-zero real vectors $x$.
     |      - A negative semidefinite matrix if $x^T A x \leq 0$
     |        for all non-zero real vectors $x$.
     |      - An indefinite matrix if there exists non-zero real vectors
     |        $x, y$ with $x^T A x > 0 > y^T A y$.
     |
     |      A square complex matrix $A$ is:
     |
     |      - A positive definite matrix if $\text{re}(x^H A x) > 0$
     |        for all non-zero complex vectors $x$.
     |      - A positive semidefinite matrix if $\text{re}(x^H A x) \geq 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative definite matrix if $\text{re}(x^H A x) < 0$
     |        for all non-zero complex vectors $x$.
     |      - A negative semidefinite matrix if $\text{re}(x^H A x) \leq 0$
     |        for all non-zero complex vectors $x$.
     |      - An indefinite matrix if there exists non-zero complex vectors
     |        $x, y$ with $\text{re}(x^H A x) > 0 > \text{re}(y^H A y)$.
     |
     |      A matrix need not be symmetric or hermitian to be positive definite.
     |
     |      - A real non-symmetric matrix is positive definite if and only if
     |        $\frac{A + A^T}{2}$ is positive definite.
     |      - A complex non-hermitian matrix is positive definite if and only if
     |        $\frac{A + A^H}{2}$ is positive definite.
     |
     |      And this extension can apply for all the definitions above.
     |
     |      However, for complex cases, you can restrict the definition of
     |      $\text{re}(x^H A x) > 0$ to $x^H A x > 0$ and require the matrix
     |      to be hermitian.
     |      But we do not present this restriction for computation because you
     |      can check ``M.is_hermitian`` independently with this and use
     |      the same procedure.
     |
     |      Examples
     |      ========
     |
     |      An example of symmetric positive definite matrix:
     |
     |      .. plot::
     |          :context: reset
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> from sympy import Matrix, symbols
     |          >>> from sympy.plotting import plot3d
     |          >>> a, b = symbols('a b')
     |          >>> x = Matrix([a, b])
     |
     |          >>> A = Matrix([[1, 0], [0, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric positive semidefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, -1], [-1, 1]])
     |          >>> A.is_positive_definite
     |          False
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric negative definite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[-1, 0], [0, -1]])
     |          >>> A.is_negative_definite
     |          True
     |          >>> A.is_negative_semidefinite
     |          True
     |          >>> A.is_indefinite
     |          False
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of symmetric indefinite matrix:
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [2, -1]])
     |          >>> A.is_indefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      An example of non-symmetric positive definite matrix.
     |
     |      .. plot::
     |          :context: close-figs
     |          :format: doctest
     |          :include-source: True
     |
     |          >>> A = Matrix([[1, 2], [-2, 1]])
     |          >>> A.is_positive_definite
     |          True
     |          >>> A.is_positive_semidefinite
     |          True
     |
     |          >>> p = plot3d((x.T*A*x)[0, 0], (a, -1, 1), (b, -1, 1))
     |
     |      Notes
     |      =====
     |
     |      Although some people trivialize the definition of positive definite
     |      matrices only for symmetric or hermitian matrices, this restriction
     |      is not correct because it does not classify all instances of
     |      positive definite matrices from the definition $x^T A x > 0$ or
     |      $\text{re}(x^H A x) > 0$.
     |
     |      For instance, ``Matrix([[1, 2], [-2, 1]])`` presented in
     |      the example above is an example of real positive definite matrix
     |      that is not symmetric.
     |
     |      However, since the following formula holds true;
     |
     |      .. math::
     |          \text{re}(x^H A x) > 0 \iff
     |          \text{re}(x^H \frac{A + A^H}{2} x) > 0
     |
     |      We can classify all positive definite matrices that may or may not
     |      be symmetric or hermitian by transforming the matrix to
     |      $\frac{A + A^T}{2}$ or $\frac{A + A^H}{2}$
     |      (which is guaranteed to be always real symmetric or complex
     |      hermitian) and we can defer most of the studies to symmetric or
     |      hermitian positive definite matrices.
     |
     |      But it is a different problem for the existance of Cholesky
     |      decomposition. Because even though a non symmetric or a non
     |      hermitian matrix can be positive definite, Cholesky or LDL
     |      decomposition does not exist because the decompositions require the
     |      matrix to be symmetric or hermitian.
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Definiteness_of_a_matrix#Eigenvalues
     |
     |      .. [2] http://mathworld.wolfram.com/PositiveDefiniteMatrix.html
     |
     |      .. [3] Johnson, C. R. "Positive Definite Matrices." Amer.
     |          Math. Monthly 77, 259-264 1970.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixSubspaces:
     |
     |  columnspace(self, simplify=False)
     |      Returns a list of vectors (Matrix objects) that span columnspace of ``M``
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
     |      >>> M
     |      Matrix([
     |      [ 1,  3, 0],
     |      [-2, -6, 0],
     |      [ 3,  9, 6]])
     |      >>> M.columnspace()
     |      [Matrix([
     |      [ 1],
     |      [-2],
     |      [ 3]]), Matrix([
     |      [0],
     |      [0],
     |      [6]])]
     |
     |      See Also
     |      ========
     |
     |      nullspace
     |      rowspace
     |
     |  nullspace(self, simplify=False, iszerofunc=<function _iszero at 0x7f71f39a9dd0>)
     |      Returns list of vectors (Matrix objects) that span nullspace of ``M``
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
     |      >>> M
     |      Matrix([
     |      [ 1,  3, 0],
     |      [-2, -6, 0],
     |      [ 3,  9, 6]])
     |      >>> M.nullspace()
     |      [Matrix([
     |      [-3],
     |      [ 1],
     |      [ 0]])]
     |
     |      See Also
     |      ========
     |
     |      columnspace
     |      rowspace
     |
     |  rowspace(self, simplify=False)
     |      Returns a list of vectors that span the row space of ``M``.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
     |      >>> M
     |      Matrix([
     |      [ 1,  3, 0],
     |      [-2, -6, 0],
     |      [ 3,  9, 6]])
     |      >>> M.rowspace()
     |      [Matrix([[1, 3, 0]]), Matrix([[0, 0, 6]])]
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from sympy.matrices.matrices.MatrixSubspaces:
     |
     |  orthogonalize(*vecs, **kwargs) from builtins.type
     |      Apply the Gram-Schmidt orthogonalization procedure
     |      to vectors supplied in ``vecs``.
     |
     |      Parameters
     |      ==========
     |
     |      vecs
     |          vectors to be made orthogonal
     |
     |      normalize : bool
     |          If ``True``, return an orthonormal basis.
     |
     |      rankcheck : bool
     |          If ``True``, the computation does not stop when encountering
     |          linearly dependent vectors.
     |
     |          If ``False``, it will raise ``ValueError`` when any zero
     |          or linearly dependent vectors are found.
     |
     |      Returns
     |      =======
     |
     |      list
     |          List of orthogonal (or orthonormal) basis vectors.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import I, Matrix
     |      >>> v = [Matrix([1, I]), Matrix([1, -I])]
     |      >>> Matrix.orthogonalize(*v)
     |      [Matrix([
     |      [1],
     |      [I]]), Matrix([
     |      [ 1],
     |      [-I]])]
     |
     |      See Also
     |      ========
     |
     |      MatrixBase.QRdecomposition
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixReductions:
     |
     |  echelon_form(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, simplify=False, with_pivots=False)
     |      Returns a matrix row-equivalent to ``M`` that is in echelon form. Note
     |      that echelon form of a matrix is *not* unique, however, properties like the
     |      row space and the null space are preserved.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2], [3, 4]])
     |      >>> M.echelon_form()
     |      Matrix([
     |      [1,  2],
     |      [0, -2]])
     |
     |  elementary_col_op(self, op='n->kn', col=None, k=None, col1=None, col2=None)
     |      Performs the elementary column operation `op`.
     |
     |      `op` may be one of
     |
     |          * "n->kn" (column n goes to k*n)
     |          * "n<->m" (swap column n and column m)
     |          * "n->n+km" (column n goes to column n + k*column m)
     |
     |      Parameters
     |      ==========
     |
     |      op : string; the elementary row operation
     |      col : the column to apply the column operation
     |      k : the multiple to apply in the column operation
     |      col1 : one column of a column swap
     |      col2 : second column of a column swap or column "m" in the column operation
     |             "n->n+km"
     |
     |  elementary_row_op(self, op='n->kn', row=None, k=None, row1=None, row2=None)
     |      Performs the elementary row operation `op`.
     |
     |      `op` may be one of
     |
     |          * "n->kn" (row n goes to k*n)
     |          * "n<->m" (swap row n and row m)
     |          * "n->n+km" (row n goes to row n + k*row m)
     |
     |      Parameters
     |      ==========
     |
     |      op : string; the elementary row operation
     |      row : the row to apply the row operation
     |      k : the multiple to apply in the row operation
     |      row1 : one row of a row swap
     |      row2 : second row of a row swap or row "m" in the row operation
     |             "n->n+km"
     |
     |  rank(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, simplify=False)
     |      Returns the rank of a matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> from sympy.abc import x
     |      >>> m = Matrix([[1, 2], [x, 1 - 1/x]])
     |      >>> m.rank()
     |      2
     |      >>> n = Matrix(3, 3, range(1, 10))
     |      >>> n.rank()
     |      2
     |
     |  rref(self, iszerofunc=<function _iszero at 0x7f71f39a9dd0>, simplify=False, pivots=True, normalize_last=True)
     |      Return reduced row-echelon form of matrix and indices of pivot vars.
     |
     |      Parameters
     |      ==========
     |
     |      iszerofunc : Function
     |          A function used for detecting whether an element can
     |          act as a pivot.  ``lambda x: x.is_zero`` is used by default.
     |
     |      simplify : Function
     |          A function used to simplify elements when looking for a pivot.
     |          By default SymPy's ``simplify`` is used.
     |
     |      pivots : True or False
     |          If ``True``, a tuple containing the row-reduced matrix and a tuple
     |          of pivot columns is returned.  If ``False`` just the row-reduced
     |          matrix is returned.
     |
     |      normalize_last : True or False
     |          If ``True``, no pivots are normalized to `1` until after all
     |          entries above and below each pivot are zeroed.  This means the row
     |          reduction algorithm is fraction free until the very last step.
     |          If ``False``, the naive row reduction procedure is used where
     |          each pivot is normalized to be `1` before row operations are
     |          used to zero above and below the pivot.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> from sympy.abc import x
     |      >>> m = Matrix([[1, 2], [x, 1 - 1/x]])
     |      >>> m.rref()
     |      (Matrix([
     |      [1, 0],
     |      [0, 1]]), (0, 1))
     |      >>> rref_matrix, rref_pivots = m.rref()
     |      >>> rref_matrix
     |      Matrix([
     |      [1, 0],
     |      [0, 1]])
     |      >>> rref_pivots
     |      (0, 1)
     |
     |      Notes
     |      =====
     |
     |      The default value of ``normalize_last=True`` can provide significant
     |      speedup to row reduction, especially on matrices with symbols.  However,
     |      if you depend on the form row reduction algorithm leaves entries
     |      of the matrix, set ``noramlize_last=False``
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.matrices.MatrixReductions:
     |
     |  is_echelon
     |      Returns `True` if the matrix is in echelon form. That is, all rows of
     |      zeros are at the bottom, and below each leading non-zero in a row are
     |      exclusively zeros.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.matrices.MatrixDeterminant:
     |
     |  adjugate(self, method='berkowitz')
     |      Returns the adjugate, or classical adjoint, of
     |      a matrix.  That is, the transpose of the matrix of cofactors.
     |
     |      https://en.wikipedia.org/wiki/Adjugate
     |
     |      Parameters
     |      ==========
     |
     |      method : string, optional
     |          Method to use to find the cofactors, can be "bareiss", "berkowitz" or
     |          "lu".
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2], [3, 4]])
     |      >>> M.adjugate()
     |      Matrix([
     |      [ 4, -2],
     |      [-3,  1]])
     |
     |      See Also
     |      ========
     |
     |      cofactor_matrix
     |      sympy.matrices.common.MatrixCommon.transpose
     |
     |  charpoly(self, x='lambda', simplify=<function simplify at 0x7f71f3b033b0>)
     |      Computes characteristic polynomial det(x*I - M) where I is
     |      the identity matrix.
     |
     |      A PurePoly is returned, so using different variables for ``x`` does
     |      not affect the comparison or the polynomials:
     |
     |      Parameters
     |      ==========
     |
     |      x : string, optional
     |          Name for the "lambda" variable, defaults to "lambda".
     |
     |      simplify : function, optional
     |          Simplification function to use on the characteristic polynomial
     |          calculated. Defaults to ``simplify``.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> from sympy.abc import x, y
     |      >>> M = Matrix([[1, 3], [2, 0]])
     |      >>> M.charpoly()
     |      PurePoly(lambda**2 - lambda - 6, lambda, domain='ZZ')
     |      >>> M.charpoly(x) == M.charpoly(y)
     |      True
     |      >>> M.charpoly(x) == M.charpoly(y)
     |      True
     |
     |      Specifying ``x`` is optional; a symbol named ``lambda`` is used by
     |      default (which looks good when pretty-printed in unicode):
     |
     |      >>> M.charpoly().as_expr()
     |      lambda**2 - lambda - 6
     |
     |      And if ``x`` clashes with an existing symbol, underscores will
     |      be prepended to the name to make it unique:
     |
     |      >>> M = Matrix([[1, 2], [x, 0]])
     |      >>> M.charpoly(x).as_expr()
     |      _x**2 - _x - 2*x
     |
     |      Whether you pass a symbol or not, the generator can be obtained
     |      with the gen attribute since it may not be the same as the symbol
     |      that was passed:
     |
     |      >>> M.charpoly(x).gen
     |      _x
     |      >>> M.charpoly(x).gen == x
     |      False
     |
     |      Notes
     |      =====
     |
     |      The Samuelson-Berkowitz algorithm is used to compute
     |      the characteristic polynomial efficiently and without any
     |      division operations.  Thus the characteristic polynomial over any
     |      commutative ring without zero divisors can be computed.
     |
     |      If the determinant det(x*I - M) can be found out easily as
     |      in the case of an upper or a lower triangular matrix, then
     |      instead of Samuelson-Berkowitz algorithm, eigenvalues are computed
     |      and the characteristic polynomial with their help.
     |
     |      See Also
     |      ========
     |
     |      det
     |
     |  cofactor(self, i, j, method='berkowitz')
     |      Calculate the cofactor of an element.
     |
     |      Parameters
     |      ==========
     |
     |      method : string, optional
     |          Method to use to find the cofactors, can be "bareiss", "berkowitz" or
     |          "lu".
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2], [3, 4]])
     |      >>> M.cofactor(0, 1)
     |      -3
     |
     |      See Also
     |      ========
     |
     |      cofactor_matrix
     |      minor
     |      minor_submatrix
     |
     |  cofactor_matrix(self, method='berkowitz')
     |      Return a matrix containing the cofactor of each element.
     |
     |      Parameters
     |      ==========
     |
     |      method : string, optional
     |          Method to use to find the cofactors, can be "bareiss", "berkowitz" or
     |          "lu".
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2], [3, 4]])
     |      >>> M.cofactor_matrix()
     |      Matrix([
     |      [ 4, -3],
     |      [-2,  1]])
     |
     |      See Also
     |      ========
     |
     |      cofactor
     |      minor
     |      minor_submatrix
     |
     |  det(self, method='bareiss', iszerofunc=None)
     |      Computes the determinant of a matrix if ``M`` is a concrete matrix object
     |      otherwise return an expressions ``Determinant(M)`` if ``M`` is a
     |      ``MatrixSymbol`` or other expression.
     |
     |      Parameters
     |      ==========
     |
     |      method : string, optional
     |          Specifies the algorithm used for computing the matrix determinant.
     |
     |          If the matrix is at most 3x3, a hard-coded formula is used and the
     |          specified method is ignored. Otherwise, it defaults to
     |          ``'bareiss'``.
     |
     |          Also, if the matrix is an upper or a lower triangular matrix, determinant
     |          is computed by simple multiplication of diagonal elements, and the
     |          specified method is ignored.
     |
     |          If it is set to ``'bareiss'``, Bareiss' fraction-free algorithm will
     |          be used.
     |
     |          If it is set to ``'berkowitz'``, Berkowitz' algorithm will be used.
     |
     |          Otherwise, if it is set to ``'lu'``, LU decomposition will be used.
     |
     |          .. note::
     |              For backward compatibility, legacy keys like "bareis" and
     |              "det_lu" can still be used to indicate the corresponding
     |              methods.
     |              And the keys are also case-insensitive for now. However, it is
     |              suggested to use the precise keys for specifying the method.
     |
     |      iszerofunc : FunctionType or None, optional
     |          If it is set to ``None``, it will be defaulted to ``_iszero`` if the
     |          method is set to ``'bareiss'``, and ``_is_zero_after_expand_mul`` if
     |          the method is set to ``'lu'``.
     |
     |          It can also accept any user-specified zero testing function, if it
     |          is formatted as a function which accepts a single symbolic argument
     |          and returns ``True`` if it is tested as zero and ``False`` if it
     |          tested as non-zero, and also ``None`` if it is undecidable.
     |
     |      Returns
     |      =======
     |
     |      det : Basic
     |          Result of determinant.
     |
     |      Raises
     |      ======
     |
     |      ValueError
     |          If unrecognized keys are given for ``method`` or ``iszerofunc``.
     |
     |      NonSquareMatrixError
     |          If attempted to calculate determinant from a non-square matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, eye, det
     |      >>> I3 = eye(3)
     |      >>> det(I3)
     |      1
     |      >>> M = Matrix([[1, 2], [3, 4]])
     |      >>> det(M)
     |      -2
     |      >>> det(M) == M.det()
     |      True
     |
     |  minor(self, i, j, method='berkowitz')
     |      Return the (i,j) minor of ``M``.  That is,
     |      return the determinant of the matrix obtained by deleting
     |      the `i`th row and `j`th column from ``M``.
     |
     |      Parameters
     |      ==========
     |
     |      i, j : int
     |          The row and column to exclude to obtain the submatrix.
     |
     |      method : string, optional
     |          Method to use to find the determinant of the submatrix, can be
     |          "bareiss", "berkowitz" or "lu".
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     |      >>> M.minor(1, 1)
     |      -12
     |
     |      See Also
     |      ========
     |
     |      minor_submatrix
     |      cofactor
     |      det
     |
     |  minor_submatrix(self, i, j)
     |      Return the submatrix obtained by removing the `i`th row
     |      and `j`th column from ``M`` (works with Pythonic negative indices).
     |
     |      Parameters
     |      ==========
     |
     |      i, j : int
     |          The row and column to exclude to obtain the submatrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     |      >>> M.minor_submatrix(1, 1)
     |      Matrix([
     |      [1, 3],
     |      [7, 9]])
     |
     |      See Also
     |      ========
     |
     |      minor
     |      cofactor
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.common.MatrixArithmetic:
     |
     |  __abs__(self)
     |      Returns a new matrix with entry-wise absolute values.
     |
     |  __add__(self, other)
     |      Return self + other, raising ShapeError if shapes don't match.
     |
     |  __matmul__(self, other)
     |
     |  __mod__(self, other)
     |
     |  __mul__(self, other)
     |      Return self*other where other is either a scalar or a matrix
     |      of compatible dimensions.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> A = Matrix([[1, 2, 3], [4, 5, 6]])
     |      >>> 2*A == A*2 == Matrix([[2, 4, 6], [8, 10, 12]])
     |      True
     |      >>> B = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     |      >>> A*B
     |      Matrix([
     |      [30, 36, 42],
     |      [66, 81, 96]])
     |      >>> B*A
     |      Traceback (most recent call last):
     |      ...
     |      ShapeError: Matrices size mismatch.
     |      >>>
     |
     |      See Also
     |      ========
     |
     |      matrix_multiply_elementwise
     |
     |  __neg__(self)
     |
     |  __pow__(self, exp)
     |      Return self**exp a scalar or symbol.
     |
     |  __radd__(self, other)
     |
     |  __rmatmul__(self, other)
     |
     |  __rmul__(self, other)
     |
     |  __rsub__(self, a)
     |
     |  __sub__(self, a)
     |
     |  __truediv__(self, other)
     |
     |  multiply(self, other, dotprodsimp=None)
     |      Same as __mul__() but with optional simplification.
     |
     |      Parameters
     |      ==========
     |
     |      dotprodsimp : bool, optional
     |          Specifies whether intermediate term algebraic simplification is used
     |          during matrix multiplications to control expression blowup and thus
     |          speed up calculation. Default is off.
     |
     |  multiply_elementwise(self, other)
     |      Return the Hadamard product (elementwise product) of A and B
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> A = Matrix([[0, 1, 2], [3, 4, 5]])
     |      >>> B = Matrix([[1, 10, 100], [100, 10, 1]])
     |      >>> A.multiply_elementwise(B)
     |      Matrix([
     |      [  0, 10, 200],
     |      [300, 40,   5]])
     |
     |      See Also
     |      ========
     |
     |      sympy.matrices.matrices.MatrixBase.cross
     |      sympy.matrices.matrices.MatrixBase.dot
     |      multiply
     |
     |  pow(self, exp, method=None)
     |      Return self**exp a scalar or symbol.
     |
     |      Parameters
     |      ==========
     |
     |      method : multiply, mulsimp, jordan, cayley
     |          If multiply then it returns exponentiation using recursion.
     |          If jordan then Jordan form exponentiation will be used.
     |          If cayley then the exponentiation is done using Cayley-Hamilton
     |          theorem.
     |          If mulsimp then the exponentiation is done using recursion
     |          with dotprodsimp. This specifies whether intermediate term
     |          algebraic simplification is used during naive matrix power to
     |          control expression blowup and thus speed up calculation.
     |          If None, then it heuristically decides which method to use.
     |
     |  rmultiply(self, other, dotprodsimp=None)
     |      Same as __rmul__() but with optional simplification.
     |
     |      Parameters
     |      ==========
     |
     |      dotprodsimp : bool, optional
     |          Specifies whether intermediate term algebraic simplification is used
     |          during matrix multiplications to control expression blowup and thus
     |          speed up calculation. Default is off.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.common.MatrixOperations:
     |
     |  adjoint(self)
     |      Conjugate transpose or Hermitian conjugation.
     |
     |  applyfunc(self, f)
     |      Apply a function to each element of the matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(2, 2, lambda i, j: i*2+j)
     |      >>> m
     |      Matrix([
     |      [0, 1],
     |      [2, 3]])
     |      >>> m.applyfunc(lambda i: 2*i)
     |      Matrix([
     |      [0, 2],
     |      [4, 6]])
     |
     |  as_real_imag(self, deep=True, **hints)
     |      Returns a tuple containing the (real, imaginary) part of matrix.
     |
     |  conjugate(self)
     |      Return the by-element conjugation.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import SparseMatrix
     |      >>> from sympy import I
     |      >>> a = SparseMatrix(((1, 2 + I), (3, 4), (I, -I)))
     |      >>> a
     |      Matrix([
     |      [1, 2 + I],
     |      [3,     4],
     |      [I,    -I]])
     |      >>> a.C
     |      Matrix([
     |      [ 1, 2 - I],
     |      [ 3,     4],
     |      [-I,     I]])
     |
     |      See Also
     |      ========
     |
     |      transpose: Matrix transposition
     |      H: Hermite conjugation
     |      sympy.matrices.matrices.MatrixBase.D: Dirac conjugation
     |
     |  doit(self, **kwargs)
     |
     |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)
     |      Apply evalf() to each element of self.
     |
     |  expand(self, deep=True, modulus=None, power_base=True, power_exp=True, mul=True, log=True, multinomial=True, basic=True, **hints)
     |      Apply core.function.expand to each entry of the matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.abc import x
     |      >>> from sympy.matrices import Matrix
     |      >>> Matrix(1, 1, [x*(x+1)])
     |      Matrix([[x*(x + 1)]])
     |      >>> _.expand()
     |      Matrix([[x**2 + x]])
     |
     |  n(self, *args, **kwargs)
     |      Apply evalf() to each element of self.
     |
     |  permute(self, perm, orientation='rows', direction='forward')
     |      Permute the rows or columns of a matrix by the given list of
     |      swaps.
     |
     |      Parameters
     |      ==========
     |
     |      perm : Permutation, list, or list of lists
     |          A representation for the permutation.
     |
     |          If it is ``Permutation``, it is used directly with some
     |          resizing with respect to the matrix size.
     |
     |          If it is specified as list of lists,
     |          (e.g., ``[[0, 1], [0, 2]]``), then the permutation is formed
     |          from applying the product of cycles. The direction how the
     |          cyclic product is applied is described in below.
     |
     |          If it is specified as a list, the list should represent
     |          an array form of a permutation. (e.g., ``[1, 2, 0]``) which
     |          would would form the swapping function
     |          `0 \mapsto 1, 1 \mapsto 2, 2\mapsto 0`.
     |
     |      orientation : 'rows', 'cols'
     |          A flag to control whether to permute the rows or the columns
     |
     |      direction : 'forward', 'backward'
     |          A flag to control whether to apply the permutations from
     |          the start of the list first, or from the back of the list
     |          first.
     |
     |          For example, if the permutation specification is
     |          ``[[0, 1], [0, 2]]``,
     |
     |          If the flag is set to ``'forward'``, the cycle would be
     |          formed as `0 \mapsto 2, 2 \mapsto 1, 1 \mapsto 0`.
     |
     |          If the flag is set to ``'backward'``, the cycle would be
     |          formed as `0 \mapsto 1, 1 \mapsto 2, 2 \mapsto 0`.
     |
     |          If the argument ``perm`` is not in a form of list of lists,
     |          this flag takes no effect.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import eye
     |      >>> M = eye(3)
     |      >>> M.permute([[0, 1], [0, 2]], orientation='rows', direction='forward')
     |      Matrix([
     |      [0, 0, 1],
     |      [1, 0, 0],
     |      [0, 1, 0]])
     |
     |      >>> from sympy.matrices import eye
     |      >>> M = eye(3)
     |      >>> M.permute([[0, 1], [0, 2]], orientation='rows', direction='backward')
     |      Matrix([
     |      [0, 1, 0],
     |      [0, 0, 1],
     |      [1, 0, 0]])
     |
     |      Notes
     |      =====
     |
     |      If a bijective function
     |      `\sigma : \mathbb{N}_0 \rightarrow \mathbb{N}_0` denotes the
     |      permutation.
     |
     |      If the matrix `A` is the matrix to permute, represented as
     |      a horizontal or a vertical stack of vectors:
     |
     |      .. math::
     |          A =
     |          \begin{bmatrix}
     |          a_0 \\ a_1 \\ \vdots \\ a_{n-1}
     |          \end{bmatrix} =
     |          \begin{bmatrix}
     |          \alpha_0 & \alpha_1 & \cdots & \alpha_{n-1}
     |          \end{bmatrix}
     |
     |      If the matrix `B` is the result, the permutation of matrix rows
     |      is defined as:
     |
     |      .. math::
     |          B := \begin{bmatrix}
     |          a_{\sigma(0)} \\ a_{\sigma(1)} \\ \vdots \\ a_{\sigma(n-1)}
     |          \end{bmatrix}
     |
     |      And the permutation of matrix columns is defined as:
     |
     |      .. math::
     |          B := \begin{bmatrix}
     |          \alpha_{\sigma(0)} & \alpha_{\sigma(1)} &
     |          \cdots & \alpha_{\sigma(n-1)}
     |          \end{bmatrix}
     |
     |  permute_cols(self, swaps, direction='forward')
     |      Alias for
     |      ``self.permute(swaps, orientation='cols', direction=direction)``
     |
     |      See Also
     |      ========
     |
     |      permute
     |
     |  permute_rows(self, swaps, direction='forward')
     |      Alias for
     |      ``self.permute(swaps, orientation='rows', direction=direction)``
     |
     |      See Also
     |      ========
     |
     |      permute
     |
     |  refine(self, assumptions=True)
     |      Apply refine to each element of the matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Symbol, Matrix, Abs, sqrt, Q
     |      >>> x = Symbol('x')
     |      >>> Matrix([[Abs(x)**2, sqrt(x**2)],[sqrt(x**2), Abs(x)**2]])
     |      Matrix([
     |      [ Abs(x)**2, sqrt(x**2)],
     |      [sqrt(x**2),  Abs(x)**2]])
     |      >>> _.refine(Q.real(x))
     |      Matrix([
     |      [  x**2, Abs(x)],
     |      [Abs(x),   x**2]])
     |
     |  replace(self, F, G, map=False, simultaneous=True, exact=None)
     |      Replaces Function F in Matrix entries with Function G.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import symbols, Function, Matrix
     |      >>> F, G = symbols('F, G', cls=Function)
     |      >>> M = Matrix(2, 2, lambda i, j: F(i+j)) ; M
     |      Matrix([
     |      [F(0), F(1)],
     |      [F(1), F(2)]])
     |      >>> N = M.replace(F,G)
     |      >>> N
     |      Matrix([
     |      [G(0), G(1)],
     |      [G(1), G(2)]])
     |
     |  rot90(self, k=1)
     |      Rotates Matrix by 90 degrees
     |
     |      Parameters
     |      ==========
     |
     |      k : int
     |          Specifies how many times the matrix is rotated by 90 degrees
     |          (clockwise when positive, counter-clockwise when negative).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, symbols
     |      >>> A = Matrix(2, 2, symbols('a:d'))
     |      >>> A
     |      Matrix([
     |      [a, b],
     |      [c, d]])
     |
     |      Rotating the matrix clockwise one time:
     |
     |      >>> A.rot90(1)
     |      Matrix([
     |      [c, a],
     |      [d, b]])
     |
     |      Rotating the matrix anticlockwise two times:
     |
     |      >>> A.rot90(-2)
     |      Matrix([
     |      [d, c],
     |      [b, a]])
     |
     |  subs(self, *args, **kwargs)
     |      Return a new matrix with subs applied to each entry.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.abc import x, y
     |      >>> from sympy.matrices import SparseMatrix, Matrix
     |      >>> SparseMatrix(1, 1, [x])
     |      Matrix([[x]])
     |      >>> _.subs(x, y)
     |      Matrix([[y]])
     |      >>> Matrix(_).subs(y, x)
     |      Matrix([[x]])
     |
     |  trace(self)
     |      Returns the trace of a square matrix i.e. the sum of the
     |      diagonal elements.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix(2, 2, [1, 2, 3, 4])
     |      >>> A.trace()
     |      5
     |
     |  transpose(self)
     |      Returns the transpose of the matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> A = Matrix(2, 2, [1, 2, 3, 4])
     |      >>> A.transpose()
     |      Matrix([
     |      [1, 3],
     |      [2, 4]])
     |
     |      >>> from sympy import Matrix, I
     |      >>> m=Matrix(((1, 2+I), (3, 4)))
     |      >>> m
     |      Matrix([
     |      [1, 2 + I],
     |      [3,     4]])
     |      >>> m.transpose()
     |      Matrix([
     |      [    1, 3],
     |      [2 + I, 4]])
     |      >>> m.T == m.transpose()
     |      True
     |
     |      See Also
     |      ========
     |
     |      conjugate: By-element conjugation
     |
     |  xreplace(self, rule)
     |      Return a new matrix with xreplace applied to each entry.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.abc import x, y
     |      >>> from sympy.matrices import SparseMatrix, Matrix
     |      >>> SparseMatrix(1, 1, [x])
     |      Matrix([[x]])
     |      >>> _.xreplace({x: y})
     |      Matrix([[y]])
     |      >>> Matrix(_).xreplace({y: x})
     |      Matrix([[x]])
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.common.MatrixOperations:
     |
     |  C
     |      By-element conjugation
     |
     |  H
     |      Return Hermite conjugate.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, I
     |      >>> m = Matrix((0, 1 + I, 2, 3))
     |      >>> m
     |      Matrix([
     |      [    0],
     |      [1 + I],
     |      [    2],
     |      [    3]])
     |      >>> m.H
     |      Matrix([[0, 1 - I, 2, 3]])
     |
     |      See Also
     |      ========
     |
     |      conjugate: By-element conjugation
     |      sympy.matrices.matrices.MatrixBase.D: Dirac conjugation
     |
     |  T
     |      Matrix transposition
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.common.MatrixProperties:
     |
     |  atoms(self, *types)
     |      Returns the atoms that form the current object.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.abc import x, y
     |      >>> from sympy.matrices import Matrix
     |      >>> Matrix([[x]])
     |      Matrix([[x]])
     |      >>> _.atoms()
     |      {x}
     |      >>> Matrix([[x, y], [y, x]])
     |      Matrix([
     |      [x, y],
     |      [y, x]])
     |      >>> _.atoms()
     |      {x, y}
     |
     |  has(self, *patterns)
     |      Test whether any subexpression matches any of the patterns.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, SparseMatrix, Float
     |      >>> from sympy.abc import x, y
     |      >>> A = Matrix(((1, x), (0.2, 3)))
     |      >>> B = SparseMatrix(((1, x), (0.2, 3)))
     |      >>> A.has(x)
     |      True
     |      >>> A.has(y)
     |      False
     |      >>> A.has(Float)
     |      True
     |      >>> B.has(x)
     |      True
     |      >>> B.has(y)
     |      False
     |      >>> B.has(Float)
     |      True
     |
     |  is_anti_symmetric(self, simplify=True)
     |      Check if matrix M is an antisymmetric matrix,
     |      that is, M is a square matrix with all M[i, j] == -M[j, i].
     |
     |      When ``simplify=True`` (default), the sum M[i, j] + M[j, i] is
     |      simplified before testing to see if it is zero. By default,
     |      the SymPy simplify function is used. To use a custom function
     |      set simplify to a function that accepts a single argument which
     |      returns a simplified expression. To skip simplification, set
     |      simplify to False but note that although this will be faster,
     |      it may induce false negatives.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, symbols
     |      >>> m = Matrix(2, 2, [0, 1, -1, 0])
     |      >>> m
     |      Matrix([
     |      [ 0, 1],
     |      [-1, 0]])
     |      >>> m.is_anti_symmetric()
     |      True
     |      >>> x, y = symbols('x y')
     |      >>> m = Matrix(2, 3, [0, 0, x, -y, 0, 0])
     |      >>> m
     |      Matrix([
     |      [ 0, 0, x],
     |      [-y, 0, 0]])
     |      >>> m.is_anti_symmetric()
     |      False
     |
     |      >>> from sympy.abc import x, y
     |      >>> m = Matrix(3, 3, [0, x**2 + 2*x + 1, y,
     |      ...                   -(x + 1)**2 , 0, x*y,
     |      ...                   -y, -x*y, 0])
     |
     |      Simplification of matrix elements is done by default so even
     |      though two elements which should be equal and opposite wouldn't
     |      pass an equality test, the matrix is still reported as
     |      anti-symmetric:
     |
     |      >>> m[0, 1] == -m[1, 0]
     |      False
     |      >>> m.is_anti_symmetric()
     |      True
     |
     |      If 'simplify=False' is used for the case when a Matrix is already
     |      simplified, this will speed things up. Here, we see that without
     |      simplification the matrix does not appear anti-symmetric:
     |
     |      >>> m.is_anti_symmetric(simplify=False)
     |      False
     |
     |      But if the matrix were already expanded, then it would appear
     |      anti-symmetric and simplification in the is_anti_symmetric routine
     |      is not needed:
     |
     |      >>> m = m.expand()
     |      >>> m.is_anti_symmetric(simplify=False)
     |      True
     |
     |  is_diagonal(self)
     |      Check if matrix is diagonal,
     |      that is matrix in which the entries outside the main diagonal are all zero.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, diag
     |      >>> m = Matrix(2, 2, [1, 0, 0, 2])
     |      >>> m
     |      Matrix([
     |      [1, 0],
     |      [0, 2]])
     |      >>> m.is_diagonal()
     |      True
     |
     |      >>> m = Matrix(2, 2, [1, 1, 0, 2])
     |      >>> m
     |      Matrix([
     |      [1, 1],
     |      [0, 2]])
     |      >>> m.is_diagonal()
     |      False
     |
     |      >>> m = diag(1, 2, 3)
     |      >>> m
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 2, 0],
     |      [0, 0, 3]])
     |      >>> m.is_diagonal()
     |      True
     |
     |      See Also
     |      ========
     |
     |      is_lower
     |      is_upper
     |      sympy.matrices.matrices.MatrixEigen.is_diagonalizable
     |      diagonalize
     |
     |  is_symbolic(self)
     |      Checks if any elements contain Symbols.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> from sympy.abc import x, y
     |      >>> M = Matrix([[x, y], [1, 0]])
     |      >>> M.is_symbolic()
     |      True
     |
     |  is_symmetric(self, simplify=True)
     |      Check if matrix is symmetric matrix,
     |      that is square matrix and is equal to its transpose.
     |
     |      By default, simplifications occur before testing symmetry.
     |      They can be skipped using 'simplify=False'; while speeding things a bit,
     |      this may however induce false negatives.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(2, 2, [0, 1, 1, 2])
     |      >>> m
     |      Matrix([
     |      [0, 1],
     |      [1, 2]])
     |      >>> m.is_symmetric()
     |      True
     |
     |      >>> m = Matrix(2, 2, [0, 1, 2, 0])
     |      >>> m
     |      Matrix([
     |      [0, 1],
     |      [2, 0]])
     |      >>> m.is_symmetric()
     |      False
     |
     |      >>> m = Matrix(2, 3, [0, 0, 0, 0, 0, 0])
     |      >>> m
     |      Matrix([
     |      [0, 0, 0],
     |      [0, 0, 0]])
     |      >>> m.is_symmetric()
     |      False
     |
     |      >>> from sympy.abc import x, y
     |      >>> m = Matrix(3, 3, [1, x**2 + 2*x + 1, y, (x + 1)**2 , 2, 0, y, 0, 3])
     |      >>> m
     |      Matrix([
     |      [         1, x**2 + 2*x + 1, y],
     |      [(x + 1)**2,              2, 0],
     |      [         y,              0, 3]])
     |      >>> m.is_symmetric()
     |      True
     |
     |      If the matrix is already simplified, you may speed-up is_symmetric()
     |      test by using 'simplify=False'.
     |
     |      >>> bool(m.is_symmetric(simplify=False))
     |      False
     |      >>> m1 = m.expand()
     |      >>> m1.is_symmetric(simplify=False)
     |      True
     |
     |  values(self)
     |      Return non-zero values of self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.common.MatrixProperties:
     |
     |  free_symbols
     |      Returns the free symbols within the matrix.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.abc import x
     |      >>> from sympy.matrices import Matrix
     |      >>> Matrix([[x], [1]]).free_symbols
     |      {x}
     |
     |  is_Identity
     |
     |  is_hermitian
     |      Checks if the matrix is Hermitian.
     |
     |      In a Hermitian matrix element i,j is the complex conjugate of
     |      element j,i.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> from sympy import I
     |      >>> from sympy.abc import x
     |      >>> a = Matrix([[1, I], [-I, 1]])
     |      >>> a
     |      Matrix([
     |      [ 1, I],
     |      [-I, 1]])
     |      >>> a.is_hermitian
     |      True
     |      >>> a[0, 0] = 2*I
     |      >>> a.is_hermitian
     |      False
     |      >>> a[0, 0] = x
     |      >>> a.is_hermitian
     |      >>> a[0, 1] = a[1, 0]*I
     |      >>> a.is_hermitian
     |      False
     |
     |  is_lower
     |      Check if matrix is a lower triangular matrix. True can be returned
     |      even if the matrix is not square.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(2, 2, [1, 0, 0, 1])
     |      >>> m
     |      Matrix([
     |      [1, 0],
     |      [0, 1]])
     |      >>> m.is_lower
     |      True
     |
     |      >>> m = Matrix(4, 3, [0, 0, 0, 2, 0, 0, 1, 4 , 0, 6, 6, 5])
     |      >>> m
     |      Matrix([
     |      [0, 0, 0],
     |      [2, 0, 0],
     |      [1, 4, 0],
     |      [6, 6, 5]])
     |      >>> m.is_lower
     |      True
     |
     |      >>> from sympy.abc import x, y
     |      >>> m = Matrix(2, 2, [x**2 + y, y**2 + x, 0, x + y])
     |      >>> m
     |      Matrix([
     |      [x**2 + y, x + y**2],
     |      [       0,    x + y]])
     |      >>> m.is_lower
     |      False
     |
     |      See Also
     |      ========
     |
     |      is_upper
     |      is_diagonal
     |      is_lower_hessenberg
     |
     |  is_lower_hessenberg
     |      Checks if the matrix is in the lower-Hessenberg form.
     |
     |      The lower hessenberg matrix has zero entries
     |      above the first superdiagonal.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> a = Matrix([[1, 2, 0, 0], [5, 2, 3, 0], [3, 4, 3, 7], [5, 6, 1, 1]])
     |      >>> a
     |      Matrix([
     |      [1, 2, 0, 0],
     |      [5, 2, 3, 0],
     |      [3, 4, 3, 7],
     |      [5, 6, 1, 1]])
     |      >>> a.is_lower_hessenberg
     |      True
     |
     |      See Also
     |      ========
     |
     |      is_upper_hessenberg
     |      is_lower
     |
     |  is_square
     |      Checks if a matrix is square.
     |
     |      A matrix is square if the number of rows equals the number of columns.
     |      The empty matrix is square by definition, since the number of rows and
     |      the number of columns are both zero.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> a = Matrix([[1, 2, 3], [4, 5, 6]])
     |      >>> b = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     |      >>> c = Matrix([])
     |      >>> a.is_square
     |      False
     |      >>> b.is_square
     |      True
     |      >>> c.is_square
     |      True
     |
     |  is_strongly_diagonally_dominant
     |      Tests if the matrix is row strongly diagonally dominant.
     |
     |      Explanation
     |      ===========
     |
     |      A $n, n$ matrix $A$ is row strongly diagonally dominant if
     |
     |      .. math::
     |          \left|A_{i, i}\right| > \sum_{j = 0, j \neq i}^{n-1}
     |          \left|A_{i, j}\right| \quad {\text{for all }}
     |          i \in \{ 0, ..., n-1 \}
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> A = Matrix([[3, -2, 1], [1, -3, 2], [-1, 2, 4]])
     |      >>> A.is_strongly_diagonally_dominant
     |      False
     |
     |      >>> A = Matrix([[-2, 2, 1], [1, 3, 2], [1, -2, 0]])
     |      >>> A.is_strongly_diagonally_dominant
     |      False
     |
     |      >>> A = Matrix([[-4, 2, 1], [1, 6, 2], [1, -2, 5]])
     |      >>> A.is_strongly_diagonally_dominant
     |      True
     |
     |      Notes
     |      =====
     |
     |      If you want to test whether a matrix is column diagonally
     |      dominant, you can apply the test after transposing the matrix.
     |
     |  is_upper
     |      Check if matrix is an upper triangular matrix. True can be returned
     |      even if the matrix is not square.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(2, 2, [1, 0, 0, 1])
     |      >>> m
     |      Matrix([
     |      [1, 0],
     |      [0, 1]])
     |      >>> m.is_upper
     |      True
     |
     |      >>> m = Matrix(4, 3, [5, 1, 9, 0, 4 , 6, 0, 0, 5, 0, 0, 0])
     |      >>> m
     |      Matrix([
     |      [5, 1, 9],
     |      [0, 4, 6],
     |      [0, 0, 5],
     |      [0, 0, 0]])
     |      >>> m.is_upper
     |      True
     |
     |      >>> m = Matrix(2, 3, [4, 2, 5, 6, 1, 1])
     |      >>> m
     |      Matrix([
     |      [4, 2, 5],
     |      [6, 1, 1]])
     |      >>> m.is_upper
     |      False
     |
     |      See Also
     |      ========
     |
     |      is_lower
     |      is_diagonal
     |      is_upper_hessenberg
     |
     |  is_upper_hessenberg
     |      Checks if the matrix is the upper-Hessenberg form.
     |
     |      The upper hessenberg matrix has zero entries
     |      below the first subdiagonal.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> a = Matrix([[1, 4, 2, 3], [3, 4, 1, 7], [0, 2, 3, 4], [0, 0, 1, 3]])
     |      >>> a
     |      Matrix([
     |      [1, 4, 2, 3],
     |      [3, 4, 1, 7],
     |      [0, 2, 3, 4],
     |      [0, 0, 1, 3]])
     |      >>> a.is_upper_hessenberg
     |      True
     |
     |      See Also
     |      ========
     |
     |      is_lower_hessenberg
     |      is_upper
     |
     |  is_weakly_diagonally_dominant
     |      Tests if the matrix is row weakly diagonally dominant.
     |
     |      Explanation
     |      ===========
     |
     |      A $n, n$ matrix $A$ is row weakly diagonally dominant if
     |
     |      .. math::
     |          \left|A_{i, i}\right| \ge \sum_{j = 0, j \neq i}^{n-1}
     |          \left|A_{i, j}\right| \quad {\text{for all }}
     |          i \in \{ 0, ..., n-1 \}
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> A = Matrix([[3, -2, 1], [1, -3, 2], [-1, 2, 4]])
     |      >>> A.is_weakly_diagonally_dominant
     |      True
     |
     |      >>> A = Matrix([[-2, 2, 1], [1, 3, 2], [1, -2, 0]])
     |      >>> A.is_weakly_diagonally_dominant
     |      False
     |
     |      >>> A = Matrix([[-4, 2, 1], [1, 6, 2], [1, -2, 5]])
     |      >>> A.is_weakly_diagonally_dominant
     |      True
     |
     |      Notes
     |      =====
     |
     |      If you want to test whether a matrix is column diagonally
     |      dominant, you can apply the test after transposing the matrix.
     |
     |  is_zero_matrix
     |      Checks if a matrix is a zero matrix.
     |
     |      A matrix is zero if every element is zero.  A matrix need not be square
     |      to be considered zero.  The empty matrix is zero by the principle of
     |      vacuous truth.  For a matrix that may or may not be zero (e.g.
     |      contains a symbol), this will be None
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, zeros
     |      >>> from sympy.abc import x
     |      >>> a = Matrix([[0, 0], [0, 0]])
     |      >>> b = zeros(3, 4)
     |      >>> c = Matrix([[0, 1], [0, 0]])
     |      >>> d = Matrix([])
     |      >>> e = Matrix([[x, 0], [0, 0]])
     |      >>> a.is_zero_matrix
     |      True
     |      >>> b.is_zero_matrix
     |      True
     |      >>> c.is_zero_matrix
     |      False
     |      >>> d.is_zero_matrix
     |      True
     |      >>> e.is_zero_matrix
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from sympy.matrices.common.MatrixSpecial:
     |
     |  companion(poly) from builtins.type
     |      Returns a companion matrix of a polynomial.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, Poly, Symbol, symbols
     |      >>> x = Symbol('x')
     |      >>> c0, c1, c2, c3, c4 = symbols('c0:5')
     |      >>> p = Poly(c0 + c1*x + c2*x**2 + c3*x**3 + c4*x**4 + x**5, x)
     |      >>> Matrix.companion(p)
     |      Matrix([
     |      [0, 0, 0, 0, -c0],
     |      [1, 0, 0, 0, -c1],
     |      [0, 1, 0, 0, -c2],
     |      [0, 0, 1, 0, -c3],
     |      [0, 0, 0, 1, -c4]])
     |
     |  diag(*args, strict=False, unpack=True, rows=None, cols=None, **kwargs) from builtins.type
     |      Returns a matrix with the specified diagonal.
     |      If matrices are passed, a block-diagonal matrix
     |      is created (i.e. the "direct sum" of the matrices).
     |
     |      kwargs
     |      ======
     |
     |      rows : rows of the resulting matrix; computed if
     |             not given.
     |
     |      cols : columns of the resulting matrix; computed if
     |             not given.
     |
     |      cls : class for the resulting matrix
     |
     |      unpack : bool which, when True (default), unpacks a single
     |      sequence rather than interpreting it as a Matrix.
     |
     |      strict : bool which, when False (default), allows Matrices to
     |      have variable-length rows.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix
     |      >>> Matrix.diag(1, 2, 3)
     |      Matrix([
     |      [1, 0, 0],
     |      [0, 2, 0],
     |      [0, 0, 3]])
     |
     |      The current default is to unpack a single sequence. If this is
     |      not desired, set `unpack=False` and it will be interpreted as
     |      a matrix.
     |
     |      >>> Matrix.diag([1, 2, 3]) == Matrix.diag(1, 2, 3)
     |      True
     |
     |      When more than one element is passed, each is interpreted as
     |      something to put on the diagonal. Lists are converted to
     |      matrices. Filling of the diagonal always continues from
     |      the bottom right hand corner of the previous item: this
     |      will create a block-diagonal matrix whether the matrices
     |      are square or not.
     |
     |      >>> col = [1, 2, 3]
     |      >>> row = [[4, 5]]
     |      >>> Matrix.diag(col, row)
     |      Matrix([
     |      [1, 0, 0],
     |      [2, 0, 0],
     |      [3, 0, 0],
     |      [0, 4, 5]])
     |
     |      When `unpack` is False, elements within a list need not all be
     |      of the same length. Setting `strict` to True would raise a
     |      ValueError for the following:
     |
     |      >>> Matrix.diag([[1, 2, 3], [4, 5], [6]], unpack=False)
     |      Matrix([
     |      [1, 2, 3],
     |      [4, 5, 0],
     |      [6, 0, 0]])
     |
     |      The type of the returned matrix can be set with the ``cls``
     |      keyword.
     |
     |      >>> from sympy.matrices import ImmutableMatrix
     |      >>> from sympy.utilities.misc import func_name
     |      >>> func_name(Matrix.diag(1, cls=ImmutableMatrix))
     |      'ImmutableDenseMatrix'
     |
     |      A zero dimension matrix can be used to position the start of
     |      the filling at the start of an arbitrary row or column:
     |
     |      >>> from sympy import ones
     |      >>> r2 = ones(0, 2)
     |      >>> Matrix.diag(r2, 1, 2)
     |      Matrix([
     |      [0, 0, 1, 0],
     |      [0, 0, 0, 2]])
     |
     |      See Also
     |      ========
     |      eye
     |      diagonal - to extract a diagonal
     |      .dense.diag
     |      .expressions.blockmatrix.BlockMatrix
     |      .sparsetools.banded - to create multi-diagonal matrices
     |
     |  eye(rows, cols=None, **kwargs) from builtins.type
     |      Returns an identity matrix.
     |
     |      Args
     |      ====
     |
     |      rows : rows of the matrix
     |      cols : cols of the matrix (if None, cols=rows)
     |
     |      kwargs
     |      ======
     |      cls : class of the returned matrix
     |
     |  jordan_block(size=None, eigenvalue=None, *, band='upper', **kwargs) from builtins.type
     |      Returns a Jordan block
     |
     |      Parameters
     |      ==========
     |
     |      size : Integer, optional
     |          Specifies the shape of the Jordan block matrix.
     |
     |      eigenvalue : Number or Symbol
     |          Specifies the value for the main diagonal of the matrix.
     |
     |          .. note::
     |              The keyword ``eigenval`` is also specified as an alias
     |              of this keyword, but it is not recommended to use.
     |
     |              We may deprecate the alias in later release.
     |
     |      band : 'upper' or 'lower', optional
     |          Specifies the position of the off-diagonal to put `1` s on.
     |
     |      cls : Matrix, optional
     |          Specifies the matrix class of the output form.
     |
     |          If it is not specified, the class type where the method is
     |          being executed on will be returned.
     |
     |      rows, cols : Integer, optional
     |          Specifies the shape of the Jordan block matrix. See Notes
     |          section for the details of how these key works.
     |
     |          .. note::
     |              This feature will be deprecated in the future.
     |
     |
     |      Returns
     |      =======
     |
     |      Matrix
     |          A Jordan block matrix.
     |
     |      Raises
     |      ======
     |
     |      ValueError
     |          If insufficient arguments are given for matrix size
     |          specification, or no eigenvalue is given.
     |
     |      Examples
     |      ========
     |
     |      Creating a default Jordan block:
     |
     |      >>> from sympy import Matrix
     |      >>> from sympy.abc import x
     |      >>> Matrix.jordan_block(4, x)
     |      Matrix([
     |      [x, 1, 0, 0],
     |      [0, x, 1, 0],
     |      [0, 0, x, 1],
     |      [0, 0, 0, x]])
     |
     |      Creating an alternative Jordan block matrix where `1` is on
     |      lower off-diagonal:
     |
     |      >>> Matrix.jordan_block(4, x, band='lower')
     |      Matrix([
     |      [x, 0, 0, 0],
     |      [1, x, 0, 0],
     |      [0, 1, x, 0],
     |      [0, 0, 1, x]])
     |
     |      Creating a Jordan block with keyword arguments
     |
     |      >>> Matrix.jordan_block(size=4, eigenvalue=x)
     |      Matrix([
     |      [x, 1, 0, 0],
     |      [0, x, 1, 0],
     |      [0, 0, x, 1],
     |      [0, 0, 0, x]])
     |
     |      Notes
     |      =====
     |
     |      .. note::
     |          This feature will be deprecated in the future.
     |
     |      The keyword arguments ``size``, ``rows``, ``cols`` relates to
     |      the Jordan block size specifications.
     |
     |      If you want to create a square Jordan block, specify either
     |      one of the three arguments.
     |
     |      If you want to create a rectangular Jordan block, specify
     |      ``rows`` and ``cols`` individually.
     |
     |      +--------------------------------+---------------------+
     |      |        Arguments Given         |     Matrix Shape    |
     |      +----------+----------+----------+----------+----------+
     |      |   size   |   rows   |   cols   |   rows   |   cols   |
     |      +==========+==========+==========+==========+==========+
     |      |   size   |         Any         |   size   |   size   |
     |      +----------+----------+----------+----------+----------+
     |      |          |        None         |     ValueError      |
     |      |          +----------+----------+----------+----------+
     |      |   None   |   rows   |   None   |   rows   |   rows   |
     |      |          +----------+----------+----------+----------+
     |      |          |   None   |   cols   |   cols   |   cols   |
     |      +          +----------+----------+----------+----------+
     |      |          |   rows   |   cols   |   rows   |   cols   |
     |      +----------+----------+----------+----------+----------+
     |
     |      References
     |      ==========
     |
     |      .. [1] https://en.wikipedia.org/wiki/Jordan_matrix
     |
     |  ones(rows, cols=None, **kwargs) from builtins.type
     |      Returns a matrix of ones.
     |
     |      Args
     |      ====
     |
     |      rows : rows of the matrix
     |      cols : cols of the matrix (if None, cols=rows)
     |
     |      kwargs
     |      ======
     |      cls : class of the returned matrix
     |
     |  zeros(rows, cols=None, **kwargs) from builtins.type
     |      Returns a matrix of zeros.
     |
     |      Args
     |      ====
     |
     |      rows : rows of the matrix
     |      cols : cols of the matrix (if None, cols=rows)
     |
     |      kwargs
     |      ======
     |      cls : class of the returned matrix
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.matrices.common.MatrixShaping:
     |
     |  col(self, j)
     |      Elementary column selector.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import eye
     |      >>> eye(2).col(0)
     |      Matrix([
     |      [1],
     |      [0]])
     |
     |      See Also
     |      ========
     |
     |      row
     |      sympy.matrices.dense.MutableDenseMatrix.col_op
     |      sympy.matrices.dense.MutableDenseMatrix.col_swap
     |      col_del
     |      col_join
     |      col_insert
     |
     |  col_del(self, col)
     |      Delete the specified column.
     |
     |  col_insert(self, pos, other)
     |      Insert one or more columns at the given column position.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import zeros, ones
     |      >>> M = zeros(3)
     |      >>> V = ones(3, 1)
     |      >>> M.col_insert(1, V)
     |      Matrix([
     |      [0, 1, 0, 0],
     |      [0, 1, 0, 0],
     |      [0, 1, 0, 0]])
     |
     |      See Also
     |      ========
     |
     |      col
     |      row_insert
     |
     |  col_join(self, other)
     |      Concatenates two matrices along self's last and other's first row.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import zeros, ones
     |      >>> M = zeros(3)
     |      >>> V = ones(1, 3)
     |      >>> M.col_join(V)
     |      Matrix([
     |      [0, 0, 0],
     |      [0, 0, 0],
     |      [0, 0, 0],
     |      [1, 1, 1]])
     |
     |      See Also
     |      ========
     |
     |      col
     |      row_join
     |
     |  diagonal(self, k=0)
     |      Returns the kth diagonal of self. The main diagonal
     |      corresponds to `k=0`; diagonals above and below correspond to
     |      `k > 0` and `k < 0`, respectively. The values of `self[i, j]`
     |      for which `j - i = k`, are returned in order of increasing
     |      `i + j`, starting with `i + j = |k|`.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(3, 3, lambda i, j: j - i); m
     |      Matrix([
     |      [ 0,  1, 2],
     |      [-1,  0, 1],
     |      [-2, -1, 0]])
     |      >>> _.diagonal()
     |      Matrix([[0, 0, 0]])
     |      >>> m.diagonal(1)
     |      Matrix([[1, 1]])
     |      >>> m.diagonal(-2)
     |      Matrix([[-2]])
     |
     |      Even though the diagonal is returned as a Matrix, the element
     |      retrieval can be done with a single index:
     |
     |      >>> Matrix.diag(1, 2, 3).diagonal()[1]  # instead of [0, 1]
     |      2
     |
     |      See Also
     |      ========
     |      diag - to create a diagonal matrix
     |
     |  extract(self, rowsList, colsList)
     |      Return a submatrix by specifying a list of rows and columns.
     |      Negative indices can be given. All indices must be in the range
     |      -n <= i < n where n is the number of rows or columns.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(4, 3, range(12))
     |      >>> m
     |      Matrix([
     |      [0,  1,  2],
     |      [3,  4,  5],
     |      [6,  7,  8],
     |      [9, 10, 11]])
     |      >>> m.extract([0, 1, 3], [0, 1])
     |      Matrix([
     |      [0,  1],
     |      [3,  4],
     |      [9, 10]])
     |
     |      Rows or columns can be repeated:
     |
     |      >>> m.extract([0, 0, 1], [-1])
     |      Matrix([
     |      [2],
     |      [2],
     |      [5]])
     |
     |      Every other row can be taken by using range to provide the indices:
     |
     |      >>> m.extract(range(0, m.rows, 2), [-1])
     |      Matrix([
     |      [2],
     |      [8]])
     |
     |      RowsList or colsList can also be a list of booleans, in which case
     |      the rows or columns corresponding to the True values will be selected:
     |
     |      >>> m.extract([0, 1, 2, 3], [True, False, True])
     |      Matrix([
     |      [0,  2],
     |      [3,  5],
     |      [6,  8],
     |      [9, 11]])
     |
     |  get_diag_blocks(self)
     |      Obtains the square sub-matrices on the main diagonal of a square matrix.
     |
     |      Useful for inverting symbolic matrices or solving systems of
     |      linear equations which may be decoupled by having a block diagonal
     |      structure.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> from sympy.abc import x, y, z
     |      >>> A = Matrix([[1, 3, 0, 0], [y, z*z, 0, 0], [0, 0, x, 0], [0, 0, 0, 0]])
     |      >>> a1, a2, a3 = A.get_diag_blocks()
     |      >>> a1
     |      Matrix([
     |      [1,    3],
     |      [y, z**2]])
     |      >>> a2
     |      Matrix([[x]])
     |      >>> a3
     |      Matrix([[0]])
     |
     |  reshape(self, rows, cols)
     |      Reshape the matrix. Total number of elements must remain the same.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m = Matrix(2, 3, lambda i, j: 1)
     |      >>> m
     |      Matrix([
     |      [1, 1, 1],
     |      [1, 1, 1]])
     |      >>> m.reshape(1, 6)
     |      Matrix([[1, 1, 1, 1, 1, 1]])
     |      >>> m.reshape(3, 2)
     |      Matrix([
     |      [1, 1],
     |      [1, 1],
     |      [1, 1]])
     |
     |  row(self, i)
     |      Elementary row selector.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import eye
     |      >>> eye(2).row(0)
     |      Matrix([[1, 0]])
     |
     |      See Also
     |      ========
     |
     |      col
     |      sympy.matrices.dense.MutableDenseMatrix.row_op
     |      sympy.matrices.dense.MutableDenseMatrix.row_swap
     |      row_del
     |      row_join
     |      row_insert
     |
     |  row_del(self, row)
     |      Delete the specified row.
     |
     |  row_insert(self, pos, other)
     |      Insert one or more rows at the given row position.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import zeros, ones
     |      >>> M = zeros(3)
     |      >>> V = ones(1, 3)
     |      >>> M.row_insert(1, V)
     |      Matrix([
     |      [0, 0, 0],
     |      [1, 1, 1],
     |      [0, 0, 0],
     |      [0, 0, 0]])
     |
     |      See Also
     |      ========
     |
     |      row
     |      col_insert
     |
     |  row_join(self, other)
     |      Concatenates two matrices along self's last and rhs's first column
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import zeros, ones
     |      >>> M = zeros(3)
     |      >>> V = ones(3, 1)
     |      >>> M.row_join(V)
     |      Matrix([
     |      [0, 0, 0, 1],
     |      [0, 0, 0, 1],
     |      [0, 0, 0, 1]])
     |
     |      See Also
     |      ========
     |
     |      row
     |      col_join
     |
     |  todok(self)
     |      Return the matrix as dictionary of keys.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> M = Matrix.eye(3)
     |      >>> M.todok()
     |      {(0, 0): 1, (1, 1): 1, (2, 2): 1}
     |
     |  tolist(self)
     |      Return the Matrix as a nested Python list.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix, ones
     |      >>> m = Matrix(3, 3, range(9))
     |      >>> m
     |      Matrix([
     |      [0, 1, 2],
     |      [3, 4, 5],
     |      [6, 7, 8]])
     |      >>> m.tolist()
     |      [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
     |      >>> ones(3, 0).tolist()
     |      [[], [], []]
     |
     |      When there are no rows then it will not be possible to tell how
     |      many columns were in the original matrix:
     |
     |      >>> ones(0, 3).tolist()
     |      []
     |
     |  vec(self)
     |      Return the Matrix converted into a one column matrix by stacking columns
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m=Matrix([[1, 3], [2, 4]])
     |      >>> m
     |      Matrix([
     |      [1, 3],
     |      [2, 4]])
     |      >>> m.vec()
     |      Matrix([
     |      [1],
     |      [2],
     |      [3],
     |      [4]])
     |
     |      See Also
     |      ========
     |
     |      vech
     |
     |  vech(self, diagonal=True, check_symmetry=True)
     |      Reshapes the matrix into a column vector by stacking the
     |      elements in the lower triangle.
     |
     |      Parameters
     |      ==========
     |
     |      diagonal : bool, optional
     |          If ``True``, it includes the diagonal elements.
     |
     |      check_symmetry : bool, optional
     |          If ``True``, it checks whether the matrix is symmetric.
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy import Matrix
     |      >>> m=Matrix([[1, 2], [2, 3]])
     |      >>> m
     |      Matrix([
     |      [1, 2],
     |      [2, 3]])
     |      >>> m.vech()
     |      Matrix([
     |      [1],
     |      [2],
     |      [3]])
     |      >>> m.vech(diagonal=False)
     |      Matrix([[2]])
     |
     |      Notes
     |      =====
     |
     |      This should work for symmetric matrices and ``vech`` can
     |      represent symmetric matrices in vector form with less size than
     |      ``vec``.
     |
     |      See Also
     |      ========
     |
     |      vec
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from sympy.matrices.common.MatrixShaping:
     |
     |  hstack(*args) from builtins.type
     |      Return a matrix formed by joining args horizontally (i.e.
     |      by repeated application of row_join).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> Matrix.hstack(eye(2), 2*eye(2))
     |      Matrix([
     |      [1, 0, 2, 0],
     |      [0, 1, 0, 2]])
     |
     |  vstack(*args) from builtins.type
     |      Return a matrix formed by joining args vertically (i.e.
     |      by repeated application of col_join).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import Matrix, eye
     |      >>> Matrix.vstack(eye(2), 2*eye(2))
     |      Matrix([
     |      [1, 0],
     |      [0, 1],
     |      [2, 0],
     |      [0, 2]])
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.common.MatrixShaping:
     |
     |  shape
     |      The shape (dimensions) of the matrix as the 2-tuple (rows, cols).
     |
     |      Examples
     |      ========
     |
     |      >>> from sympy.matrices import zeros
     |      >>> M = zeros(2, 3)
     |      >>> M.shape
     |      (2, 3)
     |      >>> M.rows
     |      2
     |      >>> M.cols
     |      3
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from sympy.matrices.common.MatrixRequired:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from sympy.matrices.common.MatrixRequired:
     |
     |  cols = None
     |
     |  rows = None
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from sympy.printing.defaults.Printable:
     |
     |  __repr__ = __str__(self)
     |      Return str(self).

# いまここ