help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: searching for the elegant code (matrix indexing and more)


From: Juan Pablo Carbajal
Subject: Re: searching for the elegant code (matrix indexing and more)
Date: Wed, 22 Jan 2014 19:46:15 +0100

On Wed, Jan 22, 2014 at 5:11 PM, oxy <address@hidden> wrote:
> ... you probably realized a small mistake. Parameter E is also
> an index to the matrix sig:
>
> dim=11;
>  for A=(1:dim)
>      for B=(1:dim)
>          for C=(1:dim)
>              for D=(1:dim)
>                  for E=(1:dim)
>                      sig(A, B, C, D, E) = A*B^2 - C*D^3 +10*E;
>                  endfor
>              endfor
>          endfor
>      endfor
>  endfor
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

You need to implement tensor products. I never tried with rank-5, you
can for sure reduce the thing t 3 loops (so work with rank-2) but I
can imagine a clever use of kron, permute and reshape can do the
trick. However, it is problably more efficient if you just write the
loops in C and make and oct file :D


reply via email to

[Prev in Thread] Current Thread [Next in Thread]