6.7.16 MatrixToMap

6.7.16.1 Outline of the node

Convert the Matrix<ObjectRef> type to the Map<int, 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.16.2 Necessary files

No files are required.

6.7.16.3 Usage

When to use

This node is used to convert the Matrix<ObjectRef> type to the Map<int, 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 Map$<$int , Matrix<float> $>$.Taking a Matrix<complex<float> > as the input will output a Map$<$int , Matrix<complex<float> > $>$. This node is for connecting to the nodes whose data type for the input is the Map<int, ObjectRef> type, for instance, PreEmphasis , MelFilterBank , or SaveRawPCM .

Typical connection

Figure 6.106 and 6.107 show connection examples for the MatrixToMap . The sample network in Figure 6.106 takes speech waveform data from microphones using AudioStreamFromMic , selects the necessary channels using ChannelSelector, and converts the data in the Matrix<float> type to the one in the Map<int, ObjectRef> type using MatrixToMap .By connecting the OUTPUT terminal of MatrixToMap to the INPUT terminal of SaveRawPCM , save the output data in a file.

The sample network in Figure 6.107 shows how to use MatrixToMap when spectra of waveform data are desired in Map<int, ObjectRef> data type. As shown in Figure 6.107, MultiFFT can be connected to MatrixToMap .The order of arrangement of nodes does not matter, MatrixToMap can be placed before or after MultiFFT .

\includegraphics[width=.9\textwidth ]{fig/modules/MatrixToMap-1}
Figure 6.106: Connection example of MatrixToMap to SaveRawPCM 

\includegraphics[width=.9\textwidth ]{fig/modules/MatrixToMap-2}
Figure 6.107: Connection example of MatrixToMap to MultiFFT 

6.7.16.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

: Map$<$int , Matrix<float> $>$, Map$<$int , Matrix<complex<float> > $>$, Map$<$int , Vector<float> $>$, or Map$<$int , Vector<complex<float> > $>$ of the Map<int, ObjectRef> type.

Parameter

Table 6.107: Parameter list of MatrixToMap 

Parameter name

Type

Default value

Unit

Description

OUTPUT_TYPE

string 

map_of_row_vectors

 

The data type of the output data. Select one from map_of_matrix, map_of_row_vectors, or map_of_column_vectors.

DEBUG

bool 

false

 

Enable or disable to output the conversion status to standard output.

OUTPUT_TYPE

: string  type. The data type of the output data. Select one from map_of_matrix, map_of_row_vectors, or map_of_column_vectors. Selecting map_of_matrix outputs a Map whose key is 0 and whose ObjectRef is the Matrix given as the input. Selecting map_of_row_vectors outputs Map as many as the number of rows of the Matrix given as the input.The each Map’s key is the row index of the Matrix and the each ObjectRef is a Vector consisting of the row components of the Matrix . Selecting map_of_column_vectors outputs Map as many as the number of columns of the Matrix . The each Map’s key is the column index of the Matrix and the each ObjectRef is a Vector consisting of the column components of the Matrix . The default value is map_of_row_vectors.

DEBUG

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

6.7.16.5 Details of the node

Table 6.108: Conversion table of MatrixToMap 

INPUT

OUT_TYPE

OUTPUT

 

type

size

 

type

size

 
   

map_of_matrix

Map$<$int , Matrix<float> $>$

1x{NxM}

(1)

Matrix<float> 

 

map_of_row_vectors

Map$<$int , Vector<float> $>$

Nx{M}

(2)

 

NxM

map_of_column_vectors

 

Mx{N}

(3)

   

map_of_matrix

Map$<$int , Matrix<complex<float> > $>$

1x{NxM}

 

Matrix<complex<float> > 

 

map_of_row_vectors

Map$<$int , Vector<complex<float> > $>$

Nx{M}

 
   

map_of_column_vectors

 

Mx{N}

 

$<$example$>$

INPUT:

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


OUTPUT(1):

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

OUTPUT(2):

  \[ \begin{tabular}{ccc} \{ 0, ~ $<$ 1 ~ 2 $>$ \} , & \{ 1, ~ $<$ 3 ~ 4 $>$ \} , & \{ 2, ~ $<$ 5 ~ 6 $>$ \} \end{tabular} \]    

OUTPUT(3):

  \[ \begin{tabular}{cc} \{ 0, ~ $<$ 1 ~ 3 ~ 5 $>$ \} , & \{ 1, ~ $<$ 2 ~ 4 ~ 6 $>$ \} \end{tabular} \]