Skip to content

Commit

Permalink
Updated the examples in the README, bumped version number.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Oct 4, 2024
1 parent 3b7fa9d commit 220910e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)

project(tatami_mtx
VERSION 1.0.0
VERSION 2.0.0
DESCRIPTION "Matrix Market to tatami matrices"
LANGUAGES CXX)

Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@ The `load_matrix_from_file()` function will create a `tatami::Matrix` from a Mat
```cpp
#include "tatami_mtx/tatami_mtx.hpp"

auto mat = tatami_mtx::load_matrix_from_file<false, double, int>("some_matrix.mtx");
tatami_mtx::Options opt;
opt.row = false;
auto mat = tatami_mtx::load_matrix_from_text_file<double, int>("some_matrix.mtx", opt);

// If compiled with Zlib support:
auto mat2 = tatami_mtx::load_matrix_from_file<false, double, int>("some_matrix.mtx.gz", 1);
// If compiled with Gzip support:
auto mat2 = tatami_mtx::load_matrix_from_gzip_file<double, int>("some_matrix.mtx.gz", opt);

// If the compression is unknown:
auto mat3 = tatami_mtx::load_matrix_from_file<false, double, int>("some_matrix.mtx.??", -1);
auto mat3 = tatami_mtx::load_matrix_from_some_file<double, int>("some_matrix.mtx.??", opt);
```

This will return a compressed sparse column matrix for coordinate formats and a column-major dense matrix for array formats.
If the first template argument is `true`, row-based matrices are returned instead.
If `opt.row = true`, row-based matrices are returned instead.

The next template arguments control the interface and storage types - for example, the above call will return a `tatami::Matrix<double, int>` interface
The template arguments control the interface and storage types - for example, the above call will return a `tatami::Matrix<double, int>` interface
The storage types are automatically chosen based on the Matrix Market field (for data) and the size of the matrix (for indices, only relevant for sparse outputs).
Users can customize these by passing the desired types directly:

```cpp
auto mat2 = tatami_mtx::load_matrix_from_file<
auto mat4 = tatami_mtx::load_matrix_from_text_file<
true, /* Row-based */
double, /* Data interface */
int, /* Index interface */
Expand Down

0 comments on commit 220910e

Please sign in to comment.