kronecker product

275 views
Skip to first unread message

Saman Kaviani

unread,
Jun 28, 2012, 9:58:40 AM6/28/12
to gg...@googlegroups.com
Hi there
Can anybody tell me how I can do Kronecker product in fortran90?
NB: I know google is my friend and I found two subroutines and they did not work. If you know the answer please respond this email.
best, 
Saman 
361.gif

Youngung Jeong

unread,
Jun 28, 2012, 10:33:09 AM6/28/12
to gg...@googlegroups.com
Hi,
Just for curiosity, when you said they don't work, you mean they are not compilable or what?



Saman 

--
You received this message because you are subscribed to the Google Groups "gg95" group.
To post to this group, send email to gg...@googlegroups.com.
To unsubscribe from this group, send email to gg95+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gg95?hl=en.

361.gif

Saman Kaviani

unread,
Jun 28, 2012, 11:08:17 AM6/28/12
to gg...@googlegroups.com
On Thu, Jun 28, 2012 at 4:33 PM, Youngung Jeong <youngun...@gmail.com> wrote:
Hi,
Just for curiosity, when you said they don't work, you mean they are not compilable or what?

I mean there is always error in compiling!
here is the code maybe you can try and let me the solution :
!-----------------------------------------------------------------------------------------------
SUBROUTINE KRON(K, A, B)
    IMPLICIT NONE
    REAL, INTENT(IN)  :: A(:,:), B(:,:)
    REAL, INTENT(INOUT) :: K(:,:)
    INTEGER :: I, J, MA, NA, MB, NB
    MA = UBOUND(A, 1)
    NA = UBOUND(A, 2)
    MB = UBOUND(B, 1)
    NB = UBOUND(B, 2)
    IF (SIZE(K,1) /= MA*MB .OR. SIZE(K,2) /= NA*NB) THEN
        WRITE(*,*) 'K has invalid size'
        CALL ABORT
    END IF
    FORALL(I=1:MA, J=1:NA)
        K(MB*(I-1)+1:MB*I,NB*(J-1)+1:NB*J) = A(I,J)*B
    END FORALL
END SUBROUTINE KRON
!----------------------------------------------------------------------------------------------------------------
361.gif

Youngung Jeong

unread,
Jun 28, 2012, 11:24:38 AM6/28/12
to gg...@googlegroups.com
What error messages you've got? What compiler did you use?

  Youngung Jeong, 정영웅
361.gif

evan

unread,
Nov 23, 2012, 4:37:50 AM11/23/12
to gg...@googlegroups.com
Delete the following line

CALL ABORT
Reply all
Reply to author
Forward
0 new messages