Encog.MathUtil.Matrices.Matrix.FromPackedArray C# (CSharp) Method

FromPackedArray() public method

Take the values of thie matrix from a packed array.
public FromPackedArray ( double array, int index ) : int
array double The packed array to read the matrix from.
index int The index to begin reading at in the array.
return int
        public int FromPackedArray(double[] array, int index)
        {
            for (int r = 0; r < Rows; r++)
            {
                for (int c = 0; c < Cols; c++)
                {
                    matrix[r][c] = array[index++];
                }
            }

            return index;
        }

Usage Example

Exemplo n.º 1
0
        public void PackedArray2()
        {
            double[] data   = { 1.0, 2.0, 3.0, 4.0 };
            var      matrix = new Matrix(1, 4);

            matrix.FromPackedArray(data, 0);
            Assert.AreEqual(1.0, matrix[0, 0]);
            Assert.AreEqual(2.0, matrix[0, 1]);
            Assert.AreEqual(3.0, matrix[0, 2]);
        }
All Usage Examples Of Encog.MathUtil.Matrices.Matrix::FromPackedArray