Public Member Functions | Friends | List of all members
fVec Class Reference

Vector of generic size. More...

#include <fMatrix.h>

Inheritance diagram for fVec:
Inheritance graph
[legend]

Public Member Functions

void abs ()
 Converts all elements to their absolute values. More...
 
 fVec ()
 
 fVec (int m, double *ini=0)
 
 fVec (int m, double ini)
 
 fVec (const fVec &ini)
 
void get_subvec (int start, const fVec &allV)
 Copy a sub-vector of a larger vector. More...
 
double length () const
 Length of the vector. More...
 
int lineq (const fMat &A, const fVec &b)
 Solves linear equation Ax = b. More...
 
int lineq_porfs (const fMat &A, const fVec &b)
 
int lineq_posv (const fMat &A, const fVec &b)
 
int lineq_sr (const fMat &A, fVec &w_err, fVec &w_norm, double k, const fVec &b)
 
int lineq_svd (const fMat &A, const fVec &b, int lwork=-1)
 
int max_index ()
 Returns the index of the largest element. More...
 
double max_value ()
 Returns the maximum value. More...
 
int min_index ()
 Returns the index of the smallest element. More...
 
double min_value ()
 Returns the minimum value. More...
 
double & operator() (int i)
 Returns the reference to the i-th element. More...
 
double operator() (int i) const
 Returns the value of the i-th element. More...
 
void operator= (double d)
 Assignment operations. More...
 
fVec operator= (const fVec &vec)
 
void resize (int i)
 Change the size. More...
 
void set (double *_d)
 Sets all elements. More...
 
void set_subvec (int start, const fVec &subV)
 Copy a smaller vector as a sub-vector. More...
 
int size () const
 Size of the vector (same as row()). More...
 
double sum ()
 Returns the sum of the elements. More...
 
void unit ()
 Converts to a unit vector (no length check!). More...
 
void zero ()
 Creates a zero vector. More...
 
 ~fVec ()
 
Functions

Operators in function forms (faster).

void set (const fVec &vec)
 
void neg (const fVec &vec)
 
void add (const fVec &vec1, const fVec &vec2)
 
void add (const fVec &vec)
 
void sub (const fVec &vec1, const fVec &vec2)
 
void div (const fVec &vec, double d)
 
void mul (const fVec &vec, double d)
 
void mul (double d, const fVec &vec)
 
void mul (const fMat &mat, const fVec &vec)
 M * v. More...
 
void mul (const fVec &vec, const fMat &mat)
 v^T * M More...
 
- Public Member Functions inherited from fMat
int col () const
 Returns the number of columns. More...
 
double * data () const
 Returns the pointer to the first element. More...
 
void ddiv (const fMat &mat1, const fMat &mat2)
 Element-wise division: ./ operator in MATLAB. More...
 
double det (void)
 Computes the determinant. More...
 
void dmul (const fMat &mat1, const fMat &mat2)
 Element-wise multiplication: .* operator in MATLAB. More...
 
int eig (fVec &wr, fVec &wi)
 Computes the eigenvalues. More...
 
int eig (fVec &wr, fVec &wi, fMat &v)
 Computes the eigenvalues and eigenvectors. More...
 
int eig (fVec &wr, fVec &wi, fMat &vr, fMat &vi)
 Computes the eigenvalues and eigenvectors. More...
 
 fMat ()
 Default constructor. More...
 
 fMat (int m, int n, double *ini=0)
 Constructor with size and initial values (optional). More...
 
 fMat (int m, int n, double ini)
 Constructor with size and common initial values. More...
 
 fMat (const fMat &ini)
 Copy constructor. More...
 
 fMat (const fVec &ini)
 Constructor from a vector. More...
 
void get_submat (int row_start, int col_start, const fMat &allM)
 Extract a sub-matrix and set to myself. More...
 
void identity ()
 Creates an identity matrix (only for square matrices). More...
 
int info ()
 Returns the value of m_info. More...
 
int inv_porfs (const fMat &)
 inverse of positive-definite, symmetric matrix More...
 
int inv_posv (const fMat &)
 inverse of positive-definite, symmetric matrix More...
 
int lineq_porfs (const fMat &A, const fMat &b)
 solve linear equation Ax = b, where A is positive-definite, symmetric More...
 
int lineq_posv (const fMat &A, const fMat &b)
 solve linear equation Ax = b, where A is positive-definite, symmetric More...
 
 operator double * ()
 Converts to an array of double. More...
 
double & operator() (int i, int j)
 Returns the (non-constant) reference to the (i,j) element. More...
 
double operator() (int i, int j) const
 Returns the value of the (i,j) element. More...
 
fMat operator= (const fMat &mat)
 Assignment from a reference matrix. More...
 
void operator= (double d)
 Assigns the same value to all elements. More...
 
