Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UInt32 array to Double array Swift

I need to multiply 2 matrices in swift, so in order to use accelerate I need 2 arrays with type double. The issue is, the two arrays that I need to multiply are type UInt32. Is there anyway to convert a UInt32 array to a double array?

var UInt32TestArray: [UInt32] = [1,4,2,3]
var Int32TestArray: [Double] = [Double](UInt32) //Doesn't work
like image 549
Ethan Rappaport Avatar asked Mar 26 '26 05:03

Ethan Rappaport


1 Answers

Use

UInt32TestArray.map { Double($0) }

to get an array of Double.

like image 80
GoZoner Avatar answered Mar 27 '26 20:03

GoZoner



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!