CUV  0.9.201304091348
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
sparse_matrix_io.hpp
Go to the documentation of this file.
1 //*LB*
2 // Copyright (c) 2010, University of Bonn, Institute for Computer Science VI
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 // * Neither the name of the University of Bonn
14 // nor the names of its contributors may be used to endorse or promote
15 // products derived from this software without specific prior written
16 // permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //*LE*
29 
30 
31 
32 
33 
41 #ifndef __SPARSE_MATRIX_IO_HPP__
42 
43 #include <boost/serialization/array.hpp>
44 #include <boost/serialization/vector.hpp>
45 #include <boost/archive/binary_oarchive.hpp>
46 #include <boost/archive/binary_iarchive.hpp>
48 #include <cuv/basics/io.hpp>
49 
50 namespace cuv{
51 
59  template<class Archive, class value_type, class index_type>
60  void serialize(Archive& ar, cuv::dia_matrix<value_type,host_memory_space,index_type>& m, const unsigned int version){
61  ar & m.m_width;
62  ar & m.m_height;
63  ar & m.m_num_dia;
64  ar & m.m_stride;
65  ar & m.m_row_fact;
66  ar & m.m_offsets;
67  if(!m.vec_ptr()){
68  m.alloc();
70  }
71  ar & m.vec();
72  }
76  template
77  void serialize(boost::archive::binary_oarchive&, dia_matrix<float, host_memory_space, unsigned int>&, unsigned int);
78 }
79 
80 #endif
81