2023-10-11 12:04:04 -04:00
|
|
|
#include "macros.h"
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#ifndef LIZFCM_H
|
|
|
|
#define LIZFCM_H
|
|
|
|
|
|
|
|
extern float smaceps();
|
|
|
|
extern double dmaceps();
|
|
|
|
|
|
|
|
extern double central_derivative_at(double (*f)(double), double a, double h);
|
|
|
|
extern double forward_derivative_at(double (*f)(double), double a, double h);
|
|
|
|
extern double backward_derivative_at(double (*f)(double), double a, double h);
|
|
|
|
|
|
|
|
extern double sum_v(Array_double *v);
|
2023-10-11 17:56:20 -04:00
|
|
|
extern Array_double *scale_v(Array_double *v1, double m);
|
2023-10-11 12:04:04 -04:00
|
|
|
extern Array_double *add_v(Array_double *v1, Array_double *v2);
|
|
|
|
extern Array_double *minus_v(Array_double *v1, Array_double *v2);
|
2023-10-13 23:00:07 -04:00
|
|
|
extern double v_dot_v(Array_double *v1, Array_double *v2);
|
2023-10-11 12:04:04 -04:00
|
|
|
extern double l2_norm(Array_double *v);
|
|
|
|
extern double l1_norm(Array_double *v);
|
|
|
|
extern double linf_norm(Array_double *v);
|
2023-10-13 23:00:07 -04:00
|
|
|
extern double vector_distance(Array_double *v1, Array_double *v2,
|
|
|
|
double (*norm)(Array_double *));
|
2023-10-11 12:04:04 -04:00
|
|
|
extern double l2_distance(Array_double *v1, Array_double *v2);
|
|
|
|
extern double l1_distance(Array_double *v1, Array_double *v2);
|
|
|
|
extern double linf_distance(Array_double *v1, Array_double *v2);
|
2023-10-11 17:56:20 -04:00
|
|
|
extern Array_double *copy_vector(Array_double *v1);
|
2023-10-30 21:07:43 -04:00
|
|
|
extern Array_double *add_element(Array_double *v, double x);
|
|
|
|
extern Array_double *slice_element(Array_double *v, size_t x);
|
2023-10-11 17:56:20 -04:00
|
|
|
extern void free_vector(Array_double *v);
|
2023-10-11 12:04:04 -04:00
|
|
|
extern void format_vector_into(Array_double *v, char *s);
|
2023-10-18 14:49:39 -04:00
|
|
|
extern int vector_equal(Array_double *a, Array_double *b);
|
2023-10-11 12:04:04 -04:00
|
|
|
|
2023-10-13 23:00:07 -04:00
|
|
|
extern Matrix_double *put_identity_diagonal(Matrix_double *m);
|
2023-10-13 19:20:17 -04:00
|
|
|
extern Matrix_double **lu_decomp(Matrix_double *m);
|
|
|
|
extern Array_double *bsubst(Matrix_double *u, Array_double *b);
|
|
|
|
extern Array_double *fsubst(Matrix_double *l, Array_double *b);
|
2023-10-30 21:07:43 -04:00
|
|
|
extern Array_double *solve_matrix_lu_bsubst(Matrix_double *m, Array_double *b);
|
|
|
|
extern Matrix_double *gaussian_elimination(Matrix_double *m);
|
|
|
|
extern Array_double *solve_matrix_gaussian(Matrix_double *m, Array_double *b);
|
2023-10-13 23:00:07 -04:00
|
|
|
extern Array_double *m_dot_v(Matrix_double *m, Array_double *v);
|
2023-10-23 12:17:03 -04:00
|
|
|
extern Matrix_double *m_dot_m(Matrix_double *a, Matrix_double *b);
|
2023-11-15 16:16:15 -05:00
|
|
|
extern Matrix_double *transpose(Matrix_double *m);
|
2023-10-23 12:17:03 -04:00
|
|
|
extern Array_double *col_v(Matrix_double *m, size_t x);
|
2023-10-13 23:00:07 -04:00
|
|
|
extern Matrix_double *copy_matrix(Matrix_double *m);
|
2023-10-30 21:07:43 -04:00
|
|
|
extern Matrix_double *add_column(Matrix_double *m, Array_double *col);
|
|
|
|
extern Matrix_double *slice_column(Matrix_double *m, size_t col);
|
2023-10-13 23:00:07 -04:00
|
|
|
extern void free_matrix(Matrix_double *m);
|
2023-10-11 17:56:20 -04:00
|
|
|
extern void format_matrix_into(Matrix_double *m, char *s);
|
2023-10-18 14:49:39 -04:00
|
|
|
extern int matrix_equal(Matrix_double *a, Matrix_double *b);
|
2023-10-11 12:04:04 -04:00
|
|
|
|
2023-10-13 23:00:07 -04:00
|
|
|
extern Line *least_squares_lin_reg(Array_double *x, Array_double *y);
|
|
|
|
|
2023-11-11 15:15:59 -05:00
|
|
|
extern Array_double *find_ivt_range(double (*f)(double), double start_x,
|
|
|
|
double delta, size_t max_steps);
|
|
|
|
extern Array_double *bisect_find_root(double (*f)(double), double a, double b,
|
|
|
|
double tolerance, size_t max_iterations);
|
2023-10-18 14:49:39 -04:00
|
|
|
extern double bisect_find_root_with_error_assumption(double (*f)(double),
|
|
|
|
double a, double b,
|
|
|
|
double tolerance);
|
2023-11-11 15:15:59 -05:00
|
|
|
extern double fixed_point_iteration_method(double (*f)(double),
|
|
|
|
double (*g)(double), double x_0,
|
|
|
|
double tolerance,
|
|
|
|
size_t max_iterations);
|
|
|
|
extern double fixed_point_newton_method(double (*f)(double),
|
|
|
|
double (*fprime)(double), double x_0,
|
|
|
|
double tolerance,
|
|
|
|
size_t max_iterations);
|
|
|
|
extern double fixed_point_secant_method(double (*f)(double), double x_0,
|
|
|
|
double x_1, double tolerance,
|
|
|
|
size_t max_iterations);
|
|
|
|
extern double fixed_point_secant_bisection_method(double (*f)(double),
|
|
|
|
double x_0, double x_1,
|
|
|
|
double tolerance,
|
|
|
|
size_t max_iterations);
|
2023-11-15 16:16:15 -05:00
|
|
|
|
|
|
|
extern double dominant_eigenvalue(Matrix_double *m, Array_double *v,
|
|
|
|
double tolerance, size_t max_iterations);
|
2023-11-27 15:27:49 -05:00
|
|
|
extern double least_dominant_eigenvalue(Matrix_double *m, Array_double *v,
|
|
|
|
double tolerance,
|
|
|
|
size_t max_iterations);
|
2023-11-15 16:30:39 -05:00
|
|
|
extern Matrix_double *leslie_matrix(Array_double *age_class_surivor_ratio,
|
|
|
|
Array_double *age_class_offspring);
|
2023-10-11 12:04:04 -04:00
|
|
|
#endif // LIZFCM_H
|