GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
vmul.c
Go to the documentation of this file.
00001 /*  vmul.c    CCMATH mathematics library source code.
00002  *
00003  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
00004  *  This code may be redistributed under the terms of the GNU library
00005  *  public license (LGPL). ( See the lgpl.license file for details.)
00006  * ------------------------------------------------------------------------
00007  */
00008 void vmul(double *vp, double *mat, double *v, int n)
00009 {
00010     double s, *q;
00011 
00012     int k, i;
00013 
00014     for (k = 0; k < n; ++k) {
00015         for (i = 0, q = v, s = 0.; i < n; ++i)
00016             s += *mat++ * *q++;
00017         *vp++ = s;
00018     }
00019 }
00020 
00021 double vnrm(double *u, double *v, int n)
00022 {
00023     double s;
00024 
00025     int i;
00026 
00027     for (i = 0, s = 0.; i < n; ++i)
00028         s += *u++ * *v++;
00029     return s;
00030 }