Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly initialise initial arrays from time-dependent variables #84

Closed
richfitz opened this issue Jan 5, 2018 · 1 comment
Closed

Directly initialise initial arrays from time-dependent variables #84

richfitz opened this issue Jan 5, 2018 · 1 comment

Comments

@richfitz
Copy link
Member

@richfitz richfitz commented Jan 5, 2018

  gen <- odin::odin({
    initial(x1) <- norm_rand()
    r <- x1 * 2
    initial(x2[]) <- r + 1

    update(x1) <- x1
    update(x2[]) <- x2[i]

    dim(x2) <- 10
    config(base) <- "bug"
  })

throws

Error in 1L:after : result would be too long a vector
In addition: Warning message:
In max(which(names(time) == iv)) :
  no non-missing arguments to max; returning -Inf
> traceback()
5: append(time, tmp, at) at generate2.R#299
4: odin_generate2_initial(obj) at generate.R#34
3: odin_generate(dat, dest) at interface.R#141
2: odin_(xx, dest, build, verbose, compiler_warnings) at interface.R#130
1: odin::odin({
       initial(x1) <- norm_rand()
       r <- x1 * 2
       initial(x2[]) <- r + 1
       update(x1) <- x1
       update(x2[]) <- x2[i]
       dim(x2) <- 10
       config(base) <- "bug"
   }, verbose = TEST_VERBOSE)
@richfitz
Copy link
Member Author

@richfitz richfitz commented Jan 5, 2018

possible workaround for now is to edit odin_generate2_initial with

         if (any(!j)) {
+          stop("This is currently broken, though some models may work?")
@richfitz richfitz changed the title Directly initialise initial arrays Directly initialise initial arrays from time-dependent variables Jan 5, 2018
@richfitz richfitz mentioned this issue Mar 18, 2019
@richfitz richfitz closed this Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.