|
ATLAS Offline Software
|
Go to the documentation of this file.
9 #ifndef EVENTPRIMITIVES_EVENTPRIMITIVESHELPERS_H
10 #define EVENTPRIMITIVES_EVENTPRIMITIVESHELPERS_H
29 for (
int i = 0;
i <
N; ++
i) {
30 if (std::isnan(
vec[
i]) || std::isinf(
vec[
i]))
33 constexpr
double max_length2 = 1.e16;
34 return vec.dot(
vec) < max_length2;
52 return (
n * (
n + 1)) / 2;
57 std::vector<float>&
vec) {
59 for (
unsigned int i = 0;
i <
N; ++
i)
60 for (
unsigned int j = 0; j <=
i; ++j)
67 for (
int i = 0;
i <
rows; ++
i) {
68 for (
int j = 0; j <=
i; ++j) {
75 inline void expand(std::vector<float>::const_iterator
it,
76 std::vector<float>::const_iterator,
78 for (
unsigned int i = 0;
i <
N; ++
i) {
79 for (
unsigned int j = 0; j <=
i; ++j) {
86 inline void expand(std::vector<float>::const_iterator
it,
87 std::vector<float>::const_iterator it_end,
91 for (
n = 1; dist >
n; ++
n) {
95 for (
unsigned int i = 0;
i <
n; ++
i) {
96 for (
unsigned int j = 0; j <=
i; ++j) {
111 bool relative =
false) {
112 for (
int i = 0;
i <
N; ++
i) {
113 for (
int j = 0; j <
N; ++j) {
115 if (0.5 * std::abs(
m1(
i, j) -
m2(
i, j)) / (
m1(
i, j) +
m2(
i, j)) >
117 return std::make_pair(
i, j);
120 if (std::abs(
m1(
i, j) -
m2(
i, j)) > precision) {
121 return std::make_pair(
i, j);
126 return std::make_pair(-1, -1);
136 double precision = 1
e-9,
bool relative =
false) {
137 for (
int i = 0;
i <
N; ++
i) {
139 if (0.5 * std::abs(
m1(
i) -
m2(
i)) / (
m1(
i) +
m2(
i)) > precision)
142 if (std::abs(
m1(
i) -
m2(
i)) > precision)
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
constexpr int CalculateCompressedSize(int n)
bool saneVector(const AmgVector(N) &vec)
std::vector< size_t > vec
#define AmgSymMatrix(dim)
void expand(std::vector< float >::const_iterator it, std::vector< float >::const_iterator, AmgSymMatrix(N) &covMatrix)
Definition of ATLAS Math & Geometry primitives (Amg)
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space