SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EigenMatrixFromScirunAsciiFormatConverter.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 #ifndef ALGORITHMS_DATAIO_EIGENMATRIXFROMSCIRUNASCIIFORMATCONVERTER_H
30 #define ALGORITHMS_DATAIO_EIGENMATRIXFROMSCIRUNASCIIFORMATCONVERTER_H
31 
32 #include <string>
33 #include <vector>
34 #include <boost/optional.hpp>
35 #include <boost/tuple/tuple.hpp>
39 
40 namespace SCIRun {
41 namespace Core {
42 namespace Algorithms {
43 namespace DataIO {
44 namespace internal
45 {
46 
48  {
49  public:
51  Core::Datatypes::MatrixHandle make(const std::string& matFile);
52 
53  Core::Datatypes::SparseRowMatrixHandle makeSparse(const std::string& matFile);
54 
55  boost::optional<std::string> getMatrixContentsLine(const std::string& matStr);
56 
57  std::string readFile(const std::string& filename);
58 
59  Core::Datatypes::DenseMatrixHandle makeDense(const std::string& matFile);
60  Core::Datatypes::DenseColumnMatrixHandle makeColumn(const std::string& matFile);
61 
62  typedef std::vector<int> Indices;
63  typedef std::vector<double> Data;
64  typedef boost::tuple<int, int, int, Indices, Indices, Data> SparseData;
65  typedef boost::tuple<std::string,std::string,std::string,std::string,std::string,std::string> RawSparseData;
66  typedef boost::tuple<int, int, Data> DenseData;
67  typedef boost::tuple<std::string,std::string,std::string> RawDenseData;
68 
69  boost::optional<RawDenseData> parseDenseMatrixString(const std::string& matString);
70  boost::optional<RawDenseData> parseColumnMatrixString(const std::string& matString);
71  DenseData convertRaw(const RawDenseData& data);
72  boost::optional<RawSparseData> parseSparseMatrixString(const std::string& matString);
73  SparseData convertRaw(const RawSparseData& data);
74  private:
75  const Utility::ProgressReporter* reporter_;
76  };
77 
78 }}}}}
79 
80 #endif
boost::shared_ptr< Matrix > MatrixHandle
Definition: MatrixFwd.h:44
boost::tuple< std::string, std::string, std::string > RawDenseData
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:67
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:47
#define SCISHARE
Definition: share.h:39
boost::shared_ptr< SparseRowMatrix > SparseRowMatrixHandle
Definition: MatrixFwd.h:68
std::vector< double > Data
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:63
Core::Datatypes::DenseMatrixHandle makeDense(const Core::Datatypes::SparseRowMatrix &sparse)
Definition: MatrixTestUtilities.h:128
dictionary data
Definition: eabLatVolData.py:11
boost::shared_ptr< DenseColumnMatrix > DenseColumnMatrixHandle
Definition: MatrixFwd.h:60
boost::tuple< int, int, int, Indices, Indices, Data > SparseData
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:64
boost::shared_ptr< DenseMatrix > DenseMatrixHandle
Definition: MatrixFwd.h:52
boost::tuple< std::string, std::string, std::string, std::string, std::string, std::string > RawSparseData
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:65
std::vector< int > Indices
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:62
Definition: ProgressReporter.h:54
boost::tuple< int, int, Data > DenseData
Definition: EigenMatrixFromScirunAsciiFormatConverter.h:66