Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
CLHEP
CLHEP
Commits
04a4c600
Commit
04a4c600
authored
Nov 18, 2008
by
Lynn Garren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test for bug #44156
parent
1630ee64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
5 deletions
+72
-5
ChangeLog
ChangeLog
+11
-0
Random/ChangeLog
Random/ChangeLog
+8
-3
Random/test/testVectorSave.cc
Random/test/testVectorSave.cc
+53
-2
No files found.
ChangeLog
View file @
04a4c600
2008-11-18 Lynn Garren <garren@fnal.gov>
* Random/test/testVectorSave.cc: Add a test for bug #44156
2008-11-13 Mark Fischler <mf@fnal.gov>
* Random/src/engineIDulong.cc: Fix problem that caused check for proper
engine type to fail where an unsigned long is 64bits. (bug #44156)
* Random/src/*Engine.cc: make sure that existing stored engine states
don't break due to the change in engineIDulong.cc
==============================
04.11.08 Release CLHEP-2.0.4.1
==============================
...
...
Random/ChangeLog
View file @
04a4c600
2008-11-18 Lynn Garren <garren@fnal.gov>
* test/testVectorSave.cc: Add a test for bug #44156
2008-11-13 Mark Fischler <mf@fnal.gov>
* src/engineIDulong.cc: fix a problem for 64bit machines
* src/*Engine.cc: protection against the 64bit problem for states
that may have been previously saved
* src/engineIDulong.cc: Fix problem that caused check for proper
engine type to fail where an unsigned long is 64bits. (bug #44156)
* src/*Engine.cc: make sure that existing stored engine states
don't break due to the change in engineIDulong.cc
==============================
04.11.08 Release CLHEP-2.0.4.1
...
...
Random/test/testVectorSave.cc
View file @
04a4c600
// -*- C++ -*-
// $Id: testVectorSave.cc,v 1.1.4.1
2005/04/15 16:32
:5
3
garren Exp $
// $Id: testVectorSave.cc,v 1.1.4.1
.2.1 2008/11/18 22:09
:5
1
garren Exp $
// ----------------------------------------------------------------------
#include "CLHEP/Random/Randomize.h"
#include "CLHEP/Random/NonRandomEngine.h"
...
...
@@ -50,6 +50,55 @@ std::vector<double> aSequence(int n) {
// ----------- Vector restore of engines -----------
// test the problem reported in bug #44156
// Note that this test always works on a 32bit machine
template
<
class
E
>
int
vectorTest64
(
int
n
)
{
output
<<
"Vector restore 64bit test for "
<<
E
::
engineName
()
<<
"
\n
"
;
E
e
;
double
x
=
0
;
for
(
int
i
=
0
;
i
<
n
;
i
++
)
x
+=
e
.
flat
();
std
::
vector
<
unsigned
long
>
v
=
e
.
put
();
x
=
e
.
flat
();
output
<<
"x = "
<<
x
<<
std
::
endl
;
E
f
;
v
[
0
]
&=
0xffffffffUL
;
f
.
get
(
v
);
double
y
=
f
.
flat
();
output
<<
"y = "
<<
y
<<
std
::
endl
;
if
(
x
!=
y
)
return
n
;
return
0
;
}
// special case for NonRandomEngine
template
<
>
int
vectorTest64
<
NonRandomEngine
>
(
int
n
)
{
output
<<
"Vector restore 64bit test for "
<<
NonRandomEngine
::
engineName
()
<<
"
\n
"
;
std
::
vector
<
double
>
nonRand
=
aSequence
(
500
);
NonRandomEngine
e
;
e
.
setRandomSequence
(
&
nonRand
[
0
],
nonRand
.
size
());
double
x
=
0
;
for
(
int
i
=
0
;
i
<
n
;
i
++
)
x
+=
e
.
flat
();
std
::
vector
<
unsigned
long
>
v
=
e
.
put
();
x
=
e
.
flat
();
output
<<
"x = "
<<
x
<<
std
::
endl
;
NonRandomEngine
f
;
f
.
setRandomSequence
(
&
nonRand
[
0
],
nonRand
.
size
());
v
[
0
]
&=
0xffffffffUL
;
f
.
get
(
v
);
double
y
=
f
.
flat
();
output
<<
"y = "
<<
y
<<
std
::
endl
;
if
(
x
!=
y
)
return
n
;
return
0
;
}
template
<
class
E
>
std
::
vector
<
unsigned
long
>
vectorRestore1
(
int
n
,
std
::
vector
<
double
>
&
v
)
{
output
<<
"Vector restore for "
<<
E
::
engineName
()
<<
"
\n
"
;
...
...
@@ -141,8 +190,10 @@ int vectorRestore2(const std::vector<unsigned long> state,
template
<
class
E
>
int
vectorRestore
(
int
n
)
{
std
::
vector
<
double
>
v
;
int
status1
=
vectorTest64
<
E
>
(
n
);
std
::
vector
<
unsigned
long
>
state
=
vectorRestore1
<
E
>
(
n
,
v
);
return
vectorRestore2
<
E
>
(
state
,
v
);
int
status2
=
vectorRestore2
<
E
>
(
state
,
v
);
return
(
status1
|
status2
);
}
...
...
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