Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ libmvec(3M) — Sun WorkShop 5.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

atan(3M)

atan2(3M)

clibmvec(3M)

cos(3M)

exp(3M)

hypot(3M)

log(3M)

pow(3M)

sin(3M)

trig_sun(3M)

attributes(5)

libmvec(3M)

NAME

libmvec − vector versions of some elementary mathematical functions

SYNOPSIS

cc [ flag ... ] file ... −lmvec [ library ... ]

or

cc [ flag ... ] file ... −lmvec_mt [ library ... ]
 

void vatan_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey);

void vatan2_(int ∗n, double ∗y, int ∗stridey, double ∗x, int ∗stridex, double ∗z, int ∗stridez);

void vcos_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey);

void vexp_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey);

void vhypot_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey, double ∗z, int ∗stridez);

void vlog_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey);

void vpow_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey, double ∗z, int ∗stridez);

void vsin_(int ∗n, double ∗x, int ∗stridex, double ∗y, int ∗stridey);

void vsincos_(int ∗n, double ∗x, int ∗stridex, double ∗s, int ∗strides, double ∗c, int ∗stridec);

void vatanf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey);

void vatan2f_(int ∗n, float ∗y, int ∗stridey, float ∗x, int ∗stridex, float ∗z, int ∗stridez);

void vcosf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey);

void vexpf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey);

void vhypotf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey, float ∗z, int ∗stridez);

void vlogf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey);

void vpowf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey, float ∗z, int ∗stridez);

void vsinf_(int ∗n, float ∗x, int ∗stridex, float ∗y, int ∗stridey);

void vsincosf_(int ∗n, float ∗x, int ∗stridex, float ∗s, int ∗strides, float ∗c, int ∗stridec);

DESCRIPTION

Each function of the form vfunc evaluates the corresponding elementary function func(x) for each element of the vector x.  The number of elements computed is n, and the results are stored in the y vector.  For functions of two arguments, the results are stored in the z vector.  Stridex, stridey, and stridez are the distances between successive elements of the x, y, and z vectors respectively, and allow the vector functions to operate on elements which are not contiguous in memory. 

vatan_(n, x , stridex, y, stridey) computes atan(x). 

vatan2_(n, y , stridey, x, stridex, z, stridez) computes atan2(y,x). 

vcos_(n, x , stridex, y, stridey) computes cos(x). 

vexp_(n, x , stridex, y, stridey) computes exp(x). 

vhypot_(n, x , stridex, y, stridey, z, stridez) computes hypot(x,y). 

vlog_(n, x , stridex, y, stridey) computes log(x). 

vpow_(n, x , stridex, y, stridey, z, stridez) computes pow(x,y). 

vsin_(n, x , stridex, y, stridey) computes sin(x). 

vsincos_(n, x , stridex, s, strides, c, stridec) returns sin in the s array, cos in the c array. 

The functions vatanf_(), vatan2f_(), vcosf_(), vexpf_(), vhypotf_(), vlogf_(), vpowf_(), vsinf_(), and vsincosf_() are single precision versions of the double precision functions listed above.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Availability SPROlang
MT-Level MT-Safe

SEE ALSO

atan(3M), atan2(3M), clibmvec(3M), cos(3M), exp(3M), hypot(3M), log(3M), pow(3M), sin(3M), trig_sun(3M), attributes(5)

DIAGNOSTICS

The vector functions treat exceptional cases in the spirit of IEEE754, producing the same results as the corresponding scalar functions do when the −xlibmieee cc compilation option is used.  See the corresponding man page for the scalar functions for the behavior on exceptional cases.  Also, some functions may raise the inexact exception even if all elements of x are such that all elements of y are exact. 

NOTES

The vector functions listed above are provided in each of two libraries, libmvec.a and libmvec_mt.a.  The latter contains parallelized versions of the functions that work in conjunction with the automatic parallelization provided by the compiler.  To use libmvec_mt.a, you must link with one of the parallelization options -xparallel, -xexplicitpar, or -xautopar. 

In vector and parallel execution, elements need not be evaluated in the order x[0], x[1∗stridex], x[2∗stridex], etc.  Therefore, exceptions that occur may not be raised in order.  For example, if argument x[1] would raise the overflow exception, and x[9] would raise the invalid exception, there is no guarantee that the overflow will be raised first. 

The strides for the argument arrays may be positive or negative integers, but must not be zero.  The argument arrays  must not be the same or overlap.  For example, vexp(n,x,1,x,1) leads to unpredictable results.  Finally, the element count n must be greater than zero. 

SunOS 5.0  —  Last change: 06/27/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026