@@ -37,12 +37,15 @@ bsp_matrix_t bsp_convert_matrix(bsp_matrix_t matrix,
3737 // higher width for rowind. In order to keep rowind/colind the same type,
3838 // we might upcast.
3939
40- if (index_type == matrix .indices_0 .type ) {
41- result .indices_1 = bsp_copy_construct_array_t (matrix .indices_0 );
40+ if (index_type == matrix .indices_1 .type ) {
41+ result .indices_1 = bsp_copy_construct_array_t (matrix .indices_1 );
4242 } else {
43- result .indices_1 = bsp_construct_array_t (matrix .nnz , index_type );
44- for (size_t i = 0 ; i < matrix .nnz ; i ++ ) {
45- bsp_array_awrite (result .indices_1 , i , matrix .indices_0 , i );
43+ result .indices_1 =
44+ bsp_construct_array_t (matrix .indices_1 .size , index_type );
45+ for (size_t i = 0 ; i < matrix .indices_1 .size ; i ++ ) {
46+ size_t index ;
47+ bsp_array_read (matrix .indices_1 , i , index );
48+ bsp_array_write (result .indices_1 , i , index );
4649 }
4750 }
4851
@@ -103,12 +106,14 @@ bsp_matrix_t bsp_convert_matrix(bsp_matrix_t matrix,
103106 result .values = bsp_copy_construct_array_t (matrix .values );
104107
105108 if (index_type == matrix .indices_1 .type ) {
106- result .indices_0 = bsp_copy_construct_array_t (matrix .indices_1 );
109+ result .indices_1 = bsp_copy_construct_array_t (matrix .indices_1 );
107110 } else {
108- result .indices_0 = bsp_construct_array_t (matrix .nnz , index_type );
111+ result .indices_1 = bsp_construct_array_t (matrix .nnz , index_type );
109112
110113 for (size_t i = 0 ; i < matrix .nnz ; i ++ ) {
111- bsp_array_awrite (result .indices_0 , i , matrix .indices_1 , i );
114+ size_t index ;
115+ bsp_array_read (matrix .indices_1 , i , index );
116+ bsp_array_write (result .indices_1 , i , index );
112117 }
113118 }
114119
0 commit comments