Skip to content

set_full_matrixSetFullMatrixSetFullMatrixset_full_matrixT_set_full_matrix🔗

Short description🔗

set_full_matrixSetFullMatrixSetFullMatrixset_full_matrixT_set_full_matrix — Set all values of a matrix.

Signature🔗

set_full_matrix( matrix MatrixID, number Values )void SetFullMatrix( const HTuple& MatrixID, const HTuple& Values )static void HOperatorSet.SetFullMatrix( HTuple matrixID, HTuple values )def set_full_matrix( matrix_id: HHandle, values: MaybeSequence[Union[int, float]] ) -> None

Herror T_set_full_matrix( const Htuple MatrixID, const Htuple Values )

void HMatrix::SetFullMatrix( const HTuple& Values ) const

void HMatrix::SetFullMatrix( double Values ) const

void HMatrix.SetFullMatrix( HTuple values )

void HMatrix.SetFullMatrix( double values )

Description🔗

The operator set_full_matrixSetFullMatrix sets all elements of the input Matrix defined by the matrix handle MatrixIDmatrixIDmatrix_id. The values of the parameter Valuesvaluesvalues can be a tuple of floating point or integer numbers. Integer numbers are converted to floating point numbers automatically. The parameter Valuesvaluesvalues must contain all values in a row-major order, i.e., stored line by line. In addition, the number of elements in Valuesvaluesvalues must be 1 or identical to the number of all elements of the matrix.

Note: The same result can be reached with the operator create_matrixCreateMatrix. The advantage by using the operator set_full_matrixSetFullMatrix is to recycle a matrix that is no longer needed. Thus, the runtime of the operation takes fewer time.

Example 1:

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 \end{array} \right] \qquad \textrm{Values} = [3,1,-2,-5,7,2,-9,-4,1] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{Matrix} = \left[ \begin{array}{rrr} 3.0 & 1.0 & -2.0 \\ -5.0 & 7.0 & 2.0 \\ -9.0 & -4.0 & 1.0 \end{array} \right] \end{eqnarray*}\]

Example 2:

\[\begin{eqnarray*} \texttt{Matrix} = \left[ \begin{array}{rrr} 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 \end{array} \right] \qquad \textrm{Values} = [ 7 ] \end{eqnarray*}\]
\[\begin{eqnarray*} \to \qquad \texttt{Matrix} = \left[ \begin{array}{rrr} 7.0 & 7.0 & 7.0 \\ 7.0 & 7.0 & 7.0 \\ 7.0 & 7.0 & 7.0 \end{array} \right] \end{eqnarray*}\]

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

MatrixIDmatrixIDmatrix_id (input_control, state is modified) matrix → (handle)HTuple (HHandle)HMatrix, HTuple (IntPtr)HHandleHtuple (handle)

Matrix handle of the input matrix.

Valuesvaluesvalues (input_control) number(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[int, float]]Htuple (double / Hlong)

Values to be set.

Result🔗

If the parameters are valid, the operator set_full_matrixSetFullMatrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_matrixCreateMatrix

Possible successors

clear_matrixClearMatrix

See also

get_full_matrixGetFullMatrix

Module🔗

Foundation