File: deig.R

package info (click to toggle)
openblas 0.2.19-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 44,272 kB
  • ctags: 76,509
  • sloc: asm: 1,086,998; ansic: 186,055; fortran: 74,181; makefile: 11,187; perl: 3,428; python: 661; sh: 81
file content (62 lines) | stat: -rwxr-xr-x 1,029 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/Rscript

argv <- commandArgs(trailingOnly = TRUE)

nfrom = 128
nto = 2048
nstep = 128
loops = 1

if ( length(argv) > 0 ) {

	for ( z in 1:length(argv) ) {

		if ( z == 1 ) {
			nfrom <- as.numeric(argv[z])
		} else if ( z==2 ) {
			nto <- as.numeric(argv[z])
		} else if ( z==3 ) {
			nstep <- as.numeric(argv[z])
		} else if ( z==4 ) {
			loops <- as.numeric(argv[z])
		}
	}

}

p=Sys.getenv("OPENBLAS_LOOPS")
if ( p != "" ) {
	loops <- as.numeric(p)
}	


cat(sprintf("From %.0f To %.0f Step=%.0f Loops=%.0f\n",nfrom, nto, nstep, loops))
cat(sprintf("      SIZE             Flops                   Time\n"))

n = nfrom
while ( n <= nto ) {

	A <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
	
	l = 1

	start <- proc.time()[3]

	while ( l <= loops ) {

		ev <- eigen(A)
		l = l + 1
	}

	end <- proc.time()[3]
	timeg = end - start
	mflops = (26.66 *n*n*n ) * loops / ( timeg * 1.0e6 )

	st = sprintf("%.0fx%.0f :",n , n)
	cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, timeg))

	n = n + nstep

}