Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
pymor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
pyMOR
pymor
Commits
de06f078
Commit
de06f078
authored
Aug 31, 2020
by
Tim Keil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make addition commutative
parent
8f7ae9e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
src/pymor/analyticalproblems/functions.py
src/pymor/analyticalproblems/functions.py
+4
-2
src/pymor/operators/interface.py
src/pymor/operators/interface.py
+4
-2
src/pymor/parameters/functionals.py
src/pymor/parameters/functionals.py
+4
-2
No files found.
src/pymor/analyticalproblems/functions.py
View file @
de06f078
...
...
@@ -63,13 +63,15 @@ class Function(ParametricObject):
other
=
ConstantFunction
(
other
,
dim_domain
=
self
.
dim_domain
)
if
self
.
name
!=
'LincombFunction'
:
if
isinstance
(
other
,
LincombFunction
)
and
other
.
name
==
'LincombFunction'
:
if
other
.
name
==
'LincombFunction'
:
assert
isinstance
(
other
,
LincombFunction
)
functions
=
(
self
,)
+
other
.
functions
coefficients
=
(
1.
,)
+
(
other
.
coefficients
if
sign
==
1.
else
tuple
(
-
c
for
c
in
other
.
coefficients
))
else
:
functions
,
coefficients
=
(
self
,
other
),
(
1.
,
sign
)
elif
isinstance
(
other
,
LincombFunction
)
and
other
.
name
==
'LincombFunction'
:
elif
other
.
name
==
'LincombFunction'
:
assert
isinstance
(
self
,
LincombFunction
)
assert
isinstance
(
other
,
LincombFunction
)
functions
=
self
.
functions
+
other
.
functions
coefficients
=
self
.
coefficients
+
(
other
.
coefficients
if
sign
==
1.
else
tuple
(
-
c
for
c
in
other
.
coefficients
))
...
...
src/pymor/operators/interface.py
View file @
de06f078
...
...
@@ -525,13 +525,15 @@ class Operator(ParametricObject):
return
NotImplemented
from
pymor.operators.constructions
import
LincombOperator
if
self
.
name
!=
'LincombOperator'
:
if
isinstance
(
other
,
LincombOperator
)
and
other
.
name
==
'LincombOperator'
:
if
other
.
name
==
'LincombOperator'
:
assert
isinstance
(
other
,
LincombOperator
)
operators
=
(
self
,)
+
other
.
operators
coefficients
=
(
1.
,)
+
(
other
.
coefficients
if
sign
==
1.
else
tuple
(
-
c
for
c
in
other
.
coefficients
))
else
:
operators
,
coefficients
=
(
self
,
other
),
(
1.
,
sign
)
elif
isinstance
(
other
,
LincombOperator
)
and
other
.
name
==
'LincombOperator'
:
elif
other
.
name
==
'LincombOperator'
:
assert
isinstance
(
self
,
LincombOperator
)
assert
isinstance
(
other
,
LincombOperator
)
operators
=
self
.
operators
+
other
.
operators
coefficients
=
self
.
coefficients
+
(
other
.
coefficients
if
sign
==
1.
else
tuple
(
-
c
for
c
in
other
.
coefficients
))
...
...
src/pymor/parameters/functionals.py
View file @
de06f078
...
...
@@ -55,13 +55,15 @@ class ParameterFunctional(ParametricObject):
other
=
ConstantParameterFunctional
(
other
)
if
self
.
name
!=
'LincombParameterFunctional'
:
if
isinstance
(
other
,
LincombParameterFunctional
)
and
other
.
name
==
'LincombParameterFunctional'
:
if
other
.
name
==
'LincombParameterFunctional'
:
assert
isinstance
(
other
,
LincombParameterFunctional
)
functionals
=
(
self
,)
+
other
.
functionals
coefficients
=
(
1.
,)
+
(
other
.
coefficients
if
sign
==
1.
else
tuple
(
-
c
for
c
in
other
.
coefficients
))
else
:
functionals
,
coefficients
=
(
self
,
other
),
(
1.
,
sign
)
elif
isinstance
(
other
,
LincombParameterFunctional
)
and
other
.
name
==
'LincombParameterFunctional'
:
elif
other
.
name
==
'LincombParameterFunctional'
:
assert
isinstance
(
self
,
LincombParameterFunctional
)
assert
isinstance
(
other
,
LincombParameterFunctional
)
functionals
=
self
.
functionals
+
other
.
functionals
coefficients
=
self
.
coefficients
+
(
other
.
coefficients
if
sign
==
1.
else
tuple
(
-
c
for
c
in
other
.
coefficients
))
...
...
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