sort method
Implementation
List sort(List list, {bool? desc = false}) {
List shape = getDim(list);
List flat = flatten(list);
if (flat.contains(true) || flat.contains(false)) {
throw new Exception(
"DartTensorException : Cannot sort boolean elements.");
}
if (desc == false) {
flat.sort((a, b) => a.compareTo(b));
} else {
flat.sort((b, a) => a.compareTo(b));
}
List temp = generate(flat, shape);
return temp;
}