qr.householder(w,A);
// SimpleMatrix U = new SimpleMatrix(width,1, true, qr.getQR()[w]).extractMatrix(w,width,0,1);
Matrix temp = Matrix.create(width,1);
temp.setElements(qr.getQR()[w]);
AStridedMatrix U = temp.subMatrix(w, width-w, 0, 1);
U.set(0,0,1); // this is not explicity set and is assumed to be 1
Matrix I = Matrix.createIdentity(width-w);
// SimpleMatrix Q = I.minus(U.mult(U.transpose()).scale(qr.getGamma()));
Matrix temp1 = Multiplications.multiply(U, U.getTranspose());
temp1.scale(qr.getGamma());
I.sub(temp1);
Matrix Q = I;
// check the expected properties of Q
assertTrue(Q.epsilonEquals(Q.getTranspose(),1e-6));
assertTrue(Q.epsilonEquals(Q.inverse(),1e-6));
// SimpleMatrix result = Q.mult(A.extractMatrix(w,width,w,width));
AStridedMatrix result = Multiplications.multiply(Q, A.subMatrix(w,width-w,w,width-w));
for( int i = 1; i < width-w; i++ ) {
assertEquals(0,result.get(i,0),1e-5);
}
}