par< T > Class Template Reference

CLASS PAR --- Simple data-parallel vectors. More...

#include <par.h>

List of all members.

Public Member Functions

 par (const int n=1)
 main constructor
 ~par ()
 destructor
 par (const par< T > &x)
 copy construct
void par2_to_par (T f(T, T), par< T > &x, par< T > &y)
par< T > & operator- ()
 Z = op(X).
par< T > & operator! ()
par< T > & operator+ ()
par< T > & operator+ (par< T > &y)
 Z = X (op) Y.
par< T > & operator- (par< T > &y)
par< T > & operator * (par< T > &y)
par< T > & operator/ (par< T > &y)
par< T > & operator% (par< T > &y)
par< T > & operator| (par< T > &y)
par< T > & operator & (par< T > &y)
par< T > & operator+= (par< T > &y)
 Y (op)= X , X and Y are parallel.
par< T > & operator-= (par< T > &y)
par< T > & operator *= (par< T > &y)
par< T > & operator/= (par< T > &y)
par< T > & operator%= (par< T > &y)
par< T > & operator|= (par< T > &y)
par< T > & operator &= (par< T > &y)
max_value (par< T > &y)
min_value (par< T > &y)
par< T > & operator++ ()
 AUTO INC++ / AUTO DEC++.
par< T > & operator++ (int a)
par< T > & operator-- ()
par< T > & operator-- (int a)
T & operator[] (int i)
 Indexing [].
const T & operator[] (int i) const
par< T > & operator[] (par< T > &x)
 parallel (permutation)
par< T > & operator= (const par< T > &x)
 ------ PAR = PAR; -------
par< T > & operator= (const T &t)
par< T > & operator= (const T *t)
 ------ PAR = ARRAY; -------
void all_on ()
void reassign (int n)
 Other Operations.
void dumpflags ()

Private Attributes

T * data
 Data.
int N
 data list

Friends

void par_bool_par (par< T > &x, bool f(T, T), par< T > &y)
 Generic Boolean Parallel Operators.
void par_bool_sing (par< T > &x, bool f(T, T), const T &t)
void par_self (par< T > &x, T f(T))
 Parallel Only Operators.
void par_to_par (par< T > &y, T f(T), par< T > &x)
void sing_to_par (par< T > &y, T f(T), const T &t)
void par_and_sing_to_par (par< T > &z, T f(T, T), par< T > &x, const T &t)
void par_and_sing_to_par_rev (par< T > &z, T f(T, T), par< T > &x, const T &t)
reduce (T init, T f(T, T), const par< T > &x)
 T (op)= X , Reduction operation - X is parallel T is a scalar.
operator+= (T &x, par< T > &y)
operator-= (T &x, par< T > &y)
operator *= (T &x, par< T > &y)
operator/= (T &x, par< T > &y)
operator%= (T &x, par< T > &y)
operator|= (T &x, par< T > &y)
operator &= (T &x, par< T > &y)
par< bool > & flag_setup_x_op_y (par< T > &x)
 bool = X (op) Y (X and Y) are parallel
par< bool > & operator== (par< T > &x, par< T > &y)
par< bool > & operator!= (par< T > &x, par< T > &y)
par< bool > & operator< (par< T > &x, par< T > &y)
par< bool > & operator> (par< T > &x, par< T > &y)
par< bool > & operator<= (par< T > &x, par< T > &y)
par< bool > & operator>= (par< T > &x, par< T > &y)
par< bool > & operator && (par< T > &x, par< T > &y)
par< bool > & operator|| (par< T > &x, par< T > &y)
par< bool > & operator== (par< T > &x, const T &t)
 bool = X op T, X is parallel and T is scalar
