---
name: "LinAlgebra"
section: "3"
platform: "linux"
package: "libvolpack1-dev"
version: "1.0b3-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/LinAlgebra"
---

# LinAlgebra(3)

linear algebra routines

## NAME

vpIdentity3, vpIdentity4, vpNormalize3, vpMatrixVectorMult4, vpMatrixMult4, vpCrossProduct, vpSolveSystem4, vpSetVector3, vpSetVector4 - linear algebra routines

## SYNOPSIS

\#include \<volpack.h\>

void

**vpIdentity3(***m\_dst***)**

-

  vpMatrix3 *m\_dst;*

void

**vpIdentity4(***m\_dst***)**

-

  vpMatrix4 *m\_dst;*

vpResult

**vpNormalize3(***v\_src1***)**

-

  vpVector3 *v\_src1;*

void

**vpMatrixVectorMult4(***v\_dst, m\_src1, v\_src1***)**

-

  vpVector4 *v\_dst;*

-

  vpMatrix4 *m\_src1;*

-

  vpVector4 *v\_src1;*

void

**vpMatrixMult4(***m\_dst, m\_src1, m\_src2***)**

-

  vpVector4 *m\_dst, m\_src1, m\_src2;*

void

**vpCrossProduct(***v\_dst, v\_src1, v\_src2***)**

-

  vpVector3 *v\_dst, v\_src1, v\_src2;*

vpResult

**vpSolveSystem4(***m\_src1, b, count***)**

-

  vpMatrix4 *m\_src1;*

-

  vpVector4 *b\[\];*

-

  int *count;*

void

**vpSetVector3(***v\_dst, x, y, z***)**

-

  vpVector3 *v\_dst;*

-

  double *x, y, z;*

void

**vpSetVector4(***v\_dst, x, y, z, w***)**

-

  vpVector4 *v\_dst;*

-

  double *x, y, z, w;*

## ARGUMENTS

- *m\_src1, m\_src2, m\_dst*

  Source and destination matrices.

- *v\_src1, v\_src2, v\_dst*

  Source and destination vectors.

- *b*

  Array of right-hand-side vectors.

- *count*

  Number of right-hand-side vectors.

- *x, y, z, w*

  Vector components.

## DESCRIPTION

These routines form a simple linear algebra package used internally by VolPack.  The routines are also available as utility routines for use by the application.

**vpIdentity3** assigns the identity matrix to a 3-by-3 matrix.

**vpIdentity4** assigns the identity matrix to a 4-by-4 matrix.

**vpNormalize3** normalizes a 3-element vector (so the magnitude is 1.0).  The result overwrites the source vector.

**vpMatrixVectorMult4** multiplies a 4-by-4 matrix by a 4-element column vector and stores the result in the destination vector *(v\_dst = m . v\_src)*.

**vpMatrixMult4** multiplies two 4-by-4 matrices and stores the result in the destination matrix *(m\_dst = m\_src1 . m\_src2)*.

**vpCrossProduct** computes the cross product of two 3-element vectors and stores the result in the destination vector *(v\_dst =* *v\_src1 x v\_src2)*.

**vpSolveSystem4** solves the linear system *m . x = b* for each right-hand-side vector in the *b* array.  The solution vectors overwrite the vectors in the *b* array.  The solution is computed using Gauss-Jordan elimination with partial pivoting and implicit scaling.

**vpSetVector3** initializes the components of a 3-element vector *(v\_dst = \[x, y, z\]).*  It is a macro.

**vpSetVector4** initializes the components of a 4-element vector *(v\_dst = \[x, y, z, w\]).*  It is a macro.

## ERRORS

**vpNormalize3** and **vpSolveSystem4** normally return VP\_OK. The following error return value is possible:

- VPERROR\_SINGULAR

  The vector is a 0 vector (**vpNormalize3** only), or the matrix is singular (**vpSolveSystem4** only).

## SEE ALSO

[VolPack(3)](/VolPack/3.md)
