package org.bouncycastle.pqc.crypto.mldsa;

/* JADX INFO: loaded from: classes.dex */
class PolyVecMatrix {
    private final PolyVecL[] matrix;

    PolyVecMatrix(MLDSAEngine mLDSAEngine) {
        int dilithiumK = mLDSAEngine.getDilithiumK();
        this.matrix = new PolyVecL[dilithiumK];
        for (int i = 0; i < dilithiumK; i++) {
            this.matrix[i] = new PolyVecL(mLDSAEngine);
        }
    }

    private String addString() {
        String string = "[";
        int i = 0;
        while (i < this.matrix.length) {
            String str = (string + "Outer Matrix " + i + " [") + this.matrix[i].toString();
            string = (i == this.matrix.length + (-1) ? new StringBuilder().append(str).append("]\n") : new StringBuilder().append(str).append("],\n")).toString();
            i++;
        }
        return string + "]\n";
    }

    public void expandMatrix(byte[] bArr) {
        for (int i = 0; i < this.matrix.length; i++) {
            this.matrix[i].uniformBlocks(bArr, i << 8);
        }
    }

    public void pointwiseMontgomery(PolyVecK polyVecK, PolyVecL polyVecL) {
        for (int i = 0; i < this.matrix.length; i++) {
            polyVecK.getVectorIndex(i).pointwiseAccountMontgomery(this.matrix[i], polyVecL);
        }
    }

    public String toString(String str) {
        return str.concat(": \n" + addString());
    }
}
