From: Bruno Turcksin Date: Thu, 5 May 2016 13:01:48 +0000 (-0400) Subject: Rename vector_internal.h to vector_operations_internal.h X-Git-Tag: v8.5.0-rc1~1048^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6a12493b5478229bbc2821b7167ad0579595fc8;p=dealii.git Rename vector_internal.h to vector_operations_internal.h --- diff --git a/include/deal.II/lac/la_vector.templates.h b/include/deal.II/lac/la_vector.templates.h index 4ec2db73e8..1166458b05 100644 --- a/include/deal.II/lac/la_vector.templates.h +++ b/include/deal.II/lac/la_vector.templates.h @@ -17,7 +17,7 @@ #define dealii__la_vector_templates_h #include -#include +#include #include #include @@ -35,9 +35,7 @@ namespace LinearAlgebra if (this->size() != in_vector.size()) this->reinit(in_vector, true); - dealii::internal::Vector_copy copier; - copier.dst = this->val; - copier.src = in_vector.val; + dealii::internal::Vector_copy copier(in_vector.val, this->val); internal::parallel_for(copier, this->size(), this->thread_loop_partitioner); return *this; @@ -53,9 +51,7 @@ namespace LinearAlgebra if (this->size() != in_vector.size()) this->reinit(in_vector, true); - dealii::internal::Vector_copy copier; - copier.dst = this->val; - copier.src = in_vector.val; + dealii::internal::Vector_copy copier(in_vector.val, this->val); internal::parallel_for(copier, this->size(), this->thread_loop_partitioner); return *this; @@ -69,10 +65,7 @@ namespace LinearAlgebra Assert(s==static_cast(0), ExcMessage("Only 0 can be assigned to a vector.")); (void) s; - internal::Vector_set setter; - setter.dst = this->val; - setter.value = Number(); - + internal::Vector_set setter(Number(), this->val); internal::parallel_for(setter, this->size(), this->thread_loop_partitioner); return *this; @@ -85,10 +78,7 @@ namespace LinearAlgebra { AssertIsFinite(factor); - internal::Vectorization_multiply_factor vector_multiply; - vector_multiply.val = this->val; - vector_multiply.factor = factor; - + internal::Vectorization_multiply_factor vector_multiply(this->val, factor); internal::parallel_for(vector_multiply, this->size(), this->thread_loop_partitioner); return *this; @@ -119,9 +109,7 @@ namespace LinearAlgebra Assert(down_V.size()==this->size(), ExcMessage("Cannot add two vectors with different numbers of elements")); - internal::Vectorization_add_v vector_add; - vector_add.val = this->val; - vector_add.v_val = down_V.val; + internal::Vectorization_add_v vector_add(this->val, down_V.val); internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner); return *this; @@ -139,9 +127,7 @@ namespace LinearAlgebra const Vector &down_V = dynamic_cast&>(V); Assert(down_V.size()==this->size(), ExcMessage("Cannot subtract two vectors with different numbers of elements")); - internal::Vectorization_subtract_v vector_subtract; - vector_subtract.val = this->val; - vector_subtract.v_val = down_V.val; + internal::Vectorization_subtract_v vector_subtract(this->val, down_V.val); internal::parallel_for(vector_subtract, this->size(), this->thread_loop_partitioner); return *this; @@ -162,9 +148,7 @@ namespace LinearAlgebra ExcMessage("Cannot compute the scalar product " "of two vectors with different numbers of elements")); Number sum; - internal::Dot dot; - dot.X = this->val; - dot.Y = down_V.val; + internal::Dot dot(this->val, down_V.val); internal::parallel_reduce(dot, this->size(), sum, this->thread_loop_partitioner); return sum; @@ -188,9 +172,7 @@ namespace LinearAlgebra { AssertIsFinite(a); - internal::Vectorization_add_factor vector_add; - vector_add.val = this->val; - vector_add.factor = a; + internal::Vectorization_add_factor vector_add(this->val, a); internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner); } @@ -209,10 +191,7 @@ namespace LinearAlgebra Assert(down_V.size()==this->size(), ExcMessage("Cannot add two vectors with different numbers of elements")); - internal::Vectorization_add_av vector_add_av; - vector_add_av.val = this->val; - vector_add_av.v_val = down_V.val; - vector_add_av.factor = a; + internal::Vectorization_add_av vector_add_av(this->val, down_V.val, a); internal::parallel_for(vector_add_av, this->size(), this->thread_loop_partitioner); } @@ -240,12 +219,8 @@ namespace LinearAlgebra Assert(down_W.size()==this->size(), ExcMessage("Cannot add two vectors with different numbers of elements")); - internal::Vectorization_add_avpbw vector_add; - vector_add.val = this->val; - vector_add.v_val = down_V.val; - vector_add.w_val = down_W.val; - vector_add.a = a; - vector_add.b = b; + internal::Vectorization_add_avpbw vector_add(this->val, down_V.val, + down_W.val, a, b); internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner); } @@ -264,11 +239,8 @@ namespace LinearAlgebra // Downcast V. It fails, throws an exception. const Vector &down_V = dynamic_cast&>(V); - internal::Vectorization_sadd_xav vector_sadd_xav; - vector_sadd_xav.val = this->val; - vector_sadd_xav.v_val = down_V.val; - vector_sadd_xav.a = a; - vector_sadd_xav.x = s; + internal::Vectorization_sadd_xav vector_sadd_xav(this->val, down_V.val, + a, s); internal::parallel_for(vector_sadd_xav, this->size(), this->thread_loop_partitioner); } @@ -287,9 +259,7 @@ namespace LinearAlgebra Assert(down_scaling_factors.size()==this->size(), ExcMessage("Cannot add two vectors with different numbers of elements")); - internal::Vectorization_scale vector_scale; - vector_scale.val = this->val; - vector_scale.v_val = down_scaling_factors.val; + internal::Vectorization_scale vector_scale(this->val, down_scaling_factors.val); internal::parallel_for(vector_scale, this->size(), this->thread_loop_partitioner); } @@ -306,10 +276,7 @@ namespace LinearAlgebra // Downcast V. If fails, throws an exception. const Vector &down_V = dynamic_cast&>(V); - internal::Vectorization_equ_au vector_equ; - vector_equ.val = this->val; - vector_equ.u_val = down_V.val; - vector_equ.a = a; + internal::Vectorization_equ_au vector_equ(this->val, down_V.val, a); internal::parallel_for(vector_equ, this->size(), this->thread_loop_partitioner); } @@ -322,8 +289,7 @@ namespace LinearAlgebra typedef typename VectorSpaceVector::real_type real_type; real_type sum; - internal::Norm1 norm1; - norm1.X = this->val; + internal::Norm1 norm1(this->val); internal::parallel_reduce(norm1, this->size(), sum, this->thread_loop_partitioner); return sum; @@ -344,8 +310,7 @@ namespace LinearAlgebra // precision) using the BLAS approach with a weight, see e.g. dnrm2.f. typedef typename VectorSpaceVector::real_type real_type; real_type norm_square; - internal::Norm2 norm2; - norm2.X = this->val; + internal::Norm2 norm2(this->val); internal::parallel_reduce(norm2, this->size(), norm_square, this->thread_loop_partitioner); if (numbers::is_finite(norm_square) && @@ -414,11 +379,7 @@ namespace LinearAlgebra ExcMessage("Cannot add two vectors with different numbers of elements")); Number sum; - internal::AddAndDot adder; - adder.X = this->val; - adder.a = a; - adder.V = down_V.val; - adder.W = down_W.val; + internal::AddAndDot adder(this->val, down_V.val, down_W.val, a); internal::parallel_reduce(adder, this->size(), sum, this->thread_loop_partitioner); AssertIsFinite(sum); diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index f772c2338b..1841f4a2d1 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -531,7 +531,9 @@ namespace LinearAlgebra ReadWriteVector::ReadWriteVector () : val(NULL) - {} + { + reinit(0, true); + } diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index e16c6e4996..7d2f02e15a 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -19,7 +19,7 @@ #include #include -#include +#include #ifdef DEAL_II_PETSC # include @@ -135,9 +135,7 @@ namespace LinearAlgebra if (n_elements() != in_vector.n_elements()) reinit(in_vector, true); - dealii::internal::Vector_copy copier; - copier.dst = val; - copier.src = in_vector.val; + dealii::internal::Vector_copy copier(in_vector.val, val); internal::parallel_for(copier, n_elements(), thread_loop_partitioner); return *this; @@ -154,9 +152,7 @@ namespace LinearAlgebra if (n_elements() != in_vector.n_elements()) reinit(in_vector, true); - dealii::internal::Vector_copy copier; - copier.dst = val; - copier.src = in_vector.val; + dealii::internal::Vector_copy copier(in_vector.val, val); internal::parallel_for(copier, n_elements(), thread_loop_partitioner); return *this; @@ -171,10 +167,7 @@ namespace LinearAlgebra Assert(s==static_cast(0), ExcMessage("Only 0 can be assigned to a vector.")); (void)s; - internal::Vector_set setter; - setter.dst = val; - setter.value = Number(); - + internal::Vector_set setter(Number(), val); internal::parallel_for(setter, n_elements(), thread_loop_partitioner); return *this; diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index f35f4a1d35..66fec39803 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #ifdef DEAL_II_WITH_PETSC # include @@ -220,9 +220,7 @@ Vector::operator= (const Vector &v) if (vec_size != v.vec_size) reinit (v, true); - dealii::internal::Vector_copy copier; - copier.dst = val; - copier.src = v.val; + dealii::internal::Vector_copy copier(v.val, val); internal::parallel_for(copier,vec_size,thread_loop_partitioner); return *this; @@ -265,9 +263,7 @@ Vector::operator= (const Vector &v) if (vec_size != v.vec_size) reinit (v, true); - dealii::internal::Vector_copy copier; - copier.dst = val; - copier.src = v.val; + dealii::internal::Vector_copy copier(v.val, val); internal::parallel_for(copier,vec_size,thread_loop_partitioner); return *this; @@ -377,9 +373,7 @@ Vector::operator= (const Number s) if (s != Number()) Assert (vec_size!=0, ExcEmptyObject()); - internal::Vector_set setter; - setter.dst = val; - setter.value = s; + internal::Vector_set setter(s, val); internal::parallel_for(setter,vec_size,thread_loop_partitioner); @@ -412,9 +406,7 @@ Vector &Vector::operator *= (const Number factor) Assert (vec_size!=0, ExcEmptyObject()); - internal::Vectorization_multiply_factor vector_multiply; - vector_multiply.val = val; - vector_multiply.factor = factor; + internal::Vectorization_multiply_factor vector_multiply(val, factor); internal::parallel_for(vector_multiply,vec_size,thread_loop_partitioner); @@ -433,10 +425,7 @@ Vector::add (const Number a, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::Vectorization_add_av vector_add_av; - vector_add_av.val = val; - vector_add_av.v_val = v.val; - vector_add_av.factor = a; + internal::Vectorization_add_av vector_add_av(val, v.val, a); internal::parallel_for(vector_add_av,vec_size,thread_loop_partitioner); } @@ -454,11 +443,7 @@ Vector::sadd (const Number x, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::Vectorization_sadd_xav vector_sadd_xav; - vector_sadd_xav.val = val; - vector_sadd_xav.v_val = v.val; - vector_sadd_xav.a = a; - vector_sadd_xav.x = x; + internal::Vectorization_sadd_xav vector_sadd_xav(val, v.val, a, x); internal::parallel_for(vector_sadd_xav,vec_size,thread_loop_partitioner); } @@ -477,9 +462,7 @@ Number Vector::operator * (const Vector &v) const ExcDimensionMismatch(vec_size, v.size())); Number sum; - internal::Dot dot; - dot.X = val; - dot.Y = v.val; + internal::Dot dot(val, v.val); internal::parallel_reduce (dot, vec_size, sum, thread_loop_partitioner); AssertIsFinite(sum); @@ -495,8 +478,7 @@ Vector::norm_sqr () const Assert (vec_size!=0, ExcEmptyObject()); real_type sum; - internal::Norm2 norm2; - norm2.X = val; + internal::Norm2 norm2(val); internal::parallel_reduce (norm2, vec_size, sum, thread_loop_partitioner); AssertIsFinite(sum); @@ -512,8 +494,7 @@ Number Vector::mean_value () const Assert (vec_size!=0, ExcEmptyObject()); Number sum; - internal::MeanValue mean; - mean.X = val; + internal::MeanValue mean(val); internal::parallel_reduce (mean, vec_size, sum, thread_loop_partitioner); return sum / real_type(size()); @@ -528,8 +509,7 @@ Vector::l1_norm () const Assert (vec_size!=0, ExcEmptyObject()); real_type sum; - internal::Norm1 norm1; - norm1.X = val; + internal::Norm1 norm1(val); internal::parallel_reduce (norm1, vec_size, sum, thread_loop_partitioner); return sum; @@ -549,8 +529,7 @@ Vector::l2_norm () const Assert (vec_size!=0, ExcEmptyObject()); real_type norm_square; - internal::Norm2 norm2; - norm2.X = val; + internal::Norm2 norm2(val); internal::parallel_reduce (norm2, vec_size, norm_square, thread_loop_partitioner); if (numbers::is_finite(norm_square) && @@ -594,9 +573,7 @@ Vector::lp_norm (const real_type p) const return l2_norm(); real_type sum; - internal::NormP normp; - normp.X = val; - normp.p = p; + internal::NormP normp(val, p); internal::parallel_reduce (normp, vec_size, sum, thread_loop_partitioner); if (numbers::is_finite(sum) && sum >= std::numeric_limits::min()) @@ -663,11 +640,7 @@ Vector::add_and_dot (const Number a, AssertDimension (vec_size, W.size()); Number sum; - internal::AddAndDot adder; - adder.X = val; - adder.a = a; - adder.V = V.val; - adder.W = W.val; + internal::AddAndDot adder(this->val, V.val, W.val, a); internal::parallel_reduce (adder, vec_size, sum, thread_loop_partitioner); AssertIsFinite(sum); @@ -693,9 +666,7 @@ Vector &Vector::operator -= (const Vector &v) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::Vectorization_subtract_v vector_subtract; - vector_subtract.val = val; - vector_subtract.v_val = v.val; + internal::Vectorization_subtract_v vector_subtract(val, v.val); internal::parallel_for(vector_subtract,vec_size,thread_loop_partitioner); return *this; @@ -708,9 +679,7 @@ void Vector::add (const Number v) { Assert (vec_size!=0, ExcEmptyObject()); - internal::Vectorization_add_factor vector_add; - vector_add.val = val; - vector_add.factor = v; + internal::Vectorization_add_factor vector_add(val, v); internal::parallel_for(vector_add,vec_size,thread_loop_partitioner); } @@ -722,9 +691,7 @@ void Vector::add (const Vector &v) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::Vectorization_add_v vector_add; - vector_add.val = val; - vector_add.v_val = v.val; + internal::Vectorization_add_v vector_add(val, v.val); internal::parallel_for(vector_add,vec_size,thread_loop_partitioner); } @@ -741,12 +708,7 @@ void Vector::add (const Number a, const Vector &v, Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size)); - internal::Vectorization_add_avpbw vector_add; - vector_add.val = val; - vector_add.v_val = v.val; - vector_add.w_val = w.val; - vector_add.a = a; - vector_add.b = b; + internal::Vectorization_add_avpbw vector_add(val, v.val, w.val, a, b); internal::parallel_for(vector_add,vec_size,thread_loop_partitioner); } @@ -761,10 +723,7 @@ void Vector::sadd (const Number x, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - internal::Vectorization_sadd_xv vector_sadd; - vector_sadd.val = val; - vector_sadd.v_val = v.val; - vector_sadd.x = x; + internal::Vectorization_sadd_xv vector_sadd(val, v.val, x); internal::parallel_for(vector_sadd,vec_size,thread_loop_partitioner); } @@ -783,13 +742,8 @@ void Vector::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)); - internal::Vectorization_sadd_xavbw vector_sadd; - vector_sadd.val = val; - vector_sadd.v_val = v.val; - vector_sadd.w_val = w.val; - vector_sadd.x = x; - vector_sadd.a = a; - vector_sadd.b = b; + internal::Vectorization_sadd_xavbw vector_sadd(val, v.val, w.val, x, + a, b); internal::parallel_for(vector_sadd,vec_size,thread_loop_partitioner); } @@ -812,9 +766,7 @@ void Vector::scale (const Vector &s) Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size)); - internal::Vectorization_scale vector_scale; - vector_scale.val = val; - vector_scale.v_val = s.val; + internal::Vectorization_scale vector_scale(val, s.val); internal::parallel_for(vector_scale,vec_size,thread_loop_partitioner); } @@ -842,10 +794,7 @@ void Vector::equ (const Number a, Assert (vec_size!=0, ExcEmptyObject()); Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size)); - internal::Vectorization_equ_au vector_equ; - vector_equ.val = val; - vector_equ.u_val = u.val; - vector_equ.a = a; + internal::Vectorization_equ_au vector_equ(val, u.val, a); internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner); } @@ -884,12 +833,7 @@ void Vector::equ (const Number a, const Vector &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)); - internal::Vectorization_equ_aubv vector_equ; - vector_equ.val = val; - vector_equ.u_val = u.val; - vector_equ.v_val = v.val; - vector_equ.a = a; - vector_equ.b = b; + internal::Vectorization_equ_aubv vector_equ(val, u.val, v.val, a, b); internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner); } @@ -904,14 +848,8 @@ void Vector::equ (const Number a, const Vector &u, Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); Assert (vec_size == w.vec_size, ExcDimensionMismatch(vec_size, w.vec_size)); - internal::Vectorization_equ_aubvcw vector_equ; - vector_equ.val = val; - vector_equ.u_val = u.val; - vector_equ.v_val = v.val; - vector_equ.w_val = w.val; - vector_equ.a = a; - vector_equ.b = b; - vector_equ.c = c; + internal::Vectorization_equ_aubvcw vector_equ(val, u.val, v.val, w.val, + a, b, c); internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner); } @@ -928,10 +866,7 @@ void Vector::ratio (const Vector &a, // we overwrite them anyway reinit (a.size(), true); - internal::Vectorization_ratio vector_ratio; - vector_ratio.val = val; - vector_ratio.a_val = a.val; - vector_ratio.b_val = b.val; + internal::Vectorization_ratio vector_ratio(val, a.val, b.val); internal::parallel_for(vector_ratio,vec_size,thread_loop_partitioner); } diff --git a/include/deal.II/lac/vector_internal.h b/include/deal.II/lac/vector_operations_internal.h similarity index 91% rename from include/deal.II/lac/vector_internal.h rename to include/deal.II/lac/vector_operations_internal.h index 804c84fe16..7fadf02cda 100644 --- a/include/deal.II/lac/vector_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -14,8 +14,8 @@ // --------------------------------------------------------------------- -#ifndef dealii__vector_internal_h -#define dealii__vector_internal_h +#ifndef dealii__vector_operations_internal_h +#define dealii__vector_operations_internal_h #include #include @@ -188,8 +188,11 @@ namespace internal template struct Vector_set { - Number *dst; - Number value; + Vector_set(Number value, Number *dst) + : + value(value), + dst(dst) + {} void operator() (const size_type begin, const size_type end) const { @@ -198,13 +201,19 @@ namespace internal else std::fill (dst+begin, dst+end, value); } + + Number value; + Number *dst; }; template struct Vector_copy { - const OtherNumber *src; - Number *dst; + Vector_copy(const OtherNumber *src, Number *dst) + : + src(src), + dst(dst) + {} void operator() (const size_type begin, const size_type end) const { @@ -217,13 +226,19 @@ namespace internal dst[i] = src[i]; } } + + const OtherNumber *src; + Number *dst; }; template struct Vectorization_multiply_factor { - Number *val; - Number factor; + Vectorization_multiply_factor(Number *val, Number factor) + : + val(val), + factor(factor) + {} void operator() (const size_type begin, const size_type end) const { @@ -239,14 +254,20 @@ namespace internal val[i] *= factor; } } + + Number *val; + Number factor; }; template struct Vectorization_add_av { - Number *val; - Number *v_val; - Number factor; + Vectorization_add_av(Number *val, Number *v_val, Number factor) + : + val(val), + v_val(v_val), + factor(factor) + {} void operator() (const size_type begin, const size_type end) const { @@ -262,15 +283,22 @@ namespace internal val[i] += factor*v_val[i]; } } + + Number *val; + Number *v_val; + Number factor; }; template struct Vectorization_sadd_xav { - Number *val; - Number *v_val; - Number a; - Number x; + Vectorization_sadd_xav(Number *val, Number *v_val, Number a, Number x) + : + val(val), + v_val(v_val), + a(a), + x(x) + {} void operator() (const size_type begin, const size_type end) const { @@ -286,13 +314,21 @@ namespace internal val[i] = x*val[i] + a*v_val[i]; } } + + Number *val; + Number *v_val; + Number a; + Number x; }; template struct Vectorization_subtract_v { - Number *val; - Number *v_val; + Vectorization_subtract_v(Number *val, Number *v_val) + : + val(val), + v_val(v_val) + {} void operator() (const size_type begin, const size_type end) const { @@ -308,13 +344,19 @@ namespace internal val[i] -= v_val[i]; } } + + Number *val; + Number *v_val; }; template struct Vectorization_add_factor { - Number *val; - Number factor; + Vectorization_add_factor(Number *val, Number factor) + : + val(val), + factor(factor) + {} void operator() (const size_type begin, const size_type end) const { @@ -330,13 +372,19 @@ namespace internal val[i] += factor; } } + + Number *val; + Number factor; }; template struct Vectorization_add_v { - Number *val; - Number *v_val; + Vectorization_add_v(Number *val, Number *v_val) + : + val(val), + v_val(v_val) + {} void operator() (const size_type begin, const size_type end) const { @@ -352,16 +400,22 @@ namespace internal val[i] += v_val[i]; } } + + Number *val; + Number *v_val; }; template struct Vectorization_add_avpbw { - Number *val; - Number *v_val; - Number *w_val; - Number a; - Number b; + Vectorization_add_avpbw(Number *val, Number *v_val, Number *w_val, Number a, Number b) + : + val(val), + v_val(v_val), + w_val(w_val), + a(a), + b(b) + {} void operator() (const size_type begin, const size_type end) const { @@ -377,14 +431,23 @@ namespace internal val[i] = val[i] + a*v_val[i] + b*w_val[i]; } } + + Number *val; + Number *v_val; + Number *w_val; + Number a; + Number b; }; template struct Vectorization_sadd_xv { - Number *val; - Number *v_val; - Number x; + Vectorization_sadd_xv(Number *val, Number *v_val, Number x) + : + val(val), + v_val(v_val), + x(x) + {} void operator() (const size_type begin, const size_type end) const { @@ -400,17 +463,25 @@ namespace internal val[i] = x*val[i] + v_val[i]; } } + + Number *val; + Number *v_val; + Number x; }; template struct Vectorization_sadd_xavbw { - Number *val; - Number *v_val; - Number *w_val; - Number x; - Number a; - Number b; + Vectorization_sadd_xavbw(Number *val, Number *v_val, Number *w_val, + Number x, Number a, Number b) + : + val(val), + v_val(v_val), + w_val(w_val), + x(x), + a(a), + b(b) + {} void operator() (const size_type begin, const size_type end) const { @@ -426,13 +497,23 @@ namespace internal val[i] = x*val[i] + a*v_val[i] + b*w_val[i]; } } + + Number *val; + Number *v_val; + Number *w_val; + Number x; + Number a; + Number b; }; template struct Vectorization_scale { - Number *val; - Number *v_val; + Vectorization_scale(Number *val, Number *v_val) + : + val(val), + v_val(v_val) + {} void operator() (const size_type begin, const size_type end) const { @@ -448,14 +529,20 @@ namespace internal val[i] *= v_val[i]; } } + + Number *val; + Number *v_val; }; template struct Vectorization_equ_au { - Number *val; - Number *u_val; - Number a; + Vectorization_equ_au(Number *val, Number *u_val, Number a) + : + val(val), + u_val(u_val), + a(a) + {} void operator() (const size_type begin, const size_type end) const { @@ -471,16 +558,24 @@ namespace internal val[i] = a*u_val[i]; } } + + Number *val; + Number *u_val; + Number a; }; template struct Vectorization_equ_aubv { - Number *val; - Number *u_val; - Number *v_val; - Number a; - Number b; + Vectorization_equ_aubv(Number *val, Number *u_val, Number *v_val, + Number a, Number b) + : + val(val), + u_val(u_val), + v_val(v_val), + a(a), + b(b) + {} void operator() (const size_type begin, const size_type end) const { @@ -496,18 +591,28 @@ namespace internal val[i] = a*u_val[i] + b*v_val[i]; } } - }; - template - struct Vectorization_equ_aubvcw - { Number *val; Number *u_val; Number *v_val; - Number *w_val; Number a; Number b; - Number c; + }; + + template + struct Vectorization_equ_aubvcw + { + Vectorization_equ_aubvcw(Number *val, Number *u_val, Number *v_val, + Number *w_val, Number a, Number b, Number c) + : + val(val), + u_val(u_val), + v_val(v_val), + w_val(w_val), + a(a), + b(b), + c(c) + {} void operator() (const size_type begin, const size_type end) const { @@ -523,14 +628,25 @@ namespace internal val[i] = a*u_val[i] + b*v_val[i] + c*w_val[i]; } } + + Number *val; + Number *u_val; + Number *v_val; + Number *w_val; + Number a; + Number b; + Number c; }; template struct Vectorization_ratio { - Number *val; - Number *a_val; - Number *b_val; + Vectorization_ratio(Number *val, Number *a_val, Number *b_val) + : + val(val), + a_val(a_val), + b_val(b_val) + {} void operator() (const size_type begin, const size_type end) const { @@ -546,6 +662,10 @@ namespace internal val[i] = a_val[i]/b_val[i]; } } + + Number *val; + Number *a_val; + Number *b_val; }; @@ -561,6 +681,12 @@ namespace internal static const bool vectorizes = types_are_equal::value && (VectorizedArray::n_array_elements > 1); + Dot(const Number *X, const Number2 *Y) + : + X(X), + Y(Y) + {} + Number operator() (const size_type i) const { @@ -585,6 +711,11 @@ namespace internal { static const bool vectorizes = VectorizedArray::n_array_elements > 1; + Norm2(const Number *X) + : + X(X) + {} + RealType operator() (const size_type i) const { @@ -607,6 +738,11 @@ namespace internal { static const bool vectorizes = VectorizedArray::n_array_elements > 1; + Norm1(const Number *X) + : + X(X) + {} + RealType operator() (const size_type i) const { @@ -629,6 +765,12 @@ namespace internal { static const bool vectorizes = VectorizedArray::n_array_elements > 1; + NormP(const Number *X, RealType p) + : + X(X), + p(p) + {} + RealType operator() (const size_type i) const { @@ -652,6 +794,11 @@ namespace internal { static const bool vectorizes = VectorizedArray::n_array_elements > 1; + MeanValue(const Number *X) + : + X(X) + {} + Number operator() (const size_type i) const { @@ -674,6 +821,14 @@ namespace internal { static const bool vectorizes = VectorizedArray::n_array_elements > 1; + AddAndDot(Number *X, const Number *V, const Number *W, Number a) + : + X(X), + V(V), + W(W), + a(a) + {} + Number operator() (const size_type i) const {