Mercurial > hg > octave-max
changeset 8401:712cfdc2e417
allow saving diagonal & permutation matrices to hdf5 as full
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 12 Dec 2008 13:35:10 +0100 |
parents | 7b6e1fc1cb90 |
children | 2176f2b4599e |
files | src/ChangeLog src/ls-hdf5.cc |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-12-12 Jaroslav Hajek <highegg@gmail.com> + + * ls-hdf5.cc (add_hdf5_data): Check for diagonal & permutation + matrices and convert them to full prior to saving. + 2008-12-11 Jaroslav Hajek <highegg@gmail.com> * ov-re-mat.cc (Fdouble): Handle diagonal & perm matrices.
--- a/src/ls-hdf5.cc +++ b/src/ls-hdf5.cc @@ -747,7 +747,13 @@ hid_t type_id = -1, space_id = -1, data_id = -1, data_type_id = -1; bool retval = false; octave_value val = tc; - std::string t = tc.type_name(); + // FIXME: diagonal & permutation matrices currently don't know how to save + // themselves, so we convert them first to normal matrices using A = A(:,:). + // This is a temporary hack. + if (val.is_diag_matrix () || val.is_perm_matrix ()) + val = val.do_index_op (octave_value_list (2, octave_value::magic_colon_t)); + + std::string t = val.type_name(); data_id = H5Gcreate (loc_id, name.c_str (), 0); if (data_id < 0)