Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
particle_methods
hysop
Commits
40cceccc
Commit
40cceccc
authored
6 years ago
by
Jean-Baptiste Keck
Browse files
Options
Downloads
Plain Diff
Merge branch 'mpi-operators' of gricad-gitlab.univ-grenoble-alpes.fr:keckj/hysop into mpi-operators
parents
d6acd372
51b17389
No related branches found
No related tags found
1 merge request
!16
MPI operators
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hysop/symbolic/relational.py
+11
-6
11 additions, 6 deletions
hysop/symbolic/relational.py
with
11 additions
and
6 deletions
hysop/symbolic/relational.py
+
11
−
6
View file @
40cceccc
...
...
@@ -142,16 +142,19 @@ class Assignment(BinaryRelation):
return
'
=
'
@classmethod
def
assign
(
cls
,
lhs
,
rhs
):
def
assign
(
cls
,
lhs
,
rhs
,
skip_zero_rhs
=
False
):
exprs
=
()
def
create_expr
(
rhs
):
return
(
not
skip_zero_rhs
)
or
(
rhs
!=
0
)
if
isinstance
(
lhs
,
npw
.
ndarray
)
and
isinstance
(
rhs
,
npw
.
ndarray
):
assert
isinstance
(
lhs
,
npw
.
ndarray
),
type
(
lhs
)
assert
isinstance
(
rhs
,
npw
.
ndarray
),
type
(
rhs
)
assert
(
rhs
.
size
==
lhs
.
size
)
assert
(
rhs
.
shape
==
lhs
.
shape
)
for
(
l
,
r
)
in
zip
(
lhs
.
ravel
().
tolist
(),
rhs
.
ravel
().
tolist
()):
e
=
cls
(
l
,
r
)
exprs
+=
(
e
,)
if
create_expr
(
r
):
e
=
cls
(
l
,
r
)
exprs
+=
(
e
,)
elif
isinstance
(
lhs
,
npw
.
ndarray
)
or
isinstance
(
rhs
,
npw
.
ndarray
):
if
isinstance
(
lhs
,
npw
.
ndarray
):
lhss
=
lhs
.
ravel
().
tolist
()
...
...
@@ -160,13 +163,15 @@ class Assignment(BinaryRelation):
rhss
=
rhs
.
ravel
().
tolist
()
lhss
=
(
lhs
,)
*
len
(
rhss
)
for
(
l
,
r
)
in
zip
(
lhss
,
rhss
):
e
=
cls
(
l
,
r
)
exprs
+=
(
e
,)
if
create_expr
(
r
):
e
=
cls
(
l
,
r
)
exprs
+=
(
e
,)
elif
isinstance
(
lhs
,
sm
.
Basic
)
and
isinstance
(
rhs
,
sm
.
Basic
):
assert
isinstance
(
lhs
,
sm
.
Basic
),
type
(
lhs
)
assert
isinstance
(
rhs
,
sm
.
Basic
),
type
(
rhs
)
e
=
cls
(
lhs
,
rhs
)
exprs
+=
(
e
,)
if
create_expr
(
rhs
):
exprs
+=
(
e
,)
else
:
msg
=
'
Cannot handle operand types:
\n
*lhs: {}
\n
*rhs: {}
\n
'
msg
=
msg
.
format
(
type
(
lhs
),
type
(
rhs
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment