HPL_dtrsm(3)
π HPL_dtrsm β bestie edition π
okay so this is HPL_dtrsm(3), one of the HPL Library Functions, and she is iconic β¨
πΈ NAME πΈ
HPL_dtrsm β it does B := A^{-1} * B or B := B * A^{-1}. that's it, that's the whole personality π
β¨ SYNOPSIS β¨
#include "hpl.h"
void HPL_dtrsm( const enum HPL_ORDER ORDER, const enum HPL_SIDE SIDE,
const enum HPL_UPLO UPLO, const enum HPL_TRANS TRANS, const enum
HPL_DIAG DIAG, const int M, const int N, const double ALPHA, const
double * A, const int LDA, double * B, const int LDB );
no cap, that's a lot of enums but we're gonna get through it together π«Ά
π¦ DESCRIPTION π¦
so HPL_dtrsm solves one of these matrix equations, and you get to pick which one:
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 or op( A ) = A^T.
the matrix X gets overwritten on B. she moves in, she redecorates, main character energy honestly π
β οΈ important bestie!! No test for singularity or near-singularity is included in this routine. Such tests must be performed before calling this routine. she is not gonna hold your hand on this one, you gotta do your own vibe check first π
π ARGUMENTS π
ORDER(local input) βconst enum HPL_ORDER
On entry, ORDER specifies the storage format of the operands as follows:
ORDER = HplRowMajor,
ORDER = HplColumnMajor.
SIDE(local input) βconst enum HPL_SIDE
On entry, SIDE specifies whether op(A) appears on the left or right of X as follows:
SIDE==HplLeft op( A ) * X = alpha * B,
SIDE==HplRight X * op( A ) = alpha * B.
UPLO(local input) βconst enum HPL_UPLO
On entry, UPLO specifies whether the upper or lower triangular part of the array A is to be referenced. When UPLO==HplUpper, only the upper triangular part of A is to be referenced, otherwise only the lower triangular part of A is to be referenced.
TRANS(local input) βconst enum HPL_TRANS
On entry, TRANSA specifies the form of op(A) to be used in the matrix-matrix operation follows:
TRANSA==HplNoTrans : op( A ) = A,
TRANSA==HplTrans : op( A ) = A^T,
TRANSA==HplConjTrans : op( A ) = A^T.
DIAG(local input) βconst enum HPL_DIAG
On entry, DIAG specifies whether A is unit triangular or not. When DIAG==HplUnit, A is assumed to be unit triangular, and otherwise, A is not assumed to be unit triangular.
M(local input) βconst int
On entry, M specifies the number of rows of the matrix B. M must be at least zero.
N(local input) βconst int
On entry, N specifies the number of columns of the matrix B. N must be at least zero.
ALPHA(local input) βconst double
On entry, ALPHA specifies the scalar alpha. When ALPHA is supplied as zero then the elements of the matrix B need not be set on input. free real estate, you can just leave her empty π
A(local input) βconst double *
On entry, A points to an array of size equal to or greater than LDA * k, where k is m when SIDE==HplLeft and is n otherwise. Before entry with UPLO==HplUpper, the leading k by k upper triangular part of the array A must contain the upper triangular matrix and the strictly lower triangular part of A is not referenced. When UPLO==HplLower on entry, the leading k by k lower triangular part of the array A must contain the lower triangular matrix and the strictly upper triangular part of A is not referenced.
Note that when DIAG==HplUnit, the diagonal elements of A not referenced either, but are assumed to be unity.
LDA(local input) βconst int
On entry, LDA specifies the leading dimension of A as declared in the calling (sub) program. LDA must be at least MAX(1,m) when SIDE==HplLeft, and MAX(1,n) otherwise.
B(local input/output) βdouble *
On entry, B points to an array of size equal to or greater than LDB * n. Before entry, the leading m by n part of the array B must contain the matrix B, except when beta is zero, in which case B need not be set on entry. On exit, the array B is overwritten by the m by n solution matrix. glow up complete β¨
LDB(local input) βconst int
On entry, LDB specifies the leading dimension of B as declared in the calling (sub) program. LDB must be at least MAX(1,m).
π EXAMPLE π
here's a whole lil program, copy it, run it, slay:
#include "hpl.h"
int main(int argc, char *argv[])
{
double a[2*2], b[2*2];
a[0] = 4.0; a[1] = 1.0; a[2] = 2.0; a[3] = 5.0;
b[0] = 2.0; b[1] = 1.0; b[2] = 1.0; b[3] = 2.0;
HPL_dtrsm( HplColumnMajor, HplLeft, HplUpper,
HplNoTrans, HplNonUnit, 2, 2, 2.0,
a, 2, b, 2 );
printf(" [%f,%f]\n", b[0], b[2]);
printf("b=[%f,%f]\n", b[1], b[3]);
exit(0); return(0);
}
π SEE ALSO π
HPL_dgemm (3)β her sister, also a legend π«Ά
k that's the whole page bestie, go forth and triangular-solve responsibly π
this was brought to you by HPL 2.2, dated February 24, 2016 β old but she ate, fr fr πΈβ¨π
π¦ where this page comes from
- fedora 43: hpl-doc 2.2-22.fc43 Β· LicenseRef-Callaway-BSD-with-advertising
- fedora 44: hpl-doc 2.2-23.fc44 Β· LicenseRef-Callaway-BSD-with-advertising
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms