SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
python.toolsExtended Namespace Reference

Functions

 buildAlphaVector (filename)
 Wrapper for buildCoefficientVectorFromFile.
 
 buildCoefficientVectorFromFile (filename)
 Builds the data vector that hold the coefficients fo either the ansatzfuctions or the node base re.sub(regex, replacement, subject)
 
 buildNodevalueVector (filename)
 Wrapper for buildCoefficientVectorFromFile.
 
 buildTrainingVector (data)
 Builds the training data vector.
 
 compareBBTMatrices (m1, m2)
 Compares, if two BBT matrices are "almost" equal.
 
 compareBTMatrices (m1, m2)
 Compares, if two BT matrices are "almost" equal.
 
 compareResultFiles (file1, file2)
 Compares two files and calculates the maximum difference between the values.
 
 doDehierarchisation (alpha, grid)
 hierarchisation of the node base values on a grid
 
 doHierarchisation (node_values, grid)
 hierarchisation of the node base values on a grid
 
 evalFunction (function, points)
 evalutes a given function
 
 generateBBTMatrix (factory, training, verbose=False)
 Generates the BBT DM Matrix for a given grid using numpy.
 
 generateBBTMatrixPython (factory, training, verbose=False)
 Generates the BBT DM Matrix for a given grid only using python arrays.
 
 generateBTMatrix (factory, training, verbose=False)
 Generates the BT DM Matrix for a given grid using numpy.
 
 generateBTMatrixPython (factory, training, verbose=False)
 Generates the BT DM Matrix for a given grid only using python arrays.
 
 generateCMatrix (factory, verbose=False)
 Generates the Laplace Matrix for a given grid using numpy.
 
 openFile (filename)
 Opens a file and returns the stored data.
 
 printNDFunction (filename, filenameValue, grid, alpha, resolution)
 This allows to evaluate a multidimensional function.
 
 printPoint (p, grid, alpha, fout, foutvalue)
 Here a evaluate point on a Sparse Grid is written to a file.
 
 printRefNDFunction (filename, filenameValue, function, resolution, dim)
 This allows to evaluate a multidimensional function.
 
 printRefPoint (points, dim, function, fout, foutvalue)
 Writes reference points to a given file.
 
 readDataVector (filename)
 Reads a DataVector.
 
 readReferenceMatrix (storage, filename)
 Reads a Reference matrix and returns it.
 
 recGenPrintRefVector (dim_rem, dim, points, function, resolution, fout, foutvalue)
 Recursive generation of the function's coordinate string.
 
 recGenPrintVector (dim_rem, p, grid, alpha, resolution, fout, foutvalue)
 Evaluates a mutlidimensional function on a Sparse Grid.
 
 testHierarchisationResults (node1, node2)
 tests the correctness of the hierarchisation and dehierachisation
 
 writeMatrixToFile (filename, matrix, n, m)
 Writes matrix stored in numpy format into a file.
 

Function Documentation

◆ buildAlphaVector()

python.toolsExtended.buildAlphaVector (   filename)

Wrapper for buildCoefficientVectorFromFile.

Parameters
filenamename of the ARFF file that contains the ansatzfunction coefficients
Returns
a instance of a DataVector that stores ansatzfunction coefficients

References python.toolsExtended.buildCoefficientVectorFromFile().

◆ buildCoefficientVectorFromFile()

python.toolsExtended.buildCoefficientVectorFromFile (   filename)

Builds the data vector that hold the coefficients fo either the ansatzfuctions or the node base re.sub(regex, replacement, subject)

Parameters
filenamename of the ARFF file that contains the coefficients
Returns
a instance of a DataVector that stores coefficients

Referenced by python.toolsExtended.buildAlphaVector(), and python.toolsExtended.buildNodevalueVector().

◆ buildNodevalueVector()

python.toolsExtended.buildNodevalueVector (   filename)

Wrapper for buildCoefficientVectorFromFile.

Parameters
filenamename of the ARFF file that contains the node base coefficients
Returns
a instance of a DataVector that stores node base coefficients

References python.toolsExtended.buildCoefficientVectorFromFile().

◆ buildTrainingVector()

