Vous êtes un professionnel et vous avez besoin d'une formation ?
Programmation Python
Les compléments
Voir le programme détaillé
Module « scipy.linalg »
Signature de la fonction issymmetric
def issymmetric(a, atol=None, rtol=None)
Description
help(scipy.linalg.issymmetric)
issymmetric(a, atol=None, rtol=None)
Check if a square 2D array is symmetric.
Parameters
----------
a : ndarray
Input array of size (N, N).
atol : float, optional
Absolute error bound
rtol : float, optional
Relative error bound
Returns
-------
sym : bool
Returns True if the array symmetric.
Raises
------
TypeError
If the dtype of the array is not supported, in particular, NumPy
float16, float128 and complex256 dtypes for exact comparisons.
See Also
--------
ishermitian : Check if a square 2D array is Hermitian
Notes
-----
For square empty arrays the result is returned True by convention. Complex
valued arrays are tested for symmetricity and not for being Hermitian (see
examples)
The diagonal of the array is not scanned. Thus if there are infs, NaNs or
similar problematic entries on the diagonal, they will be ignored. However,
`numpy.inf` will be treated as a number, that is to say ``[[1, inf],
[inf, 2]]`` will return ``True``. On the other hand `numpy.nan` is never
symmetric, say, ``[[1, nan], [nan, 2]]`` will return ``False``.
When ``atol`` and/or ``rtol`` are set to , then the comparison is performed
by `numpy.allclose` and the tolerance values are passed to it. Otherwise an
exact comparison against zero is performed by internal functions. Hence
performance can improve or degrade depending on the size and dtype of the
array. If one of ``atol`` or ``rtol`` given the other one is automatically
set to zero.
Examples
--------
>>> import numpy as np
>>> from scipy.linalg import issymmetric
>>> A = np.arange(9).reshape(3, 3)
>>> A = A + A.T
>>> issymmetric(A)
True
>>> Ac = np.array([[1. + 1.j, 3.j], [3.j, 2.]])
>>> issymmetric(Ac) # not Hermitian but symmetric
True
Vous êtes un professionnel et vous avez besoin d'une formation ?
Programmation Python
Les fondamentaux
Voir le programme détaillé
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :