normalize no longer takes explicit sum, so that it normalizes correctly
							parent
							
								
									c26b272d80
								
							
						
					
					
						commit
						acda56d67b
					
				| 
						 | 
				
			
			@ -234,12 +234,9 @@ namespace gtsam {
 | 
			
		|||
     * @brief Helper method to perform normalization such that all leaves in the
 | 
			
		||||
     * tree sum to 1
 | 
			
		||||
     *
 | 
			
		||||
     * @param sum
 | 
			
		||||
     * @return AlgebraicDecisionTree
 | 
			
		||||
     */
 | 
			
		||||
    AlgebraicDecisionTree normalize(double sum) const {
 | 
			
		||||
      return this->apply([&sum](const double& x) { return x / sum; });
 | 
			
		||||
    }
 | 
			
		||||
    AlgebraicDecisionTree normalize() const { return (*this) / this->sum(); }
 | 
			
		||||
 | 
			
		||||
    /// Find the minimum values amongst all leaves
 | 
			
		||||
    double min() const {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -562,7 +562,7 @@ TEST(ADT, Sum) {
 | 
			
		|||
TEST(ADT, Normalize) {
 | 
			
		||||
  ADT a = exampleADT();
 | 
			
		||||
  double sum = a.sum();
 | 
			
		||||
  auto actual = a.normalize(sum);
 | 
			
		||||
  auto actual = a.normalize();
 | 
			
		||||
 | 
			
		||||
  DiscreteKey A(0, 2), B(1, 3), C(2, 2);
 | 
			
		||||
  DiscreteKeys keys = DiscreteKeys{A, B, C};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue