2014-09-26 205 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生成唯一的隨機整數。

相關問題