How to switfh off combine functrion in sparse?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to switfh off combine functrion in sparse?

programistawpf
How to switfh off combine functrion  in sparse? I need to ingore new value if in data is duplicat row/col. Somthing like this : sparse(I,J,V,m,n,+=0) but this dont work.

Paul

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to switfh off combine functrion in sparse?

Kristoffer Carlsson
try sparse(I,J,V,m,n,(a,b) ->a)

On Friday, August 12, 2016 at 5:06:29 PM UTC+2, [hidden email] wrote:
How to switfh off combine functrion  in sparse? I need to ingore new value if in data is duplicat row/col. Somthing like this : sparse(I,J,V,m,n,+=0) but this dont work.

Paul

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to switfh off combine functrion in sparse?

programistawpf
ThX, Paul

W dniu piątek, 12 sierpnia 2016 18:28:26 UTC+2 użytkownik Kristoffer Carlsson napisał:
try sparse(I,J,V,m,n,(a,b) ->a)

On Friday, August 12, 2016 at 5:06:29 PM UTC+2, [hidden email] wrote:
How to switfh off combine functrion  in sparse? I need to ingore new value if in data is duplicat row/col. Somthing like this : sparse(I,J,V,m,n,+=0) but this dont work.

Paul

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to switfh off combine functrion in sparse?

programistawpf
Why "/" and "div" not work ?

julia> I
4-element Array{Int64,1}:
 1
 1
 2
 3
julia> J
4-element Array{Int64,1}:
 1
 1
 2
 3
julia> V
4-element Array{Int64,1}:
 2
 5
 1
 1

julia> sparse(I,J,V,3,3,*)
3x3 sparse matrix with 3 Int64 entries:
        [1, 1]  =  10
        [2, 2]  =  1
        [3, 3]  =  1

julia> sparse(I,J,V,3,3,+)
3x3 sparse matrix with 3 Int64 entries:
        [1, 1]  =  7
        [2, 2]  =  1
        [3, 3]  =  1

julia> sparse(I,J,V,3,3,/)
ERROR: InexactError()
 in convert at int.jl:209

julia> sparse(I,J,V,3,3,div)
3x3 sparse matrix with 3 Int64 entries:
        [1, 1]  =  0
        [2, 2]  =  1
        [3, 3]  =  1
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to switfh off combine functrion in sparse?

programistawpf
In reply to this post by programistawpf
Why "/" not work ?

julia> I
4-element Array{Int64,1}:
 1
 1
 2
 3
julia> J
4-element Array{Int64,1}:
 1
 1
 2
 3
julia> V
4-element Array{Int64,1}:
 2
 5
 1
 1

julia> sparse(I,J,V,3,3,*)
3x3 sparse matrix with 3 Int64 entries:
        [1, 1]  =  10
        [2, 2]  =  1
        [3, 3]  =  1

julia> sparse(I,J,V,3,3,+)
3x3 sparse matrix with 3 Int64 entries:
        [1, 1]  =  7
        [2, 2]  =  1
        [3, 3]  =  1

julia> sparse(I,J,V,3,3,/)
ERROR: InexactError()
 in convert at int.jl:209

julia> sparse(I,J,V,3,3,div)
3x3 sparse matrix with 3 Int64 entries:
        [1, 1]  =  0
        [2, 2]  =  1
        [3, 3]  =  1
Loading...