• Philippe Veber's avatar
    tk/Mutsel_cpg_simulator: avoid recomputing most of the rate vectors · 8ac66b28
    Philippe Veber authored
    only recompute what is affected by the state change at some
    position. Complexity is still quadratic from having to sample from all
    positions, but the constant is about 300 times better than last commit.
    
    > df <- data.frame(n = c(10000,13000,20000,23000,30000), t = c(5.03,7.53,16.84,21.58,36.12)) ; fit <- lm(t ~ I(n ^ 2), data = df) ; summary(fit)
    
    Call:
    lm(formula = t ~ I(n^2), data = df)
    
    Residuals:
           1        2        3        4        5
     0.05330 -0.13314  0.18311 -0.09938 -0.00389
    
    Coefficients:
                 Estimate Std. Error t value Pr(>|t|)
    (Intercept) 1.083e+00  1.161e-01   9.335   0.0026 **
    I(n^2)      3.893e-08  2.286e-10 170.301 4.46e-07 ***
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    
    Residual standard error: 0.146 on 3 degrees of freedom
    Multiple R-squared:  0.9999,	Adjusted R-squared:  0.9999
    F-statistic: 2.9e+04 on 1 and 3 DF,  p-value: 4.464e-07
    8ac66b28
mutsel_simulator_cpg.ml 9.8 KB