public MultiGate(Complex[,] elements, int numGates, Func <long, IUnitaryTransform> powFunc = null) { if (elements.GetLongLength(0) != elements.GetLongLength(1)) { throw new ArgumentException("Must be square matrix", nameof(elements)); } if (!elements.GetLongLength(0).IsPowerTwo()) { throw new ArgumentException("Must be power of 2"); } Dimension = elements.GetLongLength(0); NumQubits = (int)Math.Log(Dimension, 2); matrix = DenseMatrix.OfArray(elements); NumGates = numGates; this.powFunc = powFunc; }