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


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

Re: Efficient function to accumulate a list of {value,coord} into array

From julian.w.francis@gmail.com
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Efficient function to accumulate a list of {value,coord} into array
Date 2014-04-05 05:49 +0000
Message-ID <lho5hm$r7p$1@smc.vnet.net> (permalink)
References <lhiudg$dij$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Dear all,

Thanks for all your replies, I also had quite a few coming in via direct email.

Comparing a number of solutions, it seems that the level of sparsity in the resulting matrix makes a big difference as to which algorithms are more efficient.

Basically most solutions seem to boil down to doing a GatherBy to group elements of the same cell, then totalling and and feeding into SparseArray.

Bob Hanlon suggested replacing the For loop with a map construct.

In my specific circumstances, I was able to double the speed by following Bob's Map suggestion.

The other solutions while more elegant than my original code, were not that much more efficient on a dense matrix.(Although they are for a sparse matrix).

The above conclusions were tested on 144*300 with 20,000 particles.

Thanks for all your help,
Julian.

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


Thread

Efficient function to accumulate a list of {value,coord} into array julian.w.francis@gmail.com - 2014-04-03 06:17 +0000
  Re: Efficient function to accumulate a list of {value,coord} into array "Dr. Wolfgang Hintze" <weh@snafu.de> - 2014-04-04 07:56 +0000
  Re: Efficient function to accumulate a list of {value,coord} into array julian.w.francis@gmail.com - 2014-04-05 05:49 +0000

csiph-web