-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9090d4
commit 3e9ca3d
Showing
9 changed files
with
192 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ src-x86_64 | |
releases | ||
build | ||
.directory | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include <R.h> | ||
#include <Rinternals.h> | ||
#include <R_ext/Rdynload.h> | ||
|
||
#include "cheddar.h" | ||
|
||
|
||
extern "C" | ||
{ | ||
|
||
static const R_CMethodDef cMethods[] = { | ||
{ | ||
"trophic_chains_size", (DL_FUNC) &trophic_chains_size, 8, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP | ||
} | ||
}, | ||
{ | ||
"print_chains", (DL_FUNC) &print_chains, 6, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP | ||
} | ||
}, | ||
{ | ||
"trophic_chains", (DL_FUNC) &trophic_chains, 9, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP | ||
} | ||
}, | ||
{ | ||
"trophic_chains_stats", (DL_FUNC) &trophic_chains_stats, 10, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, | ||
INTSXP | ||
} | ||
}, | ||
{ | ||
"shortest_paths", (DL_FUNC) &shortest_paths, 8, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, INTSXP, INTSXP, REALSXP, INTSXP, REALSXP, INTSXP | ||
} | ||
}, | ||
{ | ||
"sum_diet_gaps", (DL_FUNC) &sum_diet_gaps, 5, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, INTSXP, INTSXP, INTSXP | ||
} | ||
}, | ||
{ | ||
"minimise_sum_diet_gaps", (DL_FUNC) &minimise_sum_diet_gaps, 10, | ||
(R_NativePrimitiveArgType []) | ||
{ | ||
INTSXP, INTSXP, REALSXP, REALSXP, REALSXP, INTSXP, INTSXP, INTSXP, INTSXP, | ||
INTSXP | ||
} | ||
}, | ||
{NULL, NULL, 0, NULL}, | ||
}; | ||
|
||
void R_init_myLib(DllInfo *info) | ||
{ | ||
R_registerRoutines(info, cMethods, NULL, NULL, NULL); | ||
R_useDynamicSymbols(info, FALSE); | ||
} | ||
|
||
} // extern C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
extern "C" | ||
{ | ||
|
||
void sum_diet_gaps(const int *network, const int *nodes, | ||
const int *row_order, | ||
int *sum_diet_gaps, | ||
int *status); | ||
|
||
void minimise_sum_diet_gaps(const int *network, | ||
const int *nodes, | ||
const double *T_start, | ||
const double *T_stop, | ||
const double *c, | ||
const int *swaps_per_T, | ||
const int *trace_anneal, | ||
int *best_cost, | ||
int *best, | ||
int *status); | ||
|
||
void trophic_chains_size(const int *adjacency, | ||
const int *adjacency_length, | ||
const int *is_basal, | ||
const int *node_count, | ||
const int *test_overflow, | ||
const int *max_queue, | ||
int *n_chains, | ||
int *longest, | ||
int *status); | ||
|
||
void print_chains(const int *adjacency, | ||
const int *adjacency_length, | ||
const int *is_basal, | ||
const int *node_count, | ||
const int *max_queue, | ||
int *status); | ||
|
||
void trophic_chains(const int *adjacency, | ||
const int *adjacency_length, | ||
const int *is_basal, | ||
const int *node_count, | ||
const int *ncols, | ||
const int *nrows, | ||
const int *max_queue, | ||
int *chains, | ||
int *status); | ||
|
||
void trophic_chains_stats(const int *adjacency, | ||
const int *adjacency_length, | ||
const int *is_basal, | ||
const int *node_count, | ||
const int *n_chains, | ||
const int *longest, | ||
const int *max_queue, | ||
int *node_pos_counts, | ||
int *chain_lengths, | ||
int *status); | ||
|
||
void shortest_paths(const int *consumers, const int *consumers_length, | ||
const int *resources, const int *resources_length, | ||
const double *weights, | ||
const int *node_count, | ||
double *lengths, | ||
int *status); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.