create_matrix T_create_matrix CreateMatrix CreateMatrix create_matrix (算子)
名称
create_matrix T_create_matrix CreateMatrix CreateMatrix create_matrix — 创建一个矩阵。
签名
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
描述
算子 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 .可通过算子
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.
示例:
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.
示例:
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).
示例:
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 。
示例:
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.
执行信息
多线程类型:可重入(与非独占算子并行运行)。
多线程作用域:全局(可从任何线程调用)。
未采用并行化处理。
此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。
参数
Rows Rows Rows Rows rows rows (输入控制) integer → HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Number of rows of the matrix.
默认值:
3
建议值:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
限制:
Rows >= 1
Columns Columns Columns Columns columns columns (输入控制) integer → HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Number of columns of the matrix.
默认值:
3
建议值:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100
限制:
Columns >= 1
Value Value Value Value value value (输入控制) 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.
默认值:
0
建议值:
0, 1, 'identity' "identity" "identity" "identity" "identity" "identity"
MatrixID MatrixID MatrixID MatrixID matrixID matrix_id (输出控制) matrix → HMatrix , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Matrix handle.
结果
如果参数有效,算子 create_matrix create_matrix CreateMatrix CreateMatrix CreateMatrix create_matrix 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
可能的后继
set_full_matrix set_full_matrix SetFullMatrix SetFullMatrix SetFullMatrix set_full_matrix ,
clear_matrix clear_matrix ClearMatrix ClearMatrix ClearMatrix clear_matrix
模块
基础