andrenarchy / pseudopy

PseudoPy computes and visualizes the pseudospectrum of a matrix
MIT License
24 stars 5 forks source link

Non Square matrix #10

Open nikosmatsa opened 3 years ago

nikosmatsa commented 3 years ago

I want to find the pseudospectrum of a rectangular matrix but your code wants square error. I have read here by Trefethen that there is an algorithm.

import numpy as np
import matplotlib.pyplot as plt
from pseudopy import *
from scipy.linalg import eigvals

A = np.array([[1, 3, 2],
              [5, 3, 1],
              [3, 4, 5],
              [3, 4, 5]])
pseudo = NonnormalAuto(A, 1e-5, 1)
pseudo.plot([10**k for k in range(-1, 1)], spectrum=eigvals(A))
pyplot.show()