sc::SCVector(3)

๐Ÿ“ฆ
version 2.3.1 ยท 5 versions
, in ubuntu jammy

๐ŸŒธ sc::SCVector(3) โ€” MPQC ๐ŸŒธ

okay so bestie, you're looking at the manual page for sc::SCVector from MPQC, and it's literally the blueprint for double valued vectors. think of it as the main character energy that all the other vector classes inherit from. no cap, this is important stuff ๐Ÿ’…โœจ


โœจ NAME โœจ

sc::SCVector โ€” the abstract base class for double valued vectors. yeah, it's abstract, so you can't just instantiate it directly, but it's the blueprint that makes everything else work. it's giving foundation, it's giving template, it's giving "i'm the parent and you will respect me" ๐Ÿ‘‘


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

so first, you gotta include the header, like:

#include <abstract.h>

and it inherits from sc::DescribedClass, which is cute. and it's inherited by sc::BlockedSCVector, sc::DistSCVector, sc::LocalSCVector, and sc::ReplSCVector โ€” so those are the actual implementations you'd use. the abstract one is just the vibe check ๐Ÿ’ซ

๐ŸŒˆ Public Member Functions ๐ŸŒˆ

here's the whole group chat of member functions, bestie. every single one, no skips:

  • SCVector (const RefSCDimension &, SCMatrixKit *) โ€” the constructor, duh. takes a RefSCDimension and an SCMatrixKit* and sets up your vector.
  • virtual void save (StateOut &) โ€” save this in an implementation independent way. it's giving "i need to remember myself" ๐Ÿ’พ
  • virtual void restore (StateIn &) โ€” and this one brings it back. the yin to save's yang.
  • Ref< SCMatrixKit > kit () const โ€” returns the SCMatrixKit that was used to create this object. like, where did you come from, king?
  • virtual SCVector * copy () โ€” returns a vector with the same dimension and same elements. a literal clone, but make it fashion ๐Ÿ’–
  • virtual SCVector * clone () โ€” returns a vector with the same dimension but uninitialized memory. so it's shaped the same but empty inside, like my brain before coffee ๐Ÿ˜ญ
  • int n () const โ€” returns the length of the vector. the number of elements, the count, the tea โ˜•
  • virtual double maxabs () const โ€” returns the maximum absolute value element. the biggest vibe in the vector.
  • virtual void normalize () โ€” normalizes this vector. makes it all neat and tidy, slay โœจ
  • virtual void randomize () โ€” assigns each element to a random number between -1 and 1. chaos mode activated ๐Ÿ”ฅ
  • void assign (double val) โ€” assigns all elements of this to val. every single one gets the same value.
  • void assign (const double *v) โ€” assigns element i to v[i] for all i. copy-paste from an array, basically.
  • void assign (SCVector *v) โ€” makes this have the same elements as v. and bestie, the dimensions must match, okay? no funny business ๐Ÿšซ
  • virtual void assign_val (double val) โ€” this is overridden to implement the assign functions. so it's the behind-the-scenes queen.
  • virtual void assign_p (const double *v) โ€” like assign but with a pointer. same energy.
  • virtual void assign_v (SCVector *v) โ€” assign from another vector. the classic.
  • virtual void convert (double *v) const โ€” assigns v[i] to element i for all i. the reverse of assign, kind of.
  • virtual void convert (SCVector *) โ€” converts an SCVector of a different specialization to this specialization and possibly accumulates the data. it's giving "blend in with the crowd" ๐Ÿซถ
  • virtual void convert_accumulate (SCVector *) โ€” same but with accumulation. add it up, bestie.
  • virtual void scale (double val) โ€” multiplies each element by val. glow up for numbers ๐Ÿ’…
  • RefSCDimension dim () const โ€” returns the RefSCDimension corresponding to this vector. the shape, the size, the dimension honey.
  • virtual void set_element (int i, double val)=0 โ€” set element i to val. pure virtual, so you HAVE to implement it in your subclass. no skipping ๐Ÿ’€
  • virtual void accumulate_element (int, double)=0 โ€” add val to element i. also pure virtual. also mandatory.
  • virtual double get_element (int i) const =0 โ€” return the value of element i. you guessed it, pure virtual.
  • void accumulate_product (SymmSCMatrix *m, SCVector *v) โ€” sum the result of m times v into this. math but make it cute ๐Ÿงฎ
  • void accumulate_product (SCMatrix *m, SCVector *v) โ€” same thing but with a regular SCMatrix. got options.
  • virtual void accumulate_product_sv (SymmSCMatrix *m, SCVector *v) โ€” the symm version. sv stands for symm-vector, iykyk.
  • virtual void accumulate_product_rv (SCMatrix *m, SCVector *v)=0 โ€” the regular matrix version, pure virtual. implement it or perish.
  • virtual void accumulate (const SCVector *v)=0 โ€” sum v into this. pure virtual, bestie.
  • virtual void accumulate (const SCMatrix *m)=0 โ€” sum m into this. one of m's dimensions must be 1. important detail! don't forget.
  • virtual double scalar_product (SCVector *)=0 โ€” return the dot product. the classic vector move.
  • virtual void element_op (const Ref< SCElementOp > &)=0 โ€” perform the element operation op on each element of this. element-wise, periodt.
  • virtual void element_op (const Ref< SCElementOp2 > &, SCVector *)=0 โ€” binary element op. two vectors enter, one leaves.
  • virtual void element_op (const Ref< SCElementOp3 > &, SCVector *, SCVector *)=0 โ€” ternary element op. it's a whole party.
  • void print (std::ostream &o=ExEnv::out0()) const โ€” print out the vector. show it off to the world ๐Ÿ–จ๏ธ
  • void print (const char *title=0, std::ostream &out=ExEnv::out0(), int=10) const โ€” print with a title and output stream and an int (probably precision). the deluxe version.
  • virtual void vprint (const char *title=0, std::ostream &out=ExEnv::out0(), int=10) const =0 โ€” the virtual print. pure virtual so subclasses can do their own thing.
  • Ref< MessageGrp > messagegrp () const โ€” returns the message group used by the matrix kit. for all your parallel communication needs ๐Ÿ“ก
  • virtual Ref< SCMatrixSubblockIter > local_blocks (SCMatrixSubblockIter::Access)=0 โ€” returns iterators for the local (rapidly accessible) blocks used in this vector. only one iterator is allowed if it has Accum or Write access. multiple Read iterators are permitted. read the fine print, bestie ๐Ÿ“–
  • virtual Ref< SCMatrixSubblockIter > all_blocks (SCMatrixSubblockIter::Access)=0 โ€” returns iterators for all the blocks used in this vector. the whole collection.

