Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
documentation:language_reference:objects:matrix:start [2018/09/25 11:32] – Added mentioning of MatrixMeta Simon Heinzedocumentation:language_reference:objects:matrix:start [2024/12/12 14:07] (current) Maurits W. Haverkort
Line 3: Line 3:
  
 ### ###
-The object Matrix defines matrices, i.e. tables of tables, and defines the standard lua math operations (+,-,*,/,^) among other functionalities on themWhen creating a table-table object in Lua one has to tell the language that this is supposed to be a matrixThis is done by setting the metatable MatrixMeta+The object Matrix defines matrices. Matrices in Lua can be defined as tables of tables, however Lua does not allow mathematical operations on tables. The Matrix object implements a set of functions and operations on tables of tablesWe have two ways of storing matrices, either as Lua table of tables, or as a user data object. The user data object stores the data as a consecutive array and is faster, especially if several matrix operations need to be preformedIn most cases one can use tables and user data matrices without the need to realise how the matrix is internally stored
 +###
  
 +###
 +Matrices can be created from tables of tables by setting the meta table of the table to MatrixMeta
 <code Quanty Example.Quanty> <code Quanty Example.Quanty>
---This creates a table of tables +M = {{1,2},{3,4}}
-M = {{1,  14 }, +
-     {33, 4.7}} +
---This defines functionalities like addition or multiplication on M+
 setmetatable(M, MatrixMeta) setmetatable(M, MatrixMeta)
 +</code> 
 +Matrices can be created as a user data with the function Matrix.New 
 +<code Quanty Example.Quanty> 
 +M = Matrix.New( {{1,2},{3,4}} )
 </code> </code>
 ### ###
  
 +###
 +Below you can find a list of possible functions and operations one can perform on matrices
 +###
  
 ===== Table of contents ===== ===== Table of contents =====
-{{indexmenu>.#1|msort}}+{{indexmenu>.#2|tsort}}
  
Print/export