The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
regression.c File Reference

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)
 

Detailed Description

Routines for finding the best fit line through a set of points.

Version
V1.0
Date
08.10.14
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

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.

Description:

Usage:

Revision History:

Definition in file regression.c.

Function Documentation

BOOL blCalculateBestFitLine ( REAL **  coordinates,
int  numberOfPoints,
int  numberOfDimensions,
REAL centroid,
REAL eigenVector 
)
Parameters
[in]coordinates2D Array containing the coordinates
[in]numberOfPointsThe number of points in the array
[in]numberOfDimensionsThe number of dimensions (usually 3)
[out]centroidThe centroid of the points
[out]eigenVectorThe best Eigen vector
Returns
Success?

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.

  • 07.10.14 Original By: ACRM Based on code by Abhi Raghavan

Definition at line 116 of file regression.c.

BOOL blCalculateCovarianceMatrix ( REAL **  matrix,
int  numX,
int  numY,
REAL **  cov 
)
Parameters
[in]matrixThe matrix
[in]numXx-dimension of the matrix
[in]numYy-dimension of the matrix
[out]covThe covariance matrix
Returns
Success

Find the covariance matrix for a given matrix

  • 07.10.14 Original By: ACRM (based on code by Abhi Raghavan)

Definition at line 254 of file regression.c.

void blFindCentroid ( REAL **  matrix,
int  numX,
int  numY,
REAL centroid 
)
Parameters
[in]matrixCoordinate array
[in]numXThe x-dimension of the array
[in]numYThe y-dimension of the array
[out]centroidThe centroid of the points

Calculates the centroid of an array of points

  • 07.10.14 Original By: ACRM

Definition at line 215 of file regression.c.