- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In Fortran - the input data files has five million entries
each entry is a integer from 0 to about 8000
I want to do a count of each of the 8000 elements in the five million entries
The vast majority will be zero so it there a way to do this is a sparse vector or array?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no need to sort, at least not explicitly. Using an array provides the means to impose order.
Suppose the data file has been opened with unit number iu.
IMAX = 8000
allocate (icount(0:IMAX))
icount = 0
do
read(iu,*,end=10)iv
icount(iv)=icount(iv)+1
end do
10 continue
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page