Re: [julia-users] Subtraction of the diagonal matrix, how sipler?

2015-02-01 Thread paul analyst
Thx, nice. Is the fast way in Julia ?
Paul

W dniu niedziela, 1 lutego 2015 17:18:03 UTC+1 użytkownik Andreas Noack 
napisał:

 This is cheaper: rand(4,4) - 5*I because 5I is a special type that doesn't 
 store all elements.

 2015-02-01 11:03 GMT-05:00 paul analyst paul.a...@mail.com javascript:
 :

 I have somethink like this :

 rand(4,4).-eye(4,4)*5

 Qestion : how to simpler subtracted from the diagonal value(5) , 
 Without  multiplying matrices  I have great and I have to simplify 
 the code.

 Paul




Re: [julia-users] Subtraction of the diagonal matrix, how sipler?

2015-02-01 Thread Andreas Noack
I think so, but it neither take long time

julia let

   A = rand(4,4);

   @time for i = 1:10^6;A - 5.0*eye(4);end

   end;

elapsed time: 0.177621144 seconds (534 MB allocated, 5.71% gc time in 25
pauses with 0 full sweep)


julia let

   A = rand(4,4);

   @time for i = 1:10^6;A - 5.0*I;end

   end;

elapsed time: 0.053749097 seconds (167 MB allocated, 5.04% gc time in 8
pauses with 0 full sweep)


2015-02-01 11:49 GMT-05:00 paul analyst paul.anal...@mail.com:

 Thx, nice. Is the fast way in Julia ?
 Paul

 W dniu niedziela, 1 lutego 2015 17:18:03 UTC+1 użytkownik Andreas Noack
 napisał:

 This is cheaper: rand(4,4) - 5*I because 5I is a special type that
 doesn't store all elements.

 2015-02-01 11:03 GMT-05:00 paul analyst paul.a...@mail.com:

 I have somethink like this :

 rand(4,4).-eye(4,4)*5

 Qestion : how to simpler subtracted from the diagonal value(5) ,
 Without  multiplying matrices  I have great and I have to simplify
 the code.

 Paul





Re: [julia-users] Subtraction of the diagonal matrix, how sipler?

2015-02-01 Thread Andreas Noack
This is cheaper: rand(4,4) - 5*I because 5I is a special type that doesn't
store all elements.

2015-02-01 11:03 GMT-05:00 paul analyst paul.anal...@mail.com:

 I have somethink like this :

 rand(4,4).-eye(4,4)*5

 Qestion : how to simpler subtracted from the diagonal value(5) ,
 Without  multiplying matrices  I have great and I have to simplify the
 code.

 Paul