Table of Contents
This is an old revision of the document!
ToUserdata
Matrices are, per default, tables of tables in Lua. When algebraic operations are performed on them, they are repeatedly copied and moved, which can lead to severe performance issues if the matrices are large objects.
A call of Matrix.ToUserdata($M$) takes a matrix and transforms it, from Lua's point of view, from a table of tables to a mere pointer. This means that the object still has all functionalities Quanty defines on it with increased performance. The downside is that any functionalities Lua defines on tables is not necessarily longer available, most notably the element-wise access via the Bracket operator [].
The inverse operation of Matrix.ToUserdata() is Matrix.ToTable().
Example
Will follow.
Input
- Example.Quanty
-- some example code
Result
text produced as output