00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef CLIPPER_HKL_OPERATORS
00046 #define CLIPPER_HKL_OPERATORS
00047
00048 #include "hkl_datatypes.h"
00049
00050
00051 namespace clipper
00052 {
00053
00054 namespace datatypes
00055 {
00056
00057
00058 HKL_data<Flag_bool> operator &( const HKL_data_base& d1, const HKL_data_base& d2 );
00059 HKL_data<Flag_bool> operator |( const HKL_data_base& d1, const HKL_data_base& d2 );
00060 HKL_data<Flag_bool> operator ^( const HKL_data_base& d1, const HKL_data_base& d2 );
00061 HKL_data<Flag_bool> operator !( const HKL_data_base& d1 );
00062
00063 HKL_data<Flag_bool> operator ==( const HKL_data<Flag>& d1, const int& n );
00064 HKL_data<Flag_bool> operator !=( const HKL_data<Flag>& d1, const int& n );
00065 HKL_data<Flag_bool> operator >=( const HKL_data<Flag>& d1, const int& n );
00066 HKL_data<Flag_bool> operator <=( const HKL_data<Flag>& d1, const int& n );
00067 HKL_data<Flag_bool> operator >( const HKL_data<Flag>& d1, const int& n );
00068 HKL_data<Flag_bool> operator <( const HKL_data<Flag>& d1, const int& n );
00069
00070
00071 template<class dtype> F_phi<dtype> operator +( const F_phi<dtype>& d1, const F_phi<dtype>& d2 );
00072 template<class dtype> F_phi<dtype> operator -( const F_phi<dtype>& d1, const F_phi<dtype>& d2 );
00073 template<class dtype> F_phi<dtype> operator -( const F_phi<dtype>& d1 );
00074 template<class dtype> ABCD<dtype> operator +( const ABCD<dtype>& d1, const ABCD<dtype>& d2 );
00075
00076
00077 template<class dtype> HKL_data<F_phi<dtype> > operator +( const HKL_data<F_phi<dtype> >& d1, const HKL_data<F_phi<dtype> >& d2 );
00078 template<class dtype> HKL_data<F_phi<dtype> > operator -( const HKL_data<F_phi<dtype> >& d1, const HKL_data<F_phi<dtype> >& d2 );
00079 template<class dtype> HKL_data<F_phi<dtype> > operator *( const HKL_data<F_phi<dtype> >& d1, const ftype& s );
00080 template<class dtype> HKL_data<F_phi<dtype> > operator -( const HKL_data<F_phi<dtype> >& d1 );
00081 template<class dtype> HKL_data<ABCD<dtype> > operator +( const HKL_data<ABCD<dtype> >& d1, const HKL_data<ABCD<dtype> >& d2 );
00082 template<class dtype> HKL_data<F_phi<dtype> > operator *( const ftype& s, const HKL_data<F_phi<dtype> >& d1 ) { return d1*s; }
00083
00084 }
00085
00086
00087
00089
00096 template<int N> class LogPhaseProb {
00097 public:
00099 LogPhaseProb( const HKL_class& hkl_class );
00101 template<class dtype> void set_abcd( const datatypes::ABCD<dtype>& abcd );
00103 template<class dtype> void get_abcd( datatypes::ABCD<dtype>& abcd ) const;
00105 template<class dtype> void set_phi_fom( const datatypes::Phi_fom<dtype>& phifom );
00107 template<class dtype> void get_phi_fom( datatypes::Phi_fom<dtype>& phifom ) const;
00109 const ftype& operator[] ( const int& p ) const { return q[p]; }
00111 ftype& operator[] ( const int& p ) { return q[p]; }
00113 ftype phase( const int& p ) const
00114 { return Util::twopi()*ftype(p*pinc+pmin)/ftype(N); }
00115 int size() const { return q.size(); }
00116 static int sampling() { return N; }
00117 private:
00118 int pmin, pinc;
00119 std::vector<ftype> q;
00120 };
00121
00122
00123 }
00124
00125 #endif