distance method
Computes the distance between this matrix and another provided matrix based on the specified distance type.
other: The other matrix to which the distance will be calculated.
distance: The type of distance measure to be used. Default is Frobenius norm.
Returns the distance as a double.
Example:
var A = Matrix.fromList([
[3, 2, 2],
[2, 3, -2]
]);
var B = Matrix.fromList([
[1, 2, 3],
[4, 5, 6]
]);
print(A.distance(B, distanceType: DistanceType.manhattan));
// Output: 10.5
Note: The output may vary due to numerical precision.
Throws Exception if the matrices have different dimensions.
Implementation
dynamic distance(Matrix other,
{DistanceType distance = DistanceType.frobenius}) {
return Matrix.distance(this, other, distance: distance);
}