Operators |
set_full_matrix — Set all values of a matrix.
The operator set_full_matrix sets all elements of the input Matrix defined by the matrix handle MatrixID. The values of the parameter Values can be a tuple of floating point or integer numbers. Integer numbers are converted to floating point numbers automatically. The parameter Values must contain all values in a row-major order, i.e., stored line by line. In addition, the number of elements in Values 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_matrix. The advantage by using the operator set_full_matrix is to recycle a matrix that is no longer needed. Thus, the runtime of the operation takes fewer time.
Example 1:
/ 0.0 0.0 0.0 \ Matrix = | 0.0 0.0 0.0 | Values = [3,1,-2,-5,7,2,-9,-4,1] \ 0.0 0.0 0.0 / / 3.0 1.0 -2.0 \ -> Matrix = | -5.0 7.0 2.0 | \ -9.0 -4.0 1.0 /
Example 2:
/ 0.0 0.0 0.0 \ Matrix = | 0.0 0.0 0.0 | Values = [ 7 ] \ 0.0 0.0 0.0 / / 7.0 7.0 7.0 \ -> Matrix = | 7.0 7.0 7.0 | \ 7.0 7.0 7.0 /
set_full_matrix modifies the content of an already existing matrix.
Matrix handle of the input matrix.
Values to be set.
If the parameters are valid, the operator set_full_matrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
clear_matrix, clear_all_matrices
Foundation
Operators |