Coverage Report

Created: 2025-09-18 20:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/contrib/openblas/interface/lapack/trtri.c
Line
Count
Source
1
/*********************************************************************/
2
/* Copyright 2009, 2010 The University of Texas at Austin.           */
3
/* All rights reserved.                                              */
4
/*                                                                   */
5
/* Redistribution and use in source and binary forms, with or        */
6
/* without modification, are permitted provided that the following   */
7
/* conditions are met:                                               */
8
/*                                                                   */
9
/*   1. Redistributions of source code must retain the above         */
10
/*      copyright notice, this list of conditions and the following  */
11
/*      disclaimer.                                                  */
12
/*                                                                   */
13
/*   2. Redistributions in binary form must reproduce the above      */
14
/*      copyright notice, this list of conditions and the following  */
15
/*      disclaimer in the documentation and/or other materials       */
16
/*      provided with the distribution.                              */
17
/*                                                                   */
18
/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
19
/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
20
/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
21
/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
22
/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
23
/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
24
/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
25
/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
26
/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
27
/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
28
/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
29
/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
30
/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
31
/*    POSSIBILITY OF SUCH DAMAGE.                                    */
32
/*                                                                   */
33
/* The views and conclusions contained in the software and           */
34
/* documentation are those of the authors and should not be          */
35
/* interpreted as representing official policies, either expressed   */
36
/* or implied, of The University of Texas at Austin.                 */
37
/*********************************************************************/
38
39
#include <stdio.h>
40
#include "common.h"
41
#ifdef FUNCTION_PROFILE
42
#include "functable.h"
43
#endif
44
45
#ifdef XDOUBLE
46
#define ERROR_NAME "QTRTRI"
47
#elif defined(DOUBLE)
48
0
#define ERROR_NAME "DTRTRI"
49
#else
50
0
#define ERROR_NAME "STRTRI"
51
#endif
52
53
static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={
54
  TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE,
55
};
56
57
#ifdef SMP
58
static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={
59
  TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL,
60
};
61
#endif
62
63
64
0
int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){
65
66
0
  blas_arg_t args;
67
68
0
  blasint uplo_arg = *UPLO;
69
0
  blasint diag_arg = *DIAG;
70
0
  blasint uplo, diag;
71
0
  blasint info;
72
0
  FLOAT *buffer;
73
#ifdef PPC440
74
  extern
75
#endif
76
0
  FLOAT *sa, *sb;
77
78
0
  PRINT_DEBUG_NAME;
79
80
0
  args.n    = *N;
81
0
  args.a    = (void *)a;
82
0
  args.lda  = *ldA;
83
84
0
  TOUPPER(uplo_arg);
85
0
  TOUPPER(diag_arg);
86
87
88
0
  uplo = -1;
89
0
  if (uplo_arg == 'U') uplo = 0;
90
0
  if (uplo_arg == 'L') uplo = 1;
91
0
  diag = -1;
92
0
  if (diag_arg == 'U') diag = 0;
93
0
  if (diag_arg == 'N') diag = 1;
94
95
96
0
  info  = 0;
97
0
  if (args.lda  < MAX(1,args.n)) info = 5;
98
0
  if (args.n    < 0)             info = 3;
99
0
  if (diag < 0)                  info = 2;
100
0
  if (uplo < 0)                  info = 1;
101
0
  if (info) {
102
0
    BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME) - 1);
103
0
    *Info = - info;
104
0
    return 0;
105
0
  }
106
107
0
  *Info = 0;
108
109
0
  if (args.n == 0) return 0;
110
111
0
  if (diag) {
112
0
    if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) {
113
0
      *Info = IAMIN_K(args.n, args.a, args.lda + 1);
114
0
      return 0;
115
0
    }
116
0
  }
117
118
0
  IDEBUG_START;
119
120
0
  FUNCTION_PROFILE_START();
121
122
0
#ifndef PPC440
123
0
  buffer = (FLOAT *)blas_memory_alloc(1);
124
125
0
  sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
126
0
  sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
127
0
#endif
128
129
0
#ifdef SMP
130
0
if (args.n <= 150)
131
0
  args.nthreads = 1;
132
0
else
133
0
  args.nthreads = num_cpu_avail(4);
134
135
0
  if (args.nthreads == 1) {
136
0
#endif
137
138
0
    *Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
139
140
0
#ifdef SMP
141
0
  } else {
142
143
0
    *Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
144
145
0
  }
146
0
#endif
147
148
0
#ifndef PPC440
149
0
  blas_memory_free(buffer);
150
0
#endif
151
152
0
  FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n,
153
0
              args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.))
154
0
           +  args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.)));
155
156
0
  IDEBUG_END;
157
158
0
  return 0;
159
0
}
Unexecuted instantiation: strtri_
Unexecuted instantiation: dtrtri_