vec.h: (Matching .c file)


/* vec.h - Routines to handle vectors.
 * © Copyright 1999 by John Halleck
 * All rights reserved.
 */
/* Version of August 18th, 1999 */

#ifndef VEC 
#define VEC 1

#include "errors.h"
 /* We return package standard error codes. */

/* What does a matrix look like? */
typedef double vector[];

/* --------------   Routines    ---------------------------- */
/* Note that input and output vectors CAN be the same.
 * So you can scale a vector with: vecscl (6, A, A, scale)
 *
 * All routines in this package can return
 * ERRnil  - You can't pass a nil pointer for a vector.
 * ERRsize - You have to have a positive size for a vector.
 * 
 * In addition, vecscl  and vecadds can return
 * ERRmeaning - Scaling by zero is not meaningful.
 *    (Although they will do the scale anyway)
 */


/* Set a vector to zeros. */
extern error veczero (int size, vector result);

/* Copy */
   /* regular */
extern error veccpy (int size, vector result, vector source);
   /* Swap */
extern error vecswp (int size, vector result, vector source);

/* Scale a vector */
extern error vecscl (int size, vector result, vector given, double scalar);
/* Scale factor must be non-zero.  (ERRmeaning) */

/* Add vectors */
    /* regular */
extern error vecadd (int size, vector result, vector A, vector B);
extern error vecsub (int size, vector result, vector A, vector B);
    /* scaled */
extern error vecadds(int size, vector result, vector A, vector B, double scale);

/* Dot product */
extern error vecdot (int size, double *result, vector A, vector B);

#endif
/* ========================================================================== */

Go to ...


This page is http://www.cc.utah.edu/~nahaj/cave/survey/code/c/vec.h.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 23rd, 2000
And the underlying file was last modified on May 11th, 2000