1// This file is part of SmallBASIC
2//
3// Math RTL
4//
5// This program is distributed under the terms of the GPL v2.0 or later
6// Download the GNU Public License (GPL) from www.gnu.org
7//
8// Copyright(C) 2000 Nicholas Christopoulos
9
10/**
11 * @defgroup math Mathematics
12 */
13
14#if !defined(_blib_math_h)
15#define _blib_math_h
16
17#include "common/sys.h"
18
19var_num_t fint(var_num_t x);
20var_num_t frac(var_num_t x);
21int sgn(var_num_t x);
22var_num_t fround(var_num_t x, int dig);
23
24#define PTSIGN(Ax,Ay,Bx,By,Qx,Qy) (ZSGN((Qx) * ((Ay) - (By)) + (Qy) * \
25 ((Bx) - (Ax)) + (Ax) * (By) - (Ay) * (Bx)))
26/**< sign of a point(Q) from a line-segment(A->B) @ingroup math */
27
28/**
29 * @ingroup math
30 *
31 * solve linear equations. Gauss-Jordan method.
32 *
33 * the result will stored on 'b'
34 *
35 * @param a is the first table
36 * @param b is the second table
37 * @param n is the number of the rows
38 * @param toler is the smallest acceptable number
39 */
40void mat_gauss_jordan(var_num_t *a, var_num_t *b, int n, double toler);
41
42/**
43 * @ingroup math
44 *
45 * converts the matrix A to its inverse.
46 *
47 * @param a is the matrix
48 * @param n is the number of rows/cols
49 */
50void mat_inverse(var_num_t *a, int n);
51
52void mat_det2(var_num_t t, int m, int k, var_num_t *a, int *done, var_num_t *v, int n, double toler)
53 ;
54
55/**
56 * @ingroup math
57 *
58 * determinant of A
59 *
60 * @param a is the matrix
61 * @param n is the rows/cols of A
62 * @param toler is the smallest acceptable number
63 * @return the determinant of A
64 */
65var_num_t mat_determ(var_num_t *a, int n, double toler);
66
67/**
68 * @ingroup math
69 * todo: statmeandev
70 */
71var_num_t statmeandev(var_num_t *e, int count);
72
73/**
74 * @ingroup math
75 * todo: statspreads
76 */
77var_num_t statspreads(var_num_t *e, int count);
78
79/**
80 * @ingroup math
81 * todo: statspreadp
82 */
83var_num_t statspreadp(var_num_t *e, int count);
84
85#endif
86