Opened 12 years ago

# numerically stable computation of nullspace of RDF/CDF matrices

Reported by: Owned by: jason jason major linear algebra cpernet, slelievre N/A

### Description

I think this message might be useful:

### comment:1 Changed 12 years ago by jason

• Component changed from algebra to linear algebra
• Milestone set to sage-3.2.2
• Owner changed from tbd to jason
• Status changed from new to assigned

### comment:2 Changed 11 years ago by was

• Report Upstream set to N/A

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]
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]])
```

### comment:3 Changed 8 years ago by jdemeyer

• Milestone changed from sage-5.11 to sage-5.12

### comment:4 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

### comment:5 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

### comment:6 Changed 7 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4