Header file for VectorN


/* The Vector<unsigned size> class */

#ifndef _vectorn_h
#define _vectorn_h

#include <stream.h>

template<unsigned size> class Vector
{
protected:
   double v[size];
public:

   Vector( double V[] ){ memcpy(v,V,size*sizeof(double)); }
   Vector<size> operator+( Vector<size> );

   friend ostream &operator<<( ostream &, Vector<size> );
};

template<unsigned size>
Vector<size> Vector<size>::operator+( Vector<size> V2 )
{
double V[size];

   for ( int i=0;i<size;i++ ) V[i] = v[i] + V2.v[i];
   return Vector<size>( V );
}

template<unsigned size>
ostream &operator<<( ostream &s, Vector<size> v1 )
{
   s << '(' << v1.v[0];
   for( int i=1;i<size;i++ ) s << ',' << v1.v[i];
   return s << ')';
}

#endif