NAG Library Manual, Mark 28.7
```/* nag_matop_complex_tri_matmul (f01dtc) Example Program.
*
* Copyright 2022 Numerical Algorithms Group.
*
* Mark 28.7, 2022.
*/

#include <nag.h>
#include <stdio.h>

int main(void) {

/* Scalars */
Complex alpha, beta;
Integer exit_status, i, j, n, pda, pdb, pdc, lu, lta, ltb;

/* Arrays */
Complex *a = 0, *b = 0, *c = 0;
char nag_enum_arg[40];

/* Nag Types */
Nag_OrderType order = Nag_ColMajor;
NagError fail;
Nag_UploType uplo;
Nag_TransType transa, transb;

#define A(I, J) a[J * pda + I]
#define B(I, J) b[J * pdb + I]
#define C(I, J) c[J * pdc + I]

exit_status = 0;
INIT_FAIL(fail);

printf("nag_matop_complex_tri_matmul (f01dtc) Example Program Results\n\n");

/* Skip heading in data file. */
scanf("%*[^\n] ");

/* Read the problem dimensions */
scanf("%" NAG_IFMT "%*[^\n]", &n);

pda = n;
pdb = n;
pdc = n;

scanf("%39s%*[^\n] ", nag_enum_arg);
/* nag_enum_name_to_value (x04nac), see above. */
uplo = (Nag_UploType)nag_enum_name_to_value(nag_enum_arg);
lu = (uplo == Nag_Lower ? 0 : 1);

scanf("%39s%*[^\n] ", nag_enum_arg);
/* nag_enum_name_to_value (x04nac), see above. */
transa = (Nag_TransType)nag_enum_name_to_value(nag_enum_arg);
lta = ((transa == Nag_Trans || transa == Nag_ConjTrans) ? 0 : 1);

scanf("%39s%*[^\n] ", nag_enum_arg);
/* nag_enum_name_to_value (x04nac), see above. */
transb = (Nag_TransType)nag_enum_name_to_value(nag_enum_arg);
ltb = ((transb == Nag_Trans || transb == Nag_ConjTrans) ? 0 : 1);

scanf(" ( %lf , %lf ) %*[^\n]", &alpha.re, &alpha.im);
scanf(" ( %lf , %lf ) %*[^\n]", &beta.re, &beta.im);

if (n > 0) {
/* Allocate memory */
if (!(a = NAG_ALLOC(n * n, Complex)) || !(b = NAG_ALLOC(n * n, Complex)) ||
!(c = NAG_ALLOC(n * n, Complex))) {
printf("Allocation failure\n");
exit_status = -1;
goto END;
}
} else {
printf("Invalid n\n");
exit_status = 1;
return exit_status;
}

/* Read A from data file */
if (lu == lta) {
/* A is upper triangular */
for (i = 0; i < n; i++) {
for (j = i; j < n; j++) {
scanf(" ( %lf , %lf ) ", &A(i, j).re, &A(i, j).im);
}
}
} else {
/* A is lower triangular */
for (i = 0; i < n; i++) {
for (j = 0; j <= i; j++) {
scanf(" ( %lf , %lf ) ", &A(i, j).re, &A(i, j).im);
}
}
}
scanf("%*[^\n] ");

/* Read B from data file */
if (lu == ltb) {
/* B is upper triangular */
for (i = 0; i < n; i++) {
for (j = i; j < n; j++) {
scanf(" ( %lf , %lf ) ", &B(i, j).re, &B(i, j).im);
}
}
} else {
/* B is lower triangular */
for (i = 0; i < n; i++) {
for (j = 0; j <= i; j++) {
scanf(" ( %lf , %lf ) ", &B(i, j).re, &B(i, j).im);
}
}
}
scanf("%*[^\n] ");

/* Read C from data file */
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf(" ( %lf , %lf ) ", &C(i, j).re, &C(i, j).im);
}
}
scanf("%*[^\n] ");

/* nag_matop_complex_tri_matmul (f01dtc).
*
*/
nag_matop_complex_tri_matmul(uplo, transa, transb, n, alpha, a, pda, b, pdb,
beta, c, pdc, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_matop_complex_tri_matmul (f01dtc).\n%s\n",
fail.message);
exit_status = 1;
goto END;
}

/* Print the updated matrix C */
/* nag_gen_complx_mat_print (x04dac).
* Print complex general matrix (easy-to-use)
*/
fflush(stdout);
nag_gen_complx_mat_print(order, Nag_GeneralMatrix, Nag_NonUnitDiag, n, n, c,
pdc, "Solution matrix C", 0, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_gen_complx_mat_print (x04dac).\n%s\n", fail.message);
exit_status = 1;
goto END;
}

END:
NAG_FREE(a);
NAG_FREE(b);
NAG_FREE(c);

return exit_status;
}
```