n4ze3m / matrix2d

A package for mathematical 2D array functions and manipulations in Dart, similar to NumPy
https://pub.dev/packages/matrix2d
MIT License
16 stars 3 forks source link

Methods should have a consistent I/O #9

Closed wall0159 closed 2 years ago

wall0159 commented 2 years ago

I'm new to Dart (looking at this package for numerical analysis) It looks like some of the methods (eg. reshape) accept and return a List whereas others (slice) require a List<List> so that the output of one method can't be passed to another

wall0159 commented 2 years ago

I'm not certain I'm doing this correctly :-), but this will reproduce

 var list = [
      [1, 2],
      [1, 2],
      [8, 5]
    ];
    var list2 = [
      [9, 2],
      [9, 2]
    ];
    var concat = m2d.concatenate(list,list2);
    print('concatenated: $res');

    concat.reshape(3, 4);
    //    List<List> ress = m2d.reshape(concat,3, 4);  // consistency with other methods would suggest this approach
    print('reshaped: $concat');
    print('res shape: ${concat.shape}');

    var sliceOfConcat = m2d.slice(concat, [2], [3]); // wrong input type
    print('slice: $sliceOfConcat');