public void applyReflectorsToRow() {
// try different offsets to make sure there are no implicit assumptions
for( int offX = 0; offX <= r; offX += r) {
for( int offY = 0; offY <= r; offY += r) {
SimpleMatrix A = SimpleMatrix.random(2*r+2,2*r+2,-1,1,rand);
A = A.mult(A.transpose());
SimpleMatrix A_orig = A.copy();
SimpleMatrix V = SimpleMatrix.random(r,A.numCols(),-1,1,rand);
D1Submatrix64F Ab = insertIntoBlock(offY,offX,A,r);
D1Submatrix64F Vb = insertIntoBlock(0,offX,V,r);
int row = r-1;
// manually apply "reflectors" to A
for( int i = 0; i < row; i++ ) {
SimpleMatrix u = A_orig.extractVector(true,i).transpose();
SimpleMatrix v = V.extractVector(true,i).transpose();
for( int j = 0; j <= i; j++ ) {
u.set(j,0.0);
}
u.set(i+1,1.0);
A = A.plus(u.mult(v.transpose())).plus(v.mult(u.transpose()));
}
// apply the reflector to that row
TridiagonalBlockHelper.applyReflectorsToRow(r,Ab,Vb,row);
// compare to manually computed solution