Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atoptima/dynamicsparsearrays.jl
Dynamic sparse vector and matrix for julia
https://github.com/atoptima/dynamicsparsearrays.jl
julia sparse-matrix
Last synced: about 2 months ago
JSON representation
Dynamic sparse vector and matrix for julia
- Host: GitHub
- URL: https://github.com/atoptima/dynamicsparsearrays.jl
- Owner: atoptima
- License: other
- Created: 2019-10-09T01:38:41.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-26T13:28:37.000Z (11 months ago)
- Last Synced: 2024-04-26T16:04:32.201Z (8 months ago)
- Topics: julia, sparse-matrix
- Language: Julia
- Homepage:
- Size: 619 KB
- Stars: 16
- Watchers: 5
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DynamicSparseArrays.jl
[![Documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://atoptima.github.io/DynamicSparseArrays.jl/dev/)
![Build Status](https://github.com/atoptima/DynamicSparseArrays.jl/workflows/CI/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/atoptima/DynamicSparseArrays.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/atoptima/DynamicSparseArrays.jl)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)Brief introduction to the package: [https://atoptima.github.io/Coluna.jl/stable/dynamic_sparse_arrays/](https://atoptima.github.io/Coluna.jl/stable/dynamic_sparse_arrays/)
Install the package :
```
] add DynamicSparseArrays
```## Example
```julia
using DynamicSparseArrays
I = [1, 10, 3, 5, 3]
V = [1.0, 2.4, 7.1, 1.1, 1.0]
vector = dynamicsparsevec(I,V) # create a vectorvector[3] == 2.4 + 1.0 # true
vector[78] = 1.5 # insert a value (new row)
vector[2] # retrieve a value
vector[2] = 0 # delete a valueI = [1, 2, 3, 2, 6, 7, 1, 6, 8] #rows
J = [1, 1, 1, 2, 2, 2, 3, 3, 3] #columns
V = [2, 3, 4, 2, 4, 5, 3, 5, 7] #value
matrix = dynamicsparse(I,J,V) # create a matrixmatrix[4,1] = 1 # new column
matrix[2,2] = 0 # delete value
deletecolumn!(matrix, 2) # delete column with id 2
matrix[2,6] == 0 # true
```