Skip to content

Commit 39d39c2

Browse files
committed
Initial commit
1 parent 1111261 commit 39d39c2

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

README.md

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,24 @@
66

77
## Overview
88

9-
`NDimensionalSparseArrays.jl` provides a `NDSparseArray` type that efficiently stores and manipulates n-dimensional arrays with a high proportion of zero elements. Unlike dense arrays, `NDSparseArray` only stores non-zero values, significantly reducing memory consumption for sparse data.
10-
11-
This package is designed to be a flexible and intuitive tool for scientific computing, data analysis, and any domain where large, sparse n-dimensional data structures are common.
9+
`NDimensionalSparseArrays.jl` provides an efficient `NDSparseArray` type for working with sparse, n-dimensional arrays. It is designed to store and manipulate arrays with a high proportion of zero elements, reducing memory consumption significantly compared to dense arrays. The package is dependency-free, making it lightweight and easy to integrate into various projects.
1210

1311
## Features
1412

15-
- **Memory Efficiency:** Only non-zero elements are stored, making it ideal for high-dimensional sparse data.
16-
- **Arbitrary Dimensionality:** Create sparse arrays of any number of dimensions.
17-
- **Intuitive Indexing:** Use standard Julia indexing to access and modify elements.
18-
- **Comprehensive API:** A rich set of functions for creating, manipulating, and analyzing sparse arrays.
19-
- **Interoperability:** Easily convert between `NDSparseArray` and dense `Array` types.
20-
- **Arithmetic Operations:** Perform element-wise arithmetic (+, -, *) on sparse arrays.
13+
- **Memory Efficiency**: Stores only non-zero elements, ideal for high-dimensional sparse data.
14+
- **Arbitrary Dimensionality**: Handles sparse arrays in any number of dimensions.
15+
- **No Dependencies**: The package is self-contained, with no external dependencies, ensuring a minimal footprint.
16+
- **Intuitive Indexing**: Uses standard Julia array indexing for easy access and modification.
17+
- **Flexible API**: A rich set of functions for creating, manipulating, and analyzing sparse arrays.
18+
- **Interoperability**: Seamlessly convert between sparse and dense array types.
2119

2220
## Comparison with `SparseArrays.jl`
2321

24-
`NDimensionalSparseArrays.jl` is designed to provide a flexible and easy-to-use interface for N-dimensional sparse arrays. While Julia's standard library [`SparseArrays.jl`](https://github.com/JuliaSparse/SparseArrays.jl) is highly optimized for 1-D and 2-D sparse arrays (vectors and matrices), `NDimensionalSparseArrays.jl` offers a more general-purpose solution for higher-dimensional sparse data. Key differences include:
22+
While `SparseArrays.jl` is highly optimized for 1D and 2D sparse arrays (vectors and matrices), `NDimensionalSparseArrays.jl` supports sparse data in **n**-dimensions, providing a more flexible and convenient solution for higher-dimensional use cases. Key differences include:
2523

26-
- **Dimensionality:** `SparseArrays.jl` focuses on `SparseVector` and `SparseMatrixCSC`. `NDimensionalSparseArrays.jl` is built from the ground up for N-dimensional arrays.
27-
- **Storage Format:** `NDimensionalSparseArrays.jl` uses a dictionary-based storage (`Dict{CartesianIndex{N}, T}`), which is flexible for arbitrary dimensions. `SparseArrays.jl` uses the more rigid but highly efficient Compressed Sparse Column (CSC) format for matrices.
28-
- **Use Case:** If you are working with 1-D or 2-D sparse arrays and require high-performance linear algebra operations, `SparseArrays.jl` is the ideal choice. If you need to work with sparse data in three or more dimensions, `NDimensionalSparseArrays.jl` provides a more natural and convenient API.
24+
- **Dimensionality**: `SparseArrays.jl` is limited to 1D and 2D arrays, whereas `NDimensionalSparseArrays.jl` supports arbitrary-dimensional sparse arrays.
25+
- **Storage Format**: Uses a dictionary-based storage format (`Dict{CartesianIndex{N}, T}`) suitable for any dimensionality, while `SparseArrays.jl` uses Compressed Sparse Column (CSC) format for matrices.
26+
- **Use Case**: Best for working with higher-dimensional sparse arrays, while `SparseArrays.jl` excels in linear algebra operations for 1D and 2D sparse arrays.
2927

3028
## Installation
3129

@@ -37,8 +35,6 @@ pkg> add NDimensionalSparseArrays
3735

3836
### Creating a NDSparseArray
3937

40-
You can create a `NDSparseArray` in several ways:
41-
4238
```julia
4339
using NDimensionalSparseArrays
4440

@@ -58,8 +54,6 @@ D = spones(2, 2)
5854

5955
### Accessing and Modifying Elements
6056

61-
Use standard array indexing to get and set elements. Accessing an unset element will throw a `BoundsError`.
62-
6357
```julia
6458
A = NDSparseArray{Float64}(3, 3)
6559

@@ -80,8 +74,6 @@ get(A, (1, 2), 0.0) # returns 0.0
8074

8175
### Handling Sparsity
8276

83-
Several functions are provided to work with the sparse nature of the array:
84-
8577
```julia
8678
# Get the number of non-zero elements
8779
nnz(B)
@@ -103,8 +95,6 @@ compress!(B)
10395

10496
### Arithmetic Operations
10597

106-
Element-wise arithmetic operations are supported:
107-
10898
```julia
10999
A = NDSparseArray([1 0; 0 4])
110100
B = NDSparseArray([0 2; 3 0])
@@ -121,8 +111,6 @@ E = A * 2 # [2 0; 0 8]
121111

122112
## API Reference
123113

124-
The following are the key exports of the package:
125-
126114
- `NDSparseArray`: The n-dimensional sparse array type.
127115
- `nnz`: Get the number of non-zero elements.
128116
- `sparsity`: Get the fraction of zero elements.

0 commit comments

Comments
 (0)