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
OpenFold
Commits
4e9f7a9d
Commit
4e9f7a9d
authored
May 07, 2022
by
Gustaf Ahdritz
Browse files
Simplify rotation multiplication code
parent
1eb4fcdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
42 deletions
+18
-42
openfold/utils/rigid_utils.py
openfold/utils/rigid_utils.py
+18
-42
No files found.
openfold/utils/rigid_utils.py
View file @
4e9f7a9d
...
...
@@ -34,49 +34,25 @@ def rot_matmul(
Returns:
The product ab
"""
row_1
=
torch
.
stack
(
[
a
[...,
0
,
0
]
*
b
[...,
0
,
0
]
+
a
[...,
0
,
1
]
*
b
[...,
1
,
0
]
+
a
[...,
0
,
2
]
*
b
[...,
2
,
0
],
a
[...,
0
,
0
]
*
b
[...,
0
,
1
]
+
a
[...,
0
,
1
]
*
b
[...,
1
,
1
]
+
a
[...,
0
,
2
]
*
b
[...,
2
,
1
],
a
[...,
0
,
0
]
*
b
[...,
0
,
2
]
+
a
[...,
0
,
1
]
*
b
[...,
1
,
2
]
+
a
[...,
0
,
2
]
*
b
[...,
2
,
2
],
],
dim
=-
1
,
)
row_2
=
torch
.
stack
(
[
a
[...,
1
,
0
]
*
b
[...,
0
,
0
]
+
a
[...,
1
,
1
]
*
b
[...,
1
,
0
]
+
a
[...,
1
,
2
]
*
b
[...,
2
,
0
],
a
[...,
1
,
0
]
*
b
[...,
0
,
1
]
+
a
[...,
1
,
1
]
*
b
[...,
1
,
1
]
+
a
[...,
1
,
2
]
*
b
[...,
2
,
1
],
a
[...,
1
,
0
]
*
b
[...,
0
,
2
]
+
a
[...,
1
,
1
]
*
b
[...,
1
,
2
]
+
a
[...,
1
,
2
]
*
b
[...,
2
,
2
],
],
dim
=-
1
,
)
row_3
=
torch
.
stack
(
[
a
[...,
2
,
0
]
*
b
[...,
0
,
0
]
+
a
[...,
2
,
1
]
*
b
[...,
1
,
0
]
+
a
[...,
2
,
2
]
*
b
[...,
2
,
0
],
a
[...,
2
,
0
]
*
b
[...,
0
,
1
]
+
a
[...,
2
,
1
]
*
b
[...,
1
,
1
]
+
a
[...,
2
,
2
]
*
b
[...,
2
,
1
],
a
[...,
2
,
0
]
*
b
[...,
0
,
2
]
+
a
[...,
2
,
1
]
*
b
[...,
1
,
2
]
+
a
[...,
2
,
2
]
*
b
[...,
2
,
2
],
],
dim
=-
1
,
)
def
row_mul
(
i
):
return
torch
.
stack
(
[
a
[...,
i
,
0
]
*
b
[...,
0
,
0
]
+
a
[...,
i
,
1
]
*
b
[...,
1
,
0
]
+
a
[...,
i
,
2
]
*
b
[...,
2
,
0
],
a
[...,
i
,
0
]
*
b
[...,
0
,
1
]
+
a
[...,
i
,
1
]
*
b
[...,
1
,
1
]
+
a
[...,
i
,
2
]
*
b
[...,
2
,
1
],
a
[...,
i
,
0
]
*
b
[...,
0
,
2
]
+
a
[...,
i
,
1
]
*
b
[...,
1
,
2
]
+
a
[...,
i
,
2
]
*
b
[...,
2
,
2
],
],
dim
=-
1
,
)
row_1
=
row_mul
(
0
)
row_2
=
row_mul
(
1
)
row_3
=
row_mul
(
2
)
return
torch
.
stack
([
row_1
,
row_2
,
row_3
],
dim
=-
2
)
...
...
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