Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixMath
Commits
7dcb0d5f
Commit
7dcb0d5f
authored
Jan 05, 2021
by
Pierre Aubert
Browse files
Add udpate histogram
parent
4791f036
Pipeline
#98257
passed with stages
in 1 minute and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
src/PHistogram/PHistogram.h
src/PHistogram/PHistogram.h
+1
-0
src/PHistogram/update_histogram.h
src/PHistogram/update_histogram.h
+54
-0
No files found.
src/PHistogram/PHistogram.h
View file @
7dcb0d5f
...
...
@@ -85,6 +85,7 @@ class PHistogram{
size_t
p_overXMax
;
};
#include "PHistogram_impl.h"
#endif
...
...
src/PHistogram/update_histogram.h
0 → 100644
View file @
7dcb0d5f
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#ifndef __UPDATE_HISTOGRAM_H__
#define __UPDATE_HISTOGRAM_H__
#include <iostream>
///Update the 2d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
* @param yValue : value to be put in the histogram on y axis
* @param amplitude : aplitude to be added to the proper histogram bin, if (xValue, yValue) is in the histogram
* @param xMin : minimum value of x
* @param xRange : range of x
* @param yMin : minimum value of y
* @param yRange : range of y
* @param nbX : number of value on x axis
* @param nbY : number of value on y axis
*/
template
<
typename
T
>
void
update_histogram2dRange
(
T
*
histValue
,
T
xValue
,
T
yValue
,
T
amplitude
,
T
xMin
,
T
xRange
,
T
yMin
,
T
yRange
,
size_t
nbX
,
size_t
nbY
){
size_t
posX
(((
xValue
-
xMin
)
*
((
T
)
nbX
))
/
xRange
);
size_t
posY
(((
yValue
-
yMin
)
*
((
T
)
nbY
))
/
yRange
);
if
(
posX
>=
nbX
||
posY
>=
nbY
){
return
;
}
histValue
[
posX
*
nbY
+
posY
]
+=
amplitude
;
}
///Update the 2d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
* @param yValue : value to be put in the histogram on y axis
* @param amplitude : aplitude to be added to the proper histogram bin, if (xValue, yValue) is in the histogram
* @param xMin : minimum value of x
* @param xMax : maximum value of x
* @param yMin : minimum value of y
* @param yMax : maximum value of y
* @param nbX : number of value on x axis
* @param nbY : number of value on y axis
*/
template
<
typename
T
>
void
update_histogram2d
(
T
*
histValue
,
T
xValue
,
T
yValue
,
T
amplitude
,
T
xMin
,
T
xMax
,
T
yMin
,
T
yMax
,
size_t
nbX
,
size_t
nbY
){
update_histogram2dRange
(
histValue
,
xValue
,
yValue
,
amplitude
,
xMin
,
xMax
-
xMin
,
yMin
,
yMax
-
yMin
,
nbX
,
nbY
);
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment