Kronecker product: Difference between revisions

-- just product --
(-- just product --)
Line 1,336:
=={{header|Lua}}==
<lang lua>
function mxn( a, b )
print( "A x B:" )
for m = 1, #a do
for p = 1, #b do
for n = 1, #a[m] do
for q = 1, #b[p] do
io.write( string.format( "[%d x %d] ", a[m][n], b[p][q] ) )
end
end
print()
end
end
end
function prod( a, b )
print( "\nPRODUCT:" )
Line 1,356 ⟶ 1,343:
for q = 1, #b[p] do
io.write( string.format( "%3d ", a[m][n] * b[p][q] ) )
end
end
print()
end
end
end
function aabb( a, b )
print( "\nAROW,ACOL x BROW,BCOL:" )
for m = 1, #a do
for p = 1, #b do
for n = 1, #a[m] do
for q = 1, #b[p] do
io.write( string.format( "[(%d, %d) x (%d, %d)] ", m, n, p, q ) )
end
end