LinearAlgebra(3) Library Functions Manual LinearAlgebra(3)

# 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¶

Source and destination matrices.
Source and destination vectors.
Array of right-hand-side vectors.
Number of right-hand-side vectors.
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:

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