18% performance boost by using pointer to address destination matrix A

release/4.3a0
Chris Beall 2009-12-11 23:59:37 +00:00
parent 631248f902
commit be10fc2a90
1 changed files with 6 additions and 2 deletions

View File

@ -345,8 +345,12 @@ weighted_eliminate(Matrix& A, Vector& b, const Vector& sigmas) {
for (int i=0;i<m;++i) { // update all rows
double ai = a(i);
b(i) -= ai*d;
for (int j2=j+1;j2<n;++j2) // limit to only columns in separator
A(i,j2) -= ai*r(j2);
double *Aptr = A.data().begin()+i*n+j+1;
for (int j2=j+1;j2<n;++j2){ // limit to only columns in separator
//A(i,j2) -= ai*r(j2);
*Aptr -= ai*r(j2);
Aptr++;
}
}
if (verbose) print(sub(A,0,m,j+1,n), "updated A");
if (verbose) print(b, "updated b ");