- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is trivial, really, and I feel I should know the answer, but I can't seem to put my finger on it...
Suppose I am in a subroutine and have an array, let's call it A, which is a dummy argument with an assumed shape, i.e. it was declared as:
subroutine test(A)
real(kind(1e0)), dimension(:) :: A
Suppose now I want toreference the 'tail' of the array, i.e. all the elements of the array from the n'th through to the end. Is there an elegant syntax for doing this? In MATLAB, one would use A(n:end), but I can't find an equivalent in IVF. The best I can find so far is A(n:size(A, 1)) which seems clunky and inelegant. Is there any better way of doing this?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even more elegant than MATLAB:
A(N:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve; I agree that that notation is more elegant, and I had in fact tried it. The problem is that when I compile in debug mode and then run, I get bombarded with rather inelegant "An array temporary was created" warning messages. I could of course turn these off, buttheymademe think that there's something about this notation that the compiler doesn't like. It's perfectly happy with the clunkier A(N:SIZE(A, 1)) notation, which to my eyes should be exactly equivalent.

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