Developer
Jul 28, 2014 at 6:16 PM

Hi,
I've changed two lines of code in SparseCholesky.cs file and I've got about 10% higher speed in cholesky factorization.
Here is the details:
// Original Code
// Triangular solve
for (; top < n; top++) // solve L(0:k1,0:k1) * x = C(:,k)
{
i = s[top]; // s [top..n1] is pattern of L(k,:)
lki = x[i] / lx[lp[i]]; // L(k,i) = x (i) / L(i,i)
x[i] = 0; // clear x for k+1st iteration
for (p = lp[i] + 1; p < c[i]; p++)
{
x[li[p]] = lx[p] * lki;
}
d = lki * lki; // d = d  L(k,i)*L(k,i)
p = c[i]++;
li[p] = k; // store L(k,i) in column i
lx[p] = lki;
}
// Edited Code
// Triangular solve
for (; top < n; top++) // solve L(0:k1,0:k1) * x = C(:,k)
{
i = s[top]; // s [top..n1] is pattern of L(k,:)
lki = x[i] / lx[lp[i]]; // L(k,i) = x (i) / L(i,i)
x[i] = 0; // clear x for k+1st iteration
var ci2 = c[i];
for (p = lp[i] + 1; p < ci2; p++)
{
x[li[p]] = lx[p] * lki;
}
d = lki * lki; // d = d  L(k,i)*L(k,i)
p = c[i]++;
li[p] = k; // store L(k,i) in column i
lx[p] = lki;
}
Thanx


Coordinator
Jul 28, 2014 at 7:08 PM

Thanks. There are surely other places where optimizations like this could be done. One might argue that the compiler should be clever enough ...
Anyways, I've updated the code. Would you be interested in joining this project as a developer?


Developer
Jul 29, 2014 at 6:18 AM

Hi,
Yes, I would like to join the project but I am not so familiar with sparse matrix operations. However know a little about profiling and performance optimizations of numerical codes in C#.

