File: SPcovar.html

package info (click to toggle)
libtsp 3r0-1
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 5,096 kB
  • ctags: 1,798
  • sloc: ansic: 14,464; sh: 1,217; makefile: 182
file content (66 lines) | stat: -rw-r--r-- 1,732 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<HTML>
<HEAD>
<TITLE>TSP (libtsp/SP) - SPcovar</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFACD">
<H2>SPcovar</H2>
<HR>
<H4>Routine</H4>
<DL>
<DT>
void SPcovar (x, Nx, Cov, Np)
</DL>
<H4>Purpose</H4>
<DL>
<DT>
Calculate a correlation (covariance) matrix for a data sequence
</DL>
<H4>Description</H4>
This routine fills in the elements of a correlation matrix given an array of
data.  The elements of the matrix are calculated as
<PRE>
           N+Np-1
  C(i,j) =  SUM x(n-i) x(n-j) ,    0 &lt;= i,j &lt;= Np
            n=Np
</PRE>
where Np is the number of correlation lags and N is the number of terms in
each correlation calculation.  To compute the correlation terms, the
following recursion is used,
<P>
<PRE>
  C(i,j) = C(i-1,j-1) + x(Np-i) x(Np-j) - x(N+Np-i) x(N+Np-j) ,
</PRE>
<P>
starting from C(i,0)=C(0,i).  Note that finite precision effects in
calculating the recursion can result in a non-positive definite matrix.
<H4>Parameters</H4>
<DL>
<DT>
 -&gt; const float x[]
<DD>
Input data (Nx elements).  The first Np values normally represent data
from a previous frame of data.
<DT>
 -&gt; int Nx
<DD>
Number of data elements.  Nx=N+Np, where N is the number of terms in
each correlation sum and Np is the number of correlation lags to be
calculated.  Note that Nx must be larger than Np.
<DT>
&lt;-  float *Cov[]
<DD>
Cov is an array of pointers to the rows of a Np+1 by Np+1 matrix.  On
return, the (symmetric) matrix contains the correlation values.
<DT>
 -&gt; int Np
<DD>
Maximum correlation lag
</DL>
<H4>Author / revision</H4>
P. Kabal  Copyright (C) 1997
/ Revision 1.7  1997/10/10
<P>
<HR>
Main Index <A HREF="../libtsp.html">libtsp</A>
</BODY>
</HTML>