python.toolsExtended.buildTrainingVector (   data)

Builds the training data vector.

Parameters
dataa list of lists that contains the points a the training data set, coordinate-wise
Returns
a instance of a DataVector that stores the training data

◆ compareBBTMatrices()

python.toolsExtended.compareBBTMatrices (   m1,
  m2 
)

Compares, if two BBT matrices are "almost" equal.

Has to handle the problem that the underlying grid was ordered differently. Uses heuristics, e.g. whether the diagonal elements and row and column sums match. and prints the result for each element

Parameters
m1the first matrix
m2the second matrix

◆ compareBTMatrices()

python.toolsExtended.compareBTMatrices (   m1,
  m2 
)

Compares, if two BT matrices are "almost" equal.

Has to handle the problem that the underlying grid was ordered differently. Uses heuristics, e.g. whether the row and column sums match. and prints the result for each element

Parameters
m1the first matrix
m2the second matrix

◆ compareResultFiles()

python.toolsExtended.compareResultFiles (   file1,
  file2 
)

Compares two files and calculates the maximum difference between the values.

Parameters
file1the first file
file2the second file
Returns
the maximum detected difference between two components

◆ doDehierarchisation()

python.toolsExtended.doDehierarchisation (   alpha,
  grid 
)

hierarchisation of the node base values on a grid

Parameters
alphaDataVector that holds the coefficients of the sparse grid's ansatzfunctions
gridthee grid matching to the alpha vector

◆ doHierarchisation()

python.toolsExtended.doHierarchisation (   node_values,
  grid 
)

hierarchisation of the node base values on a grid

Parameters
node_valuesDataVector that holds the coefficients of the function's node base
gridthe grid matching to the node_vector

◆ evalFunction()

python.toolsExtended.evalFunction (   function,
  points 
)

evalutes a given function

Parameters
functiona string the gives the function; x1...xn must be the names of the placeholders
pointssorted list of the coordinates (x1...xn) of evaluation point
Returns
returns the function value at points

Referenced by python.toolsExtended.printRefPoint().

◆ generateBBTMatrix()

python.toolsExtended.generateBBTMatrix (   factory,
  training,
  verbose = False 
)

Generates the BBT DM Matrix for a given grid using numpy.

Parameters
factorythe grid object
trainingDataVector to contains the used training data
verbosedefault:False prints some additional information

◆ generateBBTMatrixPython()

python.toolsExtended.generateBBTMatrixPython (   factory,
  training,
  verbose = False 
)

Generates the BBT DM Matrix for a given grid only using python arrays.

Parameters
factorythe grid object
trainingDataVector to contains the used training data
verbosedefault:False prints some additional information

◆ generateBTMatrix()

python.toolsExtended.generateBTMatrix (   factory,
  training,
  verbose = False 
)

Generates the BT DM Matrix for a given grid using numpy.

Parameters
factorythe grid object
trainingDataVector to contains the used training data
verbosedefault:False prints some additional information

◆ generateBTMatrixPython()

python.toolsExtended.generateBTMatrixPython (   factory,
  training,
  verbose = False 
)

Generates the BT DM Matrix for a given grid only using python arrays.

Parameters
factorythe grid object
trainingDataVector to contains the used training data
verbosedefault:False prints some additional information

◆ generateCMatrix()

python.toolsExtended.generateCMatrix (   factory,
  verbose = False 
)

Generates the Laplace Matrix for a given grid using numpy.

Parameters
factorythe grid object
verbosedefault:False prints some additional information

◆ openFile()

python.toolsExtended.openFile (   filename)

Opens a file and returns the stored data.

Parameters
filenameof file to open
Returns
the data stored in the file

◆ printNDFunction()

python.toolsExtended.printNDFunction (   filename,
  filenameValue,
  grid,
  alpha,
  resolution 
)

This allows to evaluate a multidimensional function.

Parameters
filenamefilename of file with coordinates and function values
filenameValuefilename of file with function values only
gridreference to the Sparse Grid
alphahierarchical surplus of the Sparse Grid's Ansatzfunctions
resolutionnumber of evaluating points

References python.toolsExtended.recGenPrintVector().

