dlat2s.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* dlat2s.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. /* Subroutine */ int _starpu_dlat2s_(char *uplo, integer *n, doublereal *a, integer *
  14. lda, real *sa, integer *ldsa, integer *info)
  15. {
  16. /* System generated locals */
  17. integer sa_dim1, sa_offset, a_dim1, a_offset, i__1, i__2;
  18. /* Local variables */
  19. integer i__, j;
  20. doublereal rmax;
  21. extern logical _starpu_lsame_(char *, char *);
  22. logical upper;
  23. extern doublereal _starpu_slamch_(char *);
  24. /* -- LAPACK PROTOTYPE auxiliary routine (version 3.1.2) -- */
  25. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  26. /* May 2007 */
  27. /* .. Scalar Arguments .. */
  28. /* .. */
  29. /* .. Array Arguments .. */
  30. /* .. */
  31. /* Purpose */
  32. /* ======= */
  33. /* DLAT2S converts a DOUBLE PRECISION triangular matrix, SA, to a SINGLE */
  34. /* PRECISION triangular matrix, A. */
  35. /* RMAX is the overflow for the SINGLE PRECISION arithmetic */
  36. /* DLAS2S checks that all the entries of A are between -RMAX and */
  37. /* RMAX. If not the convertion is aborted and a flag is raised. */
  38. /* This is an auxiliary routine so there is no argument checking. */
  39. /* Arguments */
  40. /* ========= */
  41. /* UPLO (input) CHARACTER*1 */
  42. /* = 'U': A is upper triangular; */
  43. /* = 'L': A is lower triangular. */
  44. /* N (input) INTEGER */
  45. /* The number of rows and columns of the matrix A. N >= 0. */
  46. /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
  47. /* On entry, the N-by-N triangular coefficient matrix A. */
  48. /* LDA (input) INTEGER */
  49. /* The leading dimension of the array A. LDA >= max(1,N). */
  50. /* SA (output) REAL array, dimension (LDSA,N) */
  51. /* Only the UPLO part of SA is referenced. On exit, if INFO=0, */
  52. /* the N-by-N coefficient matrix SA; if INFO>0, the content of */
  53. /* the UPLO part of SA is unspecified. */
  54. /* LDSA (input) INTEGER */
  55. /* The leading dimension of the array SA. LDSA >= max(1,M). */
  56. /* INFO (output) INTEGER */
  57. /* = 0: successful exit. */
  58. /* = 1: an entry of the matrix A is greater than the SINGLE */
  59. /* PRECISION overflow threshold, in this case, the content */
  60. /* of the UPLO part of SA in exit is unspecified. */
  61. /* ========= */
  62. /* .. Local Scalars .. */
  63. /* .. */
  64. /* .. External Functions .. */
  65. /* .. */
  66. /* .. Executable Statements .. */
  67. /* Parameter adjustments */
  68. a_dim1 = *lda;
  69. a_offset = 1 + a_dim1;
  70. a -= a_offset;
  71. sa_dim1 = *ldsa;
  72. sa_offset = 1 + sa_dim1;
  73. sa -= sa_offset;
  74. /* Function Body */
  75. rmax = _starpu_slamch_("O");
  76. upper = _starpu_lsame_(uplo, "U");
  77. if (upper) {
  78. i__1 = *n;
  79. for (j = 1; j <= i__1; ++j) {
  80. i__2 = j;
  81. for (i__ = 1; i__ <= i__2; ++i__) {
  82. if (a[i__ + j * a_dim1] < -rmax || a[i__ + j * a_dim1] > rmax)
  83. {
  84. *info = 1;
  85. goto L50;
  86. }
  87. sa[i__ + j * sa_dim1] = a[i__ + j * a_dim1];
  88. /* L10: */
  89. }
  90. /* L20: */
  91. }
  92. } else {
  93. i__1 = *n;
  94. for (j = 1; j <= i__1; ++j) {
  95. i__2 = *n;
  96. for (i__ = j; i__ <= i__2; ++i__) {
  97. if (a[i__ + j * a_dim1] < -rmax || a[i__ + j * a_dim1] > rmax)
  98. {
  99. *info = 1;
  100. goto L50;
  101. }
  102. sa[i__ + j * sa_dim1] = a[i__ + j * a_dim1];
  103. /* L30: */
  104. }
  105. /* L40: */
  106. }
  107. }
  108. L50:
  109. return 0;
  110. /* End of DLAT2S */
  111. } /* _starpu_dlat2s_ */