]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement the ability for Vector<T> to work on std::complex vectors.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 5 Nov 2007 03:43:52 +0000 (03:43 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 5 Nov 2007 03:43:52 +0000 (03:43 +0000)
git-svn-id: https://svn.dealii.org/trunk@15443 0785d39b-7218-0410-832d-ea1e28bc413d

105 files changed:
deal.II/lac/include/lac/vector.h
deal.II/lac/include/lac/vector.templates.h
deal.II/lac/source/vector.cc
deal.II/lac/source/vector.long_double.cc
tests/bits/Makefile
tests/bits/complex-vector_11.cc [new file with mode: 0644]
tests/bits/complex-vector_12.cc [new file with mode: 0644]
tests/bits/complex-vector_13.cc [new file with mode: 0644]
tests/bits/complex-vector_14.cc [new file with mode: 0644]
tests/bits/complex-vector_15.cc [new file with mode: 0644]
tests/bits/complex-vector_16.cc [new file with mode: 0644]
tests/bits/complex-vector_17.cc [new file with mode: 0644]
tests/bits/complex-vector_18.cc [new file with mode: 0644]
tests/bits/complex-vector_19.cc [new file with mode: 0644]
tests/bits/complex-vector_20.cc [new file with mode: 0644]
tests/bits/complex-vector_21.cc [new file with mode: 0644]
tests/bits/complex-vector_21_negative.cc [new file with mode: 0644]
tests/bits/complex-vector_22.cc [new file with mode: 0644]
tests/bits/complex-vector_23.cc [new file with mode: 0644]
tests/bits/complex-vector_24.cc [new file with mode: 0644]
tests/bits/complex-vector_25.cc [new file with mode: 0644]
tests/bits/complex-vector_26.cc [new file with mode: 0644]
tests/bits/complex-vector_27.cc [new file with mode: 0644]
tests/bits/complex-vector_28.cc [new file with mode: 0644]
tests/bits/complex-vector_29.cc [new file with mode: 0644]
tests/bits/complex-vector_30.cc [new file with mode: 0644]
tests/bits/complex-vector_31.cc [new file with mode: 0644]
tests/bits/complex-vector_32.cc [new file with mode: 0644]
tests/bits/complex-vector_33.cc [new file with mode: 0644]
tests/bits/complex-vector_34.cc [new file with mode: 0644]
tests/bits/complex-vector_35.cc [new file with mode: 0644]
tests/bits/complex-vector_36.cc [new file with mode: 0644]
tests/bits/complex-vector_37.cc [new file with mode: 0644]
tests/bits/complex-vector_38.cc [new file with mode: 0644]
tests/bits/complex-vector_39.cc [new file with mode: 0644]
tests/bits/complex-vector_40.cc [new file with mode: 0644]
tests/bits/complex-vector_41.cc [new file with mode: 0644]
tests/bits/complex-vector_42.cc [new file with mode: 0644]
tests/bits/complex-vector_43.cc [new file with mode: 0644]
tests/bits/complex-vector_44.cc [new file with mode: 0644]
tests/bits/complex-vector_45.cc [new file with mode: 0644]
tests/bits/complex-vector_46.cc [new file with mode: 0644]
tests/bits/complex-vector_47.cc [new file with mode: 0644]
tests/bits/complex-vector_48.cc [new file with mode: 0644]
tests/bits/complex-vector_49.cc [new file with mode: 0644]
tests/bits/complex-vector_57.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_1.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_2.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_3.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_4.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_5.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_6.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_7.cc [new file with mode: 0644]
tests/bits/complex-vector_equality_8.cc [new file with mode: 0644]
tests/bits/complex-vector_vector_01.cc [new file with mode: 0644]
tests/bits/complex_vector_11/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_12/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_13/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_14/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_15/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_16/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_17/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_18/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_19/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_20/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_21/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_21_negative/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_22/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_23/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_24/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_25/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_26/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_27/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_28/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_29/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_30/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_31/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_32/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_33/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_34/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_35/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_36/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_37/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_38/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_39/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_40/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_41/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_42/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_43/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_44/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_45/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_46/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_47/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_48/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_49/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_57/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_1/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_2/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_3/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_4/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_5/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_6/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_7/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_equality_8/cmp/generic [new file with mode: 0644]
tests/bits/complex_vector_vector_01/cmp/generic [new file with mode: 0644]

index 40014ecb151d9946a28b2f874e65eb8fe3a7d67f..daaaa7ca8bbc2c480b8095ad7878c05d1395ed0e 100644 (file)
@@ -71,14 +71,15 @@ class Vector : public Subscriptor
                                      * those in the <tt>C++</tt> standard libraries
                                      * <tt>vector<...></tt> class.
                                      */
-    typedef Number            value_type;
-    typedef value_type       *pointer;
-    typedef const value_type *const_pointer;
-    typedef value_type       *iterator;
-    typedef const value_type *const_iterator;
-    typedef value_type       &reference;
-    typedef const value_type &const_reference;
-    typedef size_t            size_type;
+    typedef Number                                            value_type;
+    typedef typename numbers::NumberTraits<Number>::real_type real_type;
+    typedef value_type                                       *pointer;
+    typedef const value_type                                 *const_pointer;
+    typedef value_type                                       *iterator;
+    typedef const value_type                                 *const_iterator;
+    typedef value_type                                       &reference;
+    typedef const value_type                                 &const_reference;
+    typedef size_t                                            size_type;
 
 
                                     /**
@@ -389,7 +390,7 @@ class Vector : public Subscriptor
                                     /**
                                      * Return square of the $l_2$-norm.
                                      */
-    Number norm_sqr () const;
+    real_type norm_sqr () const;
 
                                     /**
                                      * Mean value of the elements of
@@ -401,14 +402,14 @@ class Vector : public Subscriptor
                                      * $l_1$-norm of the vector.
                                      * The sum of the absolute values.
                                      */
-    Number l1_norm () const;
+    real_type l1_norm () const;
 
                                     /**
                                      * $l_2$-norm of the vector.  The
                                      * square root of the sum of the
                                      * squares of the elements.
                                      */
-    Number l2_norm () const;
+    real_type l2_norm () const;
 
                                     /**
                                      * $l_p$-norm of the vector. The
@@ -416,13 +417,13 @@ class Vector : public Subscriptor
                                      * powers of the absolute values
                                      * of the elements.
                                      */
-    Number lp_norm (const Number p) const;
+    real_type lp_norm (const real_type p) const;
 
                                     /**
                                      * Maximum absolute value of the
                                      * elements.
                                      */
-    Number linfty_norm () const;
+    real_type linfty_norm () const;
 
                                     /**
                                      * Return dimension of the vector.
@@ -446,15 +447,21 @@ class Vector : public Subscriptor
                                       * used, for example, to check whether
                                       * refinement indicators are really all
                                       * positive (or zero).
+                                     *
+                                     * The function obviously only makes
+                                     * sense if the template argument of this
+                                     * class is a real type. If it is a
+                                     * complex type, then an exception is
+                                     * thrown.
                                       */
     bool is_non_negative () const;
     
                                     /**
-                                     * Make the @p Vector class a bit like the
-                                     * <tt>vector<></tt> class of the C++ standard
-                                     * library by returning iterators to
-                                     * the start and end of the elements of this
-                                     * vector.
+                                     * Make the @p Vector class a bit like
+                                     * the <tt>vector<></tt> class of the C++
+                                     * standard library by returning
+                                     * iterators to the start and end of the
+                                     * elements of this vector.
                                      */
     iterator begin ();
 
@@ -660,7 +667,11 @@ class Vector : public Subscriptor
                                      */
                                     //@{
                                     /**
-                                     *  Output of vector in user-defined format.
+                                     *  Output of vector in user-defined
+                                     *  format. For complex-valued vectors,
+                                     *  the format should include specifiers
+                                     *  for both the real and imaginary
+                                     *  parts.
                                      */
     void print (const char* format = 0) const;
 
@@ -956,9 +967,9 @@ Vector<Number>::operator /= (const Number factor)
 {
   Assert (numbers::is_finite(factor), 
           ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
-  Assert (factor != 0., ExcZero() );
+  Assert (factor != Number(0.), ExcZero() );
 
-  *this *= (1./factor);
+  this->operator *= (Number(1.)/factor);
   return *this;
 }
 
index 3cea6f17f280fdce5c37147eff896fad13c3f78c..f2b23a267234b4b158cda077751edf505beedfcd 100644 (file)
@@ -15,6 +15,7 @@
 
 
 #include <base/template_constraints.h>
+#include <base/numbers.h>
 #include <lac/vector.h>
 #include <lac/block_vector.h>
 
 
 DEAL_II_NAMESPACE_OPEN
 
-/*
-  Note that in this file, we use std::fabs, std::sqrt, etc
-  everywhere. The reason is that we want to use those version of these
-  functions that take a variable of the template type "Number", rather
-  than the C standard function which accepts and returns a double. The
-  C++ standard library therefore offers overloaded versions of these
-  functions taking floats, or long doubles, with the importance on the
-  additional accuracy when using long doubles.
- */
-
 namespace internal
 {
-  namespace VectorHelper
+  template <typename T>
+  bool is_non_negative (const T &t)
   {
-    template <typename Number>
-    inline Number sqr (const Number x)
-    {
-      Assert (numbers::is_finite(x), 
-             ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
-      return x*x;
-    }
+    return t >= 0;
+  }
+
+
+  template <typename T>
+  bool is_non_negative (const std::complex<T> &)
+  {
+    Assert (false,
+           ExcMessage ("Complex numbers do not have an ordering."));
+    
+    return false;
   }
-}
 
 
+  template <typename T>
+  void print (const T    &t,
+             const char *format)
+  {
+    if (format != 0)
+      std::printf (format, t);
+    else
+      std::printf (" %5.2f", double(t));
+  }
+  
+
+
+  template <typename T>
+  void print (const std::complex<T> &t,
+             const char            *format)
+  {
+    if (format != 0)
+      std::printf (format, t.real(), t.imag());
+    else
+      std::printf (" %5.2f+%5.2fi",
+                  double(t.real()), double(t.imag()));
+  }
+}
 
 
 template <typename Number>
 Vector<Number>::Vector (const Vector<Number>& v)
-                : Subscriptor(),
+                :
+               Subscriptor(),
                vec_size(v.size()),
                max_vec_size(v.size()),
                val(0)
@@ -78,7 +97,8 @@ Vector<Number>::Vector (const Vector<Number>& v)
 template <typename Number>
 template <typename OtherNumber>
 Vector<Number>::Vector (const Vector<OtherNumber>& v)
-                : Subscriptor(),
+                :
+               Subscriptor(),
                vec_size(v.size()),
                max_vec_size(v.size()),
                val(0)
@@ -97,7 +117,8 @@ Vector<Number>::Vector (const Vector<OtherNumber>& v)
 
 template <typename Number>
 Vector<Number>::Vector (const PETScWrappers::Vector &v)
-                : Subscriptor(),
+                :
+               Subscriptor(),
                vec_size(v.size()),
                max_vec_size(v.size()),
                val(0)
@@ -126,7 +147,8 @@ Vector<Number>::Vector (const PETScWrappers::Vector &v)
 
 template <typename Number>
 Vector<Number>::Vector (const PETScWrappers::MPI::Vector &v)
-                : Subscriptor(),
+                :
+               Subscriptor(),
                vec_size(0),
                max_vec_size(0),
                val(0)
@@ -146,7 +168,8 @@ Vector<Number>::Vector (const PETScWrappers::MPI::Vector &v)
 
 template <typename Number>
 template <typename Number2>
-void Vector<Number>::reinit (const Vector<Number2>& v, const bool fast)
+void Vector<Number>::reinit (const Vector<Number2>& v,
+                            const bool fast)
 {
   reinit (v.size(), fast);
 }
@@ -157,9 +180,9 @@ template <typename Number>
 void
 Vector<Number>::swap (Vector<Number> &v)
 {
-  std::swap (vec_size,    v.vec_size);
+  std::swap (vec_size,     v.vec_size);
   std::swap (max_vec_size, v.max_vec_size);
-  std::swap (val,    v.val);
+  std::swap (val,          v.val);
 }
 
 
@@ -169,11 +192,9 @@ bool
 Vector<Number>::all_zero () const
 {
   Assert (vec_size!=0, ExcEmptyObject());
-  
-  const_iterator p = begin(),
-                e = end();
-  while (p!=e)
-    if (*p++ != 0.0)
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    if (val[i] != Number(0))
       return false;
   return true;
 }
@@ -186,11 +207,10 @@ Vector<Number>::is_non_negative () const
 {
   Assert (vec_size!=0, ExcEmptyObject());
   
-  const_iterator p = begin(),
-                e = end();
-  while (p!=e)
-    if (*p++ < 0.0)
+  for (unsigned int i=0; i<vec_size; ++i)
+    if ( ! internal::is_non_negative (val[i]))
       return false;
+
   return true;
 }
 
@@ -205,61 +225,36 @@ Number Vector<Number>::operator * (const Vector<Number2>& v) const
   if (PointerComparison::equal (this, &v))
     return norm_sqr();
   
-  Assert (vec_size == v.size(), ExcDimensionMismatch(vec_size, v.size()));
+  Assert (vec_size == v.size(),
+         ExcDimensionMismatch(vec_size, v.size()));
   
-  Number sum0 = 0,
-        sum1 = 0,
-        sum2 = 0,
-        sum3 = 0;
-
-                                  // use modern processors better by
-                                  // allowing pipelined commands to be
-                                  // executed in parallel
-  const_iterator ptr  = begin(),
-                eptr = ptr + (vec_size/4)*4;
-  typename Vector<Number2>::const_iterator vptr = v.begin();
-  while (ptr!=eptr)
-    {
-      sum0 += (*ptr++ * *vptr++);
-      sum1 += (*ptr++ * *vptr++);
-      sum2 += (*ptr++ * *vptr++);
-      sum3 += (*ptr++ * *vptr++);
-    };
-                                  // add up remaining elements
-  while (ptr != end())
-    sum0 += *ptr++ * *vptr++;
+  Number sum = 0;
+
+                                  // multiply the two vectors. we have to
+                                  // convert the elements of u to the type of
+                                  // the result vector. this is necessary
+                                  // because
+                                  // operator*(complex<float>,complex<double>)
+                                  // is not defined by default
+  for (unsigned int i=0; i<vec_size; ++i)
+    sum += numbers::NumberTraits<Number>::conjugate(val[i]) * Number(v.val[i]);
     
-  return sum0+sum1+sum2+sum3;
+  return sum;
 }
 
 
 template <typename Number>
-Number Vector<Number>::norm_sqr () const
+typename Vector<Number>::real_type
+Vector<Number>::norm_sqr () const
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  Number sum0 = 0,
-        sum1 = 0,
-        sum2 = 0,
-        sum3 = 0;
-
-                                  // use modern processors better by
-                                  // allowing pipelined commands to be
-                                  // executed in parallel
-  const_iterator ptr  = begin(),
-                eptr = ptr + (vec_size/4)*4;
-  while (ptr!=eptr)
-    {
-      sum0 += internal::VectorHelper::sqr(*ptr++);
-      sum1 += internal::VectorHelper::sqr(*ptr++);
-      sum2 += internal::VectorHelper::sqr(*ptr++);
-      sum3 += internal::VectorHelper::sqr(*ptr++);
-    };
-                                  // add up remaining elements
-  while (ptr != end())
-    sum0 += internal::VectorHelper::sqr(*ptr++);
+  real_type sum = 0;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    sum += numbers::NumberTraits<Number>::abs_square(val[i]);
   
-  return sum0+sum1+sum2+sum3;
+  return sum;
 }
 
 
