Page MenuHomec4science

mhd_engine.py
No OneTemporary

File Metadata

Created
Mon, May 27, 02:51

mhd_engine.py

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