29 double **eigs =
gv_calloc(new_dim,
sizeof(
double *));
30 for (i = 0; i < new_dim; i++)
32 double *evals =
gv_calloc(new_dim,
sizeof(
double));
36 for (i = 0; i <
dim; i++) {
41 for (i = 0; i <
dim; i++) {
42 for (j = 0; j <= i; j++) {
45 for (k = 0; k < n; k++) {
46 sum += coords[i][k] * coords[j][k];
48 DD[i][j] = DD[j][i] = sum;
54 for (j = 0; j < new_dim; j++) {
55 for (i = 0; i < n; i++) {
57 for (k = 0; k <
dim; k++) {
58 sum += coords[k][i] * eigs[j][k];
60 new_coords[j][i] = sum;
64 for (i = 0; i < new_dim; i++)
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
void closest_pairs2graph(double *place, int n, int num_pairs, vtx_data **graph)
static int eval(Agraph_t *g, int root)
bool power_iteration(double **square_mat, int n, int neigs, double **eigs, double *evals)
void mult_sparse_dense_mat_transpose(vtx_data *A, double **B, int dim1, int dim2, float ***CC)
void mult_dense_mat_d(double **A, float **B, int dim1, int dim2, int dim3, double ***CC)
void PCA_alloc(DistType **coords, int dim, int n, double **new_coords, int new_dim)
bool iterativePCA_1D(double **coords, int dim, int n, double *new_direction)