Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why fixed size? Some problems require unknowable-sized arrays. #53

Closed
adammj opened this issue Jul 8, 2016 · 3 comments
Closed

Why fixed size? Some problems require unknowable-sized arrays. #53

adammj opened this issue Jul 8, 2016 · 3 comments

Comments

@adammj
Copy link

adammj commented Jul 8, 2016

I was going to leave a request to add some additional operations that use two+ arrays: vDSP_vmulD, vDSP_vmmaD, and vDSP_vmmsbD. However, I realized that as-is I can't even use this project because the arrays are fixed size. For the arrays I use, the ultimate length is unknowable at initiation. I can see the performance benefits to using a fixed size array, but it removes a lot of flexibility.

@alejandro-isaza
Copy link
Owner

alejandro-isaza commented Jul 8, 2016

You can use a normal swift array in the same way you use a ValueArray. Actually anything that conforms to the LinearType protocol can be used for most operations. For instance

let array1: [Double] = (1..<100).map({ Double($0) })
let array2: [Double] = (1..<100).map({ 2 * Double($0) })
let result = dot(array1, array2)

ValueArray, as you say, is only for performance in the cases where you know the size beforehand. I will clarify this on the readme.

@adammj
Copy link
Author

adammj commented Jul 8, 2016

Thank you for the clarification. I'll have to revisit this project after conversion to Swift 3.0 (I stopped as soon as I saw the number of conversion issues). I'm interested in a complete library like this one; and I very much like that the pointers are used in such a clean way. But for now I'm just writing wrappers around each of the Accelerate functions I use.

I also think that 2 of functions I listed above (vDSP_vmmaD, and vDSP_vmmsbD) would be useful additions.

@alejandro-isaza
Copy link
Owner

Clarified on the readme. I will create a new ticket for porting over to Swift 3.0.

About vmma and vmmsb I think it is more clear to just write let result = a*b + c*d. I understand that there is a performance argument but if we add this to Upsurge then we need to add all of Accelerate. We had this discussion in the past and the conclusion was that Upsurge's goal is not to be a wrapper for Accelerate. A better option would be to write a full wrapper as a separate project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants