File tree Expand file tree Collapse file tree 3 files changed +98
-0
lines changed Expand file tree Collapse file tree 3 files changed +98
-0
lines changed Original file line number Diff line number Diff line change 1+ import arrayfire as af
2+
3+ def main ():
4+ try :
5+ device = 0
6+ af .info ()
7+
8+ n = 5
9+ t = af .randu (n ,n )
10+ inn = af .matmulNT (t ,t ) + af .identity (n ,n )* n
11+
12+ print ("Running Cholesky InPlace\n " )
13+ cin_upper = inn
14+ cin_lower = inn
15+
16+ af .cholesky_inplace (cin_upper , True )
17+ af .cholesky_inplace (cin_lower , False )
18+
19+ print (cin_upper )
20+ print (cin_lower )
21+
22+ print ("Running Cholesky Out of place\n " )
23+
24+ out_upper = af .cholesky (inn , True )
25+ out_lower = af .cholesky (inn , False )
26+
27+ # Do we want to print the array like above? If yes this is correct.
28+ print (out_upper [0 ])
29+ print (out_lower [0 ])
30+
31+
32+ except Exception as e :
33+ print ('Error: ' ,str (e ))
34+
35+ if __name__ == '__main__' :
36+ main ()
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ import arrayfire as af
3+ def main ():
4+ try :
5+ device = 0
6+ #af.setDevice(device)
7+ af .info ()
8+
9+ inn = af .randu (5 ,8 )
10+ print (inn )
11+
12+ lin = inn
13+
14+ print ("Running LU InPlace\n " )
15+ # Ask if this is correct.
16+ pivot = af .lu_inplace (lin )
17+ print (lin )
18+ print (pivot )
19+
20+ print ("Running LU with Upper Lower Factorization\n " )
21+ lower , upper , pivot = af .lu (inn )
22+ print (lower )
23+ print (upper )
24+ print (pivot )
25+ except Exception as e :
26+ print ('Error: ' , str (e ))
27+
28+ if __name__ == '__main__' :
29+ main ()
30+
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ import arrayfire as af
3+ def main ():
4+ try :
5+ #Skip device=argc....
6+ device = 0
7+ af .info ()
8+
9+ print ("Running QR InPlace\n " )
10+ inn = af .randu (5 ,8 )
11+ print (inn )
12+
13+ qin = inn
14+ tau = af .qr_inplace (qin )
15+
16+ print (qin )
17+ print (tau )
18+
19+ print ("Running QR with Q and R factorization\n " )
20+ q ,r ,tau = af .qr (inn )
21+
22+ print (q )
23+ print (r )
24+ print (tau )
25+
26+ except Exception as e :
27+ print ("Error: " ,str (e ))
28+
29+
30+
31+ if __name__ == '__main__' :
32+ main ()
You can’t perform that action at this time.
0 commit comments