for( int width = 1; width <= 3*r; width++ ) {
// System.out.println("width "+width);
int end = width;
SimpleMatrix A = SimpleMatrix.random(r,width,-1,1,rand);
SimpleMatrix B = SimpleMatrix.random(r,width,-1,1,rand);
BlockMatrix64F Ab = BlockMatrixOps.convert(A.getMatrix(),r);
BlockMatrix64F Bb = BlockMatrixOps.convert(B.getMatrix(),r);
BlockMatrix64F Cb = Ab.copy();
// turn A into householder vectors
for( int i = 0; i < A.numRows(); i++ ) {
for( int j = 0; j <= i; j++ ) {
if( A.isInBounds(i,j))
A.set(i,j,0);
}
if( A.isInBounds(i,i+1) )
A.set(i,i+1,1);
}
SimpleMatrix a = A.extractVector(true,rowA).scale(alpha);
SimpleMatrix b = B.extractVector(true,rowB).scale(beta);
SimpleMatrix c = a.plus(b);
BlockHouseHolder.add_row(r,
new D1Submatrix64F(Ab),rowA, alpha,
new D1Submatrix64F(Bb),rowB, beta ,
new D1Submatrix64F(Cb),rowC, 1,end);
// skip over the zeros
for( int j = rowA+1; j < end; j++ ) {
assertEquals(c.get(j), Cb.get(rowC,j),1e-8);
}
}
}