Skip to content

Commit 16d2e9e

Browse files
authored
Defined lt, lte, gt, gte + misc. other updates. (#712)
Details: - Changed invertsc operation to be a non-destructive operation; that is, it now takes separate input and output operands. This change applies to both the object and typed APIs. - Defined an alternative square root operation, sqrtrsc, which, when operating on complex scalars, assumes the imaginary part of the input to be zero. - Changed the semantics of addm, subm, copym, axpym, scal2m, and xpbym so that when the source matrix has an implicit unit diagonal, the operation leaves the diagonal of the destination matrix untouched. Previously, the operations would interpret an implicit unit diagonal on the source matrix as a request to manifest the unit diagonal *explicitly* on output (either as something to copy in the case of copym, or something to compute with in the cases of addm, subm, axpym, scal2m, and xpbym). It turns out that this behavior was too cute by half and could cause unintended headaches for practical use cases. (This change in behavior also required small modifications to the trmv and trsv testsuite modules so that they would properly test matrices with unit diagonals.) - Added missing dependencies for copym to gemv, ger, hemv, trmv, and trsv testsuite modules. - Implemented level-0-like ltsc, ltesc, gtsc, gtesc operations in frame/util, which use lt, lte, gt, and gte level-0 scalar macros. - Trivial variable rename in bli_part.c to harmonize with other variable naming conventions.
1 parent 9a366b1 commit 16d2e9e

29 files changed

+379
-114
lines changed

examples/oapi/04level0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int main( int argc, char** argv )
166166
bli_normfsc( &zeta, &alpha );
167167
bli_printm( "alpha := normf( zeta ) # normf() = complex modulus in complex domain.", &alpha, "%4.1f", "" );
168168

169-
bli_invertsc( &gamma );
169+
bli_invertsc( &gamma, &gamma );
170170
bli_printm( "gamma := 1.0 / gamma", &gamma, "%4.2f", "" );
171171

172172

frame/0/bli_l0_check.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,8 @@ GENFRONT( copysc )
5555
GENFRONT( divsc )
5656
GENFRONT( mulsc )
5757
GENFRONT( sqrtsc )
58+
GENFRONT( sqrtrsc )
5859
GENFRONT( subsc )
59-
60-
61-
#undef GENFRONT
62-
#define GENFRONT( opname ) \
63-
\
64-
void PASTEMAC(opname,_check) \
65-
( \
66-
const obj_t* chi \
67-
) \
68-
{ \
69-
bli_l0_xsc_check( chi ); \
70-
}
71-
7260
GENFRONT( invertsc )
7361

7462

@@ -357,7 +345,7 @@ void bli_l0_xxbsc_check
357345
(
358346
const obj_t* chi,
359347
const obj_t* psi,
360-
const bool* is_eq
348+
const bool* is
361349
)
362350
{
363351
err_t e_val;

frame/0/bli_l0_check.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,8 @@ GENTPROT( copysc )
5151
GENTPROT( divsc )
5252
GENTPROT( mulsc )
5353
GENTPROT( sqrtsc )
54+
GENTPROT( sqrtrsc )
5455
GENTPROT( subsc )
55-
56-
57-
#undef GENTPROT
58-
#define GENTPROT( opname ) \
59-
\
60-
void PASTEMAC(opname,_check) \
61-
( \
62-
const obj_t* chi \
63-
);
64-
6556
GENTPROT( invertsc )
6657

6758

@@ -152,5 +143,5 @@ void bli_l0_xxbsc_check
152143
(
153144
const obj_t* chi,
154145
const obj_t* psi,
155-
const bool* is_eq
146+
const bool* is
156147
);

frame/0/bli_l0_fpa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ GENFRONT( mulsc )
5656
GENFRONT( subsc )
5757
GENFRONT( invertsc )
5858
GENFRONT( sqrtsc )
59+
GENFRONT( sqrtrsc )
5960
GENFRONT( unzipsc )
6061
GENFRONT( zipsc )
6162

frame/0/bli_l0_fpa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ GENPROT( mulsc )
5050
GENPROT( subsc )
5151
GENPROT( invertsc )
5252
GENPROT( sqrtsc )
53+
GENPROT( sqrtrsc )
5354
GENPROT( unzipsc )
5455
GENPROT( zipsc )
5556

frame/0/bli_l0_ft.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// -- Level-0 function types ---------------------------------------------------
3838
//
3939

40-
// addsc, divsc, subsc
40+
// addsc, divsc, subsc, invertsc
4141

4242
#undef GENTDEF
4343
#define GENTDEF( ctype, ch, opname, tsuf ) \
@@ -52,18 +52,6 @@ typedef void (*PASTECH2(ch,opname,tsuf)) \
5252
INSERT_GENTDEF( addsc )
5353
INSERT_GENTDEF( divsc )
5454
INSERT_GENTDEF( subsc )
55-
56-
// invertsc
57-
58-
#undef GENTDEF
59-
#define GENTDEF( ctype, ch, opname, tsuf ) \
60-
\
61-
typedef void (*PASTECH2(ch,opname,tsuf)) \
62-
( \
63-
conj_t conjchi, \
64-
ctype* chi \
65-
);
66-
6755
INSERT_GENTDEF( invertsc )
6856

6957
// mulsc
@@ -119,6 +107,19 @@ typedef void (*PASTECH2(ch,opname,tsuf)) \
119107

120108
INSERT_GENTDEF( sqrtsc )
121109

110+
// sqrtrsc
111+
112+
#undef GENTDEF
113+
#define GENTDEF( ctype, ch, opname, tsuf ) \
114+
\
115+
typedef void (*PASTECH2(ch,opname,tsuf)) \
116+
( \
117+
const ctype* chi, \
118+
ctype* psi \
119+
);
120+
121+
INSERT_GENTDEF( sqrtrsc )
122+
122123
// getsc
123124

124125
#undef GENTDEF

frame/0/bli_l0_oapi.c

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -115,38 +115,6 @@ GENFRONT( addsc )
115115
GENFRONT( divsc )
116116
GENFRONT( mulsc )
117117
GENFRONT( subsc )
118-
119-
120-
#undef GENFRONT
121-
#define GENFRONT( opname ) \
122-
\
123-
void PASTEMAC0(opname) \
124-
( \
125-
const obj_t* chi \
126-
) \
127-
{ \
128-
bli_init_once(); \
129-
\
130-
num_t dt = bli_obj_dt( chi ); \
131-
\
132-
conj_t conjchi = bli_obj_conj_status( chi ); \
133-
\
134-
void* buf_chi = bli_obj_buffer_for_1x1( dt, chi ); \
135-
\
136-
if ( bli_error_checking_is_enabled() ) \
137-
PASTEMAC(opname,_check)( chi ); \
138-
\
139-
/* Query a type-specific function pointer, except one that uses
140-
void* for function arguments instead of typed pointers. */ \
141-
PASTECH(opname,_vft) f = PASTEMAC(opname,_qfp)( dt ); \
142-
\
143-
f \
144-
( \
145-
conjchi, \
146-
buf_chi \
147-
); \
148-
}
149-
150118
GENFRONT( invertsc )
151119

152120

@@ -181,6 +149,7 @@ void PASTEMAC0(opname) \
181149
}
182150

183151
GENFRONT( sqrtsc )
152+
GENFRONT( sqrtrsc )
184153

185154

186155
#undef GENFRONT

frame/0/bli_l0_oapi.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,8 @@ GENPROT( addsc )
6363
GENPROT( divsc )
6464
GENPROT( mulsc )
6565
GENPROT( sqrtsc )
66+
GENPROT( sqrtrsc )
6667
GENPROT( subsc )
67-
68-
69-
#undef GENPROT
70-
#define GENPROT( opname ) \
71-
\
72-
BLIS_EXPORT_BLIS void PASTEMAC0(opname) \
73-
( \
74-
const obj_t* chi \
75-
);
76-
7768
GENPROT( invertsc )
7869

7970

frame/0/bli_l0_tapi.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ INSERT_GENTFUNC_BASIC( subsc, subs )
6666
\
6767
void PASTEMAC(ch,opname) \
6868
( \
69-
conj_t conjchi, \
70-
ctype* chi \
69+
conj_t conjchi, \
70+
const ctype* chi, \
71+
ctype* psi \
7172
) \
7273
{ \
7374
bli_init_once(); \
@@ -76,7 +77,7 @@ void PASTEMAC(ch,opname) \
7677
\
7778
PASTEMAC(ch,copycjs)( conjchi, *chi, chi_conj ); \
7879
PASTEMAC(ch,kername)( chi_conj ); \
79-
PASTEMAC(ch,copys)( chi_conj, *chi ); \
80+
PASTEMAC(ch,copys)( chi_conj, *psi ); \
8081
}
8182

8283
INSERT_GENTFUNC_BASIC( invertsc, inverts )
@@ -176,6 +177,25 @@ void PASTEMAC(ch,opname) \
176177
INSERT_GENTFUNC_BASIC0( sqrtsc )
177178

178179

180+
#undef GENTFUNCR
181+
#define GENTFUNCR( ctype, ctype_r, ch, chr, opname ) \
182+
\
183+
void PASTEMAC(ch,opname) \
184+
( \
185+
const ctype* chi, \
186+
ctype* psi \
187+
) \
188+
{ \
189+
bli_init_once(); \
190+
\
191+
const ctype_r chi_r = PASTEMAC(ch,real)( *chi ); \
192+
\
193+
PASTEMAC2(chr,ch,sqrt2s)( chi_r, *psi ); \
194+
}
195+
196+
INSERT_GENTFUNCR_BASIC0( sqrtrsc )
197+
198+
179199
#undef GENTFUNC
180200
#define GENTFUNC( ctype, ch, opname ) \
181201
\

frame/0/bli_l0_tapi.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ INSERT_GENTPROT_BASIC0( addsc )
5151
INSERT_GENTPROT_BASIC0( divsc )
5252
INSERT_GENTPROT_BASIC0( mulsc )
5353
INSERT_GENTPROT_BASIC0( subsc )
54-
55-
56-
#undef GENTPROT
57-
#define GENTPROT( ctype, ch, opname ) \
58-
\
59-
BLIS_EXPORT_BLIS void PASTEMAC(ch,opname) \
60-
( \
61-
conj_t conjchi, \
62-
ctype* chi \
63-
);
64-
6554
INSERT_GENTPROT_BASIC0( invertsc )
6655

6756

@@ -88,6 +77,7 @@ BLIS_EXPORT_BLIS void PASTEMAC(ch,opname) \
8877
);
8978

9079
INSERT_GENTPROT_BASIC0( sqrtsc )
80+
INSERT_GENTPROT_BASIC0( sqrtrsc )
9181

9282

9383
#undef GENTPROT

0 commit comments

Comments
 (0)