Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RcppTskit/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ and releases adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html

- Turn vignette URL as hyperlinks and similar cosmetics.
- State mirroring of the `R/Python` APIs and `C++/C` APIs across the package.
- Update tskit C to 1.3.1
- TODO

## [0.2.0] - 2026-02-22
Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/inst/include/tskit/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1
2 changes: 1 addition & 1 deletion RcppTskit/inst/include/tskit/tskit/VERSION_kastore.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.1
2.1.2
10 changes: 5 additions & 5 deletions RcppTskit/inst/include/tskit/tskit/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern "C" {

#ifdef __GNUC__
#define TSK_WARN_UNUSED __attribute__((warn_unused_result))
#define TSK_UNUSED(x) TSK_UNUSED_##x __attribute__((__unused__))
#define TSK_UNUSED(x) TSK_UNUSED_##x __attribute__((__unused__))
#else
#define TSK_WARN_UNUSED
#define TSK_UNUSED(x) TSK_UNUSED_##x
Expand Down Expand Up @@ -93,11 +93,11 @@ missing data.
* on the thread above.
*/
typedef int64_t tsk_id_t;
#define TSK_MAX_ID INT64_MAX - 1
#define TSK_MAX_ID INT64_MAX - 1
#define TSK_ID_STORAGE_TYPE KAS_INT64
#else
typedef int32_t tsk_id_t;
#define TSK_MAX_ID INT32_MAX - 1
#define TSK_MAX_ID INT32_MAX - 1
#define TSK_ID_STORAGE_TYPE KAS_INT32
#endif

Expand All @@ -109,7 +109,7 @@ The ``tsk_size_t`` type is an unsigned integer used for any size or count value.
@endrst
*/
typedef uint64_t tsk_size_t;
#define TSK_MAX_SIZE UINT64_MAX
#define TSK_MAX_SIZE UINT64_MAX
#define TSK_SIZE_STORAGE_TYPE KAS_UINT64

/**
Expand Down Expand Up @@ -152,7 +152,7 @@ to the API or ABI are introduced, i.e., the addition of a new function.
The library patch version. Incremented when any changes not relevant to the
to the API or ABI are introduced, i.e., internal refactors of bugfixes.
*/
#define TSK_VERSION_PATCH 0
#define TSK_VERSION_PATCH 1
/** @} */

/*
Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/inst/include/tskit/tskit/kastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ to the API or ABI are introduced, i.e., the addition of a new function.
The library patch version. Incremented when any changes not relevant to the
to the API or ABI are introduced, i.e., internal refactors of bugfixes.
*/
#define KAS_VERSION_PATCH 1
#define KAS_VERSION_PATCH 2
/** @} */

#define KAS_HEADER_SIZE 64
Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/inst/include/tskit/tskit/tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -4607,7 +4607,7 @@ tsk_id_t tsk_table_collection_check_integrity(
/* Undocumented methods */

/* Flags for ibd_segments */
#define TSK_IBD_STORE_PAIRS (1 << 0)
#define TSK_IBD_STORE_PAIRS (1 << 0)
#define TSK_IBD_STORE_SEGMENTS (1 << 1)

/* TODO be systematic about where "result" should be in the params
Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/inst/include/tskit/tskit/trees.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ sequence.
@endrst

@param self A pointer to a tsk_treeseq_t object.
@return Returns a pointer to the time units.
@return Returns a pointer to the null-terminated file uuid.
*/
const char *tsk_treeseq_get_file_uuid(const tsk_treeseq_t *self);

Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/src/tskit/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1
2 changes: 1 addition & 1 deletion RcppTskit/src/tskit/VERSION_kastore.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.1
2.1.2
4 changes: 2 additions & 2 deletions RcppTskit/src/tskit/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ tsk_search_sorted(const double *restrict array, tsk_size_t size, double value)
upper = mid;
}
}
offset = (int64_t)(array[lower] < value);
return (tsk_size_t)(lower + offset);
offset = (int64_t) (array[lower] < value);
return (tsk_size_t) (lower + offset);
}

/* Rounds the specified double to the closest multiple of 10**-num_digits. If
Expand Down
12 changes: 6 additions & 6 deletions RcppTskit/src/tskit/haplotype_matching.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,15 +572,15 @@ static inline bool
element_in(
const uint64_t *restrict A, tsk_id_t u, const tsk_id_t state, tsk_size_t num_words)
{
tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t)(state / 64);
tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t) (state / 64);
return (A[index] & (1ULL << (state % 64))) != 0;
}

static inline void
set_optimal_value(
uint64_t *restrict A, tsk_id_t u, const tsk_size_t num_words, tsk_id_t state)
{
tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t)(state / 64);
tsk_size_t index = ((tsk_size_t) u) * num_words + (tsk_size_t) (state / 64);
tsk_bug_assert(((tsk_size_t) state) / 64 < num_words);
A[index] |= 1ULL << (state % 64);
}
Expand Down Expand Up @@ -815,7 +815,7 @@ tsk_ls_hmm_redistribute_transitions(tsk_ls_hmm_t *self)
* iterating over the roots. See the existing parsimony implementations
* for an example. */
for (root = tsk_tree_get_left_root(&self->tree); root != TSK_NULL;
root = right_sib[root]) {
root = right_sib[root]) {
stack[0].tree_node = root;
stack[0].old_state = T_old[T_index[root]].value_index;
stack[0].new_state
Expand Down Expand Up @@ -966,7 +966,7 @@ tsk_ls_hmm_run_forward(tsk_ls_hmm_t *self, int32_t *haplotype)
}

