GithubHelp home page GithubHelp logo

pseudopy's Introduction

PseudoPy Build Status

PseudoPy computes and visualizes the pseudospectrum of a matrix. It is a Python version of the original eigtool by Thomas G. Wright. The algorithms used in this package can be found in the book Spectra and pseudospectra by Nick Trefethen and Mark Embree.

Example

The pseudospectrum of the Grcar matrix looks like this:

Pseudospectrum of Grcar matrix

If no knowledge about the location of the pseudospectrum of the given matrix is available, the following lines of code can be used to obtain an approximation:

from pseudopy import NonnormalAuto, demo
from matplotlib import pyplot
from scipy.linalg import eigvals

# get Grcar matrix
A = demo.grcar(32).todense()

# compute pseudospectrum for the levels of interest between [1e-5, 1]
pseudo = NonnormalAuto(A, 1e-5, 1)

# plot
pseudo.plot([10**k for k in range(-4, 0)], spectrum=eigvals(A))
pyplot.show()

Installation

Dependencies

PseudoPy depends on numpy, scipy, matplotlib and shapely. If you are on Debian/Ubuntu, you can install these dependencies with

sudo apt-get install python-numpy python-scipy python-matplotlib python-shapely

pip

pip install pseudopy

Note that you may need to add sudo if you want to install it system-wide.

License

PseudoPy is free software licensed under the MIT License.

pseudopy's People

Contributors

andrenarchy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pseudopy's Issues

PseudoPsectrum of Random Matrix.

why my kernel dies when I put :

n  = 2000
mu = 0  
sigma = 1
A  = np.random.normal(mu, sigma, (n,n))

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

Non-square matrix

Hi,
I would like to know if your code is capable of computing the pseudospectrum of a rectangular matrix.
Thank you,
Georgios

Non Square matrix

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()

Support singular matrices?

It seems like the code for non-normal matrices requires the matrix to be non-singular. Am I missing something? If not, is there any plans to support non-singular matrices in the near future?

problems with importing pseudopy

I just installed pseudopy on my ubuntu machine and that seemed to go smoothly.

However, when I try importing it I get the following error.

I am sorry to bug you with this but if you have any advice on how to fix this I would be very keen to start playing with this library. It looks great!

import pseudopy
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/pseudopy/init.py", line 5, in
from .normal import Normal, NormalEvals
File "/usr/local/lib/python2.7/dist-packages/pseudopy/normal.py", line 3, in
import shapely.geometry as geom
ImportError: No module named shapely.geometry

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.