I’m new to rust and just started diving in to nalgebra this weekend. I wrote a naive version of softmax to get more familiar with nalgebra. Curious if anyone has advice in whether my implementation could be better?

Here is a python example as reference:

```
def softmax(x):
return np.exp(x) / np.sum(np.exp(x), axis=0)
```

Here is my nalgebra example using just a 4x4 matrix:

```
fn softmax(m: &mut Matrix4<f64>) {
m.apply(|v| v.exp());
let mut v4 = Vector4::zeros();
let (r, c) = m.shape();
for idx in 0..c {
let cm = m.column_mut(idx);
let sum = cm.iter().fold(0.0, |sum, val| sum + val);
v4[idx] = sum;
}
for rw in 0..r {
let mut rv = RowVector4::zeros();
for (col, val) in v4.iter().enumerate() {
let ij = m.row(rw).column(col)[0];
rv[col] = ij / val;
}
m.set_row(rw, &rv);
}
}
```