basix_doc 0.1
|
/****************************************************************************** * MODULE : vector_test.cc * DESCRIPTION: Test vectors * COPYRIGHT : (C) 2004 Joris van der Hoeven ******************************************************************************* * This software falls under the GNU general public license and comes WITHOUT * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details. * If you don't have this file, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ******************************************************************************/ #include <basix/vector.hpp> #include <basix/int.hpp> #include <basix/double.hpp> using namespace mmx; #define C double #define Vector vector<C> int main () { Vector u= seq (C (5), C (7), C (9)); Vector v (1, 10); Vector w= vec (C (2), C (3), C (5)); mmout << "u\t= " << u << "\n"; mmout << "v\t= " << v << "\n"; mmout << "w\t= " << w << "\n"; vector<C,vector_fixed<vector_naive,fixed_value<nat,10> > > x(3); vector<C,vector_fixed<vector_naive,fixed_value<nat,10> > > y(7); x[3]= 5; y[8]= 3; mmout << "x\t= " << x << "\n"; mmout << "y\t= " << y << "\n"; mmout << "copy(x)\t= " << copy (x) << "\n"; mmout << "-x\t= " << -x << "\n"; mmout << "x+x\t= " << x+x << "\n"; mmout << "x-x\t= " << x-x << "\n"; mmout << "x*x\t= " << x*x << "\n"; mmout << "2*x\t= " << 2*x << "\n"; mmout << "x*2\t= " << x*2 << "\n"; //mmout << "x/3\t= " << x/3 << "\n"; mmout << "x+=y\t= " << (x+=y) << "\n"; mmout << "x-=y\t= " << (x-=y) << "\n"; mmout << "x*=y\t= " << (x*=y) << "\n"; mmout << "x/=y\t= " << (x/=y) << "\n"; mmout << "x*=11\t= " << (x*=C(11)) << "\n"; mmout << "x/=11\t= " << (x/=C(11)) << "\n"; mmout << "x=y\t= " << (x==y) << "\n"; mmout << "x!=y\t= " << (x!=y) << "\n"; mmout << "x<y\t= " << (x<y) << "\n"; mmout << "x<=y\t= " << (x<=y) << "\n"; mmout << "x>y\t= " << (x>y) << "\n"; mmout << "x>=y\t= " << (x>=y) << "\n"; mmout << "sum(x)\t= " << big_add (x) << "\n"; mmout << "min(y)\t= " << big_min (y) << "\n"; mmout << "x...\t= " << iterate (x) << "\n"; return 0; }