Skip to content

Latest commit

 

History

History
158 lines (103 loc) · 5.78 KB

File metadata and controls

158 lines (103 loc) · 5.78 KB

ctrsm

Solve one of the matrix equations op(A)*X = alpha*B or X*op(A) = alpha*B.

Usage

var ctrsm = require( '@stdlib/blas/base/ctrsm' );

ctrsm( order, side, uplo, transa, diag, M, N, alpha, A, LDA, B, LDB )

Solves one of the matrix equations op(A)*X = alpha*B or X*op(A) = alpha*B where alpha is a scalar, X and B are M by N matrices, A is a unit or non-unit upper or lower triangular matrix, and op(A) is one of op(A) = A, op(A) = A^T, or op(A) = A^H. The matrix X is overwritten on B.

var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );

var A = new Complex64Array( [ 2.0, 0.0, 1.0, 0.0, 0.0, 0.0, 2.0, 0.0 ] );
var B = new Complex64Array( [ 4.0, 0.0, 2.0, 0.0 ] );
var alpha = new Complex64( 1.0, 0.0 );

ctrsm( 'row-major', 'left', 'upper', 'no-transpose', 'non-unit', 2, 1, alpha, A, 2, B, 1 );
// B => <Complex64Array>[ 1.5, 0.0, 1.0, 0.0 ]

The function has the following parameters:

  • order: storage layout.
  • side: specifies whether A appears on the 'left' or 'right' of X.
  • uplo: specifies whether the 'upper' or 'lower' triangular part of A is used.
  • transa: transpose operation applied to A ('no-transpose', 'transpose', or 'conjugate-transpose').
  • diag: specifies whether A is 'unit' or 'non-unit' triangular.
  • M: number of rows in B.
  • N: number of columns in B.
  • alpha: scalar constant of type Complex64.
  • A: input triangular matrix stored in a Complex64Array.
  • LDA: stride of the first dimension of A (a.k.a., leading dimension of A).
  • B: input/output matrix stored in a Complex64Array. On exit, overwritten with solution X.
  • LDB: stride of the first dimension of B (a.k.a., leading dimension of B).

ctrsm.ndarray( ord, sd, ul, ta, dg, M, N, aRe, aIm, A, sa1, oa, B, sb1, ob )

Solves one of the matrix equations using alternative indexing semantics.

var Complex64Array = require( '@stdlib/array/complex64' );

var A = new Complex64Array( [ 2.0, 0.0, 1.0, 0.0, 0.0, 0.0, 2.0, 0.0 ] );
var B = new Complex64Array( [ 4.0, 0.0, 2.0, 0.0 ] );

ctrsm.ndarray( 'row-major', 'left', 'upper', 'no-transpose', 'non-unit', 2, 1, 1.0, 0.0, A, 2, 0, B, 1, 0 );
// B => <Complex64Array>[ 1.5, 0.0, 1.0, 0.0 ]

The function accepts the following additional parameters:

  • aRe: real part of scalar constant alpha.
  • aIm: imaginary part of scalar constant alpha.
  • sa1: stride of the first dimension of A.
  • oa: starting index for A.
  • sb1: stride of the first dimension of B.
  • ob: starting index for B.

Notes

  • ctrsm() corresponds to the BLAS level 3 function ctrsm.
  • Neither routine tests for singularity or near-singularity of A. Such tests must be performed before calling these routines.

Examples

var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var ctrsm = require( '@stdlib/blas/base/ctrsm' );

var N = 3;

var opts = {
    'dtype': 'complex64'
};
var A = discreteUniform( N * N, -10, 10, opts );
var B = discreteUniform( N * N, -10, 10, opts );
var alpha = new Complex64( 1.0, 0.0 );

ctrsm( 'row-major', 'left', 'upper', 'no-transpose', 'non-unit', N, N, alpha, A, N, B, N );
console.log( B );

See Also

  • @stdlib/blas/base/strsm: solve one of the matrix equations op(A)*X = alpha*B or X*op(A) = alpha*B where A is a real single-precision triangular matrix.
  • @stdlib/blas/base/dtrsm: solve one of the matrix equations op(A)*X = alpha*B or X*op(A) = alpha*B where A is a real double-precision triangular matrix.
  • @stdlib/blas/base/ztrsm: solve one of the matrix equations op(A)*X = alpha*B or X*op(A) = alpha*B where A is a complex double-precision triangular matrix.