Matrix vector multiplication

In summary, the conversation discusses using matrix multiplication in Fortran, specifically the use of the intrinsic function MATMUL. The end result should be a vector a, which is equal to the product of matrix c and vector b. However, there is some confusion about the order of the multiplication and the possibility of getting a number or a different matrix as the result. The conversation also touches on the correct usage of the word "know."
  • #1
Milentije
48
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
  • #2
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 ... ?
 
  • #4
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!
 
  • #5


I understand your frustration with this issue. Matrix vector multiplication can be confusing, especially when dealing with larger matrices and vectors. It is possible that there could be a programming issue, but it is also important to make sure you understand the mathematical principles behind matrix vector multiplication.

In your example, the matrix c is a 5x5 matrix, meaning it has 5 rows and 5 columns. The vector b is a 5x1 vector, meaning it has 5 rows and 1 column. In order to perform matrix vector multiplication, the number of columns in the matrix must equal the number of rows in the vector. In this case, c has 5 columns and b has 5 rows, so the multiplication is possible.

To perform the multiplication, you need to multiply each element in the first row of c by the corresponding element in b, and then add them together. This will give you the first element in the resulting vector a. Repeat this process for each row in c, and you will have your final vector a.

In terms of programming, you may need to use a specific function or syntax to perform matrix vector multiplication. The FORTRAN MATMUL function you mentioned appears to be a valid way to perform this operation, but it is always important to double check your code to make sure it is working correctly.

I hope this explanation helps to clarify the process of matrix vector multiplication. It is always important to understand the underlying principles in order to troubleshoot any issues that may arise. If you continue to have difficulty, it may be helpful to consult with a colleague or a programming expert for assistance.
 

What is matrix vector multiplication?

Matrix vector multiplication is a mathematical operation in which a given vector is multiplied by a matrix, resulting in a new vector. It is a fundamental concept in linear algebra and is commonly used in various scientific and engineering fields.

How is matrix vector multiplication performed?

To perform matrix vector multiplication, the number of columns in the matrix must be equal to the number of rows in the vector. The matrix is multiplied by each element in the vector, and the resulting values are added together to create a new vector with the same number of rows as the original matrix.

What are the applications of matrix vector multiplication?

Matrix vector multiplication is used in many applications, such as image processing, data compression, and computer graphics. It is also an important tool in solving systems of linear equations and in machine learning algorithms.

What is the difference between matrix vector multiplication and scalar multiplication?

The main difference between the two is that in matrix vector multiplication, the matrix is multiplied by a vector, resulting in a new vector. In scalar multiplication, a scalar value (a single number) is multiplied by each element in a matrix or vector, resulting in a new matrix or vector with the same dimensions as the original.

Can matrix vector multiplication be performed with matrices of different dimensions?

No, for matrix vector multiplication to be performed, the number of columns in the matrix must equal the number of rows in the vector. If the dimensions do not match, the operation cannot be performed. However, matrices of different dimensions can be multiplied using other methods, such as matrix multiplication.

Similar threads

  • Linear and Abstract Algebra
Replies
6
Views
516
  • Linear and Abstract Algebra
Replies
8
Views
875
  • Linear and Abstract Algebra
Replies
8
Views
785
  • Linear and Abstract Algebra
Replies
3
Views
1K
  • Linear and Abstract Algebra
Replies
8
Views
1K
  • Linear and Abstract Algebra
Replies
5
Views
1K
  • Linear and Abstract Algebra
Replies
10
Views
132
  • Linear and Abstract Algebra
Replies
10
Views
980
  • Linear and Abstract Algebra
Replies
1
Views
806
  • Linear and Abstract Algebra
Replies
4
Views
1K
Back
Top