DoubleMatrix.Dense(Int32, Int32) Method

Creates a dense DoubleMatrix instance having the specified size, and assigns zero to each matrix entry.

Definition

Namespace: Novacta.Analytics
Assembly: Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.1.0+428f3840cfab98dda567bb0ed350b302533e273a
C#
public static DoubleMatrix Dense(
	int numberOfRows,
	int numberOfColumns
)

Parameters

numberOfRows  Int32
The number of matrix rows.
numberOfColumns  Int32
The number of matrix columns.

Return Value

DoubleMatrix
The matrix having the specified size.

Remarks

DoubleMatrix dense instances allocate storage for each matrix entry. Sparse DoubleMatrix instances can be created by calling method Sparse(Int32, Int32, Int32).

Example

In the following example, a dense matrix is created having all its entries equal to zero.

Creation of a dense matrix with all entries equal to zero
using System;

namespace Novacta.Analytics.CodeExamples
{
    public class DenseExample5  
    {
        public void Main()
        {
            // Set matrix dimensions.
            int numberOfRows = 3;
            int numberOfColumns = 2;

            // Create the matrix. All entries will be equal to zero.
            var matrix = DoubleMatrix.Dense(
                numberOfRows, numberOfColumns);
            Console.WriteLine("Each entry is equal to zero.");
            Console.WriteLine("The data matrix:");
            Console.WriteLine(matrix);
        }
    }
}

// Executing method Main() produces the following output:
// 
// Each entry is equal to zero.
// The data matrix:
// 0                0                
// 0                0                
// 0                0                
// 
//

Exceptions

ArgumentOutOfRangeExceptionnumberOfRows is not positive.
-or-
numberOfColumns is not positive.

See Also