Hi everyone,
I´m taking a programming class and currently we´re doing data structures. Today, we discussed how to save square matrices column-wise with data structures. The teacher said that after the first few steps where you declare the structure, allocate the matrix, free it and get the dimension (which mostly make sense to me I think), you have to "get" and "set" the matrix by putting in something like
Code:
void setMatrixEntry(Matrix* A, int i, int j, double Aij)
{
A->entries[i+j*A->m] = Aij;
}
double getMatrixEntry(Matrix* A, int i, int j)
{
return A->entries[i+j*A->m]
}
I´m really confused here because I can´t figure out what "A->entry[i+j*A->m] = Aij;" and "return A->entry[i+j*A->m]" do exactly or how you get to them.
I´d be really grateful for any help!