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);
47 
65 double *mbs_drand_0(int num, double min, double max);
66 
78 double *mbs_drand_1(int num, double min, double max);
79 
103 int get_dinterval_binary_0(double *array, int size, double value, int *index, int lim_check);
104 
128 int get_dinterval_binary_1(double *array, int size, double value, int *index, int lim_check);
129 
156 int get_dinterval_binary_from_index_0(double *array, int size, double value, int *index, int lim_check, int verbose);
157 
182 int get_dinterval_binary_from_index_1(double *array, int size, double value, int *index, int lim_check, int verbose);
183 
184 /* Functions related to arrays of integers */
199 int save_ivec_0(int *vec, int size,char *name, int row);
200 
215 int save_ivec_1(int *vec, int size,char *name, int row);
216 
217 
227 double norm(double v[4]);
228 
238 void normalize(double v[4], double vn[4]);
239 
249 double scalar_product(double v1[4], double v2[4]);
250 
261 double scalar_product_0(double* v1, double* v2, int n);
262 
271 void vector_sum(double v1[4], double v2[4], double v_dest[4]);
272 
281 void vector_diff(double v1[4], double v2[4], double v_dest[4]);
282 
291 void cross_product(double v1[4], double v2[4], double v_dest[4]);
292 
301 void number_product(double s, double v1[4], double v_dest[4]);
302 
303 // integer related functions
309 int* get_ivec_0(int l_v);
315 int* get_ivec_1(int l_v);
320 void free_ivec_0(int* vec);
325 void free_ivec_1(int* vec);
326 
333 void copy_ivec_0(int* vec_src, int* vec_dest, int l_v);
340 void copy_ivec_1(int* vec_src, int* vec_dest, int l_v);
341 
352 int *re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx);
353 
364 int *re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx);
365 
371 void print_ivec_0(int* vec, int l_v);
376 void print_ivec_1(int* vec);
377 
390 int code_ivec_0(FILE *file_out, int *values, const char *name, int size);
391 
404 int code_ivec_1(FILE *file_out, int *values, const char *name, int size);
405 
406 
413 void sort_ivec_0(int* vec_src, int* vec_dest, int l_v);
414 
421 void sort_dvec_0(double* vec_src, double* vec_dest, int l_v);
422 
429 void sort_ivec_1(int* vec_src, int* vec_dest, int l_v);
436 void sort_inplace_ivec_1(int* vec, int l_v);
442 void f0123_ivec_0(int* vec, int l_v);
451 void conc_ivec_0(int* vec1_src, int l_v1, int* vec2_src, int l_v2, int* vec_dest);
460 void conc_ivec_1(int* vec1_src, int l_v1, int* vec2_src, int l_v2, int* vec3);
461 
472 int slct_ivec_0(int* vec1_src, int l_v1, int* vec_ind_src, int l_v2, int* vec1_dest);
473 
482 int find_ivec_0(int* vec, int l_v, int f);
483 
492 int find_dvec_0(double* vec, int l_v, double f);
493 
502 int find_ivec_1(int* vec, int l_v, int f);
503 
512 int same_ivec_0(int* v1, int* v2, int size);
513 
521 int same_ivec_1(int* v1, int* v2);
522 
523 // double related functions
529 double* get_dvec_0(int l_v);
535 double* get_dvec_1(int l_v);
536 
541 void free_dvec_0(double* vec);
546 void free_dvec_1(double* vec);
547 
554 void copy_dvec_0(double* vec_src, double* vec_dest, int l_v);
560 void copy_dvec_1(double* vec_src, double* vec_dest);
561 
571 double *convert_dvec_0_to_1(double *src, int size, int free_src);
572 
582 double *convert_dvec_1_to_0(double *src, int size, int free_src);
583 
595 double *re_copy_dvec_0(double *src, int s_nx, double *dest, int d_nx);
607 double *re_copy_dvec_1(double *src, int s_nx, double *dest, int d_nx);
608 
616 void print_dvec_0(double* vec, int nb_r);
617 
624 void print_format_dvec_0(double* vec, int nb_r, char* format);
625 
630 void print_dvec_1(double* vec);
631 
644 int code_dvec_0(FILE *file_out, double *values, const char *name, int size);
645 
658 int code_dvec_1(FILE *file_out, double *values, const char *name, int size);
659 
667 void save_dvec_0(double* vec, int nb_r, char* name);
668 
679 void pick_and_place_dvec_1(double* src, int* index, int n, double* dest);
680 
691 void pick_and_place_dvec_0(double* src, int* index, int n, double* dest);
692 
700 void slct_dvec_1(double* vec1_src, int* vec_ind_src, int l_v, double* vec3);
701 
712 int slct_dvec_0(double* vec1_src, int l_v1, int* vec_ind_src, int l_v2, double* vec_dest);
713 
721 int any_dvec_0(double* vec, int l_v);
729 double norm_dvec_0(double* vec, int l_v);
737 double norm_dvec_1(double* vec, int l_v);
746 void normalize_dvec_0(double* vec, double* vn, int l_v);
756 void normalize_dvec_1(double* vec, double* vn, int l_v);
762 void zeros_dvec_0(double* vec, int l_v);
767 void zeros_dvec_1(double* vec);
768 
774 void opposite_dvec_0(double* vec, int n);
775 
780 void opposite_dvec_1(double* vec);
781 
790 int same_dvec_0(double* v1, double* v2, int size);
791 
799 int same_dvec_1(double* v1, double* v2);
800 #ifdef __cplusplus
801 }
802 #endif
803 
804 #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:1239
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:1045
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:1023
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:969
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:536
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:420
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:1258
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:325
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:752
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:135
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:724
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: mbs_1D_array.c:1305
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:906
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:1018
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:752
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:832
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:802
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: mbs_1D_array.c:1293
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:581
norm
double norm(double v[4])
DEPRECATED: See norm_dvec_1().
Definition: mbs_1D_array.c:341
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:100
normalize_dvec_1
void normalize_dvec_1(double *vec, double *vn, int l_v)
Compute the normalize vector with first index is 1.
Definition: mbs_1D_array.c:1330
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:1018
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:353
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:1353
normalize_dvec_0
void normalize_dvec_0(double *vec, double *vn, int l_v)
Compute the normalize vector with starting with index 0.
Definition: mbs_1D_array.c:1317
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.
Definition: mbs_1D_array.c:359
re_copy_ivec_1
int * re_copy_ivec_1(int *src, int s_nx, int *dest, int d_nx)
Definition: mbs_1D_array.c:474
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:880
same_ivec_1
int same_ivec_1(int *v1, int *v2)
Compare if two vector are the same.
Definition: mbs_1D_array.c:864
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:415
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:268
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:652
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:80
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:817
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:515
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:885
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:1045
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:742
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:1175
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:536
normalize
void normalize(double v[4], double vn[4])
DEPRECATED: See normalize_dvec_1()
Definition: mbs_1D_array.c:347
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:1277
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:616
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:1389
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:1230
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:688
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:1205
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:1368
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:399
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:171
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:280
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:916
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:393
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:901
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:216
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:378
binary_search_0
int binary_search_0(double *array, double value, int id_min, int id_max)
Definition: mbs_1D_array.c:154
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: mbs_1D_array.c:1293
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:1205
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:783
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:404
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:386
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:847
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:353
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:1258
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:435
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:880
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:934
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:60
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
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:896
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:1115
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:325
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:135
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: mbs_1D_array.c:1305
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:1175
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:1343
normalize
void normalize(double v[4], double vn[4])
DEPRECATED: See normalize_dvec_1()
Definition: mbs_1D_array.c:347
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:1368
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:370
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:171
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:581
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:494
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:950
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:901
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:205
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:378
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:425
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:998
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:1239
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:386
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:415
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:268
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:969
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:652
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:1023
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:817
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:515
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:724
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:934
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:742
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:445
same_dvec_0
int same_dvec_0(double *v1, double *v2, int size)
Compare if two vector of floats are the same.
Definition: mbs_1D_array.c:1373
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:1277
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:1389
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:688
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:445
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:399
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:1343
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:1248
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:216
norm
double norm(double v[4])
DEPRECATED: See norm_dvec_1().
Definition: mbs_1D_array.c:341
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:1358
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:767
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:370
normalize_dvec_1
void normalize_dvec_1(double *vec, double *vn, int l_v)
Compute the normalize vector with first index is 1.
Definition: mbs_1D_array.c:1330
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:1353
normalize_dvec_0
void normalize_dvec_0(double *vec, double *vn, int l_v)
Compute the normalize vector with starting with index 0.
Definition: mbs_1D_array.c:1317
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:783
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:950
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:847
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:420
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:80
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:425
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:998
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:435
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:60
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:885
mbs_linspace
int mbs_linspace(double start, double stop, int num, double *linspace)
Definition: mbs_1D_array.c:25
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:906
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:896
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:1115
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:616
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:1248
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:1230
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:767
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:832
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:280
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:802
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:916
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:393
same_dvec_0
int same_dvec_0(double *v1, double *v2, int size)
Compare if two vector of floats are the same.
Definition: mbs_1D_array.c:1373
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:100
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:494
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.
Definition: mbs_1D_array.c:359
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:205
mbs_warning_msg
void mbs_warning_msg(char *msg,...)
Send a warning message.
Definition: mbs_message.c:89
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:1358
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:404
same_ivec_1
int same_ivec_1(int *v1, int *v2)
Compare if two vector are the same.
Definition: mbs_1D_array.c:864