Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
fcad586b
Commit
fcad586b
authored
Jul 10, 2011
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ModSim ass4 taddeus: Updated Least Squares usage.
parent
4a2bab4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
modsim/ass4_taddeus/ring/plot.py
modsim/ass4_taddeus/ring/plot.py
+13
-12
modsim/ass4_taddeus/ring/ring.c
modsim/ass4_taddeus/ring/ring.c
+2
-2
No files found.
modsim/ass4_taddeus/ring/plot.py
View file @
fcad586b
#!/usr/bin/env python
#!/usr/bin/env python
from
sys
import
argv
,
stdin
from
sys
import
argv
,
stdin
from
pylab
import
array
,
matrix
,
ones
,
dot
,
plot
,
legend
,
show
,
savefig
from
pylab
import
plot
,
xlabel
,
ylabel
,
legend
,
show
,
savefig
from
scipy
import
polyfit
,
polyval
# Collect data
# Collect data
data
=
[]
x
=
[]
y
=
[]
for
line
in
stdin
.
readlines
():
for
line
in
stdin
.
readlines
():
data
.
append
(
map
(
float
,
line
.
split
(
','
,
1
)))
s
,
t
=
map
(
float
,
line
.
split
(
','
,
1
))
x
.
append
(
s
)
y
.
append
(
t
)
# Least squares data fit
# Least squares data fit
A
=
matrix
(
ones
((
len
(
data
),
2
)))
c
=
tuple
(
polyfit
(
x
,
y
,
1
).
tolist
())
data
=
array
(
data
)
fit
=
polyval
(
c
,
[
0
,
x
[
-
1
]])
A
.
T
[
1
]
=
data
.
T
[
0
]
b
=
data
.
T
[
1
].
T
start
,
slope
=
tuple
(
list
(
dot
((
A
.
T
*
A
).
I
*
A
.
T
,
b
).
tolist
()[
0
]))
# Plot and optionally save data
# Plot and optionally save data
data
=
data
.
T
plot
(
x
,
y
,
'x'
,
label
=
'metingen'
)
plot
(
data
[
0
],
data
[
1
],
'x'
,
label
=
'original data'
)
plot
([
0
,
x
[
-
1
]],
fit
,
'-'
,
label
=
'Least Squares fit (y = %ex + %e)'
%
c
)
plot
([
0
,
data
[
0
][
-
1
]],
[
start
,
data
[
0
][
-
1
]
*
slope
+
start
],
'-'
,
label
=
'linear fit y = %ex + %e'
%
(
slope
,
start
))
legend
()
legend
()
xlabel
(
'Pakketgrootte'
)
ylabel
(
'Tijd (s)'
)
if
len
(
argv
)
==
2
:
if
len
(
argv
)
==
2
:
savefig
(
argv
[
1
])
savefig
(
argv
[
1
])
show
()
show
()
modsim/ass4_taddeus/ring/ring.c
View file @
fcad586b
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
#include <math.h>
#include <math.h>
#include <mpi.h>
#include <mpi.h>
#define DEBUG
//
#define DEBUG
#define LOOP 1 // Number of different message sizes
#define LOOP 1
00
// Number of different message sizes
#define STRIDE 10000 // Difference between the message sizes
#define STRIDE 10000 // Difference between the message sizes
#define REPEAT 7 // Number of times to repeat aREPEAT measurement
#define REPEAT 7 // Number of times to repeat aREPEAT measurement
...
...
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