Skip to content

Error in doc of sprandn #31283

@DNF2

Description

@DNF2

The documentation of sprand/sprandn appears to have an error in the section https://docs.julialang.org/en/v1/stdlib/SparseArrays/#Correspondence-of-dense-and-sparse-methods-1

The table here:
screenshot 2019-03-06 at 13 04 08
shows that sprandn takes a distribution as a final argument, but this is not the case.

The accompanying text also seems to indicate that this should work:

sprand(100, 100, 0.3, Uniform(-1,1))

while, in fact, you need

sprand(100, 100, 0.3, n->rand(Uniform(-1,1),n))

Also, the docstring of sprand gives the wrong impression:

Nonzero values are sampled from the distribution specified by rfn and have the type type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviordocsThis change adds or pertains to documentationgood first issueIndicates a good issue for first-time contributors to JuliasparseSparse arrays

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions