IMP Reference Guide
develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
|
Add weights to a particle. More...
#include <IMP/isd/Weight.h>
Add weights to a particle.
Weights are constrained to the unit simplex.
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_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... | |
Model * | get_model () const |
Returns the Model containing the particle. More... | |
Particle * | get_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 | |
Particle * | operator-> () 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_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 pa) |
static Weight | setup_particle (IMP::ParticleAdaptor pa, 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 pa, const algebra::VectorKD &w) |
Additional Inherited Members | |
Protected Member Functions inherited from IMP::Decorator | |
Decorator (Model *m, ParticleIndex pi) | |
Decorator (ParticleAdaptor p) | |
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 |
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 |
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.
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 |
|
static |
Set up an empty Weight.
Weights must be added with add_weight() before use.
|
static |
|
static |
|
static |
|
static |