Table of Contents

Class MatrixProperties

Namespace
DotCompute.Algorithms
Assembly
DotCompute.Algorithms.dll

Matrix properties for adaptive algorithm selection.

public class MatrixProperties
Inheritance
MatrixProperties
Inherited Members

Remarks

Analyzes matrix characteristics to select optimal algorithms and kernel configurations. Properties include size, structure, and numerical conditioning information.

Used by adaptive kernel selection to choose between algorithms (e.g., sparse vs. dense, iterative vs. direct methods).

Properties

Columns

Gets or sets the number of columns in the matrix.

public int Columns { get; set; }

Property Value

int

Remarks

Number of columns (N dimension for M×N matrix).

ConditionNumber

Gets or sets the condition number of the matrix.

public float ConditionNumber { get; set; }

Property Value

float

Remarks

Condition number κ(A) = ||A|| × ||A^(-1)|| measures numerical sensitivity. Large values indicate ill-conditioned matrices prone to rounding errors.

Well-conditioned: κ < 100

Moderately conditioned: 100 < κ < 10^6

Ill-conditioned: κ > 10^6 (requires high-precision algorithms)

Action: High κ triggers iterative refinement or mixed-precision methods

IsPositiveDefinite

Gets or sets whether the matrix is positive-definite.

public bool IsPositiveDefinite { get; set; }

Property Value

bool

Remarks

True if symmetric and x^T A x > 0 for all x ≠ 0. Positive-definite matrices enable Cholesky decomposition (2x faster than LU).

Requirements: Must be symmetric first

Benefits: Cholesky is numerically stable and efficient

Applications: Least squares, optimization, covariance matrices

IsSymmetric

Gets or sets whether the matrix is symmetric.

public bool IsSymmetric { get; set; }

Property Value

bool

Remarks

True if A = A^T (symmetric). Symmetric matrices enable specialized algorithms (Cholesky, symmetric eigensolvers) with 2x speedup.

Storage: Only N(N+1)/2 elements need storing (50% savings)

Algorithms: Enables Lanczos, symmetric QR, Cholesky decomposition

RequiresHighPrecision

Gets or sets whether high precision computation is required.

public bool RequiresHighPrecision { get; set; }

Property Value

bool

Remarks

True if the matrix requires double-precision (FP64) computation due to ill-conditioning or numerical sensitivity. Automatically set when condition number exceeds threshold.

Trigger: Typically set when κ(A) > 10^6

Impact: Uses FP64 operations (slower on consumer GPUs)

Rows

Gets or sets the number of rows in the matrix.

public int Rows { get; set; }

Property Value

int

Remarks

Number of rows (M dimension for M×N matrix).

Size

Gets or sets the total matrix size in elements.

public long Size { get; set; }

Property Value

long

Remarks

Total number of elements (M × N for M×N matrix). Used to determine memory requirements and select between in-core and out-of-core algorithms.

Decision Threshold: > 100M elements may require out-of-core processing

SparsityRatio

Gets or sets the sparsity ratio (fraction of zero elements).

public float SparsityRatio { get; set; }

Property Value

float

Remarks

Ratio of zero elements to total elements (0.0 = dense, 1.0 = all zeros). Sparse matrices (> 0.9) benefit from specialized sparse algorithms.

Sparse Threshold: > 0.9 typically justifies sparse storage/algorithms

Storage Savings: CSR/CSC format reduces memory by (1 - sparsity) fraction