Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparse(eye(1000)) hangs on windows #7402

Closed
quinnj opened this issue Jun 24, 2014 · 13 comments
Closed

sparse(eye(1000)) hangs on windows #7402

quinnj opened this issue Jun 24, 2014 · 13 comments

Comments

@quinnj
Copy link
Member

quinnj commented Jun 24, 2014

I didn't find any other issues about this.

Some digging seems to point to the constructor. Are there some parameters not being satisfied?

In  [10]: m,n = 1000, 1000

Out [10]: (1000,1000)

In  [11]: colptr = ones(Int,1000);

In  [12]: I = ones(Int,1000);

In  [13]: V = ones(1000);

In  [14]: @which SparseMatrixCSC(m, n, colptr, I, V)

Out [14]: SparseMatrixCSC{Tv,Ti<:Integer}(m::Int64,n::Int64,colptr::Array{Ti<:Integer,1},rowval::Array{Ti<:Integer,1},nzval::Array{Tv,1})

It's weird that @which can't find a line number for the constructor.

@quinnj
Copy link
Member Author

quinnj commented Jun 24, 2014

cc: @ViralBShah @tanmaykm

@dmbates
Copy link
Member

dmbates commented Jun 24, 2014

Your vectors don't satisfy the conditions of a SparseMatrixCSC object.
colptr should have length n + 1 and length of V should be colptr[n + 1] - 1.

@quinnj
Copy link
Member Author

quinnj commented Jun 24, 2014

So why does sparse(eye(1000)) hang? Is something not being calculated right?

@dmbates
Copy link
Member

dmbates commented Jun 24, 2014

Don't know. I can't reproduce the problem on Linux.

julia> I1000 = sparse(eye(1000));

julia> names(I1000)
5-element Array{Symbol,1}:
 :m     
 :n     
 :colptr
 :rowval
 :nzval 

julia> println(I1000.m, " ", I1000.n)
1000 1000

julia> I1000.colptr'
1x1001 Array{Int64,2}:
 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15    993  994  995  996  997  998  999  1000  1001

julia> I1000.rowval'
1x1000 Array{Int64,2}:
 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15    992  993  994  995  996  997  998  999  1000

julia> I1000.nzval'
1x1000 Array{Float64,2}:
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0    1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0

@quinnj
Copy link
Member Author

quinnj commented Jun 24, 2014

Hmmm.......seems to be a weird bug in trying to show the sparse matrix. I've tracked it down to

print(io, sep, '[', rpad(S.rowval[k], pad), ", ", lpad(col, pad), "]  =  ")

here

@quinnj
Copy link
Member Author

quinnj commented Jun 24, 2014

Ok, even further reduced case:

io = STDOUT
sep = "\n\t"
print(io, sep)

Calling print hangs.

@quinnj
Copy link
Member Author

quinnj commented Jun 24, 2014

Further investigation takes me to https://github.com/JuliaLang/julia/blob/master/base/stream.jl#L765 trying to write(STDOUT,'\t'). @Keno, @vtjnash any ideas?

@quinnj
Copy link
Member Author

quinnj commented Jun 24, 2014

Is this related to #7082 perhaps?

@stevengj
Copy link
Member

Related to JuliaLang/IJulia.jl#200?

@quinnj
Copy link
Member Author

quinnj commented Jun 25, 2014

Ah, I didn't see that. Yes, it looks like it's the same issue (I don't see the same problem from console, only Sublime-IJulia). So I'm confused, is this a Julia or IJulia issue?

@stevengj
Copy link
Member

I'm not sure where the problem lies; I haven't been able to reproduce the problem (on MacOS).

(With IPython, it is not hanging, but somehow some garbled control characters are apparently being sent.)

@stevengj
Copy link
Member

The problem seems to be that JSON.jl is not escaping the tab character on Windows because isprint('\t') returns true on Windows (and false on MacOS).

I'm not sure whether this is a bug in JSON or in isprint; see #7416.

@stevengj
Copy link
Member

Should be worked around by JuliaIO/JSON.jl@0f038d9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants