[SciPy-user] Type handling of matrices

Gary Ruben gazzar at email.com
Wed Nov 10 19:09:27 EST 2004


Hi Nils,
How about transposing and subtracting it?

>>> a=array([[1,2,3],[2,1,4],[3,4,1]])
>>> a
array([[1, 2, 3],
       [2, 1, 4],
       [3, 4, 1]])
>>> b=transpose(a)
>>> b
array([[1, 2, 3],
       [2, 1, 4],
       [3, 4, 1]])
>>> a-b
array([[0, 0, 0],
       [0, 0, 0],
       [0, 0, 0]])


Alternatively, maybe you could sum along each axis of your matrix and compare the results?
eg.

>>> c=sum(a)
>>> d=sum(a,1)
>>> c
array([6, 7, 8])
>>> d
array([6, 7, 8])
>>> c-d
array([0, 0, 0])

I'm not sure whether there might be cases where this could falsely identify a matrix as symmetric - you'll have to have a think about this.
Gary R.

----- Original Message -----
> 
> Hi all,
> 
> Is it currently possible (by a built-in function)  to verify whether a 
> matrix
> is symmetric or not.  I am  also interested in a
> built-in function for verifying the definiteness of a matrix ?
> 
> Any suggestion or comment ?
> 
> Nils

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




More information about the SciPy-User mailing list