reduceMeanByAxis method
Return Matrix.column of means of the elements of this
reduced by rows
(if axis
is 0) or columns
(if axis
is 1)
Implementation
Matrix reduceMeanByAxis(int axis) {
if (axis == 1) {
return Matrix.column(
List<double>.generate(m, (index) => getColumn(index).reduceMean()));
} else if (axis == 0) {
return Matrix.column(
List<double>.generate(n, (index) => getRow(index).reduceMean()));
} else {
throw Exception('Axis error: axis shoud be 0 or 1');
}
}