You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation fault (random) when using xf::iselect or xf::ilocate #230
I have a piece of code where I try to slice a xframe object by rows and columns indexes. using 3 dynamic integer thresholds. When I try to slice with either xf::iselect or xf::ilocate I get random segmentation faults at
xt::xkeep_slice<long>::operator()(long) const
This is the code where I perform the slicing:
const auto data_value = m_data.data().value();
const auto row_sums = xt::sum(xt::greater(data_value, threshold1), 1);
const auto row_indexes = xt::ravel_indices<xt::ravel_vector_tag>(
xt::argwhere(xt::equal(row_sums > threshold_2, 1)), row_sums.shape());
const auto col_sums = xt::sum(xt::greater(data_value, threshold_1), 0);
const auto col_indexes = xt::ravel_indices<xt::ravel_vector_tag>(
xt::argwhere(xt::equal(col_sums > threshold_3, 1)), col_sums.shape());
variable_type data = xf::ilocate(m_data, xf::ikeep(row_indexes), xf::ikeep(col_indexes));
I am using the latest version of xframe (0.2.0) and xtensor (0.20.7)
Sometimes I get the segmentation fault the first time sometimes it happens the 4th or 5th time I apply the slicing.
242 rows and 16251 columns.
Types of labels is xf::fstring which I create from std::string::c_str() when parsing the input file
The cells type is double. One could just create random labels and random values and call the slicing piece of code several times with different values for the threshold variables. The error should hopefully happen then.
I can add that I am working on a Mac (most recent clang version).
Here is how I create the xframe object
using axis_type = xf::xaxis<xf::fstring>;
using coordinate_type = xf::xcoordinate<xf::fstring>;
using dimension_type = xf::xdimension<xf::fstring>;
using variable_type = xf::xvariable<double, coordinate_type>;
using data_type = variable_type::data_type;
using shape_type = data_type::shape_type;
std::vector<std::vector<double>> values;
std::vector<xf::fstring> genes;
std::vector<xf::fstring> spots;
// parse file and populate vectors
auto spot_axis = axis_type(spots);
auto gene_axis = axis_type(genes);
auto coord = coordinate_type({{"spots", spot_axis}, {"genes", gene_axis}});
auto dim = dimension_type({"spots", "genes"});
auto dataframe = variable_type(data, coord, dim);
Activity
JohanMabille commentedon May 21, 2019
Thanks for reporting!
I'll have a look this week, can you precise the shape of
m_dataand the type of labels?jfnavarro commentedon May 21, 2019
Thanks!
242 rows and 16251 columns.
Types of labels is xf::fstring which I create from std::string::c_str() when parsing the input file
The cells type is double. One could just create random labels and random values and call the slicing piece of code several times with different values for the threshold variables. The error should hopefully happen then.
I can add that I am working on a Mac (most recent clang version).
Here is how I create the xframe object
jfnavarro commentedon Jun 27, 2019
I also noticed that xf::ilocate() seg. faults when I invoke it with only row indexes or column indexes.
data = xf::ilocate(data, xf::ikeep(vector_idx), xf::iall());or
data = xf::ilocate(data, xf::iall(), xf::ikeep(vector_idx));