in reply to Re: Calculate jackknife error from of each column of a multi-column file
in thread Calculate jackknife error from of each column of a multi-column file

Let's do $x[$n[$j]][$j] in bits:

foreach my $j ($col_start .. $#column) { my $nIndex = $n[$j]; $x[$nIndex][$j] = $column[$j]; $x_tot[$j] += $x[$nIndex][$j]; $n[$j]++; }

The 'uninitialized value' error can then be fix by:

foreach my $j ($col_start .. $#column) { my $nIndex = $n[$j] // 0; $x[$nIndex][$j] = $column[$j]; $x_tot[$j] += $x[$nIndex][$j]; $n[$j]++; }
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^3: Calculate jackknife error from of each column of a multi-column file
by Marshall (Canon) on Dec 16, 2020 at 04:14 UTC
    Yes, I see now that $x[$n[$j]//=0][$j] = $column[$j]; is the answer. Thanks! The nested brackets confused my brain. I highly suspect that there is a more simple formulation of this part of the algorithm. For example, transforming a square matrix is not that hard and then you go row by row to get the column sums.