change_of_basis_op Class Reference

Change-of-basis (transformation) operator. More...

#include <change_of_basis_op.h>

List of all members.

Public Member Functions

 change_of_basis_op (rt_mx const &c, rt_mx const &c_inv)
 Initializes the change-of-basis operator with c and c_inv.
 change_of_basis_op (rt_mx const &c)
 Initializes the change-of-basis operator with c.
 change_of_basis_op (parse_string &symbol, const char *stop_chars="", int r_den=cb_r_den, int t_den=cb_t_den)
 Initializes the change-of-basis operator with matrix given as xyz, hkl, or abc string.
 change_of_basis_op (std::string const &symbol, const char *stop_chars="", int r_den=cb_r_den, int t_den=cb_t_den)
 Initializes the change-of-basis operator with matrix given as xyz, hkl, or abc string.
 change_of_basis_op (int r_den=cb_r_den, int t_den=cb_t_den)
 Initializes the change-of-basis operator with unit matrices.
bool is_valid () const
 Tests if the change-of-basis operator is valid.
change_of_basis_op identity_op () const
 Returns a new change-of-basis operator with unit matrices.
bool is_identity_op () const
 Tests if the change-of-basis operator is the identity.
change_of_basis_op new_denominators (int r_den, int t_den) const
 Returns a new copy with the denominators r_den and t_den.
change_of_basis_op new_denominators (change_of_basis_op const &other) const
rt_mx const & c () const
 Returns the change-of-basis matrix.
rt_mx const & c_inv () const
 Returns the inverse of the change-of-basis matrix.
rt_mx const & select (bool inv) const
 Returns c() for inv == false, and c_inv() for inv == true.
change_of_basis_op inverse () const
 Returns a new copy with c() and c_inv() swapped.
void mod_positive_in_place ()
 Applies modulus operation such that 0 <= x < t_den.
void mod_short_in_place ()
 Applies modulus operation such that -t_den/2+1 < x <= t_den/2.
change_of_basis_op mod_short () const
 Applies modulus operation such that -t_den/2+1 < x <= t_den/2.
rot_mx operator() (rot_mx const &r) const
 c().r() * r * c_inv().r(), for r with rotation part denominator 1.
rt_mx operator() (rt_mx const &s) const
 c() * s * c_inv(), for s with rotation part denominator 1.
rt_mx apply (rt_mx const &s) const
 c() * s * c_inv(), for s with any rotation part denominator.
uctbx::unit_cell apply (uctbx::unit_cell const &unit_cell) const
 Deprecated. Use cctbx::uctbx::unit_cell::change_basis(cb_op) instead.
miller::index apply (miller::index<> const &miller_index) const
 Transforms a Miller index.
af::shared< miller::index<> > apply (af::const_ref< miller::index<> > const &miller_indices) const
 Transforms an array of Miller indices.
af::shared< std::size_t > apply_results_in_non_integral_indices (af::const_ref< miller::index<> > const &miller_indices) const
 Flags Miller indices for which apply() leads to non-integral indices.
tr_vec operator() (tr_vec const &t, int sign_identity) const
 c() * (rt_mx(rot_mx(sign_identity), t)) * c_inv()
template<class FloatType>
fractional< FloatType > operator() (fractional< FloatType > const &site_frac) const
 Transform fractional coordinates: c() * site_frac.
void update (change_of_basis_op const &other)
 c() = other.c() * c(); c_inv() = c_inv() * other.c_inv();
void update (tr_vec const &shift)
 c() = (I|shift) * c(); c_inv() = c_inv() * (I|-shift);
change_of_basis_op operator* (change_of_basis_op const &rhs)
 Multiplication of change-of-basis operators.
std::string as_xyz (bool decimal=false, bool t_first=false, const char *symbol_letters="xyz", const char *separator=",") const
 Returns c() in xyz format.
std::string as_hkl (bool decimal=false, const char *letters_hkl="hkl", const char *separator=",") const
 Returns transpose of c_inv() in hkl format.
std::string as_abc (bool decimal=false, bool t_first=false, const char *letters_abc="abc", const char *separator=",") const
 Returns transpose of c_inv() in abc format.
std::string symbol () const
 Returns abc format, or xyz if it is shorter than abc.


Detailed Description

Change-of-basis (transformation) operator.

For ease of use, a change-of-basis matrix c() and its inverse c_inv() are grouped by this class.


Constructor & Destructor Documentation

change_of_basis_op ( rt_mx const &  c,
rt_mx const &  c_inv 
) [inline]

Initializes the change-of-basis operator with c and c_inv.

The input matrices are NOT checked for consistency.

Referenced by change_of_basis_op::identity_op(), change_of_basis_op::inverse(), change_of_basis_op::mod_short(), change_of_basis_op::new_denominators(), and change_of_basis_op::operator*().

change_of_basis_op ( rt_mx const &  c  )  [inline, explicit]

Initializes the change-of-basis operator with c.

The inverse matrix c_inv() is computed by inverting c. An exception is thrown if c is not invertible.

change_of_basis_op ( parse_string symbol,
const char *  stop_chars = "",
int  r_den = cb_r_den,
int  t_den = cb_t_den 
)

Initializes the change-of-basis operator with matrix given as xyz, hkl, or abc string.

An exception is thrown if the given matrix is not invertible.

See also: constructor of class rt_mx

Not available in Python.

change_of_basis_op ( std::string const &  symbol,
const char *  stop_chars = "",
int  r_den = cb_r_den,
int  t_den = cb_t_den 
)

Initializes the change-of-basis operator with matrix given as xyz, hkl, or abc string.

An exception is thrown if the given matrix is not invertible.

See also: constructor of class rt_mx

change_of_basis_op ( int  r_den = cb_r_den,
int  t_den = cb_t_den 
) [inline, explicit]

Initializes the change-of-basis operator with unit matrices.

The unit matrices are initialized with the rotation part denominator r_den and the translation part denominator t_den.


Member Function Documentation

bool is_valid (  )  const [inline]

Tests if the change-of-basis operator is valid.

A change_of_basis_op is valid only if the rotation part denominator and the translation part denominator of both c() and c_inv() are not zero.

References rt_mx::is_valid().

change_of_basis_op identity_op (  )  const [inline]

Returns a new change-of-basis operator with unit matrices.

The new matrices inherit the rotation and translation part denominators.

References change_of_basis_op::change_of_basis_op(), and rt_mx::unit_mx().

change_of_basis_op new_denominators ( int  r_den,
int  t_den 
) const [inline]

Returns a new copy with the denominators r_den and t_den.

An exception is thrown if the elements cannot be scaled to the new denominators.
r_den or t_den == 0 indicates that the corresponding old denominator is retained.

References change_of_basis_op::change_of_basis_op(), and rt_mx::new_denominators().

Referenced by change_of_basis_op::operator*(), and change_of_basis_op::update().

change_of_basis_op new_denominators ( change_of_basis_op const &  other  )  const [inline]

Returns a new copy of the operator, but with the denominators of other.

An exception is thrown if the elements cannot be scaled to the new denominators.

References change_of_basis_op::c(), change_of_basis_op::c_inv(), change_of_basis_op::change_of_basis_op(), and rt_mx::new_denominators().

void mod_positive_in_place (  )  [inline]

Applies modulus operation such that 0 <= x < t_den.

The operation is applied to the elements of the translation vectors of c() and c_inv(). The vectors are modified in place.

References rt_mx::mod_positive_in_place().

void mod_short_in_place (  )  [inline]

Applies modulus operation such that -t_den/2+1 < x <= t_den/2.

The operation is applied to the elements of the translation vectors of c() and c_inv(). The vectors are modified in place.

References rt_mx::mod_short_in_place().

change_of_basis_op mod_short (  )  const [inline]

Applies modulus operation such that -t_den/2+1 < x <= t_den/2.

The operation is applied to the elements of the translation vectors of c() and c_inv().

References change_of_basis_op::change_of_basis_op(), and rt_mx::mod_short().

rot_mx operator() ( rot_mx const &  r  )  const

c().r() * r * c_inv().r(), for r with rotation part denominator 1.

The rotation part denominator of the result is 1.

Not available in Python.

rt_mx operator() ( rt_mx const &  s  )  const

c() * s * c_inv(), for s with rotation part denominator 1.

Similar to apply(s), but faster. The translation denominator of the result is equal to the translation denominator of s.

Not available in Python.

rt_mx apply ( rt_mx const &  s  )  const

c() * s * c_inv(), for s with any rotation part denominator.

Similar to opertor()(). s may have any rotation part denominator or translation part denominator. The denominators of the result are made as small as possible.

See also: rt_mx::multiply(), rt_mx::cancel()

Referenced by site_symmetry_ops::change_basis().

miller::index apply ( miller::index<> const &  miller_index  )  const

Transforms a Miller index.

result = miller_index * c_inv()

af::shared<miller::index<> > apply ( af::const_ref< miller::index<> > const &  miller_indices  )  const

Transforms an array of Miller indices.

result = miller_indices * c_inv()

tr_vec operator() ( tr_vec const &  t,
int  sign_identity 
) const

c() * (rt_mx(rot_mx(sign_identity), t)) * c_inv()

Not available in Python.

void update ( tr_vec const &  shift  )  [inline]

c() = (I|shift) * c(); c_inv() = c_inv() * (I|-shift);

Not available in Python.

References tr_vec::den(), rt_mx::r(), and rt_mx::t().

std::string as_xyz ( bool  decimal = false,
bool  t_first = false,
const char *  symbol_letters = "xyz",
const char *  separator = "," 
) const [inline]

Returns c() in xyz format.

See also: rt_mx::as_xyz()

References rt_mx::as_xyz().

Referenced by change_of_basis_op::as_abc(), and change_of_basis_op::symbol().

std::string as_hkl ( bool  decimal = false,
const char *  letters_hkl = "hkl",
const char *  separator = "," 
) const [inline]

Returns transpose of c_inv() in hkl format.

c_inv.t() must be zero. An exception is thrown otherwise.

See also: rt_mx::as_xyz(), rot_mx::as_hkl()

References rot_mx::as_hkl(), CCTBX_ASSERT, tr_vec::is_zero(), rt_mx::r(), and rt_mx::t().

std::string as_abc ( bool  decimal = false,
bool  t_first = false,
const char *  letters_abc = "abc",
const char *  separator = "," 
) const [inline]

Returns transpose of c_inv() in abc format.

See also: rt_mx::as_xyz()

References change_of_basis_op::as_xyz(), rt_mx::r(), rt_mx::t(), and rot_mx::transpose().

Referenced by change_of_basis_op::symbol().

std::string symbol (  )  const [inline]

Returns abc format, or xyz if it is shorter than abc.

See also: as_abc(), as_xyz()

References change_of_basis_op::as_abc(), and change_of_basis_op::as_xyz().


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

Generated on Wed Oct 29 19:59:03 2008 for cctbx by  doxygen 1.5.6