- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm having a problem using chsift that doesn't make a lot of sense to me.
the following code works,
a(:, i:j) = chsift(a(:, i:j), shift = (/x, x, x/), dim =1)
but if i replace the shift with an array with value x and size 3 it goes out of bounds according to the results of compiling with -CB
what stupid thing am I doing wrong?
thanks
Jeremy
I'm having a problem using chsift that doesn't make a lot of sense to me.
the following code works,
a(:, i:j) = chsift(a(:, i:j), shift = (/x, x, x/), dim =1)
but if i replace the shift with an array with value x and size 3 it goes out of bounds according to the results of compiling with -CB
what stupid thing am I doing wrong?
thanks
Jeremy
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't reproduce the problem based on this one line. Please submit a support request to Intel Premier Support and attach a small but complete program that demonstrates the problem. Or you can post a small but complete problem here for people to look at.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
okay here's an example where it does work
ifort -CB shiftprob.f90 -o shiftprob
hope someone can tell me what I'm doing wrong
thanks
Jeremy
program shiftprob !the idea of the program is that if we store a block diagonal matrix !in a way where none of the zeros are kept and we then want to recover the !full structure then the function undiag will stick the blocks onto the diagonal parts of the array. implicit none integer, parameter :: npol=3 real :: a(npol, 4*npol), b(4*npol, 4*npol) a = 1.0 !a is where the matrix is stored b = undiag(a) !b will be block diagonal with the elements of a on the 'diagonal' print*, 'a', a print*, 'b', b contains !===================================================== function undiag(x) real, dimension(:, :) :: x integer :: n, i, shift(npol) real, dimension(size(a, 2), size(a,2)) :: undiag n = size(x, 2) undiag = 0.0 undiag(1:npol, :) = x do i = 1, n - npol + 1, npol shift = i-1 undiag(:,i:i+npol-1) = cshift(undiag(:, i:i+npol-1),shift = (/i-1, i-1, i-1/) , dim = 1) end do end function undiag !==================================================== end program shiftproband here's one where it doesn't
program shiftprob !the idea of the program is that if we store a block diagonal matrix !in a way where none of the zeros are kept and we then want to recover the !full structure then the function undiag will stick the blocks onto the diagonal parts of the array. implicit none integer, parameter :: npol=3 real :: a(npol, 4*npol), b(4*npol, 4*npol) a = 1.0 !a is where the matrix is stored b = undiag(a) !b will be block diagonal with the elements of a on the 'diagonal' print*, 'a', a print*, 'b', b contains !===================================================== function undiag(x) real, dimension(:, :) :: x integer :: n, i, shift(npol) real, dimension(size(a, 2), size(a,2)) :: undiag n = size(x, 2) undiag = 0.0 undiag(1:npol, :) = x do i = 1, n - npol + 1, npol shift = i-1 undiag(:,i:i+npol-1) = cshift(undiag(:, i:i+npol-1),shift = shift , dim = 1) end do end function undiag !==================================================== end program shiftprobcompile with
ifort -CB shiftprob.f90 -o shiftprob
hope someone can tell me what I'm doing wrong
thanks
Jeremy
Message Edited by Steve_Lionel on 12-13-2005 12:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm - works for me. What do you get when you type:
ifort -what shiftprob.f90
ifort -what shiftprob.f90
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran 9.0-5238
thanks for helping
Jeremy
thanks for helping
Jeremy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm, that's somewhat old. There's an update coming out later this week - try it on that and let me know what happens.

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