Bsoft 2.1.4
Bernard's software package
matrix.cpp File Reference

Matrix manipulation functions. More...

#include "Matrix.h"
#include "matrix_linear.h"
#include "math_util.h"
#include "random_numbers.h"
#include "utilities.h"

Macros

#define SQR(x)   ((x)*(x))
 

Functions

ostream & operator<< (ostream &output, Matrix &mat)
 
Vector3< double > principal_axes (Vector3< double > avg, Vector3< double > avg2, Vector3< double > avgx, Vector3< double > *eigenvec)
 Calculates the principal axes of 3D coordinates. More...
 
Vector3< double > principal_axes (vector< Vector3< double > > &coor, Matrix &a)
 Calculates the principal axes of 3D coordinates. More...
 
void dsytrd3 (Matrix &A, vector< double > &d, vector< double > &e)
 Reduces a symmetric 3x3 matrix to tridiagonal form. More...
 
vector< double > dsyevq3 (Matrix &A)
 Calculates the eigenvalues and normalized eigenvectors of a symmetric 3x3 matrix. More...
 

Variables

int verbose
 

Detailed Description

Matrix manipulation functions.

Author
Bernard Heymann
Date
Created: 20000501
Modified: 20180723

Macro Definition Documentation

◆ SQR

#define SQR (   x)    ((x)*(x))

Function Documentation

◆ dsyevq3()

vector< double > dsyevq3 ( Matrix A)

Calculates the eigenvalues and normalized eigenvectors of a symmetric 3x3 matrix.

Parameters
Amatrix, replaced by normalized eigenvectors.
Returns
double* eigenvalues.
Calculates the eigenvalues and normalized eigenvectors of a symmetric 3x3
matrix A using the QL algorithm with implicit shifts, preceded by a
Householder reduction to tridiagonal form.
The function accesses only the diagonal and upper triangular parts of A.
Reference: Kopp (2008).

◆ dsytrd3()

void dsytrd3 ( Matrix A,
vector< double > &  d,
vector< double > &  e 
)

Reduces a symmetric 3x3 matrix to tridiagonal form.

Parameters
Amatrix, replaced by tridiagonal matrix.
ddiagonal.
eoff-diagonal.
Reduces a symmetric 3x3 matrix to tridiagonal form by applying
(unitary) Householder transformations:
            [ d[0]  e[0]       ]
    A = Q . [ e[0]  d[1]  e[1] ] . Q^T
            [       e[1]  d[2] ]
The function accesses only the diagonal and upper triangular parts of A.
Reference: Kopp (2008).

◆ operator<<()

ostream & operator<< ( ostream &  output,
Matrix mat 
)

◆ principal_axes() [1/2]

Vector3< double > principal_axes ( Vector3< double >  avg,
Vector3< double >  avg2,
Vector3< double >  avgx,
Vector3< double > *  eigenvec 
)

Calculates the principal axes of 3D coordinates.

Parameters
avgaverage of vectors.
avg2average of squared vectors.
avgxaverage of cross products {xy, xz, yz}.
*eigenvec3 return eigen vectors (can be NULL).
Returns
Vector3<double> principal axes.

Reference: Press W.H. et al (1992) Numerical Recipes in C.

◆ principal_axes() [2/2]

Vector3< double > principal_axes ( vector< Vector3< double > > &  coor,
Matrix a 
)

Calculates the principal axes of 3D coordinates.

Parameters
coorvector of coordinates.
&amatrix with eigen vectors.
Returns
Vector3<double> principal axes.

Reference: Press W.H. et al (1992) Numerical Recipes in C.

Variable Documentation

◆ verbose

int verbose
extern