subtraction method
Function is used when we want to compute the difference of two array.
var sub = m2d.subtraction([[1,1],[1,1]],[[2,2],[2,2]]);
print(sub);
//[[-1,-1],[-1,-1]]
Implementation
List subtraction(List list1, List list2) {
var list1Shape = shape(list1);
var list2Shape = shape(list2);
if (list1Shape.toString() != list2Shape.toString()) {
throw new Exception(
'operands could not be broadcast together with shapes $list1Shape $list2Shape');
}
var result = utlsubtraction(list1, list2);
return result;
}