EllAlgo 1.6.13
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Vector0 Class Reference

A simple vector class for conjugate gradient calculations. More...

#include <conjugate_gradient.hpp>

Public Member Functions

 Vector0 (size_t size)
 Construct a new Vector0 object with given size.
 
 Vector0 (const std::vector< double > &v)
 Construct a new Vector0 from a std::vector.
 
doubleoperator[] (size_t i)
 Access element at index i.
 
const doubleoperator[] (size_t i) const
 Access element at index i (const version)
 
size_t size () const
 Get the size of the vector.
 
Vector0operator+= (const Vector0 &rhs)
 Add another vector to this vector.
 
Vector0operator-= (const Vector0 &rhs)
 Subtract another vector from this vector.
 
Vector0operator*= (double scalar)
 Multiply this vector by a scalar.
 
double dot (const Vector0 &other) const
 Compute the dot product with another vector.
 
double norm () const
 Compute the L2 norm of the vector.
 

Detailed Description

A simple vector class for conjugate gradient calculations.

This class provides basic vector operations needed for the conjugate gradient method, including addition, subtraction, scalar multiplication, dot product, and norm calculation.

Constructor & Destructor Documentation

◆ Vector0() [1/2]

Vector0::Vector0 ( size_t  size)
inline

Construct a new Vector0 object with given size.

Parameters
[in]sizeThe size of the vector

◆ Vector0() [2/2]

Vector0::Vector0 ( const std::vector< double > &  v)
inline

Construct a new Vector0 from a std::vector.

Parameters
[in]vThe std::vector to copy from

Member Function Documentation

◆ dot()

double Vector0::dot ( const Vector0 other) const
inline

Compute the dot product with another vector.

Parameters
[in]otherThe other vector
Returns
The dot product result

◆ norm()

double Vector0::norm ( ) const
inline

Compute the L2 norm of the vector.

Returns
The L2 norm (Euclidean length)

◆ operator*=()

Vector0 & Vector0::operator*= ( double  scalar)
inline

Multiply this vector by a scalar.

Parameters
[in]scalarThe scalar value to multiply
Returns
Reference to this vector after multiplication

◆ operator+=()

Vector0 & Vector0::operator+= ( const Vector0 rhs)
inline

Add another vector to this vector.

Parameters
[in]rhsThe vector to add
Returns
Reference to this vector after addition

◆ operator-=()

Vector0 & Vector0::operator-= ( const Vector0 rhs)
inline

Subtract another vector from this vector.

Parameters
[in]rhsThe vector to subtract
Returns
Reference to this vector after subtraction

◆ operator[]() [1/2]

double & Vector0::operator[] ( size_t  i)
inline

Access element at index i.

Parameters
[in]iIndex of the element
Returns
Reference to the element

◆ operator[]() [2/2]

const double & Vector0::operator[] ( size_t  i) const
inline

Access element at index i (const version)

Parameters
[in]iIndex of the element
Returns
Const reference to the element

◆ size()

size_t Vector0::size ( ) const
inline

Get the size of the vector.

Returns
Size of the vector

The documentation for this class was generated from the following file: