Thank you for the info.

On Saturday, March 28, 2015 at 7:56:54 PM UTC-5, Yee Sian Ng wrote:
>
> If you use tab-completion in an interactive session,
>
> julia> spones(
> spones{T}(S::SparseMatrixCSC{T,Ti<:Integer}) at sparse/sparsematrix.jl:401
>
> ​
> you'll see that the spones() function in Base only accepts CSC matrices 
> <http://julia.readthedocs.org/en/latest/manual/arrays/#sparse-matrices> so 
> far. Here's the code to make your example work:
>
> julia> A = SparseMatrixCSC(2,3,[1,3,4,6],[1,2,2,1,2],[1,2,1,3,3])
> 2x3 sparse matrix with 5 Int64 entries:
>     [1, 1]  =  1
>     [2, 1]  =  2
>     [2, 2]  =  1
>     [1, 3]  =  3
>     [2, 3]  =  3
>
> julia> spones(A)
> 2x3 sparse matrix with 5 Int64 entries:
>     [1, 1]  =  1
>     [2, 1]  =  1
>     [2, 2]  =  1
>     [1, 3]  =  1
>     [2, 3]  =  1
>
> ​
> ​
>
>
> On Saturday, 28 March 2015 20:10:07 UTC-4, Mladen Kolar wrote:
>>
>> Hi, 
>>
>> I have a question about spones() function, as I am not quite sure how to 
>> use it. 
>> I have encountered the following issue using Base.spones().
>>
>> julia> A = [1 0 3.; 2. 1. 3.]
>> 2x3 Array{Float64,2}:
>>  1.0  0.0  3.0
>>  2.0  1.0  3.0
>>
>> julia> spones(A)
>> ERROR: `spones` has no method matching spones(::Array{Float64,2})
>>
>> I would expect to get back a matrix that has ones everywhere except at 
>> [1, 2], as per help:
>>
>> help?> spones
>> INFO: Loading help data...
>> Base.spones(S)
>>
>>
>>    Create a sparse matrix with the same structure as that of "S",
>>    but with every nonzero element having the value "1.0".
>>
>>
>> I am new to Julia and not sure if I am missing something.
>>
>> Thanks,
>> Mladen
>>
>

Reply via email to