for( int width = 1; width <= r*3; width++ ) {
// System.out.println("width = "+width);
DenseMatrix64F A = RandomMatrices.createSymmetric(width,-1,1,rand);
BlockMatrix64F Ab = BlockMatrixOps.convert(A,r);
TridiagonalDecompositionHouseholderOrig decomp = new TridiagonalDecompositionHouseholderOrig();
decomp.decompose(A);
DenseMatrix64F expected = decomp.getQT();
TridiagonalDecompositionBlockHouseholder decompB = new TridiagonalDecompositionBlockHouseholder();
assertTrue(decompB.decompose(Ab));
// expected.print();
// Ab.print();
// see if the decomposed matrix is the same
for( int i = 0; i < width; i++ ) {
for( int j = i; j < width; j++ ) {
assertEquals(i+" "+j,expected.get(i,j),Ab.get(i,j),1e-8);
}
}
// check the gammas
for( int i = 0; i < width-1; i++ ) {
assertEquals(decomp.getGamma(i+1),decompB.gammas[i],1e-8);
}
DenseMatrix64F Q = decomp.getQ(null);
BlockMatrix64F Qb = decompB.getQ(null,false);
EjmlUnitTests.assertEquals(Q,Qb,1e-8);
}
}