Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60130025
rb_distributed_2d.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 27, 17:56
Size
2 KB
Mime Type
text/x-python
Expires
Mon, Apr 29, 17:56 (2 d)
Engine
blob
Format
Raw Data
Handle
17305818
Attached To
R6746 RationalROMPy
rb_distributed_2d.py
View Options
# Copyright (C) 2018 by the RROMPy authors
#
# This file is part of RROMPy.
#
# RROMPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# RROMPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with RROMPy. If not, see <http://www.gnu.org/licenses/>.
#
import
numpy
as
np
from
matrix_random
import
matrixRandom
from
rrompy.reduction_methods.distributed
import
RBDistributed
as
RBD
from
rrompy.parameter.parameter_sampling
import
(
QuadratureSampler
as
QS
,
ManualSampler
as
MS
)
from
rrompy.parameter
import
checkParameterList
def
test_LS
():
mu0
=
[
2
,
3
]
solver
=
matrixRandom
()
params
=
{
"POD"
:
True
,
"R"
:
5
,
"S"
:
[
3
,
3
],
"sampler"
:
QS
([[
0.
,
4.
],
[
1.
,
5.
]],
"CHEBYSHEV"
)}
approx
=
RBD
(
solver
,
mu0
,
params
,
verbosity
=
0
)
approx
.
setupApprox
()
for
mu
in
approx
.
mus
:
assert
not
np
.
isclose
(
approx
.
normErr
(
mu
)[
0
],
0.
,
atol
=
1e-7
)
approx
.
POD
=
False
approx
.
setupApprox
()
for
mu
in
approx
.
mus
[
approx
.
R
:]:
assert
not
np
.
isclose
(
approx
.
normErr
(
mu
)[
0
],
0.
,
atol
=
1e-3
)
def
test_interp
():
mu0
=
[
2
,
3
]
solver
=
matrixRandom
()
params
=
{
"POD"
:
False
,
"S"
:
[
3
,
3
],
"sampler"
:
QS
([[
0.
,
4.
],
[
1.
,
5.
]],
"CHEBYSHEV"
)}
approx
=
RBD
(
solver
,
mu0
,
params
,
verbosity
=
0
)
approx
.
setupApprox
()
for
mu
in
approx
.
mus
:
assert
np
.
isclose
(
approx
.
normErr
(
mu
)[
0
],
0.
,
atol
=
1e-7
)
def
test_hermite
():
mu0
=
[
2
,
3
]
solver
=
matrixRandom
()
sampler0
=
QS
([[
0.
,
4.
],
[
1.
,
5.
]],
"CHEBYSHEV"
)
points
,
_
=
checkParameterList
(
np
.
tile
(
sampler0
.
generatePoints
([
2
,
2
])
.
data
,
[
3
,
1
]))
params
=
{
"POD"
:
True
,
"S"
:
[
12
],
"sampler"
:
MS
([[
0.
,
4.
],
[
1.
,
5.
]],
points
=
points
)}
approx
=
RBD
(
solver
,
mu0
,
params
,
verbosity
=
0
)
approx
.
setupApprox
()
for
mu
in
approx
.
mus
:
assert
np
.
isclose
(
approx
.
normErr
(
mu
)[
0
],
0.
,
atol
=
1e-8
)
Event Timeline
Log In to Comment