-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix translation for conflicting module name (#1854)
Fix the translation of a file whose name conflicts with Fortran keywords by ensuring that the original name is correctly extracted from the scope. Fixes #1853. **Commit Summary** - Ensure Python name of module exists in the scope by adding it in the syntactic stage. - Don't use `AsName` for module name - Save the Python name of a module as the name of the `PyModule` - Ensure Python names are used for imports - Remove hacky `set_name` function. - Remove unused `assign_to` argument of `CodePrinter.doprint`. --------- Co-authored-by: Yaman Güçlü <yaman.guclu@gmail.com>
- Loading branch information
1 parent
d422cac
commit 8445dd7
Showing
15 changed files
with
97 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# pylint: disable=missing-function-docstring, missing-module-docstring | ||
|
||
def matmul(a: 'float[:,:](order=C)', | ||
b: 'float[:,:](order=F)', | ||
c: 'float[:,:](order=C)'): | ||
|
||
m, p = a.shape | ||
q, n = b.shape | ||
r, s = c.shape | ||
|
||
if p != q or m != r or n != s: | ||
return -1 | ||
|
||
for i in range(m): | ||
for j in range(n): | ||
c[i, j] = 0.0 | ||
for k in range(p): | ||
c[i, j] += a[i, k] * b[k, j] | ||
|
||
return 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# pylint: disable=missing-function-docstring, missing-module-docstring | ||
import numpy as np | ||
from endif import matmul | ||
|
||
if __name__ == '__main__': | ||
a = np.ones((3,4)) | ||
b = np.ones((4,3), order='F') | ||
c = np.empty((3,3)) | ||
matmul(a, b, c) | ||
print(c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters