traitecoevo / plant

Trait-Driven Models of Ecology and Evolution :evergreen_tree:
https://traitecoevo.github.io/plant
53 stars 20 forks source link

Problems with C to R connection #341

Closed pzylstra closed 2 years ago

pzylstra commented 2 years ago

On one PC, the function matrix_to_list returns the error "Row index is out of bounds: [index=0; row extent=-1309018960]". This appears to arise from the .Call component, although I'm currently investigating the function passed to it within strategy_list. The function worked on this PC in the same code until packages were updated. Have restored original packages and updated R, but the function continues to fail. What other, external programs does R use to link with C that could be causing this?

dfalster commented 2 years ago

@devmitch @aornugent the issue is with most recent changes to birth rate. This is really stopping @pzylstra progressing. Can you advise? Phil's trying to install latest code off develop branch.

@pzylstra can you post some example code to recreate the problem?

aornugent commented 2 years ago

I don't think matrix_to_list has been modified, but strategy_list has. Potentially there's some clash with @pzylstra's inputs that we didn't anticipate? An example would be great, thanks.

pzylstra commented 2 years ago

The error initially occurs when running this:

library(plant) library(dplyr)

plant::plant_log_console() params <- scm_base_parameters("FF16") FF16_hyperpar1 <- make_FF16_hyperpar()

patch <- expand_parameters(trait_matrix(x = c(lma = 0.7), trait_name = c("lma")), params, FF16_hyperpar1, mutant = FALSE)

aornugent commented 2 years ago

Strange. This doesn't throw any error on my machine. I'll call to debug.

pzylstra commented 2 years ago

I don't expect it would. That's the issue, it's only doing it on my machine, and it didn't before. I'll call you.

aornugent commented 2 years ago

This was fixed by recompiling the plant project. Happy days.

dfalster commented 2 years ago

Easy solution! Both frustrating and relieving all at once.