How to update a cell in a matrix


#1

Hi,

I have a matrix defined as such:

     let mut A = DMatrix::from_iterator(
        observed_count,
        self.max_df_lag,
        a
        .iter()
        .cloned(),
        );

this is e.g. a 8x4 matrix with zeros;

How do change e.g. Row 2 Col 1 to value of 99?

A[1][0] = 99;

Thanks


#2

Hi!

You can index by a tuple: A[(1, 0)] = 99.