CodePlexProject Hosting for Open Source Software

2

Closed

Singular Value Decomposition

I miss the method for solving a*x = b, similar to LU and Cholesky decomposition. Unfortunately I am a beginner in C# and I have helped myself with a solution from Numerical Recipes:

Best Regards,

MetaNumKL

I miss the method for solving a*x = b, similar to LU and Cholesky decomposition. Unfortunately I am a beginner in C# and I have helped myself with a solution from Numerical Recipes:

```
SingularValueDecomposition SVD = a.SingularValueDecomposition();
for (k = 0; k < n; k++)
{
w[k] = SVD.SingularValue(k);
}
U = SVD.LeftTransformMatrix();
V = SVD.RightTransformMatrix();
thresh = -1.0;
if (thresh <= 0.0)
{
thresh = 0.5 * Math.Sqrt(m + n + 1.0) * w[0] * eps;
//Console.WriteLine(thresh);
}
for (j = 0; j < n; j++)
{
s = 0.0;
if (w[j] > thresh)
{
for (i = 0; i < m; i++)
{
s += U[i, j] * b[i];
}
s /= w[j];
}
tmp[j] = s;
}
for (j = 0; j < n; j++)
{
s = 0.0;
for (jj = 0; jj < n; jj++)
{
s += V[j, jj] * tmp[jj];
}
x[j] = s;
}
```

Would it not make sense to include a –of course probably better- solution method into Meta Numerics.Best Regards,

MetaNumKL

No files are attached

## comments

wrote Dec 22, 2016 at 9:18 AM

MetaNumKL wrote Dec 22, 2016 at 12:16 PM

why has this thread be closed without giving an answer? Even if the question was stupid, any answer would have been helpful (and polite).

Best regards,

KL

MetaNumKL wrote Jan 4 at 10:19 AM

Don't you have the feeling that your behavior towards a customer of Meta Numerics is rather strange?

Why should it not be discussed to extend Meta Numerics' SVD class by a solver method? Or have I overlooked something in the documentation?

As I said before, Numerical Recipes (NR) offers it. It was not too difficult to convert NR's C++ solution for SVD to C# ( For my project I have a license for using programs from NR). This converted version works and my solution shown above together with the SVD class from Meta Numerics works as well. Am I completely wrong that such a solution is one of the standard applications for SVD?

Best regards,

KL