Dot

Command: Dot


Description


A B Dot contracts the last index in A with the first
index in B. Indices in mathematical notation leftmost
index describes first level objects. For peole used to
strict (row column) notation as in Matlab [2] effects
of this generalized product may be surprising (see
examples (1) to (3).
Dot is an implementation of Mathematica's Dot [1].
Parameters

Author
Diesmann
Bugs
Bad performace: TensorRank should be rewritten in C++
not yet protected by trie
Synopsis
array array Dot -> array
-> double
-> integer
References

[1] The Mathematica Book "Dot"
[2] The MathWorks Matlab User's Guide
Examples


(1)
[ 4 3 7 ] [ 2 5 8] Dot ==79

(2)
[ 4 3 7 ] [ [ 2] [ 5 ] [ 8 ] ] Dot == [79]

(3)
[ [ 4 ] [ 3 ] [ 7 ] ] [ 2 5 8 ] Dot == [8 6 14]
Error: /DimensionMismatch in Dup
(4)
[ [ 5 3 2 ] [ 5 4 1 ] ] [ [ 2 ] [ 3 ] [ 9 ] ] Dot == [[37] [31]]

(5)
[ [ 5 3 2 ] [ 5 4 1 ] ] [ 2 3 9 ] Dot == [37 31]

(6)
[ 7 8 ] [ [ 5 3 2 ] [ 5 4 1 ] ] Dot == [75 53 22]

(7)
[ [ 5 3 ] [ 1 2 ] [ 5 4 ] ]
[ [ [ 2 1 ] [ 5 3 ] [ 3 4 ] [ 7 5 ]] [ [ 3 1 ] [ 7 4] [8 9] [1 8] ] ]
Dot ==
[ [ [19 8] [46 27] [39 47] [38 49] ]
[ [8 3] [19 11] [19 22] [9 21] ]
[ [22 9] [53 31] [47 56] [39 57] ]
]

File
lib/sli/mathematica.sli
Remarks