CommonFunctions

  Copyright (C) 2009-2015 Peter Rakyta, Ph.D.
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see http://www.gnu.org/licenses/.

Description

Provides a class for common functionalities.

Syntax

object = CommonFunctions()

References

Attributes (protected)

  • DeployedMKL

    True if MKL component is built, false otherwise.
  • version

    The current version of the package.
  • ProgramName

    Name of the package.
  • ProgramShortName

    Short name of the package.

Methods (public)

Methods (public static)

CommonFunctions::xmlread

Function to load XML files (based on xerces libraries), providing octave compatibility.

Syntax

tree = object.xmlread( filename )

Parameters
filename Absolute path to the file to be opened. (In matlab relative path is sufficient)

Return
tree The loaded document object model (see details here.)



CommonFunctions::xmlwrite

Function to export XML files (based on xerces libraries), providing octave compatibility.

Syntax

object.xmlwrite( filename, DOM )

Parameters
filename Absolute path to the file to be opened. (In matlab relative path is sufficient)
DOM The loaded document object model (see details here.)



CommonFunctions::IsDeployedMKL

Function to load XML files (based on xerces libraries), providing octave compatibility.

Syntax

ret = object.IsDeployedMKL()

Return
ret Returns with true if MKL component is deployed, false otherwise.



CommonFunctions::partialInv

Calculated a partial inverse of a sparse matrix. If MKL component is not developed, the backslash operator is used insted.

Syntax

invA = object.partialInv( A, sizeInv )

Parameters
A A sparse matrix to be inverted
sizeInv The size of partial inverse to be calculated. (sizeInv is measured from the right bottom corner of the matrix.)

Return
invA The calculated partial inverse.



CommonFunctions::diagInv

Calculates the diagonal part of the inverse of a sparse matrix. If MKL component is advised to build.

Syntax

invA = object.diagInv( A )

Parameters
A A sparse matrix to be inverted

Return
invA Returns the diagonal elements of the inverse.



CommonFunctions::eig

Calculates the generalized eigenvalue problem based on the zggev and dggev LAPACK functions.

Syntax

[eigenvecs_right, eigenvecs_left, eigvals] = object.eig( A, B )

Parameters
A A square matrix on the left side.
B A square matrix on the right side.

Return
eigenvecs_right The right handed eigenvectors.
eigenvecs_left The left handed eigenvectors.
eigvals The calculated eigenvalues.



CommonFunctions::getVersion

Gets the current version of the package.

Syntax

ret = object.getVersion()

Return
ret The current version of the package.



CommonFunctions::getProgramName

Gets the name of the package.

Syntax

ret = object.getProgramName()

Return
ret Returns the name of the package.



CommonFunctions::getProgramShortName

Gets the short name of the package.

Syntax

ret = object.getProgramShortName()

Return
ret Returns the short name of the package.



CommonFunctions::SimphsonInt

Simphson integral: y is a vector of function values at equal distant points: y_i = f(x_i), x_i-x_{i-1}=h.

Syntax

object.SimphsonInt( delta_phi, ribbon_loc )

Parameters
y Function values to be integrated
h Increment between the x_i points.



CommonFunctions::inv_SVD

Calculates the inverse of a badly conditioned matrix with SVD regularization.

Syntax

invA = object.inv_SVD( A )

Parameters
A The matrix to be inverted.

Return
invA The calculated inverse.



CommonFunctions::checkMEXfile

Checks the presence of a given MEX file.

Syntax

ret = object.checkMEXfile( fncname )

Parameters
fncname The name of the function.

Return
ret Returns true if the MEX file is present, false otherwise.



CommonFunctions::isOctave

Checks whether the running environment is matlab or octave.

Syntax

ret = object.isOctave()

Return
retval Returns true if running environment is octave, false otherwise.