Array Comparison in Fortran 90/95
Hi FORTRAN 90/95 Users: Want to know some efficient way of comparing two or more large size arrays in FORTRAN 90/95. Thanks

Re: Array Comparison in Fortran 90/95
To be a little more specific: The arrays could be of different lengths and want to compare them for duplication. Malik

Re: Array Comparison in Fortran 90/95
Oh, they are integer arrays representing sets? You want to determine what integers appear in both arrays? If the range of possible values is known and reasonable, you can mask a bitarray. Otherwise, just sort the arrays.

Re: Array Comparison in Fortran 90/95
Thanks Jed. Yes, I have integer arrays. The range is not known all the time. Comparison by sorting turns out to be very time consuming. Some other suggestion, please!

Re: Array Comparison in Fortran 90/95
Keep the arrays sorted or partially sorted. If you don't sort, you end up with O(n^2) which is much worse. A radix sort shouldn't be that bad. Where do these arrays come from? How big are they? I assume you solve equations at some point? Or is this for mesh manipulation? Would a different data structure be better?

All times are GMT 4. The time now is 11:49. 