({{, TRSV[ul,ts,dg,a,b] 
solves the triangular system of linear equations (Subscript[op, ts])[a].x==b and resets b to the result x.}})

OpenersNotesSection(Spacer1)Details

To use TRSV, you first need to load the BLAS Package using (RefLink[Needs, paclet:ref/Needs])["LinearAlgebra`BLAS`"].

The following arguments must be given:

The upper/lower triangular string ul may be specified as:

The transposition string ts describes the operator (Subscript[op, ts]) and may be specified as:

The diagonal ones string dg may be specified as:

Dimensions of the matrix and vector arguments must be such that the dot product is well defined.

OpenersPrimaryExamplesSection(Spacer1)Examples  (11)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Load the BLAS package:

Needs["LinearAlgebra`BLAS`"]

Compute (RefLink[Inverse, paclet:ref/Inverse])[(RefLink[UpperTriangularize, paclet:ref/UpperTriangularize])[a]].b and save it in b:

b={-2,1};
a={{1,3},{2,4}};
TRSV["U","N","N",a,b];
b

OpenersExampleSection1(Spacer1)Scope  (4)

Real matrix and vectors:

b={2.3,1.2,3.9};
a={{2.1,0,1.4},{3.5,2.4,0.4},{0,2.7,1.3}};
TRSV["U","N","N",a,b];
b//Chop

Complex matrix and vectors:

b={2.3+3.I,1.2 I,-3.+2.I};
a={{2.1,0,1.4 I},{3.5 I,2.4,0.4+I},{0,2.7,1.3 I}};
TRSV["U","N","N",a,b];
b

Arbitrary-precision matrix and vectors:

b={-2`20,1};
a={{1`20,3},{2,4}};
TRSV["L","N","N",a,b];
b

Symbolic matrix and vectors:

b={b1,b2};
a={{m11,m12},{m21,m22}};
TRSV["L","N","U",a,b];
b

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

For invertible matrices a, TRSV["U","N","N",a,b] is equivalent to b=(RefLink[Inverse, paclet:ref/Inverse])[(RefLink[UpperTriangularize, paclet:ref/UpperTriangularize])[a]].b:

b=b1=RandomReal[1,{5}];
a=RandomReal[1,{5,5}];
TRSV["U","N","N",a,b];
b==Inverse[UpperTriangularize[a]].b1

For invertible matrices a, TRSV["L","T","N",a,b] is equivalent to b=(RefLink[Inverse, paclet:ref/Inverse])[(RefLink[Transpose, paclet:ref/Transpose])[(RefLink[LowerTriangularize, paclet:ref/LowerTriangularize])[a]]].b:

b=bU=bL=RandomReal[1,{5}];
a=RandomReal[1,{5,5}];
TRSV["L","T","N",a,bL];
bL==Inverse[Transpose[LowerTriangularize[a]]].b

Note this is not TRSV["U","N","N",a,b] as the lower triangular part is used for the transpose:

TRSV["U","N","N",a,bU];
bL==bU

If dg="U", the diagonal values of a are assumed to be ones:

b={-2,1};
a={{3,3},{2,4}};
TRSV["U","N","U",a,b];
b

The diagonal has been effectively replaced by ones:

Inverse[{{1,3},{0,1}}].{-2,1}

OpenersExampleSection4(Spacer1)Possible Issues  (3)

The last argument must be a symbol:

a={{1,3},{2,4}};
TRSV["U","N","N",a,{1,2}]

The last argument must be initialized to a vector:

Clear[b];
a={{1,3},{2,4}};
TRSV["U","N","N",a,b]

If a is a rectangular matrix then only the leading upper or lower triangular part of a is used:

b=b1={1,1};
a={{3,3},{2,4},{-2,3}};
TRSV["L","N","N",a,b];
b

The matrix a is effectively truncated to its upper left corner:

Inverse[{{3,0},{2,4}}].b1

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Linear Algebra Subroutines, paclet:LowLevelLinearAlgebra/guide/BLASGuide])}})}})