Skip to content

Commit 555e091

Browse files
committed
OpenMP parallelization
1 parent 7e9766f commit 555e091

6 files changed

+1450
-55
lines changed

compile.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
g++ -g -fopenmp -lm lab2_io.c lab2_omp_orig_parallel.c main_omp.c -o pca

eigen_py.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import numpy as NP
2+
from scipy import linalg as LA
3+
# A = [[108, 23, -33],[23, 121, -6],[-33, -6, 39]]
4+
# A = NP.array(A, dtype=float)
5+
# print(A)
6+
# e_vals, e_v = LA.eig(A)
7+
# print("e_vals:\n", e_vals)
8+
# print("e_v:\n", e_v)
9+
10+
A = [[-1, 5, -9, 1],[9, 6, 0, 2],[2, -5, 1, 3]]
11+
A = NP.array(A, dtype=float)
12+
print(A)
13+
u, s, vh = NP.linalg.svd(A, full_matrices=True)
14+
print("u:\n", u)
15+
print("sigma:\n", s)
16+
17+
temp = NP.matmul(u, s)
18+
print(temp)
19+
print("v_t:\n", vh)

0 commit comments

Comments
 (0)