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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
//------------------------------------------------------------------------------
// GB_emult.h: definitions for GB_emult
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
#ifndef GB_EMULT_H
#define GB_EMULT_H
#include "GB.h"
#include "GB_bitmap_assign_methods.h"
#define GB_EMULT_METHOD1_ADD 1 /* use GB_add instead of emult */
#define GB_EMULT_METHOD2 2 /* use GB_emult_02 (A,B) */
#define GB_EMULT_METHOD3 3 /* use GB_emult_02 (B,A) */
#define GB_EMULT_METHOD4 4 /* use GB_emult_04 */
#define GB_EMULT_METHOD5 5 /* use GB_emult_bitmap Method5 */
#define GB_EMULT_METHOD6 6 /* use GB_emult_bitmap Method6 */
#define GB_EMULT_METHOD7 7 /* use GB_emult_bitmap Method7 */
#define GB_EMULT_METHOD8 8 /* use GB_emult_phase[123] */
#define GB_EMULT_METHOD9 9 /* use GB_emult_phase[123] for now */
#define GB_EMULT_METHOD10 10 /* use GB_emult_phase[123] for now */
GrB_Info GB_emult // C=A.*B or C<M>=A.*B
(
GrB_Matrix C, // output matrix, static header
const GrB_Type ctype, // type of output matrix C
const bool C_is_csc, // format of output matrix C
const GrB_Matrix M, // optional mask, unused if NULL. Not complemented
const bool Mask_struct, // if true, use the only structure of M
const bool Mask_comp, // if true, use the !M
bool *mask_applied,
const GrB_Matrix A, // input A matrix
const GrB_Matrix B, // input B matrix
const GrB_BinaryOp op, // op to perform C = op (A,B)
GB_Context Context
) ;
int GB_emult_sparsity // return the sparsity structure for C
(
// output:
bool *apply_mask, // if true then mask will be applied by GB_emult
int *ewise_method, // method to use
// input:
const GrB_Matrix M, // optional mask for C, unused if NULL
const bool Mask_comp, // if true, use !M
const GrB_Matrix A, // input A matrix
const GrB_Matrix B // input B matrix
) ;
GrB_Info GB_emult_phase0 // find vectors in C for C=A.*B or C<M>=A.*B
(
int64_t *p_Cnvec, // # of vectors to compute in C
const int64_t *restrict *Ch_handle, // Ch is M->h, A->h, B->h, or NULL
size_t *Ch_size_handle,
int64_t *restrict *C_to_M_handle, // C_to_M: size Cnvec, or NULL
size_t *C_to_M_size_handle,
int64_t *restrict *C_to_A_handle, // C_to_A: size Cnvec, or NULL
size_t *C_to_A_size_handle,
int64_t *restrict *C_to_B_handle, // C_to_B: size Cnvec, or NULL
size_t *C_to_B_size_handle,
int *C_sparsity, // sparsity structure of C
// original input:
const GrB_Matrix M, // optional mask, may be NULL
const GrB_Matrix A,
const GrB_Matrix B,
GB_Context Context
) ;
GrB_Info GB_emult_phase1 // count nnz in each C(:,j)
(
// computed by phase1:
int64_t **Cp_handle, // output of size Cnvec+1
size_t *Cp_size_handle,
int64_t *Cnvec_nonempty, // # of non-empty vectors in C
// tasks from phase1a:
GB_task_struct *restrict TaskList, // array of structs
const int C_ntasks, // # of tasks
const int C_nthreads, // # of threads to use
// analysis from phase0:
const int64_t Cnvec,
const int64_t *restrict Ch, // Ch is NULL, or shallow pointer
const int64_t *restrict C_to_M,
const int64_t *restrict C_to_A,
const int64_t *restrict C_to_B,
// original input:
const GrB_Matrix M, // optional mask, may be NULL
const bool Mask_struct, // if true, use the only structure of M
const bool Mask_comp, // if true, use !M
const GrB_Matrix A,
const GrB_Matrix B,
GB_Context Context
) ;
GrB_Info GB_emult_phase2 // C=A.*B or C<M>=A.*B
(
GrB_Matrix C, // output matrix, static header
const GrB_Type ctype, // type of output matrix C
const bool C_is_csc, // format of output matrix C
const GrB_BinaryOp op, // op to perform C = op (A,B)
// from phase1:
int64_t **Cp_handle, // vector pointers for C
size_t Cp_size,
const int64_t Cnvec_nonempty, // # of non-empty vectors in C
// tasks from phase1a:
const GB_task_struct *restrict TaskList, // array of structs
const int C_ntasks, // # of tasks
const int C_nthreads, // # of threads to use
// analysis from phase0:
const int64_t Cnvec,
const int64_t *restrict Ch,
size_t Ch_size,
const int64_t *restrict C_to_M,
const int64_t *restrict C_to_A,
const int64_t *restrict C_to_B,
const int C_sparsity,
// from GB_emult_sparsity:
const int ewise_method,
// original input:
const GrB_Matrix M, // optional mask, may be NULL
const bool Mask_struct, // if true, use the only structure of M
const bool Mask_comp, // if true, use !M
const GrB_Matrix A,
const GrB_Matrix B,
GB_Context Context
) ;
GrB_Info GB_emult_02 // C=A.*B when A is sparse/hyper, B bitmap/full
(
GrB_Matrix C, // output matrix, static header
const GrB_Type ctype, // type of output matrix C
const bool C_is_csc, // format of output matrix C
const GrB_Matrix M, // optional mask, unused if NULL
const bool Mask_struct, // if true, use the only structure of M
const bool Mask_comp, // if true, use !M
const GrB_Matrix A, // input A matrix (sparse/hyper)
const GrB_Matrix B, // input B matrix (bitmap/full)
GrB_BinaryOp op, // op to perform C = op (A,B)
bool flipxy, // if true use fmult(y,x) else fmult(x,y)
GB_Context Context
) ;
GrB_Info GB_emult_04 // C<M>=A.*B, M sparse/hyper, A and B bitmap/full
(
GrB_Matrix C, // output matrix, static header
const GrB_Type ctype, // type of output matrix C
const bool C_is_csc, // format of output matrix C
const GrB_Matrix M, // sparse/hyper, not NULL
const bool Mask_struct, // if true, use the only structure of M
bool *mask_applied, // if true, the mask was applied
const GrB_Matrix A, // input A matrix (bitmap/full)
const GrB_Matrix B, // input B matrix (bitmap/full)
const GrB_BinaryOp op, // op to perform C = op (A,B)
GB_Context Context
) ;
GrB_Info GB_bitmap_emult // C=A.*B, C<M>=A.*B, or C<!M>=A.*B
(
GrB_Matrix C, // output matrix, static header
const int ewise_method,
const GrB_Type ctype, // type of output matrix C
const bool C_is_csc, // format of output matrix C
const GrB_Matrix M, // optional mask, unused if NULL
const bool Mask_struct, // if true, use the only structure of M
const bool Mask_comp, // if true, use !M
bool *mask_applied, // if true, the mask was applied
const GrB_Matrix A, // input A matrix (bitmap/full)
const GrB_Matrix B, // input B matrix (bitmap/full)
const GrB_BinaryOp op, // op to perform C = op (A,B)
GB_Context Context
) ;
bool GB_iso_emult // c = op(a,b), return true if C is iso
(
// output
GB_void *restrict c, // output scalar of iso array
// input
GrB_Type ctype, // type of c
GrB_Matrix A, // input matrix
GrB_Matrix B, // input matrix
GrB_BinaryOp op // binary operator
) ;
#endif
|