- use expectations

- improved gibbs sampling
- LayerArray is template class

git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@18 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-10-06 17:08:50 +00:00
parent f62f1283f8
commit fc758b853a
122 changed files with 1053 additions and 1149 deletions
@@ -29,6 +29,10 @@ struct UndoManager::ActionSet
time (Time::getCurrentTime())
{}
OwnedArray <UndoableAction> actions;
String name;
Time time;
bool perform() const
{
for (int i = 0; i < actions.size(); ++i)
@@ -56,10 +60,6 @@ struct UndoManager::ActionSet
return total;
}
OwnedArray<UndoableAction> actions;
String name;
Time time;
};
//==============================================================================
@@ -101,19 +101,6 @@ void UndoManager::setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep,
//==============================================================================
bool UndoManager::perform (UndoableAction* const newAction, const String& actionName)
{
if (perform (newAction))
{
if (actionName.isNotEmpty())
setCurrentTransactionName (actionName);
return true;
}
return false;
}
bool UndoManager::perform (UndoableAction* const newAction)
{
if (newAction != nullptr)
{
@@ -126,6 +113,9 @@ bool UndoManager::perform (UndoableAction* const newAction)
return false;
}
if (actionName.isNotEmpty())
currentTransactionName = actionName;
if (action->perform())
{
ActionSet* actionSet = getCurrentSet();
@@ -144,7 +134,7 @@ bool UndoManager::perform (UndoableAction* const newAction)
}
else
{
actionSet = new ActionSet (newTransactionName);
actionSet = new ActionSet (currentTransactionName);
transactions.insert (nextIndex, actionSet);
++nextIndex;
}
@@ -184,31 +174,23 @@ void UndoManager::clearFutureTransactions()
}
}
void UndoManager::beginNewTransaction() noexcept
{
beginNewTransaction (String());
}
void UndoManager::beginNewTransaction (const String& actionName) noexcept
void UndoManager::beginNewTransaction (const String& actionName)
{
newTransaction = true;
newTransactionName = actionName;
currentTransactionName = actionName;
}
void UndoManager::setCurrentTransactionName (const String& newName) noexcept
void UndoManager::setCurrentTransactionName (const String& newName)
{
if (newTransaction)
newTransactionName = newName;
else if (ActionSet* action = getCurrentSet())
action->name = newName;
currentTransactionName = newName;
}
//==============================================================================
UndoManager::ActionSet* UndoManager::getCurrentSet() const noexcept { return transactions [nextIndex - 1]; }
UndoManager::ActionSet* UndoManager::getNextSet() const noexcept { return transactions [nextIndex]; }
bool UndoManager::canUndo() const noexcept { return getCurrentSet() != nullptr; }
bool UndoManager::canRedo() const noexcept { return getNextSet() != nullptr; }
bool UndoManager::canUndo() const { return getCurrentSet() != nullptr; }
bool UndoManager::canRedo() const { return getNextSet() != nullptr; }
bool UndoManager::undo()
{
@@ -285,7 +267,7 @@ bool UndoManager::undoCurrentTransactionOnly()
return newTransaction ? false : undo();
}
void UndoManager::getActionsInCurrentTransaction (Array<const UndoableAction*>& actionsFound) const
void UndoManager::getActionsInCurrentTransaction (Array <const UndoableAction*>& actionsFound) const
{
if (! newTransaction)
if (const ActionSet* const s = getCurrentSet())