◆ printPoint()

python.toolsExtended.printPoint (   p,
  grid,
  alpha,
  fout,
  foutvalue 
)

Here a evaluate point on a Sparse Grid is written to a file.

Parameters
pDataVector containing the coordinates of the point
gridreference to the Sparse Grid
alphahierarchical surplus of the Sparse Grid's Ansatzfunctions
foutfilehandle to result file, containing the coordinates and value
foutvaluefilehandle to resultfile, containing only the value

Referenced by python.toolsExtended.recGenPrintVector().

◆ printRefNDFunction()

python.toolsExtended.printRefNDFunction (   filename,
  filenameValue,
  function,
  resolution,
  dim 
)

This allows to evaluate a multidimensional function.

Parameters
filenamefilename of file with coordinates and function values
filenameValuefilename of file with function values only
functionstring that describes the function to evaluate
resolutionnumber of evaluating points
dimdimension of function

References python.toolsExtended.recGenPrintRefVector().

◆ printRefPoint()

python.toolsExtended.printRefPoint (   points,
  dim,
  function,
  fout,
  foutvalue 
)

Writes reference points to a given file.

Parameters
pointsstring containing the evaluation potins
dimthe dimension of the function
functionstring that describes the function to evaluate
foutfilehandle to result file, containing the coordinates and value
foutvaluefilehandle to resultfile, containing only the value

References python.toolsExtended.evalFunction().

Referenced by python.toolsExtended.recGenPrintRefVector().

◆ readDataVector()

python.toolsExtended.readDataVector (   filename)

Reads a DataVector.

Parameters
filenamethe filename of the file that contains the data
Returns
returns a data Vector

◆ readReferenceMatrix()

python.toolsExtended.readReferenceMatrix (   storage,
  filename 
)

Reads a Reference matrix and returns it.

Parameters
storagestorage of the grid
filenamethe filename of the file that contains the reference data
Returns
returns a python array with the reference matrix

References python.tools.gzOpen().

◆ recGenPrintRefVector()

python.toolsExtended.recGenPrintRefVector (   dim_rem,
  dim,
  points,
  function,
  resolution,
  fout,
  foutvalue 
)

Recursive generation of the function's coordinate string.

Parameters
dim_remremaining dimensions
dimdimension of function
pointscurrent coordinate string
functionstring that describes the function to evaluate
resolutionnumber of supporting points
foutfilehandle to result file, containing the coordinates and value
foutvaluefilehandle to resultfile, containing only the value

References python.toolsExtended.printRefPoint(), and python.toolsExtended.recGenPrintRefVector().

Referenced by python.toolsExtended.printRefNDFunction(), and python.toolsExtended.recGenPrintRefVector().

◆ recGenPrintVector()

python.toolsExtended.recGenPrintVector (   dim_rem,
  p,
  grid,
  alpha,
  resolution,
  fout,
  foutvalue 
)

Evaluates a mutlidimensional function on a Sparse Grid.

Parameters
dim_remremaining dimensions
pDataVector containing the coordinates of the point
gridreference to the Sparse Grid
alphahierarchical surplus of the Sparse Grid's Ansatzfunctions
resolutionnumber of evaluating points
foutfilehandle to result file, containing the coordinates and value
foutvaluefilehandle to resultfile, containing only the value

References python.toolsExtended.printPoint(), and python.toolsExtended.recGenPrintVector().

Referenced by python.toolsExtended.printNDFunction(), and python.toolsExtended.recGenPrintVector().

◆ testHierarchisationResults()

python.toolsExtended.testHierarchisationResults (   node1,
  node2 
)

tests the correctness of the hierarchisation and dehierachisation

Parameters
node1the vector of the node base values before hierarchisation and dehierarchisation
node2the vector of the node base values after hierarchisation and dehierarchisation
Returns
maximum error during the transformations

◆ writeMatrixToFile()

python.toolsExtended.writeMatrixToFile (   filename,
  matrix,
  n,
  m 
)

Writes matrix stored in numpy format into a file.

Parameters
filenamefile's filename to which the data is written
matrixthe matrix that should be stored
nnumber of rows
mnumber of columns