/usr/include/openturns/swig/SquareMatrix_doc.i is in libopenturns-dev 1.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | %feature("docstring") OT::SquareMatrix
"Real square matrix.
Parameters
----------
size : int, :math:`n > 0`, optional
Matrix size.
Default is 1.
values : sequence of float with size :math:`n^2`, optional
Values. OpenTURNS uses **column-major** ordering (like Fortran) for
reshaping the flat list of values.
Default creates a zero matrix.
Examples
--------
Create a matrix
>>> import openturns as ot
>>> M = ot.SquareMatrix(2, range(2 * 2))
>>> print(M)
[[ 0 2 ]
[ 1 3 ]]
Get or set terms
>>> print(M[0, 0])
0.0
>>> M[0, 0] = 1.
>>> print(M[0, 0])
1.0
>>> print(M[:, 0])
[[ 1 ]
[ 1 ]]
Create an openturns matrix from a **square** numpy 2d-array (or matrix, or
2d-list)...
>>> import numpy as np
>>> np_2d_array = np.array([[1., 2.], [3., 4.]])
>>> ot_matrix = ot.SquareMatrix(np_2d_array)
and back
>>> np_matrix = np.matrix(ot_matrix)
Basic linear algebra operations (provided the dimensions are compatible)
>>> A = ot.Matrix([[1., 2.], [3., 4.], [5., 6.]])
>>> B = ot.SquareMatrix(np.eye(2))
>>> C = ot.Matrix(3, 2, [1.] * 3 * 2)
>>> print(A * B - C)
[[ 0 1 ]
[ 2 3 ]
[ 4 5 ]]
>>> A = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> print(A ** 2)
[[ 7 10 ]
[ 15 22 ]]"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::computeDeterminant
"Compute the determinant.
Parameters
----------
keep_intact : bool, optional
A flag telling whether the present matrix can be overwritten or not.
Default is *True* and leaves the present matrix unchanged.
Returns
-------
determinant : float
The square matrix determinant.
Examples
--------
>>> import openturns as ot
>>> A = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> A.computeDeterminant()
-2.0"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::computeEigenValues
"Compute eigen values.
Parameters
----------
keep_intact : bool, optional
A flag telling whether the present matrix can be overwritten or not.
Default is *True* and leaves the present matrix unchanged.
Returns
-------
eigenvalues : :class:`~openturns.NumericalComplexCollection`
Eigen values.
See Also
--------
computeEV
Examples
--------
>>> import openturns as ot
>>> M = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> M.computeEigenValues()
[(-0.372281,0),(5.37228,0)]"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::computeEV
"Compute the eigen values decomposition (EVD).
The eigen values decomposition of a square matrix :math:`\\\\mat{M}` with
size :math:`n` reads:
.. math::
\\\\mat{M} = \\\\mat{\\\\Phi} \\\\mat{\\\\Lambda} \\\\mat{\\\\Phi}^{-1}
where :math:`\\\\mat{\\\\Lambda}` is an :math:`n \\\\times n` diagonal matrix and
:math:`\\\\mat{\\\\Phi}` is an :math:`n \\\\times n` orthogonal matrix.
Parameters
----------
keep_intact : bool, optional
A flag telling whether the present matrix can be overwritten or not.
Default is *True* and leaves the present matrix unchanged.
Returns
-------
eigen_values : :class:`~openturns.NumericalComplexCollection`
The vector of eigen values with size :math:`n` that form the diagonal of
the :math:`n \\\\times n` matrix :math:`\\\\mat{\\\\Lambda}` of the EVD.
Phi : :class:`~openturns.SquareComplexMatrix`
The left matrix of the EVD.
Notes
-----
This uses LAPACK'S `DGEEV <http://www.netlib.org/lapack/lapack-3.1.1/html/dgeev.f.html>`_.
Examples
--------
>>> import openturns as ot
>>> import numpy as np
>>> M = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> eigen_values, Phi = M.computeEV()
>>> Lambda = ot.SquareComplexMatrix(M.getDimension())
>>> for i in range(eigen_values.getSize()):
... Lambda[i, i] = eigen_values[i]
>>> from scipy.linalg import inv # SquareComplexMatrix does not implement solveLinearSystem
>>> Phi, Lambda = np.matrix(Phi), np.matrix(Lambda)
>>> np.testing.assert_array_almost_equal(Phi * Lambda * inv(Phi), M)"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::computeLogAbsoluteDeterminant
"Compute the logarithm of the absolute value of the determinant.
Parameters
----------
keep_intact : bool, optional
A flag telling whether the present matrix can be overwritten or not.
Default is *True* and leaves the present matrix unchanged.
Returns
-------
determinant : float
The logarithm of the absolute value of the square matrix determinant.
sign : float
The sign of the determinant.
Examples
--------
>>> import openturns as ot
>>> A = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> A.computeLogAbsoluteDeterminant()
[0.693147..., -1.0]"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::getDimension
"Accessor to the dimension (the number of rows).
Returns
-------
dimension : int"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::isDiagonal
"Test whether the matrix is diagonal or not.
Returns
-------
test : bool
Answer."
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::solveLinearSystem
"Solve a square linear system whose the present matrix is the operator.
Parameters
----------
rhs : sequence of float or :class:`~openturns.Matrix` with :math:`n_r` values or rows, respectively
The right hand side member of the linear system.
keep_intact : bool, optional
A flag telling whether the present matrix can be overwritten or not.
Default is *True* and leaves the present matrix unchanged.
Returns
-------
solution : :class:`~openturns.NumericalPoint` or :class:`~openturns.Matrix`
The solution of the square linear system.
Notes
-----
This will handle both matrices and vectors. Note that you'd better type
explicitely the matrix if it has some properties that could simplify the
resolution (see :class:`~openturns.TriangularMatrix`).
This uses LAPACK'S `DGESV <http://www.netlib.org/lapack/lapack-3.1.1/html/dgesv.f.html>`_
for matrices and `DGELSY <http://www.netlib.org/lapack/lapack-3.1.1/html/dgelsy.f.html>`_
for vectors.
Examples
--------
>>> import openturns as ot
>>> import numpy as np
>>> M = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> b = ot.NumericalPoint([1.] * 2)
>>> x = M.solveLinearSystem(b)
>>> np.testing.assert_array_almost_equal(M * x, b)"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::transpose
"Transpose the matrix.
Returns
-------
MT : :class:`~openturns.SquareMatrix`
The transposed matrix.
Examples
--------
>>> import openturns as ot
>>> M = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> print(M)
[[ 1 2 ]
[ 3 4 ]]
>>> print(M.transpose())
[[ 1 3 ]
[ 2 4 ]]"
// ---------------------------------------------------------------------
%feature("docstring") OT::SquareMatrix::computeTrace
"Compute the trace of the matrix.
Returns
-------
trace : float
The trace of the matrix.
Examples
--------
>>> import openturns as ot
>>> M = ot.SquareMatrix([[1., 2.], [3., 4.]])
>>> M.computeTrace()
5.0"
|