HBC17386Matrix Multiplication题解 (matrixmultiplication)

庄子墨 算法基础篇 39 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
In mathematics, matrix multiplication or matrix product is a binary operation that produces a matrix from two matrices with entries in a field, or, more generally, in a ring or even a semiring. The ma

In mathematics, matrix multiplication or matrix product is a binary operation that produces a matrix from two matrices with entries in a field, or, more generally, in a ring or even a semiring. The matrix product is designed for representing the composition of linear maps that are represented by matrices. Matrix multiplication is thus a basic tool of linear algebra, and as such has numerous applications in many areas of mathematics, as well as in applied mathematics, physics, and engineering. In more detail, if A is an n x m matrix and B is an m x p matrix, their product AB is an n x p matrix, in which the m entries across a row of A are multiplied with the m emtries down a column of B and summed to produce an entry of AB. When two linear maps are represented by matrices, then the matrix product represents the composition of the two maps. We can only multiply two matrices if their dimensions are compatible, which means the number of columns in the first matrix is the same as the number of rows in the second matrix.  If A is an n x m matrix and B is an m x p matrix, the matrix product C = AB is defined to be the n x p matrix such that cij=∑k=1maikbkjc_{ij} = sum_{k=1}^{m} a_{ik} b_{kj}cij​=∑k=1m​aik​bkj​, for i = 1,2, ..., n and j = 1,2, ..., p. Your task is to design a matrix multiplication calculator to multiply two matrices and display the output. If the matrices cannot be multiplied, display "ERROR".

HBC17386Matrix Multiplication题解
(matrixmultiplication)-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC17386Matrix Multiplication题解