Synopsis

PDX_MSGT mth_UnitizeVector(int ndim, double *a, double *r)

Purpose

Unitize a vector.

Description

The vector a will be unitized and the result stored in r. Both a and r can be the same address. If the magnitude of a is 0, the error MTH_ZERO_MAG will be returned and the contents of a will be copied to r.

Input

ndim

Number of dimensions in vector

a

Vector to be unitized

Output

r

The unitized vector

Return

      MTH_NOERR
      MTH_ZERO_MAG - Magnitude of a was 0.0
      .fi