Next: multisieve, Previous: mod, Up: Internal Routines [Contents][Index]

`mproduct(`

`m1`, `m2` [, /inner, /outer])

Returns the matrix product of two- or more-dimensional real-valued
column-major matrices

and `m1`

. The matrix
product is calculated across the first two dimensions only. The 1st
(column) dimension of `m2`

must equal the 2nd (row)
dimension of `m1`

.
`m2`

If

or `m1`

have more than two dimensions,
then they can be multiplied in “inner” or “outer” fashion,
selected by `m2``/inner`

(the default) or `/outer`

,
respectively.

By default, or if `/inner`

is selected, then dimensions beyond
the first two must be equal in both arguments, and one matrix product
of the first two dimensions is calculated for each element of

beyond the first two dimension and for the
corresponding element of `m1`

.
`m2`

For example, if `x = indgen(dblarr(2,3,4))`

and ```
y =
indgen(dblarr(5,2,4))
```

, then `z = mproduct(x,y)`

or ```
z =
mproduct(x,y,/inner)
```

gets dimensions 5, 3, 4, and `z(*,*,i)`

is
equal to `mproduct(x(*,*,i),y(*,*,i))`

.

If `/outer`

is selected, then dimensions beyond the first two do
not need to be equal in both arguments, and one matrix product of the
first two dimensions is calculated for each possible combination of
one element of

beyond the first two dimensions and one
element of `m1`

beyond the first two dimensions.
`m2`

For example, if `x = indgen(dblarr(2,3,4)`

and ```
y =
indgen(dblarr(5,2,4)
```

, then `z = mproduct(x,y,/outer)`

gets
dimensions 5, 3, 4, 4, and `z(*,*,i,j)`

is equal to
`mproduct(x(*,*,i),y(*,*,j))`

.

This functions gets called when the `#`

operator is used.
`x # y`

is equivalent to `mproduct(x,y)`

.