Пример #1
0
        public bool Equals(Rotor other, float epsilon)
        {
            __m128 eps = _mm_set1_ps(epsilon);
            __m128 cmp = _mm_cmplt_ps(
                _mm_andnot_ps(_mm_set1_ps(-0f), _mm_sub_ps(P1, other.P1)), eps);

            return(_mm_movemask_ps(cmp) != 0b1111);
        }
Пример #2
0
        public static Branch Log(Rotor r)
        {
            float cos_ang = _mm_store_ss(r.P1);
            float ang     = MathF.Acos(cos_ang);
            float sin_ang = MathF.Sin(ang);

            var p1 = _mm_mul_ps(r.P1, Detail.rcp_nr1(_mm_set1_ps(sin_ang)));

            p1 = _mm_mul_ps(p1, _mm_set1_ps(ang));
            p1 = Sse41.IsSupported
                                ? _mm_blend_ps(p1, _mm_setzero_ps(), 1)
                                : _mm_and_ps(p1, _mm_castsi128_ps(_mm_set_epi32(-1, -1, -1, 0)));

            return(new Branch(p1));
        }
Пример #3
0
        public static Rotor Sqrt(Branch b)
        {
            var p1 = _mm_add_ss(b.P1, _mm_set_ss(1f));

            return(new Rotor(Rotor.Normalized(p1)));
        }
Пример #4
0
 public bool Equals(Rotor other)
 {
     return(P1.Equals(other.P1));
 }