Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101853151
homogeneization.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
Fri, Feb 14, 09:50
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Feb 16, 09:50 (1 d, 10 h)
Engine
blob
Format
Raw Data
Handle
24242463
Attached To
R6746 RationalROMPy
homogeneization.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
rrompy.utilities.base.types
import
Np1D
,
Np2D
,
Tuple
,
List
,
paramList
from
rrompy.utilities.poly_fitting.polynomial.homogeneization
import
(
homogeneizedpolyvander
as
hpvP
)
from
rrompy.utilities.exception_manager
import
RROMPyException
from
.vander
import
heavisidevander
__all__
=
[
'homogeneizedpolyvander'
]
def
homogeneizedpolyvander
(
x
:
paramList
,
poles
:
Np1D
,
deg
:
int
=
None
,
basis
:
str
=
"MONOMIAL_HEAVISIDE"
,
derIdxs
:
List
[
List
[
List
[
int
]]]
=
None
,
reorder
:
List
[
int
]
=
None
,
scl
:
Np1D
=
None
)
\
->
Tuple
[
Np2D
,
List
[
List
[
int
]],
List
[
int
]]:
"""
Compute radial-basis-inclusive homogeneized Hermite-Vandermonde matrix with
specified derivative directions.
"""
if
derIdxs
is
not
None
and
np
.
sum
(
np
.
sum
(
derIdxs
))
>
0
:
raise
RROMPyException
((
"Cannot take derivatives of radial basis "
"function."
))
basisp
=
basis
.
split
(
"_"
)[
0
]
VanR
=
heavisidevander
(
x
,
poles
,
reorder
=
reorder
)
if
deg
is
None
or
deg
<
0
:
VanP
=
np
.
empty
((
len
(
x
),
0
))
derIdxs
,
ordIdxs
=
np
.
zeros
(
0
,
dtype
=
int
),
np
.
zeros
(
0
,
dtype
=
int
)
else
:
VanP
,
derIdxs
,
ordIdxs
=
hpvP
(
x
,
deg
,
basisp
,
derIdxs
=
derIdxs
,
reorder
=
reorder
,
scl
=
scl
)
ordIdxsEff
=
np
.
concatenate
((
np
.
arange
(
len
(
VanR
)),
ordIdxs
+
len
(
VanR
)))
return
(
np
.
block
([[
VanR
,
VanP
],
[
VanP
.
T
.
conj
(),
np
.
zeros
(
tuple
([
VanP
.
shape
[
1
]]
*
2
))]]),
derIdxs
,
ordIdxsEff
)
Event Timeline
Log In to Comment