Statistics
| Branch: | Tag: | Revision:

sssimulator / Matrix / matrix.h @ master

History | View | Annotate | Download (1.25 KB)

1 692b6c80 luca
/*
2
 * This is SSSim: the Simple & Stupid Simulator
3
 *
4
 *  Copyright (c) 2015 Luca Baldesi
5
 *
6
 *  This is free software; see gpl-3.0.txt
7
 */
8
9
#ifndef __MATRIX_H__
10
#define __MATRIX_H__ 1
11
12
#include <stdint.h>
13
14
typedef uint32_t matsize;
15
typedef double matvalue;
16
17
struct matrix * matrix_from_edgefile(const char * edgefile);
18
19
matvalue matrix_element_get(const struct matrix * m, matsize i, matsize j);
20
21
int matrix_element_set(const struct matrix * m, matsize i, matsize j, matvalue v);
22
23
matsize matrix_num_rows(const struct matrix * m);
24
25
matsize matrix_num_cols(const struct matrix * m);
26
27
struct matrix * matrix_eigencentrality(const struct matrix * m, matvalue * dominant_eigenvalue);
28
29
struct matrix * matrix_multiply(const struct matrix * m1, const struct matrix * m2);
30
31
struct matrix * matrix_ones(matsize rows, matsize cols);
32
33
struct matrix * matrix_diag(const struct matrix * m);
34
35
struct matrix * matrix_invdiag(const struct matrix * m);
36
37
int matrix_stochastify(struct matrix *m);
38
39
void matrix_destroy(struct matrix **m);
40
41 db6a9d7d Luca Baldesi
void matrix_shrink(struct matrix **m, matsize pos);
42
43 37aa99b9 Luca Baldesi
/* TODO the functions below have not a test case */
44
45 d5b6282d Luca Baldesi
int matrix_make_bidir(struct matrix * m);
46
47 37aa99b9 Luca Baldesi
matvalue matrix_sum_values(const struct matrix *m);
48
49
void matrix_divide(struct matrix *m, matvalue v);
50
51 692b6c80 luca
#endif