// decoding process
final int Drows = Xrows;
final int Dcols = (D.length == 0) ? 0 : D[0].length;
final byte[][] DShallowCopy = Arrays.copyOf(D, D.length);
final ByteMatrix DM = new RowIndirected2DByteMatrix(Drows, Dcols, DShallowCopy, d);
for (int row = 0; row < Xrows; row++) {
// multiply X[row] by D
BasicByteVector prod = (BasicByteVector)X.multiplyRow(row, DM, 0, Xcols, LinearAlgebra.BASIC2D_FACTORY);
D[d[row]] = prod.getInternalArray();