accelerate-framework

Sum array of unsigned 8-bit integers using the Accelerate framework

末鹿安然 提交于 2019-11-29 22:43:54
问题 Can I use the Accelerate Framework to sum an array of unsigned 8-bit integers without converting to an array of floats. My current approach is: vDSP_vfltu8(intArray, 1, floatArray, 1, size); vDSP_sve(floatArray, 1, &result, size); But vDSP_vfltu8 is quite slow. 回答1: If it is important to you that vDSP_vfltu8( ) be fast, please file a bug report . If there's any question, file a bug report . Inadequate performance is a bug, and will be treated as such if you report it. Library writers use this

IIR coefficients for peaking EQ, how to pass them to vDSP_deq22?

…衆ロ難τιáo~ 提交于 2019-11-29 19:53:01
问题 I have these 6 coefficients for peaking EQ: b0 = 1 + (α ⋅ A) b1 = −2⋅ωC b2 = 1 - (α ⋅ A) a0 = 1 + (α / A) a1 = −2 ⋅ ωC a2 = 1 − (α / A) With these intermediate variables: ωc = 2 ⋅ π ⋅ fc / fs ωS = sin(ωc) ωC = cos(ωc) A = sqrt(10^(G/20)) α = ωS / (2Q) The documentation of vDSP_deq22() states that "5 single-precision inputs, filter coefficients" should be passed but I have 6 coefficients! Also, in what order do I pass them to vDSP_deq22() ? Update (17/05): I recommend everyone to use my DSP

How to perform matrix inverse operation using the accelerate framework?

戏子无情 提交于 2019-11-29 10:58:15
I would like to find the inverse of a matrix. I know this involves first LU factorisation then the inversion step but I cannot find the required function by searching apple's docs of 10.7! This seems like a useful post Symmetric Matrix Inversion in C using CBLAS/LAPACK , pointing out that the sgetrf_ and sgetri_ functions should be used. However searching these terms I find nothing in Xcode docs. Does anybody have boiler plate code for this matrix operation? Apple does not document the LAPACK code at all, I guess because they just implement the standard interface from netlib.org . It's a shame

How to implement fast image filters on iOS platform

柔情痞子 提交于 2019-11-29 02:58:31
问题 I am working on iOS application where user can apply a certain set of photo filters. Each filter is basically set of Photoshop actions with a specific parameters. This actions are: Levels adjustment Brightness / Contrast Hue / Saturation Single and multiple overlay I've repeated all this actions in my code using arithmetic expressions looping through the all pixels in image. But when I run my app on iPhone 4, each filter takes about 3-4 sec to apply which is quite a few time for the user to

iPhone Accelerate Framework FFT vs Matlab FFT

◇◆丶佛笑我妖孽 提交于 2019-11-28 23:59:38
I do not have much math background but part of the project I am working on requires the FFT of a single vector. The matlab function fft(x) works accurately for what I need, but after trying to set up the Accelerate Framework fft functions I get completely inaccurate results. If anyone has more expertise/experience with Accelerate Framework fft I could really use some help trying to figure out what I am doing wrong. I based my fft set-up off an example I found on google, but there were no tutorials or anything that produced different results. EDIT1: Changed around some stuff based on the

Perform autocorrelation with vDSP_conv from Apple Accelerate Framework

感情迁移 提交于 2019-11-28 21:58:57
I need to perform the autocorrelation of an array (vector) but I am having trouble finding the correct way to do so. I believe that I need the method "vDSP_conv" from the Accelerate Framework, but I can't follow how to successfully set it up. The thing throwing me off the most is the need for 2 inputs. Perhaps I have the wrong function, but I couldn't find one that operated on a single vector. The documentation can be found here Copied from the site vDSP_conv Performs either correlation or convolution on two vectors; single precision. void vDSP_conv ( const float __vDSP_signal[], vDSP_Stride _

performance of NumPy with different BLAS implementations

∥☆過路亽.° 提交于 2019-11-28 11:01:28
I'm running an algorithm that is implemented in Python and uses NumPy. The most computationally expensive part of the algorithm involves solving a set of linear systems (i.e. a call to numpy.linalg.solve() . I came up with this small benchmark: import numpy as np import time # Create two large random matrices a = np.random.randn(5000, 5000) b = np.random.randn(5000, 5000) t1 = time.time() # That's the expensive call: np.linalg.solve(a, b) print time.time() - t1 I've been running this on: My laptop, a late 2013 MacBook Pro 15" with 4 cores at 2GHz ( sysctl -n machdep.cpu.brand_string gives me

How to perform matrix inverse operation using the accelerate framework?

被刻印的时光 ゝ 提交于 2019-11-28 04:12:01
问题 I would like to find the inverse of a matrix. I know this involves first LU factorisation then the inversion step but I cannot find the required function by searching apple's docs of 10.7! This seems like a useful post Symmetric Matrix Inversion in C using CBLAS/LAPACK, pointing out that the sgetrf_ and sgetri_ functions should be used. However searching these terms I find nothing in Xcode docs. Does anybody have boiler plate code for this matrix operation? 回答1: Apple does not document the

Perform autocorrelation with vDSP_conv from Apple Accelerate Framework

不羁的心 提交于 2019-11-27 14:09:14
问题 I need to perform the autocorrelation of an array (vector) but I am having trouble finding the correct way to do so. I believe that I need the method "vDSP_conv" from the Accelerate Framework, but I can't follow how to successfully set it up. The thing throwing me off the most is the need for 2 inputs. Perhaps I have the wrong function, but I couldn't find one that operated on a single vector. The documentation can be found here Copied from the site vDSP_conv Performs either correlation or

UnsafeMutablePointer<Int8> from String in Swift

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 04:07:36
问题 I'm using the dgeev algorithm from the LAPACK implementation in the Accelerate framework to calculate eigenvectors and eigenvalues of a matrix. Sadly the LAPACK functions are not described in the Apple Documentation with a mere link to http://netlib.org/lapack/faq.html included. If you look it up, you will find that the first two arguments in dgeev are characters signifying whether to calculate eigenvectors or not. In Swift, it is asking for UnsafeMutablePointer<Int8> . When I simply use "N"