29  Spinor (
const std::complex<T>& _x, 
const std::complex<T>& _y) : x(_x), y(_y){}
 
   36  const Spinor& operator *= (U scale) { x *= scale; y *= scale; 
return *
this; }
 
   37  const Spinor& operator /= (T norm) { x /= norm; y /= norm; 
return *
this; }
 
   38  const Spinor& operator += (
const Spinor& e) { x+=e.x; y+=e.y; 
return *
this; }
 
   42std::ostream& operator << (std::ostream& os, 
const Spinor<T>& s)
 
   44  os << s.x << 
" " << s.y;
 
   49const Spinor<T> operator + (Spinor<T> s, 
const Spinor<T>& t)
 
   56const Spinor<T> operator * (
const Jones<T>& j, 
const Spinor<T>& in)
 
   58  return Spinor<T> ( j.j00 * in.x + j.j01 * in.y,
 
   59                     j.j10 * in.x + j.j11 * in.y );
 
   62template<
typename T, 
typename U>
 
   63const Spinor<T> operator * (U a, Spinor<T> in)
 
   68template<
typename T, 
typename U>
 
   69const Spinor<T> operator * (Spinor<T> in, U a)
 
   75template<
typename T, 
typename U>
 
   76void compute_stokes (
Vector<4,T>& stokes, 
const Spinor<U>& e)
 
   78  double var_x = norm(e.x);
 
   79  double var_y = norm(e.y);
 
   81  std::complex<double> c_xy = conj(e.x) * e.y;
 
   83  stokes[0] = var_x + var_y;
 
   84  stokes[1] = var_x - var_y;
 
   85  stokes[2] = 2.0*c_xy.real();
 
   86  stokes[3] = 2.0*c_xy.imag();