You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

trtri_U_single.c 3.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /***************************************************************************
  2. * Copyright (c) 2013, The OpenBLAS Project
  3. * All rights reserved.
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in
  11. * the documentation and/or other materials provided with the
  12. * distribution.
  13. * 3. Neither the name of the OpenBLAS project nor the names of
  14. * its contributors may be used to endorse or promote products
  15. * derived from this software without specific prior written permission.
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
  20. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  22. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  23. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  24. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  25. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. * *****************************************************************************/
  27. /**************************************************************************************
  28. * 2014/05/22 Saar
  29. * TEST double precision unblocked : OK
  30. * TEST double precision blocked : OK
  31. * 2014/05/23
  32. * TEST single precision blocked : OK
  33. *
  34. **************************************************************************************/
  35. #include <stdio.h>
  36. #include "common.h"
  37. // static FLOAT dp1 = 1.;
  38. // static FLOAT dm1 = -1.;
  39. #ifdef UNIT
  40. #define TRTI2 TRTI2_UU
  41. #else
  42. #define TRTI2 TRTI2_UN
  43. #endif
  44. #ifdef UNIT
  45. #define TRMM TRMM_LNUU
  46. #define TRSM TRSM_RNUU
  47. #else
  48. #define TRMM TRMM_LNUN
  49. #define TRSM TRSM_RNUN
  50. #endif
  51. blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa, FLOAT *sb, BLASLONG myid) {
  52. BLASLONG j, n, lda;
  53. FLOAT *a;
  54. // BLASLONG info=0;
  55. BLASLONG jb;
  56. BLASLONG NB;
  57. FLOAT beta_plus[2] = { ONE, ZERO};
  58. FLOAT beta_minus[2] = {-ONE, ZERO};
  59. n = args -> n;
  60. NB = GEMM_Q;
  61. if (n <= NB) {
  62. TRTI2(args, NULL, range_n, sa, sb, 0);
  63. return 0;
  64. }
  65. lda = args -> lda;
  66. a = (FLOAT *) args -> a;
  67. args -> ldb = lda;
  68. args -> ldc = lda;
  69. args -> alpha = NULL;
  70. for (j = 0; j < n; j += NB)
  71. {
  72. jb = n - j;
  73. if ( jb > NB ) jb = NB;
  74. args -> n = jb;
  75. args -> m = j;
  76. args -> a = &a[0];
  77. args -> b = &a[(j*lda) * COMPSIZE];
  78. args -> beta = beta_plus;
  79. TRMM(args, NULL, NULL, sa, sb, 0);
  80. args -> a = &a[(j+j*lda) * COMPSIZE];
  81. args -> beta = beta_minus;
  82. TRSM(args, NULL, NULL, sa, sb, 0);
  83. args -> a = &a[(j+j*lda) * COMPSIZE];
  84. TRTI2(args, NULL, range_n, sa, sb, 0);
  85. }
  86. return 0;
  87. }