[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
aggregating a vector
From: |
Francesco Potorti` |
Subject: |
aggregating a vector |
Date: |
Mon, 24 Jul 1995 15:21 +0100 (MET) |
Hi,
I often have this problem: given a vector A, compute the variance of
the elements of an aggregated vector obtained by summing up the
elements of the given vector k by k (suppose k is a divisor of
length(A)). Currently I use the following code:
do_fortran_indexing = "true";
sets = length(A)/k;
YY = zeros (k, sets);
YY(:) = A(:);
Y = sum (YY);
var = (sumsq(Y) - sum(Y)^2/sets) / (sets-1);
Is there anything faster?
--
Francesco Potorti` | address@hidden (Internet)
researcher at | 39369::pot (DECnet)
CNUCE-CNR, Pisa, Italy | +39-50-593203 (voice) 904052 (fax)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- aggregating a vector,
Francesco Potorti` <=