Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
advLigoRTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
CDS
software
advLigoRTS
Commits
79bcc8f5
Commit
79bcc8f5
authored
2 years ago
by
Ezekiel Dohmen
Browse files
Options
Downloads
Patches
Plain Diff
Adding perl logic for GaussianNoiseGenerator
parent
a573a51d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!439
RCG 5.0 release fro deb 10
,
!366
Merge with branch 4.2
,
!365
Merge branch 'branch-4.2' into master-branch-4.2-merge
,
!354
Adding gaussian noise part
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/epics/util/lib/GaussianNoiseGenerator.pm
+9
-9
9 additions, 9 deletions
src/epics/util/lib/GaussianNoiseGenerator.pm
src/include/util/random_bytes.h
+33
-0
33 additions, 0 deletions
src/include/util/random_bytes.h
with
42 additions
and
9 deletions
src/epics/util/lib/GaussianNoise.pm
→
src/epics/util/lib/GaussianNoise
Generator
.pm
+
9
−
9
View file @
79bcc8f5
package
CDS::
GaussianNoise
;
package
CDS::
GaussianNoise
Generator
;
use
Exporter
;
@ISA
=
('
Exporter
');
#// \page GaussianNoise Noise.pm
#// Documentation for GaussianNoise.pm
#// This GaussianNoise part generates gaussian
random noise around
#//
the given mean with the given
standard deviation.
#// \page GaussianNoise
Generator
Noise.pm
#// Documentation for GaussianNoise
Generator
.pm
#// This GaussianNoise
Generator
part generates gaussian
#//
random noise with 0 mean and 1
standard deviation.
#//
#//
#//
...
...
@@ -17,7 +17,7 @@ $init_code_printed = 0;
1
;
sub
partType
{
return
GaussianNoise
;
return
GaussianNoise
Generator
;
}
# Print Epics communication structure into a header file
...
...
@@ -46,7 +46,7 @@ static inline double gaussianRandomDouble( void )
{
uint64_t
gaussRandomUint
;
ligo_get_random_bytes
(
&gaussRandomUint
,
sizeof
(
gaussRandomUint
));
return
qnorm5
(
((
double
)
gaussRandomUint
/0xFFFFFFFFFFFFFFFF),
0 /
*mean
*
/, 1/
*standard
deviation
*/
,
1
,
0
);
return
qnorm5
_s
(
((
double
)
gaussRandomUint
/
0xFFFFFFFFFFFFFFFF
),
1
,
0
);
}
END
...
...
@@ -87,6 +87,6 @@ sub frontEndInitCode {
# Returns calculated code string
sub
frontEndCode
{
my
(
$i
)
=
@_
;
my
$calcExp
=
"
// GaussiaNoise
\n
";
$calcExp
.=
"
\L
$::xpartName[
$i
] = gaussianRandomDouble(
"
.
.
"
,
"
.
.
"
);
\n
";
my
$calcExp
=
"
// GaussiaNoise
Generator
\n
";
$calcExp
.=
"
\L
$::xpartName[
$i
]
"
.
"
= gaussianRandomDouble();
\n
";
}
This diff is collapsed.
Click to expand it.
src/include/util/random_bytes.h
0 → 100644
+
33
−
0
View file @
79bcc8f5
#ifndef LIGO_RAMDOM_BYTES_H
#define LIGO_RAMDOM_BYTES_H
#ifdef __KERNEL__
#include
<linux/random.h>
#define ligo_get_random_bytes get_random_bytes
static
inline
void
ligo_get_random_bytes
(
void
*
buf
,
int
nbytes
)
{
return
get_random_bytes
(
buf
,
nbytes
);
}
#else
#include
<sys/random.h>
static
inline
void
ligo_get_random_bytes
(
void
*
buf
,
int
nbytes
)
{
getrandom
(
buf
,
nbytes
,
GRND_NONBLOCK
);
//This can fail if the urandom source has not yet been initialized
return
;
}
#endif
#endif //LIGO_RAMDOM_BYTES_H
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