Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19244886
test_rescanArray_cmh.cc
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
test_rescanArray_cmh.cc
View Options
#include
"UnitTest++.h"
#include
"test_utils.hh"
#include
"npstat/nm/rescanArray.hh"
using
namespace
npstat
;
using
namespace
std
;
namespace
{
TEST
(
rescanArray
)
{
ArrayShape
shape
(
3
);
shape
.
at
(
0
)
=
3
;
shape
.
at
(
1
)
=
4
;
shape
.
at
(
2
)
=
5
;
const
unsigned
dim
=
shape
.
size
();
ArrayND
<
float
>
a
(
shape
);
const
unsigned
len
=
a
.
length
();
for
(
unsigned
i
=
0
;
i
<
len
;
++
i
)
a
.
linearValue
(
i
)
=
test_rng
();
std
::
vector
<
unsigned
>
idxbuf
(
shape
);
unsigned
*
index
=
&
idxbuf
[
0
];
for
(
unsigned
factor
=
2
;
factor
<
10
;
++
factor
)
{
ArrayShape
fshape
(
shape
);
for
(
unsigned
i
=
0
;
i
<
dim
;
++
i
)
fshape
[
i
]
*=
factor
;
ArrayND
<
double
>
b
(
fshape
);
rescanArray
(
a
,
&
b
);
const
unsigned
long
blen
=
b
.
length
();
for
(
unsigned
long
ib
=
0
;
ib
<
blen
;
++
ib
)
{
b
.
convertLinearIndex
(
ib
,
index
,
dim
);
for
(
unsigned
i
=
0
;
i
<
dim
;
++
i
)
index
[
i
]
/=
factor
;
CHECK_EQUAL
(
static_cast
<
double
>
(
a
.
value
(
index
,
dim
)),
b
.
linearValue
(
ib
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Sep 30, 4:46 AM (9 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6548848
Default Alt Text
test_rescanArray_cmh.cc (1 KB)
Attached To
Mode
rNPSTATSVN npstatsvn
Attached
Detach File
Event Timeline
Log In to Comment