ext/nmatrix/storage/dense/dense.cpp in nmatrix-0.1.0.rc2 vs ext/nmatrix/storage/dense/dense.cpp in nmatrix-0.1.0.rc3

- old
+ new

@@ -740,11 +740,10 @@ for (size_t i = 0; i < s->dim; ++i) { coords_out[i] = (temp_pos - temp_pos % s->stride[i])/s->stride[i] - s->offset[i]; temp_pos = temp_pos % s->stride[i]; } - } /* * Calculate the stride length. */ @@ -832,20 +831,17 @@ */ STORAGE* nm_dense_storage_copy_transposed(const STORAGE* rhs_base) { DENSE_STORAGE* rhs = (DENSE_STORAGE*)rhs_base; nm_dense_storage_register(rhs); - size_t *shape = NM_ALLOC_N(size_t, rhs->dim); - // swap shape and offset + // swap shape shape[0] = rhs->shape[1]; shape[1] = rhs->shape[0]; DENSE_STORAGE *lhs = nm_dense_storage_create(rhs->dtype, shape, rhs->dim, NULL, 0); - lhs->offset[0] = rhs->offset[1]; - lhs->offset[1] = rhs->offset[0]; nm_dense_storage_register(lhs); if (rhs_base->src == rhs_base) { nm_math_transpose_generic(rhs->shape[0], rhs->shape[1], rhs->elements, rhs->shape[1], lhs->elements, lhs->shape[1], DTYPE_SIZES[rhs->dtype]); @@ -914,11 +910,10 @@ nm_dense_storage_register(rhs); nm_dense_storage_register(lhs); LDType* lhs_els = reinterpret_cast<LDType*>(lhs->elements); RDType* rhs_els = reinterpret_cast<RDType*>(rhs->elements); - - size_t count = nm_storage_count_max_elements(lhs); + size_t count = nm_storage_count_max_elements(lhs);; size_t* temp_coords = NM_ALLOCA_N(size_t, lhs->dim); size_t coord_swap_temp; while (count-- > 0) { nm_dense_storage_coords(lhs, count, temp_coords);