2014-09-26 77 views
0

我一直试图在我继承的cython程序中跟踪段错误的来源。我已经通过执行gdb python3然后run my_file.py下python3实现GDB并得到了这一点:在python3上运行cython时出现段错误 - gdb输出

Program received signal SIGSEGV, Segmentation fault. 
__pyx_f_7sklearn_5utils_25graph_shortest_path_leftmost_sibling (__pyx_v_node=<optimised out>) 
at /home/my_name/.pyxbld/temp.linux-x86_64-3.4/pyrex/sklearn/utils/graph_shortest_path_strat.c:3195 
3195  __pyx_t_1 = (__pyx_v_temp->left_sibling != 0); 

感谢@Veedrac 呼叫显示如下:

landmark_points=[random.randint(0,kng.shape[0]) for r in range(self.number_landmark_points)]  
self.dist_matrix_=graph_shortest_path_strat(kng,landmark_points,method=self.path_method,directed=F‌​alse). 

基本上不是计算每一个之间的距离图中的单点我想计算所有点与阵列中定义的有限数量的点之间的距离。其中landmark_points是整数数组KNG是最近邻居

kng = kneighbors_graph(self.nbrs_, self.n_neighbors,mode='distance') 

的graph_shortest_path是.pyx代码的曲线图。我正在使用的版本是0.15.1

+0

由于@Veedrac landmark_points = [random.randint(0,kng.shape [0])对于r在范围(self.number_landmark_points)] self.dist_matrix_ = graph_shortest_path_strat(KNG,landmark_points,方法= self.path_method,定向=假)。基本上不是计算图中每个点之间的距离,我想计算所有点和数组中定义的有限数量的点之间的距离。 其中landmark_points是整数数组 KNG是最近邻居 KNG = kneighbors_graph的曲线图(self.nbrs_,self.n_neighbors,模式= '距离') – kat 2014-09-29 08:27:50

+0

的graph_shortest_path是.pyx代码。我使用的版本是0.15.1 – kat 2014-09-29 08:31:05

+0

oops,谢谢你已经完成了 – kat 2014-09-29 08:33:22

回答

0

@Veedrac感谢您的帮助。我实际上将错误追溯到我使用random.randint的事实,当时我应该使用random.sample生成唯一的随机整数。

相关问题