Further information about the module:
FMatrix
. The principles
are the same for other matrix and vector types).
% FMatrix m mBy adding another 2 arguments we can specify the dimensions of the matrix (If you really try this use another name since you cannot define the same matrix again until you have destroyed it).
% FMatrix m 3 3 mWe can also define the whole matrix with all its coefficients by using
{ }
to structure the input.
% FMatrix m {{1 2} {3 4} {5 6}} mThe contents of a matrix can by shown be simply typing the name of the object.
% m { 1.0000e+00 2.0000e+00 } { 3.0000e+00 4.0000e+00 } { 5.0000e+00 6.0000e+00 }Instead of giving the coefficients directly you can also use the name of another matrix or read the coefficients from a file.
% FMatrix m1 another_matrix m1 % FMatrix m2 @name_of_the_file m2As already mentioned above you can only define a matrix once. If you want to change the contents you have to destroy the matrix and redefine it or use a matrix method like '
:=
' to change the coefficients.
% destroy m1 % FMatrix m1 {{1 2 3}} m1 % m2 := m1A nice Tcl trick is to use the return value of a definition, which is the name of the new object, as a command by adding a matrix method. This way you can for example load data from a binary matrix file with one Tcl line.
% [FMatrix m] bload filename
Matrix
, Vector
or variants like
BMatrix
.
SVector
vector with short elements
IMatrix
matrix with integer elements
FVector
vector with float elements
FMatrix
matrix with float elements
FBMatrix
band matrix with float elements
DVector
vector with double elements
DMatrix
matrix with double elements
IMatrix
but for DMatrix
objects.% #--- converting a float matrix f into a double matrix d --- % d FMatrix f
[1] Bronstein; Semendjajew: Taschenbuch der Mathematik; Verlag Harry Deutsch
[2] G. Fischer: Lineare Algebra; Vieweg & Sohn