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

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

[Octave-bug-tracker] [bug #63833] Matrix indexing is inconsistent


From: Rik
Subject: [Octave-bug-tracker] [bug #63833] Matrix indexing is inconsistent
Date: Fri, 24 Feb 2023 13:30:34 -0500 (EST)

Follow-up Comment #7, bug #63833 (project octave):

You might time the for loop dec2hex.m which is 16 iterations versus the
indexing solution.


+  ## Convert to char matrix and return.
+  ## We used to return this in a single line:
+  ##    hstr = ("0123456789ABCDEF")(d+1);
+  ## But there are edge cases governing the sizes of row and column vectors
+  ## that cause problems with output size, so we use a loop instead.
+  hstr = repmat (' ', size (d));
+  v = "0123456789ABCDEF";
+  for t = 0:15
+    hstr(d == t) = v(t + 1);
+  endfor


The time difference might be meaningless, or it might be worth addressing.  I
did a lot of work on the set functions and what I found there was that it was
easy to do some input checks to find out what the desired shape of the output
would be, then change all inputs to a specific form such as column vectors, do
the algorithm, then just change shape at the end.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63833>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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