ryant26 / ece420Lab4

0 stars 2 forks source link

Create set of matrix utilities to store a matrix in row major form #1

Closed ryant26 closed 8 years ago

ryant26 commented 8 years ago

The way we have worked with matrices in this class so far wont work well with MPI's communication functionality. We need to store the matrix in row major form (a way to store a matrix in 1 contiguous block of memory, that is, a single array).

The supporting operations we need for this are:

double get_element(int i, int j);
void set_element(int i, int j, double value);

// The matrix argument would be just a pointer
// That is, it has not already been malloc'd
// mallocing the memory would be the job of create_matrix
void create_matrix(double ***matrix, int height, int width);

The utility to read in matrices would have to be adapted to use this.

ryant26 commented 8 years ago

This goes with #3

ryant26 commented 8 years ago

Didn't make these signatures correctly when opened the issue.

double get_element(double*A, int row_size, int i, int j);
void set_element(double*A, int row_size, int i, int j, double value);

// The matrix argument would be just a pointer
// That is, it has not already been malloc'd
// mallocing the memory would be the job of create_matrix
void create_matrix(double ***matrix, int height, int width);
ryant26 commented 8 years ago

I did a quick and dirty implementation of this right in utilities.Needs some cleaning up and documentation but you can take a look at it if you are stuck at all.

Also this version of "init_edge_matrix" inserts the number of outgoing edges.

utilities.c

ryant26 commented 8 years ago

I apologize if you got very far on this, I didn't mean to step on your toes. But I pretty much had to implement this to move forward with testing the algorithm so I'm just going to close this.