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_L_single.c 3.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. * 2014/05/23 Saar
  31. * TEST double precision blocked: OK
  32. * TEST single precision blocked: OK
  33. **************************************************************************************/
  34. #include <stdio.h>
  35. #include "common.h"
  36. // static FLOAT dp1 = 1.;
  37. // static FLOAT dm1 = -1.;
  38. #ifdef UNIT
  39. #define TRTI2 TRTI2_LU
  40. #define TRMM TRMM_LNLU
  41. #define TRSM TRSM_RNLU
  42. #else
  43. #define TRTI2 TRTI2_LN
  44. #define TRMM TRMM_LNLN
  45. #define TRSM TRSM_RNLN
  46. #endif
  47. blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa, FLOAT *sb, BLASLONG myid) {
  48. BLASLONG j, n, lda;
  49. FLOAT *a;
  50. // BLASLONG info=0;
  51. BLASLONG jb;
  52. BLASLONG NB;
  53. BLASLONG start_j;
  54. FLOAT beta_plus[2] = { ONE, ZERO};
  55. FLOAT beta_minus[2] = {-ONE, ZERO};
  56. n = args -> n;
  57. NB = GEMM_Q;
  58. if (n < NB) {
  59. TRTI2(args, NULL, range_n, sa, sb, 0);
  60. return 0;
  61. }
  62. lda = args -> lda;
  63. a = (FLOAT *) args -> a;
  64. args -> ldb = lda;
  65. args -> ldc = lda;
  66. args -> alpha = NULL;
  67. start_j = 0;
  68. while (start_j < n) start_j += NB;
  69. start_j -= NB;
  70. for (j = start_j ; j >=0 ; j-= NB)
  71. {
  72. jb = n - j;
  73. if ( jb > NB ) jb = NB;
  74. args -> n = jb;
  75. args -> m = n-j-jb;
  76. args -> a = &a[(j+jb+(j+jb)*lda) * COMPSIZE];
  77. args -> b = &a[(j+jb+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. }