Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F84018699
mhd_engine.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, Sep 20, 07:15
Size
761 B
Mime Type
text/x-python
Expires
Sun, Sep 22, 07:15 (2 d)
Engine
blob
Format
Raw Data
Handle
20908594
Attached To
R6746 RationalROMPy
mhd_engine.py
View Options
import
numpy
as
np
import
scipy.io
as
scio
import
scipy.sparse
as
sp
from
rrompy.hfengines.scipy_engines
import
TensorizedEigenproblemEngine
class
MHDEngine
(
TensorizedEigenproblemEngine
):
"""
From Matrix Market: //math.nist.gov/MatrixMarket/data/NEP/mhd/mhd.html
"""
def
__init__
(
self
,
ncol
:
int
=
1
,
seed
:
int
=
31415
):
A
=
sp
.
csr_matrix
(
scio
.
mmread
(
"mhd4800a.mtx"
),
dtype
=
np
.
complex
)
B
=
-
scio
.
mmread
(
"mhd4800b.mtx"
)
.
tocsr
()
super
()
.
__init__
([
A
,
B
],
seed
,
ncol
)
self
.
cutOffPolesRMax
=
0.
self
.
cutOffResNormMin
=
1e-5
def
getPolesExact
(
self
,
k
:
int
,
sigma
:
np
.
complex
):
return
sp
.
linalg
.
eigs
(
self
.
As
[
0
],
k
,
-
self
.
As
[
1
],
sigma
,
return_eigenvectors
=
False
)
Event Timeline
Log In to Comment