The MATRIX_MULTIPLY function calculates the IDL # operator of two (possibly transposed) arrays. The transpose operation (if desired) is done simultaneously with the multiplication, thus conserving memory and increasing the speed of the operation. If the arrays are not transposed, then MATRIX_MULTIPLY is equivalent to using the # operator.

### The # Operator vs. MATRIX_MULTIPLY

The following table illustrates how various operations are performed using the # operator versus the MATRIX_MULTIPLY function:

# Operator |
Function |

A # B |
MATRIX_MULTIPLY( |

transpose(A) # B |
MATRIX_MULTIPLY( |

A # transpose(B) |
MATRIX_MULTIPLY( |

transpose(A) # transpose(B) |
MATRIX_MULTIPLY( |

**Note: **MATRIX_MULTIPLY can also be used in place of the ## operator. For example, A ## B is equivalent to MATRIX_MULTIPLY(*B*, *A*), and A ## TRANSPOSE(B) is equivalent to MATRIX_MULTIPLY(*B*, *A*, /ATRANSPOSE).

## Syntax

*Result* = MATRIX_MULTIPLY( *A*, *B* [, /ATRANSPOSE] [, /BTRANSPOSE] )

## Return Value

The type for the result depends upon the input type. For byte or integer arrays, the result has the type of the next-larger integer type that could contain the result (for example, byte, integer, or long input returns type long integer). For floating-point, the result has the same type as the input.

For the case of no transpose, the resulting array has the same number of columns as the first array and the same number of rows as the second array. The second array must have the same number of columns as the first array has rows.

**Note: **If A and B arguments are vectors, then C = MATRIX_MULTIPLY(*A*, *B*) is a matrix with *C*_{ij }= *A*_{i}*B*_{j}. Mathematically, this is equivalent to the outer product, usually denoted by AÃ„B.

## Arguments

### A

The left operand for the matrix multiplication. Dimensions higher than two are ignored.

### B

The right operand for the matrix multiplication. Dimensions higher than two are ignored.

## Keywords

### ATRANSPOSE

Set this keyword to multiply using the transpose of *A*.

### BTRANSPOSE

Set this keyword to multiply using the transpose of *B*.

### Thread Pool Keywords

This routine is written to make use of IDLâ€™s *thread pool*, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

## Version History

5.4 |
Introduced |

## See Also

ï»¿

## Notes

This page has no user notes yet. Be the first one!