This commit is contained in:
Sam Hadow 2025-05-15 20:51:36 +02:00
parent 555bbae16c
commit 0099ee8618
4 changed files with 3 additions and 6 deletions

View File

@ -6,7 +6,6 @@ CFLAGS := -Wall -fopenmp -O3
LDFLAGS := -lm
SRCDIR := src
OBJDIR := out
DATAPATH := data/web-Google/web-Google.mtx
#
SRCS := $(wildcard $(SRCDIR)/*.c)
@ -25,9 +24,7 @@ pagerank: $(OBJDIR)/pagerank | $(OBJDIR)
# --------------------------------------------------
# Link
# --------------------------------------------------
$(OBJDIR)/pagerank: $(OBJS) $(DATAPATH) | $(OBJDIR)
@echo "→ Copying input data"
cp $(DATAPATH) $(OBJDIR)/input.mtx
$(OBJDIR)/pagerank: $(OBJS) | $(OBJDIR)
@echo "→ Linking $@"
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS)

0
main.py Executable file → Normal file
View File

View File

@ -33,7 +33,7 @@ double* gauss_seidel_pagerank(const SparseMatrix *matrix, double epsilon, double
memcpy(x_old, x, vec_size);
// 2. alpha/N * (x * f)
double x_f = vec_product(x_old, f, N);
double x_f = vec_product(x, f, N);
double right_var = (alpha / (double)N) * x_f;
// 3. alpha*(pi*M) + (right_const+alpha/N * (pi * f))*e

View File

@ -22,7 +22,7 @@ void generate_f(const SparseMatrix *matrix, double *res) {
init_vector(res, N, 1);
int num_arcs = matrix->num_arcs;
for (int i = 0; i < num_arcs; ++i) {
res[matrix->arcs[i].dest] = 0;
res[matrix->arcs[i].origin] = 0;
}
}