Exercise 4 for the course "Parallel and distributed systems" of THMMY in AUTH university.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
814 B

#ifndef CSR_SPARSE_MATRIX_H /* Include guard */
#define CSR_SPARSE_MATRIX_H
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct csrSparseMatrix {
int size, numberOfNonZeroElements;
int *rowCumulativeIndexes, *columnIndexes;
double *values;
} CsrSparseMatrix;
CsrSparseMatrix initCsrSparseMatrix();
void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int numberOfElements);
void zeroOutRow(CsrSparseMatrix *sparseMatrix, int row);
void zeroOutColumn(CsrSparseMatrix *sparseMatrix, int column);
void csrSparseMatrixVectorMultiplication(CsrSparseMatrix sparseMatrix,
double *vector, double **product, int vectorSize);
void destroyCsrSparseMatrix(CsrSparseMatrix *sparseMatrix);
void printCsrSparseMatrix(CsrSparseMatrix sparseMatrix);
#endif // CSR_SPARSE_MATRIX_H