Difference between revisions of "DotProduct"

m (adding doc status category)
Line 3: Line 3:
  
 
To compute the dot product of two vectors, use:
 
To compute the dot product of two vectors, use:
Sum( A*B, I )
+
:<code>Sum(A*B, I)</code>
  
where I is the index shared by the two vectors.
+
where «I» is the index shared by the two vectors.
  
The DotProduct function does the same, i.e., DotProduct(A,B,I).  Analytica's parser recognizes a dot product of the form Sum(A*B,I) and optimizes it as a call to DotProduct, which avoids an allocation for the intermediate value of A*B.  But DotProduct is not intended to be used explicitly.
+
The [[DotProduct]] function does the same, i.e., [[DotProduct]](A, B, I).  Analytica's parser recognizes a dot product of the form [[Sum]](A*B, I) and optimizes it as a call to [[DotProduct]], which avoids an allocation for the intermediate value of <code>A*B</code>.  But [[DotProduct]] is not intended to be used explicitly.

Revision as of 20:58, 6 January 2016


To compute the dot product of two vectors, use:

Sum(A*B, I)

where «I» is the index shared by the two vectors.

The DotProduct function does the same, i.e., DotProduct(A, B, I). Analytica's parser recognizes a dot product of the form Sum(A*B, I) and optimizes it as a call to DotProduct, which avoids an allocation for the intermediate value of A*B. But DotProduct is not intended to be used explicitly.

Comments


Pdavis

102 months ago
Score 0
Why the last sentence? I would think that DotProduct(A,B,I) would be clearer syntax than Sum(A*B,I) in definitions.

You are not allowed to post comments.