質問編集履歴

2

コード

2017/07/11 23:18

投稿

junsuke16
junsuke16

スコア14

test CHANGED
File without changes
test CHANGED
@@ -10,11 +10,7 @@
10
10
 
11
11
  print "Finished Importing Numpy"
12
12
 
13
- #from scipy import signal
14
13
 
15
- #import scipy as sp
16
-
17
- #print "Finished Importing Scipy"
18
14
 
19
15
  import re #regular expression
20
16
 
@@ -28,11 +24,7 @@
28
24
 
29
25
  print "Finished Importing Counter"
30
26
 
31
- #import matplotlib.pyplot as plt
32
-
33
27
  import time
34
-
35
- #import math
36
28
 
37
29
 
38
30
 
@@ -55,8 +47,6 @@
55
47
  print "eigenvals"
56
48
 
57
49
  la = np.linalg.eigvalsh(np.corrcoef(self.dataarr))#np.corrcoef(self.dataarr)#
58
-
59
- #U, s, V = np.linalg.svd(np.corrcoef(self.dataarr))#, full_matrices=False)
60
50
 
61
51
  return la
62
52
 
@@ -84,16 +74,4 @@
84
74
 
85
75
  laave = laave + s
86
76
 
87
- #print s
88
-
89
77
  print laave/100
90
-
91
- #print np.corrcoef(np.random.randn(1600,100))
92
-
93
- #sum=0.
94
-
95
- #for num in range(0, 1000000000):
96
-
97
- # sum=sum+np.random.randn()
98
-
99
- #print sum/1000000000

1

コード追加

2017/07/11 23:18

投稿

junsuke16
junsuke16

スコア14

test CHANGED
File without changes
test CHANGED
@@ -5,3 +5,95 @@
5
5
  の演算で、巨大な行列の固有値を求めるところでした。
6
6
 
7
7
  何か解決策があれば教えてください。
8
+
9
+ import numpy as np
10
+
11
+ print "Finished Importing Numpy"
12
+
13
+ #from scipy import signal
14
+
15
+ #import scipy as sp
16
+
17
+ #print "Finished Importing Scipy"
18
+
19
+ import re #regular expression
20
+
21
+ print "Finished Importing Regex"
22
+
23
+ import struct
24
+
25
+ print "Finished Importing Struct"
26
+
27
+ from collections import Counter
28
+
29
+ print "Finished Importing Counter"
30
+
31
+ #import matplotlib.pyplot as plt
32
+
33
+ import time
34
+
35
+ #import math
36
+
37
+
38
+
39
+ class Factoranalysis:
40
+
41
+ def __init__(self,dataarr):
42
+
43
+ print "StartinitFA"
44
+
45
+ self.dataarr=dataarr
46
+
47
+ self.numval=dataarr.shape[0]
48
+
49
+ self.numobs=dataarr.shape[1]
50
+
51
+ print "FAinitFIN"
52
+
53
+ def eigenvals(self):
54
+
55
+ print "eigenvals"
56
+
57
+ la = np.linalg.eigvalsh(np.corrcoef(self.dataarr))#np.corrcoef(self.dataarr)#
58
+
59
+ #U, s, V = np.linalg.svd(np.corrcoef(self.dataarr))#, full_matrices=False)
60
+
61
+ return la
62
+
63
+ def parallelanalysis(self,repnum):
64
+
65
+ laave=0.
66
+
67
+ for num in range(0,repnum):
68
+
69
+ print laave
70
+
71
+ laave = np.linalg.eigvalsh(np.corrcoef(np.random.randn(self.numval,self.numval))) + laave
72
+
73
+ return laave/repnum
74
+
75
+
76
+
77
+ if __name__ == '__main__':
78
+
79
+ laave=0.
80
+
81
+ for num in range(0,100):
82
+
83
+ U, s, V = np.linalg.svd(np.corrcoef(np.random.randn(100,100)))
84
+
85
+ laave = laave + s
86
+
87
+ #print s
88
+
89
+ print laave/100
90
+
91
+ #print np.corrcoef(np.random.randn(1600,100))
92
+
93
+ #sum=0.
94
+
95
+ #for num in range(0, 1000000000):
96
+
97
+ # sum=sum+np.random.randn()
98
+
99
+ #print sum/1000000000