Each table row shows performance measurements for this Cython program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|
Read the ↓ make, command line, and program output logs to see how this program was run.
Read spectral-norm benchmark to see what this program should do.
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# Contributed by Sebastien Loisel
# Fixed by Isaac Gouy
# Sped up by Josh Goldfoot
# Dirtily sped up by Simon Descarpentries
# Used list comprehension by Vadim Zelenin
# 2to3
from math import sqrt
from sys import argv
cdef float eval_A(int i, int j):
ij = i+j
return 1.0 / (ij * (ij + 1) / 2 + i + 1)
def eval_A_times_u(u):
cdef int i, j, u_j
local_eval_A = eval_A
return [
sum([
local_eval_A(i, j) * u_j for j, u_j in enumerate(u)
]) for i in range(len(u))
]
def eval_At_times_u(u):
cdef int i, j, u_j
local_eval_A = eval_A
return [
sum([
local_eval_A(j, i) * u_j for j, u_j in enumerate(u)
]) for i in range(len(u))
]
def eval_AtA_times_u(u):
return eval_At_times_u(eval_A_times_u(u))
def main():
cdef int n, dummy, ue, ve, vBv, vv
n = int(argv[1])
u = [1] * n
local_eval_AtA_times_u = eval_AtA_times_u
for dummy in range(10):
v = local_eval_AtA_times_u(u)
u = local_eval_AtA_times_u(v)
vBv = vv = 0
for ue, ve in zip(u, v):
vBv += ue * ve
vv += ve * ve
print("%0.9f" % (sqrt(vBv/vv)))
main()
Sun, 23 Apr 2023 09:39:14 GMT MAKE: make[1]: Vstupuje se do adresáře „/home/dundee/work/pybenchmarks/bencher/tmp/spectralnorm/tmp“ cp spectralnorm.cython-6.cython `echo spectralnorm.cython-6.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx cythonize -3 -bi `echo spectralnorm.cython-6.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx Compiling /home/dundee/work/pybenchmarks/bencher/tmp/spectralnorm/tmp/spectralnorm.pyx because it changed. [1/1] Cythonizing /home/dundee/work/pybenchmarks/bencher/tmp/spectralnorm/tmp/spectralnorm.pyx make[1]: Opouští se adresář „/home/dundee/work/pybenchmarks/bencher/tmp/spectralnorm/tmp“ 2.38s to complete and log all make actions COMMAND LINE: /usr/bin/python3 -c "import spectralnorm" 550 UNEXPECTED OUTPUT 1c1 < 1.000000000 --- > 1.274224125 PROGRAM OUTPUT: 1.000000000