<h3>lac</h3>
<ol>
+ <li> <p>
+ New: There is now a function <code
+ class="member">Vector::scale(Vector)</code>
+ that scales each element of the vector by the corresponding
+ element of the argument.
+ <br>
+ (WB 2001/04/23)
+ </p>
+
<li> <p> Changed: Solver functions <code class="member">solve</code>
- are void now. If the solver has not converged within the
+ return void now. If the solver has not converged within the
maximum number of iterations or encounters a breakdown, it
throws an exception of type <code
class="class">SolverControl::NoConvergence</code> instead of
const Number c, const Vector<Number>& X);
/**
- * Scale each element of the vector by the
- * given factor.
+ * Scale each element of the
+ * vector by the given factor.
*/
//TODO:[?] Why not have an operator *= instead of/in addition to `scale'?
void scale (const Number factor);
+
+ /**
+ * Scale each element of this
+ * vector by the corresponding
+ * element in the argument. This
+ * function is mostly meant to
+ * simulate multiplication (and
+ * immediate re-assignment) by a
+ * diagonal scaling matrix.
+ */
+ void scale (const Vector<Number> &scaling_factors);
/**
* U=a*V. Replacing.
}
+
template <typename Number>
void Vector<Number>::scale (const Number factor)
{
Assert (dim!=0, ExcEmptyVector());
- iterator ptr=begin(), eptr=end();
+ iterator ptr = begin();
+ const const_iterator eptr = end();
while (ptr!=eptr)
*ptr++ *= factor;
}
+
+template <typename Number>
+void Vector<Number>::scale (const Vector<Number> &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();
+ while (ptr!=eptr)
+ *ptr++ *= *sptr++;
+}
+
+
+
template <typename Number>
void Vector<Number>::equ (const Number a, const Vector<Number>& u,
const Number b, const Vector<Number>& v)