#include <VarArray.h>
Inheritance diagram for PLearn::VarArray:
Public Types | |
typedef Var * | iterator |
Public Member Functions | |
VarArray () | |
VarArray (int n, int n_extra=10) | |
VarArray (int n, int initial_length, int n_extra) | |
VarArray (int n, int initial_length, int initial_width, int n_extra) | |
VarArray (const Array< Var > &va) | |
VarArray (Array< Var > &va) | |
VarArray (const VarArray &va) | |
VarArray (const Var &v) | |
VarArray (const Var &v1, const Var &v2) | |
VarArray (Variable *v) | |
VarArray (Variable *v1, Variable *v2) | |
void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Deep copy of an array is not the same as for a TVec, because the shallow copy automatically creates a new storage. | |
operator Var () | |
VarArray & | operator &= (const Var &v) |
VarArray & | operator &= (const VarArray &va) |
VarArray | operator & (const Var &v) const |
VarArray | operator & (const VarArray &va) const |
int | nelems () const |
int | sumOfLengths () const |
int | sumOfWidths () const |
int | maxWidth () const |
int | maxLength () const |
VarArray | nonNull () const |
returns a VarArray containing all the Var's that are non-null | |
VarArray & | subVarArray (int start, int len) const |
void | copyFrom (int start, int len, const VarArray &from) |
void | copyFrom (int start, const VarArray &from) |
void | copyFrom (const Vec &datavec) |
void | copyValuesFrom (const VarArray &from) |
void | copyTo (const Vec &datavec) const |
void | accumulateTo (const Vec &datavec) const |
void | copyGradientFrom (const Vec &datavec) |
void | copyGradientFrom (const Array< Vec > &datavec) |
void | accumulateGradientFrom (const Vec &datavec) |
void | copyGradientTo (const Vec &datavec) |
void | copyGradientTo (const Array< Vec > &datavec) |
void | accumulateGradientTo (const Vec &datavec) |
void | copyTo (real *x, int n) const |
UNSAFE: x must point to at least n floats! | |
void | accumulateTo (real *x, int n) const |
void | copyFrom (const real *x, int n) |
void | makeSharedValue (real *x, int n) |
like copyTo but also makes value's point to x | |
void | makeSharedGradient (real *x, int n) |
like copyGradientTo but also makes value's point to x | |
void | makeSharedValue (PP< Storage< real > > storage, int offset_=0) |
make value and matValue point into this storage | |
void | makeSharedValue (Vec &v, int offset_=0) |
void | makeSharedGradient (Vec &v, int offset_=0) |
void | makeSharedGradient (PP< Storage< real > > storage, int offset_=0) |
void | copyGradientTo (real *x, int n) |
void | copyGradientFrom (const real *x, int n) |
void | accumulateGradientFrom (const real *x, int n) |
void | accumulateGradientTo (real *x, int n) |
void | copyMinValueTo (const Vec &minv) |
void | copyMaxValueTo (const Vec &maxv) |
void | copyMinValueTo (real *x, int n) |
void | copyMaxValueTo (real *x, int n) |
void | makeSharedRValue (Vec &v, int offset_=0) |
void | makeSharedRValue (PP< Storage< real > > storage, int offset_=0) |
void | copyRValueTo (const Vec &datavec) |
void | copyRValueFrom (const Vec &datavec) |
void | copyRValueTo (real *x, int n) |
void | copyRValueFrom (const real *x, int n) |
void | resizeRValue () |
void | setMark () const |
void | clearMark () const |
void | markPath () const |
void | buildPath (VarArray &fpath) const |
void | setDontBpropHere (bool val) |
void | fprop () |
void | sizeprop () |
void | sizefprop () |
void | bprop () |
void | bbprop () |
void | rfprop () |
void | fbprop () |
void | fbbprop () |
void | fillGradient (real value) |
void | clearGradient () |
void | clearDiagHessian () |
VarArray | sources () const |
VarArray | ancestors () const |
void | unmarkAncestors () const |
VarArray | parents () const |
returns the set of all the direct parents of the Var in this array (previously marked parents are NOT included) | |
void | symbolicBprop () |
computes symbolicBprop on a propagation path | |
VarArray | symbolicGradient () |
returns a VarArray of all the ->g members of the Vars in this array. | |
void | clearSymbolicGradient () |
clears the symbolic gradient in all vars of this array | |
bool | update (real step_size, Vec direction, real coeff=1.0, real b=0.0) |
bool | update (Vec step_sizes, Vec direction, real coeff=1.0, real b=0.0) |
Update the variables in the VarArray with different step sizes, and an optional scaling coefficient + constant coefficient step_sizes and direction must have the same length As with the update with a fixed step size, there is a possible scaling down, and the return value indicates contraints have been hit. | |
bool | update (Vec step_sizes, Vec direction, Vec coeff) |
Same as update(Vec step_sizes, Vec direction, real coeff) except there can be 1 different coeff for each variable. | |
real | maxUpdate (Vec direction) |
bool | update (real step_size) |
void | updateAndClear () |
value += step_size*gradient; gradient.clear(); | |
bool | update (Vec new_value) |
void | read (istream &in) |
void | write (ostream &out) const |
void | printNames () const |
void | printInfo (bool print_gradient=false) |
Var | operator[] (Var index) |
Var & | operator[] (int i) |
const Var & | operator[] (int i) const |
|
Reimplemented from PLearn::Array< Var >. Definition at line 60 of file VarArray.h. Referenced by VarArray(). |
|
Definition at line 49 of file VarArray.cc. Referenced by subVarArray(). |
|
Definition at line 53 of file VarArray.cc. |
|
Definition at line 57 of file VarArray.cc. References PLearn::TVec< Var >::data(), and iterator. |
|
Definition at line 65 of file VarArray.cc. References PLearn::TVec< Var >::data(). |
|
Definition at line 66 of file VarArray.h. |
|
Definition at line 67 of file VarArray.h. |
|
Definition at line 68 of file VarArray.h. |
|
Definition at line 73 of file VarArray.cc. |
|
Definition at line 77 of file VarArray.cc. |
|
Definition at line 84 of file VarArray.cc. |
|
Definition at line 88 of file VarArray.cc. |
|
Definition at line 364 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 337 of file VarArray.cc. References accumulateGradientFrom(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by accumulateGradientFrom(). |
|
Definition at line 418 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 413 of file VarArray.cc. References accumulateGradientTo(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by accumulateGradientTo(). |
|
Definition at line 268 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 241 of file VarArray.cc. References accumulateTo(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by accumulateTo(), and PLearn::Function::fbbpropAcc(). |
|
Definition at line 971 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::NaryVariable::ancestors(), and PLearn::displayVarGraph(). |
|
Definition at line 737 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 729 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::MatrixElementsVariable::bprop(), PLearn::ArgminOfVariable::bprop(), and PLearn::MatrixElementsVariable::fbprop(). |
|
Definition at line 695 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::NaryVariable::buildPath(), and PLearn::propagationPath(). |
|
Definition at line 843 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
|
Definition at line 677 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::displayVarGraph(), PLearn::nonInputParentsOfPath(), PLearn::OldDisplayVarGraph(), parents(), and PLearn::propagationPath(). |
|
clears the symbolic gradient in all vars of this array
Definition at line 819 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::Function::differentiate(). |
|
Definition at line 123 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 118 of file VarArray.cc. References copyFrom(), PLearn::TVec< T >::data(), PLearn::TVec< T >::length(), and PLearn::Vec. |
|
Definition at line 98 of file VarArray.h. References copyFrom(). |
|
|
Definition at line 342 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 295 of file VarArray.cc. References PLearn::TVec< T >::data(), PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, PLearn::TVec< T >::size(), and PLearn::TVec< Var >::size(). |
|
Definition at line 290 of file VarArray.cc. References copyGradientFrom(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by copyGradientFrom(), PLearn::Function::fbprop(), and PLearn::ScaledGradientOptimizer::optimize(). |
|
Definition at line 391 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 317 of file VarArray.cc. References PLearn::TVec< T >::data(), PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
|
Definition at line 472 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 467 of file VarArray.cc. References copyMaxValueTo(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by copyMaxValueTo(). |
|
Definition at line 445 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 440 of file VarArray.cc. References copyMinValueTo(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by copyMinValueTo(). |
|
Definition at line 535 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 563 of file VarArray.cc. References copyRValueFrom(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by copyRValueFrom(), and PLearn::Function::rfprop(). |
|
Definition at line 511 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 558 of file VarArray.cc. References copyRValueTo(), PLearn::TVec< T >::data(), and PLearn::TVec< T >::length(). Referenced by copyRValueTo(), and PLearn::Function::rfprop(). |
|
UNSAFE: x must point to at least n floats!
Definition at line 246 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). |
|
|
Definition at line 107 of file VarArray.cc. References PLERROR, and PLearn::TVec< Var >::size(). |
|
Definition at line 781 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLearn::TVec< Var >::last(), and PLearn::TVec< Var >::size(). |
|
|
Definition at line 827 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
|
Deep copy of an array is not the same as for a TVec, because the shallow copy automatically creates a new storage.
Reimplemented from PLearn::Array< Var >. Definition at line 100 of file VarArray.cc. References PLearn::TVec< Var >::size(), and PLearn::varDeepCopyField(). Referenced by PLearn::deepCopyField(), and PLearn::Function::operator()(). |
|
Definition at line 192 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 182 of file VarArray.cc. References makeSharedGradient(), PLearn::TVec< T >::offset_, and PLearn::TVec< T >::storage. |
|
like copyGradientTo but also makes value's point to x
Definition at line 216 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). Referenced by makeSharedGradient(). |
|
Definition at line 494 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 187 of file VarArray.cc. References makeSharedRValue(), PLearn::TVec< T >::offset_, and PLearn::TVec< T >::storage. Referenced by makeSharedRValue(). |
|
Definition at line 208 of file VarArray.cc. References PLearn::TVec< T >::length(), makeSharedValue(), nelems(), PLERROR, and PLearn::TVec< T >::storage. |
|
make value and matValue point into this storage
Definition at line 166 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
like copyTo but also makes value's point to x
Definition at line 146 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, and PLearn::TVec< Var >::size(). Referenced by PLearn::NNet::build_(), PLearn::NeuralNet::build_(), PLearn::NeighborhoodSmoothnessNNet::build_(), PLearn::MultiInstanceNNet::build_(), PLearn::ConditionalDensityNet::build_(), and makeSharedValue(). |
|
Definition at line 685 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::NaryVariable::markPath(), and PLearn::propagationPath(). |
|
Definition at line 620 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLearn::Var::length(), and PLearn::TVec< Var >::size(). Referenced by PLearn::ConcatColumnsVariable::recomputeSize(). |
|
Using the box constraints on the values, return the maximum allowable step_size in the given direction i.e., argmax_{step_size} {new = value + step_size * direction, new in box} Definition at line 906 of file VarArray.cc. References PLearn::TVec< Var >::data(), maxUpdate(), MIN, PLearn::TVec< Var >::size(), and PLearn::TVec< T >::subVec(). Referenced by maxUpdate(). |
|
Definition at line 606 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLearn::TVec< Var >::size(), and PLearn::Var::width(). Referenced by PLearn::ConcatRowsVariable::recomputeSize(). |
|
|
returns a VarArray containing all the Var's that are non-null
Definition at line 634 of file VarArray.cc. References PLearn::TVec< Var >::append(), PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 86 of file VarArray.h. References PLearn::operator &(). |
|
Definition at line 85 of file VarArray.h. References PLearn::operator &(). |
|
Definition at line 84 of file VarArray.h. References PLearn::operator &=(). |
|
Definition at line 83 of file VarArray.h. References PLearn::operator &=(). |
|
Definition at line 76 of file VarArray.h. References operator[](), PLERROR, and PLearn::TVec< Var >::size(). |
|
Reimplemented from PLearn::TVec< Var >. Definition at line 223 of file VarArray.h. References operator[](). |
|
Definition at line 222 of file VarArray.h. References operator[](). |
|
Definition at line 956 of file VarArray.cc. Referenced by operator Var(), and operator[](). |
|
returns the set of all the direct parents of the Var in this array (previously marked parents are NOT included)
Definition at line 989 of file VarArray.cc. References PLearn::TVec< Var >::append(), clearMark(), PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), setMark(), and PLearn::TVec< Var >::size(). Referenced by PLearn::Function::differentiate(), PLearn::nonInputParentsOfPath(), and PLearn::OldDisplayVarGraph(). |
|
Definition at line 213 of file VarArray.h. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::RandomVariable::epoch(), PLearn::printInfo(), and PLearn::Variable::printInfos(). |
|
Definition at line 1009 of file VarArray.cc. References PLearn::endl(), and PLearn::TVec< Var >::size(). |
|
Reimplemented from PLearn::Array< Var >. Definition at line 940 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 578 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::NaryVariable::resizeRValue(). |
|
Definition at line 745 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::Function::rfprop(). |
|
Definition at line 852 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLearn::TVec< Var >::size(), and val. |
|
Definition at line 669 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::displayVarGraph(), PLearn::nonInputParentsOfPath(), PLearn::nonInputSources(), PLearn::OldDisplayVarGraph(), parents(), PLearn::printInfo(), and PLearn::propagationPath(). |
|
Definition at line 721 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 713 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Definition at line 961 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::allSources(), PLearn::displayVarGraph(), PLearn::nonInputSources(), PLearn::OldDisplayVarGraph(), PLearn::propagationPath(), and PLearn::NaryVariable::sources(). |
|
Definition at line 645 of file VarArray.cc. References PLearn::TVec< Var >::append(), PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLERROR, PLearn::TVec< Var >::size(), and VarArray(). |
|
Definition at line 586 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLearn::Var::length(), and PLearn::TVec< Var >::size(). Referenced by PLearn::ConcatRowsVariable::recomputeSize(). |
|
Definition at line 596 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), PLearn::TVec< Var >::size(), and PLearn::Var::width(). Referenced by PLearn::ConcatColumnsVariable::recomputeSize(). |
|
computes symbolicBprop on a propagation path
Definition at line 801 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::Function::differentiate(). |
|
returns a VarArray of all the ->g members of the Vars in this array.
Definition at line 809 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::Function::differentiate(). |
|
Definition at line 981 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). Referenced by PLearn::allSources(), PLearn::displayVarGraph(), PLearn::nonInputSources(), PLearn::OldDisplayVarGraph(), PLearn::propagationPath(), and PLearn::NaryVariable::unmarkAncestors(). |
|
set value = new_value projected down in each direction independently in the subspace in which the box constraints are satisfied. return true if box constraints have been hit with the update Definition at line 928 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::TVec< Var >::size(), and PLearn::TVec< T >::subVec(). |
|
set value = value + step_size * gradient with step_size possibly scaled down s.t. box constraints are satisfied return true if box constraints have been hit with the update Definition at line 918 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |
|
Same as update(Vec step_sizes, Vec direction, real coeff) except there can be 1 different coeff for each variable.
Definition at line 872 of file VarArray.cc. References PLearn::TVec< Var >::data(), nelems(), PLearn::TVec< Var >::size(), and PLearn::TVec< T >::subVec(). |
|
Update the variables in the VarArray with different step sizes, and an optional scaling coefficient + constant coefficient step_sizes and direction must have the same length As with the update with a fixed step size, there is a possible scaling down, and the return value indicates contraints have been hit.
Definition at line 889 of file VarArray.cc. References PLearn::TVec< Var >::data(), nelems(), PLearn::TVec< Var >::size(), and PLearn::TVec< T >::subVec(). |
|
set value = value + (step_size * coeff + b) * direction with step_size possibly scaled down s.t. box constraints are satisfied return true if box constraints have been hit with the update Definition at line 860 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::TVec< Var >::size(), and PLearn::TVec< T >::subVec(). Referenced by PLearn::ConjGradientOptimizer::computeCostAndDerivative(), PLearn::ConjGradientOptimizer::computeCostValue(), PLearn::ConjGradientOptimizer::computeDerivative(), PLearn::ConjGradientOptimizer::gSearch(), PLearn::ConjGradientOptimizer::lineSearch(), PLearn::ScaledGradientOptimizer::optimize(), and PLearn::AdaptGradientOptimizer::optimizeN(). |
|
value += step_size*gradient; gradient.clear();
Definition at line 227 of file VarArray.h. References PLearn::TVec< Var >::data(), and PLearn::TVec< Var >::size(). Referenced by PLearn::GradientOptimizer::optimize(), PLearn::GradientOptimizer::optimizeN(), and PLearn::AdaptGradientOptimizer::optimizeN(). |
|
Reimplemented from PLearn::Array< Var >. Definition at line 948 of file VarArray.cc. References PLearn::TVec< Var >::data(), PLearn::PP< Variable >::isNull(), and PLearn::TVec< Var >::size(). |