# Command: Dot

NEST HelpDesk | Command Index | NEST Quick Reference

Name:

    Dot - product of vectors, matrices, and tensors

Synopsis:

    array array Dot -> array
      -> double
      -> integer

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] ]
      ]

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:

Bugs:

    Bad performace: TensorRank should be rewritten in C++
      not yet protected by trie

Remarks:

References:

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

Author:

    Diesmann

FirstVersion:

    31.5.2000

SeeAlso:

- Times
- Plus
- OuterProduct

Source:

    /opt/conda/conda-bld/nest_1510212701067/work/nest-2.14.0/lib/sli/mathematica.sli

NEST HelpDesk | Command Index | NEST Quick Reference

© 2004 The NEST Initiative