Robotran C Documentation
mbs_1D_array.h
Go to the documentation of this file.
1 
13 #ifndef MBS_1D_ARRAY_h
14 #define MBS_1D_ARRAY_h
15 
16 #include <stdio.h>
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* Functions related to arrays of doubles */
33 double *mbs_linspace_0(double start, double stop, int num);
34 
46 double *mbs_linspace_1(double start, double stop, int num);
63 double *mbs_arange_0(double start, double stop, double step, int with_end, int *size);
64 
80 int *mbs_range_0(int start, int stop, int *size);
81 
98 int *mbs_range_1(int start, int stop, int *size);
99 
117 double *mbs_drand_0(int num, double min, double max);
118 
130 double *mbs_drand_1(int num, double min, double max);
131 
155 int get_dinterval_binary_0(double *array, int size, double value, int *index, int lim_check);
156 
180 int get_dinterval_binary_1(double *array, int size, double value, int *index, int lim_check);
181 
208 int get_dinterval_binary_from_index_0(double *array, int size, double value, int *index, int lim_check, int verbose);
209 
234 int get_dinterval_binary_from_index_1(double *array, int size, double value, int *index, int lim_check, int verbose);
235 
236 /* Functions related to arrays of integers */
251 int save_ivec_0(int *vec, int size,char *name, int row);
252 
267 int save_ivec_1(int *vec, int size,char *name, int row);
268 
278 double scalar_product(double v1[4], double v2[4]);
279 
289 double scalar_product_0(double* v1, double* v2, int n);
290 
301 double scalar_product_1(double* v1, double* v2, int n);
302 
311 void vector_sum(double v1[4], double v2[4], double v_dest[4]);
312 
322 void sum_dvec_0(double *v1, double *v2, int size, double *v_dest);
323 
332 void vector_diff(double v1[4], double v2[4], double v_dest[4]);
333 
343 void diff_dvec_0(double *v1, double *v2, int size, double *v_dest);
344 
353 void cross_product(double v1[4], double v2[4], double v_dest[4]);
354 
363 void number_product(double s, double v1[4], double v_dest[4]);
364 
365 // integer related functions
372 int* get_ivec_0(int l_v);
378 int* get_ivec_1(int l_v);
383 void free_ivec_0(int* vec);
388 void free_ivec_1(int* vec);
389 
396 void copy_ivec_0(int* vec_src, int* vec_dest, int l_v);
403 void copy_ivec_1(int* vec_src, int* vec_dest, int l_v);
404 
415 int *re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx);
416 
427 int *re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx);
428 
434 void print_ivec_0(int* vec, int l_v);
439 void print_ivec_1(int* vec);
440 
453 int code_ivec_0(FILE *file_out, int *values, const char *name, int size);
454 
467 int code_ivec_1(FILE *file_out, int *values, const char *name, int size);
468 
469 
476 void sort_ivec_0(int* vec_src, int* vec_dest, int l_v);
477 
484 void sort_dvec_0(double* vec_src, double* vec_dest, int l_v);
485 
492 void sort_ivec_1(int* vec_src, int* vec_dest, int l_v);
499 void sort_inplace_ivec_1(int* vec, int l_v);
505 void f0123_ivec_0(int* vec, int l_v);
514 void conc_ivec_0(int* vec1_src, int l_v1, int* vec2_src, int l_v2, int* vec_dest);
523 void conc_ivec_1(int* vec1_src, int l_v1, int* vec2_src, int l_v2, int* vec3);
524 
535 int slct_ivec_0(int* vec1_src, int l_v1, int* vec_ind_src, int l_v2, int* vec1_dest);
536 
545 int find_ivec_0(int* vec, int l_v, int f);
546 
555 int find_dvec_0(double* vec, int l_v, double f);
556 
565 int find_ivec_1(int* vec, int l_v, int f);
566 
575 int same_ivec_0(int* v1, int* v2, int size);
576 
584 int same_ivec_1(int* v1, int* v2);
585 
586 // double related functions
593 double* get_dvec_0(int l_v);
599 double* get_dvec_1(int l_v);
600 
605 void free_dvec_0(double* vec);
610 void free_dvec_1(double* vec);
611 
618 void copy_dvec_0(double* vec_src, double* vec_dest, int l_v);
624 void copy_dvec_1(double* vec_src, double* vec_dest);
625 
635 double *convert_dvec_0_to_1(double *src, int size, int free_src);
636 
646 double *convert_dvec_1_to_0(double *src, int size, int free_src);
647 
659 double *re_copy_dvec_0(double *src, int s_nx, double *dest, int d_nx);
671 double *re_copy_dvec_1(double *src, int s_nx, double *dest, int d_nx);
672 
680 void print_dvec_0(double* vec, int nb_r);
681 
688 void print_format_dvec_0(double* vec, int nb_r, char* format);
689 
694 void print_dvec_1(double* vec);
695 
708 int code_dvec_0(FILE *file_out, double *values, const char *name, int size);
709 
722 int code_dvec_1(FILE *file_out, double *values, const char *name, int size);
723 
731 void save_dvec_0(double* vec, int nb_r, char* name);
732 
743 void pick_and_place_dvec_1(double* src, int* index, int n, double* dest);
744 
755 void pick_and_place_dvec_0(double* src, int* index, int n, double* dest);
756 
764 void slct_dvec_1(double* vec1_src, int* vec_ind_src, int l_v, double* vec3);
765 
776 int slct_dvec_0(double* vec1_src, int l_v1, int* vec_ind_src, int l_v2, double* vec_dest);
777 
785 int any_dvec_0(double* vec, int l_v);
786 
793 void value_dvec_0(double value, double* vec, int l_v);
799 void value_dvec_1(double value, double* vec);
805 void zeros_dvec_0(double* vec, int l_v);
810 void zeros_dvec_1(double* vec);
811 
817 void opposite_dvec_0(double* vec, int n);
818 
823 void opposite_dvec_1(double* vec);
824 
840 int cmp_dvec_0(double* v1, double* v2, int size);
841 
852 int same_dvec_0(double* v1, double* v2, int size);
853 
861 int same_dvec_1(double* v1, double* v2);
862 
872 int max_dvec_0(double* vec, int size);
873 
882 int max_dvec_1(double* vec);
883 
884 /********************************************
885  * NORM-related functions *
886  ********************************************/
887 
897 double norm(double v[4]);
898 
908 void normalize(double v[4], double vn[4]);
909 
917 double norm_dvec_0(double* vec, int l_v);
925 double norm_dvec_1(double* vec, int l_v);
934 void normalize_dvec_0(double* vec, double* vn, int l_v);
944 void normalize_dvec_1(double* vec, double* vn, int l_v);
945 
953 double norminf_vector_1(double *v, int n);
954 
955 
956 #ifdef __cplusplus
957 }
958 #endif
959 
960 #endif
pick_and_place_dvec_0
void pick_and_place_dvec_0(double *src, int *index, int n, double *dest)
Pick the values from an array and set them in the destination array at the specified index.
Definition: mbs_1D_array.c:1435
code_dvec_0
int code_dvec_0(FILE *file_out, double *values, const char *name, int size)
Write C-code to allocate and fill an array of double.
Definition: mbs_1D_array.c:1239
print_format_dvec_0
void print_format_dvec_0(double *vec, int nb_r, char *format)
print a (x sized) vector of doubles in console, starting with index 0
Definition: mbs_1D_array.c:1217
re_copy_dvec_0
double * re_copy_dvec_0(double *src, int s_nx, double *dest, int d_nx)
Copy an array of double into another, reallocate the destination if required.
Definition: mbs_1D_array.c:1163
code_ivec_0
int code_ivec_0(FILE *file_out, int *values, const char *name, int size)
Write C-code to allocate and fill an array of integers.
Definition: mbs_1D_array.c:711
free_ivec_1
void free_ivec_1(int *vec)
release memory for a vector of integers, starting with index 1
Definition: mbs_1D_array.c:595
slct_dvec_0
int slct_dvec_0(double *vec_src, int l_v1, int *vec_ind_src, int l_v2, double *vec_dest)
fill the third (l_v2 sized) vector by slicing the first (l_v1 sized) vector of doubles at the indexes...
Definition: mbs_1D_array.c:1454
save_ivec_1
int save_ivec_1(int *vec, int size, char *name, int row)
save a (x sized) vector of integers in the specified file, starting with index 0 The file is open wit...
Definition: mbs_1D_array.c:474
conc_ivec_0
void conc_ivec_0(int *vec1_src, int l_v1, int *vec2_src, int l_v2, int *vec_dest)
concatenate the first (l_v1 sized) vector and the second (l_v2 sized) vectors of integers into the th...
Definition: mbs_1D_array.c:927
mbs_drand_1
double * mbs_drand_1(int num, double min, double max)
Allocate an array with the specified random number in the specified range.
Definition: mbs_1D_array.c:284
cmp_dvec_0
int cmp_dvec_0(double *v1, double *v2, int size)
Compare two vectors of floats, as strcmp does it.
Definition: mbs_1D_array.c:1534
sort_inplace_ivec_1
void sort_inplace_ivec_1(int *vec, int l_v)
sort and modify the (x sized) vector of integers, starting with index 1 The "Bubble sort" is used,...
Definition: mbs_1D_array.c:899
diff_dvec_0
void diff_dvec_0(double *v1, double *v2, int size, double *v_dest)
Subtract each component of 2 array in a third vector.
Definition: mbs_1D_array.c:534
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
MSG_ERR
#define MSG_ERR
Definition: mbs_1D_array.c:24
norm_dvec_1
double norm_dvec_1(double *vec, int l_v)
compute the norm of a [l_v sized] vector of doubles, starting with index 1
Definition: norm.c:67
copy_dvec_0
void copy_dvec_0(double *vec_src, double *vec_dest, int l_v)
Copy the content of a vector (of sizel_v) of doubles to a second vector, starting with index 0.
Definition: mbs_1D_array.c:1100
print_dvec_0
void print_dvec_0(double *vec, int l_v)
print a (x sized) vector of doubles in console, starting with index 0
Definition: mbs_1D_array.c:1212
conc_ivec_0
void conc_ivec_0(int *vec1_src, int l_vec1, int *vec2_src, int l_vec2, int *vec_dest)
concatenate the first (l_v1 sized) vector and the second (l_v2 sized) vectors of integers into the th...
Definition: mbs_1D_array.c:927
find_ivec_1
int find_ivec_1(int *vec, int l_v, int f)
return the index of the value f in the (x sized) vector vec of integers, starting with index 1....
Definition: mbs_1D_array.c:1007
MSG_PRE
#define MSG_PRE
Definition: mbs_1D_array.c:25
find_ivec_0
int find_ivec_0(int *vec, int l_v, int f)
return the index of the value f in the (x sized) vector vec of integers, starting with index 0....
Definition: mbs_1D_array.c:977
code_ivec_1
int code_ivec_1(FILE *file_out, int *values, const char *name, int size)
Write C-code to allocate and fill an array of integers.
Definition: mbs_1D_array.c:756
norm
double norm(double v[4])
DEPRECATED: See norm_dvec_1().
Definition: norm.c:27
mbs_drand_0
double * mbs_drand_0(int num, double min, double max)
Allocate an array with the specified random number in the specified range.
Definition: mbs_1D_array.c:249
max_dvec_1
int max_dvec_1(double *vec)
Find the index of the maximum value in the vector.
Definition: mbs_1D_array.c:1601
print_dvec_0
void print_dvec_0(double *vec, int nb_r)
print a (x sized) vector of doubles in console, starting with index 0
Definition: mbs_1D_array.c:1212
scalar_product_1
double scalar_product_1(double *v1, double *v2, int n)
Compute and return the scalar product of 2 vectors with first index is 1.
Definition: mbs_1D_array.c:506
scalar_product
double scalar_product(double v1[4], double v2[4])
Compute and return the scalar product of 2 vectors with first index is 1.
Definition: mbs_1D_array.c:490
zeros_dvec_1
void zeros_dvec_1(double *vec)
set all the element of a vector of doubles to zero, starting with index 1
Definition: mbs_1D_array.c:1514
normalize_dvec_0
void normalize_dvec_0(double *vec, double *vn, int l_v)
Compute the normalize vector with starting with index 0.
Definition: norm.c:79
scalar_product_0
double scalar_product_0(double *v1, double *v2, int n)
Compute and return the scalar product of 2 vectors with first index is 0. See get_dvec_0() to such ve...
Definition: mbs_1D_array.c:496
re_copy_ivec_1
int * re_copy_ivec_1(int *src, int s_nx, int *dest, int d_nx)
Definition: mbs_1D_array.c:649
value_dvec_1
void value_dvec_1(double value, double *vec)
set all the element of a vector of doubles to a value, starting with index 1
Definition: mbs_1D_array.c:1499
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0....
Definition: mbs_1D_array.c:1055
max_dvec_0
int max_dvec_0(double *vec, int size)
Find the index of the maximum value in the array.
Definition: mbs_1D_array.c:1579
same_ivec_1
int same_ivec_1(int *v1, int *v2)
Compare if two vector are the same.
Definition: mbs_1D_array.c:1039
free_ivec_0
void free_ivec_0(int *vec)
release memory for a vector of integers, starting with index 0
Definition: mbs_1D_array.c:590
get_dinterval_binary_from_index_1
int get_dinterval_binary_from_index_1(double *array, int size, double value, int *index, int lim_check, int verbose)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:417
sort_dvec_0
void sort_dvec_0(double *vec_src, double *vec_dest, int l_v)
sort the first (l_v sized) vector of double into the second vector, starting with index 0
Definition: mbs_1D_array.c:827
mbs_linspace_1
double * mbs_linspace_1(double start, double stop, int num)
Allocate an evenly spaced numbers over the specified range.
Definition: mbs_1D_array.c:83
find_dvec_0
int find_dvec_0(double *vec, int l_v, double f)
return the index of the value f in the (x sized) vector vec of doubles, starting with index 0....
Definition: mbs_1D_array.c:992
print_ivec_1
void print_ivec_1(int *vec)
print a vector (of size specified in vec[0]) of integers in console, starting with index 1
Definition: mbs_1D_array.c:690
get_dvec_1
double * get_dvec_1(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 1
Definition: mbs_1D_array.c:1071
code_dvec_0
int code_dvec_0(FILE *file_out, double *values, const char *name, int size)
Write C-code to allocate and fill an array of double.
Definition: mbs_1D_array.c:1239
f0123_ivec_0
void f0123_ivec_0(int *vec, int l_v)
Fill the (l_v sized) vector of integers as [0 1 2 3 ... l_v-1], starting with index 0.
Definition: mbs_1D_array.c:917
print_dvec_1
void print_dvec_1(double *vec)
print a vector (of size specified in vec[0]) of doubles in console, starting with index 1
Definition: mbs_1D_array.c:1369
code_ivec_0
int code_ivec_0(FILE *file_out, int *values, const char *name, int size)
Write C-code to allocate and fill an array of integers.
Definition: mbs_1D_array.c:711
normalize
void normalize(double v[4], double vn[4])
DEPRECATED: See normalize_dvec_1()
Definition: norm.c:33
any_dvec_0
int any_dvec_0(double *vec, int l_v)
check if all values of a [l_v sized] vector of doubles are equal to 0, return 0 in that case,...
Definition: mbs_1D_array.c:1473
sort_ivec_0
void sort_ivec_0(int *vec_src, int *vec_dest, int l_v)
sort the first (l_v sized) vector of integers into the second vector, starting with index 0
Definition: mbs_1D_array.c:791
same_dvec_1
int same_dvec_1(double *v1, double *v2)
Compare if two vector of floats are the same.
Definition: mbs_1D_array.c:1564
pick_and_place_dvec_1
void pick_and_place_dvec_1(double *src, int *index, int n, double *dest)
Pick the values from an array and set them in the destination array at the specified index.
Definition: mbs_1D_array.c:1426
sort_ivec_1
void sort_ivec_1(int *vec_src, int *vec_dest, int l_v)
sort the first (x sized) vector of integers into the second vector, starting with index 1
Definition: mbs_1D_array.c:863
cmp_dvec_0
int cmp_dvec_0(double *v1, double *v2, int size)
Compare two vectors of floats, as strcmp does it.
Definition: mbs_1D_array.c:1534
save_dvec_0
void save_dvec_0(double *vec, int nb_r, char *name)
save a (x sized) vector of doubles in the specified file, starting with index 0 The file is open with...
Definition: mbs_1D_array.c:1399
opposite_dvec_1
void opposite_dvec_1(double *vec)
function to take the opposite of a given vector (minus in front of each entry)
Definition: mbs_1D_array.c:1529
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
get_ivec_0
int * get_ivec_0(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 0....
Definition: mbs_1D_array.c:555
get_dinterval_binary_0
int get_dinterval_binary_0(double *array, int size, double value, int *index, int lim_check)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:320
save_ivec_0
int save_ivec_0(int *vec, int size, char *name, int row)
save a (x sized) vector of integers in the specified file, starting with index 0 The file is open wit...
Definition: mbs_1D_array.c:429
copy_dvec_1
void copy_dvec_1(double *vec_src, double *vec_dest)
Copy the content of a vector (of size specified in vec_src[0]) of doubles to a second vector,...
Definition: mbs_1D_array.c:1110
number_product
void number_product(double s, double v1[4], double v_dest[4])
Compute the product of a vector by a real. The first index is 1.
Definition: mbs_1D_array.c:549
free_dvec_1
void free_dvec_1(double *vec)
release memory for a vector of doubles, starting at index 1
Definition: mbs_1D_array.c:1095
mbs_1D_array.h
get_dinterval_binary_from_index_0
int get_dinterval_binary_from_index_0(double *array, int size, double value, int *index, int lim_check, int verbose)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:365
vector_diff
void vector_diff(double v1[4], double v2[4], double v_dest[4])
Subtract each component of 2 vectors in a third vector. The first index is 1.
Definition: mbs_1D_array.c:527
binary_search_0
int binary_search_0(double *array, double value, int id_min, int id_max)
Definition: mbs_1D_array.c:303
norm_dvec_0
double norm_dvec_0(double *vec, int l_v)
compute the norm of a [l_v sized] vector of doubles, starting with index 0
Definition: norm.c:55
save_dvec_0
void save_dvec_0(double *vec, int l_v, char *name)
save a (x sized) vector of doubles in the specified file, starting with index 0 The file is open with...
Definition: mbs_1D_array.c:1399
mbs_range_0
int * mbs_range_0(int start, int stop, int *size)
Return an array of value in the interval spaced by 1.
Definition: mbs_1D_array.c:176
slct_ivec_0
int slct_ivec_0(int *vec_src, int l_vec1, int *vec_ind_src, int l_vec2, int *vec_dest)
fill the third (l_v2 sized) vector by slicing the first (l_v1 sized) vector of integers at the indexe...
Definition: mbs_1D_array.c:958
get_ivec_1
int * get_ivec_1(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 1
Definition: mbs_1D_array.c:571
cross_product
void cross_product(double v1[4], double v2[4], double v_dest[4])
Compute the cross product of 2 vectors in a third vector. The first index is 1.
Definition: mbs_1D_array.c:542
same_ivec_0
int same_ivec_0(int *v1, int *v2, int size)
Compare if two vector are the same.
Definition: mbs_1D_array.c:1022
scalar_product
double scalar_product(double v1[4], double v2[4])
Compute and return the scalar product of 2 vectors with first index is 1.
Definition: mbs_1D_array.c:490
norminf_vector_1
double norminf_vector_1(double *v, int n)
Compute the maximum of a vector.
Definition: norm.c:38
slct_dvec_0
int slct_dvec_0(double *vec1_src, int l_v1, int *vec_ind_src, int l_v2, double *vec_dest)
fill the third (l_v2 sized) vector by slicing the first (l_v1 sized) vector of doubles at the indexes...
Definition: mbs_1D_array.c:1454
copy_ivec_1
void copy_ivec_1(int *vec_src, int *vec_dest, int l_v)
Copy the content of a vector (of size l_v) of integers to a second vector, starting with index 1.
Definition: mbs_1D_array.c:610
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0....
Definition: mbs_1D_array.c:1055
convert_dvec_0_to_1
double * convert_dvec_0_to_1(double *src, int size, int free_src)
Copy a dvec0 into a new allocated dvec1.
Definition: mbs_1D_array.c:1128
mbs_linspace_0
double * mbs_linspace_0(double start, double stop, int num)
Allocate an evenly spaced numbers over the specified range.
Definition: mbs_1D_array.c:63
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:1090
code_dvec_1
int code_dvec_1(FILE *file_out, double *values, const char *name, int size)
Write C-code to allocate and fill an array of double.
Definition: mbs_1D_array.c:1309
save_ivec_1
int save_ivec_1(int *vec, int size, char *name, int row)
save a (x sized) vector of integers in the specified file, starting with index 0 The file is open wit...
Definition: mbs_1D_array.c:474
mbs_drand_1
double * mbs_drand_1(int num, double min, double max)
Allocate an array with the specified random number in the specified range.
Definition: mbs_1D_array.c:284
mbs_arange_0
double * mbs_arange_0(double start, double stop, double step, int with_end, int *size)
Allocate an a array with specified step between two values.
Definition: mbs_1D_array.c:103
print_dvec_1
void print_dvec_1(double *vec)
print a vector (of size specified in vec[0]) of doubles in console, starting with index 1
Definition: mbs_1D_array.c:1369
zeros_dvec_0
void zeros_dvec_0(double *vec, int l_v)
set all the element of a [l_v sized] vector of doubles to zero, starting with index 0
Definition: mbs_1D_array.c:1504
value_dvec_0
void value_dvec_0(double value, double *vec, int l_v)
set all the element of a [l_v sized] vector of doubles to a value, starting with index 0
Definition: mbs_1D_array.c:1489
opposite_dvec_1
void opposite_dvec_1(double *vec)
function to take the opposite of a given vector (minus in front of each entry)
Definition: mbs_1D_array.c:1529
vector_sum
void vector_sum(double v1[4], double v2[4], double v_dest[4])
Sum each component of 2 vectors in a third vector. The first index is 1.
Definition: mbs_1D_array.c:512
mbs_range_1
int * mbs_range_1(int start, int stop, int *size)
Return an array of value in the interval spaced by 1.
Definition: mbs_1D_array.c:212
get_dinterval_binary_0
int get_dinterval_binary_0(double *array, int size, double value, int *index, int lim_check)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:320
code_ivec_1
int code_ivec_1(FILE *file_out, int *values, const char *name, int size)
Write C-code to allocate and fill an array of integers.
Definition: mbs_1D_array.c:756
sum_dvec_0
void sum_dvec_0(double *v1, double *v2, int size, double *v_dest)
Sum each component of 2 array in a third vector.
Definition: mbs_1D_array.c:519
print_ivec_0
void print_ivec_0(int *vec, int l_v)
print a (l_v sized) vector of integers in console, starting with index 0
Definition: mbs_1D_array.c:669
convert_dvec_1_to_0
double * convert_dvec_1_to_0(double *src, int size, int free_src)
Copy a dvec1 into a new allocated dvec0.
Definition: mbs_1D_array.c:1144
free_dvec_1
void free_dvec_1(double *vec)
release memory for a vector of doubles, starting at index 1
Definition: mbs_1D_array.c:1095
get_dinterval_binary_1
int get_dinterval_binary_1(double *array, int size, double value, int *index, int lim_check)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:354
vector_diff
void vector_diff(double v1[4], double v2[4], double v_dest[4])
Subtract each component of 2 vectors in a third vector. The first index is 1.
Definition: mbs_1D_array.c:527
max_dvec_1
int max_dvec_1(double *vec)
Find the index of the maximum value in the vector.
Definition: mbs_1D_array.c:1601
externalmbs::increment
subroutine, public increment(tbegin)
Increment time step and save the current configuration of all mbs.
Definition: mod_external_robotran.f90:237
copy_ivec_0
void copy_ivec_0(int *vec_src, int *vec_dest, int l_v)
Copy the content of a vector(of size l_v) of integers to a second vector, starting with index 0.
Definition: mbs_1D_array.c:600
re_copy_dvec_1
double * re_copy_dvec_1(double *src, int s_nx, double *dest, int d_nx)
Copy an array of double into another, reallocate the destination if required.
Definition: mbs_1D_array.c:1192
pick_and_place_dvec_0
void pick_and_place_dvec_0(double *src, int *index, int n, double *dest)
Pick the values from an array and set them in the destination array at the specified index.
Definition: mbs_1D_array.c:1435
cross_product
void cross_product(double v1[4], double v2[4], double v_dest[4])
Compute the cross product of 2 vectors in a third vector. The first index is 1.
Definition: mbs_1D_array.c:542
free_ivec_0
void free_ivec_0(int *vec)
release memory for a vector of integers, starting with index 0
Definition: mbs_1D_array.c:590
get_dinterval_binary_from_index_1
int get_dinterval_binary_from_index_1(double *array, int size, double value, int *index, int lim_check, int verbose)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:417
re_copy_dvec_0
double * re_copy_dvec_0(double *src, int s_nx, double *dest, int d_nx)
Copy an array of double into another, reallocate the destination if required.
Definition: mbs_1D_array.c:1163
sort_dvec_0
void sort_dvec_0(double *vec_src, double *vec_dest, int l_v)
sort the first (l_v sized) vector of double into the second vector, starting with index 0
Definition: mbs_1D_array.c:827
print_format_dvec_0
void print_format_dvec_0(double *vec, int l_v, char *format)
print a (x sized) vector of doubles in console, starting with index 0
Definition: mbs_1D_array.c:1217
find_dvec_0
int find_dvec_0(double *vec, int l_v, double f)
return the index of the value f in the (x sized) vector vec of doubles, starting with index 0....
Definition: mbs_1D_array.c:992
print_ivec_1
void print_ivec_1(int *vec)
print a vector (of size specified in vec[0]) of integers in console, starting with index 1
Definition: mbs_1D_array.c:690
sort_inplace_ivec_1
void sort_inplace_ivec_1(int *vec, int l_v)
sort and modify the (x sized) vector of integers, starting with index 1 The "Bubble sort" is used,...
Definition: mbs_1D_array.c:899
convert_dvec_0_to_1
double * convert_dvec_0_to_1(double *src, int size, int free_src)
Copy a dvec0 into a new allocated dvec1.
Definition: mbs_1D_array.c:1128
diff_dvec_0
void diff_dvec_0(double *v1, double *v2, int size, double *v_dest)
Subtract each component of 2 array in a third vector.
Definition: mbs_1D_array.c:534
f0123_ivec_0
void f0123_ivec_0(int *vec, int l_v)
Fill the (l_v sized) vector of integers as [0 1 2 3 ... l_v-1], starting with index 0.
Definition: mbs_1D_array.c:917
mbs_message.h
re_copy_ivec_0
int * re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx)
Copy an array of int into another, reallocate the destination if required.
Definition: mbs_1D_array.c:620
same_dvec_0
int same_dvec_0(double *v1, double *v2, int size)
Compare if two vectors of floats are the same.
Definition: mbs_1D_array.c:1559
any_dvec_0
int any_dvec_0(double *vec, int l_v)
check if all values of a [l_v sized] vector of doubles are equal to 0, return 0 in that case,...
Definition: mbs_1D_array.c:1473
same_dvec_1
int same_dvec_1(double *v1, double *v2)
Compare if two vector of floats are the same.
Definition: mbs_1D_array.c:1564
sort_ivec_1
void sort_ivec_1(int *vec_src, int *vec_dest, int l_v)
sort the first (x sized) vector of integers into the second vector, starting with index 1
Definition: mbs_1D_array.c:863
re_copy_ivec_0
int * re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx)
Copy an array of int into another, reallocate the destination if required.
Definition: mbs_1D_array.c:620
get_ivec_0
int * get_ivec_0(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 0....
Definition: mbs_1D_array.c:555
zeros_dvec_0
void zeros_dvec_0(double *vec, int l_v)
set all the element of a [l_v sized] vector of doubles to zero, starting with index 0
Definition: mbs_1D_array.c:1504
slct_dvec_1
void slct_dvec_1(double *vec1_src, int *vec_ind_src, int l_v, double *vec3)
fill the third vector by slicing the first vector of doubles at the indexes specified in the second (...
Definition: mbs_1D_array.c:1444
get_dinterval_binary_from_index_0
int get_dinterval_binary_from_index_0(double *array, int size, double value, int *index, int lim_check, int verbose)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:365
opposite_dvec_0
void opposite_dvec_0(double *vec, int n)
function to take the opposite of a given vector (minus in front of each entry)
Definition: mbs_1D_array.c:1519
conc_ivec_1
void conc_ivec_1(int *vec1_src, int l_v1, int *vec2_src, int l_v2, int *vec3)
concatenate the first (l_v1 sized) vector and the second (l_v2 sized) vectors of integers into the th...
Definition: mbs_1D_array.c:942
vector_sum
void vector_sum(double v1[4], double v2[4], double v_dest[4])
Sum each component of 2 vectors in a third vector. The first index is 1.
Definition: mbs_1D_array.c:512
normalize_dvec_1
void normalize_dvec_1(double *vec, double *vn, int l_v)
Compute the normalize vector with first index is 1.
Definition: norm.c:92
mbs_range_1
int * mbs_range_1(int start, int stop, int *size)
Return an array of value in the interval spaced by 1.
Definition: mbs_1D_array.c:212
zeros_dvec_1
void zeros_dvec_1(double *vec)
set all the element of a vector of doubles to zero, starting with index 1
Definition: mbs_1D_array.c:1514
slct_ivec_0
int slct_ivec_0(int *vec1_src, int l_v1, int *vec_ind_src, int l_v2, int *vec1_dest)
fill the third (l_v2 sized) vector by slicing the first (l_v1 sized) vector of integers at the indexe...
Definition: mbs_1D_array.c:958
convert_dvec_1_to_0
double * convert_dvec_1_to_0(double *src, int size, int free_src)
Copy a dvec1 into a new allocated dvec0.
Definition: mbs_1D_array.c:1144
max_dvec_0
int max_dvec_0(double *vec, int size)
Find the index of the maximum value in the array.
Definition: mbs_1D_array.c:1579
same_ivec_0
int same_ivec_0(int *v1, int *v2, int size)
Compare if two vector are the same.
Definition: mbs_1D_array.c:1022
free_ivec_1
void free_ivec_1(int *vec)
release memory for a vector of integers, starting with index 1
Definition: mbs_1D_array.c:595
mbs_linspace_1
double * mbs_linspace_1(double start, double stop, int num)
Allocate an evenly spaced numbers over the specified range.
Definition: mbs_1D_array.c:83
copy_ivec_0
void copy_ivec_0(int *vec_src, int *vec_dest, int l_v)
Copy the content of a vector(of size l_v) of integers to a second vector, starting with index 0.
Definition: mbs_1D_array.c:600
re_copy_dvec_1
double * re_copy_dvec_1(double *src, int s_nx, double *dest, int d_nx)
Copy an array of double into another, reallocate the destination if required.
Definition: mbs_1D_array.c:1192
copy_ivec_1
void copy_ivec_1(int *vec_src, int *vec_dest, int l_v)
Copy the content of a vector (of size l_v) of integers to a second vector, starting with index 1.
Definition: mbs_1D_array.c:610
mbs_linspace_0
double * mbs_linspace_0(double start, double stop, int num)
Allocate an evenly spaced numbers over the specified range.
Definition: mbs_1D_array.c:63
get_dvec_1
double * get_dvec_1(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 1
Definition: mbs_1D_array.c:1071
mbs_linspace
int mbs_linspace(double start, double stop, int num, double *linspace)
Definition: mbs_1D_array.c:28
copy_dvec_0
void copy_dvec_0(double *vec_src, double *vec_dest, int l_v)
Copy the content of a vector (of sizel_v) of doubles to a second vector, starting with index 0.
Definition: mbs_1D_array.c:1100
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:1090
code_dvec_1
int code_dvec_1(FILE *file_out, double *values, const char *name, int size)
Write C-code to allocate and fill an array of double.
Definition: mbs_1D_array.c:1309
sort_ivec_0
void sort_ivec_0(int *vec_src, int *vec_dest, int l_v)
sort the first (l_v sized) vector of integers into the second vector, starting with index 0
Definition: mbs_1D_array.c:791
slct_dvec_1
void slct_dvec_1(double *vec_src, int *vec_ind_src, int l_v, double *vec_dest)
fill the third vector by slicing the first vector of doubles at the indexes specified in the second (...
Definition: mbs_1D_array.c:1444
pick_and_place_dvec_1
void pick_and_place_dvec_1(double *src, int *index, int n, double *dest)
Pick the values from an array and set them in the destination array at the specified index.
Definition: mbs_1D_array.c:1426
conc_ivec_1
void conc_ivec_1(int *vec1_src, int l_vec1, int *vec2_src, int l_vec2, int *vec_dest)
concatenate the first (l_v1 sized) vector and the second (l_v2 sized) vectors of integers into the th...
Definition: mbs_1D_array.c:942
find_ivec_1
int find_ivec_1(int *vec, int l_v, int f)
return the index of the value f in the (x sized) vector vec of integers, starting with index 1....
Definition: mbs_1D_array.c:1007
save_ivec_0
int save_ivec_0(int *vec, int size, char *name, int row)
save a (x sized) vector of integers in the specified file, starting with index 0 The file is open wit...
Definition: mbs_1D_array.c:429
find_ivec_0
int find_ivec_0(int *vec, int l_v, int f)
return the index of the value f in the (x sized) vector vec of integers, starting with index 0....
Definition: mbs_1D_array.c:977
copy_dvec_1
void copy_dvec_1(double *vec_src, double *vec_dest)
Copy the content of a vector (of size specified in vec_src[0]) of doubles to a second vector,...
Definition: mbs_1D_array.c:1110
number_product
void number_product(double s, double v1[4], double v_dest[4])
Compute the product of a vector by a real. The first index is 1.
Definition: mbs_1D_array.c:549
mbs_arange_0
double * mbs_arange_0(double start, double stop, double step, int with_end, int *size)
Allocate an a array with specified step between two values.
Definition: mbs_1D_array.c:103
same_dvec_0
int same_dvec_0(double *v1, double *v2, int size)
Compare if two vectors of floats are the same.
Definition: mbs_1D_array.c:1559
value_dvec_0
void value_dvec_0(double value, double *vec, int l_v)
set all the element of a [l_v sized] vector of doubles to a value, starting with index 0
Definition: mbs_1D_array.c:1489
mbs_drand_0
double * mbs_drand_0(int num, double min, double max)
Allocate an array with the specified random number in the specified range.
Definition: mbs_1D_array.c:249
sum_dvec_0
void sum_dvec_0(double *v1, double *v2, int size, double *v_dest)
Sum each component of 2 array in a third vector.
Definition: mbs_1D_array.c:519
scalar_product_1
double scalar_product_1(double *v1, double *v2, int n)
Compute and return the scalar product of 2 vectors with first index is 1.
Definition: mbs_1D_array.c:506
print_ivec_0
void print_ivec_0(int *vec, int l_v)
print a (l_v sized) vector of integers in console, starting with index 0
Definition: mbs_1D_array.c:669
scalar_product_0
double scalar_product_0(double *v1, double *v2, int n)
Compute and return the scalar product of 2 vectors with first index is 0. See get_dvec_0() to such ve...
Definition: mbs_1D_array.c:496
value_dvec_1
void value_dvec_1(double value, double *vec)
set all the element of a vector of doubles to a value, starting with index 1
Definition: mbs_1D_array.c:1499
get_dinterval_binary_1
int get_dinterval_binary_1(double *array, int size, double value, int *index, int lim_check)
Find the index of the highest value in the array lower or equal than the value.
Definition: mbs_1D_array.c:354
mbs_range_0
int * mbs_range_0(int start, int stop, int *size)
Return an array of value in the interval spaced by 1.
Definition: mbs_1D_array.c:176
opposite_dvec_0
void opposite_dvec_0(double *vec, int n)
function to take the opposite of a given vector (minus in front of each entry)
Definition: mbs_1D_array.c:1519
get_ivec_1
int * get_ivec_1(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 1
Definition: mbs_1D_array.c:571
same_ivec_1
int same_ivec_1(int *v1, int *v2)
Compare if two vector are the same.
Definition: mbs_1D_array.c:1039