44
55#include " singlepp/singlepp.hpp"
66#include " tatami/tatami.hpp"
7+ #include " sanisizer/sanisizer.hpp"
78#include " pybind11/pybind11.h"
89
910#include < vector>
1213
1314pybind11::list find_classic_markers (uint32_t num_labels, uint32_t num_genes, const pybind11::list& reference, const pybind11::list& labels, int de_n, int nthreads) {
1415 size_t num_ref = reference.size ();
15- if (num_ref != static_cast < size_t >( labels.size ())) {
16+ if (! sanisizer::is_equal (num_ref, labels.size ())) {
1617 throw std::runtime_error (" 'ref' and 'labels' should have the same length" );
1718 }
1819
@@ -24,13 +25,13 @@ pybind11::list find_classic_markers(uint32_t num_labels, uint32_t num_genes, con
2425 for (size_t r = 0 ; r < num_ref; ++r) {
2526 auto ptr = mattress::cast (reference[r].cast <uintptr_t >())->ptr .get ();
2627 ref_ptrs.emplace_back (ptr);
27- if (ptr->nrow () != num_genes) {
28+ if (! sanisizer::is_equal ( ptr->nrow (), num_genes) ) {
2829 throw std::runtime_error (" each entry of 'ref' should have number of rows equal to 'ngenes'" );
2930 }
3031
3132 // No copy, so it's fine to create a pointer and discard the casted array.
3233 auto lab = labels[r].cast <pybind11::array>();
33- if (lab.size () != static_cast < size_t >( ptr->ncol ())) {
34+ if (! sanisizer::is_equal ( lab.size (), ptr->ncol ())) {
3435 throw std::runtime_error (" number of columns in each 'ref' should equal the length of the corresponding entry of 'labels'" );
3536 }
3637
0 commit comments