IGLib
1.5
The IGLib base library for development of numerical, technical and business applications.
|
Base class for 1D grid generators. More...
Public Member Functions | |
virtual void | ClearResults () |
Clears the results of grid generation (releases internal structures). The Calculated flag is set to false. More... | |
abstract void | CalculateGrid (ref List< double > nodeList) |
Performs grid generation and stores the generated nodes directly on the provided list. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date. More... | |
virtual void | CalculateGrid (ref List< double > nodeList, ref List< double > intervalLengthsList) |
Performs grid generation and stores the generated nodes and intervals between them directly on the provided lists. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date. More... | |
virtual void | CalculateGrid () |
Performs grid generation according to current settings. The generated grid is stored in internal structures of the generator, from where it can be readily copied (e.g. by GetNodeTable() or by GetNodeList()), used in some other way (e.g. by GetIntervalLengthsList) or just referenced (e.g. by GetNodeListReference()). If the grid has already been generated and it is up to date (according to parameters of the generator) then the grid is not re-calculated. More... | |
virtual double | GetNode (int which) |
Returns the specified node of the generated grid. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual void | GetNodeTable (ref double[] result) |
Stores the node positions of the generated 1D grid into the specified table. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual double[] | GetNodeTable () |
Returns a table containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual void | GetNodeList (ref List< double > result) |
Stores the node positions of the generated 1D grid into the specified list. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual List< double > | GetNodeList () |
Returns a list containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual List< double > | GetNodeListReference () |
Returns a list containing generated 1D node positions. This method can return a reference to the internal list containing the generated node coordinated. This means that any future generation or other operation performed by the generator can override list contents. In order to use contents of the list thread safely, enclose this method call and all subsequent operations you will perform on the returned list of generated nodes, within a lock((...).Lock){ ... } block. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual void | GetIntervalLengthsTable (ref double[] result) |
Stores a table of interval lengths between the generated nodes into the specified array. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual double[] | GetIntervalLengthsTable () |
Generates and returns a table of interval lengths between the generated nodes. The returned table is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual void | GetIntervalLengthsList (ref List< double > result) |
Stores a table of interval lengths between the generated nodes into the specified list. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual List< double > | GetIntervalLengthsList () |
Generates and returns a list of interval lengths between the generated nodes. The returned list is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data. More... | |
virtual double | GetIntervalLength (int which) |
Returns the length of the specified interval between generated nodes of the grid. If necessary, grid is generated first in order to obtain the correct data. More... | |
Static Public Member Functions | |
static GridGenerator1d | CreateUniform (double from, double to, int numnodes) |
Creates and returns a 1D grid generator for uniform grid (equidistant intervals). More... | |
static GridGenerator1d | CreateGeometric (double from, double to, int numNodes, double growthFactor) |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometrical series from the lower bound of the grid interval. More... | |
static GridGenerator1d | CreateGeometricCentered (double from, double to, int numNodes, double growthFactor) |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval towards the bounds. More... | |
static GridGenerator1d | CreateGeometricScaled (double from, double to, int numNodes, double growthFactor, double scalingFactor) |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the lower bound towards teh upper bound of the grid interval, and the grid can also be scaled. More... | |
static GridGenerator1d | CreateGeometricCenteredScaled (double from, double to, int numNodes, double growthFactor, double scalingFactor) |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval, and the grid can also be scaled. More... | |
static GridGenerator1dFunc | CreateFunctionBased (double from, double to, int numNodes, IRealFunction function, double firstFunctionArgument, double lastFunctionArgument) |
Creates and returns a 1D grid generator where grid point positions are calculated by the specified function. More... | |
static void | CalculateGridUnitFactors (int numElements, bool centered, double growthFactor, double scalingFactor, ref List< double > factors) |
Calculates factors for a table of values between two points, and stores them to factors. More... | |
static void | CalculateGridUnitFactors (int numElements, IRealFunction func, double firstFunctionArgument, double lastFunctionArgument, ref List< double > factors) |
Calculates factors for a table of values between two points, and stores them to a list. Factors are calculated according to values of a function of one variable, evaluated in equidistant points on the specified interval, and scaled such that they lie between 0 and 1. It is caller's responsibility to provide a monotonous function, otherwise some factors can lie outside the [0,1] interval and are not ordered. More... | |
static void | CalculateIntervalLenghts (List< double > nodes, ref List< double > lengths) |
Calculates lengths of subsequent intervals defined by the first list, and stores it to the second list. More... | |
static void | CalculateIntervalLenghRatios (List< double > nodes, ref List< double > lengthRatios) |
Calculates length ratios between subsequent intervals defined by the first list, ans stores it to the second list. More... | |
static void | ExampleTableFactors () |
Examples for calculating table factors. More... | |
static void | FitGridNode (double minCurrent, double maxCurrent, double minTarget, double maxTarget, ref double node) |
Grid stretching to fit the specified interval bounds. Modifies position of the generated 1d grid node in such a way that it fits the new grid interval. More... | |
static void | FitGridNodes (double minCurrent, double maxCurrent, double minTarget, double maxTarget, List< double > nodes) |
Grid stretching to fit the specified interval bounds. Modifies positions of the generated 1d grid nodes contained in the specified list in such a way that it fits the new grid interval. More... | |
Protected Member Functions | |
GridGenerator1dBase () | |
Protected Attributes | |
List< double > | _nodes |
Internally stored generated nodes. More... | |
Properties | |
object | Lock [get] |
Object used for locking of the current object (ILockable interface). More... | |
virtual double | CoordinateFirst [get, set] |
Gets or sets coordinate of the first generated node (usually the minimal generated coordinate). More... | |
virtual double | CoordinateLast [get, set] |
Gets or sets coordinate of the last generated node (usually the maximal generated coordinate). More... | |
virtual int | NumNodes [get, set] |
Gets or sets teh number of nodes to be generated. More... | |
virtual int | NumIntervals [get] |
Gets the number of intervals between the nodes. Simply NumNodes-1. More... | |
virtual bool | Calculated [get, protected set] |
Flag indicating whether the grid is generated ready to use. If true then node positions are contained in an internal structure, such that they can be obtained simply by copying this structure (i.e. no need for re-calculation). REMARK: If you intend to do something with results on basis of the value of this flag, don't forget to enclose checking of the flag and your operation into the lock(....Lock){ ... } block. More... | |
![]() | |
double | CoordinateFirst [get, set] |
Gets or sets coordinate of the first generated node (usually the minimal generated coordinate). More... | |
double | CoordinateLast [get, set] |
Gets or sets coordinate of the last generated node (usually the maximal generated coordinate). More... | |
int | NumNodes [get, set] |
Gets or sets teh number of nodes to be generated. More... | |
int | NumIntervals [get] |
Gets the number of intervals between the nodes. Simply NumNodes-1. More... | |
bool | Calculated [get] |
Flag indicating whether the grid is generated ready to use. If true then node positions are contained in an internal structure, such that they can be obtained simply by copying this structure (i.e. no need for re-calculation). REMARK: If you intend to do something with results on basis of the value of this flag, don't forget to enclose checking of the flag and your operation into the lock(....Lock){ ... } block. More... | |
![]() | |
object | Lock [get] |
Private Attributes | |
object | _lockObj = new object() |
double | _first = 0.0 |
double | _last = 1.0 |
int | _numNodes = 2 |
bool | _calculated = false |
Base class for 1D grid generators.
$A Igor Apr10; Dec10;
|
inlineprotected |
|
inlinestatic |
Creates and returns a 1D grid generator for uniform grid (equidistant intervals).
from | Lower bound of the generated 1D grid. |
to | Upper bound of the generated 1D grid. |
numNodes | Number of nodes generated. |
|
inlinestatic |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometrical series from the lower bound of the grid interval.
from | Lower bound of the generated 1D grid. |
to | Upper bound of the generated 1D grid. |
numNodes | Number of nodes generated. |
growthFactor | Factor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the lower bound towards the upper bound. If factor is less than 1 then intervals shrink in this direction. |
|
inlinestatic |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval towards the bounds.
from | Lower bound of the generated 1D grid. |
to | Upper bound of the generated 1D grid. |
numNodes | Number of nodes generated. |
growthFactor | Factor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the centertowards the bounds. If factor is less than 1 then intervals shrink in this direction. |
|
inlinestatic |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the lower bound towards teh upper bound of the grid interval, and the grid can also be scaled.
from | Lower bound of the generated 1D grid (can change when scaling is applied). |
to | Upper bound of the generated 1D grid (can change when scaling is applied). |
numNodes | Number of nodes generated. |
growthFactor | Factor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the lower bound towards the upper bound. If factor is less than 1 then intervals shrink in this direction. |
scalingFactor | Factor by which the grid is scaled. |
|
inlinestatic |
Creates and returns a 1D grid generator. Grid intervals can grow or fall in geometric series from the center of the grid interval, and the grid can also be scaled.
from | Lower bound of the generated 1D grid (can change when scaling is applied). |
to | Upper bound of the generated 1D grid (can change when scaling is applied). |
numNodes | Number of nodes generated. |
growthFactor | Factor of interval growth. Factor 1 means a uniform grid with equidistant intervals. If factor is larger than 1 then intervals grow from the center towards the bounds. If factor is less than 1 then intervals shrink in this direction. |
scalingFactor | Factor by which the grid is scaled. |
|
inlinestatic |
Creates and returns a 1D grid generator where grid point positions are calculated by the specified function.
from | Lower bound of the generated 1D grid. |
to | Upper bound of the generated 1D grid. |
numNodes | Number of nodes generated. |
function | Function used for evaluation of grid points. |
firstFunctionArgument | First argument (lower bound of the interval) where grid function is evaluated. |
lastFunctionArgument | First argument (upper bound of the interval) where grid function is evaluated. |
|
inlinestatic |
Calculates factors for a table of values between two points, and stores them to factors.
numElements | Number of sampling points (elements). It should be greater than 1. |
centered | if 0 then factors run from 0 to 1 (for a table is from the specified starting till hte end point), otherwise factors run from -1 to 1 (for tables centered in the starting point, ending in the end point and starting in the reflected end point across the start point). |
growthFactor | Factor by which length of successive intervals is increases to obtain table with intervals growing in geometric order. If the specified factor is 0 then it is set to 1. |
scalingfactor | additional factor by which each factor is mutiplied. If centered!=0 and growthfactor>1 then intervals fall from -1 to 0 and grow from 0 to 1. |
factors | Ouptput - list where factors are stored. |
$A Igor Apr10;
|
inlinestatic |
Calculates factors for a table of values between two points, and stores them to a list. Factors are calculated according to values of a function of one variable, evaluated in equidistant points on the specified interval, and scaled such that they lie between 0 and 1. It is caller's responsibility to provide a monotonous function, otherwise some factors can lie outside the [0,1] interval and are not ordered.
func | A real-valued function of a real variable that defines distribution of factors. The calculated factors are function values |
numElements | Number of sampling points (elements). It should be greater than 1. |
firstFunctionArgument | Lower bound of function arguments. |
lastFunctionArgument | Upper bound for function arguments. |
factors | Ouptput - list where factors are stored. |
$A Igor Apr10;
References IG.Num.IRealFunction.Name, IG.Num.IRealFunction.Value(), and IG.Num.IRealFunction.ValueDefined.
|
inlinestatic |
Calculates lengths of subsequent intervals defined by the first list, and stores it to the second list.
nodes | List containing nodes that define intervals. |
lengths | List where interval lengths are stored. |
|
inlinestatic |
Calculates length ratios between subsequent intervals defined by the first list, ans stores it to the second list.
nodes | List containing nodes that define intervals. |
lengthRatios | List where interval length ratios are stored. This list has two elements less than the original list. |
|
inlinestatic |
Examples for calculating table factors.
|
inlinestatic |
Grid stretching to fit the specified interval bounds. Modifies position of the generated 1d grid node in such a way that it fits the new grid interval.
minCurrent | Lower bound of the interval containing the current grid. |
maxCurrent | Upper bound of the interval containing the current grid. |
minTarget | Lower bound of the interval containing the fitted (stretched) grid. |
maxTarget | Lower bound of the interval containing the fitted (stretched) grid. |
node | Position of node to be modified according to grid stretching. |
|
inlinestatic |
Grid stretching to fit the specified interval bounds. Modifies positions of the generated 1d grid nodes contained in the specified list in such a way that it fits the new grid interval.
minCurrent | Lower bound of the interval containing the current grid. |
maxCurrent | Upper bound of the interval containing the current grid. |
minTarget | Lower bound of the interval containing the fitted (stretched) grid. |
maxTarget | Lower bound of the interval containing the fitted (stretched) grid. |
node | List containing positions of node to be modified according to grid stretching. |
|
inlinevirtual |
Clears the results of grid generation (releases internal structures). The Calculated flag is set to false.
Implements IG.Num.IGridGenerator1d.
|
pure virtual |
Performs grid generation and stores the generated nodes directly on the provided list. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date.
nodeList | A list where node coordinates are stored. List is allocated or re-allocated if necessary. |
Implements IG.Num.IGridGenerator1d.
Implemented in IG.Num.GridGenerator1d, and IG.Num.GridGenerator1dFunc.
|
inlinevirtual |
Performs grid generation and stores the generated nodes and intervals between them directly on the provided lists. Unless necessary due to nature of generation, results are not stored internally on the current grid generator object. Because of this, the Calculated flag is normally not set after calling this function. WARNING: This method generates a grid even if it has already been generated and is up to date.
nodeList | A list where positions of the generated grid are stored. |
intervalLengthsList | A list where lengths of intervals between grid nodes are stored. |
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Performs grid generation according to current settings. The generated grid is stored in internal structures of the generator, from where it can be readily copied (e.g. by GetNodeTable() or by GetNodeList()), used in some other way (e.g. by GetIntervalLengthsList) or just referenced (e.g. by GetNodeListReference()). If the grid has already been generated and it is up to date (according to parameters of the generator) then the grid is not re-calculated.
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Returns the specified node of the generated grid. If necessary, grid is generated first in order to obtain the correct data.
which | Specifies which node (counted from 0) is to be returned. |
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Stores the node positions of the generated 1D grid into the specified table. If necessary, grid is generated first in order to obtain the correct data.
result | Table where node positions of the generated grid are stored. Allocated or relocated if necessary. |
Implements IG.Num.IGridGenerator1d.
Referenced by IG.Num.NeuralTrainingLimits.PrepareNeuronsTable(), and IG.Num.NeuralTrainingLimits.PrepareNumHiddenNeuronsValuesArray().
|
inlinevirtual |
Returns a table containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data.
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Stores the node positions of the generated 1D grid into the specified list. If necessary, grid is generated first in order to obtain the correct data.
result | List where node positions of the generated grid are stored. Allocated or relocated if necessary. |
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Returns a list containing 1D node positions. A copy of list of node positions is always created and returned, therefore it is guaranteed that this table will not be used by some other object related to the grid generator. If necessary, grid is generated first in order to obtain the correct data.
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Returns a list containing generated 1D node positions. This method can return a reference to the internal list containing the generated node coordinated. This means that any future generation or other operation performed by the generator can override list contents. In order to use contents of the list thread safely, enclose this method call and all subsequent operations you will perform on the returned list of generated nodes, within a lock((...).Lock){ ... } block. If necessary, grid is generated first in order to obtain the correct data.
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Stores a table of interval lengths between the generated nodes into the specified array. If necessary, grid is generated first in order to obtain the correct data.
result | Array where interval lengths between nodes of the generated grid are stored. Allocated or relocated if necessary. |
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Generates and returns a table of interval lengths between the generated nodes. The returned table is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data.
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Stores a table of interval lengths between the generated nodes into the specified list. If necessary, grid is generated first in order to obtain the correct data.
result | List where interval lengths between nodes of the generated grid are stored. Allocated or relocated if necessary. |
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Generates and returns a list of interval lengths between the generated nodes. The returned list is a copy that will not be overridden by further operations on the grid generator. If necessary, grid is generated first in order to obtain the correct data.
Implements IG.Num.IGridGenerator1d.
|
inlinevirtual |
Returns the length of the specified interval between generated nodes of the grid. If necessary, grid is generated first in order to obtain the correct data.
which | Consecutive number of the interval between nodes. |
Implements IG.Num.IGridGenerator1d.
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
Internally stored generated nodes.
|
get |
Object used for locking of the current object (ILockable interface).
|
getset |
Gets or sets coordinate of the first generated node (usually the minimal generated coordinate).
Referenced by IG.Num.NeuralTrainingLimits.PrepareNeuronsTable().
|
getset |
Gets or sets coordinate of the last generated node (usually the maximal generated coordinate).
Referenced by IG.Num.NeuralTrainingLimits.PrepareNeuronsTable().
|
getset |
Gets or sets teh number of nodes to be generated.
Referenced by IG.Num.NeuralTrainingLimits.PrepareNeuronsTable().
|
get |
Gets the number of intervals between the nodes. Simply NumNodes-1.
|
getprotected set |
Flag indicating whether the grid is generated ready to use. If true then node positions are contained in an internal structure, such that they can be obtained simply by copying this structure (i.e. no need for re-calculation). REMARK: If you intend to do something with results on basis of the value of this flag, don't forget to enclose checking of the flag and your operation into the lock(....Lock){ ... } block.