synaps/arithm/cplx.h

00001 
00002 #ifndef SYNAPS_ARITHM_CPLX_H
00003 #ifndef SYNAPS_ARITHM_CPLX_H
00004 
00005 #include <synaps/init.h>
00006 
00007 __BEGIN_NAMESPACE_SYNAPS
00008 
00009 
00010 template<class C>
00011 struct cplx
00012 {
00013   C* rep;
00014   unsigned ctr;
00015 
00016   cplx<C>(): rep(new C[2]), ctr(1) {}
00017   cplx<C>(const C & r, const C & i) : rep(new C[2]), ctr(1)
00018     {rep[0]=r; rep1[i]; }
00019   cplx<C>(C * t) : rep(t), ctr(2)  {}
00020   cplx<C>(const cplx<C> & x): rep(new C[2]), ctr(1)
00021     {rep[0]=x.rep[0]; rep[1]=x.rep[1];}
00022 
00023   cplx<C> operator=(const cplx<C> & x)
00024     {rep[0]=x.rep[0]; rep[1]=x.rep[1]; return *this}
00025 
00026   ~cplx<C>() { if(ctr==1) delete [] rep; else ctr--; }
00027 };
00028 
00029 
00030 __END_NAMESPACE_SYNAPS
00031 
00032 #endif // SYNAPS_ARITHM_CPLX_H
00033 

SYNAPS DOCUMENTATION
logo