Solve one of the matrix equations
op(A)*X = alpha*BorX*op(A) = alpha*B.
var ctrsm = require( '@stdlib/blas/base/ctrsm' );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
Aappears on the'left'or'right'ofX. - uplo: specifies whether the
'upper'or'lower'triangular part ofAis used. - transa: transpose operation applied to
A('no-transpose','transpose', or'conjugate-transpose'). - diag: specifies whether
Ais'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 ofA). - B: input/output matrix stored in a
Complex64Array. On exit, overwritten with solutionX. - LDB: stride of the first dimension of
B(a.k.a., leading dimension ofB).
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.
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 );@stdlib/blas/base/strsm: solve one of the matrix equationsop(A)*X = alpha*BorX*op(A) = alpha*BwhereAis a real single-precision triangular matrix.@stdlib/blas/base/dtrsm: solve one of the matrix equationsop(A)*X = alpha*BorX*op(A) = alpha*BwhereAis a real double-precision triangular matrix.@stdlib/blas/base/ztrsm: solve one of the matrix equationsop(A)*X = alpha*BorX*op(A) = alpha*BwhereAis a complex double-precision triangular matrix.