Commit f3667e17 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

support blitz

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1117
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent fecdc2ee
// this is <README>
// ----------------------------------------------------------------------------
// $Id: README,v 1.8 2002-11-27 15:39:20 forbrig Exp $
// $Id: README,v 1.9 2002-11-27 22:38:38 forbrig Exp $
//
// Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
//
......@@ -18,7 +18,7 @@
\since November 2002
\date November 2002
\version V1.0
$Id: README,v 1.8 2002-11-27 15:39:20 forbrig Exp $
$Id: README,v 1.9 2002-11-27 22:38:38 forbrig Exp $
\section main_aims Aims
......@@ -59,6 +59,10 @@ $Id: README,v 1.8 2002-11-27 15:39:20 forbrig Exp $
\sa error.h
\sa \ref group_error
\subsection main_module_misc Other modules
\sa \ref group_blitzutil
\subsection main_module_nogroup Modules outside groups
Some of the modules are not explicitely grouped.
......
/*! \file blitzutil.h
* \brief some helpers for Blitz++ (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: blitzutil.h,v 1.1 2002-11-27 22:38:38 forbrig Exp $
* \author Thomas Forbriger
* \date 27/11/2002
*
* some helpers for Blitz++ (prototypes)
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* REVISIONS and CHANGES
* - 27/11/2002 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TF_BLITZUTIL_H_VERSION
#define TF_BLITZUTIL_H_VERSION \
"TF_BLITZUTIL_H V1.0 "
#define TF_BLITZUTIL_H_CVSID \
"$Id: blitzutil.h,v 1.1 2002-11-27 22:38:38 forbrig Exp $"
#include<tfxx/error.h>
namespace tfxx {
/*! \defgroup group_blitzutil Blitz++ utilities
*/
/*! \brief Blitz++ utilities
*
* \ingroup group_blitzutil
*/
namespace blitzutil {
/*! \brief test for conforming shapes
*
* \ingroup group_blitzutil
* \param a1 any blitz array
* \param a2 any other blitz array
* \return true if both have same shape
*/
template<class T1, class T2, int N1, int N2>
bool sameShape(const blitz::Array<T1,N1>& a1,
const blitz::Array<T2,N2>& a2)
{ return(blitz::areShapesConformable(a1.shape(),a2.shape())); }
/*! \brief test for conforming domains
*
* \ingroup group_blitzutil
* \param a1 any blitz array
* \param a2 any other blitz array
* \return true if both have same domain
*/
template<class T1, class T2, int N1, int N2>
bool sameDomain(const blitz::Array<T1,N1>& a1,
const blitz::Array<T2,N2>& a2)
{ return(blitz::areShapesConformable(a1.lbound(),a2.lbound())&&
blitz::areShapesConformable(a1.ubound(),a2.ubound())); }
/*! \brief assert conforming shapes
*
* \ingroup group_blitzutil
* \param a1 any blitz array
* \param a2 any other blitz array
*
* Throws a tfxx::error::Exception if assertion fails
*/
template<class T1, class T2, int N1, int N2>
void assertSameShape(const blitz::Array<T1,N1>& a1,
const blitz::Array<T2,N2>& a2)
{ TFXX_assert(sameShape(a1,a2), "shape of blitz arrays differs!"); }
/*! \brief assert conforming domains
*
* \ingroup group_blitzutil
* \param a1 any blitz array
* \param a2 any other blitz array
*
* Throws a tfxx::error::Exception if assertion fails
*/
template<class T1, class T2, int N1, int N2>
void assertSameDomain(const blitz::Array<T1,N1>& a1,
const blitz::Array<T2,N2>& a2)
{ TFXX_assert(sameDomain(a1,a2), "domain of blitz arrays differs!"); }
} // namespace blitzutil
} // namespace tfxx
#endif // TF_BLITZUTIL_H_VERSION (includeguard)
/* ----- END OF blitzutil.h ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment