Levinson-Durbin recursion in Julia DSP package - time-series

I want use to use Levinson-Durbin recursion in Julia, it was suggested that I should use DSP package, but I couldn't find the usage of "LPCLevinson"
Pkg.add("DSP")
using DSP
using Distributions
ab=[1:5]
LPCLevinson(ab,4)

Related

Fastest way to compute cosine similarity in a GPU

So I have a huge tfidf matrix with more than a million records, I would like to find the cosine similarity of this matrix with itself. I am using colab to run the code, but I am not sure how to best make use of the gpu provided by colab.
sequentially run code -
tfidf_matrix = tf.fit_transform(df['categories'])
cosine_similarities = linear_kernel(matrix, matrix)
Is there way we can parallelise the code using jit or any other way?
try simple torch code like in this example from sentence transformers library: https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/util.py#L31
or just import the function.
consider cuml library which uses CUDA acceleration
https://docs.rapids.ai/api/cuml/nightly/api.html

fft numpy style on iOS accelerate with non power of two data length

I'm working on reimplementing python code on iOS (swift).
I need to do an fft (numpy style) on chunks of 1D data. each with size 1050 (windowed audio data).
Thankfully I found related explanation and snippet of code on how to do iOS fft in numpy style (link).
However, I'm stuck where accelerate framework supports doing fft only on a power of 2 input data length (or more recently, f * 2^n, where f is 3, 5, or 15 and n is at least 3).
I tested my python code on window size 1050. Working great for my use case. But it is not straightforward to implement on iOS, because of the above limitation.
It is not so easy to dig into numpy c code to know how they're doing it for non power of two lengths. This answer was a good starting point for me, but still didn't get it.
Speed here is also important, that's why I'm not considering a brute force dft.
Any guidance here would be really appreciated.
IIRC, for fft, under-the-hood, numpy uses fftpack, a C conversion of an old NCAR Fortran math library. The actual numpy fft is not implemented in Python code. You could very likely compile some fftpack C code using Xcode, and use a bridging header to call it from iOS Swift code.
Your answers/comments guided me to use c/c++ code to get the desired result. (I didn't think of that as an option initially).
I ended up using opencv dft function (which internally implements fft) that produces similar results to numpy's fft (+ it is faster than numpy, according to their docs).

Z3Py how to use Pi and e

Is it possible to use pi, e and other non-algebraic real numbers in Z3Py?
I wouldn't want to run any C program, but directly from the Z3 Python API
Non-algebraic numbers are usually not supported by SMT solvers. Having said that, you can get pi in z3 indirectly via trigonometric functions, (sin, cos etc.); but the support is incomplete. (Meaning that the solver is most likely to return unknown for most inputs.)
See this answer for a related question: Support of trigonometric functions ( e.g.: cos, tan) in Z3

How to create a convex hull of all binary spots in ImageJ

I have a binary image of separated spots.
Is there any ImageJ plugin that could construct convex hull of all spots?
Or could you recommend another program, not ImageJ, that can do this?
With OpenCV you can use findContours() and then convexHull()
You can see a complete example here: https://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/hull/hull.html
OpenCV is a library, which means that you have to code the program yourself. It has bindings for Java, python and many other languages. You can easily find the same example in other languages:
Convex Hull on Java Android Opencv 2.3
Provided you have an 8-bit (binary) image in ImageJ, you can run the following Groovy script from the script editor to get the convex hull as current selection:
## ImagePlus imp
import ij.gui.PolygonRoi
import ij.gui.Roi
import ij.plugin.filter.ThresholdToSelection
import ij.process.ImageProcessor
imp.getProcessor().setThreshold(128,255,ImageProcessor.NO_LUT_UPDATE)
roi = ThresholdToSelection.run(imp)
proi = new PolygonRoi(roi.getContainedFloatPoints(), Roi.POLYGON)
chRoi = new PolygonRoi(proi.getConvexHull(), Roi.POLYGON)
imp.setRoi(chRoi)
Note that in general, this type of question might be considered off-topic here and is better asked on the ImageJ forum, where you'll get advice from image processing experts.
Edit-Selection-make selection, then ConvexHull

OpenCV GPU Primitives

Are the OpenCV primitives based on the CUDA Nvidia Performance Primitives (NPP)?.
By primitives I mean the same ones implemented in the NPP library, for example: boxFilter, Mirror, Convolution...
I would like to know about this issue as I'm planning use the NPP library. However, OpenCV has more functions that could help me for example in border treatment for image processing.
OpenCV uses NPP library for some functions. But it is hard to create a compelete list of such functions.
Some functions uses only NPP implemetation (boxFilter, graphcut, histEven).
Other functions uses different implemetations for different input parameters. For example, cv::gpu::resize uses NPP for some input parameters (CV_8UC1 and CV_8UC3 types, INTER_NEAREST and INTER_LINEAR interpolation mode) and for other parameters it uses own implementation.
Great webinar about OpenCV on a GPU using CUDA
Video - http://on-demand.gputechconf.com/gtc/2013/webinar/opencv.mp4
Slides PDF - http://on-demand.gputechconf.com/gtc/2013/webinar/opencv-gtc-express-shalini-gupta.pdf

Resources