kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

this looks like where the function is defined #124

Open klg-2016 opened 1 year ago

klg-2016 commented 1 year ago

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/77fd055142e3cce389ea8f75d1bbda9bd17a282d/occupancy-mmpp-master/likelihood/likelihood.cpp#L74

I think all the "arma" in this code just refers to the armadillo package that it's using

klg-2016 commented 1 year ago

taking some additional C++ notes here: lines 8&9 define the namespace: "Namespace in C++ is the declarative part where the scope of identifiers like functions, the name of types, classes, variables, etc., are declared. The code generally has multiple libraries, and the namespace helps in avoiding the ambiguity that may occur when two identifiers have the same name."

klg-2016 commented 1 year ago

I think all the pind stuff starting ~line 85 is just because some of this work has to be done in a massive vector, and there's a matrix created in the fit_model script that is an "Indicator matrix to divide up single vector of parameters into subvectors for each parameter to estimate"

klg-2016 commented 1 year ago

regarding pind: this means that the C++ code and the R code for fitting the model are talking to each other, because as far as I can tell, pind is only defined in the R fit_model script.

klg-2016 commented 1 year ago

unsigned (line 96): "The unsigned keyword is a data type specifier, that makes a variable only represent non-negative integer numbers (positive numbers and zero). It can be applied only to the char , short , int and long types."

klg-2016 commented 1 year ago

more C++ thinking: "In computer science, array indices usually start at 0 in modern programming languages, so computer programmers might use zeroth in situations where others might use first, and so forth." I think this means that the (0,0) we talked about for an array (like pind) signifies the element in the first row, first column