| 498 | //! Load from structure with elements: |
| 499 | //! \code |
| 500 | //! { class='mmix'; |
| 501 | //! pdfs = (..., ...); // list of pdfs in the mixture |
| 502 | //! weights = ( 0.5, 0.5 ); // weights of pdfs in the mixture |
| 503 | //! } |
| 504 | //! \endcode |
| 505 | //!@} |
| 506 | void from_setting ( const Setting &set ) { |
| 507 | UI::get ( Coms, set, "pdfs", UI::compulsory ); |
| 508 | |
| 509 | if( !UI::get( w, set, "weights", UI::optional ) ) |
| 510 | { |
| 511 | int len = Coms.length(); |
| 512 | w.set_length( len ); |
| 513 | double default_weight = 1.0 / len; |
| 514 | for( int i=0; i < len; i++) |
| 515 | w(i) = default_weight; |
| 516 | } |
| 517 | } |