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.
29 lines
911 B
29 lines
911 B
6 years ago
|
#ifndef SPARSE_MATRIX_H /* Include guard */
|
||
|
#define SPARSE_MATRIX_H
|
||
|
|
||
|
#include <stdbool.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
typedef struct sparseMatrixElement {
|
||
|
double value;
|
||
|
int rowIndex, columnIndex;
|
||
|
struct sparseMatrixElement *nextElement;
|
||
|
} SparseMatrixElement;
|
||
|
|
||
|
typedef struct sparseMatrix {
|
||
|
int elements;
|
||
|
SparseMatrixElement *firstElement;
|
||
|
} SparseMatrix;
|
||
|
|
||
|
SparseMatrix createSparseMatrix();
|
||
|
void apendElement(SparseMatrix *sparseMatrix, double value, int row, int column);
|
||
|
bool deleteElement(SparseMatrix *sparseMatrix, int row, int column);
|
||
|
SparseMatrixElement *getElement(SparseMatrix sparseMatrix, int row, int column);
|
||
|
void transposeSparseMatrix(SparseMatrix *sparseMatrix);
|
||
|
void sparseMatrixVectorMultiplication(SparseMatrix sparseMatrix, double *vector,
|
||
|
double **product, int vectorSize);
|
||
|
void printSparseMatrix(SparseMatrix sparseMatrix);
|
||
|
|
||
|
#endif // SPARSE_MATRIX_H
|