Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Blog
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference
  • Extreme Optimization
    • Features
    • Solutions
    • Documentation
    • QuickStart Samples
    • Sample Applications
    • Downloads
    • Technical Support
    • Download trial
    • How to buy
    • Blog
    • Company
    • Resources
  • Documentation
    • Introduction
    • Deployment Guide
    • Nuget packages
    • Configuration
    • Using Parallelism
    • Mathematics Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Data Access Library User's Guide
    • Reference
  • Vector and Matrix Library User's Guide
    • Basic Concepts
    • Vectors
    • Matrices
    • Structured Matrix Types
    • Matrix Decompositions
    • Sparse Vectors and Matrices
    • Complex Linear Algebra
    • Single-Precision Linear Algebra
    • Distributed and GPU Computing
  • Matrices
    • Matrix Basics
    • Dense Matrices
    • Accessing Rows and Columns
    • Mathematical Properties
    • Operations on Matrices
    • Solving Systems Of Linear Equations
    • Solving Least Squares Problems
  • Mathematical Properties

Mathematical Properties

Extreme Optimization Numerical Libraries for .NET Professional
General properties

The RowCount and ColumnCount properties returns the number of rows and columns in the matrix.

The ElementOrder property specifies the order in which elements are stored. Possible values are ColumnMajor , RowMajor, and NotApplicable. These are enumerated by the MatrixElementOrder enumeration type.

ColumnMajor order means that, whenever possible, the elements in the same column of a matrix are stored in a contiguous block of memory. Likewise, RowMajor order means that elements in the same row are stored contiguously. Most algorithms have been optimized for column-major order. Conversions are performed as necessary.

For some matrix types, the element order is meaningless. In this case, the value is NotApplicable.

The ToArray method returns an array containing the elements of the matrix. The desired element order can be specified as a MatrixElementOrder value. The default is ColumnMajor. This method always returns a new array.

The following example illustrates these properties:

C#
VB
C++
F#
Copy
var m = Matrix.Create(2, 2, new[] { 1.0, 2.0, 4.0, 8.0 },
    MatrixElementOrder.RowMajor);
var rowCount = m.RowCount; // 2
var columnCount = m.ColumnCount; // 2
var elements = m.ToArray();
// elements -> { 1.0, 4.0, 2.0, 8.0 }
var elementsByRow = m.ToArray(MatrixElementOrder.RowMajor);
// elementsByRow -> { 1.0, 2.0, 4.0, 8.0 }
Dim m = Matrix.Create(2, 2, New Double() {1.0, 2.0, 4.0, 8.0},
    MatrixElementOrder.RowMajor)
Dim rowCount = m.RowCount ' 2
Dim columnCount = m.ColumnCount ' 2
Dim elements = m.ToArray()
' elements -> { 1.0, 4.0, 2.0, 8.0 }
Dim elementsByRow = m.ToArray(MatrixElementOrder.RowMajor)
' elementsByRow -> { 1.0, 2.0, 4.0, 8.0 }

No code example is currently available or this language may not be supported.

let m = Matrix.Create(2, 2, [| 1.0; 2.0; 4.0; 8.0 |],
            MatrixElementOrder.RowMajor)
let rowCount = m.RowCount // 2
let columnCount = m.ColumnCount // 2
let elements = m.ToArray()
// elements -> { 1.0, 4.0, 2.0, 8.0 }
let elementsByRow = m.ToArray(MatrixElementOrder.RowMajor)
// elementsByRow -> { 1.0, 2.0, 4.0, 8.0 }
Mathematical properties

Most common mathematical properties of matrices are costly to compute, in particular for large matrices. Because of this, these properties have been implemented as methods.

The norm of a matrix is a measure for the size of a matrix. Unlike vector norms, matrix norms are often hard to calculate. The easiest to calculate is the Frobenius-norm, defined as the square root of the sum of the squares of the elements of a matrix. The FrobeniusNorm method returns the Frobenius norm.

The one-norm of a matrix is defined as the maximum of the sum of the absolute values of the elements in each column. It is available through the OneNorm method.

The infinity-norm of a matrix is defined as the maximum of the sum of the absolute values of the elements in each row. It is available through the InfinityNorm method.

The two-norm of a matrix is defined as the largest increase in the length (two-norm) of a vector when it is multiplied by the matrix. This corresponds to the largest singular value of the matrix. It is available through the TwoNorm method.

The trace of a matrix is the sum of the diagonal elements. It is available through the Trace method.

C#
VB
C++
F#
Copy
var m = Matrix.Create(2, 2, new[] { 1.0, 2.0, 4.0, 8.0 },
    MatrixElementOrder.RowMajor);
var rowCount = m.RowCount; // 2
var columnCount = m.ColumnCount; // 2
var elements = m.ToArray();
// elements -> { 1.0, 4.0, 2.0, 8.0 }
var elementsByRow = m.ToArray(MatrixElementOrder.RowMajor);
// elementsByRow -> { 1.0, 2.0, 4.0, 8.0 }
Dim m = Matrix.Create(2, 2, New Double() {1.0, 2.0, 4.0, 8.0},
    MatrixElementOrder.RowMajor)
Dim rowCount = m.RowCount ' 2
Dim columnCount = m.ColumnCount ' 2
Dim elements = m.ToArray()
' elements -> { 1.0, 4.0, 2.0, 8.0 }
Dim elementsByRow = m.ToArray(MatrixElementOrder.RowMajor)
' elementsByRow -> { 1.0, 2.0, 4.0, 8.0 }

No code example is currently available or this language may not be supported.

let m = Matrix.Create(2, 2, [| 1.0; 2.0; 4.0; 8.0 |],
            MatrixElementOrder.RowMajor)
let rowCount = m.RowCount // 2
let columnCount = m.ColumnCount // 2
let elements = m.ToArray()
// elements -> { 1.0, 4.0, 2.0, 8.0 }
let elementsByRow = m.ToArray(MatrixElementOrder.RowMajor)
// elementsByRow -> { 1.0, 2.0, 4.0, 8.0 }

Other properties, such as the inverse, transpose, and determinant are covered in the section on Solving Systems Of Linear Equations.

Copyright (c) 2004-2021 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2021, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.