GOBNILP  f164d83
Functions
bge_matrix.c File Reference

Implements a Matrix Structure for floating point data and a set of matrix routines for scoring a Gaussian Network. More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <lapacke.h>
#include "bge_matrix.h"
#include "bge_vector.h"
Include dependency graph for bge_matrix.c:

Functions

void BgeMatrixAddition (Bge_Matrix *matrix_1, Bge_Matrix *matrix_2, Bge_Matrix *output_matrix)
 Adds two matrices together. More...
 
Bge_MatrixBgeMatrixCreate (int cols, int rows)
 Creates a new Matrix to be used by lapack routines. More...
 
void BgeMatrixDelete (Bge_Matrix **matrix)
 Deletes a particular matrix and frees the memory allocated. More...
 
double BgeMatrixLogDeterminant (Bge_Matrix *matrix)
 Computes the log determinant of a matrix (Only possible for square matrices) More...
 
void BgeMatrixScalarMultipliciation (double scalar, Bge_Matrix *matrix)
 Multiples a given matrix be a scalar (Real number) More...
 
void BgeMatrixSetPosteriorParentMatrix (Bge_Matrix *sub_posterior, Bge_Matrix *parent_posterior)
 Sets the posterior submatrix for a parent set of a node. More...
 
void BgeMatrixSetPosteriorSubMatrix (unsigned int *family, int no_nodes, Bge_Matrix *posterior_matrix, Bge_Matrix *submatrix)
 Returns the Posterior matrix restricted to a family of a node. More...
 
void BgeVectorOuterProduct (Bge_Vector *row_vector, Bge_Vector *col_vector, Bge_Matrix *output_matrix)
 Takes two vectors and computes their outer product. More...
 

Detailed Description

Implements a Matrix Structure for floating point data and a set of matrix routines for scoring a Gaussian Network.

Function Documentation

◆ BgeMatrixAddition()

void BgeMatrixAddition ( Bge_Matrix matrix_1,
Bge_Matrix matrix_2,
Bge_Matrix output_matrix 
)

Adds two matrices together.

Parameters
matrix_1matrix to be added
matrix_2matrix to be added
Returns
output matrix for the addition of matrix_1 and matrix_2

Referenced by SetPosteriorParametricMatrix(), and SetSampleVariance().

◆ BgeMatrixCreate()

Bge_Matrix* BgeMatrixCreate ( int  cols,
int  rows 
)

Creates a new Matrix to be used by lapack routines.

Parameters
col_dimensionThe number of columns of the matrix
row_dimensionThe number of rows of the matrix
Returns
A pointer to a matrix with dimensions row_dimension * col_dimension

Referenced by lookup(), SetPosteriorParametricMatrix(), and SetSampleVariance().

◆ BgeMatrixDelete()

void BgeMatrixDelete ( Bge_Matrix **  matrix)

Deletes a particular matrix and frees the memory allocated.

Parameters
matrixThe matrix to be deleted

Referenced by SetPosteriorParametricMatrix(), and SetSampleVariance().

◆ BgeMatrixLogDeterminant()

double BgeMatrixLogDeterminant ( Bge_Matrix matrix)

Computes the log determinant of a matrix (Only possible for square matrices)

Parameters
Bge_Matrix**The matrix for which the log determinant is to be calculated
Returns
The resulting value of the log determinant

◆ BgeMatrixScalarMultipliciation()

void BgeMatrixScalarMultipliciation ( double  scalar,
Bge_Matrix matrix 
)

Multiples a given matrix be a scalar (Real number)

Parameters
scalarEach item in the matrix is mulitlplied by this number
Bge_Matrix*The matrix that is to be multiplied by the scalar

Referenced by SetPosteriorParametricMatrix().

◆ BgeMatrixSetPosteriorParentMatrix()

void BgeMatrixSetPosteriorParentMatrix ( Bge_Matrix sub_posterior,
Bge_Matrix parent_posterior 
)

Sets the posterior submatrix for a parent set of a node.

Parameters
Bge_Matrix*the posterior matrix restricted to the node and its parents
Bge_Matrix*the posterior matrix restricted to the parents (output)

◆ BgeMatrixSetPosteriorSubMatrix()

void BgeMatrixSetPosteriorSubMatrix ( unsigned int *  family,
int  no_nodes,
Bge_Matrix posterior_matrix,
Bge_Matrix submatrix 
)

Returns the Posterior matrix restricted to a family of a node.

Parameters
familyA set of nodes that contains a node and its parents
no_nodesThe number of nodes in the family
Bge_Matrix*Posterior_matrix the posterior matrix
Bge_Matrix*Submatrix the posterior matrix restricted to the variables in the family set

◆ BgeVectorOuterProduct()

void BgeVectorOuterProduct ( Bge_Vector row_vector,
Bge_Vector col_vector,
Bge_Matrix output_matrix 
)

Takes two vectors and computes their outer product.

Parameters
row_vectorFirst vector
col_vectorSecond vector
Returns
The outer product of vec_1 and vec_2 stored in a Bge_Matrix

References Bge_Vector::capacity, and Bge_Vector::items.

Referenced by SetPosteriorParametricMatrix(), and SetSampleVariance().