In MATLAB it’s possible to use sparse
like this:
>> full(sparse([2 3 4 5; 1 2 3 4; 9 8 6 7],ones(3,1)*(1:4),1,9,9))
ans =
1 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0
0 1 1 0 0 0 0 0 0
0 0 1 1 0 0 0 0 0
0 0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0
0 1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0
Does julia support a similar constructor for sparse matrices? I realize I can make a loop to achieve the same effect, but I’m wondering if there is a built-in function somwhere.
Specifically, note that the input are matrices and not vectors.