Changeset 464
- Timestamp:
- 08/01/09 00:36:00 (16 years ago)
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/merger.cpp
r463 r464 128 128 } 129 129 130 vec ll (Merger->_Smp()._samples().length()); 131 for (int j = 0; j < Merger->_Smp()._samples().length(); j++) { 132 ll (j) = Merger->evallog (Merger->_Smp()._samples() (j)); 130 merger_mix* MerMix=dynamic_cast<merger_mix*>(Merger); 131 vec mix_val; 132 133 if (MerMix){ 134 vec ll (Merger->_Smp()._samples().length()); 135 for (int j = 0; j < Merger->_Smp()._samples().length(); j++) { 136 ll (j) = Merger->evallog (Merger->_Smp()._samples() (j)); 137 } 138 139 vec sll = exp (ll); 140 141 mix_val = sll / sum (sll); 133 142 } 134 135 vec sll = exp (ll);136 137 vec mix_val = sll / sum (sll);138 139 143 140 144 #ifdef MEX … … 158 162 159 163 //mixture values 160 mxArray* fldm = mxCreateDoubleMatrix (1, w.length(), mxREAL); 161 vec2mxArray (mix_val, fldm); 162 mxReplaceFieldNM (tmp, "mix", fldm); 163 164 if (mix_val.length()>0){ 165 mxArray* fldm = mxCreateDoubleMatrix (1, w.length(), mxREAL); 166 vec2mxArray (mix_val, fldm); 167 mxReplaceFieldNM (tmp, "mix", fldm); 168 } 164 169 // sources 165 170 char srcstr[20]; -
library/bdm/stat/emix.cpp
r460 r464 6 6 w = w0/sum ( w0 ); 7 7 dim = Coms0(0)->dimension(); 8 bool isnamed = Coms0(0)->isnamed(); 8 9 int i; 9 RV tmp_rv=Coms0(0)->_rv(); 10 RV tmp_rv; 11 if (isnamed) tmp_rv=Coms0(0)->_rv(); 12 10 13 for ( i=0;i<w.length();i++ ) { 11 14 it_assert_debug ( dim== ( Coms0 ( i )->dimension() ),"Component sizes do not match!" ); 12 it_assert_debug ( tmp_rv.equal( Coms0 ( i )->_rv() ),"Component RVs do not match!" );15 it_assert_debug ( !isnamed || tmp_rv.equal( Coms0 ( i )->_rv() ),"Component RVs do not match!" ); 13 16 } 14 17 if ( copy ) { … … 22 25 destroyComs=false; 23 26 } 24 if ( tmp_rv._dsize()==dim) epdf::set_rv(tmp_rv); //coms aer already OK, no need for set_rv27 if (isnamed) epdf::set_rv(tmp_rv); //coms aer already OK, no need for set_rv 25 28 } 26 29