# [SciPy-user] B-orthogonal complement of the null space of A

Nils Wagner nwagner@iam.uni-stuttgart...
Wed Jul 11 10:00:24 CDT 2007

```Anne Archibald wrote:
> On 06/07/07, Nils Wagner <nwagner@iam.uni-stuttgart.de> wrote:
>
>> Hi all,
>>
>> Consider  two symmetric matrices A and B, where B is positive definite
>> and A is positive semidefinite.
>> How can I compute the B-orthogonal complement of the null space of A
>> with scipy.linalg ?
>>
>
> Find the nullspace of A - which is numerically tricky, of course -
> using eig or svd; the B-orthogonal complement of a set of vectors is
> the nullspace of a rectangular matrix VB, where V has a row for each
> vector in the nullspace. svd should find that nullspace for you.
>
> This is not a particularly numerically stable operation. I suspect
> that the question itself is ill-conditioned, so that no algorithm can
> reliably solve it, but there may be a better approach. The svd is
> fairly reliable, though, and lets you make your own decisions about
> when a linear combination is zero enough.
>
> Anne
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
Hi Anne,

Thank you very much for your detailed information !
I have enclosed a small script (which is hopefully correct)
illustrating the computation of the B-orthogonal complement of the null
space of A for dense matrices.
How can I extend it to sparse matrices ? I mean what can be used instead
of linalg.qr and linalg.svd ?

Nils

```