tico 0.1
Mechanical Watch Terminal Timegrapher
mymath.h
Go to the documentation of this file.
1#pragma once
2
3#include "myarr.h"
4
5#include <stddef.h>
6
20void transpone(double* arr, unsigned int Nrows, unsigned int Ncols);
21
30void invert(double* arr, unsigned int Nrows, unsigned int Ncols);
31
44double* mulmat(const double* matrix0,
45 unsigned int Nrows,
46 unsigned int Ncols,
47 const double* matrix1,
48 unsigned int Mrows,
49 unsigned int Mcols);
50
64void matlinreg(double coeffs[2],
65 const double* xmat,
66 unsigned int Nrows,
67 unsigned int Ncols,
68 double* vec,
69 const double* weight);
70
83void fitNpeaks(double* intercept,
84 double* slope,
85 unsigned int curPos,
86 const struct myarr* maxvals,
87 const struct myarr* maxes,
88 const struct myarr* subpos,
89 unsigned int npeaks,
90 double SDthreshold);
91
102void fastlinreg(double coeffs[2],
103 const double* xmat,
104 unsigned int Npoints,
105 const double* vec,
106 const double* weightArr);
107
115size_t getmaxpos(const int* array, size_t ArrayLength);
116
127void linreg(const double* xarr,
128 const double* yarr,
129 size_t ArrayLength,
130 double* intercept,
131 double* slope,
132 double* stdev);
133
141int shiftHalf(size_t value, size_t ArrayLength);
142
int shiftHalf(size_t value, size_t ArrayLength)
Shifts a value by half the array length, wrapping around.
Definition: mymath.c:544
void invert(double *arr, unsigned int Nrows, unsigned int Ncols)
Inverts a square matrix in-place.
Definition: mymath.c:85
void transpone(double *arr, unsigned int Nrows, unsigned int Ncols)
Transposes a matrix in-place.
Definition: mymath.c:66
void linreg(const double *xarr, const double *yarr, size_t ArrayLength, double *intercept, double *slope, double *stdev)
Performs simple linear regression on two arrays.
Definition: mymath.c:34
void fitNpeaks(double *intercept, double *slope, unsigned int curPos, const struct myarr *maxvals, const struct myarr *maxes, const struct myarr *subpos, unsigned int npeaks, double SDthreshold)
Fits a line to N peaks in the data, with outlier rejection.
Definition: mymath.c:421
void fastlinreg(double coeffs[2], const double *xmat, unsigned int Npoints, const double *vec, const double *weightArr)
Performs fast weighted linear regression.
Definition: mymath.c:231
double * mulmat(const double *matrix0, unsigned int Nrows, unsigned int Ncols, const double *matrix1, unsigned int Mrows, unsigned int Mcols)
Multiplies two matrices and returns the result as a new matrix.
Definition: mymath.c:136
void matlinreg(double coeffs[2], const double *xmat, unsigned int Nrows, unsigned int Ncols, double *vec, const double *weight)
Performs linear regression on a dataset with optional weighting.
Definition: mymath.c:168
size_t getmaxpos(const int *array, size_t ArrayLength)
Returns the index of the maximum value in an integer array.
Definition: mymath.c:19
A struct to hold an array of integers or an array of doubles, along with the length of the arrays.
Definition: myarr.h:14