Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
cd37bef3
Commit
cd37bef3
authored
May 14, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert benchmark to Py3
parent
a3e02d9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
Demos/benchmarks/spectralnorm.py
Demos/benchmarks/spectralnorm.py
+4
-7
No files found.
Demos/benchmarks/spectralnorm.py
View file @
cd37bef3
...
...
@@ -7,21 +7,18 @@
# Dirtily sped up by Simon Descarpentries
# Concurrency by Jason Stitt
from
math
import
sqrt
from
itertools
import
izip
from
time
import
time
import
util
import
itertools
import
optparse
def
eval_A
(
i
,
j
):
return
1.0
/
((
i
+
j
)
*
(
i
+
j
+
1
)
/
2
+
i
+
1
)
def
eval_A_times_u
(
u
):
return
[
part_A_times_u
(
i
,
u
)
for
i
in
x
range
(
len
(
u
))
]
return
[
part_A_times_u
(
i
,
u
)
for
i
in
range
(
len
(
u
))
]
def
eval_At_times_u
(
u
):
return
[
part_At_times_u
(
i
,
u
)
for
i
in
x
range
(
len
(
u
))
]
return
[
part_At_times_u
(
i
,
u
)
for
i
in
range
(
len
(
u
))
]
def
eval_AtA_times_u
(
u
):
return
eval_At_times_u
(
eval_A_times_u
(
u
))
...
...
@@ -46,13 +43,13 @@ def main(n):
t0
=
time
()
u
=
[
1
]
*
DEFAULT_N
for
dummy
in
x
range
(
10
):
for
dummy
in
range
(
10
):
v
=
eval_AtA_times_u
(
u
)
u
=
eval_AtA_times_u
(
v
)
vBv
=
vv
=
0
for
ue
,
ve
in
i
zip
(
u
,
v
):
for
ue
,
ve
in
zip
(
u
,
v
):
vBv
+=
ue
*
ve
vv
+=
ve
*
ve
tk
=
time
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment