Table of Contents

Class DenseSolver

Namespace
NVMathNet.Solver
Assembly
NVMath.Net.dll

Stateless helpers for cuSOLVER dense operations: LU, Cholesky, SVD, eigenvalue decomposition, and QR factorisation. All matrices use column-major layout.

public static class DenseSolver

Inheritance

Inherited Members

Methods

CholeskyAsync(DeviceBuffer<Complex>, int, bool, CudaStream?, CancellationToken)

Cholesky factorisation of a Hermitian positive-definite matrix, in place. Throws System.InvalidOperationException if the matrix is not positive definite.

public static Task CholeskyAsync(DeviceBuffer<Complex> a, int n, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer for the n×n matrix (overwritten with the factor).

n int

Order of the matrix.

upper bool

Compute the upper factor instead of the lower.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

CholeskyAsync(DeviceBuffer<float>, int, bool, CudaStream?, CancellationToken)

Computes the Cholesky factorisation of a symmetric positive-definite matrix (single-precision). A is overwritten with the factor L (lower) or U (upper).

public static Task CholeskyAsync(DeviceBuffer<float> a, int n, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<float>

Device buffer for n×n SPD matrix A (overwritten).

n int

Order of the matrix.

upper bool

If true, compute upper factor; otherwise lower.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

CholeskyAsync(DeviceBuffer<double>, int, bool, CudaStream?, CancellationToken)

Computes the Cholesky factorisation (double-precision).

public static Task CholeskyAsync(DeviceBuffer<double> a, int n, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<double>
n int
upper bool
stream CudaStream?
ct CancellationToken

Returns

Task

CholeskyBatchedAsync(DeviceBuffer<Complex>, int, int, bool, CudaStream?, CancellationToken)

Cholesky factorisation of a batch of independent Hermitian positive-definite matrices, packed back-to-back.

public static Task<int[]> CholeskyBatchedAsync(DeviceBuffer<Complex> a, int n, int batchCount, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer of batchCount·n·n elements; each matrix is overwritten with its factor.

n int

Order of each matrix.

batchCount int

Number of matrices.

upper bool

Compute the upper factor instead of the lower.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int[]>

Per-matrix status: 0 = success; a positive value means the matrix is not positive definite.

CholeskyBatchedAsync<T>(DeviceBuffer<T>, int, int, bool, CudaStream?, CancellationToken)

Cholesky factorisation of a batch of independent symmetric positive-definite matrices, stored back-to-back (matrix i starts at element i·n·n). Each matrix is overwritten with its factor.

public static Task<int[]> CholeskyBatchedAsync<T>(DeviceBuffer<T> a, int n, int batchCount, bool upper = false, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer of batchCount·n·n elements.

n int

Order of each matrix.

batchCount int

Number of matrices.

upper bool

Compute the upper factor instead of the lower.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int[]>

Per-matrix status: 0 = success; a positive value means the matrix is not positive definite.

Type Parameters

T

EigAsync(DeviceBuffer<float>, DeviceBuffer<float>, int, bool, bool, CudaStream?, CancellationToken)

Computes eigenvalues (and optionally eigenvectors) of a symmetric matrix (single-precision). A is overwritten with eigenvectors (if requested); W receives eigenvalues in ascending order.

public static Task EigAsync(DeviceBuffer<float> a, DeviceBuffer<float> w, int n, bool computeVectors = true, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<float>

Device buffer for n×n symmetric matrix A (overwritten with eigenvectors if computeVectors=true).

w DeviceBuffer<float>

Device buffer for n eigenvalues.

n int

Order of the matrix.

computeVectors bool

If true, compute eigenvectors in A.

upper bool

If true, read upper triangle; otherwise lower.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

EigAsync(DeviceBuffer<double>, DeviceBuffer<double>, int, bool, bool, CudaStream?, CancellationToken)

Computes eigenvalues (and optionally eigenvectors) of a symmetric matrix (double-precision).

public static Task EigAsync(DeviceBuffer<double> a, DeviceBuffer<double> w, int n, bool computeVectors = true, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<double>
w DeviceBuffer<double>
n int
computeVectors bool
upper bool
stream CudaStream?
ct CancellationToken

Returns

Task

HermitianEigAsync(DeviceBuffer<Complex>, DeviceBuffer<double>, int, bool, bool, CudaStream?, CancellationToken)

Eigenvalue decomposition of a Hermitian matrix: eigenvalues (real, ascending) in w and, if requested, orthonormal eigenvectors overwriting a.

public static Task HermitianEigAsync(DeviceBuffer<Complex> a, DeviceBuffer<double> w, int n, bool computeVectors = true, bool upper = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer for the n×n Hermitian matrix.

w DeviceBuffer<double>

Device buffer of n real eigenvalues (output).

n int

Order of the matrix.

computeVectors bool

Whether to compute eigenvectors.

upper bool

Whether the upper triangle is referenced instead of the lower.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

LeastSquaresAsync(DeviceBuffer<Complex>, DeviceBuffer<Complex>, int, int, int, CudaStream?, CancellationToken)

Solves the overdetermined least-squares problem min ‖A·X − B‖₂ via QR (m ≥ n, A of full column rank).

public static Task LeastSquaresAsync(DeviceBuffer<Complex> a, DeviceBuffer<Complex> b, int m, int n, int nrhs = 1, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer for the m×n matrix A; overwritten with its QR factorisation.

b DeviceBuffer<Complex>

Device buffer for the m×nrhs right-hand sides (leading dimension m). On return the first n rows of each column hold the solution; the remaining rows hold the transformed residual.

m int

Number of rows of A.

n int

Number of columns of A (≤ m).

nrhs int

Number of right-hand sides.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

LeastSquaresAsync<T>(DeviceBuffer<T>, DeviceBuffer<T>, int, int, int, CudaStream?, CancellationToken)

Solves the overdetermined least-squares problem min ‖A·X − B‖₂ via QR (m ≥ n, A of full column rank).

public static Task LeastSquaresAsync<T>(DeviceBuffer<T> a, DeviceBuffer<T> b, int m, int n, int nrhs = 1, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer for the m×n matrix A; overwritten with its QR factorisation.

b DeviceBuffer<T>

Device buffer for the m×nrhs right-hand sides (leading dimension m). On return the first n rows of each column hold the solution; the remaining rows hold the transformed residual.

m int

Number of rows of A.

n int

Number of columns of A (≤ m).

nrhs int

Number of right-hand sides.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

Type Parameters

T

LuFactorAsync(DeviceBuffer<Complex>, DeviceBuffer<int>, int, int, CudaStream?, CancellationToken)

Computes the LU factorisation with partial pivoting P·A = L·U in place.

public static Task<int> LuFactorAsync(DeviceBuffer<Complex> a, DeviceBuffer<int> ipiv, int m, int n, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer for the m×n matrix A; overwritten with the L\U factors.

ipiv DeviceBuffer<int>

Device buffer of min(m, n) pivot indices (output).

m int

Number of rows.

n int

Number of columns.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int>

0 on success; a positive value i means U(i,i) is exactly zero (A is singular).

LuFactorAsync<T>(DeviceBuffer<T>, DeviceBuffer<int>, int, int, CudaStream?, CancellationToken)

Computes the LU factorisation with partial pivoting P·A = L·U in place.

public static Task<int> LuFactorAsync<T>(DeviceBuffer<T> a, DeviceBuffer<int> ipiv, int m, int n, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer for the m×n matrix A; overwritten with the L\U factors.

ipiv DeviceBuffer<int>

Device buffer of min(m, n) pivot indices (output).

m int

Number of rows.

n int

Number of columns.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int>

0 on success; a positive value i means U(i,i) is exactly zero (A is singular).

Type Parameters

T

LuFactorBatchedAsync<T>(DeviceBuffer<T>, DeviceBuffer<int>, int, int, CudaStream?, CancellationToken)

LU factorisation with partial pivoting of a batch of independent n×n matrices, in place.

public static Task<int[]> LuFactorBatchedAsync<T>(DeviceBuffer<T> a, DeviceBuffer<int> ipiv, int n, int batchCount, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer of batchCount·n·n elements; overwritten with the L\U factors.

ipiv DeviceBuffer<int>

Device buffer of batchCount·n pivot indices (output).

n int

Order of each matrix.

batchCount int

Number of matrices.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int[]>

Per-matrix status: 0 = success; a positive value i means U(i,i) is exactly zero.

Type Parameters

T

LuFactorBatchedAsync(DeviceBuffer<Complex>, DeviceBuffer<int>, int, int, CudaStream?, CancellationToken)

LU factorisation with partial pivoting of a batch of independent complex n×n matrices, in place.

public static Task<int[]> LuFactorBatchedAsync(DeviceBuffer<Complex> a, DeviceBuffer<int> ipiv, int n, int batchCount, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer of batchCount·n·n elements; overwritten with the L\U factors.

ipiv DeviceBuffer<int>

Device buffer of batchCount·n pivot indices (output).

n int

Order of each matrix.

batchCount int

Number of matrices.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int[]>

Per-matrix status: 0 = success; a positive value i means U(i,i) is exactly zero.

LuSolveAsync(DeviceBuffer<Complex>, DeviceBuffer<int>, DeviceBuffer<Complex>, int, int, bool, CudaStream?, CancellationToken)

Solves op(A)·X = B from a complex LU factorisation, where op is the identity or, with transpose, the plain transpose. Use the overload with a conjugate argument for the conjugate transpose.

public static Task LuSolveAsync(DeviceBuffer<Complex> a, DeviceBuffer<int> ipiv, DeviceBuffer<Complex> b, int n, int nrhs = 1, bool transpose = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer holding the n×n L\U factors.

ipiv DeviceBuffer<int>

Pivot indices from the factorisation.

b DeviceBuffer<Complex>

Device buffer for the n×nrhs right-hand sides; overwritten with the solution.

n int

Order of A.

nrhs int

Number of right-hand sides.

transpose bool

Solve with the transpose of A.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

LuSolveAsync(DeviceBuffer<Complex>, DeviceBuffer<int>, DeviceBuffer<Complex>, int, int, bool, bool, CudaStream?, CancellationToken)

Solves op(A)·X = B from the factors produced by NVMathNet.Solver.DenseSolver.LuFactorAsync(NVMathNet.DeviceBuffer{System.Numerics.Complex},NVMathNet.DeviceBuffer{System.Int32},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

public static Task LuSolveAsync(DeviceBuffer<Complex> a, DeviceBuffer<int> ipiv, DeviceBuffer<Complex> b, int n, int nrhs, bool transpose, bool conjugate, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer holding the n×n L\U factors.

ipiv DeviceBuffer<int>

Pivot indices from the factorisation.

b DeviceBuffer<Complex>

Device buffer for the n×nrhs right-hand sides; overwritten with the solution.

n int

Order of A.

nrhs int

Number of right-hand sides.

transpose bool

Solve with the transpose of A.

conjugate bool

With transpose, solve with the conjugate transpose.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

LuSolveAsync<T>(DeviceBuffer<T>, DeviceBuffer<int>, DeviceBuffer<T>, int, int, bool, CudaStream?, CancellationToken)

Solves op(A)·X = B using a factorisation produced by NVMathNet.Solver.DenseSolver.LuFactorAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{System.Int32},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

public static Task LuSolveAsync<T>(DeviceBuffer<T> a, DeviceBuffer<int> ipiv, DeviceBuffer<T> b, int n, int nrhs = 1, bool transpose = false, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer holding the n×n L\U factors.

ipiv DeviceBuffer<int>

Pivot indices from NVMathNet.Solver.DenseSolver.LuFactorAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{System.Int32},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

b DeviceBuffer<T>

Device buffer for the n×nrhs right-hand sides; overwritten with the solution.

n int

Order of A.

nrhs int

Number of right-hand sides.

transpose bool

Solve with the transpose of A.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

Type Parameters

T

LuSolveBatchedAsync<T>(DeviceBuffer<T>, DeviceBuffer<int>, DeviceBuffer<T>, int, int, int, bool, CudaStream?, CancellationToken)

Solves op(A_i)·X_i = B_i for every matrix of a batch from the factors produced by NVMathNet.Solver.DenseSolver.LuFactorBatchedAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{System.Int32},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

public static Task LuSolveBatchedAsync<T>(DeviceBuffer<T> a, DeviceBuffer<int> ipiv, DeviceBuffer<T> b, int n, int nrhs, int batchCount, bool transpose = false, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer holding the batch of L\U factors.

ipiv DeviceBuffer<int>

Pivot indices from NVMathNet.Solver.DenseSolver.LuFactorBatchedAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{System.Int32},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

b DeviceBuffer<T>

Device buffer of batchCount·n·nrhs right-hand sides; overwritten with the solutions.

n int

Order of each matrix.

nrhs int

Right-hand sides per matrix.

batchCount int

Number of matrices.

transpose bool

Solve with the transpose of each A.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

Type Parameters

T

LuSolveBatchedAsync(DeviceBuffer<Complex>, DeviceBuffer<int>, DeviceBuffer<Complex>, int, int, int, bool, CudaStream?, CancellationToken)

Solves op(A_i)·X_i = B_i for every matrix of a complex batch, where op is the identity or, with transpose, the plain transpose. Use the overload with a conjugate argument for the conjugate transpose.

public static Task LuSolveBatchedAsync(DeviceBuffer<Complex> a, DeviceBuffer<int> ipiv, DeviceBuffer<Complex> b, int n, int nrhs, int batchCount, bool transpose = false, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer holding the batch of L\U factors.

ipiv DeviceBuffer<int>

Pivot indices from the factorisation.

b DeviceBuffer<Complex>

Device buffer of batchCount·n·nrhs right-hand sides; overwritten with the solutions.

n int

Order of each matrix.

nrhs int

Right-hand sides per matrix.

batchCount int

Number of matrices.

transpose bool

Solve with the transpose of each A.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

LuSolveBatchedAsync(DeviceBuffer<Complex>, DeviceBuffer<int>, DeviceBuffer<Complex>, int, int, int, bool, bool, CudaStream?, CancellationToken)

Solves op(A_i)·X_i = B_i for every matrix of a complex batch from the factors produced by NVMathNet.Solver.DenseSolver.LuFactorBatchedAsync(NVMathNet.DeviceBuffer{System.Numerics.Complex},NVMathNet.DeviceBuffer{System.Int32},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

public static Task LuSolveBatchedAsync(DeviceBuffer<Complex> a, DeviceBuffer<int> ipiv, DeviceBuffer<Complex> b, int n, int nrhs, int batchCount, bool transpose, bool conjugate, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer holding the batch of L\U factors.

ipiv DeviceBuffer<int>

Pivot indices from the factorisation.

b DeviceBuffer<Complex>

Device buffer of batchCount·n·nrhs right-hand sides; overwritten with the solutions.

n int

Order of each matrix.

nrhs int

Right-hand sides per matrix.

batchCount int

Number of matrices.

transpose bool

Solve with the transpose of each A.

conjugate bool

With transpose, solve with the conjugate transpose.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

QrAsync(DeviceBuffer<Complex>, DeviceBuffer<Complex>, int, int, CudaStream?, CancellationToken)

Computes the QR factorisation A = Q·R in place. On return the upper triangle of A holds R and the part below the diagonal, together with tau, encodes the Householder reflectors of Q.

public static Task QrAsync(DeviceBuffer<Complex> a, DeviceBuffer<Complex> tau, int m, int n, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer for the m×n matrix A.

tau DeviceBuffer<Complex>

Device buffer of min(m, n) scalars (output).

m int

Number of rows.

n int

Number of columns.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

QrAsync<T>(DeviceBuffer<T>, DeviceBuffer<T>, int, int, CudaStream?, CancellationToken)

Computes the QR factorisation A = Q·R in place. On return the upper triangle of A holds R and the part below the diagonal, together with tau, encodes the Householder reflectors of Q.

public static Task QrAsync<T>(DeviceBuffer<T> a, DeviceBuffer<T> tau, int m, int n, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer for the m×n matrix A.

tau DeviceBuffer<T>

Device buffer of min(m, n) scalars (output).

m int

Number of rows.

n int

Number of columns.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

Type Parameters

T

QrFormQAsync(DeviceBuffer<Complex>, DeviceBuffer<Complex>, int, int, CudaStream?, CancellationToken)

Forms the explicit orthonormal factor Q (first n columns, m×n) from a factorisation produced by NVMathNet.Solver.DenseSolver.QrAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{``0},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken). a is overwritten with Q. Requires m ≥ n.

public static Task QrFormQAsync(DeviceBuffer<Complex> a, DeviceBuffer<Complex> tau, int m, int n, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer holding the output of NVMathNet.Solver.DenseSolver.QrAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{``0},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken); overwritten with Q.

tau DeviceBuffer<Complex>

Scalars from NVMathNet.Solver.DenseSolver.QrAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{``0},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

m int

Number of rows.

n int

Number of columns of Q (≤ m).

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

QrFormQAsync<T>(DeviceBuffer<T>, DeviceBuffer<T>, int, int, CudaStream?, CancellationToken)

Forms the explicit orthonormal factor Q (first n columns, m×n) from a factorisation produced by NVMathNet.Solver.DenseSolver.QrAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{``0},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken). a is overwritten with Q. Requires m ≥ n.

public static Task QrFormQAsync<T>(DeviceBuffer<T> a, DeviceBuffer<T> tau, int m, int n, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer holding the output of NVMathNet.Solver.DenseSolver.QrAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{``0},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken); overwritten with Q.

tau DeviceBuffer<T>

Scalars from NVMathNet.Solver.DenseSolver.QrAsync``1(NVMathNet.DeviceBuffer{``0},NVMathNet.DeviceBuffer{``0},System.Int32,System.Int32,NVMathNet.CudaStream,System.Threading.CancellationToken).

m int

Number of rows.

n int

Number of columns of Q (≤ m).

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

Type Parameters

T

SolveAsync(DeviceBuffer<float>, DeviceBuffer<float>, int, int, CudaStream?, CancellationToken)

Solves A*X = B using LU factorisation (single-precision). A is overwritten with L\U factors; B is overwritten with the solution X.

public static Task SolveAsync(DeviceBuffer<float> a, DeviceBuffer<float> b, int n, int nrhs = 1, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<float>

Device buffer for n×n matrix A (overwritten with LU factors).

b DeviceBuffer<float>

Device buffer for n×nrhs matrix B (overwritten with solution X).

n int

Order of the square matrix A.

nrhs int

Number of right-hand sides (columns of B).

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

SolveAsync(DeviceBuffer<double>, DeviceBuffer<double>, int, int, CudaStream?, CancellationToken)

Solves A*X = B using LU factorisation (double-precision).

public static Task SolveAsync(DeviceBuffer<double> a, DeviceBuffer<double> b, int n, int nrhs = 1, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<double>
b DeviceBuffer<double>
n int
nrhs int
stream CudaStream?
ct CancellationToken

Returns

Task

SvdAsync(DeviceBuffer<Complex>, DeviceBuffer<double>, DeviceBuffer<Complex>, DeviceBuffer<Complex>, int, int, CudaStream?, CancellationToken)

Singular value decomposition of a complex matrix, A = U · diag(S) · VH, where VH = Vᴴ is the conjugate transpose of the right singular vectors. Requires m ≥ n.

public static Task SvdAsync(DeviceBuffer<Complex> a, DeviceBuffer<double> s, DeviceBuffer<Complex> u, DeviceBuffer<Complex> vh, int m, int n, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer for the m×n matrix A; destroyed on return.

s DeviceBuffer<double>

Device buffer of min(m, n) real singular values in descending order (output).

u DeviceBuffer<Complex>

Device buffer for the m×m left singular vectors (output).

vh DeviceBuffer<Complex>

Device buffer for the n×n matrix Vᴴ (output).

m int

Rows of A.

n int

Columns of A (≤ m).

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

SvdAsync(DeviceBuffer<float>, DeviceBuffer<float>, DeviceBuffer<float>, DeviceBuffer<float>, int, int, CudaStream?, CancellationToken)

Computes the singular value decomposition A = U*diag(S)*VT (single-precision). Requires m >= n (cuSOLVER gesvd); for a wide matrix decompose its transpose.

public static Task SvdAsync(DeviceBuffer<float> a, DeviceBuffer<float> s, DeviceBuffer<float> u, DeviceBuffer<float> vt, int m, int n, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<float>

Device buffer for m×n matrix A (overwritten).

s DeviceBuffer<float>

Device buffer for min(m,n) singular values.

u DeviceBuffer<float>

Device buffer for m×m unitary matrix U.

vt DeviceBuffer<float>

Device buffer for n×n unitary matrix VT.

m int

Rows of A.

n int

Columns of A.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task

SvdAsync(DeviceBuffer<double>, DeviceBuffer<double>, DeviceBuffer<double>, DeviceBuffer<double>, int, int, CudaStream?, CancellationToken)

Computes the singular value decomposition A = U*diag(S)*VT (double-precision). Requires m >= n (cuSOLVER gesvd); for a wide matrix decompose its transpose.

public static Task SvdAsync(DeviceBuffer<double> a, DeviceBuffer<double> s, DeviceBuffer<double> u, DeviceBuffer<double> vt, int m, int n, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<double>
s DeviceBuffer<double>
u DeviceBuffer<double>
vt DeviceBuffer<double>
m int
n int
stream CudaStream?
ct CancellationToken

Returns

Task

SvdBatchedAsync(DeviceBuffer<Complex>, DeviceBuffer<double>, DeviceBuffer<Complex>?, DeviceBuffer<Complex>?, int, int, int, bool, CudaStream?, CancellationToken)

Singular value decomposition A_i = U_i · diag(S_i) · V_iᴴ of a batch of small complex matrices (m and n at most 32) using the Jacobi method; matrices are packed back-to-back and column-major.

public static Task<int[]> SvdBatchedAsync(DeviceBuffer<Complex> a, DeviceBuffer<double> s, DeviceBuffer<Complex>? u, DeviceBuffer<Complex>? v, int m, int n, int batchCount, bool computeVectors = true, CudaStream? stream = null, CancellationToken ct = default)

Parameters

a DeviceBuffer<Complex>

Device buffer of batchCount·m·n elements; destroyed on return.

s DeviceBuffer<double>

Device buffer of batchCount·min(m,n) real singular values, descending (output).

u DeviceBuffer<Complex>?

Device buffer of batchCount·m·m left vectors; may be null when computeVectors is false (a scratch buffer is used).

v DeviceBuffer<Complex>?

Device buffer of batchCount·n·n right vectors — V, not Vᴴ; may be null when computeVectors is false.

m int

Rows of each matrix.

n int

Columns of each matrix.

batchCount int

Number of matrices.

computeVectors bool

Whether to compute U and V.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int[]>

Per-matrix status: 0 = converged; a positive value means the matrix did not converge.

SvdBatchedAsync<T>(DeviceBuffer<T>, DeviceBuffer<T>, DeviceBuffer<T>?, DeviceBuffer<T>?, int, int, int, bool, CudaStream?, CancellationToken)

Singular value decomposition A_i = U_i · diag(S_i) · V_i^T of a batch of small matrices (m and n at most 32) using the Jacobi method. Matrices are packed back-to-back and column-major.

public static Task<int[]> SvdBatchedAsync<T>(DeviceBuffer<T> a, DeviceBuffer<T> s, DeviceBuffer<T>? u, DeviceBuffer<T>? v, int m, int n, int batchCount, bool computeVectors = true, CudaStream? stream = null, CancellationToken ct = default) where T : unmanaged, INumberBase<T>

Parameters

a DeviceBuffer<T>

Device buffer of batchCount·m·n elements; destroyed on return.

s DeviceBuffer<T>

Device buffer of batchCount·min(m,n) singular values, sorted descending (output).

u DeviceBuffer<T>?

Device buffer of batchCount·m·m left vectors (output); may be null when computeVectors is false (a scratch buffer is used).

v DeviceBuffer<T>?

Device buffer of batchCount·n·n right vectors — V, not V^T (output); may be null when computeVectors is false (a scratch buffer is used).

m int

Rows of each matrix.

n int

Columns of each matrix.

batchCount int

Number of matrices.

computeVectors bool

Whether to compute U and V.

stream CudaStream?

Optional CUDA stream.

ct CancellationToken

Cancellation token.

Returns

Task<int[]>

Per-matrix status: 0 = converged; a positive value means the matrix did not converge.

Type Parameters

T