6.7.15 MatrixToVector

6.7.15.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.15.2 Necessary file

No files are required.

6.7.15.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.15.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.102: Parameter list of MatrixToVector 

Parameter name

Type

Default value

Unit

Description

METHOD

string 

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

string 

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

string 

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

bool 

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. The default value is false. Setting the value to trueoutputs the conversion status to the standard output.

6.7.15.5 Details of the node

Table 6.103: Conversion table of MatrixToVector 

INPUT

OUTPUT

METHOD

RESHAPE _ORDER

ACCUMULATE _METHOD

 

type

size

type

size

       
     

(NxM)

reshape

row

-

(1)

         

column

 

(2)

Matrix<float> 

 

Vector<float> 

N

   

row_sum

(3)

       

accumulate

-

row_avg

(4)

     

M

   

col_sum

(5)

 

NxM

       

col_avg

(6)

     

(NxM)

reshape

row

-

 
         

column

   

Matrix<complex<float> > 

 

Vector<complex<float> > 

N

   

row_sum

 
       

accumulate

-

row_avg

 
     

M

   

col_sum

 
           

col_avg

 

$<$example$>$

INPUT:

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


OUTPUT(1): $<$ 1 2 3 4 5 6 $>$

OUTPUT(2): $<$ 1 3 5 2 4 6 $>$

OUTPUT(3): $<$ 3 7 11 $>$ ← $<$ 1+2 3+4 5+6 $>$

OUTPUT(4): $<$ 1.5 3.5 5.5 $>$ ← $<$ (1+2)/2 (3+4)/2 (5+6)/2 $>$

OUTPUT(5): $<$ 9 12 $>$ ← $<$ 1+3+5 2+4+6 $>$

OUTPUT(6): $<$ 3 4 $>$ ← $<$ (1+3+5)/3 (2+4+6)/3 $>$