# vnl\_sparse\_matrix IO

**URL:** https://discourse.itk.org/t/vnl-sparse-matrix-io/618
**Category:** Engineering
**Created:** [January 24, 2018, 10:29am UTC](https://discourse.itk.org/t/vnl-sparse-matrix-io/618 "2018-01-24T10:29:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [January 24, 2018, 10:29am UTC](https://discourse.itk.org/t/vnl-sparse-matrix-io/618/1 "2018-01-24T10:29:52Z")

</div>

Hi,  
I’d like to create a vnl\_sparse\_matrix and to write it down to disk. However, it does not seem possible. When including vnl/io/vnl\_io\_sparse\_matrix.h, I get the following error

> fatal error: ‘vsl/vsl\_binary\_io.h’ file not found

and this file is indeed not in the ITK tree. Do you confirm that it is indeed not possible to use vnl\_io\_sparse\_matrix.h? Is there an existing solution to write a sparse matrix to disk?  
Thanks in advance,  
Simon

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 24, 2018, 2:53pm UTC](https://discourse.itk.org/t/vnl-sparse-matrix-io/618/2 "2018-01-24T14:53:21Z")

</div>

Hi Simon,

Since ITK does not ship all of VNL, this file is not available.

I am not aware of existing classes available in ITK that serialize  
`vnl_sparse_matrix`.

HTH,  
Matt

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [January 25, 2018, 8:04am UTC](https://discourse.itk.org/t/vnl-sparse-matrix-io/618/3 "2018-01-25T08:04:01Z")

</div>

Hi,  
Thanks for your answer. What about itk::SparseImage? Is there a dedicated file format to write it down to disk?  
Simon

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 25, 2018, 2:37pm UTC](https://discourse.itk.org/t/vnl-sparse-matrix-io/618/4 "2018-01-25T14:37:53Z")

</div>

Not that I am aware of.
