2008-02-26 14:55:23 +01:00
|
|
|
/*
|
|
|
|
LA: linear algebra C++ interface library
|
|
|
|
Copyright (C) 2008 Jiri Pittner <jiri.pittner@jh-inst.cas.cz> or <jiri@pittnerovi.com>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2006-04-01 06:48:01 +02:00
|
|
|
#include "bitvector.h"
|
2006-04-01 16:56:35 +02:00
|
|
|
#include "qsort.h"
|
2006-04-06 23:45:51 +02:00
|
|
|
#include "la.h"
|
|
|
|
#include "fourindex.h"
|
2006-04-09 23:07:54 +02:00
|
|
|
#include "laerror.h"
|
2006-07-29 21:46:41 +02:00
|
|
|
#ifdef USE_TRSACEBACK
|
2006-04-09 23:07:54 +02:00
|
|
|
#include "traceback.h"
|
2006-07-29 21:46:41 +02:00
|
|
|
#endif
|
2006-04-01 16:56:35 +02:00
|
|
|
|
2009-11-12 22:01:19 +01:00
|
|
|
using namespace std;
|
2009-11-13 15:33:33 +01:00
|
|
|
using namespace LA;
|
2009-11-12 22:01:19 +01:00
|
|
|
|
2006-04-09 23:07:54 +02:00
|
|
|
void test2(char *msg)
|
|
|
|
{
|
|
|
|
laerror(msg);
|
|
|
|
}
|
2005-02-01 00:08:03 +01:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2006-07-29 21:46:41 +02:00
|
|
|
#ifdef USE_TRSACEBACK
|
2006-04-09 23:07:54 +02:00
|
|
|
sigtraceback(SIGSEGV,1);
|
|
|
|
sigtraceback(SIGABRT,1);
|
|
|
|
sigtraceback(SIGBUS,1);
|
|
|
|
sigtraceback(SIGFPE,1);
|
2006-07-29 21:46:41 +02:00
|
|
|
#endif
|
2006-04-09 23:07:54 +02:00
|
|
|
|
2006-04-01 06:48:01 +02:00
|
|
|
bitvector v(100);
|
|
|
|
v.fill();
|
|
|
|
bitvector x(50); x=v;
|
|
|
|
v.copyonwrite();
|
|
|
|
for(unsigned int i=0; i<100; i+=2) v.reset(i);
|
|
|
|
x.fill();
|
|
|
|
x= ~x;
|
|
|
|
for(unsigned int i=0; i<100; ++i) x.assign(i,i&1);
|
|
|
|
cout <<v<< endl;
|
|
|
|
cout <<x<< endl;
|
|
|
|
cout <<"TEST "<<(x==v)<< " "<<x.population()<<endl;
|
|
|
|
|
|
|
|
v.clear(); x.clear();
|
|
|
|
v.set(31); x.set(32);
|
|
|
|
cout <<" TEST < "<< (x<v)<<endl;
|
|
|
|
|
|
|
|
NRVec<int> t(10);
|
|
|
|
for(int i=0; i<10; ++i) t[i]=i;
|
|
|
|
cout <<t;
|
|
|
|
t.sort(1);
|
|
|
|
cout <<t;
|
2006-04-01 16:56:35 +02:00
|
|
|
NRVec<int> u(10);
|
|
|
|
for(int i=0; i<10;++i) u[i]=i;
|
|
|
|
ptrqsortup(&t[0],&t[9],&u[0]);
|
|
|
|
cout<<t <<"U= "<<u;
|
|
|
|
ptrqsortdown<int,int>(&t[0],&t[9]);
|
2006-04-01 06:48:01 +02:00
|
|
|
cout<<t;
|
2006-04-06 23:45:51 +02:00
|
|
|
|
|
|
|
NRSMat_from1<double> a(5),b(5),c;
|
|
|
|
c=a+b;
|
|
|
|
|
2006-04-09 23:07:54 +02:00
|
|
|
test2("pokus");
|
|
|
|
|
2006-04-06 23:45:51 +02:00
|
|
|
fourindex<int,double> f;
|
|
|
|
fourindex_dense<twoelectronrealmullikan,double,int> ff(f);
|
2005-02-01 00:08:03 +01:00
|
|
|
}
|