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.
31 lines
1.1 KiB
31 lines
1.1 KiB
6 years ago
|
#ifndef CSR_SPARSE_MATRIX_H /* Include guard */
|
||
|
#define CSR_SPARSE_MATRIX_H
|
||
|
|
||
|
#include <stdbool.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
typedef struct csrSparseMatrix {
|
||
|
double* values;
|
||
|
int* rowaccInd; //without the first cell, always 0
|
||
|
int* columnIndexes;
|
||
|
int size; //no. of rows
|
||
|
int nnz; //no. of non zero elements
|
||
|
|
||
|
} CsrSparseMatrix;
|
||
|
|
||
|
CsrSparseMatrix initCsrSparseMatrix();
|
||
|
void allocMemoryForElements (CsrSparseMatrix *sparseMatrix, int size, int nnz);
|
||
|
void addElements(CsrSparseMatrix *sparseMatrix, int *fileFromMatrix, int *FileToMatrix);
|
||
|
void zeroOutRow(CsrSparseMatrix *sparseMatrix, int row);
|
||
|
void zeroOutColumn(CsrSparseMatrix *sparseMatrix, int column);
|
||
|
int *getRowIndexes(CsrSparseMatrix sparseMatrix, int row, int *rowSize);
|
||
|
void transposeSparseMatrix(CsrSparseMatrix *sparseMatrix);
|
||
|
void csrSparseMatrixVectorMultiplication(CsrSparseMatrix sparseMatrix, double *vector,
|
||
|
double **product, int vectorSize);
|
||
|
void destroyCsrSparseMatrix(CsrSparseMatrix *sparseMatrix);
|
||
|
void printCsrSparseMatrix(CsrSparseMatrix sparseMatrix);
|
||
|
|
||
|
#endif // CSR_SPARSE_MATRIX_H
|