@@ -268,123 +263,69 @@ Number Vector<Number>::mean_value () const
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  Number sum0 = 0,
-        sum1 = 0,
-        sum2 = 0,
-        sum3 = 0;
-
-                                  // use modern processors better by
-                                  // allowing pipelined commands to be
-                                  // executed in parallel
-  const_iterator ptr  = begin(),
-                eptr = ptr + (vec_size/4)*4;
-  while (ptr!=eptr)
-    {
-      sum0 += *ptr++;
-      sum1 += *ptr++;
-      sum2 += *ptr++;
-      sum3 += *ptr++;
-    };
-                                  // add up remaining elements
-  while (ptr != end())
-    sum0 += *ptr++;
+  Number sum = 0;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    sum += val[i];
   
-  return (sum0+sum1+sum2+sum3)/size();
+  return sum / real_type(size());
 }
 
 
 
 template <typename Number>
-Number Vector<Number>::l1_norm () const
+typename Vector<Number>::real_type
+Vector<Number>::l1_norm () const
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  Number sum0 = 0,
-        sum1 = 0,
-        sum2 = 0,
-        sum3 = 0;
-
-                                  // use modern processors better by
-                                  // allowing pipelined commands to be
-                                  // executed in parallel
-  const_iterator ptr  = begin(),
-                eptr = ptr + (vec_size/4)*4;
-  while (ptr!=eptr)
-    {
-      sum0 += std::fabs(*ptr++);
-      sum1 += std::fabs(*ptr++);
-      sum2 += std::fabs(*ptr++);
-      sum3 += std::fabs(*ptr++);
-    };
-                                  // add up remaining elements
-  while (ptr != end())
-    sum0 += std::fabs(*ptr++);
-  
-  return sum0+sum1+sum2+sum3;
+  real_type sum = 0;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    sum += numbers::NumberTraits<Number>::abs(val[i]);
+
+  return sum;
 }
 
 