par< bool > & operator!= (par< T > &x, const T &t)
par< bool > & operator< (par< T > &x, const T &t)
par< bool > & operator> (par< T > &x, const T &t)
par< bool > & operator<= (par< T > &x, const T &t)
par< bool > & operator>= (par< T > &x, const T &t)
par< bool > & operator== (const T &t, par< T > &x)
par< bool > & operator!= (const T &t, par< T > &x)
par< bool > & operator< (const T &t, par< T > &x)
par< bool > & operator> (const T &t, par< T > &x)
par< bool > & operator>= (const T &t, par< T > &x)
par< bool > & operator<= (const T &t, par< T > &x)
par< bool > & operator && (const T &t, par< T > &x)
par< bool > & operator && (par< T > &x, const T &t)
par< bool > & operator|| (const T &t, par< T > &x)
par< bool > & operator|| (par< T > &x, const T &t)
par< T > & operator+ (par< T > &x, const T &t)
 Z = X (op) T, Z and X are parallel and T is scalar.
par< T > & operator+ (const T &t, par< T > &x)
par< T > & operator- (par< T > &x, const T &t)
par< T > & operator- (const T &t, par< T > &x)
par< T > & operator * (par< T > &x, const T &t)
par< T > & operator * (const T &t, par< T > &x)
par< T > & operator/ (par< T > &x, const T &t)
par< T > & operator/ (const T &t, par< T > &x)
par< T > & operator% (par< T > &x, const T &t)
par< T > & operator% (const T &t, par< T > &x)
par< T > & operator| (par< T > &x, const T &t)
par< T > & operator| (const T &t, par< T > &x)
par< T > & operator & (par< T > &x, const T &t)
par< T > & operator & (const T &t, par< T > &x)
std::ostream & operator<< (std::ostream &out, par< T > &x)
 Input / Output << >>.
std::istream & operator>> (std::istream &in, par< T > &x)
void addr (par< T > &x)
 ARRAY = PAR;.
first (const par< T > &x)
int first_index (const par< T > &x)
nth (const par< T > &x, int n)
nth_index (const par< T > &x, int n)
bool any (par< T > &x)
bool all (par< T > &x)
int active (par< T > &x)
par< T > & scan (T init, T f(T, T), const par< T > &x)
par< T > & pow (par< T > &x, T t)
par< T > & pow (T t, par< T > &x)
par< T > & rotate (par< T > &x, int amt)
 Communication: Rotate, Permute, Others.
par< T > & permute (par< T > &x, par< int > &y)
par< T > & pack (par< T > &x)


Detailed Description

template<class T>
class par< T >

CLASS PAR --- Simple data-parallel vectors.

Definition at line 88 of file par.h.


Constructor & Destructor Documentation

template<class T>
par< T >::par const int  n = 1  )  [inline]
 

main constructor

Definition at line 98 of file par.h.

00099     { 
00100       N = n;    
00101       data = new T[n];
00102     }

template<class T>
par< T >::~par  )  [inline]
 

destructor

Definition at line 104 of file par.h.

00105     { delete [] data; }

template<class T>
par< T >::par const par< T > &  x  )  [inline]
 

copy construct

duplicates up to the space in new vector

Definition at line 107 of file par.h.

References par< T >::data, and par< T >::N.

00108     {                                                   
00109     for (int i=0; i<x.N; i++)
00110                 data[i] = x.data[i];
00111         N = x.N;
00112     }


Member Function Documentation

template<class T>
void par< T >::all_on  )  [inline]
 

Definition at line 509 of file par.h.

References flag, and flag_N.

00510     {
00511     delete [] flag;
00512     flag = new bool[N];
00513         flag_N = N;
00514         for (int i=0; i<flag_N; i++) flag[i]=true;
00515     }

template<class T>
void par< T >::dumpflags  )  [inline]
 

Definition at line 598 of file par.h.

References flag.

00599         {
00600     for (int i=0; i<flag_N; i++)
00601                 std::cout<<flag[i];
00602     std::cout << std::endl;             
00603     }

template<class T>
T par< T >::max_value par< T > &  y  )  [inline]
 

Definition at line 266 of file par.h.

References par< T >::data, and par_max().

00267         {return reduce( y.data[0], par_max, y);}

template<class T>
T par< T >::min_value par< T > &  y  )  [inline]
 

Definition at line 269 of file par.h.

References par< T >::data, and par_min().

00270         {return reduce( y.data[0], par_min, y);}

template<class T>
par<T>& par< T >::operator & par< T > &  y  )  [inline]
 

Definition at line 216 of file par.h.

References par< T >::par2_to_par(), par_and(), and par< T >::reassign().

