[SciPy-user] Type handling of matrices

Pearu Peterson pearu at scipy.org
Thu Nov 11 02:44:40 CST 2004



On Thu, 11 Nov 2004, Nils Wagner wrote:

> Gary Ruben wrote:
>
>> Hi Nils,
>> How about transposing and subtracting it?
>> 
>> 
> That's the definition of a real symmetric matrix 
> A = transpose(A)
>
> In case of complex matrices we have
>
> A = conj(transpose(A))
>
> I am looking for a built-in function
>
> A.issym
>
> which returns
> 1 if  A is hermitian
> 0 if A is non-hermitian
>
> How about similar functions for
>
> A.issingular (singular from a numerical point of view)
> A.isspd (symmetric positive definite) This might be useful with respect to 
> iterative solvers. AFAIK linalg.cg is restricted to spd matrices.
> A.isindefinite

Methods (not attributes) A.is<property> can be defined for sparse 
matrices, in fact, sparse.spmatrix should take advantage of using
these properties.

For full matrices, is<property> must probably be a function as we cannot
change Numeric of numarray in this way (unless we subclass Matrix). They 
can be implemented in scipy_base/matrix_base.py, for instance.

<property> = symmetric | hermitian | singular | positive | negative
              | nonnegative | nonpositive

All these predicate functions must have optional tolerance
argument to take into account numerical errors that accumulate
when computing eigenvalues..

Pearu



More information about the SciPy-user mailing list