KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
data.FileTrajectoryData Class Reference

FileTrajectoryData: Trajectory data stored in external files. More...

Detailed Description

FileTrajectoryData: Trajectory data stored in external files.

The constructor takes an optional storage_root parameter. If given, it must be a valid folder in the file system. If not given, the value set in KerMor.App.DataDirectory is used.

Author
Daniel Wirtz
Date
2011-08-04
Change in 0.6:
(Daniel Wirtz, 2012-04-27) Added an internal property host to the class in order to record on which machine the FileTrajectoryData instance was created on. When saved and loaded at another machine, the dictionary will be cleared if the same path does not exist anymore on the new machine.
New in 0.5:
(Daniel Wirtz, 2011-11-02) Implemented the getBoundingBox method from superclass. Now keeping track of bounding box while adding trajectories.
New in 0.5:
(Daniel Wirtz, 2011-10-14) Added a new consolidate method in order to rebuild the internal index hashmap from the files in a directory and the data.ATrajectoryData.ParamSamples. This method is called after parallel trajectory computation as the remotely constructed hashmaps are not joint back together as one.
New in 0.5:
(Daniel Wirtz, 2011-08-04) Added this class.

This class is part of the framework

KerMor - Model Order Reduction using Kernels

Definition at line 18 of file FileTrajectoryData.m.

Public Member Functions

 FileTrajectoryData (datadir)
 Creates a new filesystem-based trajectory data container. More...
 
function [ colvec< double > x ,
double
ctime ] = 
getTrajectory (colvec< double > mu,integer inputidx)
 Gets a system's trajectory for the given \(\mu\) and inputindex. Returns [] if no trajectory is found in the Data's Snapshots. More...
 
function n = getNumTrajectories ()
 Gets the total number of trajectories. More...
 
function [ colvec< double > x ,
colvec
< double > mu ,
integer
inputidx , double ctime ] = 
getTrajectoryNr (nr)
 Gets the trajectory with the number nr. More...
 
function  addTrajectory (colvec< double > x,colvec< double > mu,integer inputidx,double ctime)
 Adds a trajectory to the ModelData instance. More...
 
function lgetTotalLength ()
 Length of the stored trajectories. More...
 
function  clearTrajectories ()
 Clears all stored trajectory data. More...
 
function  consolidate (models.BaseFullModel model)
 Rebuild the hashmap for the current FileData using the current ParamSamples and the models training inputs. More...
 
function [ colvec< double > x ,
X ] = 
getBoundingBox ()
 Gets the bounding box of the state space of all trajectories. More...
 
function [ d ,
mud ] = 
getTrajectoryDoFs ()
 Returns the degrees of freedom for the trajectories and parameter size. More...
 
- Public Member Functions inherited from data.ATrajectoryData
function  transferFrom (data.ATrajectoryData source)
 Transfers the data from one ATrajectoryData instance to another. More...
 
function [ double t , dia ,
m ,
M ] = 
computeManifoldDiameters ()
 
function n = getNumBlocks ()
 % data.ABlockedData implementations More...
 
function B = getBlock (nr)
 
function [ n ,
m ] = 
size (dim)
 
- Public Member Functions inherited from data.ABlockedData
function [ matrix< double > U ,
matrix
< double > S , matrix< double > V ] = 
getSVD (integer k,matrix< double > Vexclude,colvec< integer > targetdims)
 Computes an SVD on this blockwise matrix \(A = USV^T\). More...
 
function prod = mtimes ()
 Need left-sided matrix multiplication if RHS singular vectors V should be returned. More...
 
function A = toMemoryMatrix ()
 Converts this FileMatrix to a full double matrix. More...
 
- Public Member Functions inherited from data.FileDataCollection
 FileDataCollection (data_dir)
 Creates a new FileDataCollection in a file folder. More...
 
function  delete ()
 Destructor for FileDataCollection. More...
 
function struct data = getData (rowvec< double > keydata, varargin)
 methods(Access=protected) Retrieves data from the collection element of a given key. More...
 
function n = getCollectionSize ()
 
function struct data = getDataNr (nr, varargin)
 Retrieves data from the nr-st collection element. More...
 
function res = hasData (keydata)
 
function  addData (keydata, data)
 
function  clear ()
 
- Public Member Functions inherited from data.FileData
 FileData (data_dir)
 
function  relocate (char new_root)
 Relocates this FileData instance to a different folder. More...
 
function  delete ()
 

Static Public Member Functions

static function res = test_FileTrajectoryData ()
 
- Static Public Member Functions inherited from data.ABlockedData
static function res = test_BlockSVD_vs_SVD ()
 
- Static Public Member Functions inherited from data.FileDataCollection
static function res = test_FileDataCollection ()
 Quickly tests if the directory is persisted(deleted) when (not) saved to a mat file. More...
 

Public Attributes

logical ReplaceExisting = false
 Flag that indicates if a warning should be issued if a trajectory already exists and is about to be replaced. More...
 
logical UniformTrajectories = true
 Flag that checks if newly added trajectories must have the size of already existing trajectories. More...
 
- Public Attributes inherited from data.ABlockedData
double MinRelSingularValueSize = 1e-20
 The minimum relative value of singular values that triggers selection of the compared to the largest one. More...
 
- Public Attributes inherited from handle
 addlistener
 Creates a listener for the specified event and assigns a callback function to execute when the event occurs. More...
 
 notify
 Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. More...
 
 delete
 Handle object destructor method that is called when the object's lifecycle ends. More...
 
 disp
 Handle object disp method which is called by the display method. See the MATLAB disp function. More...
 
 display
 Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. More...
 
 findobj
 Finds objects matching the specified conditions from the input array of handle objects. More...
 
 findprop
 Returns a meta.property objects associated with the specified property name. More...
 
 fields
 Returns a cell array of string containing the names of public properties. More...
 
 fieldnames
 Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. More...
 
 isvalid
 Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. More...
 
 eq
 Relational functions example. See details for more information. More...
 
 transpose
 Transposes the elements of the handle object array. More...
 
 permute
 Rearranges the dimensions of the handle object array. See the MATLAB permute function. More...
 
 reshape
 hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. More...
 
 sort
 ort the handle objects in any array in ascending or descending order. More...
 
- Public Attributes inherited from data.FileDataCollection
 KeepFiles = false
 Tells the FileDataCollection to keep any stored files if the instance is deleted but has not been previously saved. More...
 
- Public Attributes inherited from data.FileData
char Host = ""
 The host machine this file data is created on. More...
 
char DataDirectory = ""
 The root folder where the FileData's files are saved. More...
 

Static Protected Member Functions

static function this = loadobj (this, initfrom)
 Loads a FileTrajectoryData instance. More...
 
- Static Protected Member Functions inherited from data.FileDataCollection
static function this = loadobj (this, initfrom)
 
- Static Protected Member Functions inherited from data.FileData
static function this = loadobj (this, initfrom)
 Loads a FileData instance. More...
 

Additional Inherited Members

- Protected Member Functions inherited from data.FileData
function file = getfile (file)
 
function this = saveobj ()
 Set saved flag so that the data files do not get deleted on the delete method. More...
 
- Protected Attributes inherited from data.FileData
logical isSaved = false
 This flag indicates that this FileData instance has been stored to disk via the save method somewhere. More...
 

Constructor & Destructor Documentation

data.FileTrajectoryData.FileTrajectoryData (   datadir)

Creates a new filesystem-based trajectory data container.

Parameters
datadirA string containing a valid folder. Default: A temporary folder within the KerMor.TempDirectory

Definition at line 128 of file FileTrajectoryData.m.

References KerMor.App(), clearTrajectories(), and IDGenerator.generateID().

Here is the call graph for this function:

Member Function Documentation

function data.FileTrajectoryData.addTrajectory ( colvec< double x,
colvec< double mu,
integer  inputidx,
double  ctime 
)
virtual

Adds a trajectory to the ModelData instance.

Parameters
xThe state variable vector \(\vx(t)\)
muThe currently used parameter \(\vmu\). Set to \([]\) if not used.
inputidxThe index \(i\) of the currently used input function \(u_i(t)\). Set to \([]\) if not used.
ctimeThe computation time

Implements data.ATrajectoryData.

Definition at line 201 of file FileTrajectoryData.m.

References data.FileDataCollection.addData(), all(), data.FileDataCollection.hasData(), data.ATrajectoryData.size(), and UniformTrajectories.

Here is the call graph for this function:

function data.FileTrajectoryData.clearTrajectories ( )
virtual

Clears all stored trajectory data.

Implements data.ATrajectoryData.

Definition at line 261 of file FileTrajectoryData.m.

References data.FileDataCollection.clear().

Referenced by FileTrajectoryData().

Here is the call graph for this function:

Here is the caller graph for this function:

function data.FileTrajectoryData.consolidate ( models.BaseFullModel  model)

Rebuild the hashmap for the current FileData using the current ParamSamples and the models training inputs.

