Compute Library
 21.05
Measurement::Value Struct Reference

Measurement value. More...

#include <Measurement.h>

Public Member Functions

 Value (bool is_floating)
 Constructor. More...
 
std::string to_string () const
 Convert the value stored to string. More...
 
Value operator+ (Value b) const
 Add with another value and return the sum. More...
 
Value operator- (Value b) const
 Subtract with another value and return the result. More...
 
Value operator * (Value b) const
 Multiple with another value and return the result. More...
 
Value operator/ (int b) const
 Return the stored value divided by an integer. More...
 
Valueoperator-= (const Value &b)
 Subtract another value and return the updated stored value. More...
 
bool operator< (const Value &b) const
 Compare the stored value with another value. More...
 

Static Public Member Functions

static double relative_standard_deviation (const Value &variance, const Value &mean)
 Get the relative standard deviation to a given distribution as a percentage. More...
 

Data Fields

union {
   double   floating_point
 
   long long int   integer
 
v
 Stored value. More...
 
bool is_floating_point
 Is the stored value floating point or integer ? More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Value &value)
 Add the value stored to the stream as a string. More...
 

Detailed Description

Measurement value.

Definition at line 44 of file Measurement.h.

Constructor & Destructor Documentation

◆ Value()

Value ( bool  is_floating)
inline

Constructor.

Parameters
[in]is_floatingWill the value stored be floating point ?

Definition at line 50 of file Measurement.h.

51  : v{ 0 }, is_floating_point(is_floating)
52  {
53  }
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

Member Function Documentation

◆ operator *()

Value operator * ( Value  b) const
inline

Multiple with another value and return the result.

Parameters
[in]bOther value
Returns
Result of the stored value * b

Definition at line 121 of file Measurement.h.

122  {
124  {
125  b.v.floating_point *= v.floating_point;
126  }
127  else
128  {
129  b.v.integer *= v.integer;
130  }
131  return b;
132  }
SimpleTensor< float > b
Definition: DFT.cpp:157
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

References arm_compute::test::validation::b, Measurement::Value::is_floating_point, and Measurement::Value::v.

◆ operator+()

Value operator+ ( Value  b) const
inline

Add with another value and return the sum.

Parameters
[in]bOther value
Returns
Sum of the stored value + b

Definition at line 83 of file Measurement.h.

84  {
86  {
87  b.v.floating_point += v.floating_point;
88  }
89  else
90  {
91  b.v.integer += v.integer;
92  }
93  return b;
94  }
SimpleTensor< float > b
Definition: DFT.cpp:157
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

References arm_compute::test::validation::b, Measurement::Value::is_floating_point, and Measurement::Value::v.

◆ operator-()

Value operator- ( Value  b) const
inline

Subtract with another value and return the result.

Parameters
[in]bOther value
Returns
Result of the stored value - b

Definition at line 102 of file Measurement.h.

103  {
105  {
106  b.v.floating_point -= v.floating_point;
107  }
108  else
109  {
110  b.v.integer -= v.integer;
111  }
112  return b;
113  }
SimpleTensor< float > b
Definition: DFT.cpp:157
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

References arm_compute::test::validation::b, Measurement::Value::is_floating_point, and Measurement::Value::v.

◆ operator-=()

Value& operator-= ( const Value b)
inline

Subtract another value and return the updated stored value.

Parameters
[in]bOther value
Returns
The updated stored value

Definition at line 160 of file Measurement.h.

161  {
163  {
164  v.floating_point -= b.v.floating_point;
165  }
166  else
167  {
168  v.integer -= b.v.integer;
169  }
170  return *this;
171  }
SimpleTensor< float > b
Definition: DFT.cpp:157
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

References arm_compute::test::validation::b, Measurement::Value::is_floating_point, and Measurement::Value::v.

◆ operator/()

Value operator/ ( int  b) const
inline

Return the stored value divided by an integer.

Parameters
[in]bInteger to divide the value by.
Returns
Stored value / b

Definition at line 140 of file Measurement.h.

141  {
144  {
145  res.v.floating_point = v.floating_point / b;
146  }
147  else
148  {
149  res.v.integer = v.integer / b;
150  }
151  return res;
152  }
SimpleTensor< float > b
Definition: DFT.cpp:157
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

References arm_compute::test::validation::b, Measurement::Value::floating_point, Measurement::Value::integer, Measurement::Value::is_floating_point, and Measurement::Value::v.

◆ operator<()

bool operator< ( const Value b) const
inline

Compare the stored value with another value.

Parameters
[in]bValue to compare against
Returns
The result of stored value < b

Definition at line 179 of file Measurement.h.

180  {
182  {
183  return v.floating_point < b.v.floating_point;
184  }
185  else
186  {
187  return v.integer < b.v.integer;
188  }
189  }
SimpleTensor< float > b
Definition: DFT.cpp:157
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216

References arm_compute::test::validation::b, Measurement::Value::is_floating_point, and Measurement::Value::v.

◆ relative_standard_deviation()

static double relative_standard_deviation ( const Value variance,
const Value mean 
)
inlinestatic

Get the relative standard deviation to a given distribution as a percentage.

Parameters
[in]varianceThe variance of the distribution.
[in]meanThe mean of the distribution.
Returns
the relative standard deviation.

Definition at line 198 of file Measurement.h.

199  {
200  if(variance.is_floating_point)
201  {
202  return 100.0 * sqrt(variance.v.floating_point) / mean.v.floating_point;
203  }
204  else
205  {
206  return 100.0 * sqrt(static_cast<double>(variance.v.integer)) / mean.v.integer;
207  }
208  }

References Measurement::Value::floating_point, Measurement::Value::integer, Measurement::Value::is_floating_point, and Measurement::Value::v.

Referenced by InstrumentsStats::InstrumentsStats().

◆ to_string()

std::string to_string ( ) const
inline

Convert the value stored to string.

Definition at line 71 of file Measurement.h.

72  {
73  std::stringstream ss;
74  ss << *this;
75  return ss.str();
76  }
std::stringstream ss(mlgo_str)

References arm_compute::test::validation::ss().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Value value 
)
friend

Add the value stored to the stream as a string.

Definition at line 57 of file Measurement.h.

58  {
60  {
62  }
63  else
64  {
66  }
67  return os;
68  }
union arm_compute::test::framework::Measurement::Value::@5 v
Stored value.
bool is_floating_point
Is the stored value floating point or integer ?
Definition: Measurement.h:216
const Value & value() const
Accessor for the stored value.
Definition: Measurement.h:301
std::string arithmetic_to_string(T val, int decimal_places=0)
Create a string with the arithmetic value in full precision.
Definition: Utils.h:164

Field Documentation

◆ floating_point

double floating_point

◆ integer

long long int integer

◆ is_floating_point

◆ v


The documentation for this struct was generated from the following file: