Lines Matching full:self
29 fn from(vec: &'a Vector) -> Self { in from() argument
32 Self::Some(vec) in from()
37 pub(crate) fn to_raw(&self) -> bind_ceed::CeedVector { in to_raw()
38 match self { in to_raw()
39 Self::Some(vec) => vec.ptr, in to_raw()
40 Self::Active => unsafe { bind_ceed::CEED_VECTOR_ACTIVE }, in to_raw()
41 Self::None => unsafe { bind_ceed::CEED_VECTOR_NONE }, in to_raw()
63 pub fn is_some(&self) -> bool { in is_some()
64 match self { in is_some()
65 Self::Some(_) => true, in is_some()
66 Self::Active => false, in is_some()
67 Self::None => false, in is_some()
89 pub fn is_active(&self) -> bool { in is_active()
90 match self { in is_active()
91 Self::Some(_) => false, in is_active()
92 Self::Active => true, in is_active()
93 Self::None => false, in is_active()
115 pub fn is_none(&self) -> bool { in is_none()
116 match self { in is_none()
117 Self::Some(_) => false, in is_none()
118 Self::Active => false, in is_none()
119 Self::None => true, in is_none()
136 fn drop(&mut self) { in drop() argument
139 self.vector.ptr, in drop()
154 ) -> crate::Result<Self> { in from_vector_and_slice_mut() argument
168 Ok(Self { in from_vector_and_slice_mut()
184 fn from(vec: &Vector) -> Self { in from() argument
193 fn drop(&mut self) { in drop() argument
194 let not_none_and_active = self.ptr != unsafe { bind_ceed::CEED_VECTOR_NONE } in drop()
195 && self.ptr != unsafe { bind_ceed::CEED_VECTOR_ACTIVE }; in drop()
198 unsafe { bind_ceed::CeedVectorDestroy(&mut self.ptr) }; in drop()
225 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt() argument
232 bind_ceed::CeedVectorView(self.ptr, format_c, file); in fmt()
245 pub fn create(ceed: &crate::Ceed, n: usize) -> crate::Result<Self> { in create() argument
249 Ok(Self { in create()
255 pub(crate) unsafe fn from_raw(ptr: bind_ceed::CeedVector) -> crate::Result<Self> { in from_raw() argument
256 Ok(Self { in from_raw()
262 fn ptr_copy_mut(&mut self) -> crate::Result<bind_ceed::CeedVector> { in ptr_copy_mut()
264 self.check_error(unsafe { bind_ceed::CeedVectorReferenceCopy(self.ptr, &mut ptr_copy) })?; in ptr_copy_mut()
268 /// Copy the array of self into vec_copy
289 pub fn copy_from(&mut self, vec_source: &Vector) -> crate::Result<i32> { in copy_from() argument
290 self.check_error(unsafe { bind_ceed::CeedVectorCopy(vec_source.ptr, self.ptr) }) in copy_from()
308 pub fn from_slice(ceed: &crate::Ceed, v: &[crate::Scalar]) -> crate::Result<Self> { in from_slice() argument
309 let mut x = Self::create(ceed, v.len())?; in from_slice()
331 pub fn from_array(ceed: &crate::Ceed, v: &mut [crate::Scalar]) -> crate::Result<Self> { in from_array() argument
332 let x = Self::create(ceed, v.len())?; in from_array()
344 fn ceed(&self) -> bind_ceed::Ceed { in ceed()
345 unsafe { bind_ceed::CeedVectorReturnCeed(self.ptr) } in ceed()
350 fn check_error(&self, ierr: i32) -> crate::Result<i32> { in check_error() argument
351 crate::check_error(|| self.ceed(), ierr) in check_error()
367 pub fn length(&self) -> usize { in length()
369 unsafe { bind_ceed::CeedVectorGetLength(self.ptr, &mut n) }; in length()
384 pub fn len(&self) -> usize { in len()
385 self.length() in len()
401 pub fn is_empty(&self) -> bool { in is_empty()
402 self.length() == 0 in is_empty()
427 pub fn set_value(&mut self, value: crate::Scalar) -> crate::Result<i32> { in set_value() argument
428 self.check_error(unsafe { bind_ceed::CeedVectorSetValue(self.ptr, value) }) in set_value()
435 /// * `slice` - values to into self; length must match
450 pub fn set_slice(&mut self, slice: &[crate::Scalar]) -> crate::Result<i32> { in set_slice() argument
451 assert_eq!(self.length(), slice.len()); in set_slice()
456 self.check_error(unsafe { in set_slice()
458 self.ptr, in set_slice()
470 /// * `slice` - values to wrap in self; length must match
512 &mut self, in wrap_slice_mut() argument
515 VectorSliceWrapper::from_vector_and_slice_mut(self, slice) in wrap_slice_mut()
541 pub fn sync(&self, mtype: crate::MemType) -> crate::Result<i32> { in sync() argument
542 self.check_error(unsafe { in sync()
543 bind_ceed::CeedVectorSyncArray(self.ptr, mtype as bind_ceed::CeedMemType) in sync()
564 pub fn view(&self) -> crate::Result<VectorView> { in view()
565 VectorView::new(self) in view()
586 pub fn view_mut(&mut self) -> crate::Result<VectorViewMut> { in view_mut()
587 VectorViewMut::new(self) in view_mut()
613 pub fn norm(&self, ntype: crate::NormType) -> crate::Result<crate::Scalar> { in norm() argument
615 self.check_error(unsafe { in norm()
616 bind_ceed::CeedVectorNorm(self.ptr, ntype as bind_ceed::CeedNormType, &mut res) in norm()
641 pub fn scale(mut self, alpha: crate::Scalar) -> crate::Result<Self> { in scale() argument
642 self.check_error(unsafe { bind_ceed::CeedVectorScale(self.ptr, alpha) })?; in scale()
643 Ok(self) in scale()
651 /// * `x` - second vector, must be different than self
668 pub fn axpy(mut self, alpha: crate::Scalar, x: &Vector) -> crate::Result<Self> { in axpy() argument
669 self.check_error(unsafe { bind_ceed::CeedVectorAXPY(self.ptr, alpha, x.ptr) })?; in axpy()
670 Ok(self) in axpy()
679 /// * `x` - second vector, must be different than self
697 mut self, in axpby() argument
701 ) -> crate::Result<Self> { in axpby() argument
702 self.check_error(unsafe { bind_ceed::CeedVectorAXPBY(self.ptr, alpha, beta, x.ptr) })?; in axpby()
703 Ok(self) in axpby()
729 pub fn pointwise_mult(mut self, x: &Vector, y: &Vector) -> crate::Result<Self> { in pointwise_mult() argument
730 self.check_error(unsafe { bind_ceed::CeedVectorPointwiseMult(self.ptr, x.ptr, y.ptr) })?; in pointwise_mult()
731 Ok(self) in pointwise_mult()
755 pub fn pointwise_scale(mut self, x: &Vector) -> crate::Result<Self> { in pointwise_scale() argument
756 self.check_error(unsafe { bind_ceed::CeedVectorPointwiseMult(self.ptr, self.ptr, x.ptr) })?; in pointwise_scale()
757 Ok(self) in pointwise_scale()
776 pub fn pointwise_square(mut self) -> crate::Result<Self> { in pointwise_square() argument
777 self.check_error(unsafe { in pointwise_square()
778 bind_ceed::CeedVectorPointwiseMult(self.ptr, self.ptr, self.ptr) in pointwise_square()
780 Ok(self) in pointwise_square()
798 fn new(vec: &'a Vector) -> crate::Result<Self> { in new() argument
807 Ok(Self { vec, array }) in new()
813 fn drop(&mut self) { in drop() argument
815 bind_ceed::CeedVectorRestoreArrayRead(self.vec.ptr, &mut self.array); in drop()
823 fn deref(&self) -> &[crate::Scalar] { in deref()
824 unsafe { std::slice::from_raw_parts(self.array, self.vec.len()) } in deref()
830 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt() argument
831 write!(f, "VectorView({:?})", self.deref()) in fmt()
847 fn new(vec: &'a mut Vector) -> crate::Result<Self> { in new() argument
856 Ok(Self { vec, array }) in new()
862 fn drop(&mut self) { in drop() argument
864 bind_ceed::CeedVectorRestoreArray(self.vec.ptr, &mut self.array); in drop()
872 fn deref(&self) -> &[crate::Scalar] { in deref()
873 unsafe { std::slice::from_raw_parts(self.array, self.vec.len()) } in deref()
879 fn deref_mut(&mut self) -> &mut [crate::Scalar] { in deref_mut()
880 unsafe { std::slice::from_raw_parts_mut(self.array, self.vec.len()) } in deref_mut()
886 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt() argument
887 write!(f, "VectorViewMut({:?})", self.deref()) in fmt()