27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MATRIX—END MATRIX 921<br />

• The relational and logical operations described below require that the two matrices be the<br />

same size.<br />

• Matrix multiplication requires that the number of columns of the first matrix equal the<br />

number of rows of the second matrix.<br />

• Raising a matrix to a power can be done only if the matrix is square. This includes the<br />

important operation of inverting a matrix, where the power is – 1 .<br />

• Conformability requirements for matrix functions are noted in “Matrix Functions” on p. 927<br />

and in “COMPUTE Statement” on p. 926.<br />

Scalar Expansion<br />

When one of the matrices involved in an operation is a scalar, the scalar is treated as a matrix<br />

of the correct size in order to carry out the operation. This internal scalar expansion is<br />

performed for the following operations:<br />

• Addition and subtraction.<br />

• Elementwise multiplication, division, and exponentiation. Note that multiplying a matrix<br />

elementwise by an expanded scalar is equivalent to ordinary scalar multiplication—each<br />

element of the matrix is multiplied by the scalar.<br />

• All relational and logical operators.<br />

Arithmetic Operators<br />

You can add, subtract, multiply, or exponentiate matrices according to the rules of matrix<br />

algebra, or you can perform elementwise arithmetic, in which you multiply, divide, or exponentiate<br />

each element of a matrix separately. The arithmetic operators are listed below.<br />

Unary – Sign reversal. A minus sign placed in front of a matrix reverses the sign of each<br />

element. (The unary + is also accepted but has no effect.)<br />

+<br />

Matrix addition. Corresponding elements of the two matrices are added. The<br />

matrices must have the same dimensions, or one must be a scalar.<br />

– Matrix subtraction. Corresponding elements of the two matrices are subtracted.<br />

The matrices must have the same dimensions, or one must be a scalar.<br />

*<br />

/<br />

Multiplication. There are two cases. First, scalar multiplication: if either of the<br />

matrices is a scalar, each element of the other matrix is multiplied by that scalar.<br />

Second, matrix multiplication: if A is an m × n matrix and B is an n× p matrix,<br />

A*B is an m× p matrix in which the element in row i, column k, is equal to<br />

n<br />

Ai,j ( ) × Bj,k ( ) .<br />

Σj = 1<br />

Division. The division operator performs elementwise division (described below).<br />

True matrix division, the inverse operation of matrix multiplication, is accomplished<br />

by taking the INV function (square matrices) or the GINV function (rectangular<br />

matrices) of the denominator and multiplying.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!