+
 template <typename Number>
-Number Vector<Number>::l2_norm () const
+typename Vector<Number>::real_type
+Vector<Number>::l2_norm () const
 {
   return std::sqrt(norm_sqr());
 }
 
 
+
 template <typename Number>
-Number Vector<Number>::lp_norm (const Number p) const
+typename Vector<Number>::real_type
+Vector<Number>::lp_norm (const real_type p) const
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  Number sum0 = 0,
-        sum1 = 0,
-        sum2 = 0,
-        sum3 = 0;
-
-                                  // use modern processors better by
-                                  // allowing pipelined commands to be
-                                  // executed in parallel
-  const_iterator ptr  = begin(),
-                eptr = ptr + (vec_size/4)*4;
-  while (ptr!=eptr)
-    {
-      sum0 += std::pow(std::fabs(*ptr++), p);
-      sum1 += std::pow(std::fabs(*ptr++), p);
-      sum2 += std::pow(std::fabs(*ptr++), p);
-      sum3 += std::pow(std::fabs(*ptr++), p);
-    };
-                                  // add up remaining elements
-  while (ptr != end())
-    sum0 += std::pow(std::fabs(*ptr++), p);
+  real_type sum = 0;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    sum += std::pow (numbers::NumberTraits<Number>::abs(val[i]), p);
   
-  return std::pow(sum0+sum1+sum2+sum3,
-                 static_cast<Number>(1./p));
+  return std::pow(sum, static_cast<real_type>(1./p));
 }
 
 
+
 template <typename Number>
-Number Vector<Number>::linfty_norm () const
+typename Vector<Number>::real_type
+Vector<Number>::linfty_norm () const
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  Number max0=0.,
-        max1=0.,
-        max2=0.,
-        max3=0.;
-  for (unsigned int i=0; i<(vec_size/4); ++i) 
-    {
-      if (max0<std::fabs(val[4*i]))   max0=std::fabs(val[4*i]);
-      if (max1<std::fabs(val[4*i+1])) max1=std::fabs(val[4*i+1]);
-      if (max2<std::fabs(val[4*i+2])) max2=std::fabs(val[4*i+2]);
-      if (max3<std::fabs(val[4*i+3])) max3=std::fabs(val[4*i+3]);
-    };
-                                  // add up remaining elements
-  for (unsigned int i=(vec_size/4)*4; i<vec_size; ++i)
-    if (max0<std::fabs(val[i]))
-      max0 = std::fabs(val[i]);
+  real_type max = 0;
 
-  return std::max (std::max(max0, max1),
-                  std::max(max2, max3));
+  for (unsigned int i=0; i<vec_size; ++i)
+    max = std::max (numbers::NumberTraits<Number>::abs(val[i]), max);
+
+  return max;
 }
 
 
@@ -404,11 +345,8 @@ Vector<Number>& Vector<Number>::operator -= (const Vector<Number>& v)
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator v_ptr = v.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ -= *v_ptr++;
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] -= v.val[i];
 
   return *this;
 }
@@ -419,10 +357,8 @@ void Vector<Number>::add (const Number v)
 {
   Assert (vec_size!=0, ExcEmptyObject());
 
-  iterator i_ptr = begin(),
-          i_end = end();
-  while (i_ptr!=i_end)
-    *i_ptr++ += v;
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] += v;
 }
 
 
@@ -432,11 +368,8 @@ void Vector<Number>::add (const Vector<Number>& v)
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
 
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator v_ptr = v.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ += *v_ptr++;
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] += v.val[i];
 }
 
 
@@ -452,28 +385,24 @@ void Vector<Number>::add (const Number a, const Vector<Number>& v,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator v_ptr = v.begin(),
-                w_ptr = w.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ += a * *v_ptr++ + b * *w_ptr++;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] += a*v.val[i] + b*w.val[i];
 }
 
 
 template <typename Number>
-void Vector<Number>::sadd (const Number x, const Vector<Number>& v)
+void Vector<Number>::sadd (const Number x,
+                          const Vector<Number>& v)
 {
   Assert (numbers::is_finite(x), 
           ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
 
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator v_ptr = v.begin();
-  for (; i_ptr!=i_end; ++i_ptr)
-    *i_ptr = x * *i_ptr  + *v_ptr++;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = x*val[i] + v.val[i];
 }
 
 
@@ -493,12 +422,9 @@ void Vector<Number>::sadd (const Number x, const Number a,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator v_ptr = v.begin(),
-                w_ptr = w.begin();
-  for (; i_ptr!=i_end; ++i_ptr)
-    *i_ptr = x * *i_ptr  +  a * *v_ptr++  + b * *w_ptr++;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = x*val[i] + a*v.val[i] + b*w.val[i];
 }
 
 
@@ -521,14 +447,9 @@ void Vector<Number>::sadd (const Number x, const Number a,
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
   Assert (vec_size == y.vec_size, ExcDimensionMismatch(vec_size, y.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator v_ptr = v.begin(),
-                w_ptr = w.begin(),
-                y_ptr = y.begin();
-  
-  for (; i_ptr!=i_end; ++i_ptr)
-    *i_ptr = (x * *i_ptr)  +  (a * *v_ptr++)  +  (b * *w_ptr++)  + (c * *y_ptr++);
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = x*val[i] + a*v.val[i] + b*w.val[i] +c*y.val[i];
 }
 
 
@@ -540,28 +461,30 @@ void Vector<Number>::scale (const Vector<Number2> &s)
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size));
   
-  iterator             ptr  = begin();
-  const const_iterator eptr = end();
-  typename Vector<Number2>::const_iterator sptr = s.begin();
-  while (ptr!=eptr)
-    *ptr++ *= *sptr++;
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] *= s.val[i];
 }
 
 
 template <typename Number>
 template <typename Number2>
-void Vector<Number>::equ (const Number a, const Vector<Number2>& u)
+void Vector<Number>::equ (const Number a,
+                         const Vector<Number2>& u)
 {
   Assert (numbers::is_finite(a), 
          ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
 
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  typename Vector<Number2>::const_iterator u_ptr = u.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ = a * *u_ptr++;
+
+                                  // set the result vector to a*u. we have to
+                                  // convert the elements of u to the type of
+                                  // the result vector. this is necessary
+                                  // because
+                                  // operator*(complex<float>,complex<double>)
+                                  // is not defined by default
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = a * Number(u.val[i]);
 }
 
 
@@ -577,12 +500,9 @@ void Vector<Number>::equ (const Number a, const Vector<Number>& u,
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size));
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator u_ptr = u.begin(),
-                v_ptr = v.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ = a * *u_ptr++  + b * *v_ptr++;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = a * u.val[i] + b * v.val[i];
 }
 
 
@@ -595,31 +515,26 @@ void Vector<Number>::equ (const Number a, const Vector<Number>& u,
   Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size));
   Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
   Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size));
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator u_ptr = u.begin(),
-                v_ptr = v.begin(),
-                w_ptr = w.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ = a * *u_ptr++  + b * *v_ptr++ + c * *w_ptr++;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = a * u.val[i] + b * v.val[i] + c * w.val[i];
 }
 
 
 template <typename Number>
-void Vector<Number>::ratio (const Vector<Number> &a, const Vector<Number> &b)
+void Vector<Number>::ratio (const Vector<Number> &a,
+                           const Vector<Number> &b)
 {
   Assert (vec_size!=0, ExcEmptyObject());
-  Assert (a.vec_size == b.vec_size, ExcDimensionMismatch (a.vec_size, b.vec_size));
+  Assert (a.vec_size == b.vec_size,
+         ExcDimensionMismatch (a.vec_size, b.vec_size));
 
                                   // no need to reinit with zeros, since
                                   // we overwrite them anyway
   reinit (a.size(), true);
-  iterator i_ptr = begin(),
-          i_end = end();
-  const_iterator a_ptr = a.begin(),
-                b_ptr = b.begin();
-  while (i_ptr!=i_end)
-    *i_ptr++ = *a_ptr++ / *b_ptr++;
+
+  for (unsigned int i=0; i<vec_size; ++i)
+    val[i] = a.val[i] / b.val[i];
 }
 
 
@@ -723,8 +638,14 @@ Vector<Number>::operator == (const Vector<Number2>& v) const
   Assert (vec_size!=0, ExcEmptyObject());
   Assert (vec_size == v.size(), ExcDimensionMismatch(vec_size, v.size()));
 
+                                  // compare the two vector. we have to
+                                  // convert the elements of v to the type of
+                                  // the result vector. this is necessary
+                                  // because
+                                  // operator==(complex<float>,complex<double>)
+                                  // is not defined by default
   for (unsigned int i=0; i<vec_size; ++i)
-    if (val[i] != v.val[i])
+    if (val[i] != Number(v.val[i]))
       return false;
 
   return true;
@@ -733,12 +654,12 @@ Vector<Number>::operator == (const Vector<Number2>& v) const
 
 
 template <typename Number>
-void Vector<Number>::print (const charformat) const
+void Vector<Number>::print (const char *format) const
 {
   Assert (vec_size!=0, ExcEmptyObject());
-  if (!format) format = " %5.2f";
-  for (unsigned int j=0;j<size();j++)
-    std::printf (format, val[j]);
+
+  for (unsigned int j=0; j<size(); ++j)
+    internal::print (val[j], format);
   std::printf ("\n");
 }
 
