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

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

[Octave-bug-tracker] [bug #41796] Generalize sub2ind and ind2sub or prov


From: Eduardo Ramos Fernández
Subject: [Octave-bug-tracker] [bug #41796] Generalize sub2ind and ind2sub or provide specialized functions
Date: Wed, 19 Mar 2014 04:42:17 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0

Follow-up Comment #6, bug #41796 (project octave):

I have implemented the sub2ind for work with triangular 2D matrices along with
some tests and documentation. Some of the details regarding implementation
are:

1) Dimensions vector must represent a 2D square matrix
2) Indexes of elements above or below diagonal, for lower and upper matrices
respectively, are not allowed.
3)  An offset can be given like in tril and triu.It can be negative or
positive. 
4) "tril" or "triu" should be given as the 4rth argument. Since  we work in 2D
it is mandatory that before the string argument, 3 parameters appear.
+markup+ 
sub2ind(dim, i, j, ["tril"|"triu], offset) Looks like that...
-markup- 

I have tried to touch sub2ind function the less I could. Just one if block has
been added along with the implementation of a function called sub2ind_triag.
That makes possible if needed to remove easily the code in a future.

Here is the patch (file #30945
<https://savannah.gnu.org/bugs/download.php?file_id=30945>)

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Mensaje enviado vía/por Savannah
  http://savannah.gnu.org/




reply via email to

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