for (t_ret = tsk_tree_first(&self->tree); t_ret == TSK_TREE_OK;
t_ret = tsk_tree_next(&self->tree)) {
t_ret = tsk_tree_next(&self->tree)) {
ret = tsk_ls_hmm_update_tree(self, TSK_DIR_FORWARD);
if (ret != 0) {
goto out;
Expand Down Expand Up @@ -1166,7 +1166,7 @@ tsk_ls_hmm_run_backward(
}

for (t_ret = tsk_tree_last(&self->tree); t_ret == TSK_TREE_OK;
t_ret = tsk_tree_prev(&self->tree)) {
t_ret = tsk_tree_prev(&self->tree)) {
ret = tsk_ls_hmm_update_tree(self, TSK_DIR_REVERSE);
if (ret != 0) {
goto out;
Expand Down Expand Up @@ -1492,7 +1492,7 @@ tsk_compressed_matrix_decode(tsk_compressed_matrix_t *self, double *values)
}

for (t_ret = tsk_tree_first(&tree); t_ret == TSK_TREE_OK;
t_ret = tsk_tree_next(&tree)) {
t_ret = tsk_tree_next(&tree)) {
ret = tsk_tree_get_sites(&tree, &sites, &num_tree_sites);
if (ret != 0) {
goto out;
Expand Down
48 changes: 24 additions & 24 deletions RcppTskit/src/tskit/tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ check_offset_overflow(tsk_size_t current_size, tsk_size_t additional_elements)
|| current_size > (max_val - additional_elements);
}

#define TSK_NUM_ROWS_UNSET ((tsk_size_t) -1)
#define TSK_NUM_ROWS_UNSET ((tsk_size_t) - 1)
#define TSK_MAX_COL_NAME_LEN 64

static int
Expand Down Expand Up @@ -8255,8 +8255,8 @@ pair_to_integer(tsk_id_t a, tsk_id_t b, tsk_size_t N)
static inline void
integer_to_pair(int64_t index, tsk_size_t N, tsk_id_t *a, tsk_id_t *b)
{
*a = (tsk_id_t)(index / (int64_t) N);
*b = (tsk_id_t)(index % (int64_t) N);
*a = (tsk_id_t) (index / (int64_t) N);
*b = (tsk_id_t) (index % (int64_t) N);
}

static int64_t
Expand Down Expand Up @@ -8997,7 +8997,7 @@ simplifier_check_state(simplifier_t *self)
for (j = 0; j < self->input_tables.nodes.num_rows; j++) {
last_position = -1;
for (list_node = self->node_mutation_list_map_head[j]; list_node != NULL;
list_node = list_node->next) {
list_node = list_node->next) {
tsk_bug_assert(
self->input_tables.mutations.node[list_node->mutation] == (tsk_id_t) j);
site = self->input_tables.mutations.site[list_node->mutation];
Expand Down Expand Up @@ -9028,7 +9028,7 @@ simplifier_check_state(simplifier_t *self)
child = self->buffered_children[j];
tsk_bug_assert(self->child_edge_map_head[child] != NULL);
for (int_list = self->child_edge_map_head[child]; int_list != NULL;
int_list = int_list->next) {
int_list = int_list->next) {
tsk_bug_assert(int_list->left < int_list->right);
if (int_list->next != NULL) {
tsk_bug_assert(int_list->right < int_list->next->left);
Expand Down Expand Up @@ -9108,7 +9108,7 @@ simplifier_print_state(simplifier_t *self, FILE *out)
child = self->buffered_children[j];
fprintf(out, "%lld -> ", (long long) j);
for (int_list = self->child_edge_map_head[child]; int_list != NULL;
int_list = int_list->next) {
int_list = int_list->next) {
fprintf(out, "(%f, %f), ", int_list->left, int_list->right);
}
fprintf(out, "\n");
Expand All @@ -9123,7 +9123,7 @@ simplifier_print_state(simplifier_t *self, FILE *out)
if (self->node_mutation_list_map_head[j] != NULL) {
fprintf(out, "%lld\t-> [", (long long) j);
for (list_node = self->node_mutation_list_map_head[j]; list_node != NULL;
list_node = list_node->next) {
list_node = list_node->next) {
fprintf(out, "%lld,", (long long) list_node->mutation);
}
fprintf(out, "]\n");
Expand Down Expand Up @@ -10187,7 +10187,7 @@ simplifier_insert_input_roots(simplifier_t *self)
const double *node_time = self->tables->nodes.time;

for (input_id = 0; input_id < (tsk_id_t) self->input_tables.nodes.num_rows;
input_id++) {
input_id++) {
x = self->ancestor_map_head[input_id];
if (x != NULL) {
output_id = self->node_id_map[input_id];
Expand Down Expand Up @@ -10736,11 +10736,11 @@ tsk_table_collection_check_individual_integrity(

for (j = 0; j < (tsk_size_t) num_individuals; j++) {
for (k = individuals.parents_offset[j]; k < individuals.parents_offset[j + 1];
k++) {
k++) {
/* Check parent references are valid */
if (individuals.parents[k] != TSK_NULL
&& (individuals.parents[k] < 0
|| individuals.parents[k] >= num_individuals)) {
|| individuals.parents[k] >= num_individuals)) {
ret = tsk_trace_error(TSK_ERR_INDIVIDUAL_OUT_OF_BOUNDS);
goto out;
}
Expand Down Expand Up @@ -11250,20 +11250,20 @@ tsk_table_collection_equals(const tsk_table_collection_t *self,
if (!(options & TSK_CMP_IGNORE_TABLES)) {
ret = ret
&& tsk_individual_table_equals(
&self->individuals, &other->individuals, options)
&self->individuals, &other->individuals, options)
&& tsk_node_table_equals(&self->nodes, &other->nodes, options)
&& tsk_edge_table_equals(&self->edges, &other->edges, options)
&& tsk_migration_table_equals(
&self->migrations, &other->migrations, options)
&self->migrations, &other->migrations, options)
&& tsk_site_table_equals(&self->sites, &other->sites, options)
&& tsk_mutation_table_equals(&self->mutations, &other->mutations, options)
&& tsk_population_table_equals(
&self->populations, &other->populations, options);
&self->populations, &other->populations, options);
/* TSK_CMP_IGNORE_TABLES implies TSK_CMP_IGNORE_PROVENANCE */
if (!(options & TSK_CMP_IGNORE_PROVENANCE)) {
ret = ret
&& tsk_provenance_table_equals(
&self->provenances, &other->provenances, options);
&self->provenances, &other->provenances, options);
}
}
/* TSK_CMP_IGNORE_TS_METADATA is implied by TSK_CMP_IGNORE_METADATA */
Expand All @@ -11273,19 +11273,19 @@ tsk_table_collection_equals(const tsk_table_collection_t *self,
if (!(options & TSK_CMP_IGNORE_TS_METADATA)) {
ret = ret
&& (self->metadata_length == other->metadata_length
&& self->metadata_schema_length == other->metadata_schema_length
&& tsk_memcmp(self->metadata, other->metadata,
self->metadata_length * sizeof(char))
== 0
&& tsk_memcmp(self->metadata_schema, other->metadata_schema,
self->metadata_schema_length * sizeof(char))
== 0);
&& self->metadata_schema_length == other->metadata_schema_length
&& tsk_memcmp(self->metadata, other->metadata,
self->metadata_length * sizeof(char))
== 0
&& tsk_memcmp(self->metadata_schema, other->metadata_schema,
self->metadata_schema_length * sizeof(char))
== 0);
}

if (!(options & TSK_CMP_IGNORE_REFERENCE_SEQUENCE)) {
ret = ret
&& tsk_reference_sequence_equals(
&self->reference_sequence, &other->reference_sequence, options);
&self->reference_sequence, &other->reference_sequence, options);
}
return ret;
}
Expand Down Expand Up @@ -12057,7 +12057,7 @@ tsk_table_collection_dumpf(
{ "format/name", (const void *) &TSK_FILE_FORMAT_NAME,
TSK_FILE_FORMAT_NAME_LENGTH, KAS_INT8 },
{ "format/version",
(const void *) &(uint32_t[]){
(const void *) &(uint32_t[]) {
TSK_FILE_FORMAT_VERSION_MAJOR, TSK_FILE_FORMAT_VERSION_MINOR },
2, KAS_UINT32 },
{ "sequence_length", (const void *) &self->sequence_length, 1, KAS_FLOAT64 },
Expand Down Expand Up @@ -13302,7 +13302,7 @@ tsk_table_collection_union(tsk_table_collection_t *self,
/* Now we know the full individual map we can remap the parents of the new
* individuals*/
for (k = (tsk_id_t) self->individuals.parents_offset[num_individuals_self];
k < (tsk_id_t) self->individuals.parents_length; k++) {
k < (tsk_id_t) self->individuals.parents_length; k++) {
if (self->individuals.parents[k] != TSK_NULL) {
self->individuals.parents[k] = individual_map[self->individuals.parents[k]];
}
Expand Down
Loading
Loading