LinearAlgebra - Maple Programming Help

Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Standard : LinearAlgebra/MatrixMatrixMultiply

LinearAlgebra

 MatrixMatrixMultiply
 compute the product of two Matrices

 Calling Sequence MatrixMatrixMultiply(A, B, ip, options)

Parameters

 A - Matrix B - Matrix ip - (optional) BooleanOpt(inplace); specifies if output overwrites input only in the case where B is square options - (optional); constructor options for the result object

Description

 • The MatrixMatrixMultiply(A, B) function computes the standard matrix product $A\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}B$. The resulting Matrix has the same number of rows as A and the same number of columns as B.
 • The inplace option (ip) determines where the result is returned. If given as inplace=true and B is square, the result overwrites the first argument. Otherwise, if given as inplace=false or if this option is not included in the calling sequence, the result is returned in a new Matrix.
 The condition inplace=true can be abbreviated to inplace.
 The inplace option must be used with caution since, if the operation fails, the original Matrix argument may be corrupted.
 • The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 • The inplace and constructor options are mutually exclusive.
 • This function is part of the LinearAlgebra package, and so it can be used in the form MatrixMatrixMultiply(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[MatrixMatrixMultiply](..).
 • This function (with no additional options) has an equivalent shortcut notation, $A\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}B$. For more information, see the dot operator.
 • This routine allows for acceleration by the Graphics Processing Unit (GPU) on hardware supporting Compute Unified Device Architecture (CUDA). See CUDA and CUDA,supported_routines for additional details.

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $R≔\mathrm{Matrix}\left(\left[\left[\mathrm{cos}\left(\mathrm{θ}\right),-\mathrm{sin}\left(\mathrm{θ}\right)\right],\left[\mathrm{sin}\left(\mathrm{θ}\right),\mathrm{cos}\left(\mathrm{θ}\right)\right]\right]\right)$
 ${R}{≔}\left[\begin{array}{cc}{\mathrm{cos}}{}\left({\mathrm{θ}}\right)& {-}{\mathrm{sin}}{}\left({\mathrm{θ}}\right)\\ {\mathrm{sin}}{}\left({\mathrm{θ}}\right)& {\mathrm{cos}}{}\left({\mathrm{θ}}\right)\end{array}\right]$ (1)
 > $M≔\mathrm{MatrixMatrixMultiply}\left(R,\mathrm{Transpose}\left(R\right)\right)$
 ${M}{≔}\left[\begin{array}{cc}{{\mathrm{cos}}{}\left({\mathrm{θ}}\right)}^{{2}}{+}{{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}^{{2}}& {0}\\ {0}& {{\mathrm{cos}}{}\left({\mathrm{θ}}\right)}^{{2}}{+}{{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}^{{2}}\end{array}\right]$ (2)
 > $\mathrm{Map}\left(\mathrm{simplify},M\right)$
 $\left[\begin{array}{rr}{1}& {0}\\ {0}& {1}\end{array}\right]$ (3)
 > $A≔\mathrm{Matrix}\left(1,3,\left(i,j\right)→{a}_{i,j}\right):$
 > $B≔\mathrm{Matrix}\left(3,1,\left(i,j\right)→{b}_{i,j}\right):$
 > $\mathrm{MatrixMatrixMultiply}\left(A,B\right)$
 $\left[\begin{array}{c}{{a}}_{{1}{,}{1}}{}{{b}}_{{1}{,}{1}}{+}{{a}}_{{1}{,}{2}}{}{{b}}_{{2}{,}{1}}{+}{{a}}_{{1}{,}{3}}{}{{b}}_{{3}{,}{1}}\end{array}\right]$ (4)