- Home /
Mono.Simd not working properly
In my previous question (http://answers.unity3d.com/questions/462539/how-to-use-monosimd.html), I've asked how I could use Mono.Simd in my project. I got that sort of working right now (I did that by taking "mono.simd.dll" and putting it in my assets in the project). And now I can create vector, which seems to use SSE/SIMD to improve speed (since multiplying a bunch of Vector4f's with each other is significantly faster than just multiplying 4 floats). The only problem is that only half of the things are working, I can use *, -, + and / to do basic operations on vectors, however I can't use any function, such as Sqrt(), InvSqrt(), or Reciprocal() for example (see the Mono.simd-documentation http://docs.go-mono.com/?link=N%3aMono.Simd).
For example:
Vector4f V1 = new Vector4f(0.5f,0.8f,1.6f,38.5f); //Create a vector
V1.Sqrt(); //Take the squareroot of this vector
UnityEngine.Debug.Log(V1); //Show results
Just outputs <0.5, 0.8, 1.6, 38.5>
It doesn't matter what function I take or with what vectors I try it with (Vector2d, Vector4f, Vector4i, Vector 8s and so forth), I always get the exact same numbers I put in the vector to begin with (but, as mentioned, *-+ and / do work as they're supposed to work). Does anyone know what I'm doing wrong here (BTW, my computerchip handles SSE up and till 4, so that's not the problem)?
Do you have this working correctly in a native $$anonymous$$ono application? Looking at the docs for the Sqrt
function over on the $$anonymous$$ono site it looks to me that the function returns a Vector4f
.
No, I've got the exact same problem if I'm using it in a native $$anonymous$$ono application. And the functions should take one vector, and changing that vector, so you can't say Vector2 = Vector1.Sqrt(), but you have to be using it like Vector1.Sqrt() (which takes the squareroot of every number inside that vector).
Does anyone else have any suggestions on how to fix this? Or does anyone need more information in order to help?
Answer by _-_ · May 27, 2013 at 10:21 PM
Fixed it, turned out the correct syntax was "Vector1 = Vector1.Sqrt()" after all. Pretty sure I've tried that at least a hundred times yesterday, but I guessed I overlooked something since it was late.
Your answer
![](https://koobas.hobune.stream/wayback/20220613103013im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Support the MONO AOT Compilation on Android 0 Answers
Mono library to connect to Java/Python/Node backend? 1 Answer