File: solve.py

package info (click to toggle)
libnarray-ruby 0.5.9-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 564 kB
  • ctags: 564
  • sloc: ansic: 4,620; ruby: 1,513; python: 70; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 365 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from mybench import *
from LinearAlgebra import *

n = 500

a = reshape(arrayrange(n*n)%(n+1)+1,(n,n)).astype(Float64)

b = reshape(arrayrange(n*n)+1,(n,n)).astype(Float64)
#b = arrayrange(n).astype(Float64)+1

print "LU factorize & solve %ix%i matrix ..."%(n,n)

def bench_body(a=a,b=b): c=solve_linear_equations(a,b)
bench_time(bench_body,1)

# Time:   8.120 sec