DuQuad  v1.0
Quadratic Programming Optimizations
 All Data Structures Files Functions Variables Typedefs Macros
math_functions.c File Reference
#include "math_functions.h"

Go to the source code of this file.

Functions

void mtx_vec_mul (const real_t *mtx, const real_t *v, real_t *res, const uint32_t rows, const uint32_t cols)
 
void mtx_transpose (const real_t *mtx, real_t *mtx_t, const uint32_t rows, const uint32_t cols)
 
void vector_min (const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
 
void vector_max (const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
 
void vector_sub (const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
 
void vector_add (const real_t *v1, const real_t *v2, real_t *res, const uint32_t length)
 
real_t vector_mul (const real_t *v1, const real_t *v2, const uint32_t length)
 
void vector_scalar_mul (const real_t *v1, const real_t scalar, real_t *res, const uint32_t length)
 
void vector_elements_to_zero (real_t *v, const uint32_t length)
 
uint32_t vector_is_equal (const real_t *v1, const real_t *v2, const uint32_t length)
 
void vector_copy (const real_t *v1, real_t *v2, const uint32_t length)
 
void vector_max_with_zero (real_t *v, const uint32_t length)
 
real_t vector_norm_2 (real_t *v, const uint32_t length)
 
real_t abs_2 (const real_t a)
 
real_t obj (const real_t *z, const real_t *H, const real_t *c, real_t *temp)
 

Function Documentation

real_t abs_2 ( const real_t  a)

return the absolute value of the input

Definition at line 177 of file math_functions.c.

void mtx_transpose ( const real_t mtx,
real_t mtx_t,
const uint32_t  rows,
const uint32_t  cols 
)

Computes the transpose of the matrix: mtx_t = transpose(mtx)

Definition at line 52 of file math_functions.c.

void mtx_vec_mul ( const real_t mtx,
const real_t v,
real_t res,
const uint32_t  rows,
const uint32_t  cols 
)

matrix-vector multiplication: res = mtx * v

Definition at line 23 of file math_functions.c.

real_t obj ( const real_t z,
const real_t H,
const real_t c,
real_t temp 
)

compute the primal objective function

Definition at line 184 of file math_functions.c.

void vector_add ( const real_t v1,
const real_t v2,
real_t res,
const uint32_t  length 
)

vector addition res = v1 + v2

Definition at line 97 of file math_functions.c.

void vector_copy ( const real_t v1,
real_t v2,
const uint32_t  length 
)

copy a vector element by element: v2 = v1

Definition at line 141 of file math_functions.c.

void vector_elements_to_zero ( real_t v,
const uint32_t  length 
)

set all elements in vector v to zero

Definition at line 123 of file math_functions.c.

uint32_t vector_is_equal ( const real_t v1,
const real_t v2,
const uint32_t  length 
)

returns true if all elements in the two vectors are equal

Definition at line 131 of file math_functions.c.

void vector_max ( const real_t v1,
const real_t v2,
real_t res,
const uint32_t  length 
)

compare two vectors element by element, and returns the largest element of the two: res = max(v1,v2)

Definition at line 78 of file math_functions.c.

void vector_max_with_zero ( real_t v,
const uint32_t  length 
)

project a vector on all positive numbers: v = max(v,0.0)

Definition at line 149 of file math_functions.c.

void vector_min ( const real_t v1,
const real_t v2,
real_t res,
const uint32_t  length 
)

compare two vectors element by element, and returns the smallest element of the two: res = min(v1,v2)

Definition at line 67 of file math_functions.c.

real_t vector_mul ( const real_t v1,
const real_t v2,
const uint32_t  length 
)

vector multiplication: res = v1 * v2

Definition at line 105 of file math_functions.c.

real_t vector_norm_2 ( real_t v,
const uint32_t  length 
)

compute the euclidean norm of the vector v

Definition at line 158 of file math_functions.c.

void vector_scalar_mul ( const real_t v1,
const real_t  scalar,
real_t res,
const uint32_t  length 
)

Vector times a scalar: res = v1 * scalar

Definition at line 115 of file math_functions.c.

void vector_sub ( const real_t v1,
const real_t v2,
real_t res,
const uint32_t  length 
)

vector subtract: res = v1 - v2

Definition at line 89 of file math_functions.c.