00217     {static par<T> z(N); z.reassign(N); z.par2_to_par( par_and, *this, y); return z;}

template<class T>
par<T>& par< T >::operator &= par< T > &  y  )  [inline]
 

Definition at line 238 of file par.h.

References par_and().

00239     {this->par2_to_par( par_and, *this, y); return *this;}

template<class T>
par<T>& par< T >::operator * par< T > &  y  )  [inline]
 

Definition at line 204 of file par.h.

References par< T >::par2_to_par(), par_mul(), and par< T >::reassign().

00205     {static par<T> z(N); z.reassign(N); z.par2_to_par( par_mul, *this, y); return z;}

template<class T>
par<T>& par< T >::operator *= par< T > &  y  )  [inline]
 

Definition at line 226 of file par.h.

References par_mul().

00227     {this->par2_to_par( par_mul, *this, y); return *this;}

template<class T>
par<T>& par< T >::operator!  )  [inline]
 

Definition at line 190 of file par.h.

References par_not(), and par< T >::reassign().

00191     { static par<T> z(N); z.reassign(N); par_to_par(z ,par_not ,*this ); return z;}

template<class T>
par<T>& par< T >::operator% par< T > &  y  )  [inline]
 

Definition at line 210 of file par.h.

References par< T >::par2_to_par(), par_mod(), and par< T >::reassign().

00211     {static par<T> z(N); z.reassign(N); z.par2_to_par( par_mod, *this, y); return z;}

template<class T>
par<T>& par< T >::operator%= par< T > &  y  )  [inline]
 

Definition at line 232 of file par.h.

References par_mod().

00233     {this->par2_to_par( par_mod, *this, y); return *this;}

template<class T>
par<T>& par< T >::operator+ par< T > &  y  )  [inline]
 

Z = X (op) Y.

Definition at line 198 of file par.h.

References par< T >::par2_to_par(), par_add(), and par< T >::reassign().

00199         {static par<T> z(N); z.reassign(N); z.par2_to_par( par_add, *this, y); return z;}

template<class T>
par<T>& par< T >::operator+  )  [inline]
 

Definition at line 193 of file par.h.

00194     { return *this; }

template<class T>
par<T>& par< T >::operator++ int  a  )  [inline]
 

Definition at line 403 of file par.h.

References par_add(), and par< T >::reassign().

00404         {
00405         static par<T> z(N); z.reassign(N);
00406         par_and_sing_to_par(*z, par_add, *this, 1);
00407         return z;
00408         }

template<class T>
par<T>& par< T >::operator++  )  [inline]
 

AUTO INC++ / AUTO DEC++.

Definition at line 397 of file par.h.

References par_add().

00398         {
00399         par_and_sing_to_par(*this, par_add, *this, 1);
00400         return *this;
00401         }

template<class T>
par<T>& par< T >::operator+= par< T > &  y  )  [inline]
 

Y (op)= X , X and Y are parallel.

Definition at line 220 of file par.h.

References par_add().

00221         {this->par2_to_par( par_add, *this, y); return *this;}

template<class T>
par<T>& par< T >::operator- par< T > &  y  )  [inline]
 

Definition at line 201 of file par.h.

References par< T >::par2_to_par(), par_sub(), and par< T >::reassign().

00202     {static par<T> z(N); z.reassign(N); z.par2_to_par( par_sub, *this, y); return z;}

template<class T>
par<T>& par< T >::operator-  )  [inline]
 

Z = op(X).

Definition at line 187 of file par.h.

References par_neg(), and par< T >::reassign().

00188     { static par<T> z(N); z.reassign(N); par_to_par(z ,par_neg ,*this ); return z;}

template<class T>
par<T>& par< T >::operator-- int  a  )  [inline]
 

Definition at line 416 of file par.h.

References par_sub(), and par< T >::reassign().

00417         {
00418         static par<T> z(N); z.reassign(N);
00419         par_and_sing_to_par(z, par_sub, *this, 1);
00420         return z;
00421         }

template<class T>
par<T>& par< T >::operator--  )  [inline]
 

Definition at line 410 of file par.h.

References par_sub().

