Woolz Image Processing  Version 1.8.3
AlgVectorMath.c File Reference

Basic vector arithmatic. More...

Functions

void AlgVectorZero (double *aV, size_t n)
 sets all elements of the given vector to zero. More...
 
double AlgVectorNorm (double *aV, size_t n)
 Computes the norm of the given vector \(\mathbf{a}\) with n elements:

\[ \|\mathbf{a}\| = \sqrt{\mathbf{a} \cdot \mathbf{a}}. \]

. More...

 
double AlgVectorDot (double *aV, double *bV, size_t n)
 Computes the scalar (dot) product of the two vectors \(\mathbf{a}\) and \(\mathbf{b}\) each with n elements:

\[ \mathbf{a} \cdot \mathbf{b} = \sum_{i = 0}^{n - 1}{a_i b_i} \]

. More...

 
void AlgVectorAdd (double *aV, double *bV, double *cV, size_t n)
 Adds vector \(\mathbf{b}\) to vector \(\mathbf{c}\). Computes \(a_i = b_i + c_i, \forall i \in [0 \ldots n - 1]\). More...
 
void AlgVectorSub (double *aV, double *bV, double *cV, size_t n)
 Subtracts vector \(\mathbf{c}\) from vector \(\mathbf{b}\). Computes \(a_i = b_i - c_i, \forall i \in [0 \ldots n - 1]\). More...
 
void AlgVectorCopy (double *aV, double *bV, size_t n)
 Copies one vector \(\mathbf{b}\) to vector \(\mathbf{a}\). \(a_i = b_i, \forall i \in [0 \ldots n - 1]\). More...
 
void AlgVectorScale (double *aV, double *bV, double s, size_t n)
 Scales a vector \(\mathbf{b}\). Computes \(a_i = b_i s, \forall i \in [0\ldots n - 1]\). More...
 
void AlgVectorScaleAdd (double *aV, double *bV, double *cV, double s, size_t n)
 Scales a vector \(\mathbf{b}\) and then adds vector \(\mathbf{c}\). Computes \(a_i = b_i s + c_i, \forall i \in [0\ldots n - 1]\). More...
 

Detailed Description

Basic vector arithmatic.

Author
Bill Hill
Date
March 2003
Version
Id
814826980b2ebe51ef68b935666c3c39d7beff3f
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Function Documentation

◆ AlgVectorScale()

void AlgVectorScale ( double *  aV,
double *  bV,
double  s,
size_t  n 
)

Scales a vector \(\mathbf{b}\). Computes \(a_i = b_i s, \forall i \in [0\ldots n - 1]\).

Returns
Note
For efficiency the given parameters are not checked.
Vector size is limited only by address space.
Parameters
aVVector \(\mathbf{a}\).
bVVector \(\mathbf{b}\).
sScalar scale \(s\).
nNumber of elements in each of the vectors.

Referenced by AlgMatrixScale(), and AlgMatrixSolveLSQR().

◆ AlgVectorScaleAdd()

void AlgVectorScaleAdd ( double *  aV,
double *  bV,
double *  cV,
double  s,
size_t  n 
)

Scales a vector \(\mathbf{b}\) and then adds vector \(\mathbf{c}\). Computes \(a_i = b_i s + c_i, \forall i \in [0\ldots n - 1]\).

Returns
Note
For efficiency the given parameters are not checked.
Vector size is limited only by address space.
Parameters
aVVector \(\mathbf{a}\).
bVVector \(\mathbf{b}\).
cVVector \(\mathbf{c}\).
sScalar scale \(s\).
nNumber of elements in each of the vectors.

Referenced by AlgMatrixCGSolve().