Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19244829
test_ResponseMatrix.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_ResponseMatrix.cc
View Options
#include
"UnitTest++.h"
#include
"test_utils.hh"
#include
"npstat/stat/ResponseMatrix.hh"
using
namespace
npstat
;
using
namespace
std
;
namespace
{
TEST
(
ResponseMatrix
)
{
double
a
[
3
][
4
]
=
{{
0
,
2
,
3
,
4
},
{
5
,
6
,
0
,
8
},
{
9
,
0
,
11
,
12
}};
Matrix
<
double
>
ma
(
3
,
4
,
&
a
[
0
][
0
]);
ResponseMatrix
r
(
makeShape
(
4
),
makeShape
(
3
),
ma
);
CHECK
(
r
.
isValid
());
CHECK
(
ma
==
r
.
denseMatrix
());
ArrayND
<
double
>
arr
(
4
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
arr
(
i
)
=
i
*
2
+
1
;
double
buf
[
4
];
ma
.
timesVector
(
arr
.
data
(),
arr
.
length
(),
buf
,
3
);
ArrayND
<
double
>
res
;
r
.
timesVector
(
arr
,
&
res
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
CHECK_EQUAL
(
buf
[
i
],
res
(
i
));
const
ResponseMatrix
&
rt
=
r
.
T
();
const
ResponseMatrix
&
rtt
=
rt
.
T
();
rtt
.
shrinkToFit
();
CHECK
(
rtt
==
r
);
CHECK
(
rt
.
denseMatrix
()
==
ma
.
T
());
ArrayND
<
double
>
arr2
(
3
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
arr2
(
i
)
=
i
*
3
+
11
;
ma
.
rowMultiply
(
arr2
.
data
(),
arr2
.
length
(),
buf
,
4
);
r
.
rowMultiply
(
arr2
,
&
res
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
CHECK_EQUAL
(
buf
[
i
],
res
(
i
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Sep 30, 4:45 AM (13 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6564511
Default Alt Text
test_ResponseMatrix.cc (1 KB)
Attached To
Mode
rNPSTATSVN npstatsvn
Attached
Detach File
Event Timeline
Log In to Comment