Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64470148
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
Mon, May 27, 02:51
Size
690 B
Mime Type
text/x-python
Expires
Wed, May 29, 02:51 (2 d)
Engine
blob
Format
Raw Data
Handle
17909284
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
)
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