25 #include "libmesh/dense_subvector.h" 26 #include "libmesh/dense_vector.h" 27 #include "libmesh/eigen_sparse_vector.h" 28 #include "libmesh/eigen_sparse_matrix.h" 29 #include "libmesh/int_range.h" 31 #ifdef LIBMESH_HAVE_EIGEN 53 return _vec.lpNorm<1>();
64 return _vec.lpNorm<2>();
75 return _vec.lpNorm<Eigen::Infinity>();
109 template <
typename T>
113 libmesh_assert_equal_to(size(), v_in.
size());
117 _vec = _vec.cwiseProduct(v._vec);
124 template <
typename T>
128 libmesh_assert_equal_to(size(), v_in.
size());
132 _vec = _vec.cwiseQuotient(v._vec);
140 template <
typename T>
148 libmesh_assert_not_equal_to ((*
this)(i), T(0));
151 _vec = _vec.cwiseInverse();
156 template <
typename T>
159 _vec = _vec.conjugate();
164 template <
typename T>
167 _vec += EigenSV::Constant(this->size(), v);
173 template <
typename T>
185 template <
typename T>
197 template <
typename T>
208 _vec += mat->_mat*e_vec->
_vec;
213 template <
typename T>
224 _vec += mat->_mat.transpose()*e_vec->
_vec;
229 template <
typename T>
239 template <
typename T>
252 template <
typename T>
261 return _vec.dot(v->
_vec);
266 template <
typename T>
280 template <
typename T>
286 cast_ptr<const EigenSparseVector<T> *>(&v_in);
297 template <
typename T>
303 libmesh_assert_equal_to (this->size(), v.
size());
307 this->_is_closed =
true;
314 template <
typename T>
322 if (this->size() == v.size())
327 libmesh_error_msg(
"this->size() = " << this->size() <<
" must be equal to v.size() = " << v.size());
333 template <
typename T>
338 cast_ptr<EigenSparseVector<T> *>(&v_local_in);
347 template <
typename T>
349 const std::vector<numeric_index_type> & libmesh_dbg_var(send_list))
const 353 cast_ptr<EigenSparseVector<T> *>(&v_local_in);
356 libmesh_assert_less_equal (send_list.size(), v_local->
size());
363 template <
typename T>
365 const std::vector<numeric_index_type> & indices)
const 368 v_local.resize(indices.size());
371 v_local[i] = (*
this)(indices[i]);
376 template <
typename T>
379 const std::vector<numeric_index_type> & libmesh_dbg_var(send_list))
381 libmesh_assert_equal_to (first_local_idx, 0);
382 libmesh_assert_equal_to (last_local_idx+1, this->size());
384 libmesh_assert_less_equal (send_list.size(), this->size());
386 this->_is_closed =
true;
391 template <
typename T>
395 v_local.resize(this->size());
398 v_local[i] = (*this)(i);
403 template <
typename T>
407 libmesh_assert_equal_to (pid, 0);
409 this->localize (v_local);
414 template <
typename T>
418 libmesh_not_implemented();
421 template <
typename T>
425 libmesh_not_implemented();
429 template <
typename T>
434 return -std::numeric_limits<Real>::max();
436 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 452 template <
typename T>
457 return std::numeric_limits<Real>::max();
459 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 481 #endif // #ifdef LIBMESH_HAVE_EIGEN
bool closed()
Checks that the library has been closed.
The EigenSparseMatrix class wraps a sparse matrix object from the Eigen library.
virtual Real linfty_norm() const override
virtual void localize(std::vector< T > &v_local) const override
Creates a copy of the global vector in the local vector v_local.
virtual void conjugate() override
Negates the imaginary component of each entry in the vector.
virtual void pointwise_divide(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
Computes (summation not implied) i.e.
virtual void pointwise_mult(const NumericVector< T > &vec1, const NumericVector< T > &vec2) override
Computes (summation not implied) i.e.
virtual T sum() const override
virtual void add_vector(const NumericVector< T > &v, const SparseMatrix< T > &A) override
Computes , i.e.
DataType _vec
Actual Eigen::SparseVector<> we are wrapping.
virtual void reciprocal() override
Computes the component-wise reciprocal, .
virtual numeric_index_type size() const =0
virtual NumericVector< T > & operator-=(const NumericVector< T > &v) override
Subtracts v from *this, .
virtual Real min() const override
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
The libMesh namespace provides an interface to certain functionality in the library.
uint8_t processor_id_type
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
virtual Real l2_norm() const override
dof_id_type numeric_index_type
virtual Real max() const override
virtual NumericVector< T > & operator/=(const NumericVector< T > &v_in) override
Computes the component-wise division of this vector's entries by another's, .
virtual numeric_index_type size() const override
EigenSparseVector< T > & operator=(const EigenSparseVector< T > &v)
Copy assignment operator.
virtual NumericVector< T > & operator*=(const NumericVector< T > &v_in) override
Computes the component-wise multiplication of this vector's entries by another's, ...
virtual void add_vector_transpose(const NumericVector< T > &v, const SparseMatrix< T > &A) override
Computes , i.e.
virtual void abs() override
Sets for each entry in the vector.
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 bool closed() const
virtual void scale(const T factor) override
Scale each element of the vector by the given factor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real l1_norm() const override
virtual void add(const numeric_index_type i, const T value) override
Adds value to the vector entry specified by i.
bool initialized()
Checks that library initialization has been done.
virtual T dot(const NumericVector< T > &v) const override
virtual NumericVector< T > & operator+=(const NumericVector< T > &v) override
Adds v to *this, .
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
This class provides a nice interface to the Eigen C++-based data structures for serial vectors...