mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-29 00:02:40 +08:00
remove custom assert system and use plain standard asserts instead.
we don't need no complication.
This commit is contained in:
parent
8c001c1342
commit
887ff84376
@ -24,12 +24,12 @@
|
|||||||
#ifndef TVMET_MATRIX_H
|
#ifndef TVMET_MATRIX_H
|
||||||
#define TVMET_MATRIX_H
|
#define TVMET_MATRIX_H
|
||||||
|
|
||||||
#include <iterator> // reverse_iterator
|
#include <iterator> // reverse_iterator
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include <tvmet/tvmet.h>
|
#include <tvmet/tvmet.h>
|
||||||
#include <tvmet/TypePromotion.h>
|
#include <tvmet/TypePromotion.h>
|
||||||
#include <tvmet/CommaInitializer.h>
|
#include <tvmet/CommaInitializer.h>
|
||||||
#include <tvmet/RunTimeError.h>
|
|
||||||
|
|
||||||
#include <tvmet/xpr/Matrix.h>
|
#include <tvmet/xpr/Matrix.h>
|
||||||
#include <tvmet/xpr/MatrixRow.h>
|
#include <tvmet/xpr/MatrixRow.h>
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
public: // access operators
|
public: // access operators
|
||||||
/** access by index. */
|
/** access by index. */
|
||||||
value_type operator()(std::size_t i, std::size_t j) const {
|
value_type operator()(std::size_t i, std::size_t j) const {
|
||||||
TVMET_RT_CONDITION((i < Rows) && (j < Cols), "MatrixConstReference Bounce Violation")
|
assert((i < Rows) && (j < Cols));
|
||||||
return m_data[i * Cols + j];
|
return m_data[i * Cols + j];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +226,7 @@ public:
|
|||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Matrix(InputIterator first, InputIterator last)
|
explicit Matrix(InputIterator first, InputIterator last)
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION(static_cast<std::size_t>(std::distance(first, last)) <= Size,
|
assert(static_cast<std::size_t>(std::distance(first, last)) <= Size);
|
||||||
"InputIterator doesn't fits in size" )
|
|
||||||
std::copy(first, last, m_data);
|
std::copy(first, last, m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +237,7 @@ public:
|
|||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Matrix(InputIterator first, std::size_t sz)
|
explicit Matrix(InputIterator first, std::size_t sz)
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION(sz <= Size, "InputIterator doesn't fits in size" )
|
assert(sz <= Size);
|
||||||
std::copy(first, first + sz, m_data);
|
std::copy(first, first + sz, m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,12 +268,12 @@ public: // access operators
|
|||||||
public: // index access operators
|
public: // index access operators
|
||||||
value_type& _tvmet_restrict operator()(std::size_t i, std::size_t j) {
|
value_type& _tvmet_restrict operator()(std::size_t i, std::size_t j) {
|
||||||
// Note: g++-2.95.3 does have problems on typedef reference
|
// Note: g++-2.95.3 does have problems on typedef reference
|
||||||
TVMET_RT_CONDITION((i < Rows) && (j < Cols), "Matrix Bounce Violation")
|
assert((i < Rows) && (j < Cols));
|
||||||
return m_data[i * Cols + j];
|
return m_data[i * Cols + j];
|
||||||
}
|
}
|
||||||
|
|
||||||
value_type operator()(std::size_t i, std::size_t j) const {
|
value_type operator()(std::size_t i, std::size_t j) const {
|
||||||
TVMET_RT_CONDITION((i < Rows) && (j < Cols), "Matrix Bounce Violation")
|
assert((i < Rows) && (j < Cols));
|
||||||
return m_data[i * Cols + j];
|
return m_data[i * Cols + j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
* Tiny Vector Matrix Library
|
|
||||||
* Dense Vector Matrix Libary of Tiny size using Expression Templates
|
|
||||||
*
|
|
||||||
* Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* $Id: RunTimeError.h,v 1.9 2003/11/30 08:26:25 opetzold Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TVMET_RUN_TIME_ERROR_H
|
|
||||||
#define TVMET_RUN_TIME_ERROR_H
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
|
|
||||||
namespace tvmet {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \def TVMET_RT_CONDITION(XPR, MSG)
|
|
||||||
* \brief If TVMET_DEBUG is defined it checks the condition XPR and prints
|
|
||||||
* an error message MSG at runtime.
|
|
||||||
*/
|
|
||||||
#if defined(TVMET_DEBUG)
|
|
||||||
|
|
||||||
#define TVMET_RT_CONDITION(XPR, MSG) { \
|
|
||||||
if(!(XPR)) { \
|
|
||||||
std::cerr << "[tvmet] Precondition failure in " << __FILE__ \
|
|
||||||
<< ", line " << __LINE__ << ": " \
|
|
||||||
<< MSG << std::endl; \
|
|
||||||
std::cerr.flush(); \
|
|
||||||
assert(0); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define TVMET_RT_CONDITION(XPR, MSG)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace tvmet
|
|
||||||
|
|
||||||
|
|
||||||
#endif // TVMET_RUN_TIME_ERROR_H
|
|
||||||
|
|
||||||
|
|
||||||
// Local Variables:
|
|
||||||
// mode:C++
|
|
||||||
// End:
|
|
@ -24,12 +24,12 @@
|
|||||||
#ifndef TVMET_VECTOR_H
|
#ifndef TVMET_VECTOR_H
|
||||||
#define TVMET_VECTOR_H
|
#define TVMET_VECTOR_H
|
||||||
|
|
||||||
#include <iterator> // reverse_iterator
|
#include <iterator> // reverse_iterator
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
#include <tvmet/tvmet.h>
|
#include <tvmet/tvmet.h>
|
||||||
#include <tvmet/TypePromotion.h>
|
#include <tvmet/TypePromotion.h>
|
||||||
#include <tvmet/CommaInitializer.h>
|
#include <tvmet/CommaInitializer.h>
|
||||||
#include <tvmet/RunTimeError.h>
|
|
||||||
|
|
||||||
#include <tvmet/xpr/Vector.h>
|
#include <tvmet/xpr/Vector.h>
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
public: // access operators
|
public: // access operators
|
||||||
/** access by index. */
|
/** access by index. */
|
||||||
value_type operator()(std::size_t i) const {
|
value_type operator()(std::size_t i) const {
|
||||||
TVMET_RT_CONDITION(i < Size, "VectorConstReference Bounce Violation")
|
assert(i < Size);
|
||||||
return m_data[i];
|
return m_data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,8 +214,7 @@ public:
|
|||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Vector(InputIterator first, InputIterator last)
|
explicit Vector(InputIterator first, InputIterator last)
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION( static_cast<std::size_t>(std::distance(first, last)) <= Size,
|
assert( static_cast<std::size_t>(std::distance(first, last)) <= Size);
|
||||||
"InputIterator doesn't fits in size" )
|
|
||||||
std::copy(first, last, m_data);
|
std::copy(first, last, m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +225,7 @@ public:
|
|||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Vector(InputIterator first, std::size_t sz)
|
explicit Vector(InputIterator first, std::size_t sz)
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION( sz <= Size, "InputIterator doesn't fits in size" )
|
assert(sz <= Size);
|
||||||
std::copy(first, first + sz, m_data);
|
std::copy(first, first + sz, m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,12 +332,12 @@ public: // access operators
|
|||||||
public: // index access operators
|
public: // index access operators
|
||||||
value_type& _tvmet_restrict operator()(std::size_t i) {
|
value_type& _tvmet_restrict operator()(std::size_t i) {
|
||||||
// Note: g++-2.95.3 does have problems on typedef reference
|
// Note: g++-2.95.3 does have problems on typedef reference
|
||||||
TVMET_RT_CONDITION(i < Size, "Vector Bounce Violation")
|
assert(i < Size);
|
||||||
return m_data[i];
|
return m_data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
value_type operator()(std::size_t i) const {
|
value_type operator()(std::size_t i) const {
|
||||||
TVMET_RT_CONDITION(i < Size, "Vector Bounce Violation")
|
assert(i < Size);
|
||||||
return m_data[i];
|
return m_data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user