4 #ifndef DUNE_BVECTOR_HH
5 #define DUNE_BVECTOR_HH
35 template<
class B,
class A=std::allocator<B> >
77 #ifdef DUNE_ISTL_WITH_CHECKING
78 if (this->
n!=y.
N()) DUNE_THROW(
ISTLError,
"vector size mismatch");
80 for (
size_type i=0; i<this->
n; ++i) (*
this)[i] += y[i];
87 #ifdef DUNE_ISTL_WITH_CHECKING
88 if (this->
n!=y.
N()) DUNE_THROW(
ISTLError,
"vector size mismatch");
90 for (
size_type i=0; i<this->
n; ++i) (*
this)[i] -= y[i];
97 for (
size_type i=0; i<this->
n; ++i) (*
this)[i] *= k;
104 for (
size_type i=0; i<this->
n; ++i) (*
this)[i] /= k;
111 #ifdef DUNE_ISTL_WITH_CHECKING
112 if (this->
n!=y.
N()) DUNE_THROW(
ISTLError,
"vector size mismatch");
124 #ifdef DUNE_ISTL_WITH_CHECKING
125 if (this->
n!=y.
N()) DUNE_THROW(
ISTLError,
"vector size mismatch");
128 for (
size_type i=0; i<this->
n; ++i) sum += (*
this)[i]*y[i];
139 for (
size_type i=0; i<this->
n; ++i) sum += (*
this)[i].one_norm();
147 for (
size_type i=0; i<this->
n; ++i) sum += (*
this)[i].one_norm_real();
155 for (
size_type i=0; i<this->
n; ++i) sum += (*
this)[i].two_norm2();
163 for (
size_type i=0; i<this->
n; ++i) sum += (*
this)[i].two_norm2();
196 d += (*
this)[i].dim();
221 template<
class B,
class A=std::allocator<B> >
289 if(this->
n > capacity)
331 new (this->
p) B[capacity];
338 for(
size_type i=0; i < block_vector_unmanaged<B,A>::N(); ++i, ++from, ++to)
389 this->
reserve(size, copyOldValues);
490 return this->
operator=(static_cast<const BlockVector&>(a));
509 template<
class K,
class A>
510 std::ostream& operator<< (std::ostream& s, const BlockVector<K, A>& v)
514 for (size_type i=0; i<v.size(); i++)
515 s << v[i] << std::endl;
536 template<
class B,
class A=std::allocator<B> >
603 #ifdef DUNE_ISTL_WITH_CHECKING
604 if (this->
n!=a.
N()) DUNE_THROW(
ISTLError,
"vector size mismatch");
619 return this->
operator=(static_cast<const BlockVectorWindow&>(a));
674 template<
class B,
class A=std::allocator<B> >
715 #ifdef DUNE_ISTL_WITH_CHECKING
718 for (
size_type i=0; i<y.n; ++i) this->
operator[](y.j[i]) += y.p[i];
726 #ifdef DUNE_ISTL_WITH_CHECKING
729 for (
size_type i=0; i<y.n; ++i) this->
operator[](y.j[i]) -= y.p[i];
737 #ifdef DUNE_ISTL_WITH_CHECKING
740 for (
size_type i=0; i<y.n; ++i) (this->
operator[](y.j[i])).axpy(a,y.p[i]);
747 for (
size_type i=0; i<this->
n; ++i) (this->
p)[i] *= k;
754 for (
size_type i=0; i<this->
n; ++i) (this->
p)[i] /= k;
764 #ifdef DUNE_ISTL_WITH_CHECKING
766 DUNE_THROW(
ISTLError,
"index set mismatch");
770 sum += (this->
p)[i] * y[(this->
j)[i]];
781 for (
size_type i=0; i<this->
n; ++i) sum += (this->
p)[i].one_norm();
789 for (
size_type i=0; i<this->
n; ++i) sum += (this->
p)[i].one_norm_real();
797 for (
size_type i=0; i<this->
n; ++i) sum += (this->
p)[i].two_norm2();
805 for (
size_type i=0; i<this->
n; ++i) sum += (this->
p)[i].two_norm2();
839 d += (this->
p)[i].dim();
852 typename V::ConstIterator e=this->
end();
877 template<
class B,
class A=std::allocator<B> >
946 #ifdef DUNE_ISTL_WITH_CHECKING
947 if (this->
n!=a.
N()) DUNE_THROW(
ISTLError,
"vector size mismatch");
963 return this->
operator=(static_cast<const CompressedBlockVectorWindow&>(a));