IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform

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.
void add_to_weights_derivatives (const algebra::VectorKD &dw, const DerivativeAccumulator &da)
 Add to derivatives wrt all weights.
void add_weight (Float wi=0)
 Extend the weight vector by one element.
void add_weight_lazy (Float wi=0)
 Extend the weight vector by one element lazily.
Int get_number_of_weights () const
 Get number of weights.
algebra::UnitSimplexKD get_unit_simplex () const
 Get unit simplex on which weight vector lies.
Float get_weight (int i) const
 Get the ith weight.
Float get_weight_derivative (int i) const
 Get derivative wrt ith weight.
FloatKeys get_weight_keys () const
 Get all weight keys.
algebra::VectorKD get_weights () const
 Get all weights.
bool get_weights_are_optimized () const
 Get weights are optimized.
algebra::VectorKD get_weights_derivatives () const
 Get derivatives wrt all weights.
void set_number_of_weights (Int nweights)
 Set number of weights.
void set_number_of_weights_lazy (Int nweights)
 Set number of weights lazily.
void set_weight_lazy (int i, Float wi)
 Set the ith weight lazily.
void set_weights (const algebra::VectorKD &w)
 Set all weights, enforcing the simplex constraint.
void set_weights_are_optimized (bool tf)
 Set weights are optimized.
void set_weights_lazy (const algebra::VectorKD &w)
 Set all the weights.
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.
Model * get_model () const
 Returns the Model containing the particle.
Particle * get_particle () const
 Returns the particle decorated by this decorator.
ParticleIndex get_particle_index () const
 Returns the particle index decorated by this decorator.
 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.
static FloatKey get_weight_key (int i)
 Get ith weight key.
static Weight setup_particle (IMP::ParticleAdaptor pa)
static Weight setup_particle (IMP::ParticleAdaptor pa, const algebra::VectorKD &w)
static Weight setup_particle (IMP::ParticleAdaptor pa, Int nweights)
static Weight setup_particle (Model *m, ParticleIndex pi)
 Set up an empty Weight.
static Weight setup_particle (Model *m, ParticleIndex pi, const algebra::VectorKD &w)
 Set up Weight from the provided weight vector.
static Weight setup_particle (Model *m, ParticleIndex pi, Int nweights)
 Set up Weight with a fixed number of weights.

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ Weight() [1/3]

IMP::isd::Weight::Weight ( )

Definition at line 44 of file Weight.h.

◆ Weight() [2/3]

IMP::isd::Weight::Weight ( ::IMP::Model * m,
::IMP::ParticleIndex id )

Definition at line 44 of file Weight.h.

◆ Weight() [3/3]

IMP::isd::Weight::Weight ( const IMP::ParticleAdaptor & d)
explicit

Definition at line 44 of file Weight.h.

Member Function Documentation

◆ add_to_weight_derivative()

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

Add to derivative wrt ith weight.

◆ add_to_weights_derivatives()

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

Add to derivatives wrt all weights.

◆ add_weight()

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.

◆ add_weight_lazy()

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().

◆ get_is_setup()

bool IMP::isd::Weight::get_is_setup ( const IMP::ParticleAdaptor & p)
static

Definition at line 44 of file Weight.h.

◆ get_number_of_weights()

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

Get number of weights.

◆ get_number_of_weights_key()

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

Get number of weights key.

◆ get_unit_simplex()

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

Get unit simplex on which weight vector lies.

◆ get_weight()

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

Get the ith weight.

◆ get_weight_derivative()

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

Get derivative wrt ith weight.

◆ get_weight_key()

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

Get ith weight key.

◆ get_weight_keys()

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

Get all weight keys.

◆ get_weights()

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

Get all weights.

◆ get_weights_are_optimized()

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

Get weights are optimized.

◆ get_weights_derivatives()

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

Get derivatives wrt all weights.

◆ set_number_of_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.

◆ set_number_of_weights_lazy()

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().

◆ set_weight_lazy()

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

Set the ith weight lazily.

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

◆ set_weights()

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

Set all weights, enforcing the simplex constraint.

See also
algebra::get_projected

◆ set_weights_are_optimized()

void IMP::isd::Weight::set_weights_are_optimized ( bool tf)

Set weights are optimized.

◆ set_weights_lazy()

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

Set all the weights.

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

◆ setup_particle() [1/6]

Weight IMP::isd::Weight::setup_particle ( IMP::ParticleAdaptor pa)
static
Returns
a Weight object that decorates the particle specified by pa
See also
setup_particle(m, p)

Definition at line 48 of file Weight.h.

◆ setup_particle() [2/6]

Weight IMP::isd::Weight::setup_particle ( IMP::ParticleAdaptor pa,
const algebra::VectorKD & w )
static
Returns
a Weight object that decorates the particle specified by pa
See also
setup_particle(m, pi, w)

Definition at line 55 of file Weight.h.

◆ setup_particle() [3/6]

Weight IMP::isd::Weight::setup_particle ( IMP::ParticleAdaptor pa,
Int nweights )
static
Returns
a Weight object that decorates the particle specified by pa
See also
setup_particle(m, pi, nweights)

Definition at line 52 of file Weight.h.

◆ setup_particle() [4/6]

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.

Returns
a Weight object that decorates particle pi

Definition at line 48 of file Weight.h.

◆ setup_particle() [5/6]

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

Set up Weight from the provided weight vector.

Returns
a Weight object that decorates particle pi

Definition at line 55 of file Weight.h.

◆ setup_particle() [6/6]

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.

Returns
a Weight object that decorates particle pi

Definition at line 52 of file Weight.h.


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