dot (replaces TDot)


The dot function returns the dot product of two data objects which may be a 1-dimensional array or an object of type CImage, CArray, or CMatrix.

Syntax

number = dot( array_1, array_2 )

number = dot( CImage_1 , CImage_2 )

number = dot( CArray_1, CArray_2 )

number = dot( CMatrix_1, CMatrix_2 )

bullet.gif    Object is the second CImage or 1-dimensional array.

bullet.gif    number is the returned dot product.

Example

The following script computes the dot product of two CImage objects:

A = new_image()

-- create a CImage

-- (fill A with image data)

 

B = new_array()

-- create another CImage

-- (fill B with image data)

 

Printf("AdotB = %lg", dot(A,B) )

 

The next example computes the dot product of two 1-dimensional array with values that are numbers.:

t1 = { 5, 6, -2, 5.4 }

-- create table A

t2 = { 0, 4, 2, -1 }

-- create table B

Printf("AdotB = %lg, dot(t1,t2) )

-- result: AdotB = 14.6

Related Topics

Table and Array Functions

CArray

 


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.