104 double operator()(
double a,
double b)
const {
return a * b; }
109 double operator()(
double a,
double b)
const {
return a + b; }
114 double operator()(
double a,
double b)
const {
return a - b; }
136#if defined(__SSE2__) && defined(__GNUC__) && defined(HAVE_EMMINTRIN_H) && defined(HAVE_EMMINTRIN)
137# define __x86_vector__
139#ifdef HAVE_EMMINTRIN_H
140# include <emmintrin.h>
144#define VEC_ALIGN __attribute__((aligned(16)))
163 for (
int i = 0; i <
LEN/2; i++) {
173 for (
int i = 0; i <
LEN/2; i++) {
182 for (
int i = 0; i <
LEN/2; i++) {
183 data.v[i] = p.data.v[i];
190 for (
int i = 0; i <
LEN/2; i++) data.v[i] = d.v[i];
196 for (
int i = 0; i <
LEN/2; i++) data.v[i] =
f.v[i];
203 for (
int i = 0; i <
LEN/2; i++) {
204 data.v[i] = p.data.v[i];
222 for (
int i = 0; i <
LEN/2; i++) {
231 for (
int i = 0; i <
LEN/2; i++) {
244 for (
int i = 0; i <
LEN; i++)
249#define DOP_IMPL(__op__) { \
250 dvec_internal<LEN> result; \
251 for (int i = 0; i < LEN/2; i++) { \
252 result.v[i] = __op__(data.v[i], b.data.v[i]); \
254 return dvec<LEN>(result); \
290 for (
int i = 0; i <
LEN/2; i++) {
293 for (
int i = 0; i <
LEN/2; i++) {
304 for (
int i = 0; i <
LEN; i++)
_t[i] = s;
316 for (
int i =
limit-1; i >= 0; i--) {
329 for (
int i = 0; i <
limit; i++) {
342 for (
int i = 0; i <
limit; i++) {
356 for (
int i = 0; i <
LEN; i++) {
399 double x()
const {
return (*
this)[0]; }
400 double y()
const {
return (*
this)[1]; }
448 out <<
"<" << v.x() <<
"," << v.y() <<
">";
453# define __fpu_vector__
457#define VEC_ALIGN __attribute__((aligned(16)))
473 for (
int i = 0; i <
LEN; i++)
480 for (
int i = 0; i <
LEN; i++)
487 for (
int i = 0; i <
LEN; i++)
494 for (
int i = 0; i <
LEN; i++)
495 data.v[i] = p.data.v[i];
501 for (
int i = 0; i <
LEN; i++)
508 for (
int i = 0; i <
LEN; i++)
516 for (
int i = 0; i <
LEN; i++)
517 data.v[i] = p.data.v[i];
525 return data.v[index];
546 for (
int i = 0; i <
LEN; i++)
554 for (
int i = 0; i <
LEN; i++)
562 for (
int i = 0; i <
LEN; i++)
572 for (
int i = 0; i <
LEN; i++)
573 r.v[i] = data.v[i] + b.data.v[i];
582 for (
int i = 0; i <
LEN; i++)
583 r.v[i] = data.v[i] - b.data.v[i];
592 for (
int i = 0; i <
LEN; i++)
593 r.v[i] = data.v[i] * b.data.v[i];
602 for (
int i = 0; i <
LEN; i++)
603 r.v[i] = data.v[i] / b.data.v[i];
612 for (
int i = 0; i <
LEN; i++)
613 r.v[i] = data.v[i] * s.data.v[i] + b.data.v[i];
622 for (
int i = 0; i <
LEN; i++)
623 r.v[i] = data.v[i] * s + b.data.v[i];
632 for (
int i =
limit-1; i >= 0; i--) {
642 for (
int i = 0; i <
limit; i++) {
653 for (
int i = 0; i <
limit; i++) {
654 r.v[i] =
op(data.v[i]);
665 for (
int i = 0; i <
LEN; i++) {
695 double operator[](
int index)
const {
return v[index]; }
697 double x()
const {
return v[0]; }
698 double y()
const {
return v[1]; }
701 return vec2d(v[0] + b.v[0], v[1] + b.v[1]);
705 return vec2d(v[0] - b.v[0], v[1] - b.v[1]);
709 return vec2d(v[0] * b.v[0], v[1] * b.v[1]);
713 return vec2d(v[0] / b.v[0], v[1] / b.v[1]);
721 return vec2d(v[0]*s.v[0]+b.v[0], v[1]*s.v[1]+b.v[1]);
730 v = (
double*)((((
uintptr_t)m) + 0x10L) & ~0xFL);
739 out <<
"<" << v.x() <<
"," << v.y() <<
">";
double operator()(double a, double b) const
double operator()(double a, double b) const
double operator()(double a) const
double operator()(double a, double b) const
virtual double operator()(double a, double b) const =0
virtual double operator()(double a) const =0
void u_store(double *arr) const
dvec< LEN > operator-(const dvec< LEN > &b)
double foldr(double proto, const dvec_op &operation, int limit=LEN)
dvec< LEN > operator+(const dvec< LEN > &b)
void a_store(double *arr) const
dvec< LEN > madd(const double s, const dvec< LEN > &b)
dvec(const dvec< LEN > &p)
dvec< LEN > & operator=(const dvec< LEN > &p)
dvec< LEN > madd(const dvec< LEN > &s, const dvec< LEN > &b)
bool operator==(const dvec< LEN > &b) const
void a_store(float *arr) const
dvec< LEN > operator/(const dvec< LEN > &b)
dvec< LEN > operator*(const dvec< LEN > &b)
double operator[](int index) const
double foldl(double proto, const dvec_op &operation, int limit=LEN)
void u_store(float *arr) const
dvec< LEN > map(const dvec_unop &operation, int limit=LEN)
Header file for the BRL-CAD common definitions.
void pt2dsub(pt2d_t r, pt2d_t a, pt2d_t b)
std::ostream & operator<<(std::ostream &out, const dvec< LEN > &v)
void mat2d_pt2d_mul(pt2d_t r, mat2d_t m, pt2d_t p)
bool mat2d_inverse(mat2d_t inv, mat2d_t m)
bool vequals(const vec2d &a, const vec2d &b)
void move(pt2d_t a, const double *b)
void int float float float * scale
#define __attribute__(ignore)
double fastf_t
fastest 64-bit (or larger) floating point type
#define NEAR_ZERO(val, epsilon)
fundamental vector, matrix, quaternion math macros