// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.pqc.crypto.mldsa;

class PolyVecL
{
    private final Poly[] vec;
    
    PolyVecL(final MLDSAEngine mldsaEngine) {
        final int dilithiumL = mldsaEngine.getDilithiumL();
        this.vec = new Poly[dilithiumL];
        for (int i = 0; i < dilithiumL; ++i) {
            this.vec[i] = new Poly(mldsaEngine);
        }
    }
    
    public PolyVecL() throws Exception {
        throw new Exception("Requires Parameter");
    }
    
    public Poly getVectorIndex(final int n) {
        return this.vec[n];
    }
    
    void uniformBlocks(final byte[] array, final int n) {
        for (int i = 0; i < this.vec.length; ++i) {
            this.vec[i].uniformBlocks(array, (short)(n + i));
        }
    }
    
    public void uniformEta(final byte[] array, final short n) {
        short n2 = n;
        for (int i = 0; i < this.vec.length; ++i) {
            final Poly vectorIndex = this.getVectorIndex(i);
            final short n3 = n2;
            ++n2;
            vectorIndex.uniformEta(array, n3);
        }
    }
    
    void copyTo(final PolyVecL polyVecL) {
        for (int i = 0; i < this.vec.length; ++i) {
            this.vec[i].copyTo(polyVecL.vec[i]);
        }
    }
    
    public void polyVecNtt() {
        for (int i = 0; i < this.vec.length; ++i) {
            this.vec[i].polyNtt();
        }
    }
    
    public void uniformGamma1(final byte[] array, final short n) {
        for (int i = 0; i < this.vec.length; ++i) {
            this.getVectorIndex(i).uniformGamma1(array, (short)(this.vec.length * n + i));
        }
    }
    
    public void pointwisePolyMontgomery(final Poly poly, final PolyVecL polyVecL) {
        for (int i = 0; i < this.vec.length; ++i) {
            this.getVectorIndex(i).pointwiseMontgomery(poly, polyVecL.getVectorIndex(i));
        }
    }
    
    public void invNttToMont() {
        for (int i = 0; i < this.vec.length; ++i) {
            this.getVectorIndex(i).invNttToMont();
        }
    }
    
    public void addPolyVecL(final PolyVecL polyVecL) {
        for (int i = 0; i < this.vec.length; ++i) {
            this.getVectorIndex(i).addPoly(polyVecL.getVectorIndex(i));
        }
    }
    
    public void reduce() {
        for (int i = 0; i < this.vec.length; ++i) {
            this.getVectorIndex(i).reduce();
        }
    }
    
    public boolean checkNorm(final int n) {
        for (int i = 0; i < this.vec.length; ++i) {
            if (this.getVectorIndex(i).checkNorm(n)) {
                return true;
            }
        }
        return false;
    }
    
    @Override
    public String toString() {
        String str = "\n[";
        for (int i = 0; i < this.vec.length; ++i) {
            str = str + "Inner Matrix " + i + " " + this.getVectorIndex(i).toString();
            if (i != this.vec.length - 1) {
                str += ",\n";
            }
        }
        return str + "]";
    }
    
    public String toString(final String str) {
        return str + ": " + this.toString();
    }
}
