octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #40813] atan2 returns no results for sparse ma


From: Stefan Mahr
Subject: [Octave-bug-tracker] [bug #40813] atan2 returns no results for sparse matrices
Date: Mon, 20 Jan 2014 16:54:57 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36

Follow-up Comment #1, bug #40813 (project octave):

Attached a possible fix. Don't know if 'copy_or_memcopy' is ok here, but seems
the be the fastest solution.

One option would be to copy the whole sparse matrix using existing method, but
then data is copied for nothing. Other possibility is to rewrite column and
row index within for loop, but this is slow. Third option: Create new method?

Also, MATLABs behaviour differs a little bit. This is also fixed with the
attached patch.

This is the MATLAB result:

>>     x=sparse([1 2]);   
>>     atan2(x,x)
ans =
   (1,1)            0.785398163397448
   (1,2)            0.785398163397448
>>     atan2(x,2)
ans =
   (1,1)            0.463647609000806
   (1,2)            0.785398163397448
>>     atan2(x,[1 2])
ans =
   (1,1)            0.785398163397448
   (1,2)            0.785398163397448
>>    
>>     atan2(2,x)
ans =
          1.10714871779409         0.785398163397448
>>     atan2([1 2],x)
ans =
         0.785398163397448         0.785398163397448




(file #30320)
    _______________________________________________________

Additional Item Attachment:

File name: atan2_spare.patch              Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40813>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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