@@ -37,12 +37,15 @@ bsp_matrix_t bsp_convert_matrix(bsp_matrix_t matrix,
37
37
// higher width for rowind. In order to keep rowind/colind the same type,
38
38
// we might upcast.
39
39
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 );
42
42
} 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 );
46
49
}
47
50
}
48
51
@@ -103,12 +106,14 @@ bsp_matrix_t bsp_convert_matrix(bsp_matrix_t matrix,
103
106
result .values = bsp_copy_construct_array_t (matrix .values );
104
107
105
108
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 );
107
110
} 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 );
109
112
110
113
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 );
112
117
}
113
118
}
114
119
0 commit comments