Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
a38b2c25
Commit
a38b2c25
authored
Dec 06, 2018
by
LEFEBVREJP email
Browse files
Updating mergesort fortran indices to be int instead of float.
parent
2f0e652e
Changes
2
Hide whitespace changes
Inline
Side-by-side
radixalgorithm/mergesort.f90
View file @
a38b2c25
...
...
@@ -12,7 +12,7 @@
implicit
none
integer
::
i
,
imax
,
i0
,
j
,
jmax
,
k
,
L
,
L1
,
m
,
n
real
::
a
(
n
)
real
::
indices
(
n
)
integer
::
indices
(
n
)
real
,
allocatable
::
b
(:)
allocate
(
b
(
n
))
L1
=
1
...
...
radixalgorithm/tests/tstMergeSort.f90
View file @
a38b2c25
Program
run_merge
implicit
none
external
merge_sort
integer
::
n
,
i
character
(
len
=
10
)
::
d1
,
d2
,
d3
integer
::
time
(
8
)
real
::
dtime1
,
dtime2
real
,
allocatable
::
a
(:)
real
,
allocatable
::
indices
(:)
integer
,
allocatable
::
indices
(:)
call
DATE_AND_TIME
(
d1
,
d2
,
d3
,
time
)
dtime1
=
time
(
6
)
*
60.
+
time
(
7
)
+
time
(
8
)/
1000.
n
=
1000
n
=
1000
0
allocate
(
a
(
n
))
allocate
(
indices
(
n
))
! avoid unitialised value warning
...
...
@@ -27,13 +28,13 @@
dtime1
=
dtime2
-
dtime1
print
*
,
"setup time (s) ="
,
dtime1
print
*
,
"First/Last 10 elements before sorting"
print
"(10f12.3/10
f12.
0)"
,
(
a
(
i
),
i
=
1
,
10
),
(
indices
(
i
),
i
=
1
,
10
)
print
"(10f12.3/10
f12.
0)"
,
(
a
(
i
),
i
=
n
-9
,
n
),
(
indices
(
i
),
i
=
n
-9
,
n
)
print
"(10f12.3/10
i1
0)"
,
(
a
(
i
),
i
=
1
,
10
),
(
indices
(
i
),
i
=
1
,
10
)
print
"(10f12.3/10
i1
0)"
,
(
a
(
i
),
i
=
n
-9
,
n
),
(
indices
(
i
),
i
=
n
-9
,
n
)
call
merge_sort
(
n
,
a
,
indices
)
call
DATE_AND_TIME
(
d1
,
d2
,
d3
,
time
)
print
*
,
"First/Last 10 elements after sorting"
print
"(10f12.3/10
f12.
0)"
,
(
a
(
i
),
i
=
1
,
10
),
(
indices
(
i
),
i
=
1
,
10
)
print
"(10f12.3/10
f12.
0)"
,
(
a
(
i
),
i
=
n
-9
,
n
),
(
indices
(
i
),
i
=
n
-9
,
n
)
print
"(10f12.3/10
i1
0)"
,
(
a
(
i
),
i
=
1
,
10
),
(
indices
(
i
),
i
=
1
,
10
)
print
"(10f12.3/10
i1
0)"
,
(
a
(
i
),
i
=
n
-9
,
n
),
(
indices
(
i
),
i
=
n
-9
,
n
)
dtime2
=
time
(
6
)
*
60.
+
time
(
7
)
+
time
(
8
)/
1000.
-
dtime2
print
*
,
"sort time (s) ="
,
dtime2
do
i
=
1
,
(
n
-1
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment