S2kit  1.1
Toolkit for working with functions defined on the sphere
vector_funcs.c File Reference

Vector arithmetic operations. More...

#include "vector_funcs.h"

Go to the source code of this file.

Functions

void vec_add (double *v1, double *v2, double *result, const int len)
 Adds two vectors into a third one. More...
 
void vec_mul (const double scalar, double *v, double *result, const int len)
 Multiplies the vector v by scalar. More...
 
void vec_dot (double *v1, double *v2, double *result, const int len)
 Performs dot product of v1 and v2. More...
 

Detailed Description

Vector arithmetic operations.

Definition in file vector_funcs.c.

Function Documentation

◆ vec_add()

void vec_add ( double *  v1,
double *  v2,
double *  result,
const int  len 
)

Adds two vectors into a third one.

result = v1 + v2

Parameters
v1first vector
v2second vector
resultresult vector
lenlength of all vectors

Definition at line 18 of file vector_funcs.c.

◆ vec_dot()

void vec_dot ( double *  v1,
double *  v2,
double *  result,
const int  len 
)

Performs dot product of v1 and v2.

result = v1 * v2

Parameters
v1first vector
v2second vector
resultresult vector
lenlength of all vectors

Definition at line 53 of file vector_funcs.c.

◆ vec_mul()

void vec_mul ( const double  scalar,
double *  v,
double *  result,
const int  len 
)

Multiplies the vector v by scalar.

result = scalar * v

Parameters
scalarscalar
vvector
resultresult vector
lenlength of both vectors

Definition at line 33 of file vector_funcs.c.