IMP logo
IMP Reference Guide  develop.731656d855,2020/02/17
The Integrative Modeling Platform
IMP::isd::Weight Class Reference

Add weights to a particle. More...

#include <IMP/isd/Weight.h>

+ Inheritance diagram for IMP::isd::Weight:

Detailed Description

Add weights to a particle.

Weights are constrained to the unit simplex.

See Also
algebra::UnitSimplexD

Definition at line 29 of file Weight.h.

Public Member Functions

 Weight (::IMP::Model *m,::IMP::ParticleIndex id)
 
 Weight (const IMP::ParticleAdaptor &d)
 
void add_to_weight_derivative (int i, Float dwi, const DerivativeAccumulator &da)
 Add to derivative wrt ith weight. More...
 
void add_to_weights_derivatives (const algebra::VectorKD &dw, const DerivativeAccumulator &da)
 Add to derivatives wrt all weights. More...
 
void add_weight (Float wi=0)
 Extend the weight vector by one element. More...
 
void add_weight_lazy (Float wi=0)
 Extend the weight vector by one element lazily. More...
 
Int get_number_of_states () const
 
Int get_number_of_weights () const
 Get number of weights. More...
 
algebra::UnitSimplexKD get_unit_simplex () const
 Get unit simplex on which weight vector lies. More...
 
Float get_weight (int i) const
 Get the ith weight. More...
 
Float get_weight_derivative (int i) const
 Get derivative wrt ith weight. More...
 
FloatKeys get_weight_keys () const
 Get all weight keys. More...
 
algebra::VectorKD get_weights () const
 Get all weights. More...
 
bool get_weights_are_optimized () const
 Get weights are optimized. More...
 
algebra::VectorKD get_weights_derivatives () const
 Get derivatives wrt all weights. More...
 
void set_number_of_weights (Int nweights)
 Set number of weights. More...
 
void set_number_of_weights_lazy (Int nweights)
 Set number of weights lazily. More...
 
void set_weight_lazy (int i, Float wi)
 Set the ith weight lazily. More...
 
void set_weights (const algebra::VectorKD &w)
 Set all weights, enforcing the simplex constraint. More...
 
void set_weights_are_optimized (bool tf)
 Set weights are optimized. More...
 
void set_weights_lazy (const algebra::VectorKD &w)
 Set all the weights. More...
 
void show (std::ostream &out=std::cout) const
 
- Public Member Functions inherited from IMP::Decorator
bool get_is_valid () const
 Returns true if constructed with a non-default constructor. More...
 
Modelget_model () const
 Returns the Model containing the particle. More...
 
Particleget_particle () const
 Returns the particle decorated by this decorator. More...
 
ParticleIndex get_particle_index () const
 Returns the particle index decorated by this decorator. More...
 
 operator Particle * () const
 
 operator ParticleIndex () const
 
Particleoperator-> () const
 

Static Public Member Functions

static bool get_is_setup (const IMP::ParticleAdaptor &p)
 
static bool get_is_setup (Model *m, ParticleIndex pi)
 
static IntKey get_nstates_key ()
 
static IntKey get_number_of_weights_key ()
 Get number of weights key. More...
 
static FloatKey get_weight_key (int i)
 Get ith weight key. More...
 
static Weight setup_particle (Model *m, ParticleIndex pi)
 Set up an empty Weight. More...
 
static Weight setup_particle (IMP::ParticleAdaptor decorator)
 
static Weight setup_particle (IMP::ParticleAdaptor decorator, Int nweights)
 
static Weight setup_particle (Model *m, ParticleIndex pi, Int nweights)
 Set up Weight with a fixed number of weights. More...
 
static Weight setup_particle (Model *m, ParticleIndex pi, const algebra::VectorKD &w)
 Set up Weight from the provided weight vector. More...
 
static Weight setup_particle (IMP::ParticleAdaptor decorator, const algebra::VectorKD &w)
 

Additional Inherited Members

- Protected Member Functions inherited from IMP::Decorator
 Decorator (Model *m, ParticleIndex pi)
 
 Decorator (ParticleAdaptor p)
 

Member Function Documentation

void IMP::isd::Weight::add_to_weight_derivative ( int  i,
Float  dwi,
const DerivativeAccumulator da 
)

Add to derivative wrt ith weight.

void IMP::isd::Weight::add_to_weights_derivatives ( const algebra::VectorKD dw,
const DerivativeAccumulator da 
)

Add to derivatives wrt all weights.

void IMP::isd::Weight::add_weight ( Float  wi = 0)

Extend the weight vector by one element.

This should only be called during set-up and cannot be called for an optimized Weight.

void IMP::isd::Weight::add_weight_lazy ( Float  wi = 0)

Extend the weight vector by one element lazily.

This should only be called during set-up and cannot be called for an optimized Weight. This version delays enforcing the simplex constraint until Model::update().

Int IMP::isd::Weight::get_number_of_weights ( ) const

Get number of weights.

static IntKey IMP::isd::Weight::get_number_of_weights_key ( )
static

Get number of weights key.

algebra::UnitSimplexKD IMP::isd::Weight::get_unit_simplex ( ) const

Get unit simplex on which weight vector lies.

Float IMP::isd::Weight::get_weight ( int  i) const

Get the ith weight.

Float IMP::isd::Weight::get_weight_derivative ( int  i) const

Get derivative wrt ith weight.

static FloatKey IMP::isd::Weight::get_weight_key ( int  i)
static

Get ith weight key.

FloatKeys IMP::isd::Weight::get_weight_keys ( ) const

Get all weight keys.

algebra::VectorKD IMP::isd::Weight::get_weights ( ) const

Get all weights.

bool IMP::isd::Weight::get_weights_are_optimized ( ) const

Get weights are optimized.

algebra::VectorKD IMP::isd::Weight::get_weights_derivatives ( ) const

Get derivatives wrt all weights.

void IMP::isd::Weight::set_number_of_weights ( Int  nweights)

Set number of weights.

This should only be called during set-up and cannot be called for an optimized Weight. New weights are initialized to 0.

void IMP::isd::Weight::set_number_of_weights_lazy ( Int  nweights)

Set number of weights lazily.

This should only be called during set-up and cannot be called for an optimized Weight. New weights are initialized to 0. This version delays enforcing the simplex constraint until Model::update().

void IMP::isd::Weight::set_weight_lazy ( int  i,
Float  wi 
)

Set the ith weight lazily.

Delay enforcing the simplex constraint until Model::update().

void IMP::isd::Weight::set_weights ( const algebra::VectorKD w)

Set all weights, enforcing the simplex constraint.

See Also
algebra::get_projected
void IMP::isd::Weight::set_weights_are_optimized ( bool  tf)

Set weights are optimized.

void IMP::isd::Weight::set_weights_lazy ( const algebra::VectorKD w)

Set all the weights.

Delay enforcing the simplex constraint until Model::update().

static Weight IMP::isd::Weight::setup_particle ( Model m,
ParticleIndex  pi 
)
static

Set up an empty Weight.

Weights must be added with add_weight() before use. Setup the particle so it can be used with this decorator.

Definition at line 48 of file Weight.h.

static Weight IMP::isd::Weight::setup_particle ( IMP::ParticleAdaptor  decorator,
Int  nweights 
)
static
See Also
setup_particle(m, pi, nweights )

Definition at line 52 of file Weight.h.

static Weight IMP::isd::Weight::setup_particle ( Model m,
ParticleIndex  pi,
Int  nweights 
)
static

Set up Weight with a fixed number of weights.

All weights are initialized with the same value. Setup the particle so that it can be used with this decorator

Definition at line 52 of file Weight.h.

static Weight IMP::isd::Weight::setup_particle ( IMP::ParticleAdaptor  decorator,
const algebra::VectorKD w 
)
static
See Also
setup_particle(m, pi, w )

Definition at line 55 of file Weight.h.

static Weight IMP::isd::Weight::setup_particle ( Model m,
ParticleIndex  pi,
const algebra::VectorKD w 
)
static

Set up Weight from the provided weight vector.

Setup the particle so that it can be used with this decorator

Definition at line 55 of file Weight.h.


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