Engee documentation

Permute Matrix

Rearranging rows or columns of a matrix.

blockType: PermuteMatrix

Path in the library:

/Basic/Matrix Operations/Permute Matrix

Description

Block Permute Matrix generates a new matrix from the columns (rows) of the original matrix by rearranging and/or copying them. The block rearranges the rows or columns of the input matrix size on according to the column (row) numbers received from the input P.

Ports

Input

# A — the input matrix
scalar | vector | the matrix

Details

The original matrix.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

Yes

# P — column (row) numbers to be rearranged
scalar | vector | the matrix

Details

Column (row) numbers of the matrix , from which a new matrix will be formed. Scalar or vector.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Complex numbers support

Yes

Output

# OUT_1 — the output matrix
scalar | vector | the matrix

Details

The output matrix formed by rearranging the rows or columns of the input. The output data type is the same as the input. The dimension of the original matrix is preserved.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

Yes

Parameters

Main

# Permute — the permutation method
Columns | Rows

Details

Specifies whether the columns or rows of the input matrix will be rearranged to get the output matrix.

If the parameter Permute it matters:

  • Rows — the block uses the rows of the input matrix to create a matrix with the same column dimension. The input P is a vector of length , the elements of which determine where each row from the input matrix should be placed in the output matrix on .

    To rearrange the rows, the block considers an undirected length vector. , arriving at port A, as a matrix on .

  • Columns — the block uses the columns of the input matrix to create a matrix with the same row dimension. A length vector is fed to the input P , the elements of which determine where each column from the input matrix should be placed in the output matrix on .

    To rearrange the columns, the block considers an undirected length vector. , arriving at port A, as a matrix on .

Values

Columns | Rows

Default value

Columns

Program usage name

mode

Tunable

No

Evaluatable

No

# Index Mode — index mode
One-based | Zero-based

Details

When setting the value One-based meaning 1 in the permutation vector refers to the first row or column of the input matrix . During installation Zero-based meaning 0 in refers to the first row or column .

Values

One-based | Zero-based

Default value

One-based

Program usage name

ZeroOneIdxMode

Tunable

No

Evaluatable

No

# Invalid permutation index — reaction to an invalid index value
Clip index | Clip and warn | Generate error

Details

A reaction to an invalid index value. If the index value in the input P refers to a non-existent row or column of the input matrix , the block reacts as specified in this parameter. The following options are possible:

  • Clip index — trim the index to the nearest acceptable value (1 or to rearrange the rows and 1 or to rearrange columns) and not issue a warning.

    Example: For the input matrix 3 on 7 the column index is equal to 9, is cropped to 7, and the row index is equal to −2, is cropped to 1.

  • Clip and warn — the same as the previous option; in future releases, when you select this option, a warning message will be displayed in the Engee command prompt window.

  • Generate error — display the error dialog box and abort the simulation.

Values

Clip index | Clip and warn | Generate error

Default value

Clip index

Program usage name

errmode

Tunable

No

Evaluatable

No

# Error when length of P is not equal to Permute dimension size — error message for length
Logical

Details

The option to display an error dialog box and stop modeling if the length of the permutation vector is is not equal to the number of rows or columns of the input matrix .

You can choose to open the error dialog box and end the simulation by setting this parameter to on.

Default value

false (switched off)

Program usage name

checkDims

Tunable

No

Evaluatable

No