[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #41186] image: fspecial disk is not matlab com
From: |
Joonas Lipping |
Subject: |
[Octave-bug-tracker] [bug #41186] image: fspecial disk is not matlab compatible |
Date: |
Sat, 01 Mar 2014 21:55:46 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0 |
Follow-up Comment #4, bug #41186 (project octave):
New version. In this one, the nested subfunction has been inlined. There is
still a loop, but I don't think that there is an efficient way to achieve this
functionality without one, due to the fact that the edge of the disk can hit a
square in at least three ways: enter horizontally, exit horizontally; enter
vertically, exit horizontally; enter horizontally, exit vertically. It's a bit
tricky to take all these into account in a simple expression.
I would argue that it is fine to have the loop, as it only iterates along 1/8
of the disk's rim, which means O(radius) squares hit. I tested the running
time on radii from 1 to 1000, comparing the revised function to the current
one, and the running time multiplier peaks at a little below 12 (somewhere
between radii 100 and 200) and seems to asymptotically approach ~5. The new
function is faster than the previous one I submitted by a factor of 2 or
perhaps a little less.
I added a bit to the documentation at the top of the file about what the
function now does. I also edited NEWS. I added a test that checks for a couple
different radii that the sum of the elements is approximately 1.
I haven't been able to check if the output corresponds to Matlab *exactly*,
but at least the default range gives the same output within long format
accuracy.
(file #30746)
_______________________________________________________
Additional Item Attachment:
File name: fspecial.diff Size:4 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?41186>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #41186] image: fspecial disk is not matlab compatible,
Joonas Lipping <=