get some speed gains for mixtures thru a bit more complexity
This commit is contained in:
		
							parent
							
								
									3ca32655d5
								
							
						
					
					
						commit
						7d59beb4bf
					
				
							
								
								
									
										6
									
								
								fermi.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								fermi.go
									
									
									
									
									
								
							|  | @ -382,7 +382,7 @@ func parseMixture(words []string, vars map[string]Dist) (Dist, error) { | |||
| 
 | ||||
| 	var dists []Dist | ||||
| 	var fs []func(int, sample.State) float64 | ||||
| 	var ss [][]float64 | ||||
| 	// var ss [][]float64
 | ||||
| 	var weights []float64 | ||||
| 
 | ||||
| 	for i, word := range words { | ||||
|  | @ -391,12 +391,12 @@ func parseMixture(words []string, vars map[string]Dist) (Dist, error) { | |||
| 			if !exists { | ||||
| 				return nil, printAndReturnErr("Expected mixture variable but didn't get a variable. \nMixture syntax: \nmx x 2.5 y 8 z 10\ni.e.: mx var weight var2 weight2 ... var_n weight_n") | ||||
| 			} | ||||
| 			samples := dist.Samples() | ||||
| 			// samples := dist.Samples()
 | ||||
| 			f := dist.Sampler | ||||
| 			// Inefficient to draw N_SAMPLES for each of the distributions, but conceptually simpler.
 | ||||
| 			dists = append(dists, dist) | ||||
| 			fs = append(fs, f) | ||||
| 			ss = append(ss, samples) | ||||
| 			// ss = append(ss, samples)
 | ||||
| 		} else { | ||||
| 			weight, err := pretty.ParseFloat(word) | ||||
| 			if err != nil { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user