- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - yingwu
Hi,
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
real :: d(1,1),c, A(1,5), B(5,1)
equivalence (d(1,1),c)
A=1
B=2
d=matmul(A,B)
Print *, c
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - yingwu
Hi,
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
real :: d(1,1),c, A(1,5), B(5,1)
equivalence (d(1,1),c)
A=1
B=2
d=matmul(A,B)
Print *, c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I always use:
program mymatmul
real(kind=4) :: a(1,5),b(5,1),c
a=1.
b=2.
c=maxval(matmul(a,b))
end program mymatmul
I always use:
program mymatmul
real(kind=4) :: a(1,5),b(5,1),c
a=1.
b=2.
c=maxval(matmul(a,b))
end program mymatmul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - anthonyrichards
Quoting - yingwu
Hi,
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
After evaluating the IVF, I love it and decide to give up the matlab. However, I really need somebody help me to make clear of my questions. One is about matmul(A,B). I define two arrays
real :: A(1,5), B(5,1)
then A=1;B=2
Now if I multiply the array A and the array B by using matmul(A,B), the result will be a array (result array) whose dimension is (1,1). Thus there is only one cell in the result array with a REAL value.
Here is my question. I want to define another real-type variable 'c' and set the value of 'c' equals to the cell value of the result array above. I tried
real :: c=0
c=matmul(A,B)
However, I get an error message, "error #6366: The shapes of the array expressions do not conform". I know the reason because a real variable can not equal to an array. But my question is how can I do this? I mean when I have a (1,1) array and I want to set the value of the only cell in this array to a real variable, how can I do this?
Thanks very much.
real :: d(1,1),c, A(1,5), B(5,1)
equivalence (d(1,1),c)
A=1
B=2
d=matmul(A,B)
Print *, c
real :: d(1,1),c, A(1,5), B(5,1)
A=1
B=2
d=matmul(A,B)
c = d(1,1)
Print *, c

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