Click or drag to resize

ComplexMatrixRowIndex Property

Gets or sets the index of the ComplexMatrixRow.

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 ComplexMatrixRow.
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 ComplexMatrixRow instance represents a row of a ComplexMatrix. More thoroughly, since each ComplexMatrixRow is an item in a ComplexMatrixRowCollection, 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 ComplexMatrixRow is modified, and its XData property is evaluated before and after that change.

C#
using System;
using System.Numerics;

namespace Novacta.Analytics.CodeExamples
{
    public class ComplexRowIndexDataExample0  
    {
        public void Main()
        {
            // Create a matrix.
            var data = new Complex[8] {
                new Complex(1, -1), new Complex(5, -5),
                new Complex(2, -2), new Complex(6, -6),
                new Complex(3, -3), new Complex(7, -7),
                new Complex(4, -4), new Complex(8, -8)
            };
            var matrix = ComplexMatrix.Dense(4, 2, 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 = 1;

            // 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,               -1) (                5,               -5) 
// (                2,               -2) (                6,               -6) 
// (                3,               -3) (                7,               -7) 
// (                4,               -4) (                8,               -8) 
// 
// 
// 
// XData for Row 1: (6, -6)
// 
// XData for Row 3: (8, -8)

See Also