algebramix_doc 0.3
vector_simd_test.cpp
/******************************************************************************
* MODULE     : vector_test.cc
* DESCRIPTION: Test simd vectors
* COPYRIGHT  : (C) 2008  Gregoire Lecerf
*******************************************************************************
* 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 <algebramix/vector_simd.hpp>

using namespace mmx;

#define C double
//#define C unsigned char
//#define C short int
//#define C int
//#define C long int
//#define C long long unsigned int

#define V vector_simd<4,1>
#define Vector vector<C,V>

void
vector_simd_test () {
  Vector x= seq ((C) (5), (C) (7), (C) (9), (C) (11));
  Vector y= vec ((C) (2), (C) (3), (C) (5), (C) (7));
  x << x;
  x << x;
  y << y;
  y << y;
  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+=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*=11) << "\n";
  mmout << "x/=11\t= " << (x/=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";
}


int
main () {
  try {
    vector_simd_test ();
  }
  catch (exception& e) {
    mmout << e << "\n";
    return -1;
  }
  return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines