Hi again --

Another question.  I want to create a sparse matrix whose non-zero
elements are BigFloats.  Neither of the two approaches I tried (below)
seem to work.

julia> Asp = spzeros(4,4)
4x4 sparse matrix with 0 Float64 entries:

julia> Asp[1,1] = BigFloat(3.4)
3.399999999999999911182158029987476766109466552734375000000000000000000000000000

julia> Asp
4x4 sparse matrix with 1 Float64 entries:
    [1, 1]  =  3.4

julia> Asp = BigFloat(spzeros(4,4))
ERROR: MethodError: `convert` has no method matching convert(::Type{BigFloat}, 
::SparseMatrixCSC{Float64,Int64})
This may have arisen from a call to the constructor BigFloat(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert{T<:Real}(::Type{T<:Real}, ::Complex{T<:Real})
  convert(::Type{BigFloat}, ::Rational{T<:Integer})
  ...
 in call at essentials.jl:56


I tried fiddling around with using SparseMatrixCSC{Tv,Ti<:Integer} as
a constructor, but no joy there since it probably is a type, and can't
be used as a constructor.

What's the easiest way to create a sparse matrix whose entries are not
doubles?

Thanks,

Stuart

Reply via email to