-
Notifications
You must be signed in to change notification settings - Fork 192
Addition of sort_adj
to sort an rank 1 array in the same order as an input array
#849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 10 commits
5f79d2e
230a85c
5230234
962bcc4
3cf4711
01faf83
28b6f71
b1e51da
c8981f9
55c29c3
54fc607
724fbee
1a9d04c
0c254ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
ADD_EXAMPLE(ord_sort) | ||
ADD_EXAMPLE(sort) | ||
ADD_EXAMPLE(sort_adjoint) | ||
ADD_EXAMPLE(sort_index) | ||
ADD_EXAMPLE(radix_sort) | ||
ADD_EXAMPLE(sort_bitset) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
program example_sort_adjoint | ||
use stdlib_sorting, only: sort_adjoint | ||
implicit none | ||
integer, allocatable :: array(:) | ||
real, allocatable :: adjoint(:) | ||
|
||
array = [5, 4, 3, 1, 10, 4, 9] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a great example @jvdp1. Could it be made into a test as well? The test would check that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good suggestion. I added the tests "test_real_sort_adjointes_" based on it. |
||
allocate(adjoint, source=real(array)) | ||
|
||
call sort_adjoint(array, adjoint) | ||
|
||
print *, array !print [1, 3, 4, 4, 5, 9, 10] | ||
print *, adjoint !print [1., 3., 4., 4., 5., 9., 10.] | ||
|
||
end program example_sort_adjoint |
Uh oh!
There was an error while loading. Please reload this page.