DoubleMatrixDense Method (Int32, Int32, Double) |
Namespace: Novacta.Analytics
Exception | Condition |
---|---|
ArgumentOutOfRangeException | numberOfRows is not positive. -or- numberOfColumns is not positive. |
DoubleMatrix dense instances allocate storage for each matrix entry. Sparse DoubleMatrix instances can be created by calling method Sparse(Int32, Int32, Int32).
In the following example, a dense matrix is created having all its entries equal to a given value.
using System; namespace Novacta.Analytics.CodeExamples { public class DenseExample4 { public void Main() { // Set matrix dimensions. int numberOfRows = 3; int numberOfColumns = 2; // Set the value for each entry. double data = -1.0; // Create the matrix. All entries will be equal to the // same value. var matrix = DoubleMatrix.Dense( numberOfRows, numberOfColumns, data); Console.WriteLine("Each entry is equal to the same value."); Console.WriteLine("The data matrix:"); Console.WriteLine(matrix); } } } // Executing method Main() produces the following output: // // Each entry is equal to the same value. // The data matrix: // -1 -1 // -1 -1 // -1 -1 //