@@ -52,25 +52,43 @@ Contexts
5252
5353Creation methods
5454
55- $M1 = Matrix([1,2],[3,4]);
56- $M2 = Matrix([5,6],[7,8]);
57- $v = Vector(9,10);
58- $w = ColumnVector(9,10); # differs in how it is printed
55+ $M1 = Matrix(1, 2, 3); # 1D tensor (row vector)
56+ $M1 = Matrix([1, 2, 3]);
57+
58+ $M2 = Matrix([1, 2], [3, 4]); # 2D tensor (matrix)
59+ $M2 = Matrix([[1, 2], [3, 4]]);
60+
61+ $M3 = Matrix([[1, 2], [3, 4]], [[5, 6], [7, 8]]); # 3D tensor
62+ $M3 = Matrix([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
63+
64+ $M4 = ...
5965
6066Commands added in Value::matrix
6167
6268 Conversion
63- $matrix->values produces [[3,4,5],[1,3,4]] recursive array references of numbers (not MathObjects)
64- $matrix->wwMatrix produces CPAN MatrixReal1 matrix, used for computation subroutines
69+ $matrix->value produces an array of numbers (for a 1D tensor) or array refs representing the rows.
70+ These are perl numbers and array refs, not MathObjects.
71+ $M1->value is (1, 2, 3)
72+ $M2->value is ([1, 2], [3, 4])
73+ $M3->value is ([[1, 2], [3, 4]], [[5, 6], [7, 8]])
74+ $matrix->wwMatrix produces CPAN MatrixReal1 matrix, used for computation subroutines and can only
75+ be used on 1D tensors (row vector) or 2D tensors (matrix).
6576
6677 Information
67- $matrix->dimension: ARRAY
78+ $matrix->dimensions produces an array. For an n-dimensional tensor, the array has n entries for
79+ the n dimensions.
6880
6981 Access values
7082
71- row : MathObjectMatrix
72- column : MathObjectMatrix
73- element : Real or Complex value
83+ row(i) : MathObjectMatrix
84+ For a 1D tensor, produces a 1D tensor
85+ For nD tensor with n > 1, produces a (n-1)D tensor
86+ column(j) : MathObjectMatrix or Real or Complex
87+ For a 1D tensor, produces a Real or Complex
88+ For nD tensor with n > 1, produces an nD tensor where 2nd dimension is 1
89+ element : Real or Complex value when passed the same number of arguments as the dimension of the tensor.
90+ If passed more than n arguments, null. If the dimension of the tensor is n and element is passed
91+ k arguments with k < n, then this produces the corresponding (n-k)-dimensional tensor.
7492
7593 Assign values
7694
0 commit comments