in reply to Calculate log of matrix values
Rather than having to testing for 0 (or undef) in all your further calculations, it may be easier (and mathematically acceptable) to replace your zeros with a very small number, say 1e-308:
map $_//= 1e-308, @$_ for @matrix;
which should have negligible affect upon any calculations, but avoid lot of special casing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Calculate log of matrix values
by BillKSmith (Monsignor) on Aug 09, 2013 at 18:07 UTC | |
by BrowserUk (Patriarch) on Aug 09, 2013 at 19:04 UTC | |
by BillKSmith (Monsignor) on Aug 09, 2013 at 19:59 UTC | |
by BrowserUk (Patriarch) on Aug 09, 2013 at 20:08 UTC | |
by BillKSmith (Monsignor) on Aug 10, 2013 at 18:51 UTC | |
by choroba (Cardinal) on Aug 09, 2013 at 18:13 UTC |