kstatics.cpp
Go to the documentation of this file.
1 // This file is part of kfilter.
2 // kfilter is a C++ variable-dimension extended kalman filter library.
3 //
4 // Copyright (C) 2004 Vincent Zalzal, Sylvain Marleau
5 // Copyright (C) 2001, 2004 Richard Gourdeau
6 // Copyright (C) 2004 GRPR and DGE's Automation sector
7 // �cole Polytechnique de Montr�al
8 //
9 // Code adapted from algorithms presented in :
10 // Bierman, G. J. "Factorization Methods for Discrete Sequential
11 // Estimation", Academic Press, 1977.
12 //
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2.1 of the License, or (at your option) any later version.
17 //
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 
29 
30 #include <vector>
31 
32 #include <kfilter/kvector.hpp>
33 #include <kfilter/kmatrix.hpp>
34 
35 using namespace std;
36 using namespace Kalman;
37 
38 namespace {
39 
41  typedef vector<KVectorContextImpl> VectorContextList;
42 
44  VectorContextList vectorContexts(1, KVectorContextImpl());
45 
47  KVectorContext currentVectorIndex = 0;
48 
50  typedef vector<KMatrixContextImpl> MatrixContextList;
51 
53  MatrixContextList matrixContexts(1, KMatrixContextImpl());
54 
56  KMatrixContext currentMatrixIndex = 0;
57 
58 }
59 
62 
65 
86  std::string startDelim,
87  std::string endDelim,
88  unsigned prec) {
89  if (prec < 1) prec = 1;
90  if (prec > 9) prec = 9;
91 
92  vectorContexts.push_back(KVectorContextImpl(elemDelim,
93  startDelim,
94  endDelim,
95  prec));
96  return vectorContexts.size() - 1;
97 }
98 
104 
105  if (c >= vectorContexts.size()) {
106  return currentVectorIndex;
107  }
108 
109  KVectorContext tmp = currentVectorIndex;
110  currentVectorIndex = c;
111  currentVectorContext = &vectorContexts[c];
112  return tmp;
113 }
114 
117 
120 
145  std::string rowDelim,
146  std::string startDelim,
147  std::string endDelim,
148  unsigned prec) {
149  if (prec < 1) prec = 1;
150  if (prec > 9) prec = 9;
151 
152  matrixContexts.push_back(KMatrixContextImpl(elemDelim,
153  rowDelim,
154  startDelim,
155  endDelim,
156  prec));
157  return matrixContexts.size() - 1;
158 }
159 
165 
166  if (c >= matrixContexts.size()) {
167  return currentMatrixIndex;
168  }
169 
170  KMatrixContext tmp = currentMatrixIndex;
171  currentMatrixIndex = c;
172  currentMatrixContext = &matrixContexts[c];
173  return tmp;
174 }
KVectorContext createKVectorContext(std::string elemDelim=" ", std::string startDelim="", std::string endDelim="", unsigned prec=4)
Creates a vector printing context.
Definition: kstatics.cpp:85
Contains necessary informations to print a formatted KMatrix.
unsigned short KVectorContext
Handle type to a vector printing context.
Definition: kvector.hpp:166
KVectorContextImpl * currentVectorContext
Refers to the currently selected vector printing context.
Definition: kstatics.cpp:61
unsigned short KMatrixContext
Handle type to a matrix printing context.
Definition: kmatrix.hpp:179
Contains the interface of the KMatrix template class.
KMatrixContext createKMatrixContext(std::string elemDelim=" ", std::string rowDelim="\n", std::string startDelim="", std::string endDelim="", unsigned prec=4)
Creates a matrix printing context.
Definition: kstatics.cpp:144
KMatrixContext DEFAULT_MATRIX_CONTEXT
Default matrix printing context object.
Definition: kstatics.cpp:119
Contains necessary informations to print a formatted KVector.
KVectorContext selectKVectorContext(KVectorContext c)
Selects a vector printing context as the current context.
Definition: kstatics.cpp:103
KVectorContext DEFAULT_VECTOR_CONTEXT
Default vector printing context object.
Definition: kstatics.cpp:64
KMatrixContext selectKMatrixContext(KMatrixContext c)
Selects a matrix printing context as the current context.
Definition: kstatics.cpp:164
KMatrixContextImpl * currentMatrixContext
Refers to the currently selected matrix printing context.
Definition: kstatics.cpp:116
Contains the interface of the KVector template class.


kfilter
Author(s): Jorge Almeida, Vincent Zalzal, Sylvain Marleau, Richard Gourdeau
autogenerated on Mon Mar 2 2015 01:31:45