13 #ifndef SPARSEMATRIX_H
14 #define SPARSEMATRIX_H
19 #define SYMMETRY_EPSILON 0.0000001
109 void SparseMatrix_level_sets(SparseMatrix A,
int root,
int *nlevel,
int **levelset_ptr,
int **levelset,
int **mask,
int reintialize_mask);
110 void SparseMatrix_level_sets_khops(
int khops, SparseMatrix A,
int root,
int *nlevel,
int **levelset_ptr,
int **levelset,
int **mask,
int reintialize_mask);
139 int **centers,
int centering,
real **
dist);
142 int *centers_user,
int centering,
real **
dist);
161 #define SparseMatrix_set_undirected(A) set_flag((A)->property, MATRIX_UNDIRECTED)
162 #define SparseMatrix_set_symmetric(A) set_flag((A)->property, MATRIX_SYMMETRIC)
163 #define SparseMatrix_set_pattern_symmetric(A) set_flag((A)->property, MATRIX_PATTERN_SYMMETRIC)
164 #define SparseMatrix_set_skew(A) set_flag((A)->property, MATRIX_SKEW)
165 #define SparseMatrix_set_hemitian(A) set_flag((A)->property, MATRIX_HERMITIAN)
168 #define SparseMatrix_clear_undirected(A) clear_flag((A)->property, MATRIX_UNDIRECTED)
169 #define SparseMatrix_clear_symmetric(A) clear_flag((A)->property, MATRIX_SYMMETRIC)
170 #define SparseMatrix_clear_pattern_symmetric(A) clear_flag((A)->property, MATRIX_PATTERN_SYMMETRIC)
171 #define SparseMatrix_clear_skew(A) clear_flag((A)->property, MATRIX_SKEW)
172 #define SparseMatrix_clear_hemitian(A) clear_flag((A)->property, MATRIX_HERMITIAN)
175 #define SparseMatrix_known_undirected(A) test_flag((A)->property, MATRIX_UNDIRECTED)
176 #define SparseMatrix_known_symmetric(A) test_flag((A)->property, MATRIX_SYMMETRIC)
177 #define SparseMatrix_known_strucural_symmetric(A) test_flag((A)->property, MATRIX_PATTERN_SYMMETRIC)
178 #define SparseMatrix_known_skew(A) test_flag((A)->property, MATRIX_SKEW)
179 #define SparseMatrix_known_hemitian(A) test_flag((A)->property, MATRIX_HERMITIAN)
SparseMatrix SparseMatrix_get_submatrix(SparseMatrix A, int nrow, int ncol, int *rindices, int *cindices)
void SparseMatrix_export_binary_fp(FILE *f, SparseMatrix A)
void SparseMatrix_khairness(SparseMatrix A, int **hairness)
SparseMatrix SparseMatrix_multiply3(SparseMatrix A, SparseMatrix B, SparseMatrix C)
SparseMatrix SparseMatrix_import_binary_fp(FILE *f)
SparseMatrix SparseMatrix_multiply_by_scaler(SparseMatrix A, real s)
SparseMatrix SparseMatrix_sum_repeat_entries(SparseMatrix A, int what_to_sum)
SparseMatrix SparseMatrix_symmetrize_nodiag(SparseMatrix A, int pattern_symmetric_only)
real SparseMatrix_pseudo_diameter_only(SparseMatrix A)
SparseMatrix SparseMatrix_normalize_to_rowsum1(SparseMatrix A)
void SparseMatrix_page_rank(SparseMatrix A, real teleport_probablity, int weighted, real epsilon, real **page_rank)
SparseMatrix SparseMatrix_to_square_matrix(SparseMatrix A, int bipartite_options)
SparseMatrix SparseMatrix_set_entries_to_real_one(SparseMatrix A)
SparseMatrix SparseMatrix_copy(SparseMatrix A)
SparseMatrix SparseMatrix_scaled_by_vector(SparseMatrix A, real *v, int apply_to_row)
SparseMatrix SparseMatrix_remove_upper(SparseMatrix A)
SparseMatrix SparseMatrix_import_binary(char *name)
SparseMatrix SparseMatrix_new(int m, int n, int nz, int type, int format)
SparseMatrix SparseMatrix_exclude_submatrix(SparseMatrix A, int nrow, int ncol, int *rindices, int *cindices)
int SparseMatrix_connectedQ(SparseMatrix A0)
SparseMatrix SparseMatrix_remove_diagonal(SparseMatrix A)
void SparseMatrix_export_binary(char *name, SparseMatrix A, int *flag)
struct SparseMatrix_struct * SparseMatrix
void SparseMatrix_multiply_dense(SparseMatrix A, int ATransposed, real *v, int vTransposed, real **res, int res_transposed, int dim)
void SparseMatrix_decompose_to_supervariables(SparseMatrix A, int *ncluster, int **cluster, int **clusterp)
SparseMatrix SparseMatrix_from_coordinate_arrays_not_compacted(int nz, int m, int n, int *irn, int *jcn, void *val0, int type, size_t sz, int what_to_sum)
int SparseMatrix_has_diagonal(SparseMatrix A)
int SparseMatrix_is_symmetric(SparseMatrix A, int test_pattern_symmetry_only)
int SparseMatrix_k_centers_user(SparseMatrix D0, int weighted, int K, int *centers_user, int centering, real **dist0)
void SparseMatrix_multiply_vector(SparseMatrix A, real *v, real **res, int transposed)
SparseMatrix SparseMatrix_largest_component(SparseMatrix A)
void SparseMatrix_kcore_decomposition(SparseMatrix A, int *coreness_max0, int **coreness_ptr0, int **coreness_list0)
SparseMatrix SparseMatrix_normalize_by_row(SparseMatrix A)
SparseMatrix SparseMatrix_delete_sparse_columns(SparseMatrix A, int threshold, int **new2old, int *nnew, int inplace)
SparseMatrix SparseMatrix_general_new(int m, int n, int nz, int type, size_t sz, int format)
void SparseMatrix_print(char *c, SparseMatrix A)
SparseMatrix SparseMatrix_get_augmented(SparseMatrix A)
void SparseMatrix_kcoreness(SparseMatrix A, int **coreness)
SparseMatrix SparseMatrix_from_coordinate_format_not_compacted(SparseMatrix A, int what_to_sum)
SparseMatrix SparseMatrix_get_real_adjacency_matrix_symmetrized(SparseMatrix A)
void SparseMatrix_export(FILE *f, SparseMatrix A)
SparseMatrix SparseMatrix_apply_fun_general(SparseMatrix A, void(*fun)(int i, int j, int n, double *x))
int SparseMatrix_distance_matrix(SparseMatrix D0, int weighted, real **dist0)
SparseMatrix SparseMatrix_symmetrize(SparseMatrix A, int pattern_symmetric_only)
void SparseMatrix_level_sets(SparseMatrix A, int root, int *nlevel, int **levelset_ptr, int **levelset, int **mask, int reinitialize_mask)
void SparseMatrix_level_sets_khops(int khops, SparseMatrix A, int root, int *nlevel, int **levelset_ptr, int **levelset, int **mask, int reinitialize_mask)
void SparseMatrix_delete(SparseMatrix A)
SparseMatrix SparseMatrix_from_dense(int m, int n, real *x)
real SparseMatrix_pseudo_diameter_unweighted(SparseMatrix A0, int root, int aggressive, int *end1, int *end2, int *connectedQ)
SparseMatrix SparseMatrix_sort(SparseMatrix A)
SparseMatrix SparseMatrix_delete_empty_columns(SparseMatrix A, int **new2old, int *nnew, int inplace)
real SparseMatrix_pseudo_diameter_weighted(SparseMatrix A0, int root, int aggressive, int *end1, int *end2, int *connectedQ)
int SparseMatrix_k_centers(SparseMatrix D0, int weighted, int K, int root, int **centers, int centering, real **dist0)
SparseMatrix SparseMatrix_from_coordinate_arrays(int nz, int m, int n, int *irn, int *jcn, void *val0, int type, size_t sz)
SparseMatrix SparseMatrix_crop(SparseMatrix A, real epsilon)
SparseMatrix SparseMatrix_distance_matrix_k_centers(int K, SparseMatrix D, int weighted)
SparseMatrix SparseMatrix_multiply(SparseMatrix A, SparseMatrix B)
void SparseMatrix_khair_decomposition(SparseMatrix A, int *hairness_max0, int **hairness_ptr0, int **hairness_list0)
SparseMatrix SparseMatrix_make_undirected(SparseMatrix A)
SparseMatrix SparseMatrix_distance_matrix_khops(int khops, SparseMatrix D0, int weighted)
SparseMatrix SparseMatrix_divide_row_by_degree(SparseMatrix A)
void SparseMatrix_weakly_connected_components(SparseMatrix A0, int *ncomp, int **comps, int **comps_ptr)
double dist(Site *s, Site *t)
SparseMatrix SparseMatrix_apply_fun(SparseMatrix A, double(*fun)(double x))
SparseMatrix SparseMatrix_add(SparseMatrix A, SparseMatrix B)
SparseMatrix SparseMatrix_coordinate_form_add_entries(SparseMatrix A, int nentries, int *irn, int *jcn, void *val)
SparseMatrix SparseMatrix_from_coordinate_format(SparseMatrix A)
SparseMatrix SparseMatrix_transpose(SparseMatrix A)
SparseMatrix SparseMatrix_complement(SparseMatrix A, int undirected)