Re: Accelerating a one-line program doing matrix multiplication [message #72753 is a reply to message #72696] |
Wed, 29 September 2010 09:05   |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Sep 29, 11:55 am, Axel M <axe...@gmail.com> wrote:
> On 29 Sep., 17:45, Paulo Penteado <pp.pente...@gmail.com> wrote:
>
>> On Sep 29, 12:24 pm, Axel M <axe...@gmail.com> wrote:
>
>>> Great, I did not know about this construction, and honestly I do not
>>> understand how it works (is there any documentation about it?).
>>> Anyways, I tried it, and unfortunately I saw that it needed ~20%
>>> longer (the complete function, not the rebin only). So, it is not
>>> faster.. but it is great though.
>
>> It is replicating a structure of a single field which contains the
>> array input ({temp:input}), then selecting only a single field (the
>> first, 0) of the resulting structure array. Documentation for this
>> would be on creation and use of structures.
>
> Ok, I got it. Thanks! Then probably it is the memory allocation for
> the array of structures which takes so long... it would be great if
> the ITT people would develop a _fast_ vector replicate, I fear
> rebinning is not the best option.
>
> In any case, based on the answers, I assume that my problem is rather
> on the matrix multiplication part, so I can probably do nothing for
> that.
>
> Thanks a lot
well considering your original problem - you need to apply
a linear transformation to N vectors v_i=(x_i,y_i,z_i),
for i going from 0 to a large N, right?
I would just explicitely compute the transformed vectors
z_i=(xx_i,yy_i,zz_i)
by just writing out in the program the computation for every
component,
i.e.
xx=x*c1+y*c2+z*c3+c4
and same for yy,zz with appropriate constant coefficients c1,c2,c3,c4
(that are the same for all i).
But then maybe i misunderstood the problem...
Ciao,
Paolo
|
|
|