25#include "libmesh/dense_subvector.h"
26#include "libmesh/dense_vector.h"
27#include "libmesh/laspack_vector.h"
28#include "libmesh/laspack_matrix.h"
29#include "libmesh/int_range.h"
31#ifdef LIBMESH_HAVE_LASPACK
58 return static_cast<Real>(l1Norm_V(
const_cast<QVector*
>(&_vec)));
68 return static_cast<Real>(l2Norm_V(
const_cast<QVector*
>(&_vec)));
78 return static_cast<Real>(MaxNorm_V(
const_cast<QVector*
>(&_vec)));
111 libmesh_assert_equal_to(size(), v.
size());
114 const bool was_closed = this->_is_closed;
120 this->set(i, (*
this)(i) * v(i));
125 this->_is_closed = was_closed;
136 libmesh_assert_equal_to(size(), v.
size());
139 const bool was_closed = this->_is_closed;
145 this->set(i, (*
this)(i) / v(i));
150 this->_is_closed = was_closed;
164 const bool was_closed = this->_is_closed;
172 libmesh_assert_not_equal_to (v, T(0));
174 this->set(i, 1. / v);
180 this->_is_closed = was_closed;
192 const bool was_closed = this->_is_closed;
205 this->_is_closed = was_closed;
214 const bool was_closed = this->_is_closed;
225 this->_is_closed = was_closed;
244 const LaspackVector * v = cast_ptr<const LaspackVector *>(&v_in);
247 const bool was_closed = this->_is_closed;
251 libmesh_assert_equal_to (this->size(), v->
size());
254 this->add (i, a*(*v)(i));
257 this->_is_closed = was_closed;
275 AddAsgn_VV (&_vec, Mul_QV(
const_cast<QMatrix*
>(&mat->_QMat),
276 const_cast<QVector*
>(&vec->
_vec)));
284 libmesh_not_implemented();
294 Asgn_VV(&_vec, Mul_SV (factor, &_vec));
305 this->set(i,std::abs((*
this)(i)));
317 return Mul_VV (
const_cast<QVector*
>(&(this->_vec)),
318 const_cast<QVector*
>(&(v->
_vec)));
330 V_SetAllCmp (&_vec, s);
343 cast_ptr<const LaspackVector<T> *>(&v_in);
360 libmesh_assert_equal_to (this->size(), v.
size());
363 Asgn_VV (
const_cast<QVector*
>(&_vec),
364 const_cast<QVector*
>(&v.
_vec)
368 this->_is_closed =
true;
384 if (this->size() == v.size())
389 libmesh_error_msg(
"this->size() = " << this->size() <<
" must be equal to v.size() = " << v.size());
400 cast_ptr<LaspackVector<T> *>(&v_local_in);
411 const std::vector<numeric_index_type> & libmesh_dbg_var(send_list))
const
415 cast_ptr<LaspackVector<T> *>(&v_local_in);
418 libmesh_assert_less_equal (send_list.size(), v_local->
size());
427 const std::vector<numeric_index_type> & indices)
const
430 v_local.resize(indices.size());
433 v_local[i] = (*
this)(indices[i]);
441 const std::vector<numeric_index_type> & libmesh_dbg_var(send_list))
443 libmesh_assert_equal_to (first_local_idx, 0);
444 libmesh_assert_equal_to (last_local_idx+1, this->size());
446 libmesh_assert_less_equal (send_list.size(), this->size());
449 this->_is_closed =
true;
459 v_local.resize(this->size());
462 v_local[i] = (*
this)(i);
471 libmesh_assert_equal_to (pid, 0);
473 this->localize (v_local);
482 libmesh_not_implemented();
489 libmesh_not_implemented();
497 return -std::numeric_limits<Real>::max();
516 return std::numeric_limits<Real>::max();
The LaspackMatrix class wraps a QMatrix object from the Laspack library.
This class provides a nice interface to the Laspack C-based data structures for serial vectors.
virtual NumericVector< T > & operator-=(const NumericVector< T > &v) override
Subtracts v from *this, .
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A) override
Computes , i.e.
QVector _vec
Actual Laspack vector datatype to hold vector entries.
virtual void localize(std::vector< T > &v_local) const override
Creates a copy of the global vector in the local vector v_local.
virtual numeric_index_type size() const override
virtual void add_vector(const NumericVector< T > &v, const SparseMatrix< T > &A) override
Computes , i.e.
virtual void localize_to_one(std::vector< T > &v_local, const processor_id_type proc_id=0) const override
Creates a local copy of the global vector in v_local only on processor proc_id.
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
Computes (summation not implied) i.e.
virtual NumericVector< T > & operator/=(const NumericVector< T > &v) override
Computes the component-wise division of this vector's entries by another's, .
virtual T sum() const override
virtual Real linfty_norm() const override
virtual Real l2_norm() const override
virtual Real l1_norm() const override
virtual void conjugate() override
Negates the imaginary component of each entry in the vector.
virtual Real min() const override
virtual void pointwise_divide(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
Computes (summation not implied) i.e.
virtual void reciprocal() override
Computes the component-wise reciprocal, .
virtual void abs() override
Sets for each entry in the vector.
virtual void add(const numeric_index_type i, const T value) override
Adds value to the vector entry specified by i.
LaspackVector< T > & operator=(const LaspackVector< T > &v)
Copy assignment operator.
virtual T dot(const NumericVector< T > &v) const override
virtual void scale(const T factor) override
Scale each element of the vector by the given factor.
virtual NumericVector< T > & operator*=(const NumericVector< T > &v) override
Computes the component-wise multiplication of this vector's entries by another's, .
virtual Real max() const override
virtual NumericVector< T > & operator+=(const NumericVector< T > &v) override
Adds v to *this, .
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
virtual numeric_index_type size() const =0
virtual bool closed() const
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
bool closed()
Checks that the library has been closed.
dof_id_type numeric_index_type
bool initialized()
Checks that library initialization has been done.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
uint8_t processor_id_type
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...