00411         {
00412         par_and_sing_to_par(*this, par_sub, *this, 1);
00413         return *this;
00414         }

template<class T>
par<T>& par< T >::operator-= par< T > &  y  )  [inline]
 

Definition at line 223 of file par.h.

References par_sub().

00224     {this->par2_to_par( par_sub, *this, y); return *this;}

template<class T>
par<T>& par< T >::operator/ par< T > &  y  )  [inline]
 

Definition at line 207 of file par.h.

References par< T >::par2_to_par(), par_div(), and par< T >::reassign().

00208     {static par<T> z(N); z.reassign(N); z.par2_to_par( par_div, *this, y); return z;}

template<class T>
par<T>& par< T >::operator/= par< T > &  y  )  [inline]
 

Definition at line 229 of file par.h.

References par_div().

00230     {this->par2_to_par( par_div, *this, y); return *this;}

template<class T>
par<T>& par< T >::operator= const T *  t  )  [inline]
 

------ PAR = ARRAY; -------

Definition at line 488 of file par.h.

References flag, and flagtemp.

00489         {
00490         if (flagtemp !=NULL && restrict)
00491                 for (int i=0; i<N; i++)
00492                         { if (flag[i]) data[i] = t[i]; }
00493         else    
00494                 for (int i=0; i<N; i++)
00495                         data[i]=t[i];
00496         return *this;
00497         }

template<class T>
par<T>& par< T >::operator= const T &  t  )  [inline]
 

------ PAR = SING; ------- Also, think of as a communication broadcast in MPI...

Definition at line 476 of file par.h.

References flagtemp.

00477     {
00478         if (flagtemp !=NULL && restrict)
00479                 for (int i=0; i<N; i++)
00480                         {if (flagtemp[i]) data[i] = t;}
00481         else    
00482                 for (int i=0; i<N; i++)
00483                         data[i]=t;
00484         return *this;
00485         }

template<class T>
par<T>& par< T >::operator= const par< T > &  x  )  [inline]
 

------ PAR = PAR; -------

Definition at line 462 of file par.h.

References par< T >::data, and flagtemp.

00463     {
00464         if (flagtemp !=NULL && restrict)
00465                 for (int i=0; i<N; i++)
00466                         {if (flagtemp[i]) data[i] = x.data[i];}
00467                 else
00468                         for (int i=0; i<N; i++)
00469                                 data[i] = x.data[i];
00470                 return *this;
00471     }

template<class T>
par<T>& par< T >::operator[] par< T > &  x  )  [inline]
 

parallel (permutation)

Definition at line 449 of file par.h.

References par< T >::data, par< T >::N, and par< T >::reassign().

00450     { 
00451         static par<T> z(x.N); z.reassign(x.N);
00452         for (int i=0; i<x.N; i++)
00453                 z.data[i] = data[ x.data[i]%x.N ];                              // permutation
00454         return z;
00455     } 

template<class T>
const T& par< T >::operator[] int  i  )  const [inline]
 

Definition at line 446 of file par.h.

00447     { return data[i]; } 

template<class T>
T& par< T >::operator[] int  i  )  [inline]
 

Indexing [].

Definition at line 443 of file par.h.

00444     { return data[i]; } 

template<class T>
par<T>& par< T >::operator| par< T > &  y  )  [inline]
 

Definition at line 213 of file par.h.

References par< T >::par2_to_par(), par_or(), and par< T >::reassign().

00214     {static par<T> z(N); z.reassign(N); z.par2_to_par( par_or, *this, y); return z;}

template<class T>
par<T>& par< T >::operator|= par< T > &  y  )  [inline]
 

Definition at line 235 of file par.h.

References par_or().

00236     {this->par2_to_par( par_or, *this, y); return *this;}

template<class T>
void par< T >::par2_to_par T   f(T, T),
par< T > &  x,
par< T > &  y
[inline]
 

Definition at line 156 of file par.h.

References par< T >::data.

Referenced by par< T >::operator &(), par< T >::operator *(), par< T >::operator%(), par< T >::operator+(), par< T >::operator-(), par< T >::operator/(), and par< T >::operator|().

00157     {
00158     for (int i=0; i<N; i++)
00159                 data[i] = f(x.data[i],y.data[i]);                       // Farg occurs here when data different size
00160     }