@@ -764,10 +685,10 @@ void Vector<Number>::print (std::ostream      &out,
 
   if (across)
     for (unsigned int i=0; i<size(); ++i)
-      out << static_cast<double>(val[i]) << ' ';
+      out << val[i] << ' ';
   else
     for (unsigned int i=0; i<size(); ++i)
-      out << static_cast<double>(val[i]) << std::endl;
+      out << val[i] << std::endl;
   out << std::endl;
   
   AssertThrow (out, ExcIO());
index 53a5636bcc75280fdda1264c9fda27f35be2e2ea..b25a361fe1fff3bed4e856b4d13644fa554d16f4 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -53,4 +53,43 @@ template void Vector<float>::equ<float>(const float, const Vector<float>&);
 template void Vector<float>::scale<double>(const Vector<double>&);
 template void Vector<float>::scale<float>(const Vector<float>&);
 
+
+
+// complex data types
+template class Vector<std::complex<double> >;
+
+#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG    
+template Vector<std::complex<double> >::Vector (const Vector<std::complex<float> > &);
+#endif
+
+template Vector<std::complex<double> >& Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<std::complex<float> >(const Vector<std::complex<float> >&);
+template bool Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator==<std::complex<double> >(const Vector<std::complex<double> >&) const;
+template bool Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator==<std::complex<float> >(const Vector<std::complex<float> >&) const;
+template std::complex<double> Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator*<std::complex<float> >(const Vector<std::complex<float> >&) const;
+template std::complex<double> Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator*<std::complex<double> >(const Vector<std::complex<double> >&) const;
+template void Vector<std::complex<double> >::reinit<std::complex<double> >(const Vector<std::complex<double> >&, const bool);
+template void Vector<std::complex<double> >::reinit<std::complex<float> >(const Vector<std::complex<float> >&, const bool);
+template void Vector<std::complex<double> >::equ<std::complex<double> >(const std::complex<double>, const Vector<std::complex<double> >&);
+template void Vector<std::complex<double> >::equ<std::complex<float> >(const std::complex<double>, const Vector<std::complex<float> >&);
+template void Vector<std::complex<double> >::scale<std::complex<double> >(const Vector<std::complex<double> >&);
+template void Vector<std::complex<double> >::scale<std::complex<float> >(const Vector<std::complex<float> >&);
+
+template class Vector<std::complex<float> >;
+
+#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG    
+template Vector<std::complex<float> >::Vector (const Vector<std::complex<double> > &);
+#endif
+
+template Vector<std::complex<float> >& Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<std::complex<double> >(const Vector<std::complex<double> >&);
+template bool Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator==<std::complex<double> >(const Vector<std::complex<double> >&) const;
+template bool Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator==<std::complex<float> >(const Vector<std::complex<float> >&) const;
+template std::complex<float> Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator*<std::complex<float> >(const Vector<std::complex<float> >&) const;
+template std::complex<float> Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator*<std::complex<double> >(const Vector<std::complex<double> >&) const;
+template void Vector<std::complex<float> >::reinit<std::complex<double> >(const Vector<std::complex<double> >&, const bool);
+template void Vector<std::complex<float> >::reinit<std::complex<float> >(const Vector<std::complex<float> >&, const bool);
+template void Vector<std::complex<float> >::equ<std::complex<double> >(const std::complex<float>, const Vector<std::complex<double> >&);
+template void Vector<std::complex<float> >::equ<std::complex<float> >(const std::complex<float>, const Vector<std::complex<float> >&);
+template void Vector<std::complex<float> >::scale<std::complex<double> >(const Vector<std::complex<double> >&);
+template void Vector<std::complex<float> >::scale<std::complex<float> >(const Vector<std::complex<float> >&);
+
 DEAL_II_NAMESPACE_CLOSE
index 300c9cc110f6749d3d1c5d05c0cc8e69218ed8c9..33577c38444f9e79d66d4a4fbb50c3227fe7de9f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -16,7 +16,7 @@
 
 DEAL_II_NAMESPACE_OPEN
 
-// explicit instantiations
+// explicit instantiations for long double
 template class Vector<long double>;
 
 #if !defined(DEAL_II_EXPLICIT_CONSTRUCTOR_BUG) && !defined(DEAL_II_LONG_DOUBLE_LOOP_BUG)
@@ -49,4 +49,38 @@ template float Vector<float>::DEAL_II_MEMBER_OP_TEMPLATE_INST operator *<long do
 template void Vector<float>::reinit<long double>(const Vector<long double>&, const bool);
 template void Vector<float>::equ<long double>(const float, const Vector<long double>&);
 
+
+// explicit instantiations for std::complex<long double>
+template class Vector<std::complex<long double> >;
+
+#if !defined(DEAL_II_EXPLICIT_CONSTRUCTOR_BUG) && !defined(DEAL_II_LONG_DOUBLE_LOOP_BUG)
+template Vector<std::complex<long double> >::Vector (const Vector<std::complex<double> > &);
+template Vector<std::complex<long double> >::Vector (const Vector<std::complex<float> > &);
+
+template Vector<std::complex<double> >::Vector (const Vector<std::complex<long double> > &);
+template Vector<std::complex<float> >::Vector (const Vector<std::complex<long double> > &);
+#endif
+
+template Vector<std::complex<long double> >& Vector<std::complex<long double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<std::complex<double> >(const Vector<std::complex<double> >&);
+template Vector<std::complex<long double> >& Vector<std::complex<long double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<std::complex<float> >(const Vector<std::complex<float> >&);
+template std::complex<long double> Vector<std::complex<long double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator *<std::complex<long double> > (const Vector<std::complex<long double> > &) const;
+template std::complex<long double> Vector<std::complex<long double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator *<std::complex<double> > (const Vector<std::complex<double> > &) const;
+template std::complex<long double> Vector<std::complex<long double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator *<std::complex<float> > (const Vector<std::complex<float> > &) const;
+template void Vector<std::complex<long double> >::reinit<std::complex<long double> >(const Vector<std::complex<long double> >&, const bool);
+template void Vector<std::complex<long double> >::reinit<std::complex<double> >(const Vector<std::complex<double> >&, const bool);
+template void Vector<std::complex<long double> >::reinit<std::complex<float> >(const Vector<std::complex<float> >&, const bool);
+template void Vector<std::complex<long double> >::equ<std::complex<long double> >(const std::complex<long double>, const Vector<std::complex<long double> >&);
+template void Vector<std::complex<long double> >::equ<std::complex<double> >(const std::complex<long double>, const Vector<std::complex<double> >&);
+template void Vector<std::complex<long double> >::equ<std::complex<float> >(const std::complex<long double>, const Vector<std::complex<float> >&);
+
+template Vector<std::complex<double> >& Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<std::complex<long double> >(const Vector<std::complex<long double> >&);
+template std::complex<double> Vector<std::complex<double> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator *<std::complex<long double> > (const Vector<std::complex<long double> > &) const;
+template void Vector<std::complex<double> >::reinit<std::complex<long double> >(const Vector<std::complex<long double> >&, const bool);
+template void Vector<std::complex<double> >::equ<std::complex<long double> >(const std::complex<double>, const Vector<std::complex<long double> >&);
+
+template Vector<std::complex<float> >& Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<std::complex<long double> >(const Vector<std::complex<long double> >&);
+template std::complex<float> Vector<std::complex<float> >::DEAL_II_MEMBER_OP_TEMPLATE_INST operator *<std::complex<long double> > (const Vector<std::complex<long double> > &) const;
+template void Vector<std::complex<float> >::reinit<std::complex<long double> >(const Vector<std::complex<long double> >&, const bool);
+template void Vector<std::complex<float> >::equ<std::complex<long double> >(const std::complex<float>, const Vector<std::complex<long double> >&);
+
 DEAL_II_NAMESPACE_CLOSE
index ea9420c0f29c69b484609c55f9691e6c79f6cb8a..8bee45bc6818a849e9b1a12e3d983391c7a6b88c 100644 (file)
@@ -64,6 +64,7 @@ tests_x = grid_generator_?? \
          solver_* \
          deal_solver_* \
          vector_* \
+         complex-vector_* \
          subdomain_ids_* \
          dof_constraints_* \
          apply_boundary_values_* \
diff --git a/tests/bits/complex-vector_11.cc b/tests/bits/complex-vector_11.cc
new file mode 100644 (file)
index 0000000..1012df6
--- /dev/null
@@ -0,0 +1,74 @@
+//----------------------------  vector_11.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_11.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::size()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the vector
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) = std::complex<double> (i+1., i+2.);
+
+  v.compress ();
+  
+  Assert (v.size() == 100, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_11/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_12.cc b/tests/bits/complex-vector_12.cc
new file mode 100644 (file)
index 0000000..91a50b6
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  vector_12.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_12.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator() in set-mode
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert ((((pattern[i] == true) && (v(i) == std::complex<double> (i+1., i+2.)))
+             ||
+             ((pattern[i] == false) && (v(i) == std::complex<double> (0)))),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_12/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_13.cc b/tests/bits/complex-vector_13.cc
new file mode 100644 (file)
index 0000000..74bb60e
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  vector_13.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_13.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator() in add-mode
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert ((((pattern[i] == true) && (v(i) == std::complex<double> (i+1., i+2.)))
+             ||
+             ((pattern[i] == false) && (v(i) == std::complex<double> (0)))),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_13/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_14.cc b/tests/bits/complex-vector_14.cc
new file mode 100644 (file)
index 0000000..6c7eb4c
--- /dev/null
@@ -0,0 +1,93 @@
+//----------------------------  vector_14.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_14.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator() in set/add-mode alternatingly
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  bool flag = false;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      if (flag == true)
+        v(i) += std::complex<double> (i+1., i+2.);
+      else
+        v(i) = std::complex<double> (i+1., i+2.);
+      flag = !flag;
+      
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == std::complex<double> (i+1., i+2.)))
+           ||
+           ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_14/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_15.cc b/tests/bits/complex-vector_15.cc
new file mode 100644 (file)
index 0000000..5de8f96
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  vector_15.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_15.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator() in set/add-mode alternatingly, but
+// writing to the same elements
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) += std::complex<double> (i+1., i+2.);
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == 2.*std::complex<double> (i+1., i+2.)))
+           ||
+           ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
+           ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_15/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_16.cc b/tests/bits/complex-vector_16.cc
new file mode 100644 (file)
index 0000000..b1e1b59
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  vector_16.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_16.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator() in set/add-mode alternatingly, but
+// writing and overwriting the same elements
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) += std::complex<double> (i+1., i+2.);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) = std::complex<double> (i+1., i+2.);
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == std::complex<double> (i+1., i+2.)))
+           ||
+           ((pattern[i] == false) && (v(i) == std::complex<double> (0))),
+           ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_16/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_17.cc b/tests/bits/complex-vector_17.cc
new file mode 100644 (file)
index 0000000..4d96b21
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  vector_17.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_17.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::l1_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  double norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      norm += std::abs(std::complex<double> (i+1., i+2.));
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (v.l1_norm() == norm, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_17/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_18.cc b/tests/bits/complex-vector_18.cc
new file mode 100644 (file)
index 0000000..30e3295
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  vector_18.cc  ---------------------------
+//    vector_18.cc,v 1.4 2004/02/26 17:25:45 wolf Exp
+//    Version:  
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_18.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::l2_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  double norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      norm += std::abs(std::complex<double> (i+1., i+2.))*
+             std::abs(std::complex<double> (i+1., i+2.));
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::fabs((v.l2_norm() - std::sqrt(norm))/std::sqrt(norm)) < 1e-14, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_18/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_19.cc b/tests/bits/complex-vector_19.cc
new file mode 100644 (file)
index 0000000..a054e8e
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  vector_19.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_19.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::linfty_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  double norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      norm = std::max(norm,
+                     std::abs(std::complex<double> (i+1., i+2.)));
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (v.linfty_norm() == norm, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_19/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_20.cc b/tests/bits/complex-vector_20.cc
new file mode 100644 (file)
index 0000000..821921e
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  vector_20.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_20.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator *=
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+  v.compress ();
+
+                                   // multiply v with 5/4
+  v *= 5./4.;
+
+                                   // check that the entries are ok
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == std::complex<double> (i+1., i+2.)*5./4.))
+           ||
+           ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
+           ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_20/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_21.cc b/tests/bits/complex-vector_21.cc
new file mode 100644 (file)
index 0000000..129dc06
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  vector_21.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_21.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator /=
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+  v.compress ();
+
+                                   // multiply v with 3/4
+  v /= 4./3.;
+
+                                   // check that the entries are ok
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == std::complex<double> (i+1., i+2.)*3./4.))
+           ||
+           ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
+           ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_21/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_21_negative.cc b/tests/bits/complex-vector_21_negative.cc
new file mode 100644 (file)
index 0000000..efa3e93
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  vector_21_negative.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_21_negative.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator /=. the original check was that the factor
+// by which we divide must be positive. this is of course nonsensical, it
+// should have been that the factor is != 0...
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = 1.*i*std::complex<double> (i+1., i+2.);
+      pattern[i] = true;
+    }
+  v.compress ();
+
+                                   // multiply v with 3/4
+  v /= -4./3.;
+
+                                   // check that the entries are ok
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i)-(-1.*i*std::complex<double> (i+1., i+2.)*3./4.) == std::complex<double>(0)))
+           ||
+           ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
+           ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_21_negative/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_22.cc b/tests/bits/complex-vector_22.cc
new file mode 100644 (file)
index 0000000..67e3b28
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  vector_22.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_22.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator*(Vector) on two vectors that are
+// orthogonal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector, but disjoint sets of elements
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+    else
+      w(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+  w.compress ();
+
+                                   // make sure the scalar product is zero
+  Assert (v*w == std::complex<double>(0), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_22/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_23.cc b/tests/bits/complex-vector_23.cc
new file mode 100644 (file)
index 0000000..e3b300d
--- /dev/null
@@ -0,0 +1,97 @@
+//----------------------------  vector_23.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_23.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator*(Vector) on two vectors that are
+// not orthogonal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector, and record the expected scalar
+                                   // product
+  std::complex<double> product = 0;
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        {
+          w(i) = std::complex<double> (i+1., i+2.);
+          product += 1.*i*std::complex<double> (i+1., i+2.);
+        }
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  
+                                   // make sure the scalar product is correct
+  deallog << v*w << ' ' << w*v << ' '
+         << product << ' ' << std::conj(product) << std::endl;
+  
+  Assert (v*w == product, ExcInternalError());
+
+                                  // also make sure that v*w=conj(w*v)
+  Assert (w*v == std::conj(product), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_23/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_24.cc b/tests/bits/complex-vector_24.cc
new file mode 100644 (file)
index 0000000..fb1217c
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_24.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_24.cc  ---------------------------
+
+
+// this test used to check for Vector::clear(). However, this
+// function has since been removed, so we test for v=0 instead, although that
+// may be covered by one of the other tests
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+                                   // then clear it again and make sure the
+                                   // vector is really empty
+  const unsigned int sz = v.size();
+  v = 0;
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_24/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_25.cc b/tests/bits/complex-vector_25.cc
new file mode 100644 (file)
index 0000000..d8f3b26
--- /dev/null
@@ -0,0 +1,78 @@
+//----------------------------  vector_25.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_25.cc  ---------------------------
+
+// check Vector::operator = (Scalar) with setting to zero
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+                                   // then clear it again and make sure the
+                                   // vector is really empty
+  const unsigned int sz = v.size();
+  v = 0;
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_25/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_26.cc b/tests/bits/complex-vector_26.cc
new file mode 100644 (file)
index 0000000..8d756fd
--- /dev/null
@@ -0,0 +1,77 @@
+//----------------------------  vector_26.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_26.cc  ---------------------------
+
+// check Vector::operator = (scalar) with setting to a
+// nonzero value
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+  const unsigned int sz = v.size();
+  v = 2;
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == std::sqrt(4.*sz), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_26/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_27.cc b/tests/bits/complex-vector_27.cc
new file mode 100644 (file)
index 0000000..e7ce005
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  vector_27.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_27.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator = (Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+                                   // then copy it
+  Vector<std::complex<double> > w (v.size());
+  w = v;
+
+                                   // make sure they're equal
+  deallog << std::abs(v*w) << ' ' << v.l2_norm() * w.l2_norm()
+          << ' ' << std::abs(v*w) - v.l2_norm() * w.l2_norm() << std::endl;
+  Assert (std::abs(std::abs(v*w) - v.l2_norm() * w.l2_norm()) <
+         1e-14*(std::abs(v*w)),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_27/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_28.cc b/tests/bits/complex-vector_28.cc
new file mode 100644 (file)
index 0000000..df900ad
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_28.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_28.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator = (Vector), except that we don't
+// resize the vector to be copied to beforehand
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+                                   // then copy it to a vector of different
+                                   // size
+  Vector<std::complex<double> > w (1);
+  w = v;
+
+                                   // make sure they're equal
+  deallog << std::abs(v*w) << ' ' << v.l2_norm() * w.l2_norm()
+          << ' ' << std::abs(v*w) - v.l2_norm() * w.l2_norm() << std::endl;
+  Assert (std::abs(std::abs(v*w) - v.l2_norm() * w.l2_norm()) <
+         1e-14*std::abs(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_28/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_29.cc b/tests/bits/complex-vector_29.cc
new file mode 100644 (file)
index 0000000..370e797
--- /dev/null
@@ -0,0 +1,71 @@
+//----------------------------  vector_29.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_29.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::reinit(fast)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+  v.reinit (13, true);
+  
+  Assert (v.size() == 13, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_29/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_30.cc b/tests/bits/complex-vector_30.cc
new file mode 100644 (file)
index 0000000..7ef019f
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  vector_30.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_30.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::reinit(!fast)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+                                   // then resize with setting to zero
+  v.reinit (13, false);
+  
+  Assert (v.size() == 13, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_30/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_31.cc b/tests/bits/complex-vector_31.cc
new file mode 100644 (file)
index 0000000..da7b436
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  vector_31.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_31.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::l2_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  std::complex<double> norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      norm += std::conj(std::complex<double> (i+1., i+2.)) *
+             std::complex<double> (i+1., i+2.);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::abs(v.norm_sqr() - norm) < 1e-14*std::abs(norm),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_31/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_32.cc b/tests/bits/complex-vector_32.cc
new file mode 100644 (file)
index 0000000..0933157
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  vector_32.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_32.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::mean_value()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  std::complex<double> sum = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      sum += std::complex<double> (i+1., i+2.);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::abs(v.mean_value() - sum/(1.*v.size())) <
+         1e-14*std::abs(sum)/v.size(),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_32/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_33.cc b/tests/bits/complex-vector_33.cc
new file mode 100644 (file)
index 0000000..99011f6
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_33.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_33.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::lp_norm(3)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  std::complex<double> sum = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      sum += std::pow (std::abs(std::complex<double> (i+1., i+2.)),
+                      3);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::abs(v.lp_norm(3) - std::pow(sum, 1./3.)) <
+          1e-14*std::abs(std::pow(sum, 1./3.)),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_33/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_34.cc b/tests/bits/complex-vector_34.cc
new file mode 100644 (file)
index 0000000..7958e02
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  vector_34.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_34.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::all_zero
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some elements of the vector
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+    }
+  v.compress ();
+
+                                   // set them to zero again
+  v = 0;
+
+                                   // then check all_zero
+  Assert (v.all_zero() == true, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_34/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_35.cc b/tests/bits/complex-vector_35.cc
new file mode 100644 (file)
index 0000000..c2dd098
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  vector_35.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_35.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator+=(Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v += w;
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      if (i%3 == 0)
+        {
+          Assert (w(i) == std::complex<double> (i+1., i+2.),
+                 ExcInternalError());
+          Assert (v(i) == std::complex<double> (i+1., i+2.)+1.*i,
+                 ExcInternalError());
+        }
+      else
+        {
+          Assert (w(i) == 0., ExcInternalError());
+          Assert (v(i) == 1.*i, ExcInternalError());
+        }
+    }
+
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_35/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_36.cc b/tests/bits/complex-vector_36.cc
new file mode 100644 (file)
index 0000000..6ad65cf
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  vector_36.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_36.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator-=(Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v -= w;
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      if (i%3 == 0)
+        {
+          Assert (w(i) == std::complex<double> (i+1., i+2.),
+                 ExcInternalError());
+          Assert (v(i) == std::complex<double> (-1., -(i+2.)),
+                 ExcInternalError());
+        }
+      else
+        {
+          Assert (w(i) == 0., ExcInternalError());
+          Assert (v(i) == 1.*i, ExcInternalError());
+        }
+    }
+
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_36/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_37.cc b/tests/bits/complex-vector_37.cc
new file mode 100644 (file)
index 0000000..208c7d5
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  vector_37.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_37.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::add (scalar)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = std::complex<double> (i+1., i+2.);
+  
+  v.compress ();
+
+  v.add (1.);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (v(i) == std::complex<double> (i+2., i+2.),
+           ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_37/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_38.cc b/tests/bits/complex-vector_38.cc
new file mode 100644 (file)
index 0000000..30697ca
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_38.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_38.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::add(Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.add (w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (v(i) == 1.*i+std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_38/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_39.cc b/tests/bits/complex-vector_39.cc
new file mode 100644 (file)
index 0000000..a9b3b6f
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_39.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_39.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::add(scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.add (2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (v(i) == 1.*i+2.*std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_39/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_40.cc b/tests/bits/complex-vector_40.cc
new file mode 100644 (file)
index 0000000..6fb0b3d
--- /dev/null
@@ -0,0 +1,93 @@
+//----------------------------  vector_40.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_40.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::add(s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w,
+           Vector<std::complex<double> > &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.add (2, w, 3, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.), ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (v(i) == 1.*i+2.*std::complex<double> (i+1., i+2.)+3*(i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_40/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      Vector<std::complex<double> > x (100);
+      test (v,w,x);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_41.cc b/tests/bits/complex-vector_41.cc
new file mode 100644 (file)
index 0000000..15af569
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_41.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_41.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::sadd(s, Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.sadd (2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (v(i) == 2.*i+std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_41/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_42.cc b/tests/bits/complex-vector_42.cc
new file mode 100644 (file)
index 0000000..62c6695
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_42.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_42.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::sadd(scalar, scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.sadd (3, 2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (v(i) == 3.*i+2.*std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_42/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_43.cc b/tests/bits/complex-vector_43.cc
new file mode 100644 (file)
index 0000000..1a281d5
--- /dev/null
@@ -0,0 +1,93 @@
+//----------------------------  vector_43.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_43.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::sadd(s,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w,
+           Vector<std::complex<double> > &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.sadd (1.5, 2, w, 3, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.), ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (v(i) == 1.5*i+2.*std::complex<double> (i+1., i+2.)+3*(i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_43/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      Vector<std::complex<double> > x (100);
+      test (v,w,x);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_44.cc b/tests/bits/complex-vector_44.cc
new file mode 100644 (file)
index 0000000..048d7ab
--- /dev/null
@@ -0,0 +1,102 @@
+//----------------------------  vector_44.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_44.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::sadd(s,s,V,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w,
+           Vector<std::complex<double> > &x,
+           Vector<std::complex<double> > &y)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+      x(i) = i+2.;
+      y(i) = std::complex<double> (i+3., i+4.);
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+  y.compress ();
+
+  v.sadd (1.5, 2, w, 3, x, 4, y);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (y(i) == std::complex<double> (i+3., i+4.),
+             ExcInternalError());
+      Assert (v(i) ==
+             1.5*i+2.*std::complex<double> (i+1., i+2.)+
+             3.*(i+2.)+4.*std::complex<double> (i+3., i+4.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_44/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      Vector<std::complex<double> > x (100);
+      Vector<std::complex<double> > y (100);
+      test (v,w,x,y);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_45.cc b/tests/bits/complex-vector_45.cc
new file mode 100644 (file)
index 0000000..c16e6c2
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  vector_45.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_45.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::scale
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.scale (w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.), ExcInternalError());
+      Assert (v(i) == 1.*i*std::complex<double> (i+1., i+2.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_45/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_46.cc b/tests/bits/complex-vector_46.cc
new file mode 100644 (file)
index 0000000..0ff5839
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_46.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_46.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::equ (s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.equ (2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (v(i) == 2.*std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_46/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_47.cc b/tests/bits/complex-vector_47.cc
new file mode 100644 (file)
index 0000000..4542939
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  vector_47.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_47.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::equ (s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w,
+           Vector<std::complex<double> > &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = std::complex<double> (i+1., i+2.);
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.equ (2, w, 3, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+1., i+2.),
+             ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (v(i) == 2.*std::complex<double> (i+1., i+2.)+3.*(i+2.),
+             ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_47/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      Vector<std::complex<double> > x (100);
+      test (v,w,x);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_48.cc b/tests/bits/complex-vector_48.cc
new file mode 100644 (file)
index 0000000..ab53cd0
--- /dev/null
@@ -0,0 +1,97 @@
+//----------------------------  vector_48.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_48.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::ratio
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w,
+           Vector<std::complex<double> > &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i+1., i+2.);
+      w(i) = std::complex<double> (i+2., i+3.);
+      x(i) = std::complex<double> (i+3., i+4.);
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.ratio (w, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == std::complex<double> (i+2., i+3.),
+             ExcInternalError());
+      Assert (x(i) == std::complex<double> (i+3., i+4.),
+             ExcInternalError());
+      Assert (std::abs(v(i) -
+                      std::complex<double> (i+2., i+3.) /
+                      std::complex<double> (i+3., i+4.)) < 1e-14*std::abs(v(i)),
+              ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_48/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      Vector<std::complex<double> > x (100);
+      test (v,w,x);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_49.cc b/tests/bits/complex-vector_49.cc
new file mode 100644 (file)
index 0000000..f4d82c0
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  vector_49.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_49.cc  ---------------------------
+
+
+// check copy constructor Vector<std::complex<double> >::Vector(Vector) for same template
+// argument
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = std::complex<double> (i+1., i+2.);
+  v.compress ();
+
+                                   // then copy it
+  Vector<std::complex<double> > w (v);
+
+                                   // make sure they're equal
+  deallog << std::abs(v*w) << ' ' << v.l2_norm() * w.l2_norm()
+          << ' ' << std::abs(v*w) - v.l2_norm() * w.l2_norm() << std::endl;
+  Assert (std::abs(std::abs(v*w) - v.l2_norm() * w.l2_norm())
+         < 1e-14*std::abs(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_49/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_57.cc b/tests/bits/complex-vector_57.cc
new file mode 100644 (file)
index 0000000..59250f4
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  vector_57.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_57.cc  ---------------------------
+
+
+// check Vector::is_non_zero
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+                                   // set only certain elements of the
+                                   // vector. they are all positive
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that the vector is really
+                                   // non-negative
+  Assert (v.is_non_negative() == true, ExcInternalError());
+
+                                   // then set a single element to a negative
+                                   // value and check again
+  v(v.size()/2) = -1;
+  Assert (v.is_non_negative() == false, ExcInternalError());  
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_57/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_1.cc b/tests/bits/complex-vector_equality_1.cc
new file mode 100644 (file)
index 0000000..be0e5b9
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  vector_equality_1.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_1.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator==(Vector<std::complex<double> >) for vectors that are not
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i+0., i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+
+  Assert (!(v==w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_1/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_2.cc b/tests/bits/complex-vector_equality_2.cc
new file mode 100644 (file)
index 0000000..771e297
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  vector_equality_2.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_2.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator==(Vector<std::complex<double> >) for vectors that are
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (v==w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_2/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_3.cc b/tests/bits/complex-vector_equality_3.cc
new file mode 100644 (file)
index 0000000..eeb122b
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  vector_equality_3.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_3.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator!=(Vector<std::complex<double> >) for vectors that are not
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+
+  Assert (v.operator != (w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_3/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_4.cc b/tests/bits/complex-vector_equality_4.cc
new file mode 100644 (file)
index 0000000..6400a5c
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  vector_equality_4.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_4.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator!=(Vector<std::complex<double> >) for vectors that are
+// equal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<double> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (! (v.operator != (w)), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_4/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<double> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_5.cc b/tests/bits/complex-vector_equality_5.cc
new file mode 100644 (file)
index 0000000..9bf0426
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_equality_1.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_1.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator==(Vector<std::complex<float> >) for vectors that are not
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<float> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+
+  Assert (!(v==w), ExcInternalError());
+  Assert (!(w==v), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_5/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<float> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_6.cc b/tests/bits/complex-vector_equality_6.cc
new file mode 100644 (file)
index 0000000..a03a862
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  vector_equality_2.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_2.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator==(Vector<std::complex<float> >) for vectors that are
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<float> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (v==w, ExcInternalError());
+  Assert (w==v, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_6/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<float> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_7.cc b/tests/bits/complex-vector_equality_7.cc
new file mode 100644 (file)
index 0000000..2135993
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_equality_3.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_3.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator!=(Vector<std::complex<float> >) for vectors that are not
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<float> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+
+  Assert (v!=w, ExcInternalError());
+  Assert (w!=v, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_7/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<float> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_equality_8.cc b/tests/bits/complex-vector_equality_8.cc
new file mode 100644 (file)
index 0000000..ee80c1f
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  vector_equality_4.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_equality_4.cc  ---------------------------
+
+
+// check Vector<std::complex<double> >::operator!=(Vector<std::complex<float> >) for vectors that are
+// equal and different template arguments
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<std::complex<double> > &v,
+           Vector<std::complex<float> > &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = std::complex<double> (i, i+1.);
+      if (i%3 == 0)
+        w(i) = std::complex<double> (i+1., i+2.);
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (! (v!=w), ExcInternalError());
+  Assert (! (w!=v), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("complex-vector_equality_8/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      Vector<std::complex<float> > w (100);
+      test (v,w);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex-vector_vector_01.cc b/tests/bits/complex-vector_vector_01.cc
new file mode 100644 (file)
index 0000000..ebf758a
--- /dev/null
@@ -0,0 +1,75 @@
+//----------------------------  vector_vector_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  vector_vector_01.cc  ---------------------------
+
+
+// check existence Vector<std::complex<double> >::Vector(Vector<std::complex<float> >). this conversion
+// constructor was disabled previously altogether because of a compiler defect
+// that did not honor the 'explicit' keyword on template constructors. this is
+// now autoconf'ed.
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (Vector<std::complex<double> > &v)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = std::complex<double> (i+1., i+2.);
+  Vector<std::complex<float> > w(v);
+
+  Assert (w==v, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("complex-vector_vector_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      Vector<std::complex<double> > v (100);
+      test (v);
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/bits/complex_vector_11/cmp/generic b/tests/bits/complex_vector_11/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_12/cmp/generic b/tests/bits/complex_vector_12/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_13/cmp/generic b/tests/bits/complex_vector_13/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_14/cmp/generic b/tests/bits/complex_vector_14/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_15/cmp/generic b/tests/bits/complex_vector_15/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_16/cmp/generic b/tests/bits/complex_vector_16/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_17/cmp/generic b/tests/bits/complex_vector_17/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_18/cmp/generic b/tests/bits/complex_vector_18/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_19/cmp/generic b/tests/bits/complex_vector_19/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_20/cmp/generic b/tests/bits/complex_vector_20/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_21/cmp/generic b/tests/bits/complex_vector_21/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_21_negative/cmp/generic b/tests/bits/complex_vector_21_negative/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_22/cmp/generic b/tests/bits/complex_vector_22/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_23/cmp/generic b/tests/bits/complex_vector_23/cmp/generic
new file mode 100644 (file)
index 0000000..92bca16
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::(114444.,116127.) (114444.,-116127.) (114444.,116127.) (114444.,-116127.)
+DEAL::OK
diff --git a/tests/bits/complex_vector_24/cmp/generic b/tests/bits/complex_vector_24/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_25/cmp/generic b/tests/bits/complex_vector_25/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_26/cmp/generic b/tests/bits/complex_vector_26/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_27/cmp/generic b/tests/bits/complex_vector_27/cmp/generic
new file mode 100644 (file)
index 0000000..3128bc4
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::235790. 235790. 0
+DEAL::OK
diff --git a/tests/bits/complex_vector_28/cmp/generic b/tests/bits/complex_vector_28/cmp/generic
new file mode 100644 (file)
index 0000000..3128bc4
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::235790. 235790. 0
+DEAL::OK
diff --git a/tests/bits/complex_vector_29/cmp/generic b/tests/bits/complex_vector_29/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_30/cmp/generic b/tests/bits/complex_vector_30/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_31/cmp/generic b/tests/bits/complex_vector_31/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_32/cmp/generic b/tests/bits/complex_vector_32/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_33/cmp/generic b/tests/bits/complex_vector_33/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_34/cmp/generic b/tests/bits/complex_vector_34/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_35/cmp/generic b/tests/bits/complex_vector_35/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_36/cmp/generic b/tests/bits/complex_vector_36/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_37/cmp/generic b/tests/bits/complex_vector_37/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_38/cmp/generic b/tests/bits/complex_vector_38/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_39/cmp/generic b/tests/bits/complex_vector_39/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_40/cmp/generic b/tests/bits/complex_vector_40/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_41/cmp/generic b/tests/bits/complex_vector_41/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_42/cmp/generic b/tests/bits/complex_vector_42/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_43/cmp/generic b/tests/bits/complex_vector_43/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_44/cmp/generic b/tests/bits/complex_vector_44/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_45/cmp/generic b/tests/bits/complex_vector_45/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_46/cmp/generic b/tests/bits/complex_vector_46/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_47/cmp/generic b/tests/bits/complex_vector_47/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_48/cmp/generic b/tests/bits/complex_vector_48/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_49/cmp/generic b/tests/bits/complex_vector_49/cmp/generic
new file mode 100644 (file)
index 0000000..3128bc4
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::235790. 235790. 0
+DEAL::OK
diff --git a/tests/bits/complex_vector_57/cmp/generic b/tests/bits/complex_vector_57/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_1/cmp/generic b/tests/bits/complex_vector_equality_1/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_2/cmp/generic b/tests/bits/complex_vector_equality_2/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_3/cmp/generic b/tests/bits/complex_vector_equality_3/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_4/cmp/generic b/tests/bits/complex_vector_equality_4/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_5/cmp/generic b/tests/bits/complex_vector_equality_5/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_6/cmp/generic b/tests/bits/complex_vector_equality_6/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_7/cmp/generic b/tests/bits/complex_vector_equality_7/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_equality_8/cmp/generic b/tests/bits/complex_vector_equality_8/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/bits/complex_vector_vector_01/cmp/generic b/tests/bits/complex_vector_vector_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.