1 #include <stdio.h>
2 #include "blas_extended.h"
3 #include "blas_extended_test.h"
4 
stbsv_copy(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,const float * T,int ldt,float * y,int row)5 void stbsv_copy(enum blas_order_type order, enum blas_uplo_type uplo,
6 		enum blas_trans_type trans, int n, int k, const float *T,
7 		int ldt, float *y, int row)
8 /*
9  * Purpose
10  * =======
11  *
12  * Copy a row from T to y
13  *
14  *      NOTE: this function just encapsulates sgbmv_copy.
15  *
16  * Arguments
17  * =========
18  *
19  * order        (input) blas_order_type
20  *              Order of T; row or column major
21  *
22  * uplo         (input) blas_uplo_type
23  *              Whether T is upper or lower
24  *
25  * trans        (input) blas_trans_type
26  *              Whether T is no trans, trans, or conj trans
27  *
28  * n            (input) int
29  *              Dimension of AP and the length of vector x
30  *
31  * k            (input) int
32  *              Number of super(sub)diagonals of T.
33  *
34  * T            (input) float*
35  *              The triangular matrix T
36  *
37  * ldt          (input) int
38  *              Leading dimension
39  *
40  * y            (output) float*
41  *              The vector y
42  *
43  * row          (input) int
44  *              The row to be copyied to y
45  */
46 {
47   enum blas_trans_type new_trans;
48   int conj = 0;
49   int kl, ku;
50 
51 
52   if (uplo == blas_upper) {
53     ku = k;
54     kl = 0;
55   } else {
56     ku = 0;
57     kl = k;
58   }
59 
60 
61   if (trans == blas_no_trans) {
62     new_trans = blas_no_trans;
63   } else if (trans == blas_conj_trans) {
64     new_trans = blas_trans;
65     conj = 1;
66   } else if (trans == blas_trans) {
67     new_trans = blas_trans;
68   } else {
69     /* conj, no trans */
70     new_trans = blas_no_trans;
71     conj = 1;
72   }
73   sgbmv_copy(order, new_trans, n, n, kl, ku, T, ldt, y, row);
74 
75 
76 
77 }
78 
stbsv_commit(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,float * T,int ldt,float * y,int row)79 void stbsv_commit(enum blas_order_type order, enum blas_uplo_type uplo,
80 		  enum blas_trans_type trans, int n, int k, float *T, int ldt,
81 		  float *y, int row)
82 /*
83  * Purpose
84  * =======
85  *
86  * Copy y to T
87  *
88  *      NOTE: this function just encapsulates sgbmv_commit.
89  *
90  * Arguments
91  * =========
92  *
93  * order        (input) blas_order_type
94  *              Order of T; row or column major
95  *
96  * uplo         (input) blas_uplo_type
97  *              Whether T is upper or lower
98  *
99  * trans        (input) blas_trans_type
100  *              Whether T is no trans, trans, or conj trans
101  *
102  * n            (input) int
103  *              Dimension of AP and the length of vector x
104  *
105  * k            (input) int
106  *              Number of super(sub)diagonals of T
107  *
108  * T            (input) float*
109  *              The triangular matrix T
110  *
111  * ldt          (input) int
112  *              Leading dimension
113  *
114  * y            (output) float*
115  *              The vector y
116  *
117  * row          (input) int
118  *              The row to be copyied to y
119  */
120 {
121   enum blas_trans_type new_trans;
122   int conj = 0;
123   int kl, ku;
124 
125 
126   if (uplo == blas_upper) {
127     ku = k;
128     kl = 0;
129   } else {
130     ku = 0;
131     kl = k;
132   }
133 
134 
135   if (trans == blas_no_trans) {
136     new_trans = blas_no_trans;
137   } else if (trans == blas_conj_trans) {
138     new_trans = blas_trans;
139     conj = 1;
140   } else if (trans == blas_trans) {
141     new_trans = blas_trans;
142   } else {
143     /* conj, no trans */
144     new_trans = blas_no_trans;
145     conj = 1;
146   }
147 
148 
149 
150   sgbmv_commit(order, new_trans, n, n, kl, ku, T, ldt, y, row);
151 
152 
153 
154 
155 }
156 
dtbsv_copy(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,const double * T,int ldt,double * y,int row)157 void dtbsv_copy(enum blas_order_type order, enum blas_uplo_type uplo,
158 		enum blas_trans_type trans, int n, int k, const double *T,
159 		int ldt, double *y, int row)
160 /*
161  * Purpose
162  * =======
163  *
164  * Copy a row from T to y
165  *
166  *      NOTE: this function just encapsulates dgbmv_copy.
167  *
168  * Arguments
169  * =========
170  *
171  * order        (input) blas_order_type
172  *              Order of T; row or column major
173  *
174  * uplo         (input) blas_uplo_type
175  *              Whether T is upper or lower
176  *
177  * trans        (input) blas_trans_type
178  *              Whether T is no trans, trans, or conj trans
179  *
180  * n            (input) int
181  *              Dimension of AP and the length of vector x
182  *
183  * k            (input) int
184  *              Number of super(sub)diagonals of T.
185  *
186  * T            (input) double*
187  *              The triangular matrix T
188  *
189  * ldt          (input) int
190  *              Leading dimension
191  *
192  * y            (output) double*
193  *              The vector y
194  *
195  * row          (input) int
196  *              The row to be copyied to y
197  */
198 {
199   enum blas_trans_type new_trans;
200   int conj = 0;
201   int kl, ku;
202 
203 
204   if (uplo == blas_upper) {
205     ku = k;
206     kl = 0;
207   } else {
208     ku = 0;
209     kl = k;
210   }
211 
212 
213   if (trans == blas_no_trans) {
214     new_trans = blas_no_trans;
215   } else if (trans == blas_conj_trans) {
216     new_trans = blas_trans;
217     conj = 1;
218   } else if (trans == blas_trans) {
219     new_trans = blas_trans;
220   } else {
221     /* conj, no trans */
222     new_trans = blas_no_trans;
223     conj = 1;
224   }
225   dgbmv_copy(order, new_trans, n, n, kl, ku, T, ldt, y, row);
226 
227 
228 
229 }
230 
dtbsv_commit(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,double * T,int ldt,double * y,int row)231 void dtbsv_commit(enum blas_order_type order, enum blas_uplo_type uplo,
232 		  enum blas_trans_type trans, int n, int k, double *T,
233 		  int ldt, double *y, int row)
234 /*
235  * Purpose
236  * =======
237  *
238  * Copy y to T
239  *
240  *      NOTE: this function just encapsulates dgbmv_commit.
241  *
242  * Arguments
243  * =========
244  *
245  * order        (input) blas_order_type
246  *              Order of T; row or column major
247  *
248  * uplo         (input) blas_uplo_type
249  *              Whether T is upper or lower
250  *
251  * trans        (input) blas_trans_type
252  *              Whether T is no trans, trans, or conj trans
253  *
254  * n            (input) int
255  *              Dimension of AP and the length of vector x
256  *
257  * k            (input) int
258  *              Number of super(sub)diagonals of T
259  *
260  * T            (input) double*
261  *              The triangular matrix T
262  *
263  * ldt          (input) int
264  *              Leading dimension
265  *
266  * y            (output) double*
267  *              The vector y
268  *
269  * row          (input) int
270  *              The row to be copyied to y
271  */
272 {
273   enum blas_trans_type new_trans;
274   int conj = 0;
275   int kl, ku;
276 
277 
278   if (uplo == blas_upper) {
279     ku = k;
280     kl = 0;
281   } else {
282     ku = 0;
283     kl = k;
284   }
285 
286 
287   if (trans == blas_no_trans) {
288     new_trans = blas_no_trans;
289   } else if (trans == blas_conj_trans) {
290     new_trans = blas_trans;
291     conj = 1;
292   } else if (trans == blas_trans) {
293     new_trans = blas_trans;
294   } else {
295     /* conj, no trans */
296     new_trans = blas_no_trans;
297     conj = 1;
298   }
299 
300 
301 
302   dgbmv_commit(order, new_trans, n, n, kl, ku, T, ldt, y, row);
303 
304 
305 
306 
307 }
308 
ctbsv_copy(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,const void * T,int ldt,void * y,int row)309 void ctbsv_copy(enum blas_order_type order, enum blas_uplo_type uplo,
310 		enum blas_trans_type trans, int n, int k, const void *T,
311 		int ldt, void *y, int row)
312 /*
313  * Purpose
314  * =======
315  *
316  * Copy a row from T to y
317  *
318  *      NOTE: this function just encapsulates cgbmv_copy.
319  *
320  * Arguments
321  * =========
322  *
323  * order        (input) blas_order_type
324  *              Order of T; row or column major
325  *
326  * uplo         (input) blas_uplo_type
327  *              Whether T is upper or lower
328  *
329  * trans        (input) blas_trans_type
330  *              Whether T is no trans, trans, or conj trans
331  *
332  * n            (input) int
333  *              Dimension of AP and the length of vector x
334  *
335  * k            (input) int
336  *              Number of super(sub)diagonals of T.
337  *
338  * T            (input) void*
339  *              The triangular matrix T
340  *
341  * ldt          (input) int
342  *              Leading dimension
343  *
344  * y            (output) void*
345  *              The vector y
346  *
347  * row          (input) int
348  *              The row to be copyied to y
349  */
350 {
351   enum blas_trans_type new_trans;
352   int conj = 0;
353   int kl, ku;
354   float *y_i = (float *) y;
355 
356   if (uplo == blas_upper) {
357     ku = k;
358     kl = 0;
359   } else {
360     ku = 0;
361     kl = k;
362   }
363 
364 
365   if (trans == blas_no_trans) {
366     new_trans = blas_no_trans;
367   } else if (trans == blas_conj_trans) {
368     new_trans = blas_trans;
369     conj = 1;
370   } else if (trans == blas_trans) {
371     new_trans = blas_trans;
372   } else {
373     /* conj, no trans */
374     new_trans = blas_no_trans;
375     conj = 1;
376   }
377   cgbmv_copy(order, new_trans, n, n, kl, ku, T, ldt, y, row);
378 
379   if (conj) {
380     float y_elem[2];
381     int i, incyi, ni;
382 
383     incyi = 1;
384     ni = n;
385     ni *= 2;
386     incyi *= 2;
387     for (i = 0; i < ni; i += incyi) {
388       y_elem[0] = y_i[i];
389       y_elem[1] = y_i[i + 1];
390       y_elem[1] = -y_elem[1];
391       y_i[i] = y_elem[0];
392       y_i[i + 1] = y_elem[1];
393     }
394   }
395 
396 }
397 
ctbsv_commit(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,void * T,int ldt,void * y,int row)398 void ctbsv_commit(enum blas_order_type order, enum blas_uplo_type uplo,
399 		  enum blas_trans_type trans, int n, int k, void *T, int ldt,
400 		  void *y, int row)
401 /*
402  * Purpose
403  * =======
404  *
405  * Copy y to T
406  *
407  *      NOTE: this function just encapsulates cgbmv_commit.
408  *
409  * Arguments
410  * =========
411  *
412  * order        (input) blas_order_type
413  *              Order of T; row or column major
414  *
415  * uplo         (input) blas_uplo_type
416  *              Whether T is upper or lower
417  *
418  * trans        (input) blas_trans_type
419  *              Whether T is no trans, trans, or conj trans
420  *
421  * n            (input) int
422  *              Dimension of AP and the length of vector x
423  *
424  * k            (input) int
425  *              Number of super(sub)diagonals of T
426  *
427  * T            (input) void*
428  *              The triangular matrix T
429  *
430  * ldt          (input) int
431  *              Leading dimension
432  *
433  * y            (output) void*
434  *              The vector y
435  *
436  * row          (input) int
437  *              The row to be copyied to y
438  */
439 {
440   enum blas_trans_type new_trans;
441   int conj = 0;
442   int kl, ku;
443   float *y_i = (float *) y;
444 
445   if (uplo == blas_upper) {
446     ku = k;
447     kl = 0;
448   } else {
449     ku = 0;
450     kl = k;
451   }
452 
453 
454   if (trans == blas_no_trans) {
455     new_trans = blas_no_trans;
456   } else if (trans == blas_conj_trans) {
457     new_trans = blas_trans;
458     conj = 1;
459   } else if (trans == blas_trans) {
460     new_trans = blas_trans;
461   } else {
462     /* conj, no trans */
463     new_trans = blas_no_trans;
464     conj = 1;
465   }
466 
467   if (conj) {
468     float y_elem[2];
469     int i, incyi, ni;
470 
471     incyi = 1;
472     ni = n;
473     ni *= 2;
474     incyi *= 2;
475     for (i = 0; i < ni; i += incyi) {
476       y_elem[0] = y_i[i];
477       y_elem[1] = y_i[i + 1];
478       y_elem[1] = -y_elem[1];
479       y_i[i] = y_elem[0];
480       y_i[i + 1] = y_elem[1];
481     }
482   }
483 
484   cgbmv_commit(order, new_trans, n, n, kl, ku, T, ldt, y, row);
485 
486 
487   if (conj) {
488     /* now conjugate back - leave original */
489     float y_elem[2];
490     int i, incyi, ni;
491 
492     incyi = 1;
493     ni = n;
494     ni *= 2;
495     incyi *= 2;
496     for (i = 0; i < ni; i += incyi) {
497       y_elem[0] = y_i[i];
498       y_elem[1] = y_i[i + 1];
499       y_elem[1] = -y_elem[1];
500       y_i[i] = y_elem[0];
501       y_i[i + 1] = y_elem[1];
502     }
503   }
504 
505 }
506 
ztbsv_copy(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,const void * T,int ldt,void * y,int row)507 void ztbsv_copy(enum blas_order_type order, enum blas_uplo_type uplo,
508 		enum blas_trans_type trans, int n, int k, const void *T,
509 		int ldt, void *y, int row)
510 /*
511  * Purpose
512  * =======
513  *
514  * Copy a row from T to y
515  *
516  *      NOTE: this function just encapsulates zgbmv_copy.
517  *
518  * Arguments
519  * =========
520  *
521  * order        (input) blas_order_type
522  *              Order of T; row or column major
523  *
524  * uplo         (input) blas_uplo_type
525  *              Whether T is upper or lower
526  *
527  * trans        (input) blas_trans_type
528  *              Whether T is no trans, trans, or conj trans
529  *
530  * n            (input) int
531  *              Dimension of AP and the length of vector x
532  *
533  * k            (input) int
534  *              Number of super(sub)diagonals of T.
535  *
536  * T            (input) void*
537  *              The triangular matrix T
538  *
539  * ldt          (input) int
540  *              Leading dimension
541  *
542  * y            (output) void*
543  *              The vector y
544  *
545  * row          (input) int
546  *              The row to be copyied to y
547  */
548 {
549   enum blas_trans_type new_trans;
550   int conj = 0;
551   int kl, ku;
552   double *y_i = (double *) y;
553 
554   if (uplo == blas_upper) {
555     ku = k;
556     kl = 0;
557   } else {
558     ku = 0;
559     kl = k;
560   }
561 
562 
563   if (trans == blas_no_trans) {
564     new_trans = blas_no_trans;
565   } else if (trans == blas_conj_trans) {
566     new_trans = blas_trans;
567     conj = 1;
568   } else if (trans == blas_trans) {
569     new_trans = blas_trans;
570   } else {
571     /* conj, no trans */
572     new_trans = blas_no_trans;
573     conj = 1;
574   }
575   zgbmv_copy(order, new_trans, n, n, kl, ku, T, ldt, y, row);
576 
577   if (conj) {
578     double y_elem[2];
579     int i, incyi, ni;
580 
581     incyi = 1;
582     ni = n;
583     ni *= 2;
584     incyi *= 2;
585     for (i = 0; i < ni; i += incyi) {
586       y_elem[0] = y_i[i];
587       y_elem[1] = y_i[i + 1];
588       y_elem[1] = -y_elem[1];
589       y_i[i] = y_elem[0];
590       y_i[i + 1] = y_elem[1];
591     }
592   }
593 
594 }
595 
ztbsv_commit(enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans,int n,int k,void * T,int ldt,void * y,int row)596 void ztbsv_commit(enum blas_order_type order, enum blas_uplo_type uplo,
597 		  enum blas_trans_type trans, int n, int k, void *T, int ldt,
598 		  void *y, int row)
599 /*
600  * Purpose
601  * =======
602  *
603  * Copy y to T
604  *
605  *      NOTE: this function just encapsulates zgbmv_commit.
606  *
607  * Arguments
608  * =========
609  *
610  * order        (input) blas_order_type
611  *              Order of T; row or column major
612  *
613  * uplo         (input) blas_uplo_type
614  *              Whether T is upper or lower
615  *
616  * trans        (input) blas_trans_type
617  *              Whether T is no trans, trans, or conj trans
618  *
619  * n            (input) int
620  *              Dimension of AP and the length of vector x
621  *
622  * k            (input) int
623  *              Number of super(sub)diagonals of T
624  *
625  * T            (input) void*
626  *              The triangular matrix T
627  *
628  * ldt          (input) int
629  *              Leading dimension
630  *
631  * y            (output) void*
632  *              The vector y
633  *
634  * row          (input) int
635  *              The row to be copyied to y
636  */
637 {
638   enum blas_trans_type new_trans;
639   int conj = 0;
640   int kl, ku;
641   double *y_i = (double *) y;
642 
643   if (uplo == blas_upper) {
644     ku = k;
645     kl = 0;
646   } else {
647     ku = 0;
648     kl = k;
649   }
650 
651 
652   if (trans == blas_no_trans) {
653     new_trans = blas_no_trans;
654   } else if (trans == blas_conj_trans) {
655     new_trans = blas_trans;
656     conj = 1;
657   } else if (trans == blas_trans) {
658     new_trans = blas_trans;
659   } else {
660     /* conj, no trans */
661     new_trans = blas_no_trans;
662     conj = 1;
663   }
664 
665   if (conj) {
666     double y_elem[2];
667     int i, incyi, ni;
668 
669     incyi = 1;
670     ni = n;
671     ni *= 2;
672     incyi *= 2;
673     for (i = 0; i < ni; i += incyi) {
674       y_elem[0] = y_i[i];
675       y_elem[1] = y_i[i + 1];
676       y_elem[1] = -y_elem[1];
677       y_i[i] = y_elem[0];
678       y_i[i + 1] = y_elem[1];
679     }
680   }
681 
682   zgbmv_commit(order, new_trans, n, n, kl, ku, T, ldt, y, row);
683 
684 
685   if (conj) {
686     /* now conjugate back - leave original */
687     double y_elem[2];
688     int i, incyi, ni;
689 
690     incyi = 1;
691     ni = n;
692     ni *= 2;
693     incyi *= 2;
694     for (i = 0; i < ni; i += incyi) {
695       y_elem[0] = y_i[i];
696       y_elem[1] = y_i[i + 1];
697       y_elem[1] = -y_elem[1];
698       y_i[i] = y_elem[0];
699       y_i[i + 1] = y_elem[1];
700     }
701   }
702 
703 }
704 
705 
sprint_tbsv_matrix(float * T,int n,int k,int ldt,enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans)706 void sprint_tbsv_matrix(float *T, int n, int k, int ldt,
707 			enum blas_order_type order, enum blas_uplo_type uplo,
708 			enum blas_trans_type trans)
709 /*
710  * Purpose
711  * =======
712  *
713  * Print T
714  *
715  * Arguments
716  * =========
717  *
718  * order        (input) blas_order_type
719  *              Order of T; row or column major
720  *
721  * uplo         (input) blas_uplo_type
722  *              Whether T is upper or lower
723  *
724  * trans        (input) blas_trans_type
725  *              Whether T is no trans, trans, or conj trans
726  *
727  * n            (input) int
728  *              Dimension of AP and the length of vector x
729  *
730  * k            (input) int
731  *              Number of super(sub)diagonals of T
732  *
733  * T            (input) float*
734  *              The triangular matrix T
735  *
736  * ldt          (input) int
737  *              Leading dimension
738  *
739  */
740 {
741   int i;
742   float *T_row;
743   T_row = (float *) blas_malloc(n * sizeof(float));
744   if (n > 0 && T_row == NULL) {
745     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
746   }
747 
748   for (i = 0; i < n; i++) {
749     stbsv_copy(order, uplo, trans, n, k, T, ldt, T_row, i);
750     sprint_vector(T_row, n, 1, NULL);
751   }
752   printf("\n");
753   blas_free(T_row);
754 }
755 
dprint_tbsv_matrix(double * T,int n,int k,int ldt,enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans)756 void dprint_tbsv_matrix(double *T, int n, int k, int ldt,
757 			enum blas_order_type order, enum blas_uplo_type uplo,
758 			enum blas_trans_type trans)
759 /*
760  * Purpose
761  * =======
762  *
763  * Print T
764  *
765  * Arguments
766  * =========
767  *
768  * order        (input) blas_order_type
769  *              Order of T; row or column major
770  *
771  * uplo         (input) blas_uplo_type
772  *              Whether T is upper or lower
773  *
774  * trans        (input) blas_trans_type
775  *              Whether T is no trans, trans, or conj trans
776  *
777  * n            (input) int
778  *              Dimension of AP and the length of vector x
779  *
780  * k            (input) int
781  *              Number of super(sub)diagonals of T
782  *
783  * T            (input) double*
784  *              The triangular matrix T
785  *
786  * ldt          (input) int
787  *              Leading dimension
788  *
789  */
790 {
791   int i;
792   double *T_row;
793   T_row = (double *) blas_malloc(n * sizeof(double));
794   if (n > 0 && T_row == NULL) {
795     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
796   }
797 
798   for (i = 0; i < n; i++) {
799     dtbsv_copy(order, uplo, trans, n, k, T, ldt, T_row, i);
800     dprint_vector(T_row, n, 1, NULL);
801   }
802   printf("\n");
803   blas_free(T_row);
804 }
805 
cprint_tbsv_matrix(void * T,int n,int k,int ldt,enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans)806 void cprint_tbsv_matrix(void *T, int n, int k, int ldt,
807 			enum blas_order_type order, enum blas_uplo_type uplo,
808 			enum blas_trans_type trans)
809 /*
810  * Purpose
811  * =======
812  *
813  * Print T
814  *
815  * Arguments
816  * =========
817  *
818  * order        (input) blas_order_type
819  *              Order of T; row or column major
820  *
821  * uplo         (input) blas_uplo_type
822  *              Whether T is upper or lower
823  *
824  * trans        (input) blas_trans_type
825  *              Whether T is no trans, trans, or conj trans
826  *
827  * n            (input) int
828  *              Dimension of AP and the length of vector x
829  *
830  * k            (input) int
831  *              Number of super(sub)diagonals of T
832  *
833  * T            (input) void*
834  *              The triangular matrix T
835  *
836  * ldt          (input) int
837  *              Leading dimension
838  *
839  */
840 {
841   int i;
842   float *T_row;
843   T_row = (float *) blas_malloc(n * sizeof(float) * 2);
844   if (n > 0 && T_row == NULL) {
845     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
846   }
847 
848   for (i = 0; i < n; i++) {
849     ctbsv_copy(order, uplo, trans, n, k, T, ldt, T_row, i);
850     cprint_vector(T_row, n, 1, NULL);
851   }
852   printf("\n");
853   blas_free(T_row);
854 }
855 
zprint_tbsv_matrix(void * T,int n,int k,int ldt,enum blas_order_type order,enum blas_uplo_type uplo,enum blas_trans_type trans)856 void zprint_tbsv_matrix(void *T, int n, int k, int ldt,
857 			enum blas_order_type order, enum blas_uplo_type uplo,
858 			enum blas_trans_type trans)
859 /*
860  * Purpose
861  * =======
862  *
863  * Print T
864  *
865  * Arguments
866  * =========
867  *
868  * order        (input) blas_order_type
869  *              Order of T; row or column major
870  *
871  * uplo         (input) blas_uplo_type
872  *              Whether T is upper or lower
873  *
874  * trans        (input) blas_trans_type
875  *              Whether T is no trans, trans, or conj trans
876  *
877  * n            (input) int
878  *              Dimension of AP and the length of vector x
879  *
880  * k            (input) int
881  *              Number of super(sub)diagonals of T
882  *
883  * T            (input) void*
884  *              The triangular matrix T
885  *
886  * ldt          (input) int
887  *              Leading dimension
888  *
889  */
890 {
891   int i;
892   double *T_row;
893   T_row = (double *) blas_malloc(n * sizeof(double) * 2);
894   if (n > 0 && T_row == NULL) {
895     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
896   }
897 
898   for (i = 0; i < n; i++) {
899     ztbsv_copy(order, uplo, trans, n, k, T, ldt, T_row, i);
900     zprint_vector(T_row, n, 1, NULL);
901   }
902   printf("\n");
903   blas_free(T_row);
904 }
905