applics.h   applics.h 
/************************************************************************** * /************************************************************************** *
* blitz/applics.h Applicative template classes * blitz/applics.h Applicative template classes
* *
* $Id: applics.h,v 1.2 2001/01/24 20:22:49 tveldhui Exp $ * $Id: applics.h,v 1.5 2003/12/11 03:44:22 julianc Exp $
* *
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Log: applics.h,v $
* Revision 1.2 2001/01/24 20:22:49 tveldhui
* Updated copyright date in headers.
*
* Revision 1.1.1.1 2000/06/19 12:26:08 tveldhui
* Imported sources
*
* Revision 1.5 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.4 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
* Revision 1.3 1997/01/24 14:42:00 tveldhui
* Periodic RCS update
*
* Revision 1.2 1997/01/13 22:19:58 tveldhui
* Periodic RCS update
*
*
*/
#ifndef BZ_APPLICS_H #ifndef BZ_APPLICS_H
#define BZ_APPLICS_H #define BZ_APPLICS_H
#ifndef BZ_BLITZ_H #ifndef BZ_BLITZ_H
#include <blitz/blitz.h> #include <blitz/blitz.h>
#endif #endif
#ifndef BZ_PROMOTE_H #ifndef BZ_PROMOTE_H
#include <blitz/promote.h> #include <blitz/promote.h>
skipping to change at line 71 skipping to change at line 50
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
// These base classes are included for no other reason than to keep // These base classes are included for no other reason than to keep
// the applicative templates clustered together in a graphical // the applicative templates clustered together in a graphical
// class browser. // class browser.
class ApplicativeTemplatesBase { }; class ApplicativeTemplatesBase { };
class TwoOperandApplicativeTemplatesBase : public ApplicativeTemplatesBase { }; class TwoOperandApplicativeTemplatesBase : public ApplicativeTemplatesBase { };
class OneOperandApplicativeTemplatesBase : public ApplicativeTemplatesBase { }; class OneOperandApplicativeTemplatesBase : public ApplicativeTemplatesBase { };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Add : public TwoOperandApplicativeTemplatesBase { class _bz_Add : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x + y; } { return x + y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Subtract : public TwoOperandApplicativeTemplatesBase { class _bz_Subtract : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x - y; } { return x - y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Multiply : public TwoOperandApplicativeTemplatesBase { class _bz_Multiply : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x * y; } { return x * y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Divide : public TwoOperandApplicativeTemplatesBase { class _bz_Divide : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x / y; } { return x / y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Mod : public TwoOperandApplicativeTemplatesBase { class _bz_Mod : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x % y; } { return x % y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_BitwiseXOR : public TwoOperandApplicativeTemplatesBase { class _bz_BitwiseXOR : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x ^ y; } { return x ^ y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_BitwiseAnd : public TwoOperandApplicativeTemplatesBase { class _bz_BitwiseAnd : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x & y; } { return x & y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_BitwiseOr : public TwoOperandApplicativeTemplatesBase { class _bz_BitwiseOr : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x | y; } { return x | y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_ShiftRight : public TwoOperandApplicativeTemplatesBase { class _bz_ShiftRight : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x >> y; } { return x >> y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_ShiftLeft : public TwoOperandApplicativeTemplatesBase { class _bz_ShiftLeft : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote; typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x << y; } { return x << y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Min : public TwoOperandApplicativeTemplatesBase {
public:
typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return (x < y ? x : y); }
};
template<typename P_numtype1, typename P_numtype2>
class _bz_Max : public TwoOperandApplicativeTemplatesBase {
public:
typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2;
typedef BZ_PROMOTE(T_numtype1,T_numtype2) T_promote;
typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return (x > y ? x : y); }
};
template<typename P_numtype1, typename P_numtype2>
class _bz_Greater : public TwoOperandApplicativeTemplatesBase { class _bz_Greater : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x > y; } { return x > y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Less : public TwoOperandApplicativeTemplatesBase { class _bz_Less : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x < y; } { return x < y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_GreaterOrEqual : public TwoOperandApplicativeTemplatesBase { class _bz_GreaterOrEqual : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x >= y; } { return x >= y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_LessOrEqual : public TwoOperandApplicativeTemplatesBase { class _bz_LessOrEqual : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x <= y; } { return x <= y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_Equal : public TwoOperandApplicativeTemplatesBase { class _bz_Equal : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x == y; } { return x == y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_NotEqual : public TwoOperandApplicativeTemplatesBase { class _bz_NotEqual : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x != y; } { return x != y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_LogicalAnd : public TwoOperandApplicativeTemplatesBase { class _bz_LogicalAnd : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x && y; } { return x && y; }
}; };
template<class P_numtype1, class P_numtype2> template<typename P_numtype1, typename P_numtype2>
class _bz_LogicalOr : public TwoOperandApplicativeTemplatesBase { class _bz_LogicalOr : public TwoOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype1 T_numtype1; typedef P_numtype1 T_numtype1;
typedef P_numtype2 T_numtype2; typedef P_numtype2 T_numtype2;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline T_promote apply(P_numtype1 x, P_numtype2 y) static inline T_promote apply(P_numtype1 x, P_numtype2 y)
{ return x || y; } { return x || y; }
}; };
template<class P_numtype_in, class P_numtype_out> template<typename P_numtype_in, typename P_numtype_out>
class _bz_Cast : public OneOperandApplicativeTemplatesBase { class _bz_Cast : public OneOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype_in T_numtype1; typedef P_numtype_in T_numtype1;
typedef P_numtype_out T_promote; typedef P_numtype_out T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline P_numtype_out apply(P_numtype_in x) static inline P_numtype_out apply(P_numtype_in x)
{ return P_numtype_out(x); } { return P_numtype_out(x); }
}; };
template<class P_numtype> template<typename P_numtype>
class _bz_LogicalNot : public OneOperandApplicativeTemplatesBase { class _bz_LogicalNot : public OneOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype T_numtype1; typedef P_numtype T_numtype1;
typedef _bz_bool T_promote; typedef bool T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline P_numtype apply(P_numtype x) static inline P_numtype apply(P_numtype x)
{ return !x; } { return !x; }
}; };
template<class P_numtype> template<typename P_numtype>
class _bz_BitwiseNot : public OneOperandApplicativeTemplatesBase { class _bz_BitwiseNot : public OneOperandApplicativeTemplatesBase {
public: public:
typedef P_numtype T_numtype1; typedef P_numtype T_numtype1;
typedef T_numtype1 T_promote; typedef T_numtype1 T_promote;
typedef T_promote T_numtype; typedef T_promote T_numtype;
static inline P_numtype apply(P_numtype x) static inline P_numtype apply(P_numtype x)
{ return ~x; } { return ~x; }
}; };
 End of changes. 32 change blocks. 
56 lines changed or deleted 59 lines changed or added


