*/
BlockVector<Number> & operator *= (const Number factor);
+ /**
+ * Multiply each element of this
+ * vector by the corresponding
+ * element of @p{v}.
+ */
+ template<typename Number2>
+ void scale (const BlockVector<Number2>& v);
+
/**
* U=a*V. Assignment.
*/
}
+
+template <typename Number>
+template <typename Number2>
+void BlockVector<Number>::scale (const BlockVector<Number2>& v)
+{
+ Assert (num_blocks == v.num_blocks,
+ ExcDimensionMismatch(num_blocks, v.num_blocks));
+ for (unsigned int i=0;i<num_blocks;++i)
+ {
+ components[i].scale(v.block(i));
+ }
+}
+
+
+
template <typename Number>
void BlockVector<Number>::equ (const Number a,
const BlockVector<Number>& v,
* immediate re-assignment) by a
* diagonal scaling matrix.
*/
- void scale (const Vector<Number> &scaling_factors);
+ template <typename Number2>
+ void scale (const Vector<Number2> &scaling_factors);
/**
* U=a*V. Assignment.
template <typename Number>
-void Vector<Number>::scale (const Vector<Number> &s)
+template <typename Number2>
+void Vector<Number>::scale (const Vector<Number2> &s)
{
Assert (dim!=0, ExcEmptyVector());
Assert (dim == s.dim, ExcDimensionMismatch(dim, s.dim));
iterator ptr = begin();
- const_iterator sptr = s.begin();
const const_iterator eptr = end();
+ typename Vector<Number2>::const_iterator sptr = s.begin();
while (ptr!=eptr)
*ptr++ *= *sptr++;
}
const BlockVector<double>&);
template void BlockVector<double>::equ<float>(const double,
const BlockVector<float>&);
+template void BlockVector<double>::scale<double>(const BlockVector<double>&);
+template void BlockVector<double>::scale<float>(const BlockVector<float>&);
template class BlockVector<float>;
template BlockVector<float>& BlockVector<float>::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<double>(
const BlockVector<double>&);
template void BlockVector<float>::equ<float>(const float,
const BlockVector<float>&);
+template void BlockVector<float>::scale<double>(const BlockVector<double>&);
+template void BlockVector<float>::scale<float>(const BlockVector<float>&);
namespace BlockVectorIterators
{
template void Vector<double>::reinit<float>(const Vector<float>&, const bool);
template void Vector<double>::equ<double>(const double, const Vector<double>&);
template void Vector<double>::equ<float>(const double, const Vector<float>&);
+template void Vector<double>::scale<double>(const Vector<double>&);
+template void Vector<double>::scale<float>(const Vector<float>&);
template class Vector<float>;
template Vector<float>& Vector<float>::DEAL_II_MEMBER_OP_TEMPLATE_INST operator=<double>(const Vector<double>&);
template void Vector<float>::reinit<float>(const Vector<float>&, const bool);
template void Vector<float>::equ<double>(const float, const Vector<double>&);
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>&);
// see the .h file for why these functions are disabled.
// template Vector<float>::Vector (const Vector<double>& v);