template<class T>
void par< T >::reassign int  n  )  [inline]
 

Other Operations.

Definition at line 594 of file par.h.

Referenced by par< T >::operator &(), par< T >::operator *(), par< T >::operator!(), par< T >::operator%(), par< T >::operator+(), par< T >::operator++(), par< T >::operator-(), par< T >::operator--(), par< T >::operator/(), par< T >::operator[](), and par< T >::operator|().

00595         { delete [] data;  N = n;  data = new T[n]; }


Friends And Related Function Documentation

template<class T>
int active par< T > &  x  )  [friend]
 

Definition at line 573 of file par.h.

00574         {
00575         int c=0;
00576         for (int i=0; i<x.N; i++)
00577                 if (flag[i]) c++;
00578         return c;
00579         }

template<class T>
void addr par< T > &  x  )  [friend]
 

ARRAY = PAR;.

Definition at line 506 of file par.h.

00507     { for (int i=0; i<x.N; i++) x.data[i] = i; }

template<class T>
bool all par< T > &  x  )  [friend]
 

Definition at line 566 of file par.h.

00567         {
00568         for (int i=0; i<x.N; i++)
00569                 if (!x.data[i]) return false;
00570         return true;
00571         }

template<class T>
bool any par< T > &  x  )  [friend]
 

Definition at line 559 of file par.h.

00560         {
00561         for (int i=0; i<x.N; i++)
00562                 if (x.data[i]) return true;
00563         return false;
00564         }

template<class T>
T first const par< T > &  x  )  [friend]
 

Definition at line 517 of file par.h.

00518         {
00519         if (flag != NULL)
00520                 for (int i=0; i<x.N; i++)
00521                         if (flag[i]) return x.data[i];
00522         return x.data[0];
00523         }

template<class T>
int first_index const par< T > &  x  )  [friend]
 

Definition at line 525 of file par.h.

00526         {
00527         if (flag != NULL)
00528                 for (int i=0; i<x.N; i++)
00529                         if (flag[i]) return i;
00530         return -1;
00531         }

template<class T>
par<bool>& flag_setup_x_op_y par< T > &  x  )  [friend]
 

bool = X (op) Y (X and Y) are parallel

Definition at line 276 of file par.h.

00277         {static par<bool> r(x.N);  r.reassign(x.N); r=flag;  return r;}

template<class T>
T nth const par< T > &  x,
int  n
[friend]
 

Definition at line 533 of file par.h.

00534         {
00535         int c=0;
00536         if (flag != NULL)
00537                 for (int i=0; i<x.N; i++)
00538                         if (flag[i]) 
00539                                 {
00540                                 c++;
00541                                 if (c==n) return x.data[i];
00542                                 }
00543         return x.data[0];
00544         }

template<class T>
T nth_index const par< T > &  x,
int  n
[friend]
 

Definition at line 546 of file par.h.

00547         {
00548         int c=0;
00549         if (flag != NULL)
00550                 for (int i=0; i<x.N; i++)
00551                         if (flag[i]) 
00552                                 {
00553                                 c++;
00554                                 if (c==n) return i;
00555                                 }
00556         return -1;
00557         }

template<class T>
par<T>& operator & const T &  t,
par< T > &  x
[friend]
 

Definition at line 393 of file par.h.

00394     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_and, x, t); return z;}

template<class T>
par<T>& operator & par< T > &  x,
const T &  t
[friend]
 

Definition at line 390 of file par.h.

00391     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_and, x, t); return z;}

template<class T>
par<bool>& operator && par< T > &  x,
const T &  t
[friend]
 

Definition at line 343 of file par.h.

00344     { par_bool_sing(t, par_and, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator && const T &  t,
par< T > &  x
[friend]
 

Definition at line 340 of file par.h.

00341     { par_bool_sing(t, par_and, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator && par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 297 of file par.h.

00298     { par_bool_par(x, par_and, y); return flag_setup_x_op_y(x);}

template<class T>
T operator &= T &  x,
par< T > &  y
[friend]
 

Definition at line 263 of file par.h.

00264     {return x=reduce( true, par_and, y);}

template<class T>
par<T>& operator * const T &  t,
par< T > &  x
[friend]
 

Definition at line 369 of file par.h.

00370     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_mul, x, t); return z;}

template<class T>
par<T>& operator * par< T > &  x,
const T &  t
[friend]
 

Definition at line 366 of file par.h.

00367     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_mul, x, t); return z;}

