]> Creatis software - CreaPhase.git/blob - octave_packages/nurbs-1.3.6/vecdot.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nurbs-1.3.6 / vecdot.m
1 function dot = vecdot(vec1,vec2)
2
3 % VECDOT: The dot product of two vectors.
4
5 % Calling Sequence:
6
7 %   dot = vecdot(vec1,vec2);
8
9 % INPUT:
10
11 %   vec1        : An array of column vectors represented by a matrix of
12 %   vec2        size (dim,nv), where is the dimension of the vector and
13 %               nv the number of vectors.
14 %
15 % OUTPUT:
16 %
17 %   dot         : Row vector of scalars, each element corresponding to
18 %               the dot product of the respective components in vec1 and
19 %               vec2.
20
21 % Description:
22
23 %   Scalar dot product of two vectors.
24
25 % Examples:
26
27 %   Determine the dot product of
28 %   (2.3,3.4,5.6) and (1.2,4.5,1.2)
29 %   (5.1,0.0,2.3) and (2.5,3.2,4.0)
30 %
31 %   dot = vecdot([2.3 5.1; 3.4 0.0; 5.6 2.3],[1.2 2.5; 4.5 3.2; 1.2 4.0]);
32 %
33 %    Copyright (C) 2000 Mark Spink
34 %
35 %    This program is free software: you can redistribute it and/or modify
36 %    it under the terms of the GNU General Public License as published by
37 %    the Free Software Foundation, either version 2 of the License, or
38 %    (at your option) any later version.
39
40 %    This program is distributed in the hope that it will be useful,
41 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
42 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43 %    GNU General Public License for more details.
44 %
45 %    You should have received a copy of the GNU General Public License
46 %    along with this program.  If not, see <http://www.gnu.org/licenses/>.
47
48 dot = sum(vec1.*vec2);
49
50 end