Kim Hansen wrote:
> On Thu, May 15, 2008 at 6:25 PM, dbateman <
dbateman@...> wrote:
>
>> Kim Hansen-5 wrote:
>>
>>> How about making
>>> S = sparse (I, J, SV, M, N, NZMAX)
>>> work for multi dimensional I, J and SV ?
>>>
>>> The workaround sparse(I(:), J(:), SV(:)) is easy, but I would like
>>> sparse() to check that the dimensions of I, J, and SV were the same
>>> and then create the sparse matrix also for 3+-dimensional input
>>> matrices.
>>>
>>>
>> I'm no sure I understand what you mean. If the size of the matrix is
>>
>
> I'll try with an example:
>
> octave:1> a=reshape(1:8,[2 2 2]);
> octave:2> sparse(a,a,a,8,8)
> error: invalid conversion of NDArray to Matrix
> error: invalid conversion of NDArray to Matrix
> error: invalid conversion of NDArray to Matrix
> octave:2> sparse(a(:),a(:),a(:),8,8)
> ans =
>
> Compressed Column Sparse (rows = 8, cols = 8, nnz = 8)
>
> (1, 1) -> 1
> (2, 2) -> 2
> (3, 3) -> 3
> (4, 4) -> 4
> (5, 5) -> 5
> (6, 6) -> 6
> (7, 7) -> 7
> (8, 8) -> 8
>
> octave:3>
>
> I just think that statement number 2 should work and return the same
> as the 3rd statement.
>
>
Sure why not. Then in that case its a fairly small change to
src/DLD-FUNCTIONS/sparse.cc that is needed.
D.