Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

vecLib Framework Reference

Framework
vecLib
Declared in
vBasicOps.h
vBigNum.h
vForce.h
vecLibTypes.h
vectorOps.h
vfp.h

Overview

The vecLib framework contains nine C header files (not counting vecLib.h which merely includes the others). Two of them, vDSP.h and vDSP_translate.h, are covered in vDSP Library.

Three of the header files are Apple’s versions of well-known libraries which are described in detail in external references:

This document describes the functions declared in the remaining header files: vecLibTypes.h, vfp.h, vForce.h, vBasicOps.h, vectorOps.h, and vBigNum.h.

These files support the vector mathematical functions library (also called “vMathLib”), which runs on vector processing hardware (Altivec or SSE3) if available. This library abstracts the vector processing capability so that code written for it will execute appropriate instructions for the processor available at runtime.

vecLibTypes.h

The vecLibTypes.h header file defines a set of vector data types (vFloat, vUInt32, etc.), which represent 128-bit vectors containing values of type float, UInt32, etc. The vBasicOps.h and vfp.h headers make use of these types.

The type names all begin with the letter “v,” followed by a mnemonic for the scalar data type used for elements of the vector. For example, vUInt32, vSInt16, vFloat, etc.

vBasicOps.h

vBasicOps.h declares a set of basic arithmetic and logical functions on 128-bit vectors, using the integer types from vecLibTypes.h.

The function names begin with “v,” followed by a mnemonic for the type of operation, e.g. “S” or “U” for signed or unsigned, then the width of the operation, then the name of the operation. For example, vS8Divide performs division of signed 8-bit values packed into 128-bit vectors.

vfp.h

vBasicOps.h declares a set of floating-point arithmetic, transcendental and trigonometric functions, on 128-bit vectors, using the floating-point types from vecLibTypes.h.

These functions are named with their customary mathematical names, prefixed with the letter “v”, and all except vtablelookup() have the suffix “f” to indicate that they work with single-precision floating-point data. For example, vcosf is the single-precision cosine function.

vForce.h

vForce.h declares a set of trigonometric and transcendental functions in terms of C arrays (double * or float *), which can be of any desired length. Internally, the C arrays are converted piecewise into collections of 128-bit vectors, if appropriate for the current architecture.

The functions declared in vForce.h are named with the customary mathematical names, but with the prefix “vv.” Each mathematical function is available in two variants: one for single-precision floating-point data and one for double-precision data. The single-precision forms have the suffix “f”, while the double-precision forms have no suffix. For example, vvcosf is the single-precision cosine function, while vvcos is the double-precision variant.

All of the vForce.h functions follow a common format:

vectorOps.h

vectorOps.h declares a set of vector and matrix BLAS functions on arrays of 128-bit vectors containing single-precision floating-point values. The arrays can be of any desired length, but the number of float elements must be a multiple of 4.

vBigNum.h

vBigNum.h provides arithmetic and logical operations on large integers, which may be 128, 256, 512, or 1024 bits in length. It defines types for these values, and internally processes them as collections of 128-bit vectors.

vBigNum.h defines its own set of data types to represent large integer quantities, such as vS128 for a signed, 128-bit integer or vU1024 for an unsigned, 1025-bit integer. The function names begin with the data type name, followed by the name of the operation. For example, vS512Add performs addition of two 128-bit signed integers.

The functions perform logical and arithmetic operations on scalar values that may be 128, 256, 512, or 1024 bits in width. These values are implemented as structures of one, two, four, or eight 128-bit vectors, and the operations execute on the available vector-processing hardware if possible.

The functions have names that are compatible with those in vBasicOps.h.

For More Information

For information about membership in Apple’s developer program, go to this URL:

http://developer.apple.com/membership/

For information about the Velocity Engine, go to this URL:

http://developer.apple.com/hardwaredrivers/ve/index.html

For general technical support from Apple, go to this URL:

http://developer.apple.com/technicalsupport/index.html

Functions by Task

Shift and Rotate Functions (from vBasicOps.h)

Integer Arithmetic Functions (from vBasicOps.h)

Floating-Point Arithmetic and Auxiliary Functions (from vfp.h)

Exponential and Logarithmic Functions (from vfp.h)

Trigonometric Functions (from vfp.h)

Hyperbolic Functions (from vfp.h)

Power Functions (from vfp.h)

Remainder Functions (from vfp.h)

Inquiry Functions (from vfp.h)

Array-Oriented Arithmetic and Auxiliary Functions (from vForce.h)

Array-Oriented Exponential and Logarithmic Functions (from vForce.h)

Array-Oriented Power Functions (from vForce.h)

Array-Oriented Trigonometric Functions (from vForce.h)

Array-Oriented Hyperbolic Functions (from vForce.h)

Shift and Rotate Functions on Big Numbers (from vBigNum.h)

Arithmetic Functions on Big Numbers (from vBigNum.h)

Vector-Scalar Linear Algebra Functions (from vectorOps.h)

Matrix-Vector Linear Algebra Functions (from vectorOps.h)

Matrix Operations (from vectorOps.h)

Functions

vA1024Shift

1024-bit arithmetic shift.

extern void vA1024Shift(
   const vS1024 * a,
   UInt32 shiftAmount,
   vS1024 * result);

Availability
Declared In
vBigNum.h

vA128Shift

128-bit arithmetic shift.

extern vUInt32 vA128Shift(vUInt32 vA, vUInt8 vShiftFactor);

Availability
Declared In
vBasicOps.h

vA256Shift

256-bit arithmetic shift.

extern void vA256Shift(
   const vS256 * a,
   UInt32 shiftAmount,
   vS256 * result);

Availability
Declared In
vBigNum.h