๐Ÿ’œ Protected Attributes ๐Ÿ’œ

  • RefSCDimension d โ€” the dimension, protected. it's lowkey but important.
  • Ref< SCMatrixKit > kit_ โ€” the matrix kit, protected. the behind-the-scenes enabler.

๐ŸŒŸ Additional Inherited Members ๐ŸŒŸ

there are additional inherited members from sc::DescribedClass, but they're not listed here. just know they exist and they're part of the family.


๐ŸŽ€ Detailed Description ๐ŸŽ€

okay so the SCVector class is the abstract base class for double valued vectors. periodt. that's the whole description. it's the foundation, the blueprint, the mother of all double vectors in MPQC. if you want a vector of doubles that does math and stuff, this is where it all begins ๐Ÿ’–


๐Ÿ”ฅ Member Function Documentation ๐Ÿ”ฅ

void sc::SCVector::assign (SCVector * v) [inline]

so this inline function makes this have the same elements as v. but bestie, the dimensions must match. if they don't, it's a no-go. no cap, check your dims before you assign ๐Ÿšจ

virtual Ref<SCMatrixSubblockIter> sc::SCVector::local_blocks (SCMatrixSubblockIter::Access) [pure virtual]

returns iterators for the local (rapidly accessible) blocks used in this vector. and here's the tea: only one iterator is allowed for a matrix if it has Accum or Write access. multiple Read iterators are permitted. so if you're reading, go wild, but if you're writing or accumulating, one at a time, bestie. don't be messy ๐Ÿ’…

this is implemented in sc::BlockedSCVector, sc::ReplSCVector, sc::LocalSCVector, and sc::DistSCVector. so those are the ones that actually do the work.


๐Ÿ‘‘ Author ๐Ÿ‘‘

generated automatically by Doxygen for MPQC from the source code. so you know it's official, bestie. Doxygen is the real MVP for making these docs โœจ


this page was brought to you by version 2.3.1, dated Sun Oct 4 2020 โ€” periodt, it's iconic, it's legendary, it's giving documentation royalty ๐ŸŒˆ๐Ÿ‘‘๐Ÿ’–

๐Ÿ“ฆ where this page comes from