Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
uva
Commits
fcad586b
Commit
fcad586b
authored
14 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
ModSim ass4 taddeus: Updated Least Squares usage.
parent
4a2bab4c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modsim/ass4_taddeus/ring/plot.py
+13
-12
13 additions, 12 deletions
modsim/ass4_taddeus/ring/plot.py
modsim/ass4_taddeus/ring/ring.c
+2
-2
2 additions, 2 deletions
modsim/ass4_taddeus/ring/ring.c
with
15 additions
and
14 deletions
modsim/ass4_taddeus/ring/plot.py
+
13
−
12
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
()
This diff is collapsed.
Click to expand it.
modsim/ass4_taddeus/ring/ring.c
+
2
−
2
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment