Main MRPT website > C++ reference for MRPT 1.9.9
CMatrixD.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "math-precomp.h" // Precompiled headers
11 
12 #include <mrpt/math/CMatrixD.h>
15 
16 using namespace mrpt;
17 using namespace mrpt::math;
18 
19 // This must be added to any CSerializable class implementation file.
21 
22 uint8_t CMatrixD::serializeGetVersion() const { return 0; }
24 {
25  // First, write the number of rows and columns:
26  out << (uint32_t)rows() << (uint32_t)cols();
27 
28  if (rows() > 0 && cols() > 0)
29  for (Index i = 0; i < rows(); i++)
30  out.WriteBufferFixEndianness<Scalar>(&coeff(i, 0), cols());
31 }
33 {
34  switch (version)
35  {
36  case 0:
37  {
38  uint32_t nRows, nCols;
39 
40  // First, write the number of rows and columns:
41  in >> nRows >> nCols;
42 
43  setSize(nRows, nCols);
44 
45  if (nRows > 0 && nCols > 0)
46  for (Index i = 0; i < rows(); i++)
47  in.ReadBufferFixEndianness<Scalar>(&coeffRef(i, 0), nCols);
48  }
49  break;
50  default:
52  };
53 }
mrpt::math::CMatrixD::serializeTo
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Definition: CMatrixD.cpp:23
math-precomp.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
uint8_t
unsigned char uint8_t
Definition: rptypes.h:41
Scalar
double Scalar
Definition: KmUtils.h:44
mrpt::serialization::CArchive
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
lightweight_geom_data.h
CMatrixD.h
IMPLEMENTS_SERIALIZABLE
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Definition: CSerializable.h:114
setSize
EIGEN_STRONG_INLINE void setSize(size_t row, size_t col)
Changes the size of matrix, maintaining its previous content as possible and padding with zeros where...
Definition: eigen_plugins.h:343
mrpt::math::CMatrixD::serializeFrom
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Definition: CMatrixD.cpp:32
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:13
in
GLuint in
Definition: glext.h:7274
mrpt::math::CMatrixD
This class is a "CSerializable" wrapper for "CMatrixTemplateNumeric<double>".
Definition: CMatrixD.h:24
CArchive.h
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:90
mrpt::serialization::CArchive::WriteBufferFixEndianness
void WriteBufferFixEndianness(const T *ptr, size_t ElementCount)
Writes a sequence of elemental datatypes, taking care of reordering their bytes from the running arch...
Definition: CArchive.h:123
uint32_t
unsigned __int32 uint32_t
Definition: rptypes.h:47



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST