pub fn add_output_factor_per_ssd(&mut self, ssd: f64, ofs: Vec<f64>) -> Result<(), EmuError> {
        if ofs.len() != self.energies.len() {
            return Err(EmuError::Str(format!(
                "Mismatch between the number energies [{}] and the number of outputfactors [{}]",
                self.energies.len(),
                ofs.len()
            )));
        }
        if ofs.len() != self.zrefs.len() {
            return Err(EmuError::Str(format!(
                "Mismatch between the number zrefs [{}] and the number of outputfactors [{}]",
                self.zrefs.len(),
                ofs.len()
            )));
        }
        self.ssds.push(ssd);
        if self.table.is_empty() {
            for _ in 0..self.energies.len() {
                self.table.push(vec![]);
            }
        }
        let n = ofs.len();
        for ic in 0..n {
            let opt_col = self.table.get_mut(ic);
            if opt_col.is_none() {
                return Err(EmuError::Logic(format!(
                    "Expected table to have a column available at index [{}]",
                    ic
                )));
            }
            let col = opt_col.unwrap();
            // add output factor for the corresponding SSD.
            col.push(*ofs.get(ic).unwrap());
        }
        Ok(())
    }
// Add a list of output factors (one per energy) for a given SSD.
Add a list of output factors (one per energy) for a given SSD.
Add a list of output factors ( one per energy ) for a given SSD .
pub fn add_output_factor_per_ssd(&mut self, ssd: f64, ofs: Vec<f64>) -> Result<(), EmuError> {
        if ofs.len() != self.energies.len() {
            return Err(EmuError::Str(format!(
                "Mismatch between the number energies [{}] and the number of outputfactors [{}]",
                self.energies.len(),
                ofs.len()
            )));
        }
        if ofs.len() != self.zrefs.len() {
            return Err(EmuError::Str(format!(
                "Mismatch between the number zrefs [{}] and the number of outputfactors [{}]",
                self.zrefs.len(),
                ofs.len()
            )));
        }
        self.ssds.push(ssd);
        if self.table.is_empty() {
            for _ in 0..self.energies.len() {
                self.table.push(vec![]);
            }
        }
        let n = ofs.len();
        for ic in 0..n {
            let opt_col = self.table.get_mut(ic);
            if opt_col.is_none() {
                return Err(EmuError::Logic(format!(
                    "Expected table to have a column available at index [{}]",
                    ic
                )));
            }
            let col = opt_col.unwrap();
            // add output factor for the corresponding SSD.
            col.push(*ofs.get(ic).unwrap());
        }
        Ok(())
    }
pub fn add_output_factor_per_ssd ( & mut self , ssd : f64 , ofs : Vec < f64 > ) -> Result < ( ) , EmuError > { if ofs . len ( ) != self . energies . len ( ) { return Err ( EmuError :: Str ( format ! ( " " self energies len ( ) ofs len ( ) ) ) ) ; } if ofs . len ( ) != self . zrefs . len ( ) { return Err ( EmuError :: Str ( format ! ( " " self zrefs len ( ) ofs len ( ) ) ) ) ; } self . ssds . push ( ssd ) ; if self . table . is_empty ( ) { for _ in 0 .. self . energies . len ( ) { self . table . push ( vec ! [ ] ) ; } } let n = ofs . len ( ) ; for ic in 0 .. n { let opt_col = self . table . get_mut ( ic ) ; if opt_col . is_none ( ) { return Err ( EmuError :: Logic ( format ! ( " " ic ) ) ) ; } let col = opt_col . unwrap ( ) ; // add output factor for the corresponding SSD. col . push ( * ofs . get ( ic ) . unwrap ( ) ) ; } Ok ( ( ) ) }
Add a list of output factors (one per energy) for a given SSD.
Add a list of output factors ( one per energy ) for a given SSD .
&mut self
ssd
f64
ofs
Vec<f64>
&mut self
ssd
f64
ofs
Vec<f64>