Opened 12 years ago

Last modified 2 years ago

#4789 new enhancement

numerically stable computation of nullspace of RDF/CDF matrices

Reported by: jason Owned by: jason
Priority: major Milestone:
Component: linear algebra Keywords:
Cc: cpernet, slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Change History (8)

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

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

comment:7 Changed 2 years ago by slelievre

  • Cc cpernet slelievre added
  • Milestone changed from sage-6.4 to sage-8.8

comment:8 Changed 2 years ago by embray

  • Milestone sage-8.8 deleted

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

Note: See TracTickets for help on using tickets.