Matrix
Model ElementMatrix defines a general, real-valued, M x N matrix for use in MotionSolve.
Class Name
Matrix
Description
- As a dense matrix in row or column order.
- As a sparse matrix using Coordinate List (COO) format
Attribute Summary
Name | Property | Modifiable by command? | Designable? |
---|---|---|---|
id | Int () | ||
label | Str () | Yes | |
full | Enum ("RORDER CORDER", default=None) | Yes | |
rows | Int (0) | Yes | |
columns | Int (0) | Yes | |
values | Double ([], count=0) | Yes | FD Only |
sparse | Bool (False) | Yes | |
i | Int ([], count=0) | Yes | |
j | Int ([], count=0) | Yes |
Usage
#1: Dense Matrix Format (row or column order)
Matrix (rows=integer, columns=integer, values=list, optional_attributes)
#2. Sparse matrix in COO format
Matrix (sparse=True, rows=integer, columns=integer, i=list, j=list, values=list, optional_attributes)
Attributes
- rows
- Integer
- columns
- Integer
- values
- List of Doubles
- full
- String
- sparse
- Boolean
- rows
- Integer
- columns
- Integer
- i
- List of Integers
- j
- List of Integers
- values
- List of Doubles
- id
- Integer
- label
- String
Example
XML Syntax | Python Syntax |
---|---|
Values = [11, 12, 13, 14, 15,
21, 22, 23, 24, 25, 31, 32, 33, 34, 35, 41, 42, 43, 44, 45] Mat1 = Matrix (label="Mat-1", rows=4, columns=5, full="RORDER", values=Values) |
|
Values = [11, 21, 31, 41,
12,
22, 32, 42, 13, 23, 33, 43, 14, 24, 34, 44, 15, 25, 35, 45] Mat2 = Matrix (label="Mat-2", rows=4, columns=5, values=Values) |
|
Irow = [1, 1, 2, 3, 3, 4, 5, 6,
7, 8, 9, 10] Jcol = [1, 7, 8, 9, 6, 4, 8, 2, 10, 7, 9, 3] Values = [3.3, 7.7, 2.9, 1.1, 2.2, 4.4, 7.6, 1.9, 9.2, 5.1, 10, 4.2] Mat3 = Matrix (label="Mat-3", sparse=True, rows=10, columns=10, i=Irow, j=Jcol, values=Values) |
Comments
- See Properties for an explanation about what properties are, why they are used, and how you can extend these.
- For a more detailed explanation about Matrix, see Reference: Matrix.