From: Gregory Larose on 26 Mar 2010 14:11 I keep getting this error when I run my file: In file lab12A.f95:56 RESULT = MATMUL(array, array2) 1 Error: Incompatible ranks 0 and 2 in assignment at (1). There is what the statement looks like in my file: DO irows = 1, ROWS RESULT = MATMUL(array, array2) WRITE(*,*)irows, RESULT END DO How do i fix it? Please help.
From: dpb on 26 Mar 2010 14:37 Gregory Larose wrote: > I keep getting this error when I run my file: > > In file lab12A.f95:56 > > RESULT = MATMUL(array, array2) > 1 > Error: Incompatible ranks 0 and 2 in assignment at (1). > > There is what the statement looks like in my file: > > DO irows = 1, ROWS > RESULT = MATMUL(array, array2) > WRITE(*,*)irows, RESULT > END DO > > How do i fix it? Please help. Fix the problem... :) You don't show the size declarations for either argument to the MATMUL call, but the result has to have the size at least that of that required for the conformance of matrix multiplication. If a1, a2 are mxn and nxk, then matmul(a1,a2) will be mxk The error indicates you didn't allocate an array for RESULT at all (rank 0) --
From: glen herrmannsfeldt on 26 Mar 2010 15:18 Gregory Larose <gregorylarose(a)gmail.com> wrote: > I keep getting this error when I run my file: > RESULT = MATMUL(array, array2) > 1 > Error: Incompatible ranks 0 and 2 in assignment at (1). What are the dimensions for RESULT, array, and array2? Also, why is RESULT independent of irows, but computed inside the loop? > There is what the statement looks like in my file: > DO irows = 1, ROWS > RESULT = MATMUL(array, array2) > WRITE(*,*)irows, RESULT > END DO > How do i fix it? Please help. What are you actually trying to do? -- glen
From: Greg on 26 Mar 2010 22:17 I'm trying to create a MULMAT statement, but i don't know why i keep getting this error. --- frmsrcurl: http://compgroups.net/comp.lang.fortran/Problem-with-Matmul
From: Richard Maine on 26 Mar 2010 23:16 Greg <user(a)compgroups.net/> wrote: > I'm trying to create a MULMAT statement, but i don't know why i keep getting this error. See the other posts. Realize 1. There is no such thing as a "matmul statement" (I assume mulmat was a typo for matmul, but that isn't the point). MATMUL is just a function like many other finctions; it is not a distinct statement. What you have is an assignment statement. In fact... 2. It appears that your problem is not related to MATMUL at all, but rather to the assignment. The MATMUL part is fine. What is not fine is that you apparently are trying to assign the result of MATMUL to a scalar.The result isn't a scalar and you can't assign it to one. 3. Show your declarations. They are very important. It is quite common for problems to be in the declarations instead of the executable statements. That appears likely to be the case here. People are just having to guess that you didn't declare result to be an array because that is suggested by the erro rmessage. Diagnosing computer code can be hard enough even when one has the code to look at. It is much harder when one has to diagnose problems in code that isn't even shown - such as the declarations here. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
|
Next
|
Last
Pages: 1 2 Prev: equivalent in fortran of the IDL "where" function Next: Does PAUSE have any Side Effect ?? |