#4789: numerically stable computation of nullspace of RDF/CDF matrices
------------------------------+---------------------------------------------
Reporter: jason | Owner: jason
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.3
Component: linear algebra | Keywords:
Work_issues: | Author:
Upstream: N/A | Reviewer:
Merged: |
------------------------------+---------------------------------------------
Changes (by was):
* upstream: => N/A
Comment:
Example:
{{{
sage: a = matrix(RDF,4,[1..16])*1.293949599304953485; a
[ 1.2939495993 2.58789919861 3.88184879791 5.17579839722]
[6.46974799652 7.76369759583 9.05764719513 10.3515967944]
[11.6455463937 12.939495993 14.2334455924 15.5273951917]
[ 16.821344791 18.1152943903 19.4092439896 20.7031935889]
sage: a.kernel()
Vector space of degree 4 and dimension 0 over Real Double Field
Basis matrix:
[]
}}}
Define this from the email linked to above:
{{{
import scipy
import scipy.linalg
def null(A, eps=1e-15):
"""
computes the null space of the real matrix A
"""
n, m = scipy.shape(A)
if n > m :
return scipy.transpose(null(scipy.transpose(A), eps))
return null(scipy.transpose(A), eps)
u, s, vh = scipy.linalg.svd(A)
s=scipy.append(s,scipy.zeros(m))[0:m]
null_mask = (s <= eps)
null_space = scipy.compress(null_mask, vh, axis=0)
return scipy.transpose(null_space)
}}}
Then:
{{{
sage: null(a.numpy(),eps=1e-13)
array([[-0.29797676, 0.45957573],
[ 0.73984987, -0.39066887],
[-0.58576946, -0.59738944],
[ 0.14389635, 0.52848258]])
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4789#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.