Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66589541
val.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
Tue, Jun 11, 15:36
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Jun 13, 15:36 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18240698
Attached To
R6746 RationalROMPy
val.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
.der
import
polyder
from
rrompy.utilities.base.types
import
Np1D
,
Np2D
,
List
,
paramList
from
rrompy.parameter
import
checkParameterList
from
rrompy.utilities.exception_manager
import
RROMPyException
__all__
=
[
'polyval'
]
def
polyval
(
x
:
paramList
,
c
:
Np2D
,
basis
:
str
,
m
:
List
[
int
]
=
None
,
scl
:
Np1D
=
None
)
->
Np2D
:
c
=
polyder
(
c
,
basis
,
m
=
m
,
scl
=
scl
)
x
=
checkParameterList
(
x
)[
0
]
if
x
.
shape
[
1
]
>
c
.
ndim
:
raise
RROMPyException
(
"Incompatible parameter number."
)
try
:
polyvalbase
=
{
"CHEBYSHEV"
:
np
.
polynomial
.
chebyshev
.
chebval
,
"LEGENDRE"
:
np
.
polynomial
.
legendre
.
legval
,
"MONOMIAL"
:
np
.
polynomial
.
polynomial
.
polyval
}[
basis
.
upper
()]
except
:
raise
RROMPyException
(
"Polynomial basis not recognized."
)
c
=
polyvalbase
(
x
(
0
),
c
,
tensor
=
True
)
for
d
in
range
(
1
,
x
.
shape
[
1
]):
c
=
polyvalbase
(
x
(
d
),
c
,
tensor
=
False
)
return
c
Event Timeline
Log In to Comment