/////////////////////////////////////////////////////////////////////////////// // // // This file is part of ModelBlocks. Copyright 2009, ModelBlocks developers. // // // // ModelBlocks is free software: you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation, either version 3 of the License, or // // (at your option) any later version. // // // // ModelBlocks is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with ModelBlocks. If not, see . // // // // ModelBlocks developers designate this particular file as subject to // // the "Moses" exception as provided by ModelBlocks developers in // // the LICENSE file that accompanies this code. // // // /////////////////////////////////////////////////////////////////////////////// #include "nl-linsep.h" /* class ConvolvedComplexMelVec { private: ComplexMelVec vMain; double dConvo; public: void set ( const ComplexMelVec& v ) { vMain=v; for(int i=0;i operator>> ( StringInput str, ConvolvedComplexMelVec& v ) { return pair(str,&v); } friend StringInput operator>> ( pair delimbuff, const char* ps ) { StringInput str = delimbuff.first>>delimbuff.second->vMain>>",">>delimbuff.second->dConvo>>ps; for(int i=0;idConvo+=delimbuff.second->vMain.get(i)*delimbuff.second->vMain.get(i); return str; } friend ostream& operator<< ( ostream& os, const ConvolvedComplexMelVec& v ) { return os< { }; */ //////////////////////////////////////////////////////////////////////////////// class binuint { private: uint b; public: // Constructor / destructor methods... binuint ( ) : b(0) { } binuint ( uint i ) : b(i) { } // Specification methods... binuint& operator+= ( binuint i ) { b+=i.b; return *this; } binuint& operator-= ( binuint i ) { b-=i.b; return *this; } binuint& operator*= ( binuint i ) { b*=i.b; return *this; } binuint& operator/= ( binuint i ) { b/=i.b; return *this; } binuint& operator%= ( binuint i ) { b%=i.b; return *this; } binuint& operator++ ( ) { b++; return *this; } // Extractor methods... binuint operator+ ( binuint i ) const { return (b+i.b); } binuint operator- ( binuint i ) const { return (b-i.b); } binuint operator* ( binuint i ) const { return (b*i.b); } binuint operator/ ( binuint i ) const { return (b/i.b); } binuint operator% ( binuint i ) const { return (b%i.b); } bool operator== ( binuint i ) const { return (b==i.b); } bool operator!= ( binuint i ) const { return (b!=i.b); } bool operator< ( binuint i ) const { return (b ( binuint i ) const { return (b>i.b); } bool operator<= ( binuint i ) const { return (b<=i.b); } bool operator>= ( binuint i ) const { return (b>=i.b); } size_t getHashKey ( ) const { return b; } // Input / output methods... friend StringInput operator>> ( StringInput si, binuint& i ) { if(si==NULL) return si; i.b=0; for ( char c=si[0]; '0'<=c && c<='1'; ++si,c=si[0]) { i.b=i.b*2+c-'0'; } return si; } friend ostream& operator<< ( ostream& os, binuint i ) { for(int e=uint(log2(i.b));e>=0;e--)os <<((i.b>>e)%2); return os; } friend String& operator<< ( String& str, binuint i ) { for(int e=uint(log2(i.b));e>=0;e--)str<<((i.b>>e)%2); return str; } }; //////////////////////////////////////////////////////////////////////////////// template class ObliqueDTreeModel { private: ////=M////typedef SimpleLinSepModel SepModel; //typedef int TreeAddr; map hag; map hap; public: typedef typename M::InputTrainingExample InputTrainingExample; void train ( SubArray >, const YF&, binuint=1 ); typename M::ProbType getProb ( binuint y, const typename M::CondVarType& ) const; friend pair*> operator>> ( StringInput si, ObliqueDTreeModel& m ) { return pair*>(si,&m); } friend StringInput operator>> ( pair*> si_m, const char* psD ) { if (si_m.first==NULL) return si_m.first; binuint branch=0; StringInput si=si_m.first>>branch>>" "; //cerr<<"?^?^? "<