6 #ifndef _EULE_NO_INTRINSICS_
33 int iSqrMag = x*x + y*y + z*z + w*w;
34 return (
double)iSqrMag;
40 return sqrt(SqrMagnitude());
46 #ifndef _EULE_NO_INTRINSICS_
49 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
50 __m256d __vector_scalar = _mm256_set_pd(scalar.
w, scalar.
z, scalar.
y, scalar.
x);
53 __m256d __product = _mm256_mul_pd(__vector_self, __vector_scalar);
57 _mm256_storeu_pd(result, __product);
103 double length = Magnitude();
115 #ifndef _EULE_NO_INTRINSICS_
118 __m256d __vec = _mm256_set_pd(w, z, y, x);
119 __m256d __len = _mm256_set1_pd(length);
122 __m256d __prod = _mm256_div_pd(__vec, __len);
126 _mm256_storeu_pd(prod, __prod);
150 std::cerr <<
"Stop normalizing int-vectors!!" << std::endl;
165 (::Math::Similar(x, other.
x, epsilon)) &&
166 (::Math::Similar(y, other.
y, epsilon)) &&
167 (::Math::Similar(z, other.
z, epsilon)) &&
168 (::Math::Similar(w, other.
w, epsilon))
198 throw std::out_of_range(
"Array descriptor on Vector4<T> out of range!");
216 throw std::out_of_range(
"Array descriptor on Vector4<T> out of range!");
225 const double it = 1.0 - t;
227 #ifndef _EULE_NO_INTRINSICS_
230 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
231 __m256d __vector_other = _mm256_set_pd(other.
w, other.
z, other.
y, other.
x);
232 __m256d __t = _mm256_set1_pd(t);
233 __m256d __it = _mm256_set1_pd(it);
238 __m256d __sum = _mm256_set1_pd(0);
240 __sum = _mm256_fmadd_pd(__vector_self, __it, __sum);
241 __sum = _mm256_fmadd_pd(__vector_other, __t, __sum);
245 _mm256_storeu_pd(sum, __sum);
254 x = it * x + t * other.
x;
255 y = it * y + t * other.
y;
256 z = it * z + t * other.
z;
257 w = it * w + t * other.
w;
269 const double it = 1.0 - t;
271 x = (int)(it * (
double)x + t * (double)other.
x);
272 y = (int)(it * (
double)y + t * (double)other.
y);
273 z = (int)(it * (
double)z + t * (double)other.
z);
274 w = (int)(it * (
double)w + t * (double)other.
w);
282 copy.LerpSelf(other, t);
299 #ifndef _EULE_NO_INTRINSICS_
302 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
303 __m256d __vector_other = _mm256_set_pd(other.
w, other.
z, other.
y, other.
x);
306 __m256d __sum = _mm256_add_pd(__vector_self, __vector_other);
310 _mm256_storeu_pd(sum, __sum);
345 #ifndef _EULE_NO_INTRINSICS_
348 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
349 __m256d __vector_other = _mm256_set_pd(other.
w, other.
z, other.
y, other.
x);
352 __m256d __sum = _mm256_add_pd(__vector_self, __vector_other);
356 _mm256_storeu_pd(sum, __sum);
389 #ifndef _EULE_NO_INTRINSICS_
392 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
393 __m256d __vector_other = _mm256_set_pd(other.
w, other.
z, other.
y, other.
x);
396 __m256d __diff = _mm256_sub_pd(__vector_self, __vector_other);
400 _mm256_storeu_pd(diff, __diff);
435 #ifndef _EULE_NO_INTRINSICS_
438 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
439 __m256d __vector_other = _mm256_set_pd(other.
w, other.
z, other.
y, other.
x);
442 __m256d __diff = _mm256_sub_pd(__vector_self, __vector_other);
446 _mm256_storeu_pd(diff, __diff);
479 #ifndef _EULE_NO_INTRINSICS_
482 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
483 __m256d __scalar = _mm256_set1_pd(scale);
486 __m256d __prod = _mm256_mul_pd(__vector_self, __scalar);
490 _mm256_storeu_pd(prod, __prod);
526 #ifndef _EULE_NO_INTRINSICS_
529 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
530 __m256d __scalar = _mm256_set1_pd(scale);
533 __m256d __prod = _mm256_mul_pd(__vector_self, __scalar);
537 _mm256_storeu_pd(prod, __prod);
570 #ifndef _EULE_NO_INTRINSICS_
573 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
574 __m256d __scalar = _mm256_set1_pd(scale);
577 __m256d __prod = _mm256_div_pd(__vector_self, __scalar);
581 _mm256_storeu_pd(prod, __prod);
617 #ifndef _EULE_NO_INTRINSICS_
620 __m256d __vector_self = _mm256_set_pd(w, z, y, x);
621 __m256d __scalar = _mm256_set1_pd(scale);
624 __m256d __prod = _mm256_div_pd(__vector_self, __scalar);
628 _mm256_storeu_pd(prod, __prod);
675 newVec.
x = (mat[0][0] * x) + (mat[0][1] * y) + (mat[0][2] * z) + (mat[0][3] * w);
676 newVec.
y = (mat[1][0] * x) + (mat[1][1] * y) + (mat[1][2] * z) + (mat[1][3] * w);
677 newVec.
z = (mat[2][0] * x) + (mat[2][1] * y) + (mat[2][2] * z) + (mat[2][3] * w);
678 newVec.
w = (mat[3][0] * x) + (mat[3][1] * y) + (mat[3][2] * z) + (mat[3][3] * w);
688 newVec.
x = (mat[0][0] * x) + (mat[0][1] * y) + (mat[0][2] * z) + (mat[0][3] * w);
689 newVec.
y = (mat[1][0] * x) + (mat[1][1] * y) + (mat[1][2] * z) + (mat[1][3] * w);
690 newVec.
z = (mat[2][0] * x) + (mat[2][1] * y) + (mat[2][2] * z) + (mat[2][3] * w);
691 newVec.
w = (mat[3][0] * x) + (mat[3][1] * y) + (mat[3][2] * z) + (mat[3][3] * w);
710 x = (mat[0][0] * buffer.
x) + (mat[0][1] * buffer.
y) + (mat[0][2] * buffer.
z) + (mat[0][3] * buffer.
w);
711 y = (mat[1][0] * buffer.
x) + (mat[1][1] * buffer.
y) + (mat[1][2] * buffer.
z) + (mat[1][3] * buffer.
w);
712 z = (mat[2][0] * buffer.
x) + (mat[2][1] * buffer.
y) + (mat[2][2] * buffer.
z) + (mat[2][3] * buffer.
w);
713 w = (mat[3][0] * buffer.
x) + (mat[3][1] * buffer.
y) + (mat[3][2] * buffer.
z) + (mat[3][3] * buffer.
w);
743 x = std::move(other.
x);
744 y = std::move(other.
y);
745 z = std::move(other.
z);
746 w = std::move(other.
w);
758 x = (int)((mat[0][0] * buffer.
x) + (mat[0][1] * buffer.
y) + (mat[0][2] * buffer.
z) + (mat[0][3] * buffer.
w));
759 y = (int)((mat[1][0] * buffer.
x) + (mat[1][1] * buffer.
y) + (mat[1][2] * buffer.
z) + (mat[1][3] * buffer.
w));
760 z = (int)((mat[2][0] * buffer.
x) + (mat[2][1] * buffer.
y) + (mat[2][2] * buffer.
z) + (mat[2][3] * buffer.
w));
761 w = (int)((mat[3][0] * buffer.
x) + (mat[3][1] * buffer.
y) + (mat[3][2] * buffer.
z) + (mat[3][3] * buffer.
w));
769 return !operator==(other);
790 template <
typename T>
792 template <
typename T>
794 template <
typename T>
796 template <
typename T>
798 template <
typename T>
800 template <
typename T>
802 template <
typename T>
804 template <
typename T>
806 template <
typename T>
808 template <
typename T>