3 #ifndef DUNE_DENSEVECTOR_HH
4 #define DUNE_DENSEVECTOR_HH
53 return std::abs(c.real()) + std::abs(c.imag());
73 return c.real()*c.real() + c.imag()*c.imag();
80 template<class K, bool isInteger = std::numeric_limits<K>::is_integer>
109 return Sqrt<K>::sqrt(k);
118 template<
class C,
class T>
123 friend class
DenseIterator<const typename remove_const<C>::type, const typename remove_const<T>::type >;
139 : container_(0), position_()
143 : container_(&cont), position_(pos)
147 : container_(other.container_), position_(other.position_)
153 return position_ == other.position_ && container_ == other.container_;
159 return position_ == other.position_ && container_ == other.container_;
163 return container_->operator[](position_);
177 return container_->operator[](position_+i);
181 position_=position_+n;
186 assert(other.container_==container_);
187 return other.position_ - position_;
192 assert(other.container_==container_);
193 return other.position_ - position_;
199 return this->position_;
223 typedef DenseMatVecTraits<V> Traits;
227 V & asImp() {
return static_cast<V&
>(*this); }
228 const V & asImp()
const {
return static_cast<const V&
>(*this); }
268 return asImp().vec_access(i);
273 return asImp().vec_access(i);
279 return asImp().vec_size();
359 template <
class Other>
362 assert(y.size() ==
size());
369 template <
class Other>
372 assert(y.size() ==
size());
379 template <
class Other>
387 template <
class Other>
427 template <
class Other>
430 assert(y.size() ==
size());
432 if ((*
this)[i]!=y[i])
439 template <
class Other>
447 template <
class Other>
450 assert(y.size() ==
size());
452 (*
this)[i] += a*y[i];
459 template <
class Other>
462 assert(y.size() ==
size());
465 result += (*
this)[i]*y[i];
475 result += std::abs((*
this)[i]);
485 result += fvmeta::absreal((*
this)[i]);
494 result += fvmeta::abs2((*
this)[i]);
495 return fvmeta::sqrt(result);
503 result += fvmeta::abs2((*
this)[i]);
515 for (it = it + 1; it !=
end(); ++it)
516 max = std::max(max, std::abs(*it));
529 for (it = it + 1; it !=
end(); ++it)
530 max = std::max(max, fvmeta::absreal(*it));
560 std::ostream& operator<< (std::ostream& s, const DenseVector<V>& v)
563 s << ((i>0) ?
" " :
"") << v[i];
571 #endif // DUNE_DENSEVECTOR_HH