Documented basic utility functions used by other modules of the code.
More...
|
| double * | make_1Darray (long size) |
| | Allocate memory to a 1d array of type double and length size. More...
|
| |
| int * | make_1D_int_array (long size) |
| | Allocate memory to a 1d array of type integer and length size. More...
|
| |
| double ** | make_2Darray (long nrows, long ncols) |
| | Allocate memory to a 2d array of type double. More...
|
| |
| void | free_2Darray (double **m) |
| | Free the memory allocated to a 2d array. More...
|
| |
| double * | init_1Darray (long n, double xmin, double xmax) |
| | initialize a 1d array, with values in the range of [xmin,xmax] and evenely-space on linear scale More...
|
| |
| double * | loginit_1Darray (long n, double xmin, double xmax) |
| | initialize a 1d array, with values in the range of [xmin,xmax] and evenely-space on natural-log scale More...
|
| |
| double * | log10init_1Darray (long n, double inc, double xmin) |
| | initialize a 1d array, with values in the range of [xmin,xmax] and evenely-space on log10 scale More...
|
| |
| long | count_lines_in_file (char *fname) |
| | Count the number of lines of a file. More...
|
| |
| long | count_cols_in_file (char *fname) |
| | Count the number of columns of a file. More...
|
| |
Documented basic utility functions used by other modules of the code.
Azadeh Moradinezhad Dizgah, November 4th 2021
In summary, the following functions can be called from other modules:
- make_1Darray() dynamically allocates memory to a 1d array
- make_2Darray() dynamically allocates memory to a 2d array
- free_2Darray() free the memory allocated to a 2d array
- init_1Darray() initialize a 1d array with linear spacing
- loginit_1Darray() initialize a 1d array with natural-log spacing
- log10init_1Darray() initialize a 1d array with log10 spacing
- count_lines_in_file() count the number of lines of a file
- count_cols_in_file() count number of columns of a file
- return_arr()
◆ count_cols_in_file()
| long count_cols_in_file |
( |
char * |
fname | ) |
|
Count the number of columns of a file.
- Parameters
-
- Returns
- long integer value of ncols
◆ count_lines_in_file()
| long count_lines_in_file |
( |
char * |
fname | ) |
|
Count the number of lines of a file.
- Parameters
-
- Returns
- long integer value of nlines
◆ free_2Darray()
| void free_2Darray |
( |
double ** |
m | ) |
|
Free the memory allocated to a 2d array.
- Parameters
-
| m | Input: double pointer to the elements of 2d array |
- Returns
- void
◆ init_1Darray()
| double * init_1Darray |
( |
long |
n, |
|
|
double |
xmin, |
|
|
double |
xmax |
|
) |
| |
initialize a 1d array, with values in the range of [xmin,xmax] and evenely-space on linear scale
- Parameters
-
| n | Input: number of elements |
| xmin | Input: start point |
| xmax | Input: end point |
- Returns
- a pointer to a double type 1d array, with values initialized
◆ log10init_1Darray()
| double * log10init_1Darray |
( |
long |
n, |
|
|
double |
inc, |
|
|
double |
xmin |
|
) |
| |
initialize a 1d array, with values in the range of [xmin,xmax] and evenely-space on log10 scale
- Parameters
-
| n | Input: number of elements |
| inc | Input: increment |
| xmin | Input: start point |
- Returns
- a pointer to a double type 1d array, with values initialized
◆ loginit_1Darray()
| double * loginit_1Darray |
( |
long |
n, |
|
|
double |
xmin, |
|
|
double |
xmax |
|
) |
| |
initialize a 1d array, with values in the range of [xmin,xmax] and evenely-space on natural-log scale
- Parameters
-
| n | Input: number of elements |
| xmin | Input: start point |
| xmax | Input: end point |
- Returns
- a pointer to a double type 1d array, with values initialized
◆ make_1D_int_array()
| int * make_1D_int_array |
( |
long |
size | ) |
|
Allocate memory to a 1d array of type integer and length size.
- Parameters
-
| size | Input: length of the arrat |
- Returns
- a pointer to an integer type 1d array
◆ make_1Darray()
| double * make_1Darray |
( |
long |
size | ) |
|
Allocate memory to a 1d array of type double and length size.
- Parameters
-
| size | Input: length of the array |
- Returns
- a pointer to a 1d array
◆ make_2Darray()
| double ** make_2Darray |
( |
long |
nrows, |
|
|
long |
ncols |
|
) |
| |
Allocate memory to a 2d array of type double.
- Parameters
-
| nrows | Input: number of rows of the output array |
| ncols | Input: number of columns of the output array |
- Returns
- a double pointer to a double type 2d array