elementwise_op.h 1.28 KB
Newer Older
Hongzhi (Steve), Chen's avatar
Hongzhi (Steve), Chen committed
1
/**
2
 *  Copyright (c) 2022 by Contributors
Hongzhi (Steve), Chen's avatar
Hongzhi (Steve), Chen committed
3
 * @file sparse/elementwise_op.h
czkkkkkk's avatar
czkkkkkk committed
4
 * @brief DGL C++ sparse elementwise operators.
5
6
7
8
9
10
11
12
13
 */
#ifndef SPARSE_ELEMENTWISE_OP_H_
#define SPARSE_ELEMENTWISE_OP_H_

#include <sparse/sparse_matrix.h>

namespace dgl {
namespace sparse {

Hongzhi (Steve), Chen's avatar
Hongzhi (Steve), Chen committed
14
/**
czkkkkkk's avatar
czkkkkkk committed
15
 * @brief Adds two sparse matrices possibly with different sparsities.
Hongzhi (Steve), Chen's avatar
Hongzhi (Steve), Chen committed
16
 *
czkkkkkk's avatar
czkkkkkk committed
17
18
 * @param lhs_mat SparseMatrix
 * @param rhs_mat SparseMatrix
Hongzhi (Steve), Chen's avatar
Hongzhi (Steve), Chen committed
19
 *
20
21
22
 * @return SparseMatrix
 */
c10::intrusive_ptr<SparseMatrix> SpSpAdd(
czkkkkkk's avatar
czkkkkkk committed
23
24
    const c10::intrusive_ptr<SparseMatrix>& lhs_mat,
    const c10::intrusive_ptr<SparseMatrix>& rhs_mat);
25

czkkkkkk's avatar
czkkkkkk committed
26
27
28
/**
 * @brief Multiplies two sparse matrices possibly with different sparsities.
 *
czkkkkkk's avatar
czkkkkkk committed
29
30
 * @param lhs_mat SparseMatrix
 * @param rhs_mat SparseMatrix
czkkkkkk's avatar
czkkkkkk committed
31
32
33
34
35
36
37
 *
 * @return SparseMatrix
 */
c10::intrusive_ptr<SparseMatrix> SpSpMul(
    const c10::intrusive_ptr<SparseMatrix>& lhs_mat,
    const c10::intrusive_ptr<SparseMatrix>& rhs_mat);

czkkkkkk's avatar
czkkkkkk committed
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * @brief Divides two sparse matrices with the same sparsity.
 *
 * @param lhs_mat SparseMatrix
 * @param rhs_mat SparseMatrix
 *
 * @return SparseMatrix
 */
c10::intrusive_ptr<SparseMatrix> SpSpDiv(
    const c10::intrusive_ptr<SparseMatrix>& lhs_mat,
    const c10::intrusive_ptr<SparseMatrix>& rhs_mat);

50
51
52
53
}  // namespace sparse
}  // namespace dgl

#endif  // SPARSE_ELEMENTWISE_OP_H_