## 6.7.18 MatrixToVector

### 6.7.18.1 Outline of the node

Convert the Matrix<ObjectRef> type to the Vector<ObjectRef> type when the ObjectRef of the Matrix<ObjectRef> given as the input is either the float type or the complex<float> type.

### 6.7.18.2 Necessary file

No files are required.

### 6.7.18.3 Usage

When to use

This node is used to convert the Matrix<ObjectRef> type to the Vector<ObjectRef> type when the ObjectRef of the Matrix<ObjectRef> given as the input is either the float type or the complex<float> type. Taking a Matrix<float> as the input will output a Vector<float> . Taking a Matrix<complex<float> > as the input will output a Vector<complex<float> > .

### 6.7.18.4 Input-output and property of the node

Input

INPUT

: any  type. Note that the supported data types are the Matrix<float> type and the Matrix<complex<float> > type.

Output

OUTPUT

: any  type. Note that the supported data types are the Vector<float> type and the Vector<complex<float> > type.

Parameter

Table 6.116: Parameter list of MatrixToVector
 Parameter name Type Default value Unit Description METHOD reshape The method to convert Matrix to Vector . Select reshape or accumulate. Convert by reshaping the matrix with the original elements unchanged or by replacing the original elements of the matrix with the accumulated value. RESHAPE_ORDER row The order for storing multidimensional arrays in linear storage. Select row or column. Reshape the matrix given into a vector by row-major order or by column-major order. ACCUMULATE_METHOD row_sum The method to accumulate the elements of the matrix. Select one from row_sum, col_sum, row_avg, or col_avg. Calculate the sum of the elements in each row, the sum of the elements in each column, the average the elements in each row, and the average of the elements in each column, respectively DEBUG false Enable or disable to output the conversion status to standard output.
METHOD

: string  type. The method to convert the Matrix<ObjectRef> type to the Vector<ObjectRef> type; Matrix<float> to Vector<float> , or Matrix<complex<float> > to Vector<complex<float> > . Select reshape or accumulate. Selecting reshape reshapes the Matrix<ObjectRef> given as the input into a Vector by row-major order or by column-major order. Selecting accumulate calculates the elements of the Matrix<ObjectRef> by rows or by columns and then replaces the elements with the accumulated value. The default value is reshape.

RESHAPE_ORDER

: string  type. The order to reshape the input Matrix . When the parameter value of METHOD is set to reshape, specify the desired value. Select row, or column. Selecting row reshapes the matrix by row-major order. Selecting column reshapes the matrix by column-major order. The default value is row.

ACCUMULATE_METHOD

: string  type. The method to accumulate the elements of the Matrix when the parameter value of METHOD is set to accumulate. Select row_sum, col_sum, row_avg, or col_avg. Calculate the sum of elements in each row, the sum of elements in each column, the average of the elements in each row, and the average of the elements in each column, respectively. The default value is row_sum.

DEBUG

: bool  type. Setting the value to true outputs the conversion status to the standard output. The default value is false.

### 6.7.18.5 Details of the node

Table 6.117: Conversion table of MatrixToVector
 INPUT METHOD RESHAPE _ORDER ACCUMULATE _METHOD OUTPUT type size type size reshape row - (NxM) (1) column (2) row_sum N (3) accumulate - row_avg (4) col_sum M (5) NxM col_avg (6) reshape row - (NxM) column row_sum N accumulate - row_avg col_sum M col_avg

$<$example$>$

INPUT:

 $\left[ \begin{array}{cc} 1 & 2\\ 3 & 4\\ 5 & 6 \end{array} \right]$

OUTPUT(1):

 $\begin{tabular}{c} < 1 ~ 2 ~ 3 ~ 4 ~ 5 ~ 6 > \end{tabular}$

OUTPUT(2):

 $\begin{tabular}{c} < 1 ~ 3 ~ 5 ~ 2 ~ 4 ~ 6 > \end{tabular}$

OUTPUT(3):

 $\begin{tabular}{c} < 3 ~ 7 ~ 11 > ~ \longleftarrow ~ < 1+2 ~ 3+4 ~ 5+6 > \end{tabular}$

OUTPUT(4):

 $\begin{tabular}{c} < 1.5 ~ 3.5 ~ 5.5 > ~ \longleftarrow ~ < (1+2)/2 ~ (3+4)/2 ~ (5+6)/2 > \end{tabular}$

OUTPUT(5):

 $\begin{tabular}{c} < 9 ~ 12 > ~ \longleftarrow ~ < 1+3+5 ~ 2+4+6 > \end{tabular}$

OUTPUT(6):

 $\begin{tabular}{c} < 3 ~ 4 > ~ \longleftarrow ~ < (1+3+5)/3 ~ (2+4+6)/3 > \end{tabular}$