DoubleVector v = new DenseVector(vectorLength);
for (int i = 0; i < v.length(); ++i)
v.set(i, Math.random());
Matrix RinvData = (matrix instanceof SparseMatrix)
? new RowScaledSparseMatrix((SparseMatrix) matrix, Rinv)
: new RowScaledMatrix(matrix, Rinv);
// Make log(matrix.rows()) passes.
int log = (int) Statistics.log2(vectorLength);
for (int k = 0; k < log; ++k) {