Main Page | Class List | File List | Class Members | File Members | Related Pages

An Example Code of dcovector_io

//====================================================================[include]
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "cppscalapack.h"
#include "cppscalapack_init.h"
using namespace std;

//=======================================================================[main]
/*! main */
int main(int argc, char** argv)
{
  srand(time(NULL));
  const int L(4);
  
  //// initialize ////
  CPPSL::initialize(argc,argv, 2,4, 64,64);
  //CPPSL::initialize(argc,argv, 2,4, 1,1);
  
  //// make dcovector x ////
  CPPSL::dcovector x(L);
  for(int i=0; i<x.l; i++){
    x(i) = double(rand()/(RAND_MAX/10));
  }
  
  //// print x in two ways ////
  CPPSL::cout << "x =\n" << x << endl;
  for(int i=0; i<x.l; i++){
    CPPSL::cout << "x(" << i << ") =" << x(i) << endl;
  }

  //// make dcovector y ////
  CPPSL::dcovector y(x);
  
  //// print y in two ways ////
  CPPSL::cout << "y =\n" << y << endl;
  for(int i=0; i<y.l; i++){
    CPPSL::cout << "y(" << i << ") =" << y(i) << endl;
  }
  
  //// print x+y ////
  CPPSL::cout << "x+y=\n" << x+y << endl;
  
  //// finalize ////
  CPPSL::finalize();
  return 0;
}


Generated on Sat Jan 31 19:25:46 2004 for CPPScaLapack by doxygen 1.3.5