Re: passing Indeterminate and Infinity to C via MathLink
- To: mathgroup at smc.vnet.net
- Subject: [mg121618] Re: passing Indeterminate and Infinity to C via MathLink
- From: Roman <rschmied at gmail.com>
- Date: Thu, 22 Sep 2011 07:26:50 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j4vamb$dah$1@smc.vnet.net> <j59os9$pc$1@smc.vnet.net> <j5cb36$cs6$1@smc.vnet.net>
On Sep 21, 11:34 am, David Bailey <d... at removedbailey.co.uk> wrote: > 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 Baileyhttp://www.dbaileyconsultancy.co.uk Brilliant! Thanks David.