Script Vector-vmul_test.lua

Test script for class::Vector:vmul multiplication

Example from shell:

$ export PATH=$HOME/.lua/bin:$PATH
$ Vector-vmul_test.lua 3 5 4 3

>>> Vector multiplication for pre-configured matrices

>>> Test 1
>>> m:  {3, 2}
{{1, 2, 3}, {2, 3, 4}}

>>> n:  {2, 3}
{{2, 3}, {3, 4}, {4, 5}}

>>> m * n:
{{20, 26}, {29, 38}}

>>> n * m:
{{8, 13, 18}, {11, 18, 25}, {14, 23, 32}}


>>> Test 2
>>> A:  {3, 5}
{{1, 2, 3}, {2, 3, 4}, {3, 4, 5}, {4, 5, 6}, {5, 6, 7}}

>>> B:  {4, 3}
{{4, 3, 2, 1}, {5, 4, 3, 2}, {6, 5, 4, 3}}

>>> A * B:
{{32, 26, 20, 14}, {47, 38, 29, 20}, {62, 50, 38, 26}, {77, 62, 47, 32}, {92, 74, 56, 38}}

:

See also:

Usage:

    Run matrix multiplications tests
    loadfile("Vector-vector_test.lua")(cols1, rows1, cols2, rows2)
    


generated by LDoc 1.5.0 Last updated 2024-09-16 20:16:45