Skip to content

[ENHANCEMENT] Rename constructors like SparseArrayDOK{T}(data::Dict, dims) to sparse(T, data::Dict, dims) #42

Closed
@mtfishman

Description

@mtfishman

As discussed in ITensor/BlockSparseArrays.jl#68, in order to avoid overloading constructors too much, replace constructors like SparseArrayDOK{T}(data::Dict, dims) with SparseArraysBase.sparse(T, data::Dict, dims) (note that won't be an overload of SparseArrays.sparse, but a separate function).

This is in line with how constructors are designed in BlockArrays.jl and SparseArrays.jl, where constructors are (mostly) constrained to be either for initializing arrays with undefined/empty data, or for converting from another array. Functions then generally handle more complicated operations like taking collections of blocks and turning them into block arrays (i.e. BlockArrays.mortar) or taking lists of stored values and constructing a sparse array from those stored values (i.e. SparseArrays.sparse).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions