BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
PSEUDO_F64vec1.h
Go to the documentation of this file.
1
#ifndef L1Algo_PSEUDO_F64vec1_H
2
#define L1Algo_PSEUDO_F64vec1_H
3
4
#include "
vec_arithmetic.h
"
5
6
#include <cmath>
7
#include <iostream>
8
9
/**********************************
10
*
11
* Vector of four doubles
12
*
13
**********************************/
14
15
class
F64vec1
16
{
17
public
:
18
double
v
[1];
19
20
double
&
operator[]
(
int
i
) {
return
((
double
*)&
v
)[
i
]; }
21
double
operator[]
(
int
i
)
const
{
return
((
double
*)&
v
)[
i
]; }
22
23
F64vec1
() {}
24
F64vec1
(
const
F64vec1
& a) {
v
[0] = a.v[0]; }
25
F64vec1
(
const
double
& a) {
v
[0] = a; }
26
27
friend
double
min
(
double
x,
double
y) {
return
x < y ? x : y; }
28
friend
double
max
(
double
x,
double
y) {
return
x < y ? y : x; }
29
friend
double
asgnb
(
double
x,
double
y) {
return
y >= 0 ?
fabs
(x) : -
fabs
(x); }
30
friend
double
rsqrt
(
double
x) {
return
1. /
sqrt
(x); }
31
friend
double
rcp
(
double
x) {
return
1. / x; }
32
friend
double
sgn
(
double
x) {
return
x >= 0 ? 1 : -1; }
33
34
#define _f2(A, B, F) \
35
F64vec1 z; \
36
z.v[0] = F(A.v[0], B.v[0]); \
37
return z;
38
#define _f1(A, F) \
39
F64vec1 z; \
40
z.v[0] = F(A.v[0]); \
41
return z;
42
#define _op(A, B, O) \
43
F64vec1 z; \
44
z.v[0] = A.v[0] O B.v[0]; \
45
return z;
46
47
/* Arithmetic Operators */
48
friend
F64vec1
operator+
(
const
F64vec1
& a,
const
F64vec1
& b) {
_op
(a, b, +) }
49
friend
F64vec1
operator-
(
const
F64vec1
& a,
const
F64vec1
& b) {
_op
(a, b, -) }
50
friend
F64vec1
operator*
(
const
F64vec1
& a,
const
F64vec1
& b) {
_op
(a, b, *) }
51
friend
F64vec1
operator/
(
const
F64vec1
& a,
const
F64vec1
& b) {
_op
(a, b, /) }
52
53
/* Functions */
54
friend
F64vec1
min
(
const
F64vec1
& a,
const
F64vec1
& b) {
_f2
(a, b,
min
) }
55
friend
F64vec1
max
(
const
F64vec1
& a,
const
F64vec1
& b) {
_f2
(a, b,
max
) }
56
friend
F64vec1
asgnb
(
const
F64vec1
& a,
const
F64vec1
& b) {
_f2
(a, b,
asgnb
) }
57
friend
F64vec1
sqrt
(
const
F64vec1
& a) {
_f1
(a,
sqrt
) }
58
friend
F64vec1
rsqrt
(
const
F64vec1
& a) {
_f1
(a,
rsqrt
) }
59
friend
F64vec1
rcp
(
const
F64vec1
& a) {
_f1
(a,
rcp
) }
60
friend
F64vec1
fabs
(
const
F64vec1
& a) {
_f1
(a,
fabs
) }
61
friend
F64vec1
sgn
(
const
F64vec1
& a) {
_f1
(a,
sgn
) }
62
friend
F64vec1
exp
(
const
F64vec1
& a) {
_f1
(a,
exp
) }
63
friend
F64vec1
log
(
const
F64vec1
& a) {
_f1
(a,
log
) }
64
friend
F64vec1
sin
(
const
F64vec1
& a) {
_f1
(a,
sin
) }
65
friend
F64vec1
cos
(
const
F64vec1
& a){
_f1
(a,
cos
)}
66
#undef _f1
67
#undef _f2
68
#undef _op
69
70
/* Define all operators for consistensy */
71
72
vec_arithmetic
(
F64vec1
,
double
);
73
74
friend
std::ostream&
operator<<
(std::ostream& strm,
const
F64vec1
& a)
75
{
76
strm << a[0];
77
return
strm;
78
}
79
80
friend
std::istream&
operator>>
(std::istream& strm,
F64vec1
& a)
81
{
82
double
tmp;
83
strm >> tmp;
84
a = tmp;
85
return
strm;
86
}
87
88
};
// __attribute__ ((aligned(16)));;
89
90
typedef
F64vec1
fvec
;
91
const
int
fvecLen
= 1;
92
typedef
double
fscal
;
93
94
// #define fvec_true _f32vec1_true
95
// #define fvec_false _f32vec1_false
96
#define _fvecalignment
97
98
#endif
fscal
float fscal
Definition
P4_F32vec4.h:232
fvecLen
const int fvecLen
Definition
P4_F32vec4.h:233
i
int i
Definition
P4_F32vec4.h:22
fvec
F32vec4 fvec
Definition
P4_F32vec4.h:231
_f2
#define _f2(A, B, F)
Definition
PSEUDO_F64vec1.h:34
_f1
#define _f1(A, F)
Definition
PSEUDO_F64vec1.h:38
_op
#define _op(A, B, O)
Definition
PSEUDO_F64vec1.h:42
F64vec1
Definition
PSEUDO_F64vec1.h:16
F64vec1::sgn
friend F64vec1 sgn(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:61
F64vec1::sqrt
friend F64vec1 sqrt(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:57
F64vec1::vec_arithmetic
vec_arithmetic(F64vec1, double)
F64vec1::max
friend double max(double x, double y)
Definition
PSEUDO_F64vec1.h:28
F64vec1::exp
friend F64vec1 exp(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:62
F64vec1::min
friend double min(double x, double y)
Definition
PSEUDO_F64vec1.h:27
F64vec1::operator-
friend F64vec1 operator-(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:49
F64vec1::F64vec1
F64vec1(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:24
F64vec1::sgn
friend double sgn(double x)
Definition
PSEUDO_F64vec1.h:32
F64vec1::operator+
friend F64vec1 operator+(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:48
F64vec1::asgnb
friend F64vec1 asgnb(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:56
F64vec1::F64vec1
F64vec1()
Definition
PSEUDO_F64vec1.h:23
F64vec1::asgnb
friend double asgnb(double x, double y)
Definition
PSEUDO_F64vec1.h:29
F64vec1::max
friend F64vec1 max(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:55
F64vec1::operator[]
double operator[](int i) const
Definition
PSEUDO_F64vec1.h:21
F64vec1::rcp
friend double rcp(double x)
Definition
PSEUDO_F64vec1.h:31
F64vec1::log
friend F64vec1 log(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:63
F64vec1::min
friend F64vec1 min(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:54
F64vec1::rsqrt
friend F64vec1 rsqrt(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:58
F64vec1::fabs
friend F64vec1 fabs(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:60
F64vec1::operator[]
double & operator[](int i)
Definition
PSEUDO_F64vec1.h:20
F64vec1::v
double v[1]
Definition
PSEUDO_F64vec1.h:18
F64vec1::operator/
friend F64vec1 operator/(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:51
F64vec1::operator*
friend F64vec1 operator*(const F64vec1 &a, const F64vec1 &b)
Definition
PSEUDO_F64vec1.h:50
F64vec1::rcp
friend F64vec1 rcp(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:59
F64vec1::rsqrt
friend double rsqrt(double x)
Definition
PSEUDO_F64vec1.h:30
F64vec1::operator>>
friend std::istream & operator>>(std::istream &strm, F64vec1 &a)
Definition
PSEUDO_F64vec1.h:80
F64vec1::sin
friend F64vec1 sin(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:64
F64vec1::F64vec1
F64vec1(const double &a)
Definition
PSEUDO_F64vec1.h:25
F64vec1::operator<<
friend std::ostream & operator<<(std::ostream &strm, const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:74
F64vec1::cos
friend F64vec1 cos(const F64vec1 &a)
Definition
PSEUDO_F64vec1.h:65
vec_arithmetic.h
reconstruction
cat
vectors
PSEUDO_F64vec1.h
Generated on
for BmnRoot by
1.17.0