MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: passing Indeterminate and Infinity to C via MathLink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121582] Re: passing Indeterminate and Infinity to C via MathLink
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Wed, 21 Sep 2011 05:32:35 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j4vamb$dah$1@smc.vnet.net> <j59os9$pc$1@smc.vnet.net>

On 20/09/2011 11:11, Roman wrote:
> Dear John,
> thanks a lot for your detailed explanations. I believe that your
> suggestion of using "magic" floats for representing Indeterminate and
> Infinity is the most viable possibility; in this way I can send packed
> arrays to C without a hitch.
> The inefficiencies that you mention in the MathLink protocol, even
> using packed arrays, are quite noticeable though. Much experimentation
> and comparison to the use of Compile[] is required to find the fastest
> way of getting things done.
> Best regards,
> Roman
>

One alternative to designating a magic float (which then has to be 
searched for in the external program, and which could be generated by an 
unfortunate calculation) is to replace the NaN values with 0.0, and also 
send a small (packed integer) index array locating the NaN's. If there 
are no Nan's, the list would be empty.

David Bailey
http://www.dbaileyconsultancy.co.uk






  • Prev by Date: Re: Artistic impression of cloudy structures
  • Next by Date: Re: Texture in version 8, fine, but don't export...?
  • Previous by thread: Re: passing Indeterminate and Infinity to C via MathLink
  • Next by thread: Re: passing Indeterminate and Infinity to C via MathLink