Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accelerate/Scenekit Framework:: Where's the math matrix/vector lib for 3d and 4d vectors?

I'm looking at this

https://developer.apple.com/library/mac/documentation/SceneKit/Reference/SceneKit_Functions/index.html

Aren't basic operations supported?

var t:SCNVector3 = SCNVector3(x: 0,y: -1,z: 2)
var a:SCNVector3 = SCNVector3(x: 1,y: -2,z: -2)
var b:SCNVector3 = t + a

or do I need to create my own operations C-style?

Where are the math vector/matrix functions like transpose? inverse? add? blas? lapack functions?

Accelerate framework doesn't look compatible??

https://developer.apple.com/library/ios/documentation/Accelerate/Reference/BLAS_Ref/index.html#//apple_ref/doc/uid/TP30000414-SW9

I didn't find any official apple simd extensions for swift. I did find this on git hub https://github.com/noxytrux/SwiftGeom

like image 511
μολὼν.λαβέ Avatar asked Jan 28 '26 03:01

μολὼν.λαβέ


1 Answers

You don't want to use tiny vectors like this with Accelerate framework, with the possible exception of vMathLib. You will lose your performance in overhead to check to see if the arrays and aligned and whether the problem is large enough to multithread.

Much of the SIMD level stuff you are looking for is in simd/simd.h and associated headers.

Also, Swift doesn't support SIMD vectors at the moment.

like image 187
Ian Ollmann Avatar answered Jan 30 '26 19:01

Ian Ollmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!