summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/C/lapack-aux.c
diff options
context:
space:
mode:
authorDominic Steinitz <dominic@steinitz.org>2017-03-17 14:20:07 +0000
committerDominic Steinitz <dominic@steinitz.org>2017-03-17 14:20:07 +0000
commitfa1642dcf26f1da0a6f4c1324bcd1e8baf9fd478 (patch)
tree356a1c759bd5f54f20399e57ff1f99afca14733c /packages/base/src/Internal/C/lapack-aux.c
parentd2d0066d2ff3d8e66ce902ee1b9d1317f1710a2c (diff)
Support triangular matrices.
Diffstat (limited to 'packages/base/src/Internal/C/lapack-aux.c')
-rw-r--r--packages/base/src/Internal/C/lapack-aux.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/packages/base/src/Internal/C/lapack-aux.c b/packages/base/src/Internal/C/lapack-aux.c
index ff7ad92..4a8129c 100644
--- a/packages/base/src/Internal/C/lapack-aux.c
+++ b/packages/base/src/Internal/C/lapack-aux.c
@@ -584,6 +584,90 @@ int cholSolveC_l(KOCMAT(a),OCMAT(b)) {
584 OK 584 OK
585} 585}
586 586
587//////// triangular real linear system ////////////
588
589int dtrtrs_(char *uplo, char *trans, char *diag, integer *n, integer *nrhs,
590 doublereal *a, integer *lda, doublereal *b, integer *ldb, integer *
591 info);
592
593int triSolveR_l_u(KODMAT(a),ODMAT(b)) {
594 integer n = ar;
595 integer lda = aXc;
596 integer nhrs = bc;
597 REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE);
598 DEBUGMSG("triSolveR_l_u");
599 integer res;
600 dtrtrs_ ("U",
601 "N",
602 "N",
603 &n,&nhrs,
604 (double*)ap, &lda,
605 bp, &n,
606 &res);
607 CHECK(res,res);
608 OK
609}
610
611int triSolveR_l_l(KODMAT(a),ODMAT(b)) {
612 integer n = ar;
613 integer lda = aXc;
614 integer nhrs = bc;
615 REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE);
616 DEBUGMSG("triSolveR_l_l");
617 integer res;
618 dtrtrs_ ("L",
619 "N",
620 "N",
621 &n,&nhrs,
622 (double*)ap, &lda,
623 bp, &n,
624 &res);
625 CHECK(res,res);
626 OK
627}
628
629//////// triangular complex linear system ////////////
630
631int ztrtrs_(char *uplo, char *trans, char *diag, integer *n, integer *nrhs,
632 doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb,
633 integer *info);
634
635int triSolveC_l_u(KOCMAT(a),OCMAT(b)) {
636 integer n = ar;
637 integer lda = aXc;
638 integer nhrs = bc;
639 REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE);
640 DEBUGMSG("triSolveC_l_u");
641 integer res;
642 ztrtrs_ ("U",
643 "N",
644 "N",
645 &n,&nhrs,
646 (doublecomplex*)ap, &lda,
647 bp, &n,
648 &res);
649 CHECK(res,res);
650 OK
651}
652
653int triSolveC_l_l(KOCMAT(a),OCMAT(b)) {
654 integer n = ar;
655 integer lda = aXc;
656 integer nhrs = bc;
657 REQUIRES(n>=1 && ar==ac && ar==br,BAD_SIZE);
658 DEBUGMSG("triSolveC_l_u");
659 integer res;
660 ztrtrs_ ("L",
661 "N",
662 "N",
663 &n,&nhrs,
664 (doublecomplex*)ap, &lda,
665 bp, &n,
666 &res);
667 CHECK(res,res);
668 OK
669}
670
587//////////////////// least squares real linear system //////////// 671//////////////////// least squares real linear system ////////////
588 672
589int dgels_(char *trans, integer *m, integer *n, integer * 673int dgels_(char *trans, integer *m, integer *n, integer *