| 1 |
#ifndef _Matrix_extensions_h_ |
| 2 |
#define _Matrix_extensions_h_ |
| 3 |
/* Matrix_extensions.h |
| 4 |
* |
| 5 |
* Copyright (C) 1993-2020 David Weenink |
| 6 |
* |
| 7 |
* This code is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 10 |
* your option) any later version. |
| 11 |
* |
| 12 |
* This code is distributed in the hope that it will be useful, but |
| 13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
* General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
djmw 20020813 GPL header |
| 23 |
djmw 20121110 Latest modification |
| 24 |
*/ |
| 25 |
|
| 26 |
#include "Matrix.h" |
| 27 |
#include "Eigen.h" |
| 28 |
#include "Graphics.h" |
| 29 |
#include "Graphics_extensions.h" |
| 30 |
#include "SVD.h" |
| 31 |
|
| 32 |
autoMatrix Matrix_readFromIDXFormatFile (MelderFile file); |
| 33 |
autoDaata IDXFormattedMatrixFileRecognizer (integer numberOfBytesRead, const char *header, MelderFile file); |
| 34 |
|
| 35 |
void Matrix_scatterPlot (Matrix me, Graphics g, integer icx, integer icy, |
| 36 |
double xmin, double xmax, double ymin, double ymax, |
| 37 |
double size_mm, conststring32 mark, bool garnish); |
| 38 |
/* Draw my columns ix and iy as a scatterplot (with squares) */ |
| 39 |
|
| 40 |
void Matrix_drawAsSquares_inside (Matrix me, Graphics g, double xmin, double xmax, double ymin, double ymax, kGraphicsMatrixOrigin origin, double cellAreaScaleFactor, kGraphicsMatrixCellDrawingOrder drawingOrder); |
| 41 |
|
| 42 |
void Matrix_drawAsSquares (Matrix me, Graphics graphics, double xmin, double xmax, double ymin, double ymax, bool garnished); |
| 43 |
/* Draw a Matrix as small squares whose area correspond to the matrix element */ |
| 44 |
/* The square is filled with black if the weights are negative */ |
| 45 |
|
| 46 |
void Matrix_drawRowsAsLineSegments (Matrix me, Graphics g, double xmin, double xmax, double ymin, double ymax, |
| 47 |
double minimum, double maximum, int connect); |
| 48 |
/* draw a row as segments */ |
| 49 |
|
| 50 |
void Matrix_scale (Matrix me, int choice); |
| 51 |
/* choice = 1 :divide each elmnt by the maximum (abs) */ |
| 52 |
/* choice = 2 :rows, divide each row elmnt by the maximum (abs) of that row */ |
| 53 |
/* choice = 3 :columns, divide each col elmnt by the maximum of that col */ |
| 54 |
|
| 55 |
autoMatrix Matrix_transpose (Matrix me); |
| 56 |
|
| 57 |
void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax, |
| 58 |
double ymin, double ymax, double minimum, double maximum, integer nBins, |
| 59 |
double freqMin, double freqmax, bool cumulative, bool garnish); |
| 60 |
|
| 61 |
void Matrix_drawSliceY (Matrix me, Graphics g, double x, double ymin, double ymax, |
| 62 |
double min, double max); |
| 63 |
|
| 64 |
int Matrix_fitPolynomial (Matrix me, integer maxDegree); |
| 65 |
|
| 66 |
autoMatrix Matrix_solveEquation (Matrix me, double tolerance); |
| 67 |
|
| 68 |
autoMatrix Matrix_solveEquation (Matrix me, Matrix thee, double tolerance); // Me * X = Thee |
| 69 |
|
| 70 |
double Matrix_getMean (Matrix me, double xmin, double xmax, double ymin, double ymax); |
| 71 |
|
| 72 |
double Matrix_getStandardDeviation (Matrix me, double xmin, double xmax, double ymin, double ymax); |
| 73 |
|
| 74 |
autoEigen Matrix_to_Eigen (Matrix me); // deprecated feb 2026 |
| 75 |
/* Symmetric matrix */ |
| 76 |
|
| 77 |
autoEigen Matrix_to_Eigen_special (Matrix me, kMAT_TYPE matType, integer numberOfEigenvalues, bool sortAscending); |
| 78 |
/* Symmetric and symmetric tridiagonal matrices have real eigenvalues and eigenvectors. */ |
| 79 |
|
| 80 |
autoMatrix SVD_to_Matrix (SVD me, integer from, integer to); |
| 81 |
|
| 82 |
void Matrix_Eigen_complex (Matrix me, autoMatrix *out_eigenvectors, autoMatrix *out_eigenvalues); |
| 83 |
/* General square matrix */ |
| 84 |
|
| 85 |
#endif /* _Matrix_extensions_h_ */ |