Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CLASS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BaM
CLASS
Commits
42a123e1
Commit
42a123e1
authored
8 years ago
by
Josselin Massot
Committed by
BaM
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove useless classes
parent
31df69d0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/external/Stat.cpp
+0
-81
0 additions, 81 deletions
source/external/Stat.cpp
source/external/Stat.hxx
+0
-65
0 additions, 65 deletions
source/external/Stat.hxx
with
0 additions
and
146 deletions
source/external/Stat.cpp
deleted
100644 → 0
+
0
−
81
View file @
31df69d0
//////////////////////////////////////////////////////////////////////////////
///// CLASS Stat<T> //////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
///// CONSTRUCTOR ////////////////////////////////////////////////////////////
template
<
typename
T
>
Stat
<
T
>::
Stat
()
:
fn
(
0
)
,
fmin
(
0
)
,
fmax
(
0
)
,
fsum
(
0
)
,
fsum2
(
0
)
{
;
}
//____________________________________________________________________________
template
<
typename
T
>
Stat
<
T
>::
Stat
(
const
Stat
<
T
>
&
a
)
:
fn
(
a
.
fn
)
,
min
(
a
.
fmin
)
,
fmax
(
a
.
fmax
)
,
fsum
(
a
.
fsum
)
,
fsum2
(
a
.
fsum2
)
{
;
}
//____________________________________________________________________________
template
<
typename
T
>
template
<
typename
ITR
>
Stat
<
T
>::
Stat
(
const
ITR
first
,
const
ITR
last
)
:
fn
(
0
)
,
fmin
(
*
first
)
,
fmax
(
*
first
)
,
fsum
(
0
)
,
fsum2
(
0
)
{
for
(
ITR
it
=
first
;
it
!=
last
;
++
it
)
// do all in one loop
{
if
(
*
it
>
fmax
)
{
fmax
=
*
it
;
}
if
(
*
it
<
fmin
)
{
fmin
=
*
it
;
}
fsum
+=
*
it
;
fsum2
+=
(
*
it
)
*
(
*
it
);
++
fn
;
}
}
///// DESTRUCTOR /////////////////////////////////////////////////////////////
template
<
typename
T
>
Stat
<
T
>::~
Stat
()
{
;
}
///// OPERATOR ///////////////////////////////////////////////////////////////
template
<
typename
T
>
Stat
<
T
>
&
Stat
<
T
>::
operator
=
(
const
Stat
<
T
>
&
a
)
{
if
(
this
!=
&
a
)
{
fn
=
a
.
fn
;
fmin
=
a
.
fmin
;
fmax
=
a
.
fmax
;
fsum
=
a
.
fsum
;
fsum2
=
a
.
fsum2
;
}
return
*
this
;
}
//____________________________________________________________________________
template
<
typename
T
>
Stat
<
T
>
&
Stat
<
T
>::
operator
+=
(
const
T
t
)
{
this
->
add
(
t
);
}
///// GETTER /////////////////////////////////////////////////////////////////
template
<
typename
T
>
std
::
size_t
Stat
<
T
>::
n
()
const
{
return
fn
;
}
//____________________________________________________________________________
template
<
typename
T
>
T
Stat
<
T
>::
min
()
const
{
return
fmin
;
}
//____________________________________________________________________________
template
<
typename
T
>
T
Stat
<
T
>::
max
()
const
{
return
fmax
;
}
//____________________________________________________________________________
template
<
typename
T
>
T
Stat
<
T
>::
amp
()
const
{
return
fmax
-
fmin
;
}
//____________________________________________________________________________
template
<
typename
T
>
T
Stat
<
T
>::
avg
()
const
{
return
fsum
/
fn
;
}
//____________________________________________________________________________
template
<
typename
T
>
T
Stat
<
T
>::
rms
()
const
{
return
std
::
sqrt
(
(
fsum
*
fsum
)
/
fn
-
fsum2
/
fn
);
}
///// SETTER /////////////////////////////////////////////////////////////////
template
<
typename
T
>
void
Stat
<
T
>::
add
(
T
val
)
{
fn
+=
1
;
fmin
=
std
::
min
(
fmin
,
val
);
fsum
+=
val
;
fmax
=
std
::
max
(
fmax
,
val
);
fsum2
+=
val
*
val
;
}
This diff is collapsed.
Click to expand it.
source/external/Stat.hxx
deleted
100644 → 0
+
0
−
65
View file @
31df69d0
#ifndef CLASS_stat_h
#define CLASS_stat_h
#include
<iostream>
#include
<cmath>
/*!
\class Stat<T>
\brief Class to compute stat on container or on value which arrived progressively
#
La classe permet d'effectuer des statistiques sur un échantillion lors de la
construction ou en ajoutant au fur et à mesure des données.
Cette deuxième possibilité limite les valeurs statistiques calculables :
* Le minimum : $\min_{i} x_i$
* Le maximum : $\max_{i} x_i$
* L'amplitude : $\max_{i}x_i - \min_{i}x_i$
* La moyenne : $\bar{x} = \frac{1}{n}\sum_i x_i$
* L'écart-type (RMS) : $\sigma = \sqrt{ \frac{1}{n} \sum_{i}(x_i - \bar{x})^2 } = \sqrt{ \frac{1}{n}\sum_{i} x_i^2 - \bar{x}^2 }$
Petite précision, RMS signifie *Root Mean Square* ou moyenne quadratique en français. Celle-ci est identique à l'écart-type si la moyenne est nulle puisque la moyenne quadratique se calcule comme suit : $rms = \sqrt{\frac{1}{n}\sum_{i} x_i^2}$
!*/
template
<
typename
T
>
class
Stat
{
public:
// CONSTRUCTOR
Stat
();
Stat
(
const
Stat
<
T
>
&
);
template
<
typename
ITR
>
Stat
(
const
ITR
,
const
ITR
);
// DESTRUCTOR
~
Stat
();
// OPERATOR
Stat
<
T
>
&
operator
=
(
const
Stat
<
T
>
&
);
Stat
<
T
>
&
operator
+=
(
const
T
);
// GETTER
inline
std
::
size_t
n
()
const
;
inline
T
min
()
const
;
inline
T
max
()
const
;
inline
T
amp
()
const
;
inline
T
avg
()
const
;
inline
T
rms
()
const
;
// SETTER
inline
void
add
(
const
T
);
private:
// ATTRIBUTS
std
::
size_t
fn
;
// number of elements
T
fmin
;
// minimum
T
fmax
;
// maximum
T
fsum
;
// sum of all
T
fsum2
;
// sum of square
};
#include
"stat.cpp"
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment