DuQuad
v1.0
Quadratic Programming Optimizations
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
general_functions.c
Go to the documentation of this file.
1
/*
2
* general_functions.c
3
*
4
* Created on: Oct 4, 2014
5
* Author: sverre
6
*/
7
8
#include "
general_functions.h
"
9
10
real_t
*
vector_alloc
(
uint32_t
size
)
11
{
12
return
(
real_t
*)calloc(size,
sizeof
(
real_t
));
13
}
14
15
16
void
free_pointer
(
real_t
* pointer)
17
{
18
free((
void
*)pointer);
19
pointer = NULL;
20
21
}
22
23
void
initArray
(
struct
Array
*a,
uint32_t
initialSize) {
24
a->
array
= (
real_t
*)malloc(initialSize *
sizeof
(
real_t
));
25
a->
used
= 0;
26
a->
size
= initialSize;
27
}
28
29
void
insertArray
(
struct
Array
*a,
real_t
element) {
30
if
(a->
used
== a->
size
) {
31
a->
size
*= 2;
32
a->
array
= (
real_t
*)realloc(a->
array
, a->
size
*
sizeof
(
real_t
));
33
}
34
a->
array
[a->
used
++] = element;
35
}
36
37
void
freeArray
(
struct
Array
*a) {
38
free(a->
array
);
39
a->
array
= NULL;
40
a->
used
= a->
size
= 0;
41
}
free_pointer
void free_pointer(real_t *pointer)
Definition:
general_functions.c:16
insertArray
void insertArray(struct Array *a, real_t element)
Definition:
general_functions.c:29
uint32_t
unsigned int uint32_t
Definition:
typedefs.h:19
initArray
void initArray(struct Array *a, uint32_t initialSize)
Definition:
general_functions.c:23
vector_alloc
real_t * vector_alloc(uint32_t size)
Definition:
general_functions.c:10
Array::used
uint32_t used
Definition:
qp_structs.h:75
Array
Definition:
qp_structs.h:73
general_functions.h
Array::size
uint32_t size
Definition:
qp_structs.h:76
real_t
float64_t real_t
Definition:
typedefs.h:25
Array::array
real_t * array
Definition:
qp_structs.h:74
freeArray
void freeArray(struct Array *a)
Definition:
general_functions.c:37
general_functions.c
Generated on Sat Dec 13 2014 18:15:38 for DuQuad by
1.8.6