How to calculate the inner product of two vectors in python?

Source: Internet
Author: User

1>>> A=mat ([[1],[2],[3]]);2>>> B=mat ([[0],[2],[3]]);3>>>a4Matrix ([[1],5[2],6[3]])7>>>b8 Matrix ([[0],9[2],Ten[3]]) One>>> a.t*b AMatrix ([[13]])

The above is calculated for the inner product of two column vectors, noting the construction of the column vectors a=mat ([[1],[2],[3]]);

The following is a calculation of the inner product of two line vectors, and the construction of the line vectors is A=mat ([[three]]);

1 >>> A=mat ([[[+]]); 2 >>> b=mat ([[0,2,3]]); 3 >>> a4 matrix ([[[1, 2, 3]])5 >>> b6 Matrix ([[[0, 2, 3]])7 >>> *b.t8 matrix ([[[]])  9

How to calculate the inner product of two vectors in python?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.