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

proceeding

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: 1480
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent d8b2f747
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: arrayoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $
* $Id: arrayoperators.h,v 1.3 2004-02-10 11:45:28 tforb Exp $
* \author Thomas Forbriger
* \date 10/02/2004
*
......@@ -23,13 +23,15 @@
#define AFF_ARRAYOPERATORS_H_VERSION \
"AFF_ARRAYOPERATORS_H V1.0 "
#define AFF_ARRAYOPERATORS_H_CVSID \
"$Id: arrayoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $"
"$Id: arrayoperators.h,v 1.3 2004-02-10 11:45:28 tforb Exp $"
#include<aff/array.h>
#define AFF_OPERATORS_CLASS aff::Array
#define AFF_OPERATORS_CONSTCLASS aff::ConstArray
#include <aff/lib/operators.h>
#undef AFF_OPERATORS_CLASS
#undef AFF_OPERATORS_CONSTCLASS
#endif // AFF_ARRAYOPERATORS_H_VERSION (includeguard)
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: operators.h,v 1.2 2004-02-10 09:57:20 tforb Exp $
* $Id: operators.h,v 1.3 2004-02-10 11:45:28 tforb Exp $
* \author Thomas Forbriger
* \date 10/02/2004
*
......@@ -19,34 +19,72 @@
// include guard
#ifndef AFF_OPERATORS_CLASS
#error "never ever inlcude this from your code"
#error "never ever inlcude this from your code!"
#endif
#ifndef AFF_OPERATORS_CONSTCLASS
#error "definition of container of const is missing!"
#endif
#include<aff/iterator.h>
namespace aff {
template<class T>
AFF_OPERATORS_CLASS<T> operator*(const AFF_OPERATORS_CLASS<T>& c,
const typename AFF_OPERATORS_CLASS<T>::Tvalue& v)
{
typename AFF_OPERATORS_CLASS<T> retval(c.copyout());
for (aff::Iterator<AFF_OPERATORS_CLASS<T> > i(retval);
i.valid(); ++i)
{ (*i) *= v; }
return(retval);
#define AFF_OPERATORS_TEMPAR T
#define AFF_OPERATORS_CONT AFF_OPERATORS_CLASS< AFF_OPERATORS_TEMPAR >
#define AFF_OPERATORS_CONSTCONT AFF_OPERATORS_CONSTCLASS< AFF_OPERATORS_TEMPAR >
#define AFF_OPERATORS_UNOP( CONT, OP ) \
template<class AFF_OPERATORS_TEMPAR > \
CONT& operator OP ## =(CONT& container, \
typename CONT::Tconst_reference value) \
{ \
for (aff::Iterator< CONT > i(container); i.valid(); ++i) \
{ (*i) OP ## = value; } \
return(container); \
}
template<class T>
AFF_OPERATORS_CLASS<T> operator*=(AFF_OPERATORS_CLASS<T>& c,
const typename AFF_OPERATORS_CLASS<T>::Tvalue& v)
{
typename AFF_OPERATORS_CLASS<T> retval(c);
for (aff::Iterator<AFF_OPERATORS_CLASS<T> > i(retval);
i.valid(); ++i)
{ (*i) *= v; }
return(retval);
#define AFF_OPERATORS_BINOP( RETCONT, INCONT, OP ) \
template<class AFF_OPERATORS_TEMPAR > \
RETCONT operator OP(const INCONT& container, \
typename INCONT::Tconst_reference value) \
{ \
RETCONT retval; \
retval.copyin(container); \
retval OP ## = value; \
return(retval); \
}
#define AFF_OPERATORS_THEUNOP( OP ) \
AFF_OPERATORS_UNOP( AFF_OPERATORS_CONT , OP )
AFF_OPERATORS_THEUNOP( + )
AFF_OPERATORS_THEUNOP( * )
AFF_OPERATORS_THEUNOP( / )
AFF_OPERATORS_THEUNOP( - )
#undef AFF_OPERATORS_THEUNOP
#define AFF_OPERATORS_THEBINOP( OP ) \
AFF_OPERATORS_BINOP( AFF_OPERATORS_CONT , AFF_OPERATORS_CONSTCONT, OP )
AFF_OPERATORS_THEBINOP( + )
AFF_OPERATORS_THEBINOP( * )
AFF_OPERATORS_THEBINOP( / )
AFF_OPERATORS_THEBINOP( - )
#undef AFF_OPERATORS_THEBINOP
/*
#define AFF_OPERATORS_THEBINOP( OP ) \
AFF_OPERATORS_BINOP( AFF_OPERATORS_CONT , AFF_OPERATORS_CONT, OP )
AFF_OPERATORS_THEBINOP( + )
AFF_OPERATORS_THEBINOP( * )
AFF_OPERATORS_THEBINOP( / )
AFF_OPERATORS_THEBINOP( - )
#undef AFF_OPERATORS_THEBINOP
*/
#undef AFF_OPERATORS_UNOP
#undef AFF_OPERATORS_BINOP
#undef AFF_OPERATORS_CONSTCONT
#undef AFF_OPERATORS_CONT
#undef AFF_OPERATORS_TEMPAR
}
/* ----- END OF operators.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seriesoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $
* $Id: seriesoperators.h,v 1.3 2004-02-10 11:45:28 tforb Exp $
* \author Thomas Forbriger
* \date 10/02/2004
*
......@@ -23,13 +23,15 @@
#define AFF_SERIESOPERATORS_H_VERSION \
"AFF_SERIESOPERATORS_H V1.0 "
#define AFF_SERIESOPERATORS_H_CVSID \
"$Id: seriesoperators.h,v 1.2 2004-02-10 09:57:19 tforb Exp $"
"$Id: seriesoperators.h,v 1.3 2004-02-10 11:45:28 tforb Exp $"
#include<aff/series.h>
#define AFF_OPERATORS_CLASS aff::Series
#define AFF_OPERATORS_CONSTCLASS aff::ConstSeries
#include <aff/lib/operators.h>
#undef AFF_OPERATORS_CLASS
#undef AFF_OPERATORS_CONSTCLASS
#endif // AFF_SERIESOPERATORS_H_VERSION (includeguard)
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: operatortest.cc,v 1.1 2004-02-10 09:57:21 tforb Exp $
* $Id: operatortest.cc,v 1.2 2004-02-10 11:45:29 tforb Exp $
* \author Thomas Forbriger
* \date 10/02/2004
*
......@@ -19,9 +19,10 @@
#define OPERATORTEST_VERSION \
"OPERATORTEST V1.0 test operator functions"
#define OPERATORTEST_CVSID \
"$Id: operatortest.cc,v 1.1 2004-02-10 09:57:21 tforb Exp $"
"$Id: operatortest.cc,v 1.2 2004-02-10 11:45:29 tforb Exp $"
#include <iostream>
#include <complex>
#include <aff/array.h>
#include <aff/dump.h>
#include <aff/arrayoperators.h>
......@@ -57,6 +58,16 @@ int main(int iargc, char* argv[])
CODE(aff::Array<double> B = A * 5.;)
CODE(dump_array(B));
CODE(B*=0.2);
CODE(B*=4L);
CODE(B*=0xa0);
CODE(dump_array(B));
CODE(aff::Array<std::complex<double> > C(3,3);)
CODE(C=std::complex<double>(14.,2.);)
CODE(dump_array(C));
CODE(C*=0.2);
CODE(dump_array(C));
CODE(aff::ConstArray<double> D(B));
CODE(aff::Array<double> E(D*50.));
CODE(dump_array(B));
}
......
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