int resize (int i, int j)
 Changes the matrix size. More...
 
int row () const
 Returns the number of rows. More...
 
void set (double *_d)
 Sets the values from an array. More...
 
void set_submat (int row_start, int col_start, const fMat &subM)
 Sets a sub-matrix of myself. More...
 
void setinfo (int _info)
 Sets m_info. More...
 
int svd (fMat &U, fVec &Sigma, fMat &VT)
 singular value decomposition More...
 
void symmetric (char t= 'U')
 Change to symmetric matrix. More...
 
void tran (const fMat &mat)
 Sets the transpose of a matrix. More...
 
void tran ()
 Transposes a matrix (only for square matrices). More...
 
void zero ()
 Creates a zero matrix. More...
 
 ~fMat ()
 Destructor. More...
 
void set (const fMat &mat)
 
void neg (const fMat &mat)
 
void add (const fMat &mat1, const fMat &mat2)
 
void add (const fMat &mat)
 
void sub (const fMat &mat1, const fMat &mat2)
 
void mul (const fMat &mat1, const fMat &mat2)
 
void mul (double d, const fMat &mat)
 
void mul (const fMat &mat, double d)
 
void mul_tran (const fMat &mat1, int trans_first)
 
void div (const fMat &mat, double d)
 
int inv (const fMat &)
 inverse More...
 
int p_inv (const fMat &)
 pseudo inverse More...
 
int sr_inv (const fMat &mat, fVec &w_err, fVec &w_norm, double k)
 singularity-robust (SR) inverse More...
 
int lineq (const fMat &A, const fMat &b)
 solve linear equation Ax = b More...
 
int lineq_sr (const fMat &A, fVec &w_err, fVec &w_norm, double k, const fMat &b)
 solve linear equation Ax = b using SR-inverse More...
 
int inv_svd (const fMat &, int lwork=-1)
 inverse More...
 
int p_inv_svd (const fMat &, int lwork=-1)
 pseudo inverse More...
 
int sr_inv_svd (const fMat &mat, fVec &w_err, fVec &w_norm, double k, int lwork=-1)
 SR-inverse. More...
 
int lineq_svd (const fMat &A, const fMat &b, int lwork=-1)
 solve linear equation Ax = b More...
 
void operator+= (const fMat &mat)
 
void operator-= (const fMat &mat)
 
void operator*= (double d)
 
void operator/= (double d)
 

Friends

double length (const fVec &v)
 Length of the vector. More...
 
fVec unit (const fVec &v)
 Returns a unit vector with the same direction (no length check!). More...
 

Operators

Operators

void operator+= (const fVec &vec)
 
void operator-= (const fVec &vec)
 
void operator*= (double d)
 
void operator/= (double d)
 
fVec operator- (const fVec &vec)
 
fVec operator+ (const fVec &vec1, const fVec &vec2)
 
fVec operator- (const fVec &vec1, const fVec &vec2)
 
fVec operator/ (const fVec &vec, double d)
 
fVec operator* (double d, const fVec &vec)
 
fVec operator* (const fVec &vec, double d)
 
double operator* (const fVec &vec1, const fVec &vec2)
 

Additional Inherited Members

- Protected Attributes inherited from fMat
int m_info
 
int n_col
 
int n_row
 
double * p_data
 
double temp
 

Detailed Description

Vector of generic size.

Definition at line 491 of file fMatrix.h.

Constructor & Destructor Documentation

fVec::fVec ( )
inline

Definition at line 495 of file fMatrix.h.

fVec::fVec ( int  m,
double *  ini = 0 
)
inline

Definition at line 497 of file fMatrix.h.

fVec::fVec ( int  m,
double  ini 
)
inline

Definition at line 499 of file fMatrix.h.

fVec::fVec ( const fVec ini)
inline

Definition at line 501 of file fMatrix.h.

fVec::~fVec ( )
inline

Definition at line 503 of file fMatrix.h.

Member Function Documentation

void fVec::abs ( )

Converts all elements to their absolute values.

Definition at line 1510 of file fMatrix.cpp.

void fVec::add ( const fVec vec1,
const fVec vec2 
)

Definition at line 1562 of file fMatrix.cpp.

void fVec::add ( const fVec vec)

Definition at line 1568 of file fMatrix.cpp.

void fVec::div ( const fVec vec,
double  d 
)

Definition at line 1599 of file fMatrix.cpp.

void fVec::get_subvec ( int  start,
const fVec allV 
)

Copy a sub-vector of a larger vector.

Definition at line 65 of file fMatrix.cpp.

double fVec::length ( void  ) const
inline

Length of the vector.

Definition at line 553 of file fMatrix.h.

int fVec::lineq ( const fMat A,
const fVec b 
)

Solves linear equation Ax = b.

Definition at line 163 of file fMatrix.cpp.

int fVec::lineq_porfs ( const fMat A,
const fVec b 
)

Definition at line 788 of file fMatrix.cpp.

int fVec::lineq_posv ( const fMat A,
const fVec b 
)

Definition at line 765 of file fMatrix.cpp.

int fVec::lineq_sr ( const fMat A,
fVec w_err,
fVec w_norm,
double  k,
const fVec b 
)

Definition at line 869 of file fMatrix.cpp.

int fVec::lineq_svd ( const fMat A,
const fVec b,
int  lwork = -1 
)

Definition at line 468 of file fMatrix.cpp.

int fVec::max_index ( )

Returns the index of the largest element.

fVec

Definition at line 1446 of file fMatrix.cpp.

double fVec::max_value ( )

Returns the maximum value.

Definition at line 1478 of file fMatrix.cpp.

int fVec::min_index ( )

Returns the index of the smallest element.

Definition at line 1462 of file fMatrix.cpp.

double fVec::min_value ( )

Returns the minimum value.

Definition at line 1494 of file fMatrix.cpp.

void fVec::mul ( const fVec vec,
double  d 
)

Definition at line 1620 of file fMatrix.cpp.

void fVec::mul ( double  d,
const fVec vec 
)

Definition at line 1626 of file fMatrix.cpp.

void fVec::mul ( const fMat mat,
const fVec vec 
)

M * v.

Definition at line 1380 of file fMatrix.cpp.

void fVec::mul ( const fVec vec,
const fMat mat 
)

v^T * M

Definition at line 1401 of file fMatrix.cpp.

void fVec::neg ( const fVec vec)

Definition at line 1524 of file fMatrix.cpp.

double& fVec::operator() ( int  i)
inline

Returns the reference to the i-th element.

Definition at line 538 of file fMatrix.h.

double fVec::operator() ( int  i) const
inline

Returns the value of the i-th element.

Definition at line 543 of file fMatrix.h.

void fVec::operator*= ( double  d)

Definition at line 1552 of file fMatrix.cpp.

void fVec::operator+= ( const fVec vec)

Definition at line 1539 of file fMatrix.cpp.

void fVec::operator-= ( const fVec vec)

Definition at line 1546 of file fMatrix.cpp.

void fVec::operator/= ( double  d)

Definition at line 1557 of file fMatrix.cpp.

void fVec::operator= ( double  d)

Assignment operations.

Definition at line 1646 of file fMatrix.cpp.

fVec fVec::operator= ( const fVec vec)

Definition at line 1651 of file fMatrix.cpp.

void fVec::resize ( int  i)
inline

Change the size.

Definition at line 511 of file fMatrix.h.

void fVec::set ( double *  _d)
inline

Sets all elements.

Definition at line 533 of file fMatrix.h.

void fVec::set ( const fVec vec)

Definition at line 1518 of file fMatrix.cpp.

void fVec::set_subvec ( int  start,
const fVec subV 
)

Copy a smaller vector as a sub-vector.

Definition at line 76 of file fMatrix.cpp.

int fVec::size ( void  ) const
inline

Size of the vector (same as row()).

Definition at line 507 of file fMatrix.h.

void fVec::sub ( const fVec vec1,
const fVec vec2 
)

Definition at line 1583 of file fMatrix.cpp.

double fVec::sum ( )
inline

Returns the sum of the elements.

Definition at line 569 of file fMatrix.h.

void fVec::unit ( )
inline

Converts to a unit vector (no length check!).

Definition at line 564 of file fMatrix.h.

void fVec::zero ( )
inline

Creates a zero vector.

Definition at line 575 of file fMatrix.h.

Friends And Related Function Documentation

double length ( const fVec v)
friend

Length of the vector.

Definition at line 549 of file fMatrix.h.

fVec operator* ( double  d,
const fVec vec 
)
friend

Definition at line 1632 of file fMatrix.cpp.

fVec operator* ( const fVec vec,
double  d 
)
friend

Definition at line 1639 of file fMatrix.cpp.

double operator* ( const fVec vec1,
const fVec vec2 
)
friend

Definition at line 1612 of file fMatrix.cpp.

fVec operator+ ( const fVec vec1,
const fVec vec2 
)
friend

Definition at line 1574 of file fMatrix.cpp.

fVec operator- ( const fVec vec)
friend

Definition at line 1531 of file fMatrix.cpp.

fVec operator- ( const fVec vec1,
const fVec vec2 
)
friend

Definition at line 1590 of file fMatrix.cpp.

fVec operator/ ( const fVec vec,
double  d 
)
friend

Definition at line 1605 of file fMatrix.cpp.

fVec unit ( const fVec v)
friend

Returns a unit vector with the same direction (no length check!).

Definition at line 557 of file fMatrix.h.


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


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:43