MathGroup Archive 2011

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

Search the Archive

Re: Importing text file as machine-precision array

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118229] Re: Importing text file as machine-precision array
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Sun, 17 Apr 2011 07:53:18 -0400 (EDT)
  • References: <inpfu3$9as$1@smc.vnet.net> <inqkt3$e73$1@smc.vnet.net> <inun9l$2aj$1@smc.vnet.net>

On 11/04/2011 12:05, Sidney Cadot wrote:
>> The only way that you will obtain an array as compact as you calculate
>> (plus a small overhead) is to use the function Developer`ToPackedArray
>> on the result after applying N.
>
> Thanks for the hint -- I didn't know about thgat package. As I
> discovered by trial and error, this also works:
>
> data = data + ConstantArray[0., Dimensions[data]];
>
> Regards Sidney
>
Mathematica uses some heuristics to decide when to convert to packed 
arrays, and one of these obviously kicks in in this case, but I would 
guess that it would be marginally faster to use the ToPackedArray 
function. Although the Developer context could in theory change at 
future versions, the packed array functions have been there for many 
versions, and are widely used, so I can't imagine these would get moved 
without a lot of warning.

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


  • Prev by Date: Re: concatenate matrices?
  • Next by Date: Re: trouble printing to PDF
  • Previous by thread: Re: Importing text file as machine-precision array
  • Next by thread: Managing your notebooks