123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- /* dtrti2.f -- translated by f2c (version 20061008).
- You must link the resulting object file with libf2c:
- on Microsoft Windows system, link with libf2c.lib;
- on Linux or Unix systems, link with .../path/to/libf2c.a -lm
- or, if you install libf2c.a in a standard place, with -lf2c -lm
- -- in that order, at the end of the command line, as in
- cc *.o -lf2c -lm
- Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
- http://www.netlib.org/f2c/libf2c.zip
- */
- #include "f2c.h"
- #include "blaswrap.h"
- /* Table of constant values */
- static integer c__1 = 1;
- /* Subroutine */ int _starpu_dtrti2_(char *uplo, char *diag, integer *n, doublereal *
- a, integer *lda, integer *info)
- {
- /* System generated locals */
- integer a_dim1, a_offset, i__1, i__2;
- /* Local variables */
- integer j;
- doublereal ajj;
- extern /* Subroutine */ int _starpu_dscal_(integer *, doublereal *, doublereal *,
- integer *);
- extern logical _starpu_lsame_(char *, char *);
- logical upper;
- extern /* Subroutine */ int _starpu_dtrmv_(char *, char *, char *, integer *,
- doublereal *, integer *, doublereal *, integer *), _starpu_xerbla_(char *, integer *);
- logical nounit;
- /* -- LAPACK routine (version 3.2) -- */
- /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
- /* November 2006 */
- /* .. Scalar Arguments .. */
- /* .. */
- /* .. Array Arguments .. */
- /* .. */
- /* Purpose */
- /* ======= */
- /* DTRTI2 computes the inverse of a real upper or lower triangular */
- /* matrix. */
- /* This is the Level 2 BLAS version of the algorithm. */
- /* Arguments */
- /* ========= */
- /* UPLO (input) CHARACTER*1 */
- /* Specifies whether the matrix A is upper or lower triangular. */
- /* = 'U': Upper triangular */
- /* = 'L': Lower triangular */
- /* DIAG (input) CHARACTER*1 */
- /* Specifies whether or not the matrix A is unit triangular. */
- /* = 'N': Non-unit triangular */
- /* = 'U': Unit triangular */
- /* N (input) INTEGER */
- /* The order of the matrix A. N >= 0. */
- /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
- /* On entry, the triangular matrix A. If UPLO = 'U', the */
- /* leading n by n upper triangular part of the array A contains */
- /* the upper triangular matrix, and the strictly lower */
- /* triangular part of A is not referenced. If UPLO = 'L', the */
- /* leading n by n lower triangular part of the array A contains */
- /* the lower triangular matrix, and the strictly upper */
- /* triangular part of A is not referenced. If DIAG = 'U', the */
- /* diagonal elements of A are also not referenced and are */
- /* assumed to be 1. */
- /* On exit, the (triangular) inverse of the original matrix, in */
- /* the same storage format. */
- /* LDA (input) INTEGER */
- /* The leading dimension of the array A. LDA >= max(1,N). */
- /* INFO (output) INTEGER */
- /* = 0: successful exit */
- /* < 0: if INFO = -k, the k-th argument had an illegal value */
- /* ===================================================================== */
- /* .. Parameters .. */
- /* .. */
- /* .. Local Scalars .. */
- /* .. */
- /* .. External Functions .. */
- /* .. */
- /* .. External Subroutines .. */
- /* .. */
- /* .. Intrinsic Functions .. */
- /* .. */
- /* .. Executable Statements .. */
- /* Test the input parameters. */
- /* Parameter adjustments */
- a_dim1 = *lda;
- a_offset = 1 + a_dim1;
- a -= a_offset;
- /* Function Body */
- *info = 0;
- upper = _starpu_lsame_(uplo, "U");
- nounit = _starpu_lsame_(diag, "N");
- if (! upper && ! _starpu_lsame_(uplo, "L")) {
- *info = -1;
- } else if (! nounit && ! _starpu_lsame_(diag, "U")) {
- *info = -2;
- } else if (*n < 0) {
- *info = -3;
- } else if (*lda < max(1,*n)) {
- *info = -5;
- }
- if (*info != 0) {
- i__1 = -(*info);
- _starpu_xerbla_("DTRTI2", &i__1);
- return 0;
- }
- if (upper) {
- /* Compute inverse of upper triangular matrix. */
- i__1 = *n;
- for (j = 1; j <= i__1; ++j) {
- if (nounit) {
- a[j + j * a_dim1] = 1. / a[j + j * a_dim1];
- ajj = -a[j + j * a_dim1];
- } else {
- ajj = -1.;
- }
- /* Compute elements 1:j-1 of j-th column. */
- i__2 = j - 1;
- _starpu_dtrmv_("Upper", "No transpose", diag, &i__2, &a[a_offset], lda, &
- a[j * a_dim1 + 1], &c__1);
- i__2 = j - 1;
- _starpu_dscal_(&i__2, &ajj, &a[j * a_dim1 + 1], &c__1);
- /* L10: */
- }
- } else {
- /* Compute inverse of lower triangular matrix. */
- for (j = *n; j >= 1; --j) {
- if (nounit) {
- a[j + j * a_dim1] = 1. / a[j + j * a_dim1];
- ajj = -a[j + j * a_dim1];
- } else {
- ajj = -1.;
- }
- if (j < *n) {
- /* Compute elements j+1:n of j-th column. */
- i__1 = *n - j;
- _starpu_dtrmv_("Lower", "No transpose", diag, &i__1, &a[j + 1 + (j +
- 1) * a_dim1], lda, &a[j + 1 + j * a_dim1], &c__1);
- i__1 = *n - j;
- _starpu_dscal_(&i__1, &ajj, &a[j + 1 + j * a_dim1], &c__1);
- }
- /* L20: */
- }
- }
- return 0;
- /* End of DTRTI2 */
- } /* _starpu_dtrti2_ */
|