KernelMatrix Class Reference

#include <kernel-matrix.h>

List of all members.


Detailed Description

Data structure for a square symmetric matrix.


Public Member Functions

 KernelMatrix ()
 Creates an empty (0x0) matrix.
 KernelMatrix (int size)
 Creates a (size x size) identity matrix.
int GetSize () const
 Gets the current size of the matrix.
void Normalize ()
 Normalizes by dividing k[r][c] by sqrt(k[r][r] * k[c][c]).
void NormalizeByMinCardinality (const vector< int > &cards)
 Normalize by min cardinality.
void Resize (int new_size)
 Resizes the matrix.
double & at (int row, int col)
 Get a ref to the kernel value at row, col.
double at (int row, int col) const
 Get the kernel value at row, col.
void WriteToStream (ostream &output_stream) const
 Write the matrix to a stream.
void WriteToFile (const char *filename) const
 Write the matrix to a stream.
void ReadFromStream (istream &input_stream)
 Replaces all data in this matrix with new data from the stream.
void ReadFromFile (const char *filename)
 Replaces all data in this matrix with new data from the file.


Constructor & Destructor Documentation

KernelMatrix (  )  [inline]

Creates an empty (0x0) matrix.

KernelMatrix ( int  size  ) 

Creates a (size x size) identity matrix.


Member Function Documentation

int GetSize (  )  const

Gets the current size of the matrix.

void Normalize (  ) 

Normalizes by dividing k[r][c] by sqrt(k[r][r] * k[c][c]).

void NormalizeByMinCardinality ( const vector< int > &  cards  ) 

Normalize by min cardinality.

Requires cards.size() == GetSize(). cards[i] is the cardinality of the ith set. This function will divide k[r][c] by the minimum of cards[r] and cards[c].

See also:
PointSetList::GetSetCardinalities()

void Resize ( int  new_size  ) 

Resizes the matrix.

Warning: this can cause data loss if you are shrinking the matrix. If rows are added, any new elements on the diagonal are initialized to 1, all other new elements are 0.

double & at ( int  row,
int  col 
)

Get a ref to the kernel value at row, col.

This allows you to do things like kernel.at(1, 3) = 37; KernelMatrix will automatically maintain symmetry, so that after you do this, if you call kernel.at(3, 1), it will be 37.

double at ( int  row,
int  col 
) const

Get the kernel value at row, col.

void WriteToStream ( ostream &  output_stream  )  const

Write the matrix to a stream.

File format:

Aborts if the stream is bad.

void WriteToFile ( const char *  filename  )  const

Write the matrix to a stream.

See also:
WriteToStream

void ReadFromStream ( istream &  input_stream  ) 

Replaces all data in this matrix with new data from the stream.

Aborts if the stream is bad. See WriteToStream() for the file format.

See also:
WriteToStream()

void ReadFromFile ( const char *  filename  ) 

Replaces all data in this matrix with new data from the file.

See also:
ReadFromStream


The documentation for this class was generated from the following files:
Generated on Wed May 2 11:17:13 2007 for libpmk by  doxygen 1.5.1