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

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
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 ... ?