Re: Mathlink and packed arrays
- To: mathgroup at smc.vnet.net
- Subject: [mg22071] Re: Mathlink and packed arrays
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 12 Feb 2000 04:04:30 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <880eac$4np@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, an arry by that is transfered by MathLink is already a PackedArray[]. PackedArrays[] are just continuous meory blocks of numbers. For a normal List[] with symbols and formulas a "unpacked array" has pointer to the memory location of the object and not the object self. There is an option to in the System[] part of Mathematica that switch the packed array *expansion* for MathLink data on and off. But any array *to* a C program must be a packed one. MathLink does not transfer the data bits of an object plain to the client. Because the client can be an computer with different integer representation character set .. MathLink must prepare the bytes of the object for your client. Since MathLink is buffered there is the additional workload to allocate an freeing the buffer. I would expect that you have no chance to get the speed you need. Regards Jens DIAMOND Mark wrote: > > I wish to download index-coloured (8-bit) images from Mathematica to a > non-standard video card as fast as possible, preferably within one or two > frames. (It is not particularly > relevant, but the card is a Cambridge Research Systems VSG2/4). The images > might be as large as 800 x 600, but are more often about 256 x 256. > > I have attempted to do this with Mathlink but my > attempts have been very very slow (tens of seconds). Initially, I used > arrays of Integer, then I tried speeding things up by converting the images > to a String. This gains some speed, but nowhere near enough. So now I am > hoping that someone might be able to help. > > (1) has anyone done anything similar using Mathlink, either to a video or a > sound card or any other hardware? > (2) if I were to used a Packed Array of Integer, instead of just Integer, > how should the type specification now appear in the Mathlink *.tm file? > (3) has anyone used Mathlink with Packed Array for any other purpose, and > how did it work out? > > Cheers,