norm method
returns a list with elements standarized to have a ||x||₂ = 1
Implementation
List<double> norm() {
double acc = 0.0;
for (var e in this) {
acc += e * e;
}
final double normFactor = 1 / math.sqrt(acc);
final res = List<double>.filled(length, 0);
int counter = 0;
for (var e in this) {
res[counter] = e * normFactor;
counter++;
}
return res;
}