#define dealii__la_vector_templates_h
#include <deal.II/lac/la_vector.h>
-#include <deal.II/lac/vector_internal.h>
+#include <deal.II/lac/vector_operations_internal.h>
#include <iostream>
#include <iomanip>
if (this->size() != in_vector.size())
this->reinit(in_vector, true);
- dealii::internal::Vector_copy<Number, Number> copier;
- copier.dst = this->val;
- copier.src = in_vector.val;
+ dealii::internal::Vector_copy<Number, Number> copier(in_vector.val, this->val);
internal::parallel_for(copier, this->size(), this->thread_loop_partitioner);
return *this;
if (this->size() != in_vector.size())
this->reinit(in_vector, true);
- dealii::internal::Vector_copy<Number, Number2> copier;
- copier.dst = this->val;
- copier.src = in_vector.val;
+ dealii::internal::Vector_copy<Number, Number2> copier(in_vector.val, this->val);
internal::parallel_for(copier, this->size(), this->thread_loop_partitioner);
return *this;
Assert(s==static_cast<Number>(0), ExcMessage("Only 0 can be assigned to a vector."));
(void) s;
- internal::Vector_set<Number> setter;
- setter.dst = this->val;
- setter.value = Number();
-
+ internal::Vector_set<Number> setter(Number(), this->val);
internal::parallel_for(setter, this->size(), this->thread_loop_partitioner);
return *this;
{
AssertIsFinite(factor);
- internal::Vectorization_multiply_factor<Number> vector_multiply;
- vector_multiply.val = this->val;
- vector_multiply.factor = factor;
-
+ internal::Vectorization_multiply_factor<Number> vector_multiply(this->val, factor);
internal::parallel_for(vector_multiply, this->size(), this->thread_loop_partitioner);
return *this;
Assert(down_V.size()==this->size(),
ExcMessage("Cannot add two vectors with different numbers of elements"));
- internal::Vectorization_add_v<Number> vector_add;
- vector_add.val = this->val;
- vector_add.v_val = down_V.val;
+ internal::Vectorization_add_v<Number> vector_add(this->val, down_V.val);
internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner);
return *this;
const Vector<Number> &down_V = dynamic_cast<const Vector<Number>&>(V);
Assert(down_V.size()==this->size(),
ExcMessage("Cannot subtract two vectors with different numbers of elements"));
- internal::Vectorization_subtract_v<Number> vector_subtract;
- vector_subtract.val = this->val;
- vector_subtract.v_val = down_V.val;
+ internal::Vectorization_subtract_v<Number> vector_subtract(this->val, down_V.val);
internal::parallel_for(vector_subtract, this->size(), this->thread_loop_partitioner);
return *this;
ExcMessage("Cannot compute the scalar product "
"of two vectors with different numbers of elements"));
Number sum;
- internal::Dot<Number, Number> dot;
- dot.X = this->val;
- dot.Y = down_V.val;
+ internal::Dot<Number, Number> dot(this->val, down_V.val);
internal::parallel_reduce(dot, this->size(), sum, this->thread_loop_partitioner);
return sum;
{
AssertIsFinite(a);
- internal::Vectorization_add_factor<Number> vector_add;
- vector_add.val = this->val;
- vector_add.factor = a;
+ internal::Vectorization_add_factor<Number> vector_add(this->val, a);
internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner);
}
Assert(down_V.size()==this->size(),
ExcMessage("Cannot add two vectors with different numbers of elements"));
- internal::Vectorization_add_av<Number> 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<Number> vector_add_av(this->val, down_V.val, a);
internal::parallel_for(vector_add_av, this->size(), this->thread_loop_partitioner);
}
Assert(down_W.size()==this->size(),
ExcMessage("Cannot add two vectors with different numbers of elements"));
- internal::Vectorization_add_avpbw<Number> 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<Number> vector_add(this->val, down_V.val,
+ down_W.val, a, b);
internal::parallel_for(vector_add, this->size(), this->thread_loop_partitioner);
}
// Downcast V. It fails, throws an exception.
const Vector<Number> &down_V = dynamic_cast<const Vector<Number>&>(V);
- internal::Vectorization_sadd_xav<Number> 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<Number> vector_sadd_xav(this->val, down_V.val,
+ a, s);
internal::parallel_for(vector_sadd_xav, this->size(), this->thread_loop_partitioner);
}
Assert(down_scaling_factors.size()==this->size(),
ExcMessage("Cannot add two vectors with different numbers of elements"));
- internal::Vectorization_scale<Number> vector_scale;
- vector_scale.val = this->val;
- vector_scale.v_val = down_scaling_factors.val;
+ internal::Vectorization_scale<Number> vector_scale(this->val, down_scaling_factors.val);
internal::parallel_for(vector_scale, this->size(), this->thread_loop_partitioner);
}
// Downcast V. If fails, throws an exception.
const Vector<Number> &down_V = dynamic_cast<const Vector<Number>&>(V);
- internal::Vectorization_equ_au<Number> vector_equ;
- vector_equ.val = this->val;
- vector_equ.u_val = down_V.val;
- vector_equ.a = a;
+ internal::Vectorization_equ_au<Number> vector_equ(this->val, down_V.val, a);
internal::parallel_for(vector_equ, this->size(), this->thread_loop_partitioner);
}
typedef typename VectorSpaceVector<Number>::real_type real_type;
real_type sum;
- internal::Norm1<Number, real_type> norm1;
- norm1.X = this->val;
+ internal::Norm1<Number, real_type> norm1(this->val);
internal::parallel_reduce(norm1, this->size(), sum, this->thread_loop_partitioner);
return sum;
// precision) using the BLAS approach with a weight, see e.g. dnrm2.f.
typedef typename VectorSpaceVector<Number>::real_type real_type;
real_type norm_square;
- internal::Norm2<Number, real_type> norm2;
- norm2.X = this->val;
+ internal::Norm2<Number, real_type> norm2(this->val);
internal::parallel_reduce(norm2, this->size(), norm_square,
this->thread_loop_partitioner);
if (numbers::is_finite(norm_square) &&
ExcMessage("Cannot add two vectors with different numbers of elements"));
Number sum;
- internal::AddAndDot<Number> adder;
- adder.X = this->val;
- adder.a = a;
- adder.V = down_V.val;
- adder.W = down_W.val;
+ internal::AddAndDot<Number> adder(this->val, down_V.val, down_W.val, a);
internal::parallel_reduce(adder, this->size(), sum, this->thread_loop_partitioner);
AssertIsFinite(sum);
ReadWriteVector<Number>::ReadWriteVector ()
:
val(NULL)
- {}
+ {
+ reinit(0, true);
+ }
#include <deal.II/base/config.h>
#include <deal.II/lac/read_write_vector.h>
-#include <deal.II/lac/vector_internal.h>
+#include <deal.II/lac/vector_operations_internal.h>
#ifdef DEAL_II_PETSC
# include <deal.II/lac/petsc_parallel_vector.h>
if (n_elements() != in_vector.n_elements())
reinit(in_vector, true);
- dealii::internal::Vector_copy<Number,Number> copier;
- copier.dst = val;
- copier.src = in_vector.val;
+ dealii::internal::Vector_copy<Number,Number> copier(in_vector.val, val);
internal::parallel_for(copier, n_elements(), thread_loop_partitioner);
return *this;
if (n_elements() != in_vector.n_elements())
reinit(in_vector, true);
- dealii::internal::Vector_copy<Number,Number2> copier;
- copier.dst = val;
- copier.src = in_vector.val;
+ dealii::internal::Vector_copy<Number,Number2> copier(in_vector.val, val);
internal::parallel_for(copier, n_elements(), thread_loop_partitioner);
return *this;
Assert(s==static_cast<Number>(0), ExcMessage("Only 0 can be assigned to a vector."));
(void)s;
- internal::Vector_set<Number> setter;
- setter.dst = val;
- setter.value = Number();
-
+ internal::Vector_set<Number> setter(Number(), val);
internal::parallel_for(setter, n_elements(), thread_loop_partitioner);
return *this;
#include <deal.II/base/numbers.h>
#include <deal.II/lac/vector.h>
#include <deal.II/lac/block_vector.h>
-#include <deal.II/lac/vector_internal.h>
+#include <deal.II/lac/vector_operations_internal.h>
#ifdef DEAL_II_WITH_PETSC
# include <deal.II/lac/petsc_vector.h>
if (vec_size != v.vec_size)
reinit (v, true);
- dealii::internal::Vector_copy<Number,Number> copier;
- copier.dst = val;
- copier.src = v.val;
+ dealii::internal::Vector_copy<Number,Number> copier(v.val, val);
internal::parallel_for(copier,vec_size,thread_loop_partitioner);
return *this;
if (vec_size != v.vec_size)
reinit (v, true);
- dealii::internal::Vector_copy<Number,Number2> copier;
- copier.dst = val;
- copier.src = v.val;
+ dealii::internal::Vector_copy<Number,Number2> copier(v.val, val);
internal::parallel_for(copier,vec_size,thread_loop_partitioner);
return *this;
if (s != Number())
Assert (vec_size!=0, ExcEmptyObject());
- internal::Vector_set<Number> setter;
- setter.dst = val;
- setter.value = s;
+ internal::Vector_set<Number> setter(s, val);
internal::parallel_for(setter,vec_size,thread_loop_partitioner);
Assert (vec_size!=0, ExcEmptyObject());
- internal::Vectorization_multiply_factor<Number> vector_multiply;
- vector_multiply.val = val;
- vector_multiply.factor = factor;
+ internal::Vectorization_multiply_factor<Number> vector_multiply(val, factor);
internal::parallel_for(vector_multiply,vec_size,thread_loop_partitioner);
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
- internal::Vectorization_add_av<Number> vector_add_av;
- vector_add_av.val = val;
- vector_add_av.v_val = v.val;
- vector_add_av.factor = a;
+ internal::Vectorization_add_av<Number> vector_add_av(val, v.val, a);
internal::parallel_for(vector_add_av,vec_size,thread_loop_partitioner);
}
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
- internal::Vectorization_sadd_xav<Number> 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<Number> vector_sadd_xav(val, v.val, a, x);
internal::parallel_for(vector_sadd_xav,vec_size,thread_loop_partitioner);
}
ExcDimensionMismatch(vec_size, v.size()));
Number sum;
- internal::Dot<Number,Number2> dot;
- dot.X = val;
- dot.Y = v.val;
+ internal::Dot<Number,Number2> dot(val, v.val);
internal::parallel_reduce (dot, vec_size, sum, thread_loop_partitioner);
AssertIsFinite(sum);
Assert (vec_size!=0, ExcEmptyObject());
real_type sum;
- internal::Norm2<Number,real_type> norm2;
- norm2.X = val;
+ internal::Norm2<Number,real_type> norm2(val);
internal::parallel_reduce (norm2, vec_size, sum, thread_loop_partitioner);
AssertIsFinite(sum);
Assert (vec_size!=0, ExcEmptyObject());
Number sum;
- internal::MeanValue<Number> mean;
- mean.X = val;
+ internal::MeanValue<Number> mean(val);
internal::parallel_reduce (mean, vec_size, sum, thread_loop_partitioner);
return sum / real_type(size());
Assert (vec_size!=0, ExcEmptyObject());
real_type sum;
- internal::Norm1<Number, real_type> norm1;
- norm1.X = val;
+ internal::Norm1<Number, real_type> norm1(val);
internal::parallel_reduce (norm1, vec_size, sum, thread_loop_partitioner);
return sum;
Assert (vec_size!=0, ExcEmptyObject());
real_type norm_square;
- internal::Norm2<Number, real_type> norm2;
- norm2.X = val;
+ internal::Norm2<Number, real_type> norm2(val);
internal::parallel_reduce (norm2, vec_size, norm_square,
thread_loop_partitioner);
if (numbers::is_finite(norm_square) &&
return l2_norm();
real_type sum;
- internal::NormP<Number, real_type> normp;
- normp.X = val;
- normp.p = p;
+ internal::NormP<Number, real_type> normp(val, p);
internal::parallel_reduce (normp, vec_size, sum, thread_loop_partitioner);
if (numbers::is_finite(sum) && sum >= std::numeric_limits<real_type>::min())
AssertDimension (vec_size, W.size());
Number sum;
- internal::AddAndDot<Number> adder;
- adder.X = val;
- adder.a = a;
- adder.V = V.val;
- adder.W = W.val;
+ internal::AddAndDot<Number> adder(this->val, V.val, W.val, a);
internal::parallel_reduce (adder, vec_size, sum, thread_loop_partitioner);
AssertIsFinite(sum);
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
- internal::Vectorization_subtract_v<Number> vector_subtract;
- vector_subtract.val = val;
- vector_subtract.v_val = v.val;
+ internal::Vectorization_subtract_v<Number> vector_subtract(val, v.val);
internal::parallel_for(vector_subtract,vec_size,thread_loop_partitioner);
return *this;
{
Assert (vec_size!=0, ExcEmptyObject());
- internal::Vectorization_add_factor<Number> vector_add;
- vector_add.val = val;
- vector_add.factor = v;
+ internal::Vectorization_add_factor<Number> vector_add(val, v);
internal::parallel_for(vector_add,vec_size,thread_loop_partitioner);
}
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
- internal::Vectorization_add_v<Number> vector_add;
- vector_add.val = val;
- vector_add.v_val = v.val;
+ internal::Vectorization_add_v<Number> vector_add(val, v.val);
internal::parallel_for(vector_add,vec_size,thread_loop_partitioner);
}
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<Number> 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<Number> vector_add(val, v.val, w.val, a, b);
internal::parallel_for(vector_add,vec_size,thread_loop_partitioner);
}
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size));
- internal::Vectorization_sadd_xv<Number> vector_sadd;
- vector_sadd.val = val;
- vector_sadd.v_val = v.val;
- vector_sadd.x = x;
+ internal::Vectorization_sadd_xv<Number> vector_sadd(val, v.val, x);
internal::parallel_for(vector_sadd,vec_size,thread_loop_partitioner);
}
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<Number> 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<Number> vector_sadd(val, v.val, w.val, x,
+ a, b);
internal::parallel_for(vector_sadd,vec_size,thread_loop_partitioner);
}
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == s.vec_size, ExcDimensionMismatch(vec_size, s.vec_size));
- internal::Vectorization_scale<Number> vector_scale;
- vector_scale.val = val;
- vector_scale.v_val = s.val;
+ internal::Vectorization_scale<Number> vector_scale(val, s.val);
internal::parallel_for(vector_scale,vec_size,thread_loop_partitioner);
}
Assert (vec_size!=0, ExcEmptyObject());
Assert (vec_size == u.vec_size, ExcDimensionMismatch(vec_size, u.vec_size));
- internal::Vectorization_equ_au<Number> vector_equ;
- vector_equ.val = val;
- vector_equ.u_val = u.val;
- vector_equ.a = a;
+ internal::Vectorization_equ_au<Number> vector_equ(val, u.val, a);
internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner);
}
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<Number> 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<Number> vector_equ(val, u.val, v.val, a, b);
internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner);
}
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<Number> 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<Number> vector_equ(val, u.val, v.val, w.val,
+ a, b, c);
internal::parallel_for(vector_equ,vec_size,thread_loop_partitioner);
}
// we overwrite them anyway
reinit (a.size(), true);
- internal::Vectorization_ratio<Number> vector_ratio;
- vector_ratio.val = val;
- vector_ratio.a_val = a.val;
- vector_ratio.b_val = b.val;
+ internal::Vectorization_ratio<Number> vector_ratio(val, a.val, b.val);
internal::parallel_for(vector_ratio,vec_size,thread_loop_partitioner);
}
// ---------------------------------------------------------------------
-#ifndef dealii__vector_internal_h
-#define dealii__vector_internal_h
+#ifndef dealii__vector_operations_internal_h
+#define dealii__vector_operations_internal_h
#include <deal.II/base/multithread_info.h>
#include <deal.II/base/parallel.h>
template <typename Number>
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
{
else
std::fill (dst+begin, dst+end, value);
}
+
+ Number value;
+ Number *dst;
};
template <typename Number, typename OtherNumber>
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
{
dst[i] = src[i];
}
}
+
+ const OtherNumber *src;
+ Number *dst;
};
template <typename Number>
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
{
val[i] *= factor;
}
}
+
+ Number *val;
+ Number factor;
};
template <typename Number>
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
{
val[i] += factor*v_val[i];
}
}
+
+ Number *val;
+ Number *v_val;
+ Number factor;
};
template <typename Number>
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
{
val[i] = x*val[i] + a*v_val[i];
}
}
+
+ Number *val;
+ Number *v_val;
+ Number a;
+ Number x;
};
template <typename Number>
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
{
val[i] -= v_val[i];
}
}
+
+ Number *val;
+ Number *v_val;
};
template <typename Number>
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
{
val[i] += factor;
}
}
+
+ Number *val;
+ Number factor;
};
template <typename Number>
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
{
val[i] += v_val[i];
}
}
+
+ Number *val;
+ Number *v_val;
};
template <typename Number>
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
{
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 <typename Number>
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
{
val[i] = x*val[i] + v_val[i];
}
}
+
+ Number *val;
+ Number *v_val;
+ Number x;
};
template <typename Number>
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
{
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 <typename Number>
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
{
val[i] *= v_val[i];
}
}
+
+ Number *val;
+ Number *v_val;
};
template <typename Number>
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
{
val[i] = a*u_val[i];
}
}
+
+ Number *val;
+ Number *u_val;
+ Number a;
};
template <typename Number>
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
{
val[i] = a*u_val[i] + b*v_val[i];
}
}
- };
- template <typename Number>
- struct Vectorization_equ_aubvcw
- {
Number *val;
Number *u_val;
Number *v_val;
- Number *w_val;
Number a;
Number b;
- Number c;
+ };
+
+ template <typename Number>
+ 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
{
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 <typename Number>
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
{
val[i] = a_val[i]/b_val[i];
}
}
+
+ Number *val;
+ Number *a_val;
+ Number *b_val;
};
static const bool vectorizes = types_are_equal<Number,Number2>::value &&
(VectorizedArray<Number>::n_array_elements > 1);
+ Dot(const Number *X, const Number2 *Y)
+ :
+ X(X),
+ Y(Y)
+ {}
+
Number
operator() (const size_type i) const
{
{
static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
+ Norm2(const Number *X)
+ :
+ X(X)
+ {}
+
RealType
operator() (const size_type i) const
{
{
static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
+ Norm1(const Number *X)
+ :
+ X(X)
+ {}
+
RealType
operator() (const size_type i) const
{
{
static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
+ NormP(const Number *X, RealType p)
+ :
+ X(X),
+ p(p)
+ {}
+
RealType
operator() (const size_type i) const
{
{
static const bool vectorizes = VectorizedArray<Number>::n_array_elements > 1;
+ MeanValue(const Number *X)
+ :
+ X(X)
+ {}
+
Number
operator() (const size_type i) const
{
{
static const bool vectorizes = VectorizedArray<Number>::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
{