 array-impl.h   array-impl.h 
// -*- C++ -*-
/************************************************************************** * /************************************************************************** *
* blitz/array-impl.h Definition of the Array<P_numtype, N_rank> class * blitz/array-impl.h Definition of the Array<P_numtype, N_rank> class
* *
* $Id: array-impl.h,v 1.10 2002/08/30 22:12:49 jcumming Exp $ * $Id: array-impl.h,v 1.25 2005/10/13 23:46:43 julianc Exp $
* *
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Log: array-impl.h,v $
* Revision 1.10 2002/08/30 22:12:49 jcumming
* Added declaration of setStorage() method, which lets user set Array stor
age
* format after construction.
*
* Revision 1.9 2002/06/28 01:33:03 jcumming
* Modified the isInRange() methods to check that each index value is
* greater than or equal to the base index value, rather than just
* casting (index-base) to an unsigned int. The latter gives unpredictable
* results if index<base and produces compiler warnings about comparisons
* between unsigned and signed quantities.
*
* Revision 1.8 2002/06/27 00:28:50 jcumming
* Changed template parameter name T_numtype2 to P_numtype2 in member funct
ion
* template declarataions for consistency with definitions and to avoid any
* confusion with typedef T_numtype.
*
* Revision 1.7 2002/06/26 23:55:45 jcumming
* Explicitly specify second template argument for ListInitializationSwitch
,
* rather than relying on the default value. This eliminates a compilation
* problem using the xlC compiler. Also removed #include of misc.cc, which
* is now handled in blitz/array/et.h.
*
* Revision 1.6 2002/05/27 19:29:29 jcumming
* Removed use of this-> as means of accessing members of templated base cl
ass.
* Instead provided using declarations for these members within the derived
* class definitions to bring them into the scope of the derived class.
*
* Revision 1.5 2002/03/06 15:47:49 patricg
*
* data_ replaced by this->data_ everywhere
* changeToNullBlock() replaced by this->changeToNullBlock()
* class _bz_endTag replaced by struct _bz_endTag {}
*
* Revision 1.4 2001/02/15 13:14:39 tveldhui
* Fixed typo
*
* Revision 1.3 2001/02/11 22:10:55 tveldhui
* Fixed prototype typos
*
* Revision 1.2 2001/02/11 15:43:39 tveldhui
* Additions from Julian Cummings:
* - StridedDomain class
* - more versions of resizeAndPreserve
*
* Revision 1.1 2001/01/26 18:30:50 tveldhui
* More source code reorganization to reduce compile times.
*
* Revision 1.3 2001/01/24 22:51:50 tveldhui
* Reorganized #include orders to avoid including the huge Vector e.t.
* implementation when using Array.
*
* Revision 1.2 2001/01/24 20:22:49 tveldhui
* Updated copyright date in headers.
*
* Revision 1.1.1.1 2000/06/19 12:26:12 tveldhui
* Imported sources
*
* Revision 1.2 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.1 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
*/
/* /*
* Wish list for array classes. * Wish list for array classes.
* - Arrays whose dimensions are unknown at compile time. * - Arrays whose dimensions are unknown at compile time.
* - where()/elsewhere()/elsewhere() as in Dan Quinlan's implementation * - where()/elsewhere()/elsewhere() as in Dan Quinlan's implementation
* - block reduction operations * - block reduction operations
* - conversion to/from matrix & vector * - conversion to/from matrix & vector
* - apply(T func(T)) * - apply(T func(T))
* - apply(T func(const T&)) * - apply(T func(const T&))
* - apply<T func(T)> * - apply<T func(T)>
*/ */
#ifndef BZ_ARRAY_H #ifndef BZ_ARRAY_H
#define BZ_ARRAY_H #define BZ_ARRAY_H
#ifndef BZ_BLITZ_H #include <blitz/blitz.h>
#include <blitz/blitz.h> #include <blitz/memblock.h>
#endif #include <blitz/range.h>
#include <blitz/tinyvec.h>
#ifndef BZ_MEMBLOCK_H
#include <blitz/memblock.h>
#endif
#ifndef BZ_RANGE_H
#include <blitz/range.h>
#endif
#ifndef BZ_TINYVEC_H
#include <blitz/tinyvec.h>
#endif
#ifdef BZ_ARRAY_SPACE_FILLING_TRAVERSAL #ifdef BZ_ARRAY_SPACE_FILLING_TRAVERSAL
#ifndef BZ_TRAVERSAL_H #include <blitz/traversal.h>
#include <blitz/traversal.h>
#endif
#endif
#ifndef BZ_INDEXEXPR_H
#include <blitz/indexexpr.h>
#endif #endif
#ifndef BZ_PRETTYPRINT_H #include <blitz/indexexpr.h>
#include <blitz/prettyprint.h> #include <blitz/prettyprint.h>
#endif
#include <blitz/array/slice.h> // Subarrays and slicing #include <blitz/array/slice.h> // Subarrays and slicing
#include <blitz/array/map.h> // Tensor index notation #include <blitz/array/map.h> // Tensor index notation
#include <blitz/array/multi.h> // Multicomponent arrays #include <blitz/array/multi.h> // Multicomponent arrays
#include <blitz/array/domain.h> // RectDomain class #include <blitz/array/domain.h> // RectDomain class
#include <blitz/array/storage.h> // GeneralArrayStorage #include <blitz/array/storage.h> // GeneralArrayStorage
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
/* /*
* Forward declarations * Forward declarations
*/ */
template<class T_numtype, int N_rank> template<typename T_numtype, int N_rank>
class ArrayIterator; class ArrayIterator;
template<class T_numtype, int N_rank> template<typename T_numtype, int N_rank>
class ConstArrayIterator; class ConstArrayIterator;
template<class T_numtype, int N_rank> template<typename T_numtype, int N_rank>
class FastArrayIterator; class FastArrayIterator;
template<class P_expr> template<typename P_expr>
class _bz_ArrayExpr; class _bz_ArrayExpr;
template<class T_array, class T_index> template<typename T_array, typename T_index>
class IndirectArray; class IndirectArray;
struct _bz_endTag {}; template <typename P_numtype,int N_rank>
void swap(Array<P_numtype,N_rank>&,Array<P_numtype,N_rank>&);
template <typename P_numtype, int N_rank>
void find(Array<TinyVector<int,N_rank>,1>&,const Array<P_numtype,N_rank>&);
/* /*
* Declaration of class Array * Declaration of class Array
*/ */
// NEEDS_WORK: Array should inherit protected from MemoryBlockReference. // NEEDS_WORK: Array should inherit protected from MemoryBlockReference.
// To make this work, need to expose MemoryBlockReference::numReferences() // To make this work, need to expose MemoryBlockReference::numReferences()
// and make Array<P,N2> a friend of Array<P,N> for slicing. // and make Array<P,N2> a friend of Array<P,N> for slicing.
template<class P_numtype, int N_rank> template<typename P_numtype, int N_rank>
class Array : public MemoryBlockReference<P_numtype> class Array : public MemoryBlockReference<P_numtype>
#ifdef BZ_NEW_EXPRESSION_TEMPLATES #ifdef BZ_NEW_EXPRESSION_TEMPLATES
, public ETBase<Array<P_numtype,N_rank> > , public ETBase<Array<P_numtype,N_rank> >
#endif #endif
{ {
private: private:
typedef MemoryBlockReference<P_numtype> T_base; typedef MemoryBlockReference<P_numtype> T_base;
using T_base::data_; using T_base::data_;
using T_base::changeToNullBlock; using T_base::changeToNullBlock;
skipping to change at line 209 skipping to change at line 131
*/ */
typedef P_numtype T_numtype; typedef P_numtype T_numtype;
typedef TinyVector<int, N_rank> T_index; typedef TinyVector<int, N_rank> T_index;
typedef Array<T_numtype, N_rank> T_array; typedef Array<T_numtype, N_rank> T_array;
typedef FastArrayIterator<T_numtype, N_rank> T_iterator; typedef FastArrayIterator<T_numtype, N_rank> T_iterator;
typedef ArrayIterator<T_numtype,N_rank> iterator; typedef ArrayIterator<T_numtype,N_rank> iterator;
typedef ConstArrayIterator<T_numtype,N_rank> const_iterator; typedef ConstArrayIterator<T_numtype,N_rank> const_iterator;
enum { _bz_rank = N_rank }; static const int _bz_rank = N_rank;
////////////////////////////////////////////// //////////////////////////////////////////////
// Constructors // // Constructors //
////////////////////////////////////////////// //////////////////////////////////////////////
/* /*
* Construct an array from an array expression. * Construct an array from an array expression.
*/ */
template<class T_expr> template<typename T_expr>
_bz_explicit Array(_bz_ArrayExpr<T_expr> expr); explicit Array(_bz_ArrayExpr<T_expr> expr);
/* /*
* Any missing length arguments will have their value taken from the * Any missing length arguments will have their value taken from the
* last argument. For example, * last argument. For example,
* Array<int,3> A(32,64); * Array<int,3> A(32,64);
* will create a 32x64x64 array. This is handled by setupStorage(). * will create a 32x64x64 array. This is handled by setupStorage().
*/ */
Array(GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank> ()) Array(GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank> ())
: storage_(storage) : storage_(storage)
{ {
length_ = 0; length_ = 0;
stride_ = 0; stride_ = 0;
zeroOffset_ = 0; zeroOffset_ = 0;
} }
_bz_explicit Array(int length0, explicit Array(int length0,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() ) GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() )
: storage_(storage) : storage_(storage)
{ {
length_[0] = length0; length_[0] = length0;
setupStorage(0); setupStorage(0);
} }
Array(int length0, int length1, Array(int length0, int length1,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() ) GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() )
: storage_(storage) : storage_(storage)
skipping to change at line 405 skipping to change at line 327
length_[8] = length8; length_[8] = length8;
length_[9] = length9; length_[9] = length9;
length_[10] = length10; length_[10] = length10;
setupStorage(10); setupStorage(10);
} }
/* /*
* Construct an array from an existing block of memory. Ownership * Construct an array from an existing block of memory. Ownership
* is not acquired (this is provided for backwards compatibility). * is not acquired (this is provided for backwards compatibility).
*/ */
Array(T_numtype* _bz_restrict dataFirst, TinyVector<int, N_rank> shape, Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() ) GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() )
: MemoryBlockReference<T_numtype>(product(shape), dataFirst, : MemoryBlockReference<T_numtype>(product(shape), dataFirst,
neverDeleteData), neverDeleteData),
storage_(storage) storage_(storage)
{ {
BZPRECONDITION(dataFirst != 0); BZPRECONDITION(dataFirst != 0);
length_ = shape; length_ = shape;
computeStrides(); computeStrides();
data_ += zeroOffset_; data_ += zeroOffset_;
} }
/* /*
* Construct an array from an existing block of memory, with a * Construct an array from an existing block of memory, with a
* given set of strides. Ownership is not acquired (i.e. the memory * given set of strides. Ownership is not acquired (i.e. the memory
* block will not be freed by Blitz++). * block will not be freed by Blitz++).
*/ */
Array(T_numtype* _bz_restrict dataFirst, TinyVector<int, N_rank> shape, Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
TinyVector<int, N_rank> stride, TinyVector<int, N_rank> stride,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() ) GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() )
: MemoryBlockReference<T_numtype>(product(shape), dataFirst, : MemoryBlockReference<T_numtype>(product(shape), dataFirst,
neverDeleteData), neverDeleteData),
storage_(storage) storage_(storage)
{ {
BZPRECONDITION(dataFirst != 0); BZPRECONDITION(dataFirst != 0);
length_ = shape; length_ = shape;
stride_ = stride; stride_ = stride;
calculateZeroOffset(); calculateZeroOffset();
data_ += zeroOffset_; data_ += zeroOffset_;
} }
/* /*
* Construct an array from an existing block of memory. * Construct an array from an existing block of memory.
*/ */
Array(T_numtype* _bz_restrict dataFirst, TinyVector<int, N_rank> shape, Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
preexistingMemoryPolicy deletionPolicy, preexistingMemoryPolicy deletionPolicy,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() ) GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() )
: MemoryBlockReference<T_numtype>(product(shape), dataFirst, : MemoryBlockReference<T_numtype>(product(shape), dataFirst,
deletionPolicy), deletionPolicy),
storage_(storage) storage_(storage)
{ {
BZPRECONDITION(dataFirst != 0); BZPRECONDITION(dataFirst != 0);
length_ = shape; length_ = shape;
computeStrides(); computeStrides();
data_ += zeroOffset_; data_ += zeroOffset_;
if (deletionPolicy == duplicateData) if (deletionPolicy == duplicateData)
reference(copy()); reference(copy());
} }
/* /*
* Construct an array from an existing block of memory, with a * Construct an array from an existing block of memory, with a
* given set of strides. * given set of strides.
*/ */
Array(T_numtype* _bz_restrict dataFirst, TinyVector<int, N_rank> shape, Array(T_numtype* restrict dataFirst, TinyVector<int, N_rank> shape,
TinyVector<int, N_rank> stride, TinyVector<int, N_rank> stride,
preexistingMemoryPolicy deletionPolicy, preexistingMemoryPolicy deletionPolicy,
GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() ) GeneralArrayStorage<N_rank> storage = GeneralArrayStorage<N_rank>() )
: MemoryBlockReference<T_numtype>(product(shape), dataFirst, : MemoryBlockReference<T_numtype>(product(shape), dataFirst,
deletionPolicy), deletionPolicy),
storage_(storage) storage_(storage)
{ {
BZPRECONDITION(dataFirst != 0); BZPRECONDITION(dataFirst != 0);
length_ = shape; length_ = shape;
skipping to change at line 788 skipping to change at line 710
length_[10] = r10.length(); length_[10] = r10.length();
storage_.setBase(10, r10.first()); storage_.setBase(10, r10.first());
setupStorage(10); setupStorage(10);
} }
/* /*
* Create a reference of another array * Create a reference of another array
*/ */
Array(const Array<T_numtype, N_rank>& array) Array(const Array<T_numtype, N_rank>& array)
#ifdef BZ_NEW_EXPRESSION_TEMPLATES
: MemoryBlockReference<T_numtype>(),
ETBase< Array<T_numtype, N_rank> >(array)
#else
: MemoryBlockReference<T_numtype>()
#endif
{ {
// NEEDS_WORK: this const_cast is a tad ugly. // NEEDS_WORK: this const_cast is a tad ugly.
reference(const_cast<T_array&>(array)); reference(const_cast<T_array&>(array));
} }
/* /*
* These constructors are used for creating interlaced arrays (see * These constructors are used for creating interlaced arrays (see
* <blitz/arrayshape.h> * <blitz/arrayshape.h>
*/ */
Array(const TinyVector<int,N_rank-1>& shape, Array(const TinyVector<int,N_rank-1>& shape,
skipping to change at line 893 skipping to change at line 821
const StridedDomain<N_rank>& subdomain) const StridedDomain<N_rank>& subdomain)
{ {
constructSubarray(array, subdomain); constructSubarray(array, subdomain);
} }
/* /*
* This constructor is invoked by the operator()'s which take * This constructor is invoked by the operator()'s which take
* a combination of integer and Range arguments. It's not intended * a combination of integer and Range arguments. It's not intended
* for end-user use. * for end-user use.
*/ */
template<int N_rank2, class R0, class R1, class R2, class R3, class R4, template<int N_rank2, typename R0, typename R1, typename R2, typename R
class R5, class R6, class R7, class R8, class R9, class R10> 3, typename R4,
typename R5, typename R6, typename R7, typename R8, typename R9, ty
pename R10>
Array(Array<T_numtype,N_rank2>& array, R0 r0, R1 r1, R2 r2, Array(Array<T_numtype,N_rank2>& array, R0 r0, R1 r1, R2 r2,
R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10) R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10)
{ {
constructSlice(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10); constructSlice(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10);
} }
////////////////////////////////////////////// //////////////////////////////////////////////
// Member functions // Member functions
////////////////////////////////////////////// //////////////////////////////////////////////
skipping to change at line 921 skipping to change at line 849
iterator begin() iterator begin()
{ return iterator(*this); } { return iterator(*this); }
const_iterator begin() const const_iterator begin() const
{ return const_iterator(*this); } { return const_iterator(*this); }
T_iterator beginFast() const T_iterator beginFast() const
{ return T_iterator(*this); } { return T_iterator(*this); }
// Deprecated: now extractComponent(...) // Deprecated: now extractComponent(...)
template<class P_numtype2> template<typename P_numtype2>
Array<P_numtype2,N_rank> chopComponent(P_numtype2 a, int compN um, Array<P_numtype2,N_rank> chopComponent(P_numtype2 a, int compN um,
int numComponents) const int numComponents) const
{ return extractComponent(a, compNum, numComponents); } { return extractComponent(a, compNum, numComponents); }
int cols() const int cols() const
{ return length_[1]; } { return length_[1]; }
int columns() const int columns() const
{ return length_[1]; } { return length_[1]; }
skipping to change at line 945 skipping to change at line 873
// not be in the array if the base is not zero in each rank. // not be in the array if the base is not zero in each rank.
// These data() routines return a pointer to the first // These data() routines return a pointer to the first
// element in the array (but note that it may not be // element in the array (but note that it may not be
// stored first in memory if some ranks are stored descending). // stored first in memory if some ranks are stored descending).
int dataOffset() const int dataOffset() const
{ {
return dot(storage_.base(), stride_); return dot(storage_.base(), stride_);
} }
const T_numtype* _bz_restrict data() const const T_numtype* restrict data() const
{ return data_ + dataOffset(); } { return data_ + dataOffset(); }
T_numtype* _bz_restrict data() T_numtype* restrict data()
{ return data_ + dataOffset(); } { return data_ + dataOffset(); }
// These dataZero() routines refer to the point (0,0,...,0) // These dataZero() routines refer to the point (0,0,...,0)
// which may not be in the array if the bases are nonzero. // which may not be in the array if the bases are nonzero.
const T_numtype* _bz_restrict dataZero() const const T_numtype* restrict dataZero() const
{ return data_; } { return data_; }
T_numtype* _bz_restrict dataZero() T_numtype* restrict dataZero()
{ return data_; } { return data_; }
// These dataFirst() routines refer to the element in the // These dataFirst() routines refer to the element in the
// array which falls first in memory. // array which falls first in memory.
int dataFirstOffset() const int dataFirstOffset() const
{ {
int pos = 0; int pos = 0;
// Used to use tinyvector expressions: // Used to use tinyvector expressions:
// return data_ + dot(storage_.base() // return data_ + dot(storage_.base()
// + (1 - storage_.ascendingFlag()) * (length_ - 1), stride_); // + (1 - storage_.ascendingFlag()) * (length_ - 1), stride_);
for (int i=0; i < N_rank; ++i) for (int i=0; i < N_rank; ++i)
pos += (storage_.base(i) + (1-storage_.isRankStoredAscending(i)) * pos += (storage_.base(i) + (1-storage_.isRankStoredAscending(i)) *
(length_(i)-1)) * stride_(i); (length_(i)-1)) * stride_(i);
return pos; return pos;
} }
const T_numtype* _bz_restrict dataFirst() const const T_numtype* restrict dataFirst() const
{ {
return data_ + dataFirstOffset(); return data_ + dataFirstOffset();
} }
T_numtype* _bz_restrict dataFirst() T_numtype* restrict dataFirst()
{ {
return data_ + dataFirstOffset(); return data_ + dataFirstOffset();
} }
int depth() const int depth() const
{ return length_[2]; } { return length_[2]; }
int dimensions() const int dimensions() const
{ return N_rank; } { return N_rank; }
RectDomain<N_rank> domain() const RectDomain<N_rank> domain() const
{ {
return RectDomain<N_rank>(lbound(), ubound()); return RectDomain<N_rank>(lbound(), ubound());
} }
void dumpStructureInformation(ostream& os = cout) const; void dumpStructureInformation(ostream& os = cout) const;
iterator end() iterator end()
{ {
return iterator(*this, _bz_endTag()); return iterator();
} }
const_iterator end() const const_iterator end() const
{ {
return const_iterator(*this, _bz_endTag()); return const_iterator();
} }
int extent(int rank) const int extent(int rank) const
{ return length_[rank]; } { return length_[rank]; }
const TinyVector<int,N_rank>& extent() const const TinyVector<int,N_rank>& extent() const
{ return length_; } { return length_; }
template<class P_numtype2> template<typename P_numtype2>
Array<P_numtype2,N_rank> extractComponent(P_numtype2, int comp Num, Array<P_numtype2,N_rank> extractComponent(P_numtype2, int comp Num,
int numComponents) const; int numComponents) const;
void free() void free()
{ {
changeToNullBlock(); changeToNullBlock();
length_ = 0; length_ = 0;
} }
_bz_bool isMajorRank(int rank) const bool isMajorRank(int rank) const { return storage_.ordering(rank) == 0;
{ return storage_.ordering(rank) == 0; } }
bool isMinorRank(int rank) const { return storage_.ordering(rank) != 0;
_bz_bool isMinorRank(int rank) const }
{ return storage_.ordering(rank) != 0; } bool isRankStoredAscending(int rank) const {
return storage_.isRankStoredAscending(rank);
_bz_bool isRankStoredAscending(int rank) const
{ return storage_.isRankStoredAscending(rank); }
_bz_bool isStorageContiguous() const;
int lbound(int rank) const
{ return base(rank); }
TinyVector<int,N_rank> lbound() const
{
return base();
} }
int length(int rank) const bool isStorageContiguous() const;
{ return length_[rank]; }
const TinyVector<int, N_rank>& length() const int lbound(int rank) const { return base(rank); }
{ return length_; } TinyVector<int,N_rank> lbound() const { return base(); }
void makeUnique(); int length(int rank) const { return length_[
rank]; }
const TinyVector<int, N_rank>& length() const { return length_;
}
int numElements() const void makeUnique();
{ return product(length_); }
int numElements() const { return product(length_); }
// NEEDS_WORK -- Expose the numReferences() method // NEEDS_WORK -- Expose the numReferences() method
// MemoryBlockReference<T_numtype>::numReferences; // MemoryBlockReference<T_numtype>::numReferences;
// The storage_.ordering_ array is a list of dimensions from // The storage_.ordering_ array is a list of dimensions from
// the most minor (stride 1) to major dimension. Generally, // the most minor (stride 1) to major dimension. Generally,
// ordering(0) will return the dimension which has the smallest // ordering(0) will return the dimension which has the smallest
// stride, and ordering(N_rank-1) will return the dimension with // stride, and ordering(N_rank-1) will return the dimension with
// the largest stride. // the largest stride.
int ordering(int storageRankIndex) const int ordering(int storageRankIndex) const
skipping to change at line 1229 skipping to change at line 1145
return ub; return ub;
} }
int zeroOffset() const int zeroOffset() const
{ return zeroOffset_; } { return zeroOffset_; }
////////////////////////////////////////////// //////////////////////////////////////////////
// Debugging routines // Debugging routines
////////////////////////////////////////////// //////////////////////////////////////////////
_bz_bool isInRangeForDim(int i, int d) const bool isInRangeForDim(int i, int d) const {
{
return i >= base(d) && (i - base(d)) < length_[d]; return i >= base(d) && (i - base(d)) < length_[d];
} }
_bz_bool isInRange(int i0) const bool isInRange(int i0) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0]; return i0 >= base(0) && (i0 - base(0)) < length_[0];
} }
_bz_bool isInRange(int i0, int i1) const bool isInRange(int i0, int i1) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1]; && i1 >= base(1) && (i1 - base(1)) < length_[1];
} }
_bz_bool isInRange(int i0, int i1, int i2) const bool isInRange(int i0, int i1, int i2) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2]; && i2 >= base(2) && (i2 - base(2)) < length_[2];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3) const bool isInRange(int i0, int i1, int i2, int i3) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3]; && i3 >= base(3) && (i3 - base(3)) < length_[3];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4) const bool isInRange(int i0, int i1, int i2, int i3, int i4) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4]; && i4 >= base(4) && (i4 - base(4)) < length_[4];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4, bool isInRange(int i0, int i1, int i2, int i3, int i4, int i5) const {
int i5) const
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4] && i4 >= base(4) && (i4 - base(4)) < length_[4]
&& i5 >= base(5) && (i5 - base(5)) < length_[5]; && i5 >= base(5) && (i5 - base(5)) < length_[5];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4, bool isInRange(int i0, int i1, int i2, int i3, int i4, int i5, int i6)
int i5, int i6) const const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4] && i4 >= base(4) && (i4 - base(4)) < length_[4]
&& i5 >= base(5) && (i5 - base(5)) < length_[5] && i5 >= base(5) && (i5 - base(5)) < length_[5]
&& i6 >= base(6) && (i6 - base(6)) < length_[6]; && i6 >= base(6) && (i6 - base(6)) < length_[6];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4, bool isInRange(int i0, int i1, int i2, int i3, int i4,
int i5, int i6, int i7) const int i5, int i6, int i7) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4] && i4 >= base(4) && (i4 - base(4)) < length_[4]
&& i5 >= base(5) && (i5 - base(5)) < length_[5] && i5 >= base(5) && (i5 - base(5)) < length_[5]
&& i6 >= base(6) && (i6 - base(6)) < length_[6] && i6 >= base(6) && (i6 - base(6)) < length_[6]
&& i7 >= base(7) && (i7 - base(7)) < length_[7]; && i7 >= base(7) && (i7 - base(7)) < length_[7];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4, bool isInRange(int i0, int i1, int i2, int i3, int i4,
int i5, int i6, int i7, int i8) const int i5, int i6, int i7, int i8) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4] && i4 >= base(4) && (i4 - base(4)) < length_[4]
&& i5 >= base(5) && (i5 - base(5)) < length_[5] && i5 >= base(5) && (i5 - base(5)) < length_[5]
&& i6 >= base(6) && (i6 - base(6)) < length_[6] && i6 >= base(6) && (i6 - base(6)) < length_[6]
&& i7 >= base(7) && (i7 - base(7)) < length_[7] && i7 >= base(7) && (i7 - base(7)) < length_[7]
&& i8 >= base(8) && (i8 - base(8)) < length_[8]; && i8 >= base(8) && (i8 - base(8)) < length_[8];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4, bool isInRange(int i0, int i1, int i2, int i3, int i4,
int i5, int i6, int i7, int i8, int i9) const int i5, int i6, int i7, int i8, int i9) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4] && i4 >= base(4) && (i4 - base(4)) < length_[4]
&& i5 >= base(5) && (i5 - base(5)) < length_[5] && i5 >= base(5) && (i5 - base(5)) < length_[5]
&& i6 >= base(6) && (i6 - base(6)) < length_[6] && i6 >= base(6) && (i6 - base(6)) < length_[6]
&& i7 >= base(7) && (i7 - base(7)) < length_[7] && i7 >= base(7) && (i7 - base(7)) < length_[7]
&& i8 >= base(8) && (i8 - base(8)) < length_[8] && i8 >= base(8) && (i8 - base(8)) < length_[8]
&& i9 >= base(9) && (i9 - base(9)) < length_[9]; && i9 >= base(9) && (i9 - base(9)) < length_[9];
} }
_bz_bool isInRange(int i0, int i1, int i2, int i3, int i4, bool isInRange(int i0, int i1, int i2, int i3, int i4,
int i5, int i6, int i7, int i8, int i9, int i10) const int i5, int i6, int i7, int i8, int i9, int i10) const {
{
return i0 >= base(0) && (i0 - base(0)) < length_[0] return i0 >= base(0) && (i0 - base(0)) < length_[0]
&& i1 >= base(1) && (i1 - base(1)) < length_[1] && i1 >= base(1) && (i1 - base(1)) < length_[1]
&& i2 >= base(2) && (i2 - base(2)) < length_[2] && i2 >= base(2) && (i2 - base(2)) < length_[2]
&& i3 >= base(3) && (i3 - base(3)) < length_[3] && i3 >= base(3) && (i3 - base(3)) < length_[3]
&& i4 >= base(4) && (i4 - base(4)) < length_[4] && i4 >= base(4) && (i4 - base(4)) < length_[4]
&& i5 >= base(5) && (i5 - base(5)) < length_[5] && i5 >= base(5) && (i5 - base(5)) < length_[5]
&& i6 >= base(6) && (i6 - base(6)) < length_[6] && i6 >= base(6) && (i6 - base(6)) < length_[6]
&& i7 >= base(7) && (i7 - base(7)) < length_[7] && i7 >= base(7) && (i7 - base(7)) < length_[7]
&& i8 >= base(8) && (i8 - base(8)) < length_[8] && i8 >= base(8) && (i8 - base(8)) < length_[8]
&& i9 >= base(9) && (i9 - base(9)) < length_[9] && i9 >= base(9) && (i9 - base(9)) < length_[9]
&& i10 >= base(10) && (i10 - base(10)) < length_[10]; && i10 >= base(10) && (i10 - base(10)) < length_[10];
} }
_bz_bool isInRange(const T_index& index) const bool isInRange(const T_index& index) const {
{
for (int i=0; i < N_rank; ++i) for (int i=0; i < N_rank; ++i)
if (index[i] < base(i) || (index[i] - base(i)) >= length_[i]) if (index[i] < base(i) || (index[i] - base(i)) >= length_[i])
return _bz_false; return false;
return _bz_true; return true;
} }
_bz_bool assertInRange(const T_index& index) const bool assertInRange(const T_index& BZ_DEBUG_PARAM(index)) const {
{
BZPRECHECK(isInRange(index), "Array index out of range: " << index BZPRECHECK(isInRange(index), "Array index out of range: " << index
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0) const bool assertInRange(int BZ_DEBUG_PARAM(i0)) const {
{
BZPRECHECK(isInRange(i0), "Array index out of range: " << i0 BZPRECHECK(isInRange(i0), "Array index out of range: " << i0
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1) const bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1)) cons
{ t {
BZPRECHECK(isInRange(i0,i1), "Array index out of range: (" BZPRECHECK(isInRange(i0,i1), "Array index out of range: ("
<< i0 << ", " << i1 << ")" << i0 << ", " << i1 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2) const bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int BZ_DEBUG_PARAM(i2)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2), "Array index out of range: (" BZPRECHECK(isInRange(i0,i1,i2), "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ")" << i0 << ", " << i1 << ", " << i2 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3) const bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3), "Array index out of range: (" BZPRECHECK(isInRange(i0,i1,i2,i3), "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << ")" << i0 << ", " << i1 << ", " << i2 << ", " << i3 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4) const bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3),
int BZ_DEBUG_PARAM(i4)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4), "Array index out of range: (" BZPRECHECK(isInRange(i0,i1,i2,i3,i4), "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ")" << ", " << i4 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4, bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int i5) const int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3), int BZ_DEBUG_PARAM(
i4),
int BZ_DEBUG_PARAM(i5)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5), "Array index out of range: (" BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5), "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ", " << i5 << ")" << ", " << i4 << ", " << i5 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4, bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int i5, int i6) const int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3), int BZ_DEBUG_PARAM(
i4),
int BZ_DEBUG_PARAM(i5), int BZ_DEBUG_PARAM(i6)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6), BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6),
"Array index out of range: (" "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ", " << i5 << ", " << i6 << ")" << ", " << i4 << ", " << i5 << ", " << i6 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4, bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int i5, int i6, int i7) const int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3), int BZ_DEBUG_PARAM(
i4),
int BZ_DEBUG_PARAM(i5), int BZ_DEBUG_PARAM(i6),
int BZ_DEBUG_PARAM(i7)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7), BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7),
"Array index out of range: (" "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7 << ")" << ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4, bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int i5, int i6, int i7, int i8) const int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3), int BZ_DEBUG_PARAM(
i4),
int BZ_DEBUG_PARAM(i5), int BZ_DEBUG_PARAM(i6), int BZ_DEBUG_PARAM(
i7),
int BZ_DEBUG_PARAM(i8)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7,i8), BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7,i8),
"Array index out of range: (" "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7 << ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7
<< ", " << i8 << ")" << ", " << i8 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4, bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int i5, int i6, int i7, int i8, int i9) const int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3), int BZ_DEBUG_PARAM(
i4),
int BZ_DEBUG_PARAM(i5), int BZ_DEBUG_PARAM(i6), int BZ_DEBUG_PARAM(
i7),
int BZ_DEBUG_PARAM(i8), int BZ_DEBUG_PARAM(i9)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7,i8,i9), BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7,i8,i9),
"Array index out of range: (" "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7 << ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7
<< ", " << i8 << ", " << i9 << ")" << ", " << i8 << ", " << i9 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
_bz_bool assertInRange(int i0, int i1, int i2, int i3, int i4, bool assertInRange(int BZ_DEBUG_PARAM(i0), int BZ_DEBUG_PARAM(i1),
int i5, int i6, int i7, int i8, int i9, int i10) const int BZ_DEBUG_PARAM(i2), int BZ_DEBUG_PARAM(i3), int BZ_DEBUG_PARAM(
i4),
int BZ_DEBUG_PARAM(i5), int BZ_DEBUG_PARAM(i6), int BZ_DEBUG_PARAM(
i7),
int BZ_DEBUG_PARAM(i8), int BZ_DEBUG_PARAM(i9),
int BZ_DEBUG_PARAM(i10)) const
{ {
BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10), BZPRECHECK(isInRange(i0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10),
"Array index out of range: (" "Array index out of range: ("
<< i0 << ", " << i1 << ", " << i2 << ", " << i3 << i0 << ", " << i1 << ", " << i2 << ", " << i3
<< ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7 << ", " << i4 << ", " << i5 << ", " << i6 << ", " << i7
<< ", " << i8 << ", " << i9 << ", " << i10 << ")" << ", " << i8 << ", " << i9 << ", " << i10 << ")"
<< endl << "Lower bounds: " << storage_.base() << endl << endl << "Lower bounds: " << storage_.base() << endl
<< "Length: " << length_ << endl); << "Length: " << length_ << endl);
return _bz_true; return true;
} }
////////////////////////////////////////////// //////////////////////////////////////////////
// Subscripting operators // Subscripting operators
////////////////////////////////////////////// //////////////////////////////////////////////
template<int N_rank2> template<int N_rank2>
T_numtype operator()(const TinyVector<int,N_rank2>& index) const const T_numtype& restrict operator()(const TinyVector<int,N_rank2>& ind ex) const
{ {
assertInRange(index); assertInRange(index);
return data_[dot(index, stride_)]; return data_[dot(index, stride_)];
} }
template<int N_rank2> template<int N_rank2>
T_numtype& _bz_restrict operator()(const TinyVector<int,N_rank2>& index ) T_numtype& restrict operator()(const TinyVector<int,N_rank2>& index)
{ {
assertInRange(index); assertInRange(index);
return data_[dot(index, stride_)]; return data_[dot(index, stride_)];
} }
T_numtype operator()(TinyVector<int,1> index) const const T_numtype& restrict operator()(TinyVector<int,1> index) const
{ {
assertInRange(index[0]); assertInRange(index[0]);
return data_[index[0] * stride_[0]]; return data_[index[0] * stride_[0]];
} }
T_numtype& operator()(TinyVector<int,1> index) T_numtype& operator()(TinyVector<int,1> index)
{ {
assertInRange(index[0]); assertInRange(index[0]);
return data_[index[0] * stride_[0]]; return data_[index[0] * stride_[0]];
} }
T_numtype operator()(TinyVector<int,2> index) const const T_numtype& restrict operator()(TinyVector<int,2> index) const
{ {
assertInRange(index[0], index[1]); assertInRange(index[0], index[1]);
return data_[index[0] * stride_[0] + index[1] * stride_[1]]; return data_[index[0] * stride_[0] + index[1] * stride_[1]];
} }
T_numtype& operator()(TinyVector<int,2> index) T_numtype& operator()(TinyVector<int,2> index)
{ {
assertInRange(index[0], index[1]); assertInRange(index[0], index[1]);
return data_[index[0] * stride_[0] + index[1] * stride_[1]]; return data_[index[0] * stride_[0] + index[1] * stride_[1]];
} }
T_numtype operator()(TinyVector<int,3> index) const const T_numtype& restrict operator()(TinyVector<int,3> index) const
{ {
assertInRange(index[0], index[1], index[2]); assertInRange(index[0], index[1], index[2]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2]]; + index[2] * stride_[2]];
} }
T_numtype& operator()(TinyVector<int,3> index) T_numtype& operator()(TinyVector<int,3> index)
{ {
assertInRange(index[0], index[1], index[2]); assertInRange(index[0], index[1], index[2]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2]]; + index[2] * stride_[2]];
} }
T_numtype operator()(const TinyVector<int,4>& index) const const T_numtype& restrict operator()(const TinyVector<int,4>& index) co nst
{ {
assertInRange(index[0], index[1], index[2], index[3]); assertInRange(index[0], index[1], index[2], index[3]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3]]; + index[2] * stride_[2] + index[3] * stride_[3]];
} }
T_numtype& operator()(const TinyVector<int,4>& index) T_numtype& operator()(const TinyVector<int,4>& index)
{ {
assertInRange(index[0], index[1], index[2], index[3]); assertInRange(index[0], index[1], index[2], index[3]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3]]; + index[2] * stride_[2] + index[3] * stride_[3]];
} }
T_numtype operator()(const TinyVector<int,5>& index) const const T_numtype& restrict operator()(const TinyVector<int,5>& index) co nst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4]); index[4]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4]]; + index[4] * stride_[4]];
} }
T_numtype& operator()(const TinyVector<int,5>& index) T_numtype& operator()(const TinyVector<int,5>& index)
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4]); index[4]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4]]; + index[4] * stride_[4]];
} }
T_numtype operator()(const TinyVector<int,6>& index) const const T_numtype& restrict operator()(const TinyVector<int,6>& index) co nst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5]); index[4], index[5]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5]]; + index[4] * stride_[4] + index[5] * stride_[5]];
} }
T_numtype& operator()(const TinyVector<int,6>& index) T_numtype& operator()(const TinyVector<int,6>& index)
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5]); index[4], index[5]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5]]; + index[4] * stride_[4] + index[5] * stride_[5]];
} }
T_numtype operator()(const TinyVector<int,7>& index) const const T_numtype& restrict operator()(const TinyVector<int,7>& index) co nst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6]); index[4], index[5], index[6]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6]]; + index[6] * stride_[6]];
} }
T_numtype& operator()(const TinyVector<int,7>& index) T_numtype& operator()(const TinyVector<int,7>& index)
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6]); index[4], index[5], index[6]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6]]; + index[6] * stride_[6]];
} }
T_numtype operator()(const TinyVector<int,8>& index) const const T_numtype& restrict operator()(const TinyVector<int,8>& index) co nst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7]); index[4], index[5], index[6], index[7]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7]]; + index[6] * stride_[6] + index[7] * stride_[7]];
} }
T_numtype& operator()(const TinyVector<int,8>& index) T_numtype& operator()(const TinyVector<int,8>& index)
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7]); index[4], index[5], index[6], index[7]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7]]; + index[6] * stride_[6] + index[7] * stride_[7]];
} }
T_numtype operator()(const TinyVector<int,9>& index) const const T_numtype& restrict operator()(const TinyVector<int,9>& index) co nst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7], index[8]); index[4], index[5], index[6], index[7], index[8]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7] + index[6] * stride_[6] + index[7] * stride_[7]
+ index[8] * stride_[8]]; + index[8] * stride_[8]];
} }
skipping to change at line 1654 skipping to change at line 1567
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7], index[8]); index[4], index[5], index[6], index[7], index[8]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7] + index[6] * stride_[6] + index[7] * stride_[7]
+ index[8] * stride_[8]]; + index[8] * stride_[8]];
} }
T_numtype operator()(const TinyVector<int,10>& index) const const T_numtype& restrict operator()(const TinyVector<int,10>& index) c onst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7], index[8], index[9]); index[4], index[5], index[6], index[7], index[8], index[9]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7] + index[6] * stride_[6] + index[7] * stride_[7]
+ index[8] * stride_[8] + index[9] * stride_[9]]; + index[8] * stride_[8] + index[9] * stride_[9]];
} }
skipping to change at line 1676 skipping to change at line 1589
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7], index[8], index[9]); index[4], index[5], index[6], index[7], index[8], index[9]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7] + index[6] * stride_[6] + index[7] * stride_[7]
+ index[8] * stride_[8] + index[9] * stride_[9]]; + index[8] * stride_[8] + index[9] * stride_[9]];
} }
T_numtype operator()(const TinyVector<int,11>& index) const const T_numtype& restrict operator()(const TinyVector<int,11>& index) c onst
{ {
assertInRange(index[0], index[1], index[2], index[3], assertInRange(index[0], index[1], index[2], index[3],
index[4], index[5], index[6], index[7], index[8], index[9], index[4], index[5], index[6], index[7], index[8], index[9],
index[10]); index[10]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7] + index[6] * stride_[6] + index[7] * stride_[7]
+ index[8] * stride_[8] + index[9] * stride_[9] + index[8] * stride_[8] + index[9] * stride_[9]
+ index[10] * stride_[10]]; + index[10] * stride_[10]];
skipping to change at line 1702 skipping to change at line 1615
index[4], index[5], index[6], index[7], index[8], index[9], index[4], index[5], index[6], index[7], index[8], index[9],
index[10]); index[10]);
return data_[index[0] * stride_[0] + index[1] * stride_[1] return data_[index[0] * stride_[0] + index[1] * stride_[1]
+ index[2] * stride_[2] + index[3] * stride_[3] + index[2] * stride_[2] + index[3] * stride_[3]
+ index[4] * stride_[4] + index[5] * stride_[5] + index[4] * stride_[4] + index[5] * stride_[5]
+ index[6] * stride_[6] + index[7] * stride_[7] + index[6] * stride_[6] + index[7] * stride_[7]
+ index[8] * stride_[8] + index[9] * stride_[9] + index[8] * stride_[8] + index[9] * stride_[9]
+ index[10] * stride_[10]]; + index[10] * stride_[10]];
} }
T_numtype operator()(int i0) const const T_numtype& restrict operator()(int i0) const
{ {
assertInRange(i0); assertInRange(i0);
return data_[i0 * stride_[0]]; return data_[i0 * stride_[0]];
} }
T_numtype& _bz_restrict operator()(int i0) T_numtype& restrict operator()(int i0)
{ {
assertInRange(i0); assertInRange(i0);
return data_[i0 * stride_[0]]; return data_[i0 * stride_[0]];
} }
T_numtype operator()(int i0, int i1) const const T_numtype& restrict operator()(int i0, int i1) const
{ {
assertInRange(i0, i1); assertInRange(i0, i1);
return data_[i0 * stride_[0] + i1 * stride_[1]]; return data_[i0 * stride_[0] + i1 * stride_[1]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1) T_numtype& restrict operator()(int i0, int i1)
{ {
assertInRange(i0, i1); assertInRange(i0, i1);
return data_[i0 * stride_[0] + i1 * stride_[1]]; return data_[i0 * stride_[0] + i1 * stride_[1]];
} }
T_numtype operator()(int i0, int i1, int i2) const const T_numtype& restrict operator()(int i0, int i1, int i2) const
{ {
assertInRange(i0, i1, i2); assertInRange(i0, i1, i2);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2]]; + i2 * stride_[2]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2) T_numtype& restrict operator()(int i0, int i1, int i2)
{ {
assertInRange(i0, i1, i2); assertInRange(i0, i1, i2);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2]]; + i2 * stride_[2]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3) const const T_numtype& restrict operator()(int i0, int i1, int i2, int i3) co nst
{ {
assertInRange(i0, i1, i2, i3); assertInRange(i0, i1, i2, i3);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3]]; + i2 * stride_[2] + i3 * stride_[3]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3) T_numtype& restrict operator()(int i0, int i1, int i2, int i3)
{ {
assertInRange(i0, i1, i2, i3); assertInRange(i0, i1, i2, i3);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3]]; + i2 * stride_[2] + i3 * stride_[3]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4) const int i4) const
{ {
assertInRange(i0, i1, i2, i3, i4); assertInRange(i0, i1, i2, i3, i4);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]]; + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4) int i4)
{ {
assertInRange(i0, i1, i2, i3, i4); assertInRange(i0, i1, i2, i3, i4);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]]; + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5) const int i4, int i5) const
{ {
assertInRange(i0, i1, i2, i3, i4, i5); assertInRange(i0, i1, i2, i3, i4, i5);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5]]; + i5 * stride_[5]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5) int i4, int i5)
{ {
assertInRange(i0, i1, i2, i3, i4, i5); assertInRange(i0, i1, i2, i3, i4, i5);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5]]; + i5 * stride_[5]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6) const int i4, int i5, int i6) const
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6); assertInRange(i0, i1, i2, i3, i4, i5, i6);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6]]; + i5 * stride_[5] + i6 * stride_[6]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6) int i4, int i5, int i6)
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6); assertInRange(i0, i1, i2, i3, i4, i5, i6);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6]]; + i5 * stride_[5] + i6 * stride_[6]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7) const int i4, int i5, int i6, int i7) const
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7); assertInRange(i0, i1, i2, i3, i4, i5, i6, i7);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]]; + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7) int i4, int i5, int i6, int i7)
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7); assertInRange(i0, i1, i2, i3, i4, i5, i6, i7);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]]; + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7, int i8) const int i4, int i5, int i6, int i7, int i8) const
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8); assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7] + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
+ i8 * stride_[8]]; + i8 * stride_[8]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7, int i8) int i4, int i5, int i6, int i7, int i8)
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8); assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7] + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
+ i8 * stride_[8]]; + i8 * stride_[8]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7, int i8, int i9) const int i4, int i5, int i6, int i7, int i8, int i9) const
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9); assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7] + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
+ i8 * stride_[8] + i9 * stride_[9]]; + i8 * stride_[8] + i9 * stride_[9]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7, int i8, int i9) int i4, int i5, int i6, int i7, int i8, int i9)
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9); assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, i9);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7] + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
+ i8 * stride_[8] + i9 * stride_[9]]; + i8 * stride_[8] + i9 * stride_[9]];
} }
T_numtype operator()(int i0, int i1, int i2, int i3, const T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7, int i8, int i9, int i10) const int i4, int i5, int i6, int i7, int i8, int i9, int i10) const
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8,
i9, i10); i9, i10);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7] + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
+ i8 * stride_[8] + i9 * stride_[9] + i10 * stride_[10]]; + i8 * stride_[8] + i9 * stride_[9] + i10 * stride_[10]];
} }
T_numtype& _bz_restrict operator()(int i0, int i1, int i2, int i3, T_numtype& restrict operator()(int i0, int i1, int i2, int i3,
int i4, int i5, int i6, int i7, int i8, int i9, int i10) int i4, int i5, int i6, int i7, int i8, int i9, int i10)
{ {
assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8, assertInRange(i0, i1, i2, i3, i4, i5, i6, i7, i8,
i9, i10); i9, i10);
return data_[i0 * stride_[0] + i1 * stride_[1] return data_[i0 * stride_[0] + i1 * stride_[1]
+ i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4] + i2 * stride_[2] + i3 * stride_[3] + i4 * stride_[4]
+ i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7] + i5 * stride_[5] + i6 * stride_[6] + i7 * stride_[7]
+ i8 * stride_[8] + i9 * stride_[9] + i10 * stride_[10]]; + i8 * stride_[8] + i9 * stride_[9] + i10 * stride_[10]];
} }
skipping to change at line 1989 skipping to change at line 1902
* other helpful things. * other helpful things.
* *
* Once partial specialization becomes widely implemented, these * Once partial specialization becomes widely implemented, these
* operators may be expanded to accept Vector<int> arguments * operators may be expanded to accept Vector<int> arguments
* and produce ArrayPick<T,N> objects. * and produce ArrayPick<T,N> objects.
* *
* This operator() is not provided with a single argument because * This operator() is not provided with a single argument because
* the appropriate cases exist above. * the appropriate cases exist above.
*/ */
#ifdef BZ_PARTIAL_ORDERING #ifdef BZ_HAVE_PARTIAL_ORDERING
template<class T1, class T2> template<typename T1, typename T2>
_bz_typename SliceInfo<T_numtype,T1,T2>::T_slice typename SliceInfo<T_numtype,T1,T2>::T_slice
operator()(T1 r1, T2 r2) const operator()(T1 r1, T2 r2) const
{ {
return SliceInfo<T_numtype,T1,T2>::T_slice(noConst(), r1, r2, typedef typename SliceInfo<T_numtype,T1,T2>::T_slice slice;
nilArraySection(), nilArraySection(), nilArraySection(), return slice(noConst(), r1, r2, nilArraySection(), nilArraySection(
), nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3> template<typename T1, typename T2, typename T3>
_bz_typename SliceInfo<T_numtype,T1,T2,T3>::T_slice typename SliceInfo<T_numtype,T1,T2,T3>::T_slice
operator()(T1 r1, T2 r2, T3 r3) const operator()(T1 r1, T2 r2, T3 r3) const
{ {
return SliceInfo<T_numtype,T1,T2,T3>::T_slice(noConst(), r1, r2, r3 typedef typename SliceInfo<T_numtype,T1,T2,T3>::T_slice slice;
, return slice(noConst(), r1, r2, r3, nilArraySection(), nilArraySect
nilArraySection(), nilArraySection(), nilArraySection(), ion(), nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4> template<typename T1, typename T2, typename T3, typename T4>
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4>::T_slice typename SliceInfo<T_numtype,T1,T2,T3,T4>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4) const operator()(T1 r1, T2 r2, T3 r3, T4 r4) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4>::T_slice(noConst(), r1, r2, typedef typename SliceInfo<T_numtype,T1,T2,T3,T4>::T_slice slice;
r3, return slice(noConst(), r1, r2, r3, r4, nilArraySection(), nilArray
r4, nilArraySection(), nilArraySection(), Section(),
nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5> template<typename T1, typename T2, typename T3, typename T4, typename T
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5>::T_slice 5>
typename SliceInfo<T_numtype,T1,T2,T3,T4,T5>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5) const operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5>::T_slice(noConst(), r1, typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5>::T_slice slice
r2, ;
r3, r4, r5, nilArraySection(), return slice(noConst(), r1, r2, r3, r4, r5, nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5, class T6> template<typename T1, typename T2, typename T3, typename T4, typename T
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6>::T_slice 5, typename T6>
typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6) const operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6>::T_slice(noConst(), r typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6>::T_slice sl
1, ice;
r2, r3, r4, r5, r6, return slice(noConst(), r1, r2, r3, r4, r5, r6, nilArraySection(),
nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(), nilArraySection(),
nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5, class T6, template<typename T1, typename T2, typename T3, typename T4, typename T
class T7> 5, typename T6,
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7>::T_slice typename T7>
typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7) const operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7>::T_slice(noConst() typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7>::T_slice
, slice;
r1, r2, r3, r4, r5, r6, r7, return slice(noConst(), r1, r2, r3, r4, r5, r6, r7, nilArraySection
nilArraySection(), nilArraySection(), (), nilArraySection(),
nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5, class T6, template<typename T1, typename T2, typename T3, typename T4, typename T
class T7, class T8> 5, typename T6,
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8>::T_slice typename T7, typename T8>
typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8) cons t operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8) cons t
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8>::T_slice(noCons typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8>::T_sl
t(), ice slice;
r1, r2, r3, r4, r5, r6, r7, r8, return slice(noConst(), r1, r2, r3, r4, r5, r6, r7, r8,
nilArraySection(), nilArraySection(), nilArraySection()); nilArraySection(), nilArraySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5, class T6, template<typename T1, typename T2, typename T3, typename T4, typename T
class T7, class T8, class T9> 5, typename T6,
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9>::T_slice typename T7, typename T8, typename T9>
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9>::T_slice
T9 r9) const operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r
9) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9> typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9>::T
::T_slice(noConst(), _slice slice;
r1, r2, r3, r4, r5, r6, r7, r8, r9, return slice(noConst(), r1, r2, r3, r4, r5, r6, r7, r8, r9, nilArra
nilArraySection(), nilArraySection()); ySection(), nilArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5, class T6, template<typename T1, typename T2, typename T3, typename T4, typename T
class T7, class T8, class T9, class T10> 5, typename T6,
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>::T_sli typename T7, typename T8, typename T9, typename T10>
ce typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r
T9 r9, T10 r10) const 9, T10 r10) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9, typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10
T10>::T_slice(noConst(), r1, r2, r3, r4, r5, r6, r7, r8, >::T_slice slice;
r9, r10, nilArraySection()); return slice(noConst(), r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, ni
lArraySection());
} }
template<class T1, class T2, class T3, class T4, class T5, class T6, template<typename T1, typename T2, typename T3, typename T4, typename T
class T7, class T8, class T9, class T10, class T11> 5, typename T6,
_bz_typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, typename T7, typename T8, typename T9, typename T10, typename T11>
T11>::T_slice typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>::T_sli
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, ce
T9 r9, T10 r10, T11 r11) const operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r
9, T10 r10, T11 r11) const
{ {
return SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, typedef typename SliceInfo<T_numtype,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10
T11>::T_slice(noConst(), r1, r2, r3, r4, r5, r6, r7, r8, r9, ,T11>::T_slice slice;
r10, r11); return slice(noConst(), r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r1
1);
} }
#endif // BZ_PARTIAL_ORDERING #endif // BZ_HAVE_PARTIAL_ORDERING
/* /*
* These versions of operator() are provided to support tensor-style * These versions of operator() are provided to support tensor-style
* array notation, e.g. * array notation, e.g.
* *
* Array<float, 2> A, B; * Array<float, 2> A, B;
* firstIndex i; * firstIndex i;
* secondIndex j; * secondIndex j;
* thirdIndex k; * thirdIndex k;
* Array<float, 3> C = A(i,j) * B(j,k); * Array<float, 3> C = A(i,j) * B(j,k);
skipping to change at line 2238 skipping to change at line 2141
////////////////////////////////////////////// //////////////////////////////////////////////
// Support for multicomponent arrays // Support for multicomponent arrays
////////////////////////////////////////////// //////////////////////////////////////////////
/* /*
* See <blitz/array/multi.h> for an explanation of the traits class * See <blitz/array/multi.h> for an explanation of the traits class
* multicomponent_traits. * multicomponent_traits.
*/ */
// NEEDS_WORK: const version Array<typename multicomponent_traits<T_numtype>::T_element,N_rank>
Array<_bz_typename multicomponent_traits<T_numtype>::T_element,N_rank> operator[](const unsigned component) {
operator[](int component) typedef typename multicomponent_traits<T_numtype>::T_element T_comp
{ Type;
typedef _bz_typename multicomponent_traits<T_numtype>::T_element
T_compType;
return extractComponent(T_compType(), return extractComponent(T_compType(),component,
component, multicomponent_traits<T_numtype>::numComponents); multicomponent_traits<T_numtype>::numCompon
ents);
}
const Array<typename multicomponent_traits<T_numtype>::T_element,N_rank
>
operator[](const unsigned component) const {
typedef typename multicomponent_traits<T_numtype>::T_element T_comp
Type;
return extractComponent(T_compType(),component,
multicomponent_traits<T_numtype>::numCompon
ents);
}
Array<typename multicomponent_traits<T_numtype>::T_element,N_rank>
operator[](const int component) {
return operator[](static_cast<unsigned>(component));
}
const Array<typename multicomponent_traits<T_numtype>::T_element,N_rank
>
operator[](const int component) const {
return operator[](static_cast<unsigned>(component));
} }
////////////////////////////////////////////// //////////////////////////////////////////////
// Indirection // Indirection
////////////////////////////////////////////// //////////////////////////////////////////////
template<class T_indexContainer> template<typename T_indexContainer>
IndirectArray<T_array, T_indexContainer> IndirectArray<T_array, T_indexContainer>
operator[](const T_indexContainer& index) operator[](const T_indexContainer& index)
{ {
return IndirectArray<T_array, T_indexContainer>(*this, return IndirectArray<T_array, T_indexContainer>(*this,
const_cast<T_indexContainer&>(index)); const_cast<T_indexContainer&>(index));
} }
////////////////////////////////////////////// //////////////////////////////////////////////
// Assignment Operators // Assignment Operators
////////////////////////////////////////////// //////////////////////////////////////////////
skipping to change at line 2279 skipping to change at line 2197
{ {
return ListInitializationSwitch<T_array,T_numtype*>(*this, x); return ListInitializationSwitch<T_array,T_numtype*>(*this, x);
} }
T_array& initialize(T_numtype); T_array& initialize(T_numtype);
// Was: // Was:
// T_array& operator=(T_numtype); // T_array& operator=(T_numtype);
#ifdef BZ_NEW_EXPRESSION_TEMPLATES #ifdef BZ_NEW_EXPRESSION_TEMPLATES
template<class T_expr> template<typename T_expr>
T_array& operator=(const ETBase<T_expr>&); T_array& operator=(const ETBase<T_expr>&);
T_array& operator=(const Array<T_numtype,N_rank>&); T_array& operator=(const Array<T_numtype,N_rank>&);
template<class T> T_array& operator+=(const T&); template<typename T> T_array& operator+=(const T&);
template<class T> T_array& operator-=(const T&); template<typename T> T_array& operator-=(const T&);
template<class T> T_array& operator*=(const T&); template<typename T> T_array& operator*=(const T&);
template<class T> T_array& operator/=(const T&); template<typename T> T_array& operator/=(const T&);
template<class T> T_array& operator%=(const T&); template<typename T> T_array& operator%=(const T&);
template<class T> T_array& operator^=(const T&); template<typename T> T_array& operator^=(const T&);
template<class T> T_array& operator&=(const T&); template<typename T> T_array& operator&=(const T&);
template<class T> T_array& operator|=(const T&); template<typename T> T_array& operator|=(const T&);
template<class T> T_array& operator>>=(const T&); template<typename T> T_array& operator>>=(const T&);
template<class T> T_array& operator<<=(const T&); template<typename T> T_array& operator<<=(const T&);
#else #else
T_array& operator+=(T_numtype); T_array& operator+=(T_numtype);
T_array& operator-=(T_numtype); T_array& operator-=(T_numtype);
T_array& operator*=(T_numtype); T_array& operator*=(T_numtype);
T_array& operator/=(T_numtype); T_array& operator/=(T_numtype);
T_array& operator%=(T_numtype); T_array& operator%=(T_numtype);
T_array& operator^=(T_numtype); T_array& operator^=(T_numtype);
T_array& operator&=(T_numtype); T_array& operator&=(T_numtype);
T_array& operator|=(T_numtype); T_array& operator|=(T_numtype);
T_array& operator>>=(T_numtype); T_array& operator>>=(T_numtype);
T_array& operator<<=(T_numtype); T_array& operator<<=(T_numtype);
// Array operands // Array operands
T_array& operator=(const Array<T_numtype,N_rank>&); T_array& operator=(const Array<T_numtype,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator=(const Array<P_numtype2,N_rank>&); T_array& operator=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator+=(const Array<P_numtype2,N_rank>&); T_array& operator+=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator-=(const Array<P_numtype2,N_rank>&); T_array& operator-=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator*=(const Array<P_numtype2,N_rank>&); T_array& operator*=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator/=(const Array<P_numtype2,N_rank>&); T_array& operator/=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator%=(const Array<P_numtype2,N_rank>&); T_array& operator%=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator^=(const Array<P_numtype2,N_rank>&); T_array& operator^=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator&=(const Array<P_numtype2,N_rank>&); T_array& operator&=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator|=(const Array<P_numtype2,N_rank>&); T_array& operator|=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator>>=(const Array<P_numtype2,N_rank>&); T_array& operator>>=(const Array<P_numtype2,N_rank>&);
template<class P_numtype2> template<typename P_numtype2>
T_array& operator<<=(const Array<P_numtype2,N_rank>&); T_array& operator<<=(const Array<P_numtype2,N_rank>&);
// Array expression operands // Array expression operands
template<class T_expr> template<typename T_expr>
inline T_array& operator=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator+=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator+=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator-=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator-=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator*=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator*=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator/=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator/=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator%=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator%=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator^=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator^=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator&=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator&=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator|=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator|=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator>>=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator>>=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
template<class T_expr> template<typename T_expr>
inline T_array& operator<<=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr); inline T_array& operator<<=(BZ_ETPARM(_bz_ArrayExpr<T_expr>) expr);
// NEEDS_WORK -- Index placeholder operand // NEEDS_WORK -- Index placeholder operand
// NEEDS_WORK -- Random operand // NEEDS_WORK -- Random operand
#endif #endif
public: public:
// Undocumented implementation routines // Undocumented implementation routines
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluate(T_expr expr, T_update); inline T_array& evaluate(T_expr expr, T_update);
#ifdef BZ_HAVE_STD #ifdef BZ_HAVE_STD
#ifdef BZ_ARRAY_SPACE_FILLING_TRAVERSAL #ifdef BZ_ARRAY_SPACE_FILLING_TRAVERSAL
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluateWithFastTraversal( inline T_array& evaluateWithFastTraversal(
const TraversalOrder<N_rank - 1>& order, const TraversalOrder<N_rank - 1>& order,
T_expr expr, T_update); T_expr expr, T_update);
#endif // BZ_ARRAY_SPACE_FILLING_TRAVERSAL #endif // BZ_ARRAY_SPACE_FILLING_TRAVERSAL
#endif #endif
#ifdef BZ_ARRAY_2D_STENCIL_TILING #ifdef BZ_ARRAY_2D_STENCIL_TILING
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluateWithTiled2DTraversal( inline T_array& evaluateWithTiled2DTraversal(
T_expr expr, T_update); T_expr expr, T_update);
#endif #endif
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluateWithIndexTraversal1( inline T_array& evaluateWithIndexTraversal1(
T_expr expr, T_update); T_expr expr, T_update);
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluateWithIndexTraversalN( inline T_array& evaluateWithIndexTraversalN(
T_expr expr, T_update); T_expr expr, T_update);
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluateWithStackTraversal1( inline T_array& evaluateWithStackTraversal1(
T_expr expr, T_update); T_expr expr, T_update);
template<class T_expr, class T_update> template<typename T_expr, typename T_update>
inline T_array& evaluateWithStackTraversalN( inline T_array& evaluateWithStackTraversalN(
T_expr expr, T_update); T_expr expr, T_update);
T_numtype* _bz_restrict getInitializationIterator() T_numtype* restrict getInitializationIterator() { return dataFirst(); }
{ return dataFirst(); }
_bz_bool canCollapse(int outerRank, int innerRank) const bool canCollapse(int outerRank, int innerRank) const {
{
#ifdef BZ_DEBUG_TRAVERSE #ifdef BZ_DEBUG_TRAVERSE
BZ_DEBUG_MESSAGE("stride(" << innerRank << ")=" << stride(innerRank ) BZ_DEBUG_MESSAGE("stride(" << innerRank << ")=" << stride(innerRank )
<< ", extent()=" << extent(innerRank) << ", stride(outerRank)=" << ", extent()=" << extent(innerRank) << ", stride(outerRank)="
<< stride(outerRank)); << stride(outerRank));
#endif #endif
return (stride(innerRank) * extent(innerRank) == stride(outerRank)) ; return (stride(innerRank) * extent(innerRank) == stride(outerRank)) ;
} }
protected: protected:
////////////////////////////////////////////// //////////////////////////////////////////////
skipping to change at line 2449 skipping to change at line 2365
Range r7, Range r8); Range r7, Range r8);
void constructSubarray(Array<T_numtype, N_rank>& array, Range r0, void constructSubarray(Array<T_numtype, N_rank>& array, Range r0,
Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6,
Range r7, Range r8, Range r9); Range r7, Range r8, Range r9);
void constructSubarray(Array<T_numtype, N_rank>& array, Range r0, void constructSubarray(Array<T_numtype, N_rank>& array, Range r0,
Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6,
Range r7, Range r8, Range r9, Range r10); Range r7, Range r8, Range r9, Range r10);
void calculateZeroOffset(); void calculateZeroOffset();
template<int N_rank2, class R0, class R1, class R2, class R3, class R4, template<int N_rank2, typename R0, typename R1, typename R2, typename R
class R5, class R6, class R7, class R8, class R9, class R10> 3, typename R4,
typename R5, typename R6, typename R7, typename R8, typename R9, ty
pename R10>
void constructSlice(Array<T_numtype, N_rank2>& array, R0 r0, R1 r1, R2 r2, void constructSlice(Array<T_numtype, N_rank2>& array, R0 r0, R1 r1, R2 r2,
R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10); R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10);
template<int N_rank2> template<int N_rank2>
void slice(int& setRank, Range r, Array<T_numtype,N_rank2>& array, void slice(int& setRank, Range r, Array<T_numtype,N_rank2>& array,
TinyVector<int,N_rank2>& rankMap, int sourceRank); TinyVector<int,N_rank2>& rankMap, int sourceRank);
template<int N_rank2> template<int N_rank2>
void slice(int& setRank, int i, Array<T_numtype,N_rank2>& array, void slice(int& setRank, int i, Array<T_numtype,N_rank2>& array,
TinyVector<int,N_rank2>& rankMap, int sourceRank); TinyVector<int,N_rank2>& rankMap, int sourceRank);
template<int N_rank2> template<int N_rank2>
void slice(int& setRank, nilArraySection, Array<T_numtype,N_rank2>& arr void slice(int&, nilArraySection, Array<T_numtype,N_rank2>&,
ay, TinyVector<int,N_rank2>&, int)
TinyVector<int,N_rank2>& rankMap, int sourceRank)
{ } { }
void doTranspose(int destRank, int sourceRank, T_array& array); void doTranspose(int destRank, int sourceRank, T_array& array);
protected: protected:
////////////////////////////////////////////// //////////////////////////////////////////////
// Data members // Data members
////////////////////////////////////////////// //////////////////////////////////////////////
// NB: adding new data members may require changes to ctors, reference( ) // NB: adding new data members may require changes to ctors, reference( )
skipping to change at line 2537 skipping to change at line 2453
const int seventhDim = 6; const int seventhDim = 6;
const int eighthDim = 7; const int eighthDim = 7;
const int ninthDim = 8; const int ninthDim = 8;
const int tenthDim = 9; const int tenthDim = 9;
const int eleventhDim = 10; const int eleventhDim = 10;
/* /*
* Global Functions * Global Functions
*/ */
template<class T_numtype> template<typename T_numtype>
ostream& operator<<(ostream&, const Array<T_numtype,1>&); ostream& operator<<(ostream&, const Array<T_numtype,1>&);
template<class T_numtype> template<typename T_numtype>
ostream& operator<<(ostream&, const Array<T_numtype,2>&); ostream& operator<<(ostream&, const Array<T_numtype,2>&);
template<class T_numtype, int N_rank> template<typename T_numtype, int N_rank>
ostream& operator<<(ostream&, const Array<T_numtype,N_rank>&); ostream& operator<<(ostream&, const Array<T_numtype,N_rank>&);
template<class T_numtype, int N_rank> template<typename T_numtype, int N_rank>
istream& operator>>(istream& is, Array<T_numtype,N_rank>& x); istream& operator>>(istream& is, Array<T_numtype,N_rank>& x);
template <typename P_numtype,int N_rank>
void swap(Array<P_numtype,N_rank>& a,Array<P_numtype,N_rank>& b) {
Array<P_numtype,N_rank> c(a);
a.reference(b);
b.reference(c);
}
template <typename P_expr>
void find(Array<TinyVector<int,P_expr::rank>,1>& indices,
const _bz_ArrayExpr<P_expr>& expr) {
find(indices,
static_cast< Array<typename P_expr::T_numtype,P_expr::rank> >(expr
));
}
template <typename P_numtype, int N_rank>
void find(Array<TinyVector<int,N_rank>,1>& indices,
const Array<P_numtype,N_rank>& exprVals) {
indices.resize(exprVals.size());
typename Array<P_numtype,N_rank>::const_iterator it, end = exprVals.end
();
int j=0;
for (it = exprVals.begin(); it != end; ++it)
if (*it)
indices(j++) = it.position();
if (j)
indices.resizeAndPreserve(j);
else
indices.free();
return;
}
BZ_NAMESPACE_END BZ_NAMESPACE_END
/* /*
* Include implementations of the member functions and some additional * Include implementations of the member functions and some additional
* global functions. * global functions.
*/ */
#include <blitz/array/iter.h> // Array iterators #include <blitz/array/iter.h> // Array iterators
#include <blitz/array/fastiter.h> // Fast Array iterators (for et) #include <blitz/array/fastiter.h> // Fast Array iterators (for et)
#include <blitz/array/expr.h> // Array expression objects #include <blitz/array/expr.h> // Array expression objects
 End of changes. 176 change blocks. 
379 lines changed or deleted 366 lines changed or added


 array-old.h   array-old.h 
/************************************************************************** * /************************************************************************** *
* blitz/array-old.h Maximal include version of Array<P_numtype, N_rank> * blitz/array-old.h Maximal include version of Array<P_numtype, N_rank>
* Note: see <blitz/array-impl.h> for the class def. * Note: see <blitz/array-impl.h> for the class def.
* *
* $Id: array-old.h,v 1.1 2002/07/02 19:23:59 jcumming Exp $ * $Id: array-old.h,v 1.2 2003/01/14 11:29:18 patricg Exp $
* *
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Log: array-old.h,v $
* Revision 1.1 2002/07/02 19:23:59 jcumming
* This is the new name for the old array.h header file that included all o
f the Array, TinyVector and Vector stuff along with Vector ET support. It
is now deprecated.
*
* Revision 1.4 2001/01/26 18:30:50 tveldhui
* More source code reorganization to reduce compile times.
*
*/
#ifndef BZ_ARRAY_OLD_H #ifndef BZ_ARRAY_OLD_H
#define BZ_ARRAY_OLD_H #define BZ_ARRAY_OLD_H
/* /*
* <blitz/array.h> used to include most of the Blitz++ library * <blitz/array.h> used to include most of the Blitz++ library
* functionality, totally ~ 120000 lines of source code. This * functionality, totally ~ 120000 lines of source code. This
* made for extremely slow compile times; processing #include <blitz/array. h> * made for extremely slow compile times; processing #include <blitz/array. h>
* took gcc about 25 seconds on a 500 MHz pentium box. * took gcc about 25 seconds on a 500 MHz pentium box.
* *
 End of changes. 2 change blocks. 
13 lines changed or deleted 3 lines changed or added


 array.h   array.h 
/************************************************************************** * /************************************************************************** *
* blitz/array.h Minimal include version of Array<T,N> * blitz/array.h Minimal include version of Array<T,N>
* *
* $Id: array.h,v 1.5 2002/07/02 19:22:00 jcumming Exp $ * $Id: array.h,v 1.6 2003/01/14 11:29:18 patricg Exp $
* *
* Copyright (C) 1997-2000 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997-2000 Todd Veldhuizen <tveldhui@oonumerics.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Log: array.h,v $
* Revision 1.5 2002/07/02 19:22:00 jcumming
* This file used to be called Array.h but has been renamed to avoid name
* clashes on Windows-based systems. This file includes only the Array
* class implementation files.
*
* Revision 1.1 2001/01/26 18:30:49 tveldhui
* More source code reorganization to reduce compile times.
*
* Revision 1.1 2001/01/24 22:51:50 tveldhui
* Reorganized #include orders to avoid including the huge Vector e.t.
* implementation when using Array.
*
*/
#ifndef BZ_ARRAY_ONLY_H #ifndef BZ_ARRAY_ONLY_H
#define BZ_ARRAY_ONLY_H #define BZ_ARRAY_ONLY_H
// See comments in <blitz/array-old.h> for an explanation of the new // See comments in <blitz/array-old.h> for an explanation of the new
// headers arrangement. // headers arrangement.
#include <blitz/array-impl.h> #include <blitz/array-impl.h>
#endif // BZ_ARRAY_ONLY_H #endif // BZ_ARRAY_ONLY_H
 End of changes. 2 change blocks. 
17 lines changed or deleted 3 lines changed or added


 asexpr.h   asexpr.h 
// -*- C++ -*-
/************************************************************************** * /************************************************************************** *
* blitz/array/asexpr.h Declaration of the asExpr helper functions * blitz/array/asexpr.h Declaration of the asExpr helper functions
* *
* $Id: asexpr.h,v 1.2 2001/01/25 00:25:55 tveldhui Exp $
*
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Log: asexpr.h,v $
* Revision 1.2 2001/01/25 00:25:55 tveldhui
* Ensured that source files have cvs logs.
*
*/
#ifndef BZ_ARRAYASEXPR_H #ifndef BZ_ARRAYASEXPR_H
#define BZ_ARRAYASEXPR_H #define BZ_ARRAYASEXPR_H
#ifndef BZ_ARRAY_H #ifndef BZ_ARRAY_H
#error <blitz/array/asexpr.h> must be included via <blitz/array.h> #error <blitz/array/asexpr.h> must be included via <blitz/array.h>
#endif #endif
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
// The traits class asExpr converts arbitrary things to // The traits class asExpr converts arbitrary things to
// expression templatable operands. // expression templatable operands.
// Default to scalar. // Default to scalar.
template<class T>
template <typename T>
struct asExpr { struct asExpr {
typedef _bz_ArrayExprConstant<T> T_expr; typedef _bz_ArrayExprConstant<T> T_expr;
static T_expr getExpr(const T& x) { return T_expr(x); }
}; };
// Already an expression template term // Already an expression template term
template<class T>
template <typename T>
struct asExpr<_bz_ArrayExpr<T> > { struct asExpr<_bz_ArrayExpr<T> > {
typedef _bz_ArrayExpr<T> T_expr; typedef _bz_ArrayExpr<T> T_expr;
static const T_expr& getExpr(const T_expr& x) { return x; }
}; };
// An array operand // An array operand
template<class T, int N>
template <typename T,int N>
struct asExpr<Array<T,N> > { struct asExpr<Array<T,N> > {
typedef FastArrayIterator<T,N> T_expr; typedef FastArrayIterator<T,N> T_expr;
static T_expr getExpr(const Array<T,N>& x) { return x.beginFast(); }
}; };
// Index placeholder // Index placeholder
template<int N>
template <int N>
struct asExpr<IndexPlaceholder<N> > { struct asExpr<IndexPlaceholder<N> > {
typedef IndexPlaceholder<N> T_expr; typedef IndexPlaceholder<N> T_expr;
static T_expr getExpr(T_expr x) { return x; }
}; };
#ifdef BZ_HAVE_TEMPLATES_AS_TEMPLATE_ARGUMENTS
// A traits class that provides the return type of a binary operation.
template <template <typename T1> class OP, typename O1>
struct BzUnaryExprResult {
typedef _bz_ArrayExpr<_bz_ArrayExprUnaryOp<
typename asExpr<O1>::T_expr,
OP<typename asExpr<O1>::T_expr::T_numtype> > > T_result;
};
template <template <typename T1, typename T2> class OP,
typename O1, typename O2>
struct BzBinaryExprResult {
typedef _bz_ArrayExpr<_bz_ArrayExprBinaryOp<
typename asExpr<O1>::T_expr,
typename asExpr<O2>::T_expr,
OP<typename asExpr<O1>::T_expr::T_numtype,
typename asExpr<O2>::T_expr::T_numtype> > > T_result;
};
template <template <typename T1, typename T2, typename T3> class OP,
typename O1, typename O2, typename O3>
struct BzTernaryExprResult {
typedef _bz_ArrayExpr<_bz_ArrayExprTernaryOp<
typename asExpr<O1>::T_expr,
typename asExpr<O2>::T_expr,
typename asExpr<O3>::T_expr,
OP<typename asExpr<O1>::T_expr::T_numtype,
typename asExpr<O2>::T_expr::T_numtype,
typename asExpr<O3>::T_expr::T_numtype> > > T_result;
};
#endif /* BZ_HAVE_TEMPLATES_AS_TEMPLATE_ARGUMENTS */
BZ_NAMESPACE_END BZ_NAMESPACE_END
#endif #endif
 End of changes. 12 change blocks. 
18 lines changed or deleted 54 lines changed or added


 bench.cc   bench.cc 
/* /*
* $Id: bench.cc,v 1.1.1.1 2000/06/19 12:26:08 tveldhui Exp $
*
* Copyright (C) 1997 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997 Todd Veldhuizen <tveldhui@oonumerics.org>
* All rights reserved. Please see <blitz/blitz.h> for terms and * All rights reserved. Please see <blitz/blitz.h> for terms and
* conditions of use. * conditions of use.
* *
* $Log: bench.cc,v $
* Revision 1.1.1.1 2000/06/19 12:26:08 tveldhui
* Imported sources
*
* Revision 1.5 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.4 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
* Revision 1.3 1997/01/24 14:42:00 tveldhui
* Periodic RCS update
*
*/ */
#ifndef BZ_BENCH_CC #ifndef BZ_BENCH_CC
#define BZ_BENCH_CC #define BZ_BENCH_CC
#ifndef BZ_BENCH_H #ifndef BZ_BENCH_H
#error <blitz/bench.cc> must be included via <blitz/bench.h> #error <blitz/bench.cc> must be included via <blitz/bench.h>
#endif #endif
#ifdef BZ_HAVE_STD #ifdef BZ_HAVE_STD
#include <fstream> #include <fstream>
#else #else
#include <fstream.h> #include <fstream.h>
#endif #endif
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
template<class P_parameter> template<typename P_parameter>
Benchmark<P_parameter>::Benchmark(unsigned numImplementations) Benchmark<P_parameter>::Benchmark(unsigned numImplementations)
{ {
state_ = uninitialized; state_ = uninitialized;
numImplementations_ = numImplementations; numImplementations_ = numImplementations;
numStoredImplementations_ = 0; numStoredImplementations_ = 0;
implementations_ = new BenchmarkImplementation<P_parameter>* [numImplem entations_]; implementations_ = new BenchmarkImplementation<P_parameter>* [numImplem entations_];
rates_.resize(numImplementations, numParameterSettings()); rates_.resize(numImplementations, numParameterSettings());
Mflops_.resize(numImplementations, numParameterSettings()); Mflops_.resize(numImplementations, numParameterSettings());
} }
template<class P_parameter> template<typename P_parameter>
Benchmark<P_parameter>::~Benchmark() Benchmark<P_parameter>::~Benchmark()
{ {
delete [] implementations_; delete [] implementations_;
} }
template<class P_parameter> template<typename P_parameter>
void Benchmark<P_parameter>::addImplementation( void Benchmark<P_parameter>::addImplementation(
BenchmarkImplementation<P_parameter> * implementation) BenchmarkImplementation<P_parameter> * implementation)
{ {
BZPRECONDITION(state_ == uninitialized); BZPRECONDITION(state_ == uninitialized);
BZPRECONDITION(numStoredImplementations_ < numImplementations_); BZPRECONDITION(numStoredImplementations_ < numImplementations_);
implementations_[numStoredImplementations_++] = implementation; implementations_[numStoredImplementations_++] = implementation;
if (numStoredImplementations_ == numImplementations_) if (numStoredImplementations_ == numImplementations_)
state_ = initialized; state_ = initialized;
} }
template<class P_parameter> template<typename P_parameter>
void Benchmark<P_parameter>::run(ostream& log) void Benchmark<P_parameter>::run(ostream& log)
{ {
BZPRECONDITION(state_ == initialized); BZPRECONDITION(state_ == initialized);
state_ = running; state_ = running;
Timer t; Timer t;
for (unsigned j=0; j < numImplementations_; ++j) for (unsigned j=0; j < numImplementations_; ++j)
{ {
for (unsigned i=0; i < numParameterSettings(); ++i) for (unsigned i=0; i < numParameterSettings(); ++i)
skipping to change at line 120 skipping to change at line 105
log << endl; log << endl;
log.flush(); log.flush();
implementations_[j]->done(); implementations_[j]->done();
} }
} }
state_ = done; state_ = done;
} }
template<class P_parameter> template<typename P_parameter>
double Benchmark<P_parameter>::getMflops(unsigned implementation, double Benchmark<P_parameter>::getMflops(unsigned implementation,
unsigned setting) const unsigned setting) const
{ {
BZPRECONDITION(state_ == done); BZPRECONDITION(state_ == done);
BZPRECONDITION(implementation < numImplementations_); BZPRECONDITION(implementation < numImplementations_);
BZPRECONDITION(setting < numParameterSettings()); BZPRECONDITION(setting < numParameterSettings());
return Mflops_(implementation, setting); return Mflops_(implementation, setting);
} }
template<class P_parameter> template<typename P_parameter>
double Benchmark<P_parameter>::getRate(unsigned implementation, double Benchmark<P_parameter>::getRate(unsigned implementation,
unsigned setting) const unsigned setting) const
{ {
BZPRECONDITION(state_ == done); BZPRECONDITION(state_ == done);
BZPRECONDITION(implementation < numImplementations_); BZPRECONDITION(implementation < numImplementations_);
BZPRECONDITION(setting < numParameterSettings()); BZPRECONDITION(setting < numParameterSettings());
return rates_(implementation, setting); return rates_(implementation, setting);
} }
template<class P_parameter> template<typename P_parameter>
void Benchmark<P_parameter>::saveMatlabGraph(const char* filename) const void Benchmark<P_parameter>::saveMatlabGraph(const char* filename) const
{ {
BZPRECONDITION(state_ == done); BZPRECONDITION(state_ == done);
ofstream ofs(filename); ofstream ofs(filename);
assert(ofs.good()); assert(ofs.good());
ofs << "% This matlab file generated automatically by class Benchmark" ofs << "% This matlab file generated automatically by class Benchmark"
<< endl << "% of the Blitz++ class library." << endl << endl; << endl << "% of the Blitz++ class library." << endl << endl;
 End of changes. 9 change blocks. 
22 lines changed or deleted 7 lines changed or added


 bench.h   bench.h 
skipping to change at line 22 skipping to change at line 22
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Id: bench.h,v 1.3 2001/01/25 00:25:54 tveldhui Exp $
*
* $Log: bench.h,v $
* Revision 1.3 2001/01/25 00:25:54 tveldhui
* Ensured that source files have cvs logs.
*
* Revision 1.2 2001/01/24 20:22:49 tveldhui
* Updated copyright date in headers.
*
* Revision 1.1.1.1 2000/06/19 12:26:08 tveldhui
* Imported sources
*
* Revision 1.4 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.3 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
* Revision 1.2 1997/01/24 14:30:34 tveldhui
* Prior to rewrite of Bench class; in this version, Bench contains
* each benchmark implementation.
*
*/
#ifndef BZ_BENCH_H #ifndef BZ_BENCH_H
#define BZ_BENCH_H #define BZ_BENCH_H
#ifndef BZ_MATRIX_H #ifndef BZ_MATRIX_H
#include <blitz/matrix.h> #include <blitz/matrix.h>
#endif #endif
#ifndef BZ_TIMER_H #ifndef BZ_TIMER_H
#include <blitz/timer.h> #include <blitz/timer.h>
#endif #endif
#include <math.h> #include <math.h>
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
// Forward declaration // Forward declaration
template<class P_parameter = unsigned> template<typename P_parameter = unsigned>
class BenchmarkImplementation; class BenchmarkImplementation;
// Declaration of class Benchmark<T> // Declaration of class Benchmark<T>
// The template parameter T is the parameter type which is varied in // The template parameter T is the parameter type which is varied in
// the benchmark. Typically T will be an unsigned, and will represent // the benchmark. Typically T will be an unsigned, and will represent
// the length of a vector, size of an array, etc. // the length of a vector, size of an array, etc.
template<class P_parameter = unsigned> template<typename P_parameter = unsigned>
class Benchmark { class Benchmark {
public: public:
typedef P_parameter T_parameter; typedef P_parameter T_parameter;
Benchmark(unsigned numImplementations); Benchmark(unsigned numImplementations);
~Benchmark(); ~Benchmark();
void addImplementation(BenchmarkImplementation<T_parameter>* void addImplementation(BenchmarkImplementation<T_parameter>*
skipping to change at line 125 skipping to change at line 102
unsigned numImplementations_; unsigned numImplementations_;
unsigned numStoredImplementations_; unsigned numStoredImplementations_;
BenchmarkImplementation<T_parameter>** implementations_; BenchmarkImplementation<T_parameter>** implementations_;
Matrix<double,RowMajor> rates_; // Iterations per second array Matrix<double,RowMajor> rates_; // Iterations per second array
Matrix<double,RowMajor> Mflops_; Matrix<double,RowMajor> Mflops_;
}; };
template<class P_parameter> template<typename P_parameter>
class BenchmarkImplementation { class BenchmarkImplementation {
public: public:
typedef P_parameter T_parameter; typedef P_parameter T_parameter;
virtual void initialize(P_parameter parameter) { } virtual void initialize(P_parameter parameter) { }
virtual void done() { } virtual void done() { }
virtual const char* implementationName() const virtual const char* implementationName() const
 End of changes. 4 change blocks. 
28 lines changed or deleted 5 lines changed or added


 benchext.cc   benchext.cc 
/* /*
* $Id: benchext.cc,v 1.3 2002/06/28 05:05:58 jcumming Exp $
*
* Copyright (C) 1997 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997 Todd Veldhuizen <tveldhui@oonumerics.org>
* All rights reserved. Please see <blitz/blitz.h> for terms and * All rights reserved. Please see <blitz/blitz.h> for terms and
* conditions of use. * conditions of use.
* *
* $Log: benchext.cc,v $
* Revision 1.3 2002/06/28 05:05:58 jcumming
* Changed loop variable j to unsigned to eliminate signed/unsigned compari
sons.
*
* Revision 1.2 2001/01/26 18:30:50 tveldhui
* More source code reorganization to reduce compile times.
*
* Revision 1.1.1.1 2000/06/19 12:26:11 tveldhui
* Imported sources
*
* Revision 1.2 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.1 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
*/ */
#ifndef BZ_BENCHEXT_CC #ifndef BZ_BENCHEXT_CC
#define BZ_BENCHEXT_CC #define BZ_BENCHEXT_CC
#ifndef BZ_BENCHEXT_H #ifndef BZ_BENCHEXT_H
#error <blitz/benchext.cc> must be included via <blitz/benchext.h> #error <blitz/benchext.cc> must be included via <blitz/benchext.h>
#endif #endif
#include <blitz/vector-et.h> #include <blitz/vector-et.h>
#ifdef BZ_HAVE_STD #ifdef BZ_HAVE_STD
#include <fstream> #include <fstream>
#else #else
#include <fstream.h> #include <fstream.h>
#endif #endif
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
template<class P_parameter> template<typename P_parameter>
BenchmarkExt<P_parameter>::BenchmarkExt(const char* name, BenchmarkExt<P_parameter>::BenchmarkExt(const char* name,
int numImplementations) int numImplementations)
{ {
BZPRECONDITION(numImplementations > 0); BZPRECONDITION(numImplementations > 0);
description_ = name; description_ = name;
numImplementations_ = numImplementations; numImplementations_ = numImplementations;
implementationDescriptions_.resize(numImplementations); implementationDescriptions_.resize(numImplementations);
parameterDescription_ = "Vector length"; parameterDescription_ = "Vector length";
rateDescription_ = "Mflops/s"; rateDescription_ = "Mflops/s";
// Set up default parameters and iterations // Set up default parameters and iterations
setNumParameters(19); setNumParameters(19);
// NEEDS_WORK: once pow(X,Y) is supported, can just say // NEEDS_WORK: once pow(X,Y) is supported, can just say
// parameters_ = pow(10.0, Range(1,20)/4.0); // parameters_ = pow(10.0, Range(1,20)/4.0);
for (int i=0; i < numParameters_; ++i) for (unsigned i=0; i < numParameters_; ++i)
parameters_[i] = (P_parameter)::pow(10.0, (i+1)/4.0); parameters_[i] = (P_parameter)::pow(10.0, (i+1)/4.0);
iterations_ = 5.0e+5 / parameters_; iterations_ = 5.0e+5 / parameters_;
flopsPerIteration_ = parameters_; flopsPerIteration_ = parameters_;
// Set up initial state // Set up initial state
state_ = initializing; state_ = initializing;
implementationNumber_ = 0; implementationNumber_ = 0;
} }
template<class P_parameter> template<typename P_parameter>
BenchmarkExt<P_parameter>::~BenchmarkExt() BenchmarkExt<P_parameter>::~BenchmarkExt()
{ {
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::setNumParameters(int numParameters) void BenchmarkExt<P_parameter>::setNumParameters(int numParameters)
{ {
BZPRECONDITION(state_ == initializing); //BZPRECONDITION(state_ == initializing);
numParameters_ = numParameters; numParameters_ = numParameters;
parameters_.resize(numParameters_); parameters_.resize(numParameters_);
iterations_.resize(numParameters_); iterations_.resize(numParameters_);
flopsPerIteration_.resize(numParameters_); flopsPerIteration_.resize(numParameters_);
// Set up timer and Mflops array // Set up timer and Mflops array
times_.resize(numImplementations_, numParameters_); times_.resize(numImplementations_, numParameters_);
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::setParameterVector(Vector<P_parameter> parm s) void BenchmarkExt<P_parameter>::setParameterVector(Vector<P_parameter> parm s)
{ {
BZPRECONDITION(state_ == initializing); BZPRECONDITION(state_ == initializing);
BZPRECONDITION(parms.length() == parameters_.length()); BZPRECONDITION(parms.length() == parameters_.length());
// NEEDS_WORK: should use operator=(), once that problem // NEEDS_WORK: should use operator=(), once that problem
// gets sorted out. // gets sorted out.
// parameters_ = parms; // parameters_ = parms;
for (int i=0; i < parameters_.length(); ++i) for (int i=0; i < parameters_.length(); ++i)
parameters_[i] = parms(i); parameters_[i] = parms(i);
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::setParameterDescription(const char* string) void BenchmarkExt<P_parameter>::setParameterDescription(const char* string)
{ {
parameterDescription_ = string; parameterDescription_ = string;
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::setIterations(Vector<long> iters) void BenchmarkExt<P_parameter>::setIterations(Vector<long> iters)
{ {
BZPRECONDITION(state_ == initializing); BZPRECONDITION(state_ == initializing);
// NEEDS_WORK: should use operator=(), once that problem // NEEDS_WORK: should use operator=(), once that problem
// gets sorted out. // gets sorted out.
// iterations_ = iters; // iterations_ = iters;
for (int i=0; i < iterations_.length(); ++i) for (int i=0; i < iterations_.length(); ++i)
iterations_[i] = iters(i); iterations_[i] = iters(i);
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::setFlopsPerIteration(Vector<double> void BenchmarkExt<P_parameter>::setFlopsPerIteration(Vector<double>
flopsPerIteration) flopsPerIteration)
{ {
BZPRECONDITION(flopsPerIteration_.length() == flopsPerIteration.length( )); BZPRECONDITION(flopsPerIteration_.length() == flopsPerIteration.length( ));
// NEEDS_WORK: should use operator=(), once that problem // NEEDS_WORK: should use operator=(), once that problem
// gets sorted out. // gets sorted out.
// flopsPerIteration_ = flopsPerIteration; // flopsPerIteration_ = flopsPerIteration;
for (int i=0; i < flopsPerIteration_.length(); ++i) for (int i=0; i < flopsPerIteration_.length(); ++i)
flopsPerIteration_[i] = flopsPerIteration[i]; flopsPerIteration_[i] = flopsPerIteration[i];
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::setRateDescription(const char* string) void BenchmarkExt<P_parameter>::setRateDescription(const char* string)
{ {
rateDescription_ = string; rateDescription_ = string;
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::beginBenchmarking() void BenchmarkExt<P_parameter>::beginBenchmarking()
{ {
BZPRECONDITION(state_ == initializing); BZPRECONDITION(state_ == initializing);
state_ = benchmarking; state_ = benchmarking;
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::beginImplementation(const char* description ) void BenchmarkExt<P_parameter>::beginImplementation(const char* description )
{ {
BZPRECONDITION(implementationNumber_ < numImplementations_); BZPRECONDITION(implementationNumber_ < numImplementations_);
BZPRECONDITION(state_ == benchmarking); BZPRECONDITION(state_ == benchmarking);
implementationDescriptions_[implementationNumber_] = description; implementationDescriptions_[implementationNumber_] = description;
state_ = benchmarkingImplementation; state_ = benchmarkingImplementation;
parameterNumber_ = 0; parameterNumber_ = 0;
} }
template<class P_parameter> template<typename P_parameter>
_bz_bool BenchmarkExt<P_parameter>::doneImplementationBenchmark() const bool BenchmarkExt<P_parameter>::doneImplementationBenchmark() const
{ {
BZPRECONDITION(state_ == benchmarkingImplementation); BZPRECONDITION(state_ == benchmarkingImplementation);
return parameterNumber_ == numParameters_; return parameterNumber_ == numParameters_;
} }
template<class P_parameter> template<typename P_parameter>
P_parameter BenchmarkExt<P_parameter>::getParameter() const P_parameter BenchmarkExt<P_parameter>::getParameter() const
{ {
BZPRECONDITION(state_ == benchmarkingImplementation); BZPRECONDITION(state_ == benchmarkingImplementation);
BZPRECONDITION(parameterNumber_ >= 0);
BZPRECONDITION(parameterNumber_ < numParameters_); BZPRECONDITION(parameterNumber_ < numParameters_);
return parameters_[parameterNumber_]; return parameters_[parameterNumber_];
} }
template<class P_parameter> template<typename P_parameter>
long BenchmarkExt<P_parameter>::getIterations() const long BenchmarkExt<P_parameter>::getIterations() const
{ {
BZPRECONDITION(state_ == benchmarkingImplementation); BZPRECONDITION(state_ == benchmarkingImplementation);
BZPRECONDITION(parameterNumber_ >= 0);
BZPRECONDITION(parameterNumber_ < numParameters_); BZPRECONDITION(parameterNumber_ < numParameters_);
return iterations_[parameterNumber_]; return iterations_[parameterNumber_];
} }
template<class P_parameter> template<typename P_parameter>
inline void BenchmarkExt<P_parameter>::start() inline void BenchmarkExt<P_parameter>::start()
{ {
BZPRECONDITION(state_ == benchmarkingImplementation); BZPRECONDITION(state_ == benchmarkingImplementation);
BZPRECONDITION(parameterNumber_ < numParameters_); BZPRECONDITION(parameterNumber_ < numParameters_);
state_ = running; state_ = running;
timer_.start(); timer_.start();
} }
template<class P_parameter> template<typename P_parameter>
inline void BenchmarkExt<P_parameter>::stop() inline void BenchmarkExt<P_parameter>::stop()
{ {
timer_.stop(); timer_.stop();
BZPRECONDITION(state_ == running); BZPRECONDITION(state_ == running);
state_ = benchmarkingImplementation; state_ = benchmarkingImplementation;
times_(implementationNumber_, parameterNumber_) = timer_.elapsedSeconds (); times_(implementationNumber_, parameterNumber_) = timer_.elapsedSeconds ();
++parameterNumber_; ++parameterNumber_;
} }
template<class P_parameter> template<typename P_parameter>
inline void BenchmarkExt<P_parameter>::startOverhead() inline void BenchmarkExt<P_parameter>::startOverhead()
{ {
BZPRECONDITION(state_ == benchmarkingImplementation); BZPRECONDITION(state_ == benchmarkingImplementation);
BZPRECONDITION(parameterNumber_ > 0); BZPRECONDITION(parameterNumber_ > 0);
BZPRECONDITION(parameterNumber_ <= numParameters_); BZPRECONDITION(parameterNumber_ <= numParameters_);
state_ = runningOverhead; state_ = runningOverhead;
overheadTimer_.start(); overheadTimer_.start();
} }
template<class P_parameter> template<typename P_parameter>
inline void BenchmarkExt<P_parameter>::stopOverhead() inline void BenchmarkExt<P_parameter>::stopOverhead()
{ {
BZPRECONDITION(state_ == runningOverhead); BZPRECONDITION(state_ == runningOverhead);
overheadTimer_.stop(); overheadTimer_.stop();
times_(implementationNumber_, parameterNumber_-1) -= times_(implementationNumber_, parameterNumber_-1) -=
overheadTimer_.elapsedSeconds(); overheadTimer_.elapsedSeconds();
state_ = benchmarkingImplementation; state_ = benchmarkingImplementation;
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::endImplementation() void BenchmarkExt<P_parameter>::endImplementation()
{ {
BZPRECONDITION(state_ == benchmarkingImplementation); BZPRECONDITION(state_ == benchmarkingImplementation);
BZPRECONDITION(parameterNumber_ == numParameters_); BZPRECONDITION(parameterNumber_ == numParameters_);
++implementationNumber_; ++implementationNumber_;
state_ = benchmarking; state_ = benchmarking;
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::endBenchmarking() void BenchmarkExt<P_parameter>::endBenchmarking()
{ {
BZPRECONDITION(state_ == benchmarking); BZPRECONDITION(state_ == benchmarking);
BZPRECONDITION(implementationNumber_ == numImplementations_); BZPRECONDITION(implementationNumber_ == numImplementations_);
state_ = done; state_ = done;
} }
template<class P_parameter> template<typename P_parameter>
double BenchmarkExt<P_parameter>::getMflops(unsigned implementation, double BenchmarkExt<P_parameter>::getMflops(unsigned implementation,
unsigned parameterNum) const unsigned parameterNum) const
{ {
BZPRECONDITION(state_ == done); BZPRECONDITION(state_ == done);
BZPRECONDITION(implementation < numImplementations_); BZPRECONDITION(implementation < numImplementations_);
BZPRECONDITION(parameterNum < numParameters_); BZPRECONDITION(parameterNum < numParameters_);
return iterations_(parameterNum) * flopsPerIteration_(parameterNum) return iterations_(parameterNum) * flopsPerIteration_(parameterNum)
/ times_(implementation, parameterNum) / 1.0e+6; / times_(implementation, parameterNum) / 1.0e+6;
} }
template<class P_parameter> template<typename P_parameter>
void BenchmarkExt<P_parameter>::saveMatlabGraph(const char* filename) const void BenchmarkExt<P_parameter>::saveMatlabGraph(const char* filename, const
char* graphType) const
{ {
BZPRECONDITION(state_ == done); BZPRECONDITION(state_ == done);
ofstream ofs(filename); ofstream ofs(filename);
assert(ofs.good()); assert(ofs.good());
ofs << "% This matlab file generated automatically by class Benchmark" ofs << "% This matlab file generated automatically by class Benchmark"
<< endl << "% of the Blitz++ class library." << endl << endl; << endl << "% of the Blitz++ class library." << endl << endl;
ofs.setf(ios::scientific); ofs.setf(ios::scientific);
// This will be a lot simpler once Matlab-style output formatting // This will be a lot simpler once Matlab-style output formatting
// of vectors & matrices is finished. // of vectors & matrices is finished.
// ofs << "parm = " << parameters_ << ";" << endl << endl; // ofs << "parm = " << parameters_ << ";" << endl << endl;
ofs << "parm = [ "; ofs << "parm = [ ";
int i; unsigned i;
for (i=0; i < numParameters_; ++i) for (i=0; i < numParameters_; ++i)
ofs << setprecision(12) << double(parameters_[i]) << " "; ofs << setprecision(12) << double(parameters_[i]) << " ";
ofs << "]; " << endl << endl; ofs << "]; " << endl << endl;
ofs << "Mf = [ "; ofs << "Mf = [ ";
for (i=0; i < numParameters_; ++i) for (i=0; i < numParameters_; ++i)
{ {
for (unsigned j=0; j < numImplementations_; ++j) for (unsigned j=0; j < numImplementations_; ++j)
{ {
ofs << setprecision(12) << getMflops(j,i) << " "; ofs << setprecision(12) << getMflops(j,i) << " ";
} }
if (i != numParameters_ - 1) if (i != numParameters_ - 1)
ofs << ";" << endl; ofs << ";" << endl;
} }
ofs << "] ;" << endl << endl; ofs << "] ;" << endl << endl;
ofs << "semilogx(parm,Mf), title('" << description_ << "'), " << endl ofs << graphType << "(parm,Mf), title('" << description_ << "'), " << e ndl
<< " xlabel('" << parameterDescription_ << "'), " << " xlabel('" << parameterDescription_ << "'), "
<< "ylabel('" << rateDescription_ << "')" << endl << "ylabel('" << rateDescription_ << "')" << endl
<< "legend("; << "legend(";
for (unsigned j=0; j < numImplementations_; ++j) for (unsigned j=0; j < numImplementations_; ++j)
{ {
ofs << "'" << implementationDescriptions_(j) << "'"; ofs << "'" << implementationDescriptions_(j) << "'";
if (j != numImplementations_ - 1) if (j != numImplementations_ - 1)
ofs << ", "; ofs << ", ";
} }
 End of changes. 29 change blocks. 
48 lines changed or deleted 28 lines changed or added


 benchext.h   benchext.h 
skipping to change at line 23 skipping to change at line 23
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Id: benchext.h,v 1.3 2001/01/25 00:25:54 tveldhui Exp $
*
* $Log: benchext.h,v $
* Revision 1.3 2001/01/25 00:25:54 tveldhui
* Ensured that source files have cvs logs.
*
* Revision 1.2 2001/01/24 20:22:49 tveldhui
* Updated copyright date in headers.
*
* Revision 1.1.1.1 2000/06/19 12:26:11 tveldhui
* Imported sources
*
* Revision 1.2 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.1 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
*/
#ifndef BZ_BENCHEXT_H #ifndef BZ_BENCHEXT_H
#define BZ_BENCHEXT_H #define BZ_BENCHEXT_H
#ifndef BZ_MATRIX_H #ifndef BZ_MATRIX_H
#include <blitz/matrix.h> #include <blitz/matrix.h>
#endif #endif
#ifndef BZ_TIMER_H #ifndef BZ_TIMER_H
#include <blitz/timer.h> #include <blitz/timer.h>
skipping to change at line 67 skipping to change at line 48
// NEEDS_WORK: replace use of const char* with <string>, once standard // NEEDS_WORK: replace use of const char* with <string>, once standard
// library is widely supported. // library is widely supported.
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
// Declaration of class BenchmarkExt<T> // Declaration of class BenchmarkExt<T>
// The template parameter T is the parameter type which is varied in // The template parameter T is the parameter type which is varied in
// the benchmark. Typically T will be an unsigned, and will represent // the benchmark. Typically T will be an unsigned, and will represent
// the length of a vector, size of an array, etc. // the length of a vector, size of an array, etc.
template<class P_parameter = unsigned> template<typename P_parameter = unsigned>
class BenchmarkExt { class BenchmarkExt {
public: public:
typedef P_parameter T_parameter; typedef P_parameter T_parameter;
BenchmarkExt(const char* description, int numImplementations); BenchmarkExt(const char* description, int numImplementations);
~BenchmarkExt(); ~BenchmarkExt();
void setNumParameters(int numParameters); void setNumParameters(int numParameters);
void setParameterVector(Vector<T_parameter> parms); void setParameterVector(Vector<T_parameter> parms);
void setParameterDescription(const char* string); void setParameterDescription(const char* string);
void setIterations(Vector<long> iters); void setIterations(Vector<long> iters);
void setFlopsPerIteration(Vector<double> flopsPerIteration); void setFlopsPerIteration(Vector<double> flopsPerIteration);
void setRateDescription(const char* string); void setRateDescription(const char* string);
void beginBenchmarking(); void beginBenchmarking();
void beginImplementation(const char* description); void beginImplementation(const char* description);
_bz_bool doneImplementationBenchmark() const; bool doneImplementationBenchmark() const;
T_parameter getParameter() const; T_parameter getParameter() const;
long getIterations() const; long getIterations() const;
inline void start(); inline void start();
inline void stop(); inline void stop();
void startOverhead(); void startOverhead();
void stopOverhead(); void stopOverhead();
void endImplementation(); void endImplementation();
void endBenchmarking(); void endBenchmarking();
double getMflops(unsigned implementation, unsigned parameterNum) const; double getMflops(unsigned implementation, unsigned parameterNum) const;
void saveMatlabGraph(const char* filename) const; void saveMatlabGraph(const char* filename, const char* graphType="semil ogx") const;
protected: protected:
BenchmarkExt(const BenchmarkExt<P_parameter>&) { } BenchmarkExt(const BenchmarkExt<P_parameter>&) { }
void operator=(const BenchmarkExt<P_parameter>&) { } void operator=(const BenchmarkExt<P_parameter>&) { }
enum { initializing, benchmarking, benchmarkingImplementation, enum { initializing, benchmarking, benchmarkingImplementation,
running, runningOverhead, done } state_; running, runningOverhead, done } state_;
unsigned numImplementations_; unsigned numImplementations_;
unsigned implementationNumber_; unsigned implementationNumber_;
skipping to change at line 132 skipping to change at line 113
Vector<T_parameter> parameters_; Vector<T_parameter> parameters_;
Vector<long> iterations_; Vector<long> iterations_;
Vector<double> flopsPerIteration_; Vector<double> flopsPerIteration_;
Timer timer_; Timer timer_;
Timer overheadTimer_; Timer overheadTimer_;
const char* parameterDescription_; const char* parameterDescription_;
const char* rateDescription_; const char* rateDescription_;
int numParameters_; unsigned numParameters_;
int parameterNumber_; unsigned parameterNumber_;
}; };
BZ_NAMESPACE_END BZ_NAMESPACE_END
#include <blitz/benchext.cc> #include <blitz/benchext.cc>
#endif // BZ_BENCHEXT_H #endif // BZ_BENCHEXT_H
 End of changes. 5 change blocks. 
26 lines changed or deleted 7 lines changed or added


 blitz.h   blitz.h 
// -*- C++ -*-
/************************************************************************** * /************************************************************************** *
* blitz/blitz.h Includes all the important header files * blitz/blitz.h Includes all the important header files
* *
* $Id: blitz.h,v 1.9 2002/07/19 20:40:32 jcumming Exp $ * $Id: blitz.h,v 1.14 2005/05/18 23:35:55 julianc Exp $
* *
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-dev@oonumerics.org
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@oonumerics.org
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://oonumerics.org/blitz/
* *
************************************************************************** **************************************************************************
* */
* $Log: blitz.h,v $
* Revision 1.9 2002/07/19 20:40:32 jcumming
* Put ending semicolon into definition of BZ_MUTEX_* macros so that you
* don't need to add a semicolon after invoking the macro.
*
* Revision 1.8 2001/02/15 13:13:30 tveldhui
* Fixed problem with BZ_THREADSAFE macros
*
* Revision 1.7 2001/02/11 22:03:44 tveldhui
* Fixed minor typo in blitz.h
*
* Revision 1.6 2001/02/04 22:36:41 tveldhui
* Oops, was including <pthread.h> inside the blitz namespace.
*
* Revision 1.5 2001/02/04 16:32:28 tveldhui
* Made memory block reference counting (optionally) threadsafe when
* BZ_THREADSAFE is defined. Currently uses pthread mutex.
* When compiling with gcc -pthread, _REENTRANT automatically causes
* BZ_THREADSAFE to be enabled.
*
* Revision 1.4 2001/01/26 18:30:50 tveldhui
* More source code reorganization to reduce compile times.
*
* Revision 1.3 2001/01/24 22:51:50 tveldhui
* Reorganized #include orders to avoid including the huge Vector e.t.
* implementation when using Array.
*
* Revision 1.2 2001/01/24 20:22:49 tveldhui
* Updated copyright date in headers.
*
* Revision 1.1.1.1 2000/06/19 12:26:08 tveldhui
* Imported sources
*
* Revision 1.7 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.6 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
* Revision 1.5 1997/01/24 14:42:00 tveldhui
* Periodic RCS update
*
* Revision 1.4 1997/01/23 03:28:28 tveldhui
* Periodic RCS update
*
* Revision 1.3 1997/01/13 22:19:58 tveldhui
* Periodic RCS update
*
* Revision 1.2 1996/11/11 17:29:13 tveldhui
* Periodic RCS update
*
* Revision 1.1 1996/04/14 21:13:00 todd
* Initial revision
*
*/
#ifndef BZ_BLITZ_H #ifndef BZ_BLITZ_H
#define BZ_BLITZ_H #define BZ_BLITZ_H
/* /*
* These symbols allow use of the IEEE and System V math libraries * These symbols allow use of the IEEE and System V math libraries
* (libm.a and libmsaa.a) on some platforms. * (libm.a and libmsaa.a) on some platforms.
*/ */
#ifdef BZ_ENABLE_XOPEN_SOURCE #ifdef BZ_ENABLE_XOPEN_SOURCE
skipping to change at line 118 skipping to change at line 64
#ifdef BZ_HAVE_STD #ifdef BZ_HAVE_STD
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#else #else
#include <iostream.h> #include <iostream.h>
#include <iomanip.h> #include <iomanip.h>
#endif #endif
#ifdef BZ_MATH_FN_IN_NAMESPACE_STD #ifdef BZ_MATH_FN_IN_NAMESPACE_STD
#include <cmath> #include <cmath>
#else
#include <math.h>
#endif #endif
#include <math.h>
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
#include <complex> #include <complex>
#endif #endif
#define BZ_THROW // Needed in <blitz/numinquire.h> #define BZ_THROW // Needed in <blitz/numinquire.h>
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
#ifdef BZ_HAVE_STD #ifdef BZ_HAVE_STD
BZ_USING_NAMESPACE(std) BZ_USING_NAMESPACE(std)
skipping to change at line 166 skipping to change at line 112
* Which mutex implementation should be used for synchronizing * Which mutex implementation should be used for synchronizing
* reference counts. Currently only one option -- pthreads. * reference counts. Currently only one option -- pthreads.
*/ */
#ifdef BZ_THREADSAFE #ifdef BZ_THREADSAFE
#define BZ_THREADSAFE_USE_PTHREADS #define BZ_THREADSAFE_USE_PTHREADS
#endif #endif
#ifdef BZ_THREADSAFE_USE_PTHREADS #ifdef BZ_THREADSAFE_USE_PTHREADS
#include <pthread.h> #include <pthread.h>
#define BZ_MUTEX_DECLARE(name) pthread_mutex_t name; #define BZ_MUTEX_DECLARE(name) mutable pthread_mutex_t name;
#define BZ_MUTEX_INIT(name) pthread_mutex_init(&name,NULL); #define BZ_MUTEX_INIT(name) pthread_mutex_init(&name,NULL);
#define BZ_MUTEX_LOCK(name) pthread_mutex_lock(&name); #define BZ_MUTEX_LOCK(name) pthread_mutex_lock(&name);
#define BZ_MUTEX_UNLOCK(name) pthread_mutex_unlock(&name); #define BZ_MUTEX_UNLOCK(name) pthread_mutex_unlock(&name);
#define BZ_MUTEX_DESTROY(name) pthread_mutex_destroy(&name); #define BZ_MUTEX_DESTROY(name) pthread_mutex_destroy(&name);
#else #else
#define BZ_MUTEX_DECLARE(name) #define BZ_MUTEX_DECLARE(name)
#define BZ_MUTEX_INIT(name) #define BZ_MUTEX_INIT(name)
#define BZ_MUTEX_LOCK(name) #define BZ_MUTEX_LOCK(name)
#define BZ_MUTEX_UNLOCK(name) #define BZ_MUTEX_UNLOCK(name)
#define BZ_MUTEX_DESTROY(name) #define BZ_MUTEX_DESTROY(name)
 End of changes. 6 change blocks. 
61 lines changed or deleted 7 lines changed or added


 bops.cc   bops.cc 
/************************************************************************** * /************************************************************************** *
* blitz/arraybops.cc Array expression templates (2 operands) * blitz/../array/bops.cc Array expression templates (2 operands)
* *
* $Id: bops.cc,v 1.1.1.1 2000/06/19 12:26:14 tveldhui Exp $ * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* Copyright (C) 1997 Todd Veldhuizen <tveldhui@oonumerics.org> * This program is distributed in the hope that it will be useful,
* All rights reserved. Please see <blitz/blitz.h> for terms and * but WITHOUT ANY WARRANTY; without even the implied warranty of
* conditions of use. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-suggest@cybervision.com
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-bugs@cybervision.com
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * http://seurat.uwaterloo.ca/blitz/
* *
************************************************************************** * ************************************************************************** *
* $Log: bops.cc,v $
* Revision 1.1.1.1 2000/06/19 12:26:14 tveldhui
* Imported sources
*
* Revision 1.2 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
* *
*/ */
// Generated source file. Do not edit. // Generated source file. Do not edit.
// genarrbops.cpp Aug 7 1997 15:04:14 // genarrbops.cpp Dec 30 2003 16:48:46
#ifndef BZ_ARRAYBOPS_CC #ifndef BZ_ARRAYBOPS_CC
#define BZ_ARRAYBOPS_CC #define BZ_ARRAYBOPS_CC
#ifndef BZ_ARRAYEXPR_H #ifndef BZ_ARRAYEXPR_H
#error <blitz/arraybops.cc> must be included after <blitz/arrayexpr.h> #error <blitz/array/bops.cc> must be included after <blitz/arrayexpr.h>
#endif #endif
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
/************************************************************************** ** /************************************************************************** **
* Addition Operators * Addition Operators
************************************************************************** **/ ************************************************************************** **/
// Array<T_numtype1, N_rank1> + Array<T_numtype2, N_rank2> // Array<T_numtype1, N_rank1> + Array<T_numtype2, N_rank2>
template<class T_numtype1, int N_rank1, class T_numtype2, int N_rank2> template<class T_numtype1, int N_rank1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<T_numtype1, T_numtype2 > > > Add<T_numtype1, T_numtype2 > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<T_numtype1, T_numtype2> > Add<T_numtype1, T_numtype2> >
(d1.begin(), (d1.begin(),
d2.begin()); d2.begin());
} }
// Array<T_numtype1, N_rank1> + _bz_ArrayExpr<P_expr2> // Array<T_numtype1, N_rank1> + _bz_ArrayExpr<P_expr2>
template<class T_numtype1, int N_rank1, class P_expr2> template<class T_numtype1, int N_rank1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<T_numtype1, _bz_typename P_expr2::T_numtype > > > Add<T_numtype1, typename P_expr2::T_numtype > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<T_numtype1, _bz_typename P_expr2::T_numtype> > Add<T_numtype1, typename P_expr2::T_numtype> >
(d1.begin(), (d1.begin(),
d2); d2);
} }
// Array<T_numtype1, N_rank1> + IndexPlaceholder<N_index2> // Array<T_numtype1, N_rank1> + IndexPlaceholder<N_index2>
template<class T_numtype1, int N_rank1, int N_index2> template<class T_numtype1, int N_rank1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<T_numtype1, int > > > Add<T_numtype1, int > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<T_numtype1, int> > Add<T_numtype1, int> >
(d1.begin(), (d1.begin(),
d2); d2);
} }
// Array<T_numtype1, N_rank1> + int // Array<T_numtype1, N_rank1> + int
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Add<T_numtype1, int > > > Add<T_numtype1, int > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Add<T_numtype1, int> > Add<T_numtype1, int> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// Array<T_numtype1, N_rank1> + float // Array<T_numtype1, N_rank1> + float
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Add<T_numtype1, float > > > Add<T_numtype1, float > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Add<T_numtype1, float> > Add<T_numtype1, float> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// Array<T_numtype1, N_rank1> + double // Array<T_numtype1, N_rank1> + double
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Add<T_numtype1, double > > > Add<T_numtype1, double > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Add<T_numtype1, double> > Add<T_numtype1, double> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// Array<T_numtype1, N_rank1> + long double // Array<T_numtype1, N_rank1> + long double
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Add<T_numtype1, long double > > > Add<T_numtype1, long double > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Add<T_numtype1, long double> > Add<T_numtype1, long double> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// Array<T_numtype1, N_rank1> + complex<T2> // Array<T_numtype1, N_rank1> + complex<T2>
template<class T_numtype1, int N_rank1, class T2> template<class T_numtype1, int N_rank1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Add<T_numtype1, complex<T2> > > > Add<T_numtype1, complex<T2> > > >
operator+(const Array<T_numtype1, N_rank1>& d1, operator+(const Array<T_numtype1, N_rank1>& d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Add<T_numtype1, complex<T2> > > Add<T_numtype1, complex<T2> > >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// _bz_ArrayExpr<P_expr1> + Array<T_numtype2, N_rank2> // _bz_ArrayExpr<P_expr1> + Array<T_numtype2, N_rank2>
template<class P_expr1, class T_numtype2, int N_rank2> template<class P_expr1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<_bz_typename P_expr1::T_numtype, T_numtype2 > > > Add<typename P_expr1::T_numtype, T_numtype2 > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<_bz_typename P_expr1::T_numtype, T_numtype2> > Add<typename P_expr1::T_numtype, T_numtype2> >
(d1, (d1,
d2.begin()); d2.begin());
} }
// _bz_ArrayExpr<P_expr1> + _bz_ArrayExpr<P_expr2> // _bz_ArrayExpr<P_expr1> + _bz_ArrayExpr<P_expr2>
template<class P_expr1, class P_expr2> template<class P_expr1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<_bz_typename P_expr1::T_numtype, _bz_typename P_expr2::T_numtype > > > Add<typename P_expr1::T_numtype, typename P_expr2::T_numtype > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<_bz_typename P_expr1::T_numtype, _bz_typename P_expr2::T_numtype> > Add<typename P_expr1::T_numtype, typename P_expr2::T_numtype> >
(d1, (d1,
d2); d2);
} }
// _bz_ArrayExpr<P_expr1> + IndexPlaceholder<N_index2> // _bz_ArrayExpr<P_expr1> + IndexPlaceholder<N_index2>
template<class P_expr1, int N_index2> template<class P_expr1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<_bz_typename P_expr1::T_numtype, int > > > Add<typename P_expr1::T_numtype, int > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<_bz_typename P_expr1::T_numtype, int> > Add<typename P_expr1::T_numtype, int> >
(d1, (d1,
d2); d2);
} }
// _bz_ArrayExpr<P_expr1> + int // _bz_ArrayExpr<P_expr1> + int
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Add<_bz_typename P_expr1::T_numtype, int > > > Add<typename P_expr1::T_numtype, int > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Add<_bz_typename P_expr1::T_numtype, int> > Add<typename P_expr1::T_numtype, int> >
(d1, (d1,
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// _bz_ArrayExpr<P_expr1> + float // _bz_ArrayExpr<P_expr1> + float
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Add<_bz_typename P_expr1::T_numtype, float > > > Add<typename P_expr1::T_numtype, float > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Add<_bz_typename P_expr1::T_numtype, float> > Add<typename P_expr1::T_numtype, float> >
(d1, (d1,
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// _bz_ArrayExpr<P_expr1> + double // _bz_ArrayExpr<P_expr1> + double
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Add<_bz_typename P_expr1::T_numtype, double > > > Add<typename P_expr1::T_numtype, double > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Add<_bz_typename P_expr1::T_numtype, double> > Add<typename P_expr1::T_numtype, double> >
(d1, (d1,
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// _bz_ArrayExpr<P_expr1> + long double // _bz_ArrayExpr<P_expr1> + long double
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Add<_bz_typename P_expr1::T_numtype, long double > > > Add<typename P_expr1::T_numtype, long double > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Add<_bz_typename P_expr1::T_numtype, long double> > Add<typename P_expr1::T_numtype, long double> >
(d1, (d1,
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// _bz_ArrayExpr<P_expr1> + complex<T2> // _bz_ArrayExpr<P_expr1> + complex<T2>
template<class P_expr1, class T2> template<class P_expr1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Add<_bz_typename P_expr1::T_numtype, complex<T2> > > > Add<typename P_expr1::T_numtype, complex<T2> > > >
operator+(_bz_ArrayExpr<P_expr1> d1, operator+(_bz_ArrayExpr<P_expr1> d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Add<_bz_typename P_expr1::T_numtype, complex<T2> > > Add<typename P_expr1::T_numtype, complex<T2> > >
(d1, (d1,
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// IndexPlaceholder<N_index1> + Array<T_numtype2, N_rank2> // IndexPlaceholder<N_index1> + Array<T_numtype2, N_rank2>
template<int N_index1, class T_numtype2, int N_rank2> template<int N_index1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<int, T_numtype2 > > > Add<int, T_numtype2 > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<int, T_numtype2> > Add<int, T_numtype2> >
(d1, (d1,
d2.begin()); d2.begin());
} }
// IndexPlaceholder<N_index1> + _bz_ArrayExpr<P_expr2> // IndexPlaceholder<N_index1> + _bz_ArrayExpr<P_expr2>
template<int N_index1, class P_expr2> template<int N_index1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<int, _bz_typename P_expr2::T_numtype > > > Add<int, typename P_expr2::T_numtype > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<int, _bz_typename P_expr2::T_numtype> > Add<int, typename P_expr2::T_numtype> >
(d1, (d1,
d2); d2);
} }
// IndexPlaceholder<N_index1> + IndexPlaceholder<N_index2> // IndexPlaceholder<N_index1> + IndexPlaceholder<N_index2>
template<int N_index1, int N_index2> template<int N_index1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<int, int > > > Add<int, int > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<int, int> > Add<int, int> >
(d1, (d1,
d2); d2);
} }
// IndexPlaceholder<N_index1> + int // IndexPlaceholder<N_index1> + int
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Add<int, int > > > Add<int, int > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Add<int, int> > Add<int, int> >
(d1, (d1,
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// IndexPlaceholder<N_index1> + float // IndexPlaceholder<N_index1> + float
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Add<int, float > > > Add<int, float > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Add<int, float> > Add<int, float> >
(d1, (d1,
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// IndexPlaceholder<N_index1> + double // IndexPlaceholder<N_index1> + double
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Add<int, double > > > Add<int, double > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Add<int, double> > Add<int, double> >
(d1, (d1,
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// IndexPlaceholder<N_index1> + long double // IndexPlaceholder<N_index1> + long double
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Add<int, long double > > > Add<int, long double > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Add<int, long double> > Add<int, long double> >
(d1, (d1,
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// IndexPlaceholder<N_index1> + complex<T2> // IndexPlaceholder<N_index1> + complex<T2>
template<int N_index1, class T2> template<int N_index1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Add<int, complex<T2> > > > Add<int, complex<T2> > > >
operator+(IndexPlaceholder<N_index1> d1, operator+(IndexPlaceholder<N_index1> d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Add<int, complex<T2> > > Add<int, complex<T2> > >
(d1, (d1,
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// int + Array<T_numtype2, N_rank2> // int + Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<int>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<int, T_numtype2 > > > Add<int, T_numtype2 > > >
operator+(int d1, operator+(int d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<int>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<int, T_numtype2> > Add<int, T_numtype2> >
(_bz_ArrayExprConstant<int>(d1), (_bz_ArrayExprConstant<int>(d1),
d2.begin()); d2.begin());
} }
// int + _bz_ArrayExpr<P_expr2> // int + _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<int>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<int, _bz_typename P_expr2::T_numtype > > > Add<int, typename P_expr2::T_numtype > > >
operator+(int d1, operator+(int d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<int>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<int, _bz_typename P_expr2::T_numtype> > Add<int, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<int>(d1), (_bz_ArrayExprConstant<int>(d1),
d2); d2);
} }
// int + IndexPlaceholder<N_index2> // int + IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<int>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<int, int > > > Add<int, int > > >
operator+(int d1, operator+(int d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<int>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<int, int> > Add<int, int> >
(_bz_ArrayExprConstant<int>(d1), (_bz_ArrayExprConstant<int>(d1),
d2); d2);
} }
// float + Array<T_numtype2, N_rank2> // float + Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<float>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<float, T_numtype2 > > > Add<float, T_numtype2 > > >
operator+(float d1, operator+(float d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<float>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<float, T_numtype2> > Add<float, T_numtype2> >
(_bz_ArrayExprConstant<float>(d1), (_bz_ArrayExprConstant<float>(d1),
d2.begin()); d2.begin());
} }
// float + _bz_ArrayExpr<P_expr2> // float + _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<float>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<float, _bz_typename P_expr2::T_numtype > > > Add<float, typename P_expr2::T_numtype > > >
operator+(float d1, operator+(float d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<float>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<float, _bz_typename P_expr2::T_numtype> > Add<float, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<float>(d1), (_bz_ArrayExprConstant<float>(d1),
d2); d2);
} }
// float + IndexPlaceholder<N_index2> // float + IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<float>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<float, int > > > Add<float, int > > >
operator+(float d1, operator+(float d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<float>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<float, int> > Add<float, int> >
(_bz_ArrayExprConstant<float>(d1), (_bz_ArrayExprConstant<float>(d1),
d2); d2);
} }
// double + Array<T_numtype2, N_rank2> // double + Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<double, T_numtype2 > > > Add<double, T_numtype2 > > >
operator+(double d1, operator+(double d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<double, T_numtype2> > Add<double, T_numtype2> >
(_bz_ArrayExprConstant<double>(d1), (_bz_ArrayExprConstant<double>(d1),
d2.begin()); d2.begin());
} }
// double + _bz_ArrayExpr<P_expr2> // double + _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<double, _bz_typename P_expr2::T_numtype > > > Add<double, typename P_expr2::T_numtype > > >
operator+(double d1, operator+(double d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<double, _bz_typename P_expr2::T_numtype> > Add<double, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<double>(d1), (_bz_ArrayExprConstant<double>(d1),
d2); d2);
} }
// double + IndexPlaceholder<N_index2> // double + IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<double, int > > > Add<double, int > > >
operator+(double d1, operator+(double d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<double, int> > Add<double, int> >
(_bz_ArrayExprConstant<double>(d1), (_bz_ArrayExprConstant<double>(d1),
d2); d2);
} }
// long double + Array<T_numtype2, N_rank2> // long double + Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<long double, T_numtype2 > > > Add<long double, T_numtype2 > > >
operator+(long double d1, operator+(long double d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<long double, T_numtype2> > Add<long double, T_numtype2> >
(_bz_ArrayExprConstant<long double>(d1), (_bz_ArrayExprConstant<long double>(d1),
d2.begin()); d2.begin());
} }
// long double + _bz_ArrayExpr<P_expr2> // long double + _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<long double, _bz_typename P_expr2::T_numtype > > > Add<long double, typename P_expr2::T_numtype > > >
operator+(long double d1, operator+(long double d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<long double, _bz_typename P_expr2::T_numtype> > Add<long double, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<long double>(d1), (_bz_ArrayExprConstant<long double>(d1),
d2); d2);
} }
// long double + IndexPlaceholder<N_index2> // long double + IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<long double, int > > > Add<long double, int > > >
operator+(long double d1, operator+(long double d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<long double, int> > Add<long double, int> >
(_bz_ArrayExprConstant<long double>(d1), (_bz_ArrayExprConstant<long double>(d1),
d2); d2);
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// complex<T1> + Array<T_numtype2, N_rank2> // complex<T1> + Array<T_numtype2, N_rank2>
template<class T1, class T_numtype2, int N_rank2> template<class T1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<complex<T1> , T_numtype2 > > > Add<complex<T1> , T_numtype2 > > >
operator+(complex<T1> d1, operator+(complex<T1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Add<complex<T1> , T_numtype2> > Add<complex<T1> , T_numtype2> >
(_bz_ArrayExprConstant<complex<T1> > (d1), (_bz_ArrayExprConstant<complex<T1> > (d1),
d2.begin()); d2.begin());
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// complex<T1> + _bz_ArrayExpr<P_expr2> // complex<T1> + _bz_ArrayExpr<P_expr2>
template<class T1, class P_expr2> template<class T1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<complex<T1> , _bz_typename P_expr2::T_numtype > > > Add<complex<T1> , typename P_expr2::T_numtype > > >
operator+(complex<T1> d1, operator+(complex<T1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Add<complex<T1> , _bz_typename P_expr2::T_numtype> > Add<complex<T1> , typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<complex<T1> > (d1), (_bz_ArrayExprConstant<complex<T1> > (d1),
d2); d2);
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// complex<T1> + IndexPlaceholder<N_index2> // complex<T1> + IndexPlaceholder<N_index2>
template<class T1, int N_index2> template<class T1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<complex<T1> , int > > > Add<complex<T1> , int > > >
operator+(complex<T1> d1, operator+(complex<T1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Add<complex<T1> , int> > Add<complex<T1> , int> >
(_bz_ArrayExprConstant<complex<T1> > (d1), (_bz_ArrayExprConstant<complex<T1> > (d1),
d2); d2);
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
/************************************************************************** ** /************************************************************************** **
* Subtraction Operators * Subtraction Operators
************************************************************************** **/ ************************************************************************** **/
// Array<T_numtype1, N_rank1> - Array<T_numtype2, N_rank2> // Array<T_numtype1, N_rank1> - Array<T_numtype2, N_rank2>
template<class T_numtype1, int N_rank1, class T_numtype2, int N_rank2> template<class T_numtype1, int N_rank1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<T_numtype1, T_numtype2 > > > Subtract<T_numtype1, T_numtype2 > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<T_numtype1, T_numtype2> > Subtract<T_numtype1, T_numtype2> >
(d1.begin(), (d1.begin(),
d2.begin()); d2.begin());
} }
// Array<T_numtype1, N_rank1> - _bz_ArrayExpr<P_expr2> // Array<T_numtype1, N_rank1> - _bz_ArrayExpr<P_expr2>
template<class T_numtype1, int N_rank1, class P_expr2> template<class T_numtype1, int N_rank1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<T_numtype1, _bz_typename P_expr2::T_numtype > > > Subtract<T_numtype1, typename P_expr2::T_numtype > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<T_numtype1, _bz_typename P_expr2::T_numtype> > Subtract<T_numtype1, typename P_expr2::T_numtype> >
(d1.begin(), (d1.begin(),
d2); d2);
} }
// Array<T_numtype1, N_rank1> - IndexPlaceholder<N_index2> // Array<T_numtype1, N_rank1> - IndexPlaceholder<N_index2>
template<class T_numtype1, int N_rank1, int N_index2> template<class T_numtype1, int N_rank1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<T_numtype1, int > > > Subtract<T_numtype1, int > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<T_numtype1, int> > Subtract<T_numtype1, int> >
(d1.begin(), (d1.begin(),
d2); d2);
} }
// Array<T_numtype1, N_rank1> - int // Array<T_numtype1, N_rank1> - int
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Subtract<T_numtype1, int > > > Subtract<T_numtype1, int > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Subtract<T_numtype1, int> > Subtract<T_numtype1, int> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// Array<T_numtype1, N_rank1> - float // Array<T_numtype1, N_rank1> - float
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Subtract<T_numtype1, float > > > Subtract<T_numtype1, float > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Subtract<T_numtype1, float> > Subtract<T_numtype1, float> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// Array<T_numtype1, N_rank1> - double // Array<T_numtype1, N_rank1> - double
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Subtract<T_numtype1, double > > > Subtract<T_numtype1, double > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Subtract<T_numtype1, double> > Subtract<T_numtype1, double> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// Array<T_numtype1, N_rank1> - long double // Array<T_numtype1, N_rank1> - long double
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Subtract<T_numtype1, long double > > > Subtract<T_numtype1, long double > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Subtract<T_numtype1, long double> > Subtract<T_numtype1, long double> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// Array<T_numtype1, N_rank1> - complex<T2> // Array<T_numtype1, N_rank1> - complex<T2>
template<class T_numtype1, int N_rank1, class T2> template<class T_numtype1, int N_rank1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Subtract<T_numtype1, complex<T2> > > > Subtract<T_numtype1, complex<T2> > > >
operator-(const Array<T_numtype1, N_rank1>& d1, operator-(const Array<T_numtype1, N_rank1>& d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Subtract<T_numtype1, complex<T2> > > Subtract<T_numtype1, complex<T2> > >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// _bz_ArrayExpr<P_expr1> - Array<T_numtype2, N_rank2> // _bz_ArrayExpr<P_expr1> - Array<T_numtype2, N_rank2>
template<class P_expr1, class T_numtype2, int N_rank2> template<class P_expr1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<_bz_typename P_expr1::T_numtype, T_numtype2 > > > Subtract<typename P_expr1::T_numtype, T_numtype2 > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<_bz_typename P_expr1::T_numtype, T_numtype2> > Subtract<typename P_expr1::T_numtype, T_numtype2> >
(d1, (d1,
d2.begin()); d2.begin());
} }
// _bz_ArrayExpr<P_expr1> - _bz_ArrayExpr<P_expr2> // _bz_ArrayExpr<P_expr1> - _bz_ArrayExpr<P_expr2>
template<class P_expr1, class P_expr2> template<class P_expr1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<_bz_typename P_expr1::T_numtype, _bz_typename P_expr2::T_num type > > > Subtract<typename P_expr1::T_numtype, typename P_expr2::T_numtype > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<_bz_typename P_expr1::T_numtype, _bz_typename P_expr2::T_num type> > Subtract<typename P_expr1::T_numtype, typename P_expr2::T_numtype> >
(d1, (d1,
d2); d2);
} }
// _bz_ArrayExpr<P_expr1> - IndexPlaceholder<N_index2> // _bz_ArrayExpr<P_expr1> - IndexPlaceholder<N_index2>
template<class P_expr1, int N_index2> template<class P_expr1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<_bz_typename P_expr1::T_numtype, int > > > Subtract<typename P_expr1::T_numtype, int > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<_bz_typename P_expr1::T_numtype, int> > Subtract<typename P_expr1::T_numtype, int> >
(d1, (d1,
d2); d2);
} }
// _bz_ArrayExpr<P_expr1> - int // _bz_ArrayExpr<P_expr1> - int
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Subtract<_bz_typename P_expr1::T_numtype, int > > > Subtract<typename P_expr1::T_numtype, int > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Subtract<_bz_typename P_expr1::T_numtype, int> > Subtract<typename P_expr1::T_numtype, int> >
(d1, (d1,
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// _bz_ArrayExpr<P_expr1> - float // _bz_ArrayExpr<P_expr1> - float
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Subtract<_bz_typename P_expr1::T_numtype, float > > > Subtract<typename P_expr1::T_numtype, float > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Subtract<_bz_typename P_expr1::T_numtype, float> > Subtract<typename P_expr1::T_numtype, float> >
(d1, (d1,
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// _bz_ArrayExpr<P_expr1> - double // _bz_ArrayExpr<P_expr1> - double
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Subtract<_bz_typename P_expr1::T_numtype, double > > > Subtract<typename P_expr1::T_numtype, double > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Subtract<_bz_typename P_expr1::T_numtype, double> > Subtract<typename P_expr1::T_numtype, double> >
(d1, (d1,
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// _bz_ArrayExpr<P_expr1> - long double // _bz_ArrayExpr<P_expr1> - long double
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Subtract<_bz_typename P_expr1::T_numtype, long double > > > Subtract<typename P_expr1::T_numtype, long double > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Subtract<_bz_typename P_expr1::T_numtype, long double> > Subtract<typename P_expr1::T_numtype, long double> >
(d1, (d1,
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// _bz_ArrayExpr<P_expr1> - complex<T2> // _bz_ArrayExpr<P_expr1> - complex<T2>
template<class P_expr1, class T2> template<class P_expr1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Subtract<_bz_typename P_expr1::T_numtype, complex<T2> > > > Subtract<typename P_expr1::T_numtype, complex<T2> > > >
operator-(_bz_ArrayExpr<P_expr1> d1, operator-(_bz_ArrayExpr<P_expr1> d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Subtract<_bz_typename P_expr1::T_numtype, complex<T2> > > Subtract<typename P_expr1::T_numtype, complex<T2> > >
(d1, (d1,
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// IndexPlaceholder<N_index1> - Array<T_numtype2, N_rank2> // IndexPlaceholder<N_index1> - Array<T_numtype2, N_rank2>
template<int N_index1, class T_numtype2, int N_rank2> template<int N_index1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<int, T_numtype2 > > > Subtract<int, T_numtype2 > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<int, T_numtype2> > Subtract<int, T_numtype2> >
(d1, (d1,
d2.begin()); d2.begin());
} }
// IndexPlaceholder<N_index1> - _bz_ArrayExpr<P_expr2> // IndexPlaceholder<N_index1> - _bz_ArrayExpr<P_expr2>
template<int N_index1, class P_expr2> template<int N_index1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<int, _bz_typename P_expr2::T_numtype > > > Subtract<int, typename P_expr2::T_numtype > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<int, _bz_typename P_expr2::T_numtype> > Subtract<int, typename P_expr2::T_numtype> >
(d1, (d1,
d2); d2);
} }
// IndexPlaceholder<N_index1> - IndexPlaceholder<N_index2> // IndexPlaceholder<N_index1> - IndexPlaceholder<N_index2>
template<int N_index1, int N_index2> template<int N_index1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<int, int > > > Subtract<int, int > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<int, int> > Subtract<int, int> >
(d1, (d1,
d2); d2);
} }
// IndexPlaceholder<N_index1> - int // IndexPlaceholder<N_index1> - int
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Subtract<int, int > > > Subtract<int, int > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Subtract<int, int> > Subtract<int, int> >
(d1, (d1,
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// IndexPlaceholder<N_index1> - float // IndexPlaceholder<N_index1> - float
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Subtract<int, float > > > Subtract<int, float > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Subtract<int, float> > Subtract<int, float> >
(d1, (d1,
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// IndexPlaceholder<N_index1> - double // IndexPlaceholder<N_index1> - double
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Subtract<int, double > > > Subtract<int, double > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Subtract<int, double> > Subtract<int, double> >
(d1, (d1,
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// IndexPlaceholder<N_index1> - long double // IndexPlaceholder<N_index1> - long double
template<int N_index1> template<int N_index1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Subtract<int, long double > > > Subtract<int, long double > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Subtract<int, long double> > Subtract<int, long double> >
(d1, (d1,
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// IndexPlaceholder<N_index1> - complex<T2> // IndexPlaceholder<N_index1> - complex<T2>
template<int N_index1, class T2> template<int N_index1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<IndexPlaceholder<N_index1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Subtract<int, complex<T2> > > > Subtract<int, complex<T2> > > >
operator-(IndexPlaceholder<N_index1> d1, operator-(IndexPlaceholder<N_index1> d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<IndexPlaceholder<N_index1>, return _bz_ArrayExprBinaryOp<IndexPlaceholder<N_index1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Subtract<int, complex<T2> > > Subtract<int, complex<T2> > >
(d1, (d1,
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// int - Array<T_numtype2, N_rank2> // int - Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<int>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<int, T_numtype2 > > > Subtract<int, T_numtype2 > > >
operator-(int d1, operator-(int d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<int>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<int, T_numtype2> > Subtract<int, T_numtype2> >
(_bz_ArrayExprConstant<int>(d1), (_bz_ArrayExprConstant<int>(d1),
d2.begin()); d2.begin());
} }
// int - _bz_ArrayExpr<P_expr2> // int - _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<int>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<int, _bz_typename P_expr2::T_numtype > > > Subtract<int, typename P_expr2::T_numtype > > >
operator-(int d1, operator-(int d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<int>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<int, _bz_typename P_expr2::T_numtype> > Subtract<int, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<int>(d1), (_bz_ArrayExprConstant<int>(d1),
d2); d2);
} }
// int - IndexPlaceholder<N_index2> // int - IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<int>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<int, int > > > Subtract<int, int > > >
operator-(int d1, operator-(int d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<int>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<int>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<int, int> > Subtract<int, int> >
(_bz_ArrayExprConstant<int>(d1), (_bz_ArrayExprConstant<int>(d1),
d2); d2);
} }
// float - Array<T_numtype2, N_rank2> // float - Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<float>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<float, T_numtype2 > > > Subtract<float, T_numtype2 > > >
operator-(float d1, operator-(float d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<float>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<float, T_numtype2> > Subtract<float, T_numtype2> >
(_bz_ArrayExprConstant<float>(d1), (_bz_ArrayExprConstant<float>(d1),
d2.begin()); d2.begin());
} }
// float - _bz_ArrayExpr<P_expr2> // float - _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<float>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<float, _bz_typename P_expr2::T_numtype > > > Subtract<float, typename P_expr2::T_numtype > > >
operator-(float d1, operator-(float d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<float>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<float, _bz_typename P_expr2::T_numtype> > Subtract<float, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<float>(d1), (_bz_ArrayExprConstant<float>(d1),
d2); d2);
} }
// float - IndexPlaceholder<N_index2> // float - IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<float>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<float, int > > > Subtract<float, int > > >
operator-(float d1, operator-(float d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<float>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<float>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<float, int> > Subtract<float, int> >
(_bz_ArrayExprConstant<float>(d1), (_bz_ArrayExprConstant<float>(d1),
d2); d2);
} }
// double - Array<T_numtype2, N_rank2> // double - Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<double, T_numtype2 > > > Subtract<double, T_numtype2 > > >
operator-(double d1, operator-(double d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<double, T_numtype2> > Subtract<double, T_numtype2> >
(_bz_ArrayExprConstant<double>(d1), (_bz_ArrayExprConstant<double>(d1),
d2.begin()); d2.begin());
} }
// double - _bz_ArrayExpr<P_expr2> // double - _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<double, _bz_typename P_expr2::T_numtype > > > Subtract<double, typename P_expr2::T_numtype > > >
operator-(double d1, operator-(double d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<double, _bz_typename P_expr2::T_numtype> > Subtract<double, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<double>(d1), (_bz_ArrayExprConstant<double>(d1),
d2); d2);
} }
// double - IndexPlaceholder<N_index2> // double - IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<double, int > > > Subtract<double, int > > >
operator-(double d1, operator-(double d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<double, int> > Subtract<double, int> >
(_bz_ArrayExprConstant<double>(d1), (_bz_ArrayExprConstant<double>(d1),
d2); d2);
} }
// long double - Array<T_numtype2, N_rank2> // long double - Array<T_numtype2, N_rank2>
template<class T_numtype2, int N_rank2> template<class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<long double, T_numtype2 > > > Subtract<long double, T_numtype2 > > >
operator-(long double d1, operator-(long double d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<long double, T_numtype2> > Subtract<long double, T_numtype2> >
(_bz_ArrayExprConstant<long double>(d1), (_bz_ArrayExprConstant<long double>(d1),
d2.begin()); d2.begin());
} }
// long double - _bz_ArrayExpr<P_expr2> // long double - _bz_ArrayExpr<P_expr2>
template<class P_expr2> template<class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<long double, _bz_typename P_expr2::T_numtype > > > Subtract<long double, typename P_expr2::T_numtype > > >
operator-(long double d1, operator-(long double d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<long double, _bz_typename P_expr2::T_numtype> > Subtract<long double, typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<long double>(d1), (_bz_ArrayExprConstant<long double>(d1),
d2); d2);
} }
// long double - IndexPlaceholder<N_index2> // long double - IndexPlaceholder<N_index2>
template<int N_index2> template<int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<long double, int > > > Subtract<long double, int > > >
operator-(long double d1, operator-(long double d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<long double>, return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<long double>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<long double, int> > Subtract<long double, int> >
(_bz_ArrayExprConstant<long double>(d1), (_bz_ArrayExprConstant<long double>(d1),
d2); d2);
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// complex<T1> - Array<T_numtype2, N_rank2> // complex<T1> - Array<T_numtype2, N_rank2>
template<class T1, class T_numtype2, int N_rank2> template<class T1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<complex<T1> , T_numtype2 > > > Subtract<complex<T1> , T_numtype2 > > >
operator-(complex<T1> d1, operator-(complex<T1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Subtract<complex<T1> , T_numtype2> > Subtract<complex<T1> , T_numtype2> >
(_bz_ArrayExprConstant<complex<T1> > (d1), (_bz_ArrayExprConstant<complex<T1> > (d1),
d2.begin()); d2.begin());
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// complex<T1> - _bz_ArrayExpr<P_expr2> // complex<T1> - _bz_ArrayExpr<P_expr2>
template<class T1, class P_expr2> template<class T1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<complex<T1> , _bz_typename P_expr2::T_numtype > > > Subtract<complex<T1> , typename P_expr2::T_numtype > > >
operator-(complex<T1> d1, operator-(complex<T1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Subtract<complex<T1> , _bz_typename P_expr2::T_numtype> > Subtract<complex<T1> , typename P_expr2::T_numtype> >
(_bz_ArrayExprConstant<complex<T1> > (d1), (_bz_ArrayExprConstant<complex<T1> > (d1),
d2); d2);
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// complex<T1> - IndexPlaceholder<N_index2> // complex<T1> - IndexPlaceholder<N_index2>
template<class T1, int N_index2> template<class T1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<complex<T1> , int > > > Subtract<complex<T1> , int > > >
operator-(complex<T1> d1, operator-(complex<T1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExprConstant<complex<T1> > , return _bz_ArrayExprBinaryOp<_bz_ArrayExprConstant<complex<T1> > ,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Subtract<complex<T1> , int> > Subtract<complex<T1> , int> >
(_bz_ArrayExprConstant<complex<T1> > (d1), (_bz_ArrayExprConstant<complex<T1> > (d1),
d2); d2);
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
/************************************************************************** ** /************************************************************************** **
* Multiplication Operators * Multiplication Operators
************************************************************************** **/ ************************************************************************** **/
// Array<T_numtype1, N_rank1> * Array<T_numtype2, N_rank2> // Array<T_numtype1, N_rank1> * Array<T_numtype2, N_rank2>
template<class T_numtype1, int N_rank1, class T_numtype2, int N_rank2> template<class T_numtype1, int N_rank1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Multiply<T_numtype1, T_numtype2 > > > Multiply<T_numtype1, T_numtype2 > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Multiply<T_numtype1, T_numtype2> > Multiply<T_numtype1, T_numtype2> >
(d1.begin(), (d1.begin(),
d2.begin()); d2.begin());
} }
// Array<T_numtype1, N_rank1> * _bz_ArrayExpr<P_expr2> // Array<T_numtype1, N_rank1> * _bz_ArrayExpr<P_expr2>
template<class T_numtype1, int N_rank1, class P_expr2> template<class T_numtype1, int N_rank1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Multiply<T_numtype1, _bz_typename P_expr2::T_numtype > > > Multiply<T_numtype1, typename P_expr2::T_numtype > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Multiply<T_numtype1, _bz_typename P_expr2::T_numtype> > Multiply<T_numtype1, typename P_expr2::T_numtype> >
(d1.begin(), (d1.begin(),
d2); d2);
} }
// Array<T_numtype1, N_rank1> * IndexPlaceholder<N_index2> // Array<T_numtype1, N_rank1> * IndexPlaceholder<N_index2>
template<class T_numtype1, int N_rank1, int N_index2> template<class T_numtype1, int N_rank1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Multiply<T_numtype1, int > > > Multiply<T_numtype1, int > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Multiply<T_numtype1, int> > Multiply<T_numtype1, int> >
(d1.begin(), (d1.begin(),
d2); d2);
} }
// Array<T_numtype1, N_rank1> * int // Array<T_numtype1, N_rank1> * int
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Multiply<T_numtype1, int > > > Multiply<T_numtype1, int > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Multiply<T_numtype1, int> > Multiply<T_numtype1, int> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// Array<T_numtype1, N_rank1> * float // Array<T_numtype1, N_rank1> * float
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Multiply<T_numtype1, float > > > Multiply<T_numtype1, float > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Multiply<T_numtype1, float> > Multiply<T_numtype1, float> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// Array<T_numtype1, N_rank1> * double // Array<T_numtype1, N_rank1> * double
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Multiply<T_numtype1, double > > > Multiply<T_numtype1, double > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Multiply<T_numtype1, double> > Multiply<T_numtype1, double> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// Array<T_numtype1, N_rank1> * long double // Array<T_numtype1, N_rank1> * long double
template<class T_numtype1, int N_rank1> template<class T_numtype1, int N_rank1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Multiply<T_numtype1, long double > > > Multiply<T_numtype1, long double > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
long double d2) long double d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,
Multiply<T_numtype1, long double> > Multiply<T_numtype1, long double> >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<long double>(d2)); _bz_ArrayExprConstant<long double>(d2));
} }
#ifdef BZ_HAVE_COMPLEX #ifdef BZ_HAVE_COMPLEX
// Array<T_numtype1, N_rank1> * complex<T2> // Array<T_numtype1, N_rank1> * complex<T2>
template<class T_numtype1, int N_rank1, class T2> template<class T_numtype1, int N_rank1, class T2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Multiply<T_numtype1, complex<T2> > > > Multiply<T_numtype1, complex<T2> > > >
operator*(const Array<T_numtype1, N_rank1>& d1, operator*(const Array<T_numtype1, N_rank1>& d1,
complex<T2> d2) complex<T2> d2)
{ {
return _bz_ArrayExprOp<ArrayIterator<T_numtype1, N_rank1>, return _bz_ArrayExprBinaryOp<ArrayIterator<T_numtype1, N_rank1>,
_bz_ArrayExprConstant<complex<T2> > , _bz_ArrayExprConstant<complex<T2> > ,
Multiply<T_numtype1, complex<T2> > > Multiply<T_numtype1, complex<T2> > >
(d1.begin(), (d1.begin(),
_bz_ArrayExprConstant<complex<T2> > (d2)); _bz_ArrayExprConstant<complex<T2> > (d2));
} }
#endif // BZ_HAVE_COMPLEX #endif // BZ_HAVE_COMPLEX
// _bz_ArrayExpr<P_expr1> * Array<T_numtype2, N_rank2> // _bz_ArrayExpr<P_expr1> * Array<T_numtype2, N_rank2>
template<class P_expr1, class T_numtype2, int N_rank2> template<class P_expr1, class T_numtype2, int N_rank2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Multiply<_bz_typename P_expr1::T_numtype, T_numtype2 > > > Multiply<typename P_expr1::T_numtype, T_numtype2 > > >
operator*(_bz_ArrayExpr<P_expr1> d1, operator*(_bz_ArrayExpr<P_expr1> d1,
const Array<T_numtype2, N_rank2>& d2) const Array<T_numtype2, N_rank2>& d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
ArrayIterator<T_numtype2, N_rank2>, ArrayIterator<T_numtype2, N_rank2>,
Multiply<_bz_typename P_expr1::T_numtype, T_numtype2> > Multiply<typename P_expr1::T_numtype, T_numtype2> >
(d1, (d1,
d2.begin()); d2.begin());
} }
// _bz_ArrayExpr<P_expr1> * _bz_ArrayExpr<P_expr2> // _bz_ArrayExpr<P_expr1> * _bz_ArrayExpr<P_expr2>
template<class P_expr1, class P_expr2> template<class P_expr1, class P_expr2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Multiply<_bz_typename P_expr1::T_numtype, _bz_typename P_expr2::T_num type > > > Multiply<typename P_expr1::T_numtype, typename P_expr2::T_numtype > > >
operator*(_bz_ArrayExpr<P_expr1> d1, operator*(_bz_ArrayExpr<P_expr1> d1,
_bz_ArrayExpr<P_expr2> d2) _bz_ArrayExpr<P_expr2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExpr<P_expr2>, _bz_ArrayExpr<P_expr2>,
Multiply<_bz_typename P_expr1::T_numtype, _bz_typename P_expr2::T_num type> > Multiply<typename P_expr1::T_numtype, typename P_expr2::T_numtype> >
(d1, (d1,
d2); d2);
} }
// _bz_ArrayExpr<P_expr1> * IndexPlaceholder<N_index2> // _bz_ArrayExpr<P_expr1> * IndexPlaceholder<N_index2>
template<class P_expr1, int N_index2> template<class P_expr1, int N_index2>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Multiply<_bz_typename P_expr1::T_numtype, int > > > Multiply<typename P_expr1::T_numtype, int > > >
operator*(_bz_ArrayExpr<P_expr1> d1, operator*(_bz_ArrayExpr<P_expr1> d1,
IndexPlaceholder<N_index2> d2) IndexPlaceholder<N_index2> d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
IndexPlaceholder<N_index2>, IndexPlaceholder<N_index2>,
Multiply<_bz_typename P_expr1::T_numtype, int> > Multiply<typename P_expr1::T_numtype, int> >
(d1, (d1,
d2); d2);
} }
// _bz_ArrayExpr<P_expr1> * int // _bz_ArrayExpr<P_expr1> * int
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Multiply<_bz_typename P_expr1::T_numtype, int > > > Multiply<typename P_expr1::T_numtype, int > > >
operator*(_bz_ArrayExpr<P_expr1> d1, operator*(_bz_ArrayExpr<P_expr1> d1,
int d2) int d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<int>, _bz_ArrayExprConstant<int>,
Multiply<_bz_typename P_expr1::T_numtype, int> > Multiply<typename P_expr1::T_numtype, int> >
(d1, (d1,
_bz_ArrayExprConstant<int>(d2)); _bz_ArrayExprConstant<int>(d2));
} }
// _bz_ArrayExpr<P_expr1> * float // _bz_ArrayExpr<P_expr1> * float
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Multiply<_bz_typename P_expr1::T_numtype, float > > > Multiply<typename P_expr1::T_numtype, float > > >
operator*(_bz_ArrayExpr<P_expr1> d1, operator*(_bz_ArrayExpr<P_expr1> d1,
float d2) float d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<float>, _bz_ArrayExprConstant<float>,
Multiply<_bz_typename P_expr1::T_numtype, float> > Multiply<typename P_expr1::T_numtype, float> >
(d1, (d1,
_bz_ArrayExprConstant<float>(d2)); _bz_ArrayExprConstant<float>(d2));
} }
// _bz_ArrayExpr<P_expr1> * double // _bz_ArrayExpr<P_expr1> * double
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Multiply<_bz_typename P_expr1::T_numtype, double > > > Multiply<typename P_expr1::T_numtype, double > > >
operator*(_bz_ArrayExpr<P_expr1> d1, operator*(_bz_ArrayExpr<P_expr1> d1,
double d2) double d2)
{ {
return _bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, return _bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<double>, _bz_ArrayExprConstant<double>,
Multiply<_bz_typename P_expr1::T_numtype, double> > Multiply<typename P_expr1::T_numtype, double> >
(d1, (d1,
_bz_ArrayExprConstant<double>(d2)); _bz_ArrayExprConstant<double>(d2));
} }
// _bz_ArrayExpr<P_expr1> * long double // _bz_ArrayExpr<P_expr1> * long double
template<class P_expr1> template<class P_expr1>
inline inline
_bz_ArrayExpr<_bz_ArrayExprOp<_bz_ArrayExpr<P_expr1>, _bz_ArrayExpr<_bz_ArrayExprBinaryOp<_bz_ArrayExpr<P_expr1>,
_bz_ArrayExprConstant<long double>, _bz_ArrayExprConstant<long double>,