octave-maintainers
[Top][All Lists]
Advanced

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

Re: ind2sub and sub2ind


From: Juan Pablo Carbajal
Subject: Re: ind2sub and sub2ind
Date: Sun, 11 Dec 2011 17:00:36 +0100

2011/12/9 Jordi Gutiérrez Hermoso <address@hidden>:
> On 9 December 2011 09:56, Juan Pablo Carbajal <address@hidden> wrote:
>> What is the status of ind2sub and sub2ind extension to triangular matrices?
>>
>> Are we going to extend ind2sub and sub2ind or we just add ind2sub_tril
>> and sub2ind_tril (and unvech) to the linear-algebra package?
>
> I've been lazy/busy about doing this when I realised that it required
> a new implementation in C++.
>
> I would be happy to add those options, if someone else codes them. Do
> you want to try? I think it's a fairly simple task for C++. It should
> even require less trickery than any m-script implementation. If you
> write the initial implementation, I can polish it later (not sure how
> confident you are with C++) and then push the changes to the repo.
>
> - Jordi G.H.

Hi,

I have been working on the change set for sub2ind and ind2sub.
I want to ask how to trigger the new functionality.

I observed that calls to any of the functions ind2sub or sub2ind (I
use foo to name them) fails if they are in the form
foo(N,i,j)
with N a scalar.

The implementation of sub2ind_tril we have, assumes the triangular
matrix is square (indeed if it is not it doesn't make much sense in
general), or in other words it will number only the first square block
(as tril and triup do, test tril(ones(3,8))).

Therefore, we could extend the behavior of the foo functions by using
the case of scalar first argument.

What do you think?

Note: The  other possibility is to check if the fourth argument is a
string (indicating tril or triup), so
foo(N,i,j,str)
will trigger the extended behavior, and N will be checked to be a scalar.



-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

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