Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
extrema / usr / share / extrema / Help / Operators / innerproduct.htm
Size: Mime:
<HTML>
<HEAD>
<TITLE>INNER PRODUCT</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF" fgcolor="#000000">

<P><A NAME="inner product"></A>
<font size="+3" color="green"><B>INNER PRODUCT</B></font></P>
<P>
<TABLE border="1" cols="2" frame="box" rules="all" width="572">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%"><CODE>
vout = v1 &lt;&gt; v2</CODE>
</TD></TR>
</table></p>
<p>
 The inner product operator, <code>&lt;&gt;</code>, operating on two vectors
 produces a scalar; operating on a vector and a matrix produces a vector; and
 operating on two matrices produces a matrix.</p>
<P><font size=+2 color="green">Operating on two vectors</font></p>
<P>
 The inner product operating on two vectors produces a scalar, whose value
 is equal to the sum of the products of the vectors' elements. The two
 vectors <EM>must</EM> be the same length. Suppose <code>X</code> and <code>Y</code>
 are vectors of length N.  Then <code>x&lt;&gt;y = x[1]*y[1] + x[2]y[2] + ... + x[N]*y[N]</code>.</p>
<P>
 <font size="+1" color="green">Example</font></p>
<P>
 Suppose you have two vectors: <code>X = [1;3;5]</CODE> and <CODE>Y = [2;4;6]</code></p>
<P>
 Then: <code>X&lt;&gt;Y = 1*2 + 3*4 + 5*6 = 44</CODE></p>
<P>
 <font size=+2 color="green">Operating on a vector and a matrix</font></p>
<P>
 The inner product operating on a vector and a matrix produces a
 vector. If the vector is the first operand, its length <EM>must</EM> be equal to
 the number of rows of the matrix. The resultant vector length will be the
 number of columns of the second operand matrix.</p>
<p>
 If <code>X</code> is a vector of length N, and <code>A</code> is a matrix with N rows and M columns,
 then <code>X&lt;&gt;A</code> is a vector where
 <code>(X&lt;&gt;A)[i] = X[1]*A[1,i] + X[2]*A[2,i] + ... + X[N]*A[N,i]</code>.  The vector
 <code>X&lt;&gt;A</code> will have M elements.</p>
<P>
 <font size="+1" color="green">Example</font></p>
<P>
 The inner product of a vector and a matrix:</p>
<P>
 <code>X = [1;3;5]</CODE> and
 <pre>
     | 1 4 |
 M = | 2 5 |
     | 3 6 |
 </pre></p>
<P>
 Then: <code>X&lt;&gt;M = [22;49]</CODE></p>
<P>
 <font size="+2" color="green">Operating on a matrix and a vector</font></p>
<P>
 The inner product operating on a matrix and a vector produces a vector.  If
 the vector is the second operand, its length <EM>must</EM> be equal to the
 number of columns of the matrix, and the resultant vector length will be the
 number of rows of the first operand matrix.</p>
<p> 
 If <code>A</code> is a matrix with N rows and M columns, and <code>X</code> is a vector of length M,
 then <code>A&lt;&gt;X</code> is a vector where
 <code>(A&lt;&gt;X)[i] = A[i,1]*X[1] + A[i,2]*X[2] + ... + A[i,M]*X[M]</code>.  The vector
 <code>X&lt;&gt;A</code> will have N elements.</p>
<P>
 <font size="+1" color="green">Example</font></p>
<P>
 The inner product of a matrix and a vector:</p>
<P>
 <code>X = [1;3;5]</code>
 <pre>
 M = | 1 3 5 |
     | 2 4 6 |
 </pre></p>
<P>
 Then: <code>M&lt;&gt;X = [35;44]</CODE></p>
<P>
 <font size="+2" color="green">Operating on two matrices</font></p>
<P>
 The inner product operating on two matrices produces a matrix.
 The number of columns of the first operand matrix <EM>must</EM> be equal to the
 number of rows of the second operand matrix. The resultant matrix will be a
 square matrix with the number of rows and the number of columns equal to the
 number of rows of the first operand.</P>
<P>
 If <code>A</code> is an N by M matrix and <code>B</code> is an M by N matrix, 
 then <CODE>A&lt;&gt;B</code> is an N by N matrix, where <code>(A&lt;&gt;B)[i,j] = 
 A[i,1]*B[1,j] + A[i,2]*B[2,j] + ... + A[i,M]*B[M,j]</code> for 
 <CODE>i = [1;2;...;N]</CODE> and <CODE>j = [1;2;...;N]</CODE></p>
<P>
 <font size="+1" color="green">Example</font></p>
<P>
 The inner product of two matrices:</p>
<P>
 Let
 <pre>
     | 11 12 13 |
 A = | 21 22 23 |
     | 31 32 33 |
 </pre>
 and
 <pre>
     | 1 2 3 |
 B = | 2 4 6 |
     | 3 6 9 |
 </pre>
 then
 <pre>
        |  74 148 222 |
 A&lt;&gt;B = | 134 268 402 |
        | 194 388 582 |
 </pre></p>
</BODY>
</HTML>