Why Does My Matrix Vector Multiplication in FORTRAN Not Work as Expected?

Click For Summary
The discussion revolves around a FORTRAN issue with matrix-vector multiplication. The user has a 5x5 matrix and a vector, expecting a specific result from the multiplication. However, confusion arises regarding the use of the MATMUL function, as it appears the user is attempting to multiply the vector by the matrix instead of the other way around. Clarification is provided that MATMUL may yield different results based on the order of multiplication. The thread emphasizes the importance of correctly understanding the function's application and naming conventions in programming.
Milentije
Messages
47
Reaction score
0
I have a problem with something that should be very simple,I do not no if it is programming issue or my ignorance.
If I have matrix c(5,5)
3 0 0 0 0
1 2 0 0 0
0 1 2 0 0
0 0 1 4 1
0 0 0 1 2
and vector b(1,2,3,4,5)

c*b=a

a=(3,5,8,24,14)
FORTRAN MATMUL
C=MATMUL(B,A)

Correct?
 
Physics news on Phys.org
a=(3,5,8,24,14)

That is correct.

C=MATMUL(B,A)
I don't know Fortran at all, but here you are multiplying B and A to get C. This is different from what you said earlier (multiplying C and B to get A). I don't know that MATMUL does with two vectors, but you will either get a number (the inner product) or a matrix (but not the one you expect).

Did you mix up your naming, or ... ?
 
I do not no if it is programming issue or my ignorance
'no' means negation or the absence of something.

Perhaps here he used it correctly!
 
Thread 'How to define a vector field?'
Hello! In one book I saw that function ##V## of 3 variables ##V_x, V_y, V_z## (vector field in 3D) can be decomposed in a Taylor series without higher-order terms (partial derivative of second power and higher) at point ##(0,0,0)## such way: I think so: higher-order terms can be neglected because partial derivative of second power and higher are equal to 0. Is this true? And how to define vector field correctly for this case? (In the book I found nothing and my attempt was wrong...

Similar threads

  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 24 ·
Replies
24
Views
2K