Right now I am attempting to optimize my code as much as possible. I'm trying to optimize the code that does a./T. Is there any way to get the same results while only using the upper triangular portion of T or will that not help get speed gains? Also in order to deal with the NaN's on the resulting diagonal, after I divide I just set everything on the diagonal of the new matrix to 0.

An example of what a and T look like:
a =

0 -1 -2 -3 -4
1 0 -1 -2 -3
2 1 0 -1 -2
3 2 1 0 -1
4 3 2 1 0

T =

0 1 4 9 16
1 0 1 4 9
4 1 0 1 4
9 4 1 0 1
16 9 4 1 0

Thanks!

Subject: Using only upper triangular part of matrix to divide another matrix

"Steve" wrote in message <itqalq$6og$1@newscl01ah.mathworks.com>...
> Right now I am attempting to optimize my code as much as possible. I'm trying to optimize the code that does a./T. Is there any way to get the same results while only using the upper triangular portion of T or will that not help get speed gains? Also in order to deal with the NaN's on the resulting diagonal, after I divide I just set everything on the diagonal of the new matrix to 0.
>
> An example of what a and T look like:
> a =
>
> 0 -1 -2 -3 -4
> 1 0 -1 -2 -3
> 2 1 0 -1 -2
> 3 2 1 0 -1
> 4 3 2 1 0
>
> T =
>
> 0 1 4 9 16
> 1 0 1 4 9
> 4 1 0 1 4
> 9 4 1 0 1
> 16 9 4 1 0
>
> Thanks!

On Jun 21, 10:43 am, "Steve " <vipquality...@gmail.com> wrote:
> Right now I am attempting to optimize my code as much as possible. I'm trying to optimize the code that does a./T. Is there any way to get the same results while only using the upper triangular portion of T or will that not help get speed gains? Also in order to deal with the NaN's on the resulting diagonal, after I divide I just set everything on the diagonal of the new matrix to 0.
>
> An example of what a and T look like:
> a =
>
> 0 -1 -2 -3 -4
> 1 0 -1 -2 -3
> 2 1 0 -1 -2
> 3 2 1 0 -1
> 4 3 2 1 0
>
> T =
>
> 0 1 4 9 16
> 1 0 1 4 9
> 4 1 0 1 4
> 9 4 1 0 1
> 16 9 4 1 0
>
> Thanks!

"Steve" wrote in message <itqalq$6og$1@newscl01ah.mathworks.com>...
> Right now I am attempting to optimize my code as much as possible. I'm trying to optimize the code that does a./T. Is there any way to get the same results while only using the upper triangular portion of T or will that not help get speed gains? Also in order to deal with the NaN's on the resulting diagonal, after I divide I just set everything on the diagonal of the new matrix to 0.
>
> An example of what a and T look like:
> a =
>
> 0 -1 -2 -3 -4
> 1 0 -1 -2 -3
> 2 1 0 -1 -2
> 3 2 1 0 -1
> 4 3 2 1 0
>
> T =
>
> 0 1 4 9 16
> 1 0 1 4 9
> 4 1 0 1 4
> 9 4 1 0 1
> 16 9 4 1 0
>
> Thanks!

Is your purpose purely a speed gain? How big is your matrix that you are actually working with?

James Tursa

Subject: Using only upper triangular part of matrix to divide another matrix

"James Tursa" wrote in message <itrd8g$k4q$1@newscl01ah.mathworks.com>...
> "Steve" wrote in message <itqalq$6og$1@newscl01ah.mathworks.com>...
> > Right now I am attempting to optimize my code as much as possible. I'm trying to optimize the code that does a./T. Is there any way to get the same results while only using the upper triangular portion of T or will that not help get speed gains? Also in order to deal with the NaN's on the resulting diagonal, after I divide I just set everything on the diagonal of the new matrix to 0.
> >
> > An example of what a and T look like:
> > a =
> >
> > 0 -1 -2 -3 -4
> > 1 0 -1 -2 -3
> > 2 1 0 -1 -2
> > 3 2 1 0 -1
> > 4 3 2 1 0
> >
> > T =
> >
> > 0 1 4 9 16
> > 1 0 1 4 9
> > 4 1 0 1 4
> > 9 4 1 0 1
> > 16 9 4 1 0
> >
> > Thanks!
>
> Is your purpose purely a speed gain? How big is your matrix that you are actually working with?
>
> James Tursa

Thanks so much for the help so far everyone. My purpose is purely a speed gain. I am going to be working with matrices that are on the scale of ~20000x20000. Will using loops to break down the matrix help for such large matrices?