File: GB_iso.h

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 506; asm: 369; python: 125; awk: 10
file content (77 lines) | stat: -rw-r--r-- 2,454 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//------------------------------------------------------------------------------
// GB_iso.h: definitions for iso methods
//------------------------------------------------------------------------------

// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//------------------------------------------------------------------------------

#ifndef GB_ISO_H
#define GB_ISO_H

typedef enum
{
    GB_NON_ISO = 0,     // result is not iso
    GB_ISO_1 = 1,       // iso value is 1
    GB_ISO_S = 2,       // iso value is the scalar input
    GB_ISO_A = 3,       // iso value is A
    GB_ISO_OP1_A = 4,   // iso value is unop (A)
    GB_ISO_OP2_SA = 5,  // iso value is binop (scalar, A)
    GB_ISO_OP2_AS = 6   // iso value is binop (A, scalar)
}
GB_iso_code ;

GB_iso_code GB_iso_unop_code
(
    GrB_Matrix A,           // input matrix
    GB_Operator op,         // unary/idxunop/binop, if present
    bool binop_bind1st      // if true, C = binop(x,A), else C = binop(A,y)
) ;

void GB_iso_unop            // Cx [0] = unop (A), binop (s,A) or binop (A,s)
(
    // output
    GB_void *restrict Cx,   // output scalar of iso array
    // input
    GrB_Type ctype,         // type of Cx
    GB_iso_code C_code_iso, // defines how C iso value is to be computed
    GB_Operator op,         // unary/idxunop/binop, if present
    GrB_Matrix A,           // input matrix
    GrB_Scalar scalar       // input scalar
) ;

GB_PUBLIC
GrB_Info GB_convert_any_to_non_iso // convert iso matrix to non-iso
(
    GrB_Matrix A,           // input/output matrix
    bool initialize,        // if true, copy the iso value to all of A->x
    GB_Context Contest
) ;

GB_PUBLIC
GrB_Info GB_convert_any_to_iso // convert non-iso matrix to iso
(
    GrB_Matrix A,           // input/output matrix
    GB_void *scalar,        // scalar value, of size A->type->size, or NULL
    GB_Context Context
) ;

void GB_iso_expand          // expand an iso scalar into an entire array
(
    void *restrict X,       // output array to expand into
    int64_t n,              // # of entries in X
    void *restrict scalar,  // scalar to expand into X
    size_t size,            // size of the scalar and each entry of X
    GB_Context Context
) ;

GB_PUBLIC
bool GB_iso_check               // return true if A is iso, false otherwise
(
    const GrB_Matrix A,         // matrix to reduce
    GB_Context Context
) ;

#endif