53 double *eigv =
gv_calloc(n,
sizeof(
double));
58 srand((
unsigned)random_seed);
61 for (i = 0; i < n; i++) u[i] =
drand();
63 if (res > 0) res = 1/res;
64 for (i = 0; i < n; i++) {
78 for (i = 0; i < n; i++) vv[i] = u[i];
80 if (unorm > 0) unorm = 1/unorm;
84 for (i = 0; i < n; i++) {
86 res = res + u[i]*v[i];
void SparseMatrix_multiply_vector(SparseMatrix A, double *v, double **res)
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
double vector_product(int n, double *x, double *y)
static double drand(void)
static const double tolerance
double * power_method(void *A, int n, int random_seed)