int main() {
array double complex a[4][3] = {1,2,3,
4,5,6,
7,8,9,
3,6,4};
int n = 4, m=3, k;
array double complex t[n][m];
t = ctriangularmatrix("upper",a);
printf("ctriangularmatrix(\"upper\", t) =\n%5.3f\n", t);
k = 0;
t = ctriangularmatrix("upper",a,k);
printf("ctriangularmatrix(\"upper\", t, 0) =\n%5.3f\n", t);
k = 1;
t = ctriangularmatrix("upper",a,k);
printf("ctriangularmatrix(\"upper\", t, 1) =\n%5.3f\n", t);
k = -1;
t = ctriangularmatrix("upper",a,k);
printf("ctriangularmatrix(\"upper\", t, -1) =\n%5.3f\n", t);
t = ctriangularmatrix("lower",a);
printf("ctriangularmatrix(\"lower\", t) =\n%5.3f\n", t);
k = 0;
t = ctriangularmatrix("lower",a,k);
printf("ctriangularmatrix(\"lower\", t, 0) =\n%5.3f\n", t);
k = 1;
t = ctriangularmatrix("lower",a,k);
printf("ctriangularmatrix(\"lower\", t, 1) =\n%5.3f\n", t);
k = -1;
t = ctriangularmatrix("lower",a,k);
printf("ctriangularmatrix(\"lower\", t, -1) =\n%5.3f\n", t);
}

ctriangularmatrix("upper", t) =
complex(1.000000,0.000000) complex(2.000000,0.000000) complex(3.000000,0.000000)
complex(0.000000,0.000000) complex(5.000000,0.000000) complex(6.000000,0.000000)
complex(0.000000,0.000000) complex(0.000000,0.000000) complex(9.000000,0.000000)
ctriangularmatrix("upper", t, 0) =
complex(1.000000,0.000000) complex(2.000000,0.000000) complex(3.000000,0.000000)
complex(0.000000,0.000000) complex(5.000000,0.000000) complex(6.000000,0.000000)
complex(0.000000,0.000000) complex(0.000000,0.000000) complex(9.000000,0.000000)
ctriangularmatrix("upper", t, 1) =
complex(0.000000,0.000000) complex(2.000000,0.000000) complex(3.000000,0.000000)
complex(0.000000,0.000000) complex(0.000000,0.000000) complex(6.000000,0.000000)
complex(0.000000,0.000000) complex(0.000000,0.000000) complex(0.000000,0.000000)
ctriangularmatrix("upper", t, -1) =
complex(1.000000,0.000000) complex(2.000000,0.000000) complex(3.000000,0.000000)
complex(4.000000,0.000000) complex(5.000000,0.000000) complex(6.000000,0.000000)
complex(0.000000,0.000000) complex(8.000000,0.000000) complex(9.000000,0.000000)
ctriangularmatrix("lower", t) =
complex(1.000000,0.000000) complex(0.000000,0.000000) complex(0.000000,0.000000)
complex(4.000000,0.000000) complex(5.000000,0.000000) complex(0.000000,0.000000)
complex(7.000000,0.000000) complex(8.000000,0.000000) complex(9.000000,0.000000)
ctriangularmatrix("lower", t, 0) =
complex(1.000000,0.000000) complex(0.000000,0.000000) complex(0.000000,0.000000)
complex(4.000000,0.000000) complex(5.000000,0.000000) complex(0.000000,0.000000)
complex(7.000000,0.000000) complex(8.000000,0.000000) complex(9.000000,0.000000)
ctriangularmatrix("lower", t, 1) =
complex(1.000000,0.000000) complex(2.000000,0.000000) complex(0.000000,0.000000)
complex(4.000000,0.000000) complex(5.000000,0.000000) complex(6.000000,0.000000)
complex(7.000000,0.000000) complex(8.000000,0.000000) complex(9.000000,0.000000)
ctriangularmatrix("lower", t, -1) =
complex(0.000000,0.000000) complex(0.000000,0.000000) complex(0.000000,0.000000)
complex(4.000000,0.000000) complex(0.000000,0.000000) complex(0.000000,0.000000)
complex(7.000000,0.000000) complex(8.000000,0.000000) complex(0.000000,0.000000)