0

I want to define the following matrix A = b * c ^T.

So the product from a column vector b and a transposed column vector c. This product is a matrix.

In this case b and c have the same amount of components thus multiplication is possible.

The np.transpose(c) command did not really help me because when I did

import numpy as np
b = np.array([1,1])
c = np.array([0,1])

d = np.transpose(c)
A = b * d
print(A)

I received the vector [0,1] but I should be receiving a matrix. Because a column vector multiplied with a transposed column vector yields a matrix. What could I do instead?

sakabukayo
  • 33
  • 4

1 Answers1

0

The main problem you are facing is when you define the matrix b and c. When you work with matrix in python, normally, the definition is the following:

A list of list of line vectors of the matrix.

A = [[a11,a12,a13,...],
     [a21,a22,a23, ...],
     ...]

So be careful, because you are defining the matrix in some vector way. As I can see you consider b and c column matrix the way I will define it is this:

b = np.array([[1],[1]])
c = np.array([[0],[1]])
luisch444
  • 31
  • 5