Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new matrix with the specified number of rows and columns
 /// </summary>
 /// <param name="numRows"> number of rows </param>
 /// <param name="numCols"> number of columns </param>
 public ZMatrixRMaj(int numRows, int numCols)
 {
     UtilEjml.checkTooLargeComplex(numRows, numCols);
     this.numRows = numRows;
     this.numCols = numCols;
     this.data    = new double[numRows * numCols * 2];
 }
Ejemplo n.º 2
0
        public override void reshape(int numRows, int numCols)
        {
            UtilEjml.checkTooLargeComplex(numRows, numCols);
            int newLength = numRows * numCols * 2;

            if (newLength > data.Count())
            {
                data = new double[newLength];
            }

            this.numRows = numRows;
            this.numCols = numCols;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <para>
        /// Creates a matrix with the values and shape defined by the 2D array 'data'.
        /// It is assumed that 'data' has a row-major formatting:<br>
        /// <br>
        /// data[ row ][ column ]
        /// </para>
        /// </summary>
        /// <param name="data"> 2D array representation of the matrix. Not modified. </param>
        public ZMatrixRMaj(double[][] data)
        {
            this.numRows = data.Length;
            this.numCols = data[0].Length / 2;

            UtilEjml.checkTooLargeComplex(numRows, numCols);

            this.data = new double[numRows * numCols * 2];

            for (int i = 0; i < numRows; i++)
            {
                double[] row = data[i];
                if (row.Length != numCols * 2)
                {
                    throw new System.ArgumentException("Unexpected row size in input data at row " + i);
                }

                Array.Copy(row, 0, this.data, i * numCols * 2, row.Length);
            }
        }