1 #ifndef DataFormat_Math_ExtVec_H
2 #define DataFormat_Math_ExtVec_H
7 #define VECTOR_EXT(N) __attribute__( ( ext_vector_type( N ) ) )
9 #define VECTOR_EXT(N) __attribute__( ( vector_size( N ) ) )
23 #if defined(__aarch64__)
24 typedef long double VECTOR_EXT( 32 ) float128x2_t;
25 typedef
long double VECTOR_EXT( 64 ) float128x4_t;
26 typedef
long double VECTOR_EXT( 128 ) float128x8_t;
31 template<
typename T,
int N>
60 #if defined(__aarch64__)
93 template<
typename Vec,
typename F>
99 for (
int i=0;
i!=
N;++
i) ret[
i] =
f(v[
i]);
104 template<
typename Vec>
109 Vec x1200{ x[1], x[2], x[0], x[0] };
110 Vec y2010{ y[2], y[0], y[1], y[0] };
111 Vec x2010{ x[2], x[0], x[1], x[0] };
112 Vec y1200{ y[1], y[2], y[0], y[0] };
113 return x1200 * y2010 - x2010 * y1200;
116 template<
typename V1,
typename V2>
119 return x[0]*
y[1]-
x[1]*
y[0];
156 for (
int i=0;
i!=
N;++
i) ret+=
x[
i]*
y[
i];
160 template<
typename V1,
typename V2 >
165 for (
int i=0;
i!=2;++
i) ret+=
x[
i]*
y[
i];
206 axis{ (
Vec){
T(1),0,0,0},
215 axis{ (Vec){xx,
xy,xz,0},
221 return Rot3( axis[0][0], axis[1][0], axis[2][0],
222 axis[0][1], axis[1][1], axis[2][1],
223 axis[0][2], axis[1][2], axis[2][2]
239 return v[0]*axis[0] + v[1]*axis[1] + v[2]*axis[2];
244 return Rot3(tr.rotateBack(r.
axis[0]),tr.rotateBack(r.
axis[1]),tr.rotateBack(r.
axis[2]));
248 return Rot3(rotateBack(r.
axis[0]),rotateBack(r.
axis[1]),rotateBack(r.
axis[2]));
260 return lh.rotateBack(rh);
283 return Rot2( axis[0][0], axis[1][0],
284 axis[0][1], axis[1][1]
299 return v[0]*axis[0] + v[1]*axis[1];
304 return Rot2(tr.rotateBack(r.
axis[0]),tr.rotateBack(r.
axis[1]));
308 return Rot2(rotateBack(r.
axis[0]),rotateBack(r.
axis[1]));
322 return lh.rotateBack(rh);
328 std::ostream &
operator<<(std::ostream &
out, Vec2D
const & v);
329 std::ostream &
operator<<(std::ostream &
out, Vec2F
const & v);
330 std::ostream &
operator<<(std::ostream &
out, Vec4F
const & v);
331 std::ostream &
operator<<(std::ostream &
out, Vec4D
const & v);
333 std::ostream & operator<<(std::ostream & out, As3D<Vec4F>
const &
v);
334 std::ostream & operator<<(std::ostream & out, As3D<Vec4D>
const &
v);
336 std::ostream &
operator<<(std::ostream &
out, Rot3F
const & v);
337 std::ostream &
operator<<(std::ostream &
out, Rot3D
const & v);
338 std::ostream &
operator<<(std::ostream &
out, Rot2F
const & v);
339 std::ostream &
operator<<(std::ostream &
out, Rot2D
const & v);
344 std::ostream &
operator<<(std::ostream &
out, ::Vec4F
const & v) {
345 return out <<
'(' << v[0] <<
", " << v[1] <<
", "<< v[2] <<
", "<< v[3] <<
')';
347 std::ostream &
operator<<(std::ostream &
out, ::Vec4D
const & v) {
348 return out <<
'(' << v[0] <<
", " << v[1] <<
", "<< v[2] <<
", "<< v[3] <<
')';
350 std::ostream &
operator<<(std::ostream &
out, ::Vec2F
const & v) {
351 return out <<
'(' << v[0] <<
", " << v[1] <<
')';
353 std::ostream &
operator<<(std::ostream &
out, ::Vec2D
const & v) {
354 return out <<
'(' << v[0] <<
", " << v[1] <<
')';
357 std::ostream & operator<<(std::ostream & out, ::As3D<Vec4F>
const &
v) {
358 return out <<
'(' << v.v[0] <<
", " << v.v[1] <<
", "<< v.v[2] <<
')';
361 std::ostream & operator<<(std::ostream & out, ::As3D<Vec4D>
const &
v) {
362 return out <<
'(' << v.v[0] <<
", " << v.v[1] <<
", "<< v.v[2] <<
')';
365 std::ostream &
operator<<(std::ostream &
out, ::Rot3F
const & r){
369 std::ostream &
operator<<(std::ostream &
out, ::Rot3D
const & r){
373 std::ostream &
operator<<(std::ostream &
out, ::Rot2F
const & r){
374 return out << r.
axis[0] <<
'\n' << r.
axis[1];
377 std::ostream &
operator<<(std::ostream &
out, ::Rot2D
const & r){
378 return out << r.
axis[0] <<
'\n' << r.
axis[1];
auto cross2(V1 x, V2 y) -> typename std::remove_reference< decltype(x[0])>::type
auto zw(V v) -> Vec2< typenamestd::remove_reference< decltype(v[0])>::type >
typename ExtVecTraits< T, N >::type ExtVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
auto dot2(V1 x, V2 y) -> typenamestd::remove_reference< decltype(x[0])>::type
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
As3D< V > as3D(V const &v)
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)