Click or drag to resize

DoubleMatrixRowIndex Property

Gets or sets the index of the DoubleMatrixRow.

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public int Index { get; set; }

Property Value

Type: Int32
The index of the DoubleMatrixRow.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionvalue is less than zero.
-or-
value is greater than or equal to the NumberOfRows of the matrix of which this instance represents a row.
Remarks

In a matrix, entries are arranged in rows and columns. Zero-based indexes are assigned to rows and columns, so that each entry can be identified by the indexes of the specific row and column on which it lies.

A DoubleMatrixRow instance represents a row of a DoubleMatrix. More thoroughly, since each DoubleMatrixRow is an item in a DoubleMatrixRowCollection, such matrix can be inspected by getting the Matrix property of the given collection.

Property Index is the zero-based index assigned to the row in that matrix.

Examples

In the following example, the Index of a DoubleMatrixRow is modified, and its XData property is evaluated before and after that change.

C#
using System;

namespace Novacta.Analytics.CodeExamples
{
    public class RowIndexDataExample0  
    { 
        public void Main()
        {
            // Create a matrix.
            var data = new double[12] {
                1, 5,  9,
                2, 6, 10,
                3, 7, 11,
                4, 8, 12
            };
            var matrix = DoubleMatrix.Dense(4, 3, data, StorageOrder.RowMajor);
            Console.WriteLine("Data matrix:");
            Console.WriteLine(matrix);
            Console.WriteLine();

            // Get the collection of matrix rows.
            var rows = matrix.AsRowCollection();

            // Set the column corresponding to property XData.
            rows.XDataColumn = 2;

            // Get the a row in the collection
            var firstRow = rows[1];

            // Get the XData value of the row.
            Console.WriteLine("XData for Row {0}: {1}", firstRow.Index, firstRow.XData);
            Console.WriteLine();

            // Change the index of the row.
            firstRow.Index = 3;

            // Here the row represents the matrix row having index 3.

            // Get the XData value of the first row.
            Console.WriteLine("XData for Row {0}: {1}", firstRow.Index, firstRow.XData);
            Console.WriteLine();
        }
    }
}

// Executing method Main() produces the following output:
// 
// Data matrix:
// 1                5                9                
// 2                6                10               
// 3                7                11               
// 4                8                12               
// 
// 
// 
// XData for Row 1: 10
// 
// XData for Row 3: 12

See Also