int main( int argc, char *argv[] ){ int n = 10; if( argc > 1 ){ n = atoi( argv[1] ); } int *A = genRandomData( n, 0, 1234 ); printf( "Before sort: \n" ); printArray( A, n ); merge_sort( A, 0, n ); printf( "\n\nAfter sort:\n" ); printArray( A, n ); delete[] A; return 0; }
void initObj_ttm(dim_t order, dim_t size[], dim_t isRandom, FLA_Obj* obj){ dim_t i; dim_t stride[FLA_MAX_ORDER]; dim_t nData; double* data; stride[0] = 1; for(i = 1; i < order; i++) stride[i] = stride[i-1]*size[i-1]; nData = 1; for(i = 0; i < order; i++) nData *= size[i]; if(isRandom == 1) data = genRandomData(order, size); else data = genSequentialData(order, size); FLA_Obj_create_tensor_without_buffer(FLA_DOUBLE, order, size, obj); FLA_Obj_attach_buffer_to_tensor(data, order, stride, obj); }