I want to operate(sum) two 2d-vectors(NumPy.array) in python 3.
I know I can use functions in NumPy, but I still want to know is there any package to support SSE instruction opreation in python 3? or any existing package with high efficiency to do that?
There's numpy-mkl which is Numpy compiled against Intel's Math Kernel Library.
Related
I would like a python function that would operate similar to: talib.RSI() (https://mrjbq7.github.io/ta-lib/)
The feature that I am looking for is that I can have it in a loop and just feed it the latest stock close price, and it would output the current RSI value. Also no forever growing stock price list would have to be maintained inside our outside of the function.
If anyone can direct me to such or how to build it, I would be very grateful.
Thanks
TA-Lib for python is just a wrapper for TA-Lib library written in C. This library doesn't support incremental calculation of indicators. It requires whole data at once. But there is a fork of TA-Lib - TA-Lib RT that introduces such functionality. Being a fork it's written in C language too and thus requires a python wrapper to be used from Python application. There is experimental adaptation of a original TA-Lib's python wrapper to TA-Lib RT here and related discussion here. You may try to set it up but note performance issues discussion at the end of the thread. You may need *BatchState functions instead of *State.
Or you may look for some python library not based on TA-Lib. I heard about talipp as an alternative. You may check its RSI implementation sources for example.
Note: I know how to cythonize my own Python modules.
So, I have managed to cythonize some of my Python modules, and I've gained some speed. The question is, since cython:
The goal of cython is to be compatible with python, i.e. that you can cythonize any python code and it will work as before. Currently, a large fraction of python code already works. Cython furthermore allows you to optimize parts of your code and compile it into more efficient C code.
Source: What does Cython do with imports?
Now, the biggest issue in my code evolve around re.py, the built-in Python Regular Expression module, despite the fact, that I am per-compiling my regexes.
I need to use a parallel linear algebra on OSX and as painlessly as possible (i.e., at most I can use HomeBrew with my colleagues) factorization library due to the number of DOFs I have in my problems.
I've tried Armadillo, it supports sparse algebra which is what I need, I can link with the Accelerate framework, but it just solves linear problems, it doesn't support factorization AFAIK.
Next, MKL, but nothing I can do seems to trigger threading, even with TBB:
tbb::task_scheduler_init scheduler(4);
mkl_set_dynamic(true);
mkl_set_num_threads(4);
mkl_set_num_threads_local(4);
Eigen could be cool, but it seems that, like MKL, it won't run in parallel.
Do you have any suggestions?
OSX clang does not support openmp, which is required by multi-thread Eigen and MKL.
According to IntelĀ® Math Kernel Library Link Line Advisor, MKL does not support TBB threading with clang.
But it seems to support Intel OpenMP library with the extra link option -liomp5. You could try if it works. If not, you may have to use another compiler such as gcc. You could find it in HomeBrew.
I am learning python from a video tutorial series that uses a GUI called 'simpleGUI'.
It is not inbuilt in python so I had to download install a similar module called 'simpleGUITK'.
I'm new to python and I wish to know if there is any inbuilt module that I can import without any installation (like I important math or random) which is same as (or at least similar to) simpleguitk?
Because I might need to send some py files to a friend who might not be having the simpleguitk module.
To my knowledge there is no GUI module in the standard library. However, some, like Tkinter, are included with most Python distributions.
I strongly advise that you have a look at the GUI FAQ in the official documentation.
A standard build of python includes tkinter. From the GUI FAQ:
Standard builds of Python include an object-oriented interface to the
Tcl/Tk widget set, called tkinter. This is probably the easiest to
install (since it comes included with most binary distributions of
Python) and use. For more info about Tk, including pointers to the
source, see the Tcl/Tk home page. Tcl/Tk is fully portable to the Mac
OS X, Windows, and Unix platforms.
Is the combination of Python 3 and PyQt 4 recommended? Are there any alternatives?
I don't see why not, there is a version available for Python 3 which works normally, and the only alternative if you really need Qt would be PySide, which is far from being compatible with Python 3.
Other GUI alternatives would be wxPython (not in Python 3 yet AFAIK) and the "native" Tkinter (which is something else...).
If PyQt4 is the only non-native module you need, there should be no problem.
Check if all modules you need are available for Py3k!
PyQt4 for Py3k is not yet integrated into all distributions.
I.e. on Debian PyQt4 only works with Python 2 currently.
Have a look at 3to2! A tool to convert Py3 to Py2 code.
That is just better than coding in Py2 and using 2to3.