0

I am new to python so by gentle with me , I try to convert code from Matlab to numpy python , I am working with matrix .

I have some basic question (that I didn't found the answers in Google):

What is the equivalent for the ' tag for example : H' , H= H*H'

What is the equivalent for the / (mrdivide) tag for example : H= H/A

Thanks, MAK

1

1 Answer 1

4
  • ' (transpose) means the conjugate transpose of a matrix. For real matrices, it is given by np.transpose(arr) or the shorthand arr.T. For complex matrices, you need to use more complicated arr.conj().T.

  • / (mrdivide) solves the equation x A = b -> x = b / A using least squares (np.linalg.lstsq). This is equivalent to (x A)^T = b^T -> A^T x^T = b^T, which can be done using np.linalg.lstsq(A.T, b.T).T.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your helpful answers!! . In your answer you make a little work around job :-) , you use the equation B/A = (A'\B')' (np.linalg.lstsq(A.T, b.T).T). Thare any straightforward method in numpy for solves the equation B/A? . In addition the method (np.linalg.lstsq) work only for A n-by-n matrix and B is a matrix with n columns ? or like matlab give full solution ?, again THANKS!!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.