33 #ifndef __INCLUDE_MIST_OPERATOR_ARRAY1__ 
   34 #define __INCLUDE_MIST_OPERATOR_ARRAY1__ 
   47 template < 
class T, 
class Allocator >
 
   48 inline const array1< T, Allocator >& 
operator +=( array1< T, Allocator > &a1, 
const array1< T, Allocator >  &a2 )
 
   50     typedef typename array1< T, Allocator >::size_type size_type;
 
   51 #if _CHECK_ARRAY1_OPERATION_ != 0 
   52     if( a1.size( ) != a2.size( ) )
 
   55         ::std::cerr << 
"can't add array1s." << ::std::endl;
 
   59     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] += static_cast< T >( a2[i] );
 
   73 template < 
class T, 
class Allocator >
 
   74 inline const array1< T, Allocator >& 
operator -=( array1< T, Allocator > &a1, 
const array1< T, Allocator >  &a2 )
 
   76     typedef typename array1< T, Allocator >::size_type size_type;
 
   77 #if _CHECK_ARRAY1_OPERATION_ != 0 
   78     if( a1.size( ) != a2.size( ) )
 
   81         ::std::cerr << 
"can't subtract array1s." << ::std::endl;
 
   85     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] -= static_cast< T >( a2[i] );
 
   99 template < 
class T, 
class Allocator >
 
  100 inline const array1< T, Allocator >& 
operator *=( array1< T, Allocator > &a1, 
const array1< T, Allocator >  &a2 )
 
  102     typedef typename array1< T, Allocator >::size_type size_type;
 
  103 #if _CHECK_ARRAY1_OPERATION_ != 0 
  104     if( a1.size( ) != a2.size( ) )
 
  107         ::std::cerr << 
"can't multiply array1s." << ::std::endl;
 
  111     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] *= static_cast< T >( a2[i] );
 
  125 template < 
class T, 
class Allocator >
 
  126 inline const array1< T, Allocator >& 
operator /=( array1< T, Allocator > &a1, 
const array1< T, Allocator >  &a2 )
 
  128     typedef typename array1< T, Allocator >::size_type size_type;
 
  129 #if _CHECK_ARRAY1_OPERATION_ != 0 
  130     if( a1.size( ) != a2.size( ) )
 
  133         ::std::cerr << 
"can't divide array1s." << ::std::endl;
 
  137     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] /= static_cast< T >( a2[i] );
 
  151 template < 
class T, 
class Allocator >
 
  152 inline const array1< T, Allocator >& 
operator +=( array1< T, Allocator > &a1, 
typename array1< T, Allocator >::value_type val )
 
  154     typedef typename array1< T, Allocator >::size_type size_type;
 
  155     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] += val;
 
  169 template < 
class T, 
class Allocator >
 
  170 inline const array1< T, Allocator >& 
operator -=( array1< T, Allocator > &a1, 
typename array1< T, Allocator >::value_type val )
 
  172     typedef typename array1< T, Allocator >::size_type size_type;
 
  173     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] -= val;
 
  187 template < 
class T, 
class Allocator >
 
  188 inline const array1< T, Allocator >& 
operator *=( array1< T, Allocator > &a1, 
typename array1< T, Allocator >::value_type val )
 
  190     typedef typename array1< T, Allocator >::size_type size_type;
 
  191     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] *= val;
 
  205 template < 
class T, 
class Allocator >
 
  206 inline const array1< T, Allocator >& 
operator /=( array1< T, Allocator > &a1, 
typename array1< T, Allocator >::value_type val )
 
  208     typedef typename array1< T, Allocator >::size_type size_type;
 
  209 #ifndef _CHECK_ARRAY_OPERATION_ 
  213         ::std::cerr << 
"zero division occured." << ::std::endl;
 
  217     for( size_type i = 0 ; i < a1.size( ) ; i++ ) a1[i] /= val;
 
  230 template < 
class T, 
class Allocator >
 
  231 inline array1< T, Allocator > 
operator -( 
const array1< T, Allocator > &a )
 
  233     typedef typename array1< T, Allocator >::size_type size_type;
 
  234     array1< T, Allocator > o( a.size1( ), a.reso1( ) );
 
  235     for( size_type i = 0 ; i < o.size( ) ; i++ ) o[i] = -a[i];
 
  249 template < 
class T, 
class Allocator >
 
  250 inline array1< T, Allocator > 
operator +( 
const array1< T, Allocator > &a1, 
const array1< T, Allocator > &a2 )
 
  252     array1< T, Allocator > tmp( a1 );
 
  266 template < 
class T, 
class Allocator >
 
  267 inline array1< T, Allocator > 
operator -( 
const array1< T, Allocator > &a1, 
const array1< T, Allocator > &a2 )
 
  269     array1< T, Allocator > tmp( a1 );
 
  283 template < 
class T, 
class Allocator >
 
  284 inline array1< T, Allocator > 
operator *( 
const array1< T, Allocator > &a1, 
const array1< T, Allocator > &a2 )
 
  286     array1< T, Allocator > tmp( a1 );
 
  300 template < 
class T, 
class Allocator >
 
  301 inline array1< T, Allocator > 
operator /( 
const array1< T, Allocator > &a1, 
const array1< T, Allocator > &a2 )
 
  303     array1< T, Allocator > tmp( a1 );
 
  317 template < 
class T, 
class Allocator >
 
  318 inline array1< T, Allocator > 
operator +( 
const array1< T, Allocator > &a, 
typename array1< T, Allocator >::value_type val )
 
  320     array1< T, Allocator > tmp( a );
 
  321     return( tmp += val );
 
  334 template < 
class T, 
class Allocator >
 
  335 inline array1< T, Allocator > 
operator +( 
typename array1< T, Allocator >::value_type val, 
const array1< T, Allocator > &a )
 
  337     array1< T, Allocator > tmp( a );
 
  338     return( tmp += val );
 
  351 template < 
class T, 
class Allocator >
 
  352 inline array1< T, Allocator > 
operator -( 
const array1< T, Allocator > &a, 
typename array1< T, Allocator >::value_type val )
 
  354     array1< T, Allocator > tmp( a );
 
  355     return( tmp -= val );
 
  368 template < 
class T, 
class Allocator >
 
  369 inline array1< T, Allocator > 
operator -( 
typename array1< T, Allocator >::value_type val, 
const array1< T, Allocator > &a )
 
  371     array1< T, Allocator > tmp( a.size( ), val );
 
  385 template < 
class T, 
class Allocator >
 
  386 inline array1< T, Allocator > 
operator *( 
const array1< T, Allocator > &a, 
typename array1< T, Allocator >::value_type val )
 
  388     array1< T, Allocator > tmp( a );
 
  389     return( tmp *= val );
 
  402 template < 
class T, 
class Allocator >
 
  403 inline array1< T, Allocator > 
operator *( 
typename array1< T, Allocator >::value_type val, 
const array1< T, Allocator > &a )
 
  405     array1< T, Allocator > tmp( a );
 
  406     return( tmp *= val );
 
  419 template < 
class T, 
class Allocator >
 
  420 inline array1< T, Allocator > 
operator /( 
const array1< T, Allocator > &a, 
typename array1< T, Allocator >::value_type val )
 
  422     array1< T, Allocator > tmp( a );
 
  423     return( tmp /= val );
 
  427 #endif // __INCLUDE_MIST_OPERATOR_ARRAY1__