comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: matrix division
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: matrix division [message #60569 is a reply to message #60422] Thu, 22 May 2008 07:57 Go to previous message
jameskuyper is currently offline  jameskuyper
Messages: 79
Registered: October 2007
Member
David Fanning wrote:
> James Kuyper writes:
>
>> What if b is < 0?
>
> I was hoping you would tell me, so I didn't have to
> think about it anymore. :-(

For the integer case:

ratio = numerator/denominator
bad = WHERE(denominator eq 0, count)
IF count gt 0 THEN ratio[bad] = replacement_value

replacement_value needs to be carefully chose for the context of your
problem. You might want to give different replacement values depending
upon whether the numerator is positive, negative, or 0. There's
probably a more elegant approach, but three different WHERE's would
certainly be sufficient to cover those cases.

For the floating point case, IDL fills in the relevant elements of
ratio with -Inf, Nan, or Inf, depending upon the sign of the
numerator, and I can't think of any better way of handling it than to
use precisely those value. If you need to use your result for further
computations where those values would be unacceptable, replace them,
with logic similar to the above, but using the FINITE() function.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: plotting graphics for web pages
Next Topic: Re: interact with iimage from the command line?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 13:09:02 PDT 2025

Total time taken to generate the page: 2.31893 seconds