#include "neato.h"
-#ifdef __cplusplus
- enum Style { regular, invisible };
- struct vtx_data {
- int nedges;
- int *edges;
- float *ewgts;
- Style *styles;
- float *edists; /* directed dist reflecting the direction of the edge */
- };
-
- typedef int DistType; /* must be signed!! */
-
- inline double max(double x, double y) {
- if (x >= y)
- return x;
- else
- return y;
- } inline double min(double x, double y) {
- if (x <= y)
- return x;
- else
- return y;
- }
-
- inline int max(int x, int y) {
- if (x >= y)
- return x;
- else
- return y;
- }
-
- inline int min(int x, int y) {
- if (x <= y)
- return x;
- else
- return y;
- }
-
- struct Point {
- double x;
- double y;
- int operator==(Point other) {
- return x == other.x && y == other.y;
- }};
-#else
-#undef inline
-#define inline
-#define NOTUSED(var) (void) var
-
-#include <macros.h>
-
-#ifdef USE_STYLES
- typedef enum { regular, invisible } Style;
-#endif
- typedef struct {
- int nedges; /* no. of neighbors, including self */
- int *edges; /* edges[0..(nedges-1)] are neighbors; edges[0] is self */
- float *ewgts; /* preferred edge lengths */
- float *eweights; /* edge weights */
- node_t *np; /* original node */
-#ifdef USE_STYLES
- Style *styles;
-#endif
-#ifdef DIGCOLA
- float *edists; /* directed dist reflecting the direction of the edge */
-#endif
- } vtx_data;
+#include "sparsegraph.h"
#ifdef DIGCOLA
#ifdef IPSEPCOLA
#endif
#endif
- typedef int DistType; /* must be signed!! */
-
-#ifdef UNUSED
- typedef struct {
- double x;
- double y;
- } Point;
-#endif
-
-#endif
-
-#endif
#ifdef __cplusplus
}
#endif
+
+#endif
#include "matrix_ops.h"
+#include "memory.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
static double p_iteration_threshold = 1e-3;
-boolean
+int
power_iteration(double **square_mat, int n, int neigs, double **eigs,
- double *evals, boolean initialize)
+ double *evals, int initialize)
{
/* compute the 'neigs' top eigenvectors of 'square_mat' using power iteration */
}
/* inline */
-void set_vector_valf(int n, float val, float * result) {
+void set_vector_valf(int n, float val, float* result)
+{
int i;
- for (i=0; i<n; i++)
- result[i]=val;
+ for (i = 0; i < n; i++)
+ result[i] = val;
}
/* inline */
#ifndef _MATRIX_OPS_H_
#define _MATRIX_OPS_H_
-#include "defs.h"
+#include "sparsegraph.h"
extern void cpvec(double *, int, int, double *);
extern double dot(double *, int, int, double *);
double ***CC);
extern void mult_sparse_dense_mat_transpose(vtx_data *, double **, int,
int, float ***);
- extern boolean power_iteration(double **, int, int, double **, double *,
- boolean);
+ extern int power_iteration(double **, int, int, double **, double *, int);
/*****************************