1 //------------------------------------------------------------------------------
2 // GB_unop_factory.c:  switch factory for unary operators and 2 types
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 // Switch factory for applying a unary operator.  This file is #include'd into
11 // GB_apply_op.c and GB_transpose_op.c, which must define the GrB_UnaryOp op
12 // and the GrB_Type Atype.
13 
14 // If the op is user-defined, or if the combinations of z and x type are not
15 // handled by the built-in operator, then this switch factory falls through
16 // with no action taken.
17 
18 {
19     // switch factory for two types, controlled by code1 and code2
20     GB_Type_code code1 = op->ztype->code ;      // defines ztype
21     GB_Type_code code2 = Atype->code ;          // defines the type of A
22     GB_Opcode opcode = op->opcode ;
23 
24     ASSERT (code1 <= GB_UDT_code) ;
25     ASSERT (code2 <= GB_UDT_code) ;
26 
27     if (opcode == GB_IDENTITY_opcode)
28     {
29 
30         //----------------------------------------------------------------------
31         // z = (ztype) x, with arbitrary typecasting
32         //----------------------------------------------------------------------
33 
34         // the identity operator is only used with typecasting via this switch
35         // factory, so code1 is never equal to code2.
36 
37         ASSERT (code1 != code2)
38         #define GB_OPNAME _identity
39         #define GB_EXCLUDE_SAME_TYPES
40         #include "GB_2type_factory.c"
41 
42     }
43     else if (opcode == GB_ONE_opcode)
44     {
45 
46         //----------------------------------------------------------------------
47         // z = (ztype) 1, where the type of A is ignored
48         //----------------------------------------------------------------------
49 
50         switch (code1)
51         {
52             case GB_BOOL_code   : GB_WORKER (_one, _bool  , bool      , _bool  , bool      )
53             case GB_INT8_code   : GB_WORKER (_one, _int8  , int8_t    , _int8  , int8_t    )
54             case GB_INT16_code  : GB_WORKER (_one, _int16 , int16_t   , _int16 , int16_t   )
55             case GB_INT32_code  : GB_WORKER (_one, _int32 , int32_t   , _int32 , int32_t   )
56             case GB_INT64_code  : GB_WORKER (_one, _int64 , int64_t   , _int64 , int64_t   )
57             case GB_UINT8_code  : GB_WORKER (_one, _uint8 , uint8_t   , _uint8 , uint8_t   )
58             case GB_UINT16_code : GB_WORKER (_one, _uint16, uint16_t  , _uint16, uint16_t  )
59             case GB_UINT32_code : GB_WORKER (_one, _uint32, uint32_t  , _uint32, uint32_t  )
60             case GB_UINT64_code : GB_WORKER (_one, _uint64, uint64_t  , _uint64, uint64_t  )
61             case GB_FP32_code   : GB_WORKER (_one, _fp32  , float     , _fp32  , float     )
62             case GB_FP64_code   : GB_WORKER (_one, _fp64  , double    , _fp64  , double    )
63             case GB_FC32_code   : GB_WORKER (_one, _fc32  , GxB_FC32_t, _fc32  , GxB_FC32_t)
64             case GB_FC64_code   : GB_WORKER (_one, _fc64  , GxB_FC64_t, _fc64  , GxB_FC64_t)
65             default: ;
66         }
67 
68     }
69     else if ((code1 == GB_FP32_code && code2 == GB_FC32_code) ||
70              (code1 == GB_FP64_code && code2 == GB_FC64_code))
71     {
72 
73         //----------------------------------------------------------------------
74         // z = f (x) where z is real and x is complex (same base type)
75         //----------------------------------------------------------------------
76 
77         switch (opcode)
78         {
79 
80             case GB_ABS_opcode :     // z = abs (x), for x complex
81 
82                 switch (code2)
83                 {
84                     case GB_FC32_code : GB_WORKER (_abs, _fp32, float , _fc32, GxB_FC32_t)
85                     case GB_FC64_code : GB_WORKER (_abs, _fp64, double, _fc64, GxB_FC64_t)
86                     default: ;
87                 }
88                 break ;
89 
90             case GB_CREAL_opcode :   // z = creal (x)
91 
92                 switch (code2)
93                 {
94                     case GB_FC32_code : GB_WORKER (_creal, _fp32, float , _fc32, GxB_FC32_t)
95                     case GB_FC64_code : GB_WORKER (_creal, _fp64, double, _fc64, GxB_FC64_t)
96                     default: ;
97                 }
98                 break ;
99 
100             case GB_CIMAG_opcode :   // z = cimag (x)
101 
102                 switch (code2)
103                 {
104                     case GB_FC32_code : GB_WORKER (_cimag, _fp32, float , _fc32, GxB_FC32_t)
105                     case GB_FC64_code : GB_WORKER (_cimag, _fp64, double, _fc64, GxB_FC64_t)
106                     default: ;
107                 }
108                 break ;
109 
110             case GB_CARG_opcode :    // z = carg (x)
111 
112                 switch (code2)
113                 {
114                     case GB_FC32_code : GB_WORKER (_carg, _fp32, float , _fc32, GxB_FC32_t)
115                     case GB_FC64_code : GB_WORKER (_carg, _fp64, double, _fc64, GxB_FC64_t)
116                     default: ;
117                 }
118                 break ;
119 
120             default: ;
121         }
122 
123     }
124     else if (code1 == GB_BOOL_code && (code2 >= GB_FP32_code && code2 <= GB_FC64_code))
125     {
126 
127         //----------------------------------------------------------------------
128         // z = f (x) where z is boolean and x is floating-point
129         //----------------------------------------------------------------------
130 
131         switch (opcode)
132         {
133 
134             case GB_ISINF_opcode :   // z = isinf (x)
135 
136                 switch (code2)
137                 {
138                     case GB_FP32_code   : GB_WORKER (_isinf, _bool, bool, _fp32, float     )
139                     case GB_FP64_code   : GB_WORKER (_isinf, _bool, bool, _fp64, double    )
140                     case GB_FC32_code   : GB_WORKER (_isinf, _bool, bool, _fc32, GxB_FC32_t)
141                     case GB_FC64_code   : GB_WORKER (_isinf, _bool, bool, _fc64, GxB_FC64_t)
142                     default: ;
143                 }
144                 break ;
145 
146             case GB_ISNAN_opcode :   // z = isnan (x)
147 
148                 switch (code2)
149                 {
150                     case GB_FP32_code   : GB_WORKER (_isnan, _bool, bool, _fp32, float     )
151                     case GB_FP64_code   : GB_WORKER (_isnan, _bool, bool, _fp64, double    )
152                     case GB_FC32_code   : GB_WORKER (_isnan, _bool, bool, _fc32, GxB_FC32_t)
153                     case GB_FC64_code   : GB_WORKER (_isnan, _bool, bool, _fc64, GxB_FC64_t)
154                     default: ;
155                 }
156                 break ;
157 
158             case GB_ISFINITE_opcode :// z = isfinite (x)
159 
160                 switch (code2)
161                 {
162                     case GB_FP32_code   : GB_WORKER (_isfinite, _bool, bool, _fp32, float     )
163                     case GB_FP64_code   : GB_WORKER (_isfinite, _bool, bool, _fp64, double    )
164                     case GB_FC32_code   : GB_WORKER (_isfinite, _bool, bool, _fc32, GxB_FC32_t)
165                     case GB_FC64_code   : GB_WORKER (_isfinite, _bool, bool, _fc64, GxB_FC64_t)
166                     default: ;
167                 }
168                 break ;
169 
170             default: ;
171 
172         }
173 
174     }
175     else if (code1 == code2)
176     {
177 
178         //----------------------------------------------------------------------
179         // z = f (x) with no typecasting
180         //----------------------------------------------------------------------
181 
182         switch (opcode)
183         {
184 
185             case GB_AINV_opcode :      // z = -x, all 13 types
186 
187                 switch (code1)
188                 {
189                     case GB_BOOL_code   : GB_WORKER (_ainv, _bool  , bool      , _bool  , bool      )
190                     case GB_INT8_code   : GB_WORKER (_ainv, _int8  , int8_t    , _int8  , int8_t    )
191                     case GB_INT16_code  : GB_WORKER (_ainv, _int16 , int16_t   , _int16 , int16_t   )
192                     case GB_INT32_code  : GB_WORKER (_ainv, _int32 , int32_t   , _int32 , int32_t   )
193                     case GB_INT64_code  : GB_WORKER (_ainv, _int64 , int64_t   , _int64 , int64_t   )
194                     case GB_UINT8_code  : GB_WORKER (_ainv, _uint8 , uint8_t   , _uint8 , uint8_t   )
195                     case GB_UINT16_code : GB_WORKER (_ainv, _uint16, uint16_t  , _uint16, uint16_t  )
196                     case GB_UINT32_code : GB_WORKER (_ainv, _uint32, uint32_t  , _uint32, uint32_t  )
197                     case GB_UINT64_code : GB_WORKER (_ainv, _uint64, uint64_t  , _uint64, uint64_t  )
198                     case GB_FP32_code   : GB_WORKER (_ainv, _fp32  , float     , _fp32  , float     )
199                     case GB_FP64_code   : GB_WORKER (_ainv, _fp64  , double    , _fp64  , double    )
200                     case GB_FC32_code   : GB_WORKER (_ainv, _fc32  , GxB_FC32_t, _fc32  , GxB_FC32_t)
201                     case GB_FC64_code   : GB_WORKER (_ainv, _fc64  , GxB_FC64_t, _fc64  , GxB_FC64_t)
202                     default: ;
203                 }
204                 break ;
205 
206             case GB_MINV_opcode :      // z = 1/x, all 13 types
207 
208                 switch (code1)
209                 {
210                     case GB_BOOL_code   : GB_WORKER (_minv, _bool  , bool      , _bool  , bool      )
211                     case GB_INT8_code   : GB_WORKER (_minv, _int8  , int8_t    , _int8  , int8_t    )
212                     case GB_INT16_code  : GB_WORKER (_minv, _int16 , int16_t   , _int16 , int16_t   )
213                     case GB_INT32_code  : GB_WORKER (_minv, _int32 , int32_t   , _int32 , int32_t   )
214                     case GB_INT64_code  : GB_WORKER (_minv, _int64 , int64_t   , _int64 , int64_t   )
215                     case GB_UINT8_code  : GB_WORKER (_minv, _uint8 , uint8_t   , _uint8 , uint8_t   )
216                     case GB_UINT16_code : GB_WORKER (_minv, _uint16, uint16_t  , _uint16, uint16_t  )
217                     case GB_UINT32_code : GB_WORKER (_minv, _uint32, uint32_t  , _uint32, uint32_t  )
218                     case GB_UINT64_code : GB_WORKER (_minv, _uint64, uint64_t  , _uint64, uint64_t  )
219                     case GB_FP32_code   : GB_WORKER (_minv, _fp32  , float     , _fp32  , float     )
220                     case GB_FP64_code   : GB_WORKER (_minv, _fp64  , double    , _fp64  , double    )
221                     case GB_FC32_code   : GB_WORKER (_minv, _fc32  , GxB_FC32_t, _fc32  , GxB_FC32_t)
222                     case GB_FC64_code   : GB_WORKER (_minv, _fc64  , GxB_FC64_t, _fc64  , GxB_FC64_t)
223                     default: ;
224                 }
225                 break ;
226 
227             case GB_ABS_opcode :       // z = abs (x), for all but complex
228 
229                 switch (code1)
230                 {
231                     case GB_BOOL_code   : GB_WORKER (_abs, _bool  , bool      , _bool  , bool    )
232                     case GB_INT8_code   : GB_WORKER (_abs, _int8  , int8_t    , _int8  , int8_t  )
233                     case GB_INT16_code  : GB_WORKER (_abs, _int16 , int16_t   , _int16 , int16_t )
234                     case GB_INT32_code  : GB_WORKER (_abs, _int32 , int32_t   , _int32 , int32_t )
235                     case GB_INT64_code  : GB_WORKER (_abs, _int64 , int64_t   , _int64 , int64_t )
236                     case GB_UINT8_code  : GB_WORKER (_abs, _uint8 , uint8_t   , _uint8 , uint8_t )
237                     case GB_UINT16_code : GB_WORKER (_abs, _uint16, uint16_t  , _uint16, uint16_t)
238                     case GB_UINT32_code : GB_WORKER (_abs, _uint32, uint32_t  , _uint32, uint32_t)
239                     case GB_UINT64_code : GB_WORKER (_abs, _uint64, uint64_t  , _uint64, uint64_t)
240                     case GB_FP32_code   : GB_WORKER (_abs, _fp32  , float     , _fp32  , float   )
241                     case GB_FP64_code   : GB_WORKER (_abs, _fp64  , double    , _fp64  , double  )
242                     default: ;
243                 }
244                 break ;
245 
246             case GB_LNOT_opcode :      // z = ! (x != 0), no complex case
247 
248                 switch (code1)
249                 {
250                     case GB_BOOL_code   : GB_WORKER (_lnot, _bool  , bool    , _bool  , bool    )
251                     case GB_INT8_code   : GB_WORKER (_lnot, _int8  , int8_t  , _int8  , int8_t  )
252                     case GB_INT16_code  : GB_WORKER (_lnot, _int16 , int16_t , _int16 , int16_t )
253                     case GB_INT32_code  : GB_WORKER (_lnot, _int32 , int32_t , _int32 , int32_t )
254                     case GB_INT64_code  : GB_WORKER (_lnot, _int64 , int64_t , _int64 , int64_t )
255                     case GB_UINT8_code  : GB_WORKER (_lnot, _uint8 , uint8_t , _uint8 , uint8_t )
256                     case GB_UINT16_code : GB_WORKER (_lnot, _uint16, uint16_t, _uint16, uint16_t)
257                     case GB_UINT32_code : GB_WORKER (_lnot, _uint32, uint32_t, _uint32, uint32_t)
258                     case GB_UINT64_code : GB_WORKER (_lnot, _uint64, uint64_t, _uint64, uint64_t)
259                     case GB_FP32_code   : GB_WORKER (_lnot, _fp32  , float   , _fp32  , float   )
260                     case GB_FP64_code   : GB_WORKER (_lnot, _fp64  , double  , _fp64  , double  )
261                     default: ;
262                 }
263                 break ;
264 
265             case GB_BNOT_opcode :    // z = ~x (bitwise complement), integers only
266 
267                 switch (code1)
268                 {
269                     case GB_INT8_code   : GB_WORKER (_bnot, _int8  , int8_t  , _int8  , int8_t  )
270                     case GB_INT16_code  : GB_WORKER (_bnot, _int16 , int16_t , _int16 , int16_t )
271                     case GB_INT32_code  : GB_WORKER (_bnot, _int32 , int32_t , _int32 , int32_t )
272                     case GB_INT64_code  : GB_WORKER (_bnot, _int64 , int64_t , _int64 , int64_t )
273                     case GB_UINT8_code  : GB_WORKER (_bnot, _uint8 , uint8_t , _uint8 , uint8_t )
274                     case GB_UINT16_code : GB_WORKER (_bnot, _uint16, uint16_t, _uint16, uint16_t)
275                     case GB_UINT32_code : GB_WORKER (_bnot, _uint32, uint32_t, _uint32, uint32_t)
276                     case GB_UINT64_code : GB_WORKER (_bnot, _uint64, uint64_t, _uint64, uint64_t)
277                     default: ;
278                 }
279                 break ;
280 
281             case GB_SQRT_opcode :    // z = sqrt (x)
282 
283                 switch (code1)
284                 {
285                     case GB_FP32_code   : GB_WORKER (_sqrt, _fp32, float     , _fp32, float     )
286                     case GB_FP64_code   : GB_WORKER (_sqrt, _fp64, double    , _fp64, double    )
287                     case GB_FC32_code   : GB_WORKER (_sqrt, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
288                     case GB_FC64_code   : GB_WORKER (_sqrt, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
289                     default: ;
290                 }
291                 break ;
292 
293             case GB_LOG_opcode :     // z = log (x)
294 
295                 switch (code1)
296                 {
297                     case GB_FP32_code   : GB_WORKER (_log, _fp32, float     , _fp32, float     )
298                     case GB_FP64_code   : GB_WORKER (_log, _fp64, double    , _fp64, double    )
299                     case GB_FC32_code   : GB_WORKER (_log, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
300                     case GB_FC64_code   : GB_WORKER (_log, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
301                     default: ;
302                 }
303                 break ;
304 
305 
306             case GB_EXP_opcode :     // z = exp (x)
307 
308                 switch (code1)
309                 {
310                     case GB_FP32_code   : GB_WORKER (_exp, _fp32, float     , _fp32, float     )
311                     case GB_FP64_code   : GB_WORKER (_exp, _fp64, double    , _fp64, double    )
312                     case GB_FC32_code   : GB_WORKER (_exp, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
313                     case GB_FC64_code   : GB_WORKER (_exp, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
314                     default: ;
315                 }
316                 break ;
317 
318 
319             case GB_SIN_opcode :     // z = sin (x)
320 
321                 switch (code1)
322                 {
323                     case GB_FP32_code   : GB_WORKER (_sin, _fp32, float     , _fp32, float     )
324                     case GB_FP64_code   : GB_WORKER (_sin, _fp64, double    , _fp64, double    )
325                     case GB_FC32_code   : GB_WORKER (_sin, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
326                     case GB_FC64_code   : GB_WORKER (_sin, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
327                     default: ;
328                 }
329                 break ;
330 
331             case GB_COS_opcode :     // z = cos (x)
332 
333                 switch (code1)
334                 {
335                     case GB_FP32_code   : GB_WORKER (_cos, _fp32, float     , _fp32, float     )
336                     case GB_FP64_code   : GB_WORKER (_cos, _fp64, double    , _fp64, double    )
337                     case GB_FC32_code   : GB_WORKER (_cos, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
338                     case GB_FC64_code   : GB_WORKER (_cos, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
339                     default: ;
340                 }
341                 break ;
342 
343             case GB_TAN_opcode :     // z = tan (x)
344 
345                 switch (code1)
346                 {
347                     case GB_FP32_code   : GB_WORKER (_tan, _fp32, float     , _fp32, float     )
348                     case GB_FP64_code   : GB_WORKER (_tan, _fp64, double    , _fp64, double    )
349                     case GB_FC32_code   : GB_WORKER (_tan, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
350                     case GB_FC64_code   : GB_WORKER (_tan, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
351                     default: ;
352                 }
353                 break ;
354 
355 
356             case GB_ASIN_opcode :    // z = asin (x)
357 
358                 switch (code1)
359                 {
360                     case GB_FP32_code   : GB_WORKER (_asin, _fp32, float     , _fp32, float     )
361                     case GB_FP64_code   : GB_WORKER (_asin, _fp64, double    , _fp64, double    )
362                     case GB_FC32_code   : GB_WORKER (_asin, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
363                     case GB_FC64_code   : GB_WORKER (_asin, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
364                     default: ;
365                 }
366                 break ;
367 
368             case GB_ACOS_opcode :    // z = acos (x)
369 
370                 switch (code1)
371                 {
372                     case GB_FP32_code   : GB_WORKER (_acos, _fp32, float     , _fp32, float     )
373                     case GB_FP64_code   : GB_WORKER (_acos, _fp64, double    , _fp64, double    )
374                     case GB_FC32_code   : GB_WORKER (_acos, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
375                     case GB_FC64_code   : GB_WORKER (_acos, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
376                     default: ;
377                 }
378                 break ;
379 
380             case GB_ATAN_opcode :    // z = atan (x)
381 
382                 switch (code1)
383                 {
384                     case GB_FP32_code   : GB_WORKER (_atan, _fp32, float     , _fp32, float     )
385                     case GB_FP64_code   : GB_WORKER (_atan, _fp64, double    , _fp64, double    )
386                     case GB_FC32_code   : GB_WORKER (_atan, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
387                     case GB_FC64_code   : GB_WORKER (_atan, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
388                     default: ;
389                 }
390                 break ;
391 
392 
393             case GB_SINH_opcode :    // z = sinh (x)
394 
395                 switch (code1)
396                 {
397                     case GB_FP32_code   : GB_WORKER (_sinh, _fp32, float     , _fp32, float     )
398                     case GB_FP64_code   : GB_WORKER (_sinh, _fp64, double    , _fp64, double    )
399                     case GB_FC32_code   : GB_WORKER (_sinh, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
400                     case GB_FC64_code   : GB_WORKER (_sinh, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
401                     default: ;
402                 }
403                 break ;
404 
405             case GB_COSH_opcode :    // z = cosh (x)
406 
407                 switch (code1)
408                 {
409                     case GB_FP32_code   : GB_WORKER (_cosh, _fp32, float     , _fp32, float     )
410                     case GB_FP64_code   : GB_WORKER (_cosh, _fp64, double    , _fp64, double    )
411                     case GB_FC32_code   : GB_WORKER (_cosh, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
412                     case GB_FC64_code   : GB_WORKER (_cosh, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
413                     default: ;
414                 }
415                 break ;
416 
417             case GB_TANH_opcode :    // z = tanh (x)
418 
419                 switch (code1)
420                 {
421                     case GB_FP32_code   : GB_WORKER (_tanh, _fp32, float     , _fp32, float     )
422                     case GB_FP64_code   : GB_WORKER (_tanh, _fp64, double    , _fp64, double    )
423                     case GB_FC32_code   : GB_WORKER (_tanh, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
424                     case GB_FC64_code   : GB_WORKER (_tanh, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
425                     default: ;
426                 }
427                 break ;
428 
429 
430             case GB_ASINH_opcode :   // z = asinh (x)
431 
432                 switch (code1)
433                 {
434                     case GB_FP32_code   : GB_WORKER (_asinh, _fp32, float     , _fp32, float     )
435                     case GB_FP64_code   : GB_WORKER (_asinh, _fp64, double    , _fp64, double    )
436                     case GB_FC32_code   : GB_WORKER (_asinh, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
437                     case GB_FC64_code   : GB_WORKER (_asinh, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
438                     default: ;
439                 }
440                 break ;
441 
442             case GB_ACOSH_opcode :   // z = acosh (x)
443 
444                 switch (code1)
445                 {
446                     case GB_FP32_code   : GB_WORKER (_acosh, _fp32, float     , _fp32, float     )
447                     case GB_FP64_code   : GB_WORKER (_acosh, _fp64, double    , _fp64, double    )
448                     case GB_FC32_code   : GB_WORKER (_acosh, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
449                     case GB_FC64_code   : GB_WORKER (_acosh, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
450                     default: ;
451                 }
452                 break ;
453 
454             case GB_ATANH_opcode :   // z = atanh (x)
455 
456                 switch (code1)
457                 {
458                     case GB_FP32_code   : GB_WORKER (_atanh, _fp32, float     , _fp32, float     )
459                     case GB_FP64_code   : GB_WORKER (_atanh, _fp64, double    , _fp64, double    )
460                     case GB_FC32_code   : GB_WORKER (_atanh, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
461                     case GB_FC64_code   : GB_WORKER (_atanh, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
462                     default: ;
463                 }
464                 break ;
465 
466             case GB_SIGNUM_opcode :  // z = signum (x)
467 
468                 switch (code1)
469                 {
470                     case GB_FP32_code   : GB_WORKER (_signum, _fp32, float     , _fp32, float     )
471                     case GB_FP64_code   : GB_WORKER (_signum, _fp64, double    , _fp64, double    )
472                     case GB_FC32_code   : GB_WORKER (_signum, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
473                     case GB_FC64_code   : GB_WORKER (_signum, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
474                     default: ;
475                 }
476                 break ;
477 
478             case GB_CEIL_opcode :    // z = ceil (x)
479 
480                 switch (code1)
481                 {
482                     case GB_FP32_code   : GB_WORKER (_ceil, _fp32, float     , _fp32, float     )
483                     case GB_FP64_code   : GB_WORKER (_ceil, _fp64, double    , _fp64, double    )
484                     case GB_FC32_code   : GB_WORKER (_ceil, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
485                     case GB_FC64_code   : GB_WORKER (_ceil, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
486                     default: ;
487                 }
488                 break ;
489 
490             case GB_FLOOR_opcode :   // z = floor (x)
491 
492                 switch (code1)
493                 {
494                     case GB_FP32_code   : GB_WORKER (_floor, _fp32, float     , _fp32, float     )
495                     case GB_FP64_code   : GB_WORKER (_floor, _fp64, double    , _fp64, double    )
496                     case GB_FC32_code   : GB_WORKER (_floor, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
497                     case GB_FC64_code   : GB_WORKER (_floor, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
498                     default: ;
499                 }
500                 break ;
501 
502             case GB_ROUND_opcode :   // z = round (x)
503 
504                 switch (code1)
505                 {
506                     case GB_FP32_code   : GB_WORKER (_round, _fp32, float     , _fp32, float     )
507                     case GB_FP64_code   : GB_WORKER (_round, _fp64, double    , _fp64, double    )
508                     case GB_FC32_code   : GB_WORKER (_round, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
509                     case GB_FC64_code   : GB_WORKER (_round, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
510                     default: ;
511                 }
512                 break ;
513 
514             case GB_TRUNC_opcode :   // z = trunc (x)
515 
516                 switch (code1)
517                 {
518                     case GB_FP32_code   : GB_WORKER (_trunc, _fp32, float     , _fp32, float     )
519                     case GB_FP64_code   : GB_WORKER (_trunc, _fp64, double    , _fp64, double    )
520                     case GB_FC32_code   : GB_WORKER (_trunc, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
521                     case GB_FC64_code   : GB_WORKER (_trunc, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
522                     default: ;
523                 }
524                 break ;
525 
526 
527             case GB_EXP2_opcode :    // z = exp2 (x)
528 
529                 switch (code1)
530                 {
531                     case GB_FP32_code   : GB_WORKER (_exp2, _fp32, float     , _fp32, float     )
532                     case GB_FP64_code   : GB_WORKER (_exp2, _fp64, double    , _fp64, double    )
533                     case GB_FC32_code   : GB_WORKER (_exp2, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
534                     case GB_FC64_code   : GB_WORKER (_exp2, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
535                     default: ;
536                 }
537                 break ;
538 
539             case GB_EXPM1_opcode :   // z = expm1 (x)
540 
541                 switch (code1)
542                 {
543                     case GB_FP32_code   : GB_WORKER (_expm1, _fp32, float     , _fp32, float     )
544                     case GB_FP64_code   : GB_WORKER (_expm1, _fp64, double    , _fp64, double    )
545                     case GB_FC32_code   : GB_WORKER (_expm1, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
546                     case GB_FC64_code   : GB_WORKER (_expm1, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
547                     default: ;
548                 }
549                 break ;
550 
551             case GB_LOG10_opcode :   // z = log10 (x)
552 
553                 switch (code1)
554                 {
555                     case GB_FP32_code   : GB_WORKER (_log10, _fp32, float     , _fp32, float     )
556                     case GB_FP64_code   : GB_WORKER (_log10, _fp64, double    , _fp64, double    )
557                     case GB_FC32_code   : GB_WORKER (_log10, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
558                     case GB_FC64_code   : GB_WORKER (_log10, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
559                     default: ;
560                 }
561                 break ;
562 
563             case GB_LOG1P_opcode :   // z = log1P (x)
564 
565                 switch (code1)
566                 {
567                     case GB_FP32_code   : GB_WORKER (_log1p, _fp32, float     , _fp32, float     )
568                     case GB_FP64_code   : GB_WORKER (_log1p, _fp64, double    , _fp64, double    )
569                     case GB_FC32_code   : GB_WORKER (_log1p, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
570                     case GB_FC64_code   : GB_WORKER (_log1p, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
571                     default: ;
572                 }
573                 break ;
574 
575             case GB_LOG2_opcode :    // z = log2 (x)
576 
577                 switch (code1)
578                 {
579                     case GB_FP32_code   : GB_WORKER (_log2, _fp32, float     , _fp32, float     )
580                     case GB_FP64_code   : GB_WORKER (_log2, _fp64, double    , _fp64, double    )
581                     case GB_FC32_code   : GB_WORKER (_log2, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
582                     case GB_FC64_code   : GB_WORKER (_log2, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
583                     default: ;
584                 }
585                 break ;
586 
587             case GB_LGAMMA_opcode :  // z = lgamma (x)
588 
589                 switch (code1)
590                 {
591                     case GB_FP32_code   : GB_WORKER (_lgamma, _fp32, float     , _fp32, float )
592                     case GB_FP64_code   : GB_WORKER (_lgamma, _fp64, double    , _fp64, double)
593                     default: ;
594                 }
595                 break ;
596 
597             case GB_TGAMMA_opcode :  // z = tgamma (x)
598 
599                 switch (code1)
600                 {
601                     case GB_FP32_code   : GB_WORKER (_tgamma, _fp32, float     , _fp32, float )
602                     case GB_FP64_code   : GB_WORKER (_tgamma, _fp64, double    , _fp64, double)
603                     default: ;
604                 }
605                 break ;
606 
607             case GB_ERF_opcode :     // z = erf (x)
608 
609                 switch (code1)
610                 {
611                     case GB_FP32_code   : GB_WORKER (_erf, _fp32, float     , _fp32, float )
612                     case GB_FP64_code   : GB_WORKER (_erf, _fp64, double    , _fp64, double)
613                     default: ;
614                 }
615                 break ;
616 
617             case GB_ERFC_opcode :    // z = erfc (x)
618 
619                 switch (code1)
620                 {
621                     case GB_FP32_code   : GB_WORKER (_erfc, _fp32, float     , _fp32, float )
622                     case GB_FP64_code   : GB_WORKER (_erfc, _fp64, double    , _fp64, double)
623                     default: ;
624                 }
625                 break ;
626 
627             case GB_FREXPX_opcode :  // z = frexpx (x), mantissa from ANSI C11 frexp
628 
629                 switch (code1)
630                 {
631                     case GB_FP32_code   : GB_WORKER (_frexpx, _fp32, float     , _fp32, float )
632                     case GB_FP64_code   : GB_WORKER (_frexpx, _fp64, double    , _fp64, double)
633                     default: ;
634                 }
635                 break ;
636 
637             case GB_FREXPE_opcode :  // z = frexpe (x), exponent from ANSI C11 frexp
638 
639                 switch (code1)
640                 {
641                     case GB_FP32_code   : GB_WORKER (_frexpe, _fp32, float     , _fp32, float )
642                     case GB_FP64_code   : GB_WORKER (_frexpe, _fp64, double    , _fp64, double)
643                     default: ;
644                 }
645                 break ;
646 
647             case GB_CONJ_opcode :    // z = conj (x)
648 
649                 switch (code1)
650                 {
651                     case GB_FC32_code   : GB_WORKER (_conj, _fc32, GxB_FC32_t, _fc32, GxB_FC32_t)
652                     case GB_FC64_code   : GB_WORKER (_conj, _fc64, GxB_FC64_t, _fc64, GxB_FC64_t)
653                     default: ;
654                 }
655                 break ;
656 
657             default: ;
658         }
659     }
660 }
661 
662