create_matrix T_create_matrix CreateMatrix CreateMatrix create_matrix (Operator)
Name
create_matrix T_create_matrix CreateMatrix CreateMatrix create_matrix
— Create a matrix.
Signature
void CreateMatrix (const HTuple& Rows , const HTuple& Columns , const HTuple& Value , HTuple* MatrixID )
void HMatrix ::HMatrix (Hlong Rows , Hlong Columns , const HTuple& Value )
void HMatrix ::HMatrix (Hlong Rows , Hlong Columns , double Value )
void HMatrix ::CreateMatrix (Hlong Rows , Hlong Columns , const HTuple& Value )
void HMatrix ::CreateMatrix (Hlong Rows , Hlong Columns , double Value )
static void HOperatorSet .CreateMatrix (HTuple rows , HTuple columns , HTuple value , out HTuple matrixID )
public HMatrix (int rows , int columns , HTuple value )
public HMatrix (int rows , int columns , double value )
void HMatrix .CreateMatrix (int rows , int columns , HTuple value )
void HMatrix .CreateMatrix (int rows , int columns , double value )
def create_matrix (rows : int, columns : int, value : MaybeSequence[Union[int, float, str]]) -> HHandle
Description
The operator create_matrix create_matrix CreateMatrix CreateMatrix CreateMatrix create_matrix
creates a new Matrix
with Rows Rows Rows Rows rows rows
rows and Columns Columns Columns Columns columns columns
columns and returns the
matrix handle MatrixID MatrixID MatrixID MatrixID matrixID matrix_id
. Access to the elements of the
matrix is possible e.g., with the operator get_full_matrix get_full_matrix GetFullMatrix GetFullMatrix GetFullMatrix get_full_matrix
.
The parameter Value Value Value Value value value
is a string or a tuple of floating
point or integer numbers. Integer numbers are converted to
floating point numbers automatically.
If Value Value Value Value value value
= 'identity' "identity" "identity" "identity" "identity" "identity" , Rows Rows Rows Rows rows rows
and
Columns Columns Columns Columns columns columns
must have the identical values and an identity matrix
is created.
Example:
Rows Rows Rows Rows rows rows
= 3 ,
Columns Columns Columns Columns columns columns
= 3 ,
Value Value Value Value value value
= 'identity' "identity" "identity" "identity" "identity" "identity"
If the parameter Value Value Value Value value value
contains a single value, all
elements of the matrix are filled with this value.
Example:
Rows Rows Rows Rows rows rows
= 3 ,
Columns Columns Columns Columns columns columns
= 3 ,
Value Value Value Value value value
= 7
If Value Value Value Value value value
contains as many values as the main diagonal, all
elements of the main diagonal are set to the values of the parameter
Value Value Value Value value value
(i.e., the number of elements in Value Value Value Value value value
is
identical).
Example:
Rows Rows Rows Rows rows rows
= 3 ,
Columns Columns Columns Columns columns columns
= 4 ,
Value Value Value Value value value
= [3,7,1]
It is also possible to set all elements of the matrix with different
values. In this case the parameter Value Value Value Value value value
must contain all
values in a row-major order, i.e., stored line by line. In
addition, the number of elements of Value Value Value Value value value
must be identical
to the number of all elements of the matrix, i.e., Rows Rows Rows Rows rows rows
Columns Columns Columns Columns columns columns
.
Example:
Rows Rows Rows Rows rows rows
= 3 ,
Columns Columns Columns Columns columns columns
= 3 ,
Value Value Value Value value value
= [3,1,-2,-5,7,2,-9,-4,1]
It should be noted that in the examples there are differences in the
meaning of the values of the output matrices: If a value is shown as
an integer number, e.g., 0 or 1, the value of this element is per
definition this certain value. If the number is shown as a floating
point number, e.g., 0.0 or 1.0, the value is computed by the
operator.
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 returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Parameters
Rows Rows Rows Rows rows rows
(input_control) integer →
HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Number of rows of the matrix.
Default value: 3
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
Restriction: Rows >= 1
Columns Columns Columns Columns columns columns
(input_control) integer →
HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Number of columns of the matrix.
Default value: 3
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
Restriction: Columns >= 1
Value Value Value Value value value
(input_control) number(-array) →
HTuple MaybeSequence[Union[int, float, str]] HTuple Htuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)
Values for initializing the elements of the
matrix.
Default value: 0
Suggested values: 0, 1, 'identity' "identity" "identity" "identity" "identity" "identity"
MatrixID MatrixID MatrixID MatrixID matrixID matrix_id
(output_control) matrix →
HMatrix , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Matrix handle.
Result
If the parameters are valid, the operator create_matrix create_matrix CreateMatrix CreateMatrix CreateMatrix create_matrix
returns the value TRUE. If necessary, an exception is raised.
Possible Successors
set_full_matrix set_full_matrix SetFullMatrix SetFullMatrix SetFullMatrix set_full_matrix
,
clear_matrix clear_matrix ClearMatrix ClearMatrix ClearMatrix clear_matrix
Module
Foundation