Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77985704
rational_interpolant_greedy.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, Aug 17, 16:30
Size
2 KB
Mime Type
text/x-python
Expires
Mon, Aug 19, 16:30 (2 d)
Engine
blob
Format
Raw Data
Handle
19961466
Attached To
R6746 RationalROMPy
rational_interpolant_greedy.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_fft
import
matrixFFT
from
rrompy.reduction_methods.distributed_greedy
import
\
RationalInterpolantGreedy
as
RIG
def
test_lax_tolerance
(
capsys
):
solver
=
matrixFFT
()
params
=
{
"POD"
:
True
,
"muBounds"
:
[
1.5
,
6.5
],
"S"
:
4
,
"polybasis"
:
"CHEBYSHEV"
,
"greedyTol"
:
1e-2
}
approx
=
RIG
(
solver
,
4.
,
params
,
verbosity
=
10
)
approx
.
greedy
()
out
,
err
=
capsys
.
readouterr
()
assert
"Done computing snapshots (final snapshot count: 10)."
in
out
assert
len
(
err
)
==
0
assert
np
.
isclose
(
approx
.
normErr
(
0
),
.
00770413
89
,
rtol
=
1e-3
)
def
test_samples_at_poles
():
solver
=
matrixFFT
()
params
=
{
"POD"
:
True
,
"muBounds"
:
[
1.5
,
6.5
],
"S"
:
4
,
"nTestPoints"
:
100
,
"polybasis"
:
"CHEBYSHEV"
,
"greedyTol"
:
1e-5
}
approx
=
RIG
(
solver
,
4.
,
params
,
verbosity
=
0
)
approx
.
greedy
()
for
mu
in
approx
.
mus
:
assert
np
.
isclose
(
approx
.
normErr
(
mu
)
/
(
1e-15
+
approx
.
normHF
(
mu
)),
0.
,
atol
=
1e-4
)
poles
=
approx
.
getPoles
()
for
lambda_
in
range
(
2
,
7
):
assert
np
.
isclose
(
np
.
min
(
np
.
abs
(
poles
-
lambda_
)),
0.
,
atol
=
1e-3
)
assert
np
.
isclose
(
np
.
min
(
np
.
abs
(
approx
.
mus
-
lambda_
)),
0.
,
atol
=
1e-1
)
def
test_maxIter
():
solver
=
matrixFFT
()
params
=
{
"POD"
:
True
,
"muBounds"
:
[
1.5
,
6.5
],
"S"
:
5
,
"nTestPoints"
:
500
,
"polybasis"
:
"CHEBYSHEV"
,
"greedyTol"
:
1e-6
,
"maxIter"
:
10
}
approx
=
RIG
(
solver
,
4.
,
params
,
verbosity
=
0
)
approx
.
input
=
lambda
:
"N"
approx
.
greedy
()
assert
len
(
approx
.
mus
)
==
10
_
,
_
,
maxEst
=
approx
.
getMaxErrorEstimator
(
approx
.
muTest
)
assert
maxEst
>
1e-6
Event Timeline
Log In to Comment