Is there a python version of MATLAB's place function - python

MATLAB's place function is pretty handy for determining a matrix that gives you the desired eigenvalues of a system.
I'm trying to implement it in Python, but numpy.place doesn't seem to be an analagous function and I can't for the life of me seem to find anything better in the numpy or scipy documentation.

Found this and other control functions in Python Control Systems Library

Related

Implementation of NumPy exponential function

I'm trying to perform an evaluation of total floating-point operations (FLOPs) of a neural network.
My problem is the following. I'm using a sigmoid function. My question is how to eval the FLOPs of the exponential function. I'm using Tensorflow which relies on NumPy for the exp function.
I tried to dig into the Numpy code but didn't find the implementation ... I saw some subjects here talking about fast implementation of exponential but it doesn't really help.
My guess is that it would use a Taylor implementation or Chebychev.
Do you have any clue about this? And if so an estimation of the amount of FLOPs. I tried to find some references as well on Google but nothing really standardized ...
Thank you a lot for your answers.
I looked into it for a bit and what i found is that numpy indeed uses the C implementation as seen here.
Tensorflow though doesnt use nmpy implementation, instead it uses the scalar_logistics_opfunction from the C++ library called Eigen. The source for that can be found here.

Calculate principle value integral with julia

With the python package scipy one can find the principle value of a function (given that the pole is of low order) using the "cauchy" weighting method, see scipy.integrate.quad (consider for instance this question, where its usage is demonstrated). Is something analogous possible within the julia ecosystem (of course on can import scipy easily, but the native integration packages of julia should be, in principle, superior).
There doesn't seem to be any native library that does this. GSL has it (https://www.gnu.org/software/gsl/doc/html/integration.html#qawc-adaptive-integration-for-cauchy-principal-values), so you can call it through https://github.com/JuliaMath/GSL.jl

Block-diagonal Schur factorization in Python

I have a real non-diagonalizable matrix that I'm looking to decompose as tidily as possible. I would love to put it in Jordan normal form, but since that's problematic numerically I'm looking for the next best thing. I've discovered that there are FORTRAN and MATLAB routines that will do a block-diagonal Schur factorization of a matrix. The FORTRAN implementation in SLICOT is MB03RD and the MATLAB implementation is bdschur (which for all I know could just be a wrapper around MB03RD).
I don't have MATLAB on my computer, and the code that's generating my matrices is in Python, so I'm looking for an equivalent function in Python. Old documentation for Python Control Systems Library indicated that an emulation of bdschur was planned, but it doesn't show up anywhere in the current docs. The Slycot repository has a FORTRAN file for MB03RD, but I can't seem to find much documentation for Slycot, and when I import it very few functions actually appear to be wrapped as Python functions.
I would like to know if anyone knows of a way to call an equivalent routine in Python, or if there exists some other similar decomposition that has an implementation in Python.

What is the easiest way to solve matrix inverse using python

I Wanted to solve matrix inverse without calling numpy into python. I want to know if it possible or not.
your question title:
What is the easiest way to solve matrix inverse using python
import numpy
numpy.linalg.inv(your_matrix)
or the same with scipy instead of numpy -- that's definitely the easiest, for you as a programmer.
What is your reason not to use numpy?
You can of course look for an algorithm and implement it manually. But the built-in function are based on the Fortran LAPACK algorithms, which are tested and optimized for the last 50 years... they will be hard to surpass...

Solution method used for Scipy solve_banded matrix

Does anyone know what method scipy.linalg.solve_banded uses to solve the system of equations? The documentation does not state the solution method used by the function. Usually the Thomas algorithm, a.k.a. TDMA, is used for these types of systems but I was wondering if this Scipy function uses some other solution method.
The Github code shows that scipy uses the lapack routine gbsv() to solve this. You can read about gbsv() here and here.
I am not sure if this the same as the Thomas algorithm. Looks like both use LU decomposition, though.

Categories