Bioplib
Protein Structure C Library
|
Routines for finding the best fit line through a set of points. More...
#include <math.h>
#include <stdlib.h>
#include "pdb.h"
#include "array.h"
#include "macros.h"
#include "MathType.h"
#include "SysDefs.h"
#include "regression.h"
#include "eigen.h"
Go to the source code of this file.
Functions | |
BOOL | blCalculateBestFitLine (REAL **coordinates, int numberOfPoints, int numberOfDimensions, REAL *centroid, REAL *eigenVector) |
void | blFindCentroid (REAL **matrix, int numX, int numY, REAL *centroid) |
BOOL | blCalculateCovarianceMatrix (REAL **matrix, int numX, int numY, REAL **cov) |
Routines for finding the best fit line through a set of points.
This program is not in the public domain, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC
The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.
Definition in file regression.c.
BOOL blCalculateBestFitLine | ( | REAL ** | coordinates, |
int | numberOfPoints, | ||
int | numberOfDimensions, | ||
REAL * | centroid, | ||
REAL * | eigenVector | ||
) |
[in] | coordinates | 2D Array containing the coordinates |
[in] | numberOfPoints | The number of points in the array |
[in] | numberOfDimensions | The number of dimensions (usually 3) |
[out] | centroid | The centroid of the points |
[out] | eigenVector | The best Eigen vector |
Calculates a best fit line through a set of coordinates in 3D. The results are returned in 'eigenVector'
The code calculates the centroid and ouputs this. The covariance matrix is then calculated and the Eigen vectors and values of the covariance matrix are then calculated. The Eigenvalue with the largest Eigenvector represents the best fit line passing through the centroid.
Definition at line 116 of file regression.c.
[in] | matrix | The matrix |
[in] | numX | x-dimension of the matrix |
[in] | numY | y-dimension of the matrix |
[out] | cov | The covariance matrix |
Find the covariance matrix for a given matrix
Definition at line 254 of file regression.c.
[in] | matrix | Coordinate array |
[in] | numX | The x-dimension of the array |
[in] | numY | The y-dimension of the array |
[out] | centroid | The centroid of the points |
Calculates the centroid of an array of points
Definition at line 215 of file regression.c.