Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
41b41809
Unverified
Commit
41b41809
authored
Jan 11, 2023
by
Hongzhi (Steve), Chen
Committed by
GitHub
Jan 11, 2023
Browse files
Polish (#5149)
Co-authored-by:
Steve
<
ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal
>
parent
9c647d80
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
docs/source/api/python/dgl.sparse_v0.rst
docs/source/api/python/dgl.sparse_v0.rst
+2
-0
python/dgl/sparse/elementwise_op.py
python/dgl/sparse/elementwise_op.py
+14
-14
No files found.
docs/source/api/python/dgl.sparse_v0.rst
View file @
41b41809
...
...
@@ -161,6 +161,8 @@ Elementwise Operators
add
sub
mul
div
power
Matrix Multiplication
...
...
python/dgl/sparse/elementwise_op.py
View file @
41b41809
...
...
@@ -11,13 +11,13 @@ __all__ = ["add", "sub", "mul", "div", "power"]
def
add
(
A
:
Union
[
DiagMatrix
,
SparseMatrix
],
B
:
Union
[
DiagMatrix
,
SparseMatrix
]
)
->
Union
[
DiagMatrix
,
SparseMatrix
]:
"""Elementwise additions for ``DiagMatrix`` and ``SparseMatrix``
. This is
r
"""Elementwise additions for ``DiagMatrix`` and ``SparseMatrix``
,
equivalent to ``A + B``.
The supported combinations are shown as follows.
+--------------+------------+--------------+--------+
| A
\
\
B | DiagMatrix | SparseMatrix | scalar |
|
A \ B | DiagMatrix | SparseMatrix | scalar |
+--------------+------------+--------------+--------+
| DiagMatrix | ✅ | ✅ | 🚫 |
+--------------+------------+--------------+--------+
...
...
@@ -56,13 +56,13 @@ def add(
def
sub
(
A
:
Union
[
DiagMatrix
],
B
:
Union
[
DiagMatrix
])
->
Union
[
DiagMatrix
]:
"""Elementwise subtraction for ``DiagMatrix`` and ``SparseMatrix``. This is
r
"""Elementwise subtraction for ``DiagMatrix`` and ``SparseMatrix``. This is
equivalent to ``A - B``.
The supported combinations are shown as follows.
+--------------+------------+--------------+--------+
| A
\
\
B | DiagMatrix | SparseMatrix | scalar |
|
A \ B | DiagMatrix | SparseMatrix | scalar |
+--------------+------------+--------------+--------+
| DiagMatrix | ✅ | 🚫 | 🚫 |
+--------------+------------+--------------+--------+
...
...
@@ -98,13 +98,13 @@ def mul(
A
:
Union
[
SparseMatrix
,
DiagMatrix
,
float
,
int
],
B
:
Union
[
SparseMatrix
,
DiagMatrix
,
float
,
int
],
)
->
Union
[
SparseMatrix
,
DiagMatrix
]:
"""Elementwise multiplication for ``DiagMatrix`` and ``SparseMatrix``
. This
is
equivalent to ``A * B``.
r
"""Elementwise multiplication for ``DiagMatrix`` and ``SparseMatrix``
,
equivalent to ``A * B``.
The supported combinations are shown as follows.
+--------------+------------+--------------+--------+
| A
\
\
B | DiagMatrix | SparseMatrix | scalar |
|
A \ B | DiagMatrix | SparseMatrix | scalar |
+--------------+------------+--------------+--------+
| DiagMatrix | ✅ | 🚫 | ✅ |
+--------------+------------+--------------+--------+
...
...
@@ -153,13 +153,13 @@ def mul(
def
div
(
A
:
Union
[
DiagMatrix
],
B
:
Union
[
DiagMatrix
,
float
,
int
]
)
->
Union
[
DiagMatrix
]:
"""Elementwise division for ``DiagMatrix`` and ``SparseMatrix``
. This is
equivalent
to ``A / B``.
r
"""Elementwise division for ``DiagMatrix`` and ``SparseMatrix``
, equivalent
to ``A / B``.
The supported combinations are shown as follows.
+--------------+------------+--------------+--------+
| A
\
\
B | DiagMatrix | SparseMatrix | scalar |
|
A \ B | DiagMatrix | SparseMatrix | scalar |
+--------------+------------+--------------+--------+
| DiagMatrix | ✅ | 🚫 | ✅ |
+--------------+------------+--------------+--------+
...
...
@@ -199,13 +199,13 @@ def div(
def
power
(
A
:
Union
[
SparseMatrix
,
DiagMatrix
],
scalar
:
Union
[
float
,
int
]
)
->
Union
[
SparseMatrix
,
DiagMatrix
]:
"""Elementwise exponentiation for ``DiagMatrix`` and ``SparseMatrix``
. This
is
equivalent to ``A ** scalar``.
r
"""Elementwise exponentiation for ``DiagMatrix`` and ``SparseMatrix``
,
equivalent to ``A ** scalar``.
The supported combinations are shown as follows.
+--------------+------------+--------------+--------+
| A
\
\
B | DiagMatrix | SparseMatrix | scalar |
|
A \ B | DiagMatrix | SparseMatrix | scalar |
+--------------+------------+--------------+--------+
| DiagMatrix | 🚫 | 🚫 | ✅ |
+--------------+------------+--------------+--------+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment