source: trunk/test/normalization_test.cc @ 1432

Last change on this file since 1432 was 1432, checked in by Peter, 13 years ago

refs #416 moving quantile normalizer to new dir. Also moved the algorithm to a class (rather than free function).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1// $Id: normalization_test.cc 1432 2008-08-25 13:54:18Z peter $
2
3/*
4  Copyright (C) 2008 Peter Johansson
5
6  This file is part of the yat library, http://trac.thep.lu.se/yat
7
8  The yat library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12
13  The yat library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#include "Suite.h"
25
26#include "yat/normalization/QuantileNormalizer.h"
27
28#include "yat/utility/Matrix.h"
29
30using namespace theplu::yat;
31void test_quantile_normalize(test::Suite&);
32
33int main(int argc, char* argv[])
34{ 
35  test::Suite suite(argc, argv);
36  suite.err() << "testing normalizations ... " << std::endl;
37
38  test_quantile_normalize(suite);
39
40  return suite.return_value();
41}
42
43
44void test_quantile_normalize(test::Suite& suite)
45{
46  suite.err() << "Testing quantile normalization\n";
47 
48  utility::Matrix m(2,2);
49  m(0,0) = 0;
50  m(0,1) = 10;
51  m(1,0) = 2;
52  m(1,1) = 4;
53  normalization::QuantileNormalizer qn;
54  qn(m);
55  suite.err() << "Testing m(0,0)\n";
56  suite.add(suite.equal(m(0,0), 2));
57  suite.err() << "Testing m(0,1)\n";
58  suite.add(suite.equal(m(0,1), 6));
59  suite.err() << "Testing m(1,0)\n";
60  suite.add(suite.equal(m(1,0), 6));
61  suite.err() << "Testing m(1,1)\n";
62  suite.add(suite.equal(m(1,1), 2));
63}
64
Note: See TracBrowser for help on using the repository browser.