-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMathHelpers.h
More file actions
34 lines (27 loc) · 1013 Bytes
/
MathHelpers.h
File metadata and controls
34 lines (27 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef SW_PROJECT_MATHHELPERS_H
#define SW_PROJECT_MATHHELPERS_H
/*
* Module for computing eigenvalue and leading eigenpair
*/
/*
* Calculates the eigenvalue of a given vector based on formula.
* Eigenvalue returns as a double
*/
double CalculateEigenvalue(double** matrix, double* vector, int length);
/*
* Calculates the 1-norm of a given matrix.
* Used for the matrix shifting
*/
double Calculate1norm(double** matrix,int length);
/*
* Calculates the matrix after adding the 1-norm (C' = ||C_1||*I + C)
*/
int CalculateNewMatrix(double** matrix, double norm ,int length);
/*
* Calculates the leading eigenpair using sparse impl.
* NOTE: since we are required for computing the leading eigenpair, we are doing the following:
* - init_vector will contain the leading eigenvctor after the function was called.
* - The eigenvalue is the return value of the function.
*/
double CalculateLeadingEigenpair(double** matrix,double* init_vector, int length);
#endif /*SW_PROJECT_MATHHELPERS_H*/