~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/special/cephes/mvmpy.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T. Chen (new)
  • Date: 2005-03-16 02:15:29 UTC
  • Revision ID: james.westby@ubuntu.com-20050316021529-xrjlowsejs0cijig
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*                                                      mvmpy.c
 
2
 *
 
3
 *      Matrix times vector
 
4
 *
 
5
 *
 
6
 *
 
7
 * SYNOPSIS:
 
8
 *
 
9
 * int r, c;
 
10
 * double A[r*c], V[c], Y[r];
 
11
 *
 
12
 * mvmpy( r, c, A, V, Y );
 
13
 *
 
14
 *
 
15
 *
 
16
 * DESCRIPTION:
 
17
 *
 
18
 *          c-1
 
19
 *          --
 
20
 * Y[j] =   >   A[j][k] V[k] ,  j = 1, ..., r
 
21
 *          --
 
22
 *          k=0
 
23
 *
 
24
 * Multiplies the r (rows) by c (columns) matrix A on the left
 
25
 * by column vector V of dimension c on the right
 
26
 * to produce a (column) vector Y output of dimension r.
 
27
 *
 
28
 *
 
29
 *
 
30
 *
 
31
 */
 
32
 
 
33
 
 
34
#define ANSIPROT
 
35
#ifdef ANSIPROT
 
36
void mvmpy( int, int, double*, double*, double* );
 
37
#endif
 
38
 
 
39
void
 
40
mvmpy( r, c, A, V, Y )
 
41
int r, c;
 
42
double *A, *V, *Y;
 
43
{
 
44
register double s;
 
45
double *pA, *pV, *pY;
 
46
int i, j;
 
47
 
 
48
pA = A;
 
49
pY = Y;
 
50
for( i=0; i<r; i++ )
 
51
        {
 
52
        pV = V;
 
53
        s = 0.0;
 
54
        for( j=0; j<c; j++ )
 
55
                {
 
56
                s += *pA++ * *pV++;
 
57
                }
 
58
        *pY++ = s;
 
59
        }
 
60
}
 
61