Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1762

Re: Importing text file as machine-precision array

From David Bailey <dave@removedbailey.co.uk>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Importing text file as machine-precision array
Date 2011-04-17 11:53 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ioekb0$n0q$1@smc.vnet.net> (permalink)
References <inpfu3$9as$1@smc.vnet.net> <inqkt3$e73$1@smc.vnet.net> <inun9l$2aj$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Importing text file as machine-precision array Sidney Cadot <sidney@jigsaw.nl> - 2011-04-09 11:29 +0000
  Re: Importing text file as machine-precision array David Bailey <dave@removedbailey.co.uk> - 2011-04-09 22:00 +0000
    Re: Importing text file as machine-precision array Sidney Cadot <sidney.cadot@gmail.com> - 2011-04-11 11:05 +0000
      Re: Importing text file as machine-precision array David Bailey <dave@removedbailey.co.uk> - 2011-04-17 11:53 +0000

csiph-web