Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
coo.h
Go to the documentation of this file.
1 #ifndef __COO_H__
2 #define __COO_H__
3 
4 #include "../tensor/algstrct.h"
5 
6 namespace CTF_int {
7 
8  class CSR_Matrix;
9  class bivar_function;
10 
11  int64_t get_coo_size(int64_t nnz, int val_size);
12 
14  class COO_Matrix{
15  public:
17  char * all_data;
18 
24  COO_Matrix(int64_t nnz, algstrct const * sr);
25 
30  COO_Matrix(char * all_data);
31 
37  COO_Matrix(CSR_Matrix const & csr, algstrct const * sr);
38 
40  int64_t nnz() const;
41 
43  int64_t size() const;
44 
46  int nrow() const;
47 
49  int ncol() const;
50 
52  int val_size() const;
53 
55  char * vals() const;
56 
58  int * rows() const;
59 
61  int * cols() const;
62 
74  void set_data(int64_t nz, int order, int const * lens, int const * ordering, int nrow_idx, char const * tsr_data, algstrct const * sr, int const * phase);
75 
88  void get_data(int64_t nz, int order, int const * lens, int const * rev_ordering, int nrow_idx, char * tsr_data, algstrct const * sr, int const * phase, int const * phase_rank);
89 
93  static void coomm(char const * A, algstrct const * sr_A, int m, int n, int k, char const * alpha, char const * B, algstrct const * sr_B, char const * beta, char * C, algstrct const * sr_C, bivar_function const * func);
94 
95  };
96 }
97 
98 #endif
int * rows() const
retrieves pointer to array row indices of each value
Definition: coo.cxx:61
int64_t get_coo_size(int64_t nnz, int val_size)
Definition: coo.cxx:7
int bivar_function(int n, World &dw)
int64_t size() const
retrieves buffer size out of all_data
Definition: coo.cxx:53
untyped internal class for triply-typed bivariate function
Definition: ctr_comm.h:16
char * all_data
serialized buffer containing info and data
Definition: coo.h:17
COO_Matrix(int64_t nnz, algstrct const *sr)
constructor that allocates empty buffer
Definition: coo.cxx:12
int ncol() const
retrieves number of columns out of all_data
int * cols() const
retrieves pointer to array of column indices for each value
Definition: coo.cxx:68
int64_t nnz() const
retrieves number of nonzeros out of all_data
Definition: coo.cxx:45
void get_data(int64_t nz, int order, int const *lens, int const *rev_ordering, int nrow_idx, char *tsr_data, algstrct const *sr, int const *phase, int const *phase_rank)
unfolds tensor data from COO format based on prespecification of row and column modes ...
Definition: coo.cxx:146
serialized matrix in coordinate format, meaning three arrays of dimension nnz are stored...
Definition: coo.h:14
int nrow() const
retrieves number of rows out of all_data
abstraction for a serialized sparse matrix stored in column-sparse-row (CSR) layout ...
Definition: csr.h:22
static void coomm(char const *A, algstrct const *sr_A, int m, int n, int k, char const *alpha, char const *B, algstrct const *sr_B, char const *beta, char *C, algstrct const *sr_C, bivar_function const *func)
computes C = beta*C + func(alpha*A*B) where A is a COO_Matrix, while B and C are dense ...
Definition: coo.cxx:230
void set_data(int64_t nz, int order, int const *lens, int const *ordering, int nrow_idx, char const *tsr_data, algstrct const *sr, int const *phase)
folds tensor data into COO format based on prespecification of row and column modes ...
Definition: coo.cxx:75
int val_size() const
retrieves matrix entry size out of all_data
Definition: coo.cxx:49
algstrct (algebraic structure) defines the elementwise operations computed in each tensor contraction...
Definition: algstrct.h:34
char * vals() const
retrieves pointer to array of values out of all_data
Definition: coo.cxx:57