template<class T>
T operator *= T &  x,
par< T > &  y
[friend]
 

Definition at line 251 of file par.h.

00252     {return x=reduce( 1, par_mul, y);}

template<class T>
par<bool>& operator!= const T &  t,
par< T > &  x
[friend]
 

Definition at line 325 of file par.h.

00326     { par_bool_sing(t, par_ne, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator!= par< T > &  x,
const T &  t
[friend]
 

Definition at line 307 of file par.h.

00308     { par_bool_sing(x, par_ne, t); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator!= par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 282 of file par.h.

00283     { par_bool_par(x, par_ne, y); return flag_setup_x_op_y(x);}

template<class T>
par<T>& operator% const T &  t,
par< T > &  x
[friend]
 

Definition at line 381 of file par.h.

00382     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_mod, x, t); return z;}

template<class T>
par<T>& operator% par< T > &  x,
const T &  t
[friend]
 

Definition at line 378 of file par.h.

00379     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_mod, x, t); return z;}

template<class T>
T operator%= T &  x,
par< T > &  y
[friend]
 

Definition at line 257 of file par.h.

00258     {return x=reduce( 1, par_mod, y);}

template<class T>
par<T>& operator+ const T &  t,
par< T > &  x
[friend]
 

Definition at line 357 of file par.h.

00358         {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_add, x, t); return z;}

template<class T>
par<T>& operator+ par< T > &  x,
const T &  t
[friend]
 

Z = X (op) T, Z and X are parallel and T is scalar.

Definition at line 354 of file par.h.

00355     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_add, x, t); return z;}

template<class T>
T operator+= T &  x,
par< T > &  y
[friend]
 

Definition at line 245 of file par.h.

00246         {return x=reduce( 0, par_add, y);}

template<class T>
par<T>& operator- const T &  t,
par< T > &  x
[friend]
 

Definition at line 363 of file par.h.

00364     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_sub, x, t); return z;}

template<class T>
par<T>& operator- par< T > &  x,
const T &  t
[friend]
 

Definition at line 360 of file par.h.

00361     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_sub, x, t); return z;}

template<class T>
T operator-= T &  x,
par< T > &  y
[friend]
 

Definition at line 248 of file par.h.

00249     {return x=reduce( 0, par_sub, y);}

template<class T>
par<T>& operator/ const T &  t,
par< T > &  x
[friend]
 

Definition at line 375 of file par.h.

00376     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_div, x, t); return z;}

template<class T>
par<T>& operator/ par< T > &  x,
const T &  t
[friend]
 

Definition at line 372 of file par.h.

00373     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_div, x, t); return z;}

template<class T>
T operator/= T &  x,
par< T > &  y
[friend]
 

Definition at line 254 of file par.h.

00255     {return x=reduce( 1, par_div, y);}

template<class T>
par<bool>& operator< const T &  t,
par< T > &  x
[friend]
 

Definition at line 328 of file par.h.

