Matrix Square

Compute square of input matrix

Library

Math Functions / Matrices and Linear Algebra / Matrix Operations

dspmtrx3

  • Matrix Square block

Description

The Matrix Square block computes the square of an M-by-N input matrix, u, by premultiplying with the Hermitian transpose.

y = u' * u					% Equivalent MATLAB code 

The block treats length-M unoriented vector inputs as an M-by-1 matrix. When the input is an M-by-N matrix, the output of the block is an N-by-N matrix.

Applications

The Matrix Square block is useful in a variety of applications:

  • General matrix squares — The Matrix Square block computes the output matrix, y, without explicitly forming u'. It is therefore more efficient than other methods for computing the matrix square.

  • Sum of squares — When the input is a column vector (N=1), the block's operation is equivalent to a multiply-accumulate (MAC) process, or inner product. The output is the sum of the squares of the input, and is always a real scalar.

  • Correlation matrix — When the input is a row vector (M=1), the output, y, is the symmetric autocorrelation matrix, or outer product.

Parameters

Output minimum

Specify the minimum value the block should output. The default value is [] (unspecified). Simulink® software uses this value to perform:

  • Simulation range checking (see Specify Signal Ranges (Simulink))

  • Automatic scaling of fixed-point data types

Output maximum

Specify the maximum value the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:

  • Simulation range checking (see Specify Signal Ranges (Simulink))

  • Automatic scaling of fixed-point data types

Output data type

Specify the output data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule. For more information on this rule, see Inherit via Internal Rule.

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Control Signal Data Types (Simulink) for more information.

Lock output data type setting against changes by the fixed-point tools

Select this parameter to prevent the fixed-point tools from overriding the Output data type you specify on the block mask.

Integer rounding mode

Select the rounding mode for fixed-point operations.

Saturate on integer overflow

Select this check box to have overflows saturate to the maximum or minimum value that the data type can represent. If you clear this check box, the block wraps all overflows. See overflow mode for more information.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.

Supported Data Types

  • Double-precision floating point

  • Single-precision floating point

See Also

Matrix Multiply (Simulink)DSP System Toolbox
Matrix ProductDSP System Toolbox
Matrix Sum (Simulink)DSP System Toolbox

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Introduced before R2006a