Last change
on this file since 511 was
511,
checked in by Peter, 17 years ago
|
added percentile function for gslapi::vector
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
471 bytes
|
Rev | Line | |
---|
[116] | 1 | // $Id: statistics_test.cc 511 2006-02-18 14:46:46Z peter $ |
---|
| 2 | |
---|
[301] | 3 | #include <c++_tools/statistics/utility.h> |
---|
[511] | 4 | #include <c++_tools/gslapi/vector.h> |
---|
[116] | 5 | |
---|
| 6 | #include <vector> |
---|
| 7 | #include <cstdlib> |
---|
| 8 | #include <iostream> |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | int main() |
---|
| 12 | { |
---|
[511] | 13 | using namespace theplu; |
---|
| 14 | gslapi::vector gsl_vec(10); |
---|
[116] | 15 | std::vector<double> data; |
---|
[511] | 16 | for (unsigned int i=0; i<10; i++){ |
---|
[116] | 17 | data.push_back(static_cast<double>(i)); |
---|
[511] | 18 | gsl_vec(i)=i; |
---|
| 19 | } |
---|
| 20 | double m=statistics::median(data); |
---|
| 21 | double m_gsl=statistics::median(gsl_vec); |
---|
| 22 | if (m!=4.5 || m!=m_gsl) |
---|
[116] | 23 | return -1; |
---|
| 24 | return 0; |
---|
| 25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.