00329     { par_bool_sing(t, par_lt, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator< par< T > &  x,
const T &  t
[friend]
 

Definition at line 310 of file par.h.

00311     { par_bool_sing(x, par_lt, t); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator< par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 285 of file par.h.

00286     { par_bool_par(x, par_lt, y); return flag_setup_x_op_y(x);}

template<class T>
std::ostream& operator<< std::ostream &  out,
par< T > &  x
[friend]
 

Input / Output << >>.

Definition at line 426 of file par.h.

00427     {
00428     for (int i=0; i<x.N; i++)
00429                 out << std::setw(12) << x.data[i];
00430     return out;
00431         }

template<class T>
par<bool>& operator<= const T &  t,
par< T > &  x
[friend]
 

Definition at line 337 of file par.h.

00338     { par_bool_sing(t, par_le, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator<= par< T > &  x,
const T &  t
[friend]
 

Definition at line 316 of file par.h.

00317         { par_bool_sing(x, par_le, t); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator<= par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 291 of file par.h.

00292     { par_bool_par(x, par_le, y); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator== const T &  t,
par< T > &  x
[friend]
 

Definition at line 322 of file par.h.

00323     { par_bool_sing(t, par_eq, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator== par< T > &  x,
const T &  t
[friend]
 

bool = X op T, X is parallel and T is scalar

Definition at line 304 of file par.h.

00305     { par_bool_sing(x, par_eq, t); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator== par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 279 of file par.h.

00280     { par_bool_par(x, par_eq, y); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator> const T &  t,
par< T > &  x
[friend]
 

Definition at line 331 of file par.h.

00332     { par_bool_sing(t, par_gt, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator> par< T > &  x,
const T &  t
[friend]
 

Definition at line 313 of file par.h.

00314     { par_bool_sing(x, par_gt, t); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator> par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 288 of file par.h.

00289     { par_bool_par(x, par_gt, y); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator>= const T &  t,
par< T > &  x
[friend]
 

Definition at line 334 of file par.h.

00335     { par_bool_sing(t, par_ge, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator>= par< T > &  x,
const T &  t
[friend]
 

Definition at line 319 of file par.h.

00320     { par_bool_sing(x, par_ge, t); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator>= par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 294 of file par.h.

00295     { par_bool_par(x, par_ge, y); return flag_setup_x_op_y(x);}

template<class T>
std::istream& operator>> std::istream &  in,
par< T > &  x
[friend]
 

Definition at line 434 of file par.h.

00435     {
00436     for (int i=0; i<x.N; i++)
00437                 in >> x.data[i];
00438     return in;
00439     }

template<class T>
par<T>& operator| const T &  t,
par< T > &  x
[friend]
 

Definition at line 387 of file par.h.

00388     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par_rev( z, par_or, x, t); return z;}

template<class T>
par<T>& operator| par< T > &  x,
const T &  t
[friend]
 

Definition at line 384 of file par.h.

00385     {static par<T> z(x.N); z.reassign(x.N); par_and_sing_to_par( z, par_or, x, t); return z;}

template<class T>
T operator|= T &  x,
par< T > &  y
[friend]
 

Definition at line 260 of file par.h.

00261     {return x=reduce( false, par_or, y);}

template<class T>
par<bool>& operator|| par< T > &  x,
const T &  t
[friend]
 

Definition at line 349 of file par.h.

00350     { par_bool_sing(t, par_and, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator|| const T &  t,
par< T > &  x
[friend]
 

Definition at line 346 of file par.h.

00347     { par_bool_sing(t, par_and, x); return flag_setup_x_op_y(x);}

template<class T>
par<bool>& operator|| par< T > &  x,
par< T > &  y
[friend]
 

Definition at line 300 of file par.h.

00301     { par_bool_par(x, par_or, y); return flag_setup_x_op_y(x);}

template<class T>
par<T>& pack par< T > &  x  )  [friend]
 

Definition at line 643 of file par.h.

00644         {
00645         static par<T> z(x.N); z.reassign(x.N);
00646         int c=0;
00647         for (int i=0; i<x.N; i++)
00648                 if (flag[i]) z.data[c++] = x.data[i];
00649         return z;
00650         }

template<class T>
void par_and_sing_to_par par< T > &  z,
T   f(T, T),
par< T > &  x,
const T &  t
[friend]
 

Definition at line 170 of file par.h.

00171     {
00172     par<T> y(x.N);      y=t;
00173     z.par2_to_par(f,x,y);               
00174     }

template<class T>
void par_and_sing_to_par_rev par< T > &  z,
T   f(T, T),
par< T > &  x,
const T &  t
[friend]
 

Definition at line 176 of file par.h.

00177     {
00178     par<T> y(x.N);      y=t;
00179     z.par2_to_par(f,y,x);       
00180     }

template<class T>
void par_bool_par par< T > &  x,
bool   f(T, T),
par< T > &  y
[friend]
 

Generic Boolean Parallel Operators.

Definition at line 125 of file par.h.

00126     {
00127     delete [] flag;
00128     flag = new bool[x.N];
00129         flag_N = x.N; 
00130         for (int i=0; i<x.N; i++)
00131                 {
00132                 flag[i] = f(x.data[i],y.data[i]);
00133                 }
00134     }

template<class T>
void par_bool_sing par< T > &  x,
bool   f(T, T),
const T &  t
[friend]
 

Definition at line 136 of file par.h.

00137     {
00138     par<T> y(x.N);
00139         y=t;
00140     par_bool_par(x,f,y);
00141     }

template<class T>
void par_self par< T > &  x,
T   f(T)
[friend]
 

Parallel Only Operators.

Definition at line 144 of file par.h.

00145     {
00146     for (int i=0; i<x.N; i++)
00147                 x.data[i] = f(x.data[i]);
00148     }

template<class T>
void par_to_par par< T > &  y,
T   f(T),
par< T > &  x
[friend]
 

Definition at line 150 of file par.h.

00151     {
00152     for (int i=0; i<y.N; i++)
00153                 y.data[i] = f(x.data[i]);
00154     }

template<class T>
par<T>& permute par< T > &  x,
par< int > &  y
[friend]
 

Definition at line 635 of file par.h.

00636         {
00637         static par<T> z(x.N); z.reassign(x.N);
00638         for (int i=0; i<x.N; i++)
00639                 z.data[y.data[i]%x.N] = x.data[i];
00640         return z;
00641         }

template<class T>
par<T>& pow t,
par< T > &  x
[friend]
 

Definition at line 614 of file par.h.

00615     {
00616         par<T> y(x.N);
00617     static par<T> z(x.N);  
00618         z.reassign(x.N); 
00619     y = t;
00620         z.par2_to_par( std::pow, y, x); return z;
00621     }

template<class T>
par<T>& pow par< T > &  x,
t
[friend]
 

Definition at line 605 of file par.h.

00606     {
00607         par<T> y(x.N);
00608     static par<T> z(x.N);
00609         z.reassign(x.N); 
00610     y = t;
00611         z.par2_to_par( std::pow, x, y); return z;
00612     }

template<class T>
T reduce init,
T   f(T, T),
const par< T > &  x
[friend]
 

T (op)= X , Reduction operation - X is parallel T is a scalar.

Definition at line 242 of file par.h.

00243     { for (int i=0; i<x.N; i++)  init = f(init , x.data[i]);  return init; }

template<class T>
par<T>& rotate par< T > &  x,
int  amt
[friend]
 

Communication: Rotate, Permute, Others.

Definition at line 627 of file par.h.

00628         {
00629         static par<T> z(x.N); z.reassign(x.N);
00630         for (int i=0; i<x.N; i++)
00631                 z.data[(i+amt+x.N)%x.N] = x.data[i];            
00632         return z;
00633         }

template<class T>
par<T>& scan init,
T   f(T, T),
const par< T > &  x
[friend]
 

Definition at line 581 of file par.h.

00582         { 
00583         static par<T> z(N); z.reassign(N);
00584         z.data[0] = x.data[0];
00585         for (int i=1; i<x.N; i++)
00586                 z.data[i] = f(z.data[i-1], x.data[i]);
00587         return z;
00588         }

template<class T>
void sing_to_par par< T > &  y,
T   f(T),
const T &  t
[friend]
 

Singular(Scalar) and Parallel Combined Note: Singulars could involve broadcasts from master process using MPI

Definition at line 164 of file par.h.

00165     {
00166     for (int i=0; i<y.N; i++)
00167                 y.data[i] = f(t);
00168     }


Member Data Documentation

template<class T>
T* par< T >::data [private]
 

Data.

Definition at line 92 of file par.h.

Referenced by par< T >::max_value(), par< T >::min_value(), par< T >::operator=(), par< T >::operator[](), par< T >::par(), and par< T >::par2_to_par().

template<class T>
int par< T >::N [private]
 

data list

Definition at line 93 of file par.h.

Referenced by par< T >::operator[](), and par< T >::par().


The documentation for this class was generated from the following file:
Generated on Tue Jan 4 17:45:20 2005 for ZIPPAR by  doxygen 1.3.9.1