[Scilab-users] u .^ k ?

Stéphane Mottelet stephane.mottelet at utc.fr
Wed Dec 19 11:31:35 CET 2012


Le 19/12/12 11:17, Lamy Alain a écrit :
> Hi,
>
> Does anyone know how to perform efficiently an operation like :
> u .^k
>
> with:
> u = [u1, u2, ..., un]  // ui : real numbers
> and:
> k = [k1; k2; kp]  // ki : positive integers
>
>
> The result being :
>
> [ u1^k1, u2^k1, ..., un^k1;
>    u1^k2, u2^k2, ..., un^k2;
> ...
>    u1^kp, u2^kp, ..., un^kp ]
>
>
> I know  how to do it with cumprod (for instance), but it does not seem to be
> efficient enough.
>
>
>
>
>
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

maybe u(ones(1,p),:).^k(:,ones(1,n)) ?

S.



More information about the users mailing list