6.7.13 MatrixToMap

6.7.13.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.13.2 Necessary files

No files are required.

6.7.13.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.102 and 6.103 show connection examples for the MatrixToMap . The sample network in Figure 6.102 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.103 shows how to use MatrixToMap when spectra of waveform data are desired in Map<int, ObjectRef> data type. As shown in Figure 6.103, 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.102: Connection example of MatrixToMap to SaveRawPCM 

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

6.7.13.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.98: Parameter list of MatrixToMap 

Parameter name

Type

Default value

Unit

Description

OUTPUT_TYPE

string 

map_of_matrix

 

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

6.7.13.5 Details of the node

Table 6.99: Conversion table of MatrixToMap 

INPUT

OUTPUT

OUT_TYPE

 

type

size

type

size

   
   

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

1x{NxM}

map_of_matrix

(1)

Matrix<float> 

 

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

Nx{M}

map_of_row_vectors

(2)

 

NxM

 

Mx{N}

map_of_column_vectors

(3)

   

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

1x{NxM}

map_of_matrix

 

Matrix<complex<float> > 

 

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

Nx{M}

map_of_row_vectors

 
     

Mx{N}

map_of_column_vectors

 

$<$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): { 0, $<$ 1 2 $>$ }, { 1, $<$ 3 4 $>$ }, { 2, $<$ 5 6 $>$ }

OUTPUT(3): { 0, $<$ 1 3 5 $>$ }, { 1, $<$ 2 4 6 $>$ }