Class for setting up Matrix objects.
This class contains all attributes and methods related to the following Matrix types:
- Correlation: specifies a symmetric correlation matrix.
In the following, all methods and attributes are explained and a code example is given.
Methods for Matrix object obj:
- Matrix(id) or Matrix(): Constructor of a Matrix object. id is optional and specifies id and name of new object.
- obj.set(attribute,value): Setter method. Provide pairs of attributes and values. Values are checked for format and constraints.
- obj.get(attribute): Getter method. Query the value of specified attribute.
- obj.getValue(xx,yy): Return matrix value for component on x-Axis xx
and component on y-Axis yy. Component values are recognized as strings.
- Matrix.help(format,returnflag): show this message. Format can be [plain text, html or texinfo].
If empty, defaults to plain text. Returnflag is boolean: True returns
documentation string, false (default) returns empty string. [static method]
Attributes of Matrix objects:
- id: Matrix id. Has to be unique identifier. Default: empty string.
- name: Matrix name. Default: empty string.
- description: Matrix description. Default: empty string.
- type: Matrix type. Can be [Correlation]
- components: String cell specifying matrix components. For symmetric
correlation matrizes x and y-axis components are equal.
- matrix: Matrix containing all elements. Has to be of dimension n x n,
while n is length of components cell.
- components_xx: Set automatically while setting components cell
- components_yy: Set automatically while setting components cell
For illustration see the following example:
A symmetric 3 x 3 correlation matrix is specified and one specific correlation
for a set of components as well as the whole matrix is retrieved:
m = Matrix();
component_cell = cell;
component_cell(1) = 'INDEX_A';
component_cell(2) = 'INDEX_B';
component_cell(3) = 'INDEX_C';
m = m.set('id','BASKET_CORR','type','Correlation','components',component_cell);
m = m.set('matrix',[1.0,0.3,-0.2;0.3,1,0.1;-0.2,0.1,1]);
m.get('matrix')
corr_A_C = m.getValue('INDEX_A','INDEX_C')