mrc-ide / odin.dust

Compile odin to dust
https://mrc-ide.github.io/odin.dust
Other
3 stars 1 forks source link

Detect use of sum without partial sums used #63

Closed richfitz closed 3 years ago

richfitz commented 3 years ago

This fails:

  gen <- odin.dust::odin_dust({
    len <- user(integer = TRUE)
    mean <- user(0)
    sd <- user(1)
    x[] <- rnorm(mean, sd)
    initial(z) <- 0
    update(z) <- z + sum(x)
    dim(x) <- len
  }, verbose = TRUE)

with

   dust.cpp: In member function ‘void odin::update(size_t, const real_t*, dust::rng_state_t<double>&, odin::real_t*)’:
   dust.cpp:42:25: error: ‘odin_sum1’ was not declared in this scope
      42 |     state_next[0] = z + odin_sum1(internal.x.data(), 0, shared->dim_x);
         |                         ^~~~~~~~~
   make: *** [/usr/lib/R/etc/Makeconf:181: dust.o] Error 1
   ERROR: compilation failed for package ‘odin4d615a16’

we're not including odin_sum1 somehow