This method is used when trajectories are generated within a parfor loop, as then the FileTrajectoryData's are remotely instantiated and their inner hash maps not synced with the local one.

Uses the model's parameter samples to compute hashes, look up if the files exist in the given folder corresponding to model_ID (if not given the second arguments ID is used) and re-insert them into the hash map.

Parameters
modelThe model to use for consolidation
Required fields of model:

Definition at line 270 of file FileTrajectoryData.m.

References models.BaseFullModel.Data, data.FileDataCollection.getData(), data.ModelData.ParamSamples, data.ModelData.SampleCount, data.ATrajectoryData.size(), models.BaseFullModel.TrainingInputCount, and UniformTrajectories.

Here is the call graph for this function:

function [ colvec< double > x , X ] = data.FileTrajectoryData.getBoundingBox ( )
virtual

Gets the bounding box of the state space of all trajectories.

Implements data.ATrajectoryData.

Definition at line 322 of file FileTrajectoryData.m.

References X.

function n = data.FileTrajectoryData.getNumTrajectories ( )
virtual

Gets the total number of trajectories.

Implements data.ATrajectoryData.

Definition at line 181 of file FileTrajectoryData.m.

References data.FileDataCollection.getCollectionSize().

Referenced by getTrajectoryDoFs().

Here is the call graph for this function:

Here is the caller graph for this function:

function l = data.FileTrajectoryData.getTotalLength ( )
virtual

Length of the stored trajectories.

Implements data.ATrajectoryData.

Definition at line 252 of file FileTrajectoryData.m.

References data.ATrajectoryData.getNumBlocks(), l, and UniformTrajectories.

Here is the call graph for this function:

function [ colvec< double > x , double ctime ] = data.FileTrajectoryData.getTrajectory ( colvec< double mu,
integer  inputidx 
)
virtual

Gets a system's trajectory for the given \(\mu\) and inputindex. Returns [] if no trajectory is found in the Data's Snapshots.

See Also
ModelData/getSampleIndex
Parameters
muThe currently used parameter \(\vmu\). Set to \([]\) if not used.
inputidxThe index \(i\) of the currently used input function \(u_i(t)\). Set to \([]\) if not used.

Implements data.ATrajectoryData.

Definition at line 152 of file FileTrajectoryData.m.

References data.FileDataCollection.getData().

Here is the call graph for this function:

function [d , mud ] = data.FileTrajectoryData.getTrajectoryDoFs ( )
virtual

Returns the degrees of freedom for the trajectories and parameter size.

Implements data.ATrajectoryData.

Definition at line 333 of file FileTrajectoryData.m.

References getNumTrajectories(), getTrajectoryNr(), and data.ATrajectoryData.size().

Here is the call graph for this function:

function [ colvec< double > x , colvec< double > mu , integer inputidx , double ctime ] = data.FileTrajectoryData.getTrajectoryNr (   nr)
virtual

Gets the trajectory with the number nr.

Implements data.ATrajectoryData.

Definition at line 186 of file FileTrajectoryData.m.

References data.FileDataCollection.getDataNr().

Referenced by getTrajectoryDoFs().

Here is the call graph for this function:

Here is the caller graph for this function:

function this = data.FileTrajectoryData.loadobj (   this,
  initfrom 
)
staticprotected

Loads a FileTrajectoryData instance.

Ensures that the directory associated with this FileTrajectoryData is existent.

Required fields of initfrom:
Generated fields of this:

Definition at line 371 of file FileTrajectoryData.m.

References data.ABlockedData.MinRelSingularValueSize, ReplaceExisting, and UniformTrajectories.

static function res = data.FileTrajectoryData.test_FileTrajectoryData ( )
static

Definition at line 409 of file FileTrajectoryData.m.

References all().

Here is the call graph for this function:

Member Data Documentation

data.FileTrajectoryData.ReplaceExisting = false

Flag that indicates if a warning should be issued if a trajectory already exists and is about to be replaced.

Default: false

Definition at line 58 of file FileTrajectoryData.m.

Referenced by loadobj().

data.FileTrajectoryData.UniformTrajectories = true

Flag that checks if newly added trajectories must have the size of already existing trajectories.

So far, if you add an non-uniform trajectory when temporarily switching the check off will not check for this inconsistency when turning it back on again. (This setting has effect only as long as it is turned on)

Default: true

Definition at line 69 of file FileTrajectoryData.m.

Referenced by addTrajectory(), consolidate(), getTotalLength(), and loadobj().


The documentation for this class was generated from the following file: