You can subscribe to this list here.
| 2005 |
Jan
(70) |
Feb
(200) |
Mar
(222) |
Apr
(198) |
May
(122) |
Jun
(74) |
Jul
(171) |
Aug
(235) |
Sep
(118) |
Oct
(165) |
Nov
(276) |
Dec
(167) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(102) |
Feb
(124) |
Mar
(90) |
Apr
(155) |
May
(162) |
Jun
(285) |
Jul
(142) |
Aug
(136) |
Sep
(251) |
Oct
(188) |
Nov
(156) |
Dec
(144) |
| 2007 |
Jan
(231) |
Feb
(151) |
Mar
(142) |
Apr
(69) |
May
(66) |
Jun
(88) |
Jul
(61) |
Aug
(82) |
Sep
(125) |
Oct
(167) |
Nov
(115) |
Dec
(70) |
| 2008 |
Jan
(112) |
Feb
(109) |
Mar
(163) |
Apr
(239) |
May
(185) |
Jun
(147) |
Jul
(123) |
Aug
(142) |
Sep
(134) |
Oct
(106) |
Nov
(151) |
Dec
(114) |
| 2009 |
Jan
(143) |
Feb
(188) |
Mar
(121) |
Apr
(188) |
May
(193) |
Jun
(113) |
Jul
(161) |
Aug
(172) |
Sep
(95) |
Oct
(157) |
Nov
(123) |
Dec
(112) |
| 2010 |
Jan
(61) |
Feb
(115) |
Mar
(163) |
Apr
(138) |
May
(152) |
Jun
(133) |
Jul
(228) |
Aug
(135) |
Sep
(230) |
Oct
(214) |
Nov
(178) |
Dec
(225) |
| 2011 |
Jan
(197) |
Feb
(284) |
Mar
(244) |
Apr
(190) |
May
(119) |
Jun
(195) |
Jul
(305) |
Aug
(204) |
Sep
(175) |
Oct
(196) |
Nov
(166) |
Dec
(170) |
| 2012 |
Jan
(203) |
Feb
(197) |
Mar
(255) |
Apr
(153) |
May
(111) |
Jun
(130) |
Jul
(82) |
Aug
(207) |
Sep
(103) |
Oct
(173) |
Nov
(150) |
Dec
(171) |
| 2013 |
Jan
(156) |
Feb
(242) |
Mar
(216) |
Apr
(264) |
May
(116) |
Jun
(218) |
Jul
(192) |
Aug
(255) |
Sep
(157) |
Oct
(209) |
Nov
(227) |
Dec
(222) |
| 2014 |
Jan
(207) |
Feb
(214) |
Mar
(223) |
Apr
(125) |
May
(183) |
Jun
(213) |
Jul
(219) |
Aug
(230) |
Sep
(195) |
Oct
(275) |
Nov
(179) |
Dec
(163) |
| 2015 |
Jan
(227) |
Feb
(148) |
Mar
(148) |
Apr
(178) |
May
(228) |
Jun
(195) |
Jul
(155) |
Aug
(168) |
Sep
(168) |
Oct
(151) |
Nov
(259) |
Dec
(137) |
| 2016 |
Jan
(127) |
Feb
(244) |
Mar
(219) |
Apr
(266) |
May
(120) |
Jun
(366) |
Jul
(211) |
Aug
(203) |
Sep
(222) |
Oct
(155) |
Nov
(97) |
Dec
|
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-29 09:26:00
|
Update of /cvsroot/cctbx/cctbx/maptbx/boost_python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16697/maptbx/boost_python Modified Files: maptbx_ext.cpp tst_maptbx.py Log Message: new maptbx::copy(map_unit_cell, first, last) for copying blocks Index: tst_maptbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/maptbx/boost_python/tst_maptbx.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tst_maptbx.py 7 Dec 2004 01:21:26 -0000 1.23 --- tst_maptbx.py 29 Jan 2005 09:25:39 -0000 1.24 *************** *** 14,22 **** m = flex_type((1,2,3,4)) m.resize(flex.grid(2,2)) ! c = maptbx.copy(m, m.accessor()) assert tuple(m) == tuple(c) ! c = maptbx.copy(m, flex.grid(2,3).set_focus(2,2)) assert approx_equal(tuple(c), (1,2,0,3,4,0)) ! n = maptbx.copy(c, m.accessor()) assert approx_equal(tuple(m), tuple(n)) c = maptbx.copy(m, flex.grid(3,2).set_focus(2,2)) --- 14,22 ---- m = flex_type((1,2,3,4)) m.resize(flex.grid(2,2)) ! c = maptbx.copy(map=m, result_grid=m.accessor()) assert tuple(m) == tuple(c) ! c = maptbx.copy(map=m, result_grid=flex.grid(2,3).set_focus(2,2)) assert approx_equal(tuple(c), (1,2,0,3,4,0)) ! n = maptbx.copy(c, result_grid=m.accessor()) assert approx_equal(tuple(m), tuple(n)) c = maptbx.copy(m, flex.grid(3,2).set_focus(2,2)) *************** *** 36,39 **** --- 36,55 ---- n = maptbx.copy(c, m.accessor()) assert approx_equal(tuple(m), tuple(n)) + # + m = flex_type() + for i in xrange(2): + for j in xrange(3): + for k in xrange(5): + m.append(i*100+j*10+k) + m.resize(flex.grid(2,3,5).set_focus((2,3,4))) + for i in xrange(-5,5): + for j in xrange(-5,5): + for k in xrange(-5,5): + c = maptbx.copy(map_unit_cell=m, first=(i,j,k), last=(i,j,k)) + assert c.size() == 1 + assert c[(i,j,k)] == m[(i%2,j%3,k%4)] + c = maptbx.copy(map_unit_cell=m, first=(-1,1,-2), last=(1,2,0)) + assert list(c) == [112, 113, 110, 122, 123, 120, 12, 13, 10, + 22, 23, 20, 112, 113, 110, 122, 123, 120] def exercise_statistics(): Index: maptbx_ext.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/maptbx/boost_python/maptbx_ext.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** maptbx_ext.cpp 7 Dec 2004 01:21:26 -0000 1.12 --- maptbx_ext.cpp 29 Jan 2005 09:25:38 -0000 1.13 *************** *** 39,50 **** def("copy", (af::versa<float, af::flex_grid<> >(*) ! (af::const_ref<float, af::flex_grid<> > const& map, ! af::flex_grid<> const& result_grid)) ! maptbx::copy); def("copy", (af::versa<double, af::flex_grid<> >(*) ! (af::const_ref<double, af::flex_grid<> > const& map, ! af::flex_grid<> const& result_grid)) ! maptbx::copy); def("eight_point_interpolation", --- 39,68 ---- def("copy", (af::versa<float, af::flex_grid<> >(*) ! (af::const_ref<float, af::flex_grid<> > const&, ! af::flex_grid<> const&)) maptbx::copy, ( ! arg_("map"), ! arg_("result_grid"))); def("copy", (af::versa<double, af::flex_grid<> >(*) ! (af::const_ref<double, af::flex_grid<> > const&, ! af::flex_grid<> const&)) maptbx::copy, ( ! arg_("map"), ! arg_("result_grid"))); ! def("copy", ! (af::versa<float, af::flex_grid<> >(*) ! (af::const_ref<float, c_grid_padded_p1<3> > const&, ! af::int3 const&, ! af::int3 const&)) maptbx::copy, ( ! arg_("map_unit_cell"), ! arg_("first"), ! arg_("last"))); ! def("copy", ! (af::versa<double, af::flex_grid<> >(*) ! (af::const_ref<double, c_grid_padded_p1<3> > const&, ! af::int3 const&, ! af::int3 const&)) maptbx::copy, ( ! arg_("map_unit_cell"), ! arg_("first"), ! arg_("last"))); def("eight_point_interpolation", |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-29 09:25:46
|
Update of /cvsroot/cctbx/cctbx/include/cctbx/maptbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16697/include/cctbx/maptbx Modified Files: copy.h Log Message: new maptbx::copy(map_unit_cell, first, last) for copying blocks Index: copy.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/maptbx/copy.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** copy.h 21 Jan 2004 07:33:34 -0000 1.4 --- copy.h 29 Jan 2005 09:25:37 -0000 1.5 *************** *** 57,60 **** --- 57,82 ---- } + template <typename OutFloatType, typename InpFloatType> + af::versa<OutFloatType, af::flex_grid<> > + copy( + af::const_ref<InpFloatType, c_grid_padded_p1<3> > const& map_unit_cell, + af::int3 const& first, + af::int3 const& last) + { + CCTBX_ASSERT(first.all_le(last)); + af::flex_grid_default_index_type first_(af::adapt(first)); + af::flex_grid_default_index_type last_(af::adapt(last)); + af::versa<OutFloatType, af::flex_grid<> > result( + af::flex_grid<>(first_, last_, false)); + OutFloatType* out_ptr = result.begin(); + typename c_grid_padded_p1<3>::index_type out_pt; + for (out_pt[0] = first[0]; out_pt[0] <= last[0]; out_pt[0]++) { + for (out_pt[1] = first[1]; out_pt[1] <= last[1]; out_pt[1]++) { + for (out_pt[2] = first[2]; out_pt[2] <= last[2]; out_pt[2]++) { + *out_ptr++ = static_cast<OutFloatType>(map_unit_cell(out_pt)); + }}} + return result; + } + }} // namespace cctbx::maptbx |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 19:25:25
|
Update of /cvsroot/cctbx/iotbx/iotbx/regression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1213 Modified Files: tst_reflection_statistics.py Log Message: attempt to work around strange Python 2.2.1 C assert failure Index: tst_reflection_statistics.py =================================================================== RCS file: /cvsroot/cctbx/iotbx/iotbx/regression/tst_reflection_statistics.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tst_reflection_statistics.py 3 Jan 2005 19:55:01 -0000 1.3 --- tst_reflection_statistics.py 28 Jan 2005 19:22:30 -0000 1.4 *************** *** 1,2 **** --- 1,3 ---- + from cctbx.array_family import flex from iotbx.command_line import reflection_statistics from iotbx import mtz *************** *** 6,10 **** from cctbx.sgtbx import subgroups from cctbx.development import debug_utils - from cctbx.array_family import flex from cStringIO import StringIO import sys --- 7,10 ---- |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 17:06:47
|
Update of /cvsroot/cctbx/cctbx/cctbx/regression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29621 Modified Files: tst_reflection_statistics.py Log Message: fixed random seed to avoid rare failures Index: tst_reflection_statistics.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/regression/tst_reflection_statistics.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tst_reflection_statistics.py 4 Jan 2005 20:48:11 -0000 1.3 --- tst_reflection_statistics.py 28 Jan 2005 17:06:12 -0000 1.4 *************** *** 12,16 **** import sys ! if (0): random.seed(0) flex.set_random_seed(0) --- 12,16 ---- import sys ! if (1): # fixed random seed to avoid rare failures random.seed(0) flex.set_random_seed(0) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 16:53:18
|
Update of /cvsroot/cctbx/cctbx/dox/rst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25684 Modified Files: versions.txt Log Message: newsletter link to cci web server Index: versions.txt =================================================================== RCS file: /cvsroot/cctbx/cctbx/dox/rst/versions.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** versions.txt 28 Jan 2005 01:42:38 -0000 1.9 --- versions.txt 28 Jan 2005 16:52:38 -0000 1.10 *************** *** 26,30 **** - `No. 4, 2004/08 <http://cci.lbl.gov/publications/download/iucrcompcomm_aug2004.pdf>`_ ! - `No. 5, 2005/01 <http://iucrcomputing.ccp14.ac.uk/iucr-top/comm/ccom/newsletters/2005jan/>`_ - Python interfaces: --- 26,30 ---- - `No. 4, 2004/08 <http://cci.lbl.gov/publications/download/iucrcompcomm_aug2004.pdf>`_ ! - `No. 5, 2005/01 <http://cci.lbl.gov/publications/download/iucrcompcomm_jan2005.pdf>`_ - Python interfaces: |
|
From: Pavel A. <af...@us...> - 2005-01-28 16:39:12
|
Update of /cvsroot/cctbx/cctbx/cctbx/xray In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22039 Modified Files: target_functors.py Log Message: step for integration is hidden now in fmodel Index: target_functors.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/xray/target_functors.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** target_functors.py 14 Jan 2005 03:31:30 -0000 1.14 --- target_functors.py 28 Jan 2005 16:38:36 -0000 1.15 *************** *** 25,29 **** flags, abcd = None, - step_for_integration = None, weights = None, use_sigmas_as_weights = False, --- 25,28 ---- *************** *** 39,43 **** self.f_obs_t = self.f_obs if(self.target_name == "mlhl"): ! assert self.abcd is not None and self.step_for_integration if(self.abcd is not None): if(self.target_name == "mlhl"): --- 38,42 ---- self.f_obs_t = self.f_obs if(self.target_name == "mlhl"): ! assert self.abcd is not None if(self.abcd is not None): if(self.target_name == "mlhl"): *************** *** 86,91 **** return maximum_likelihood_criterion_hl( f_obs = f_obs, ! abcd = abcd.data(), ! step_for_integration = self.step_for_integration) def target_functor_t(self, selection = None): --- 85,89 ---- return maximum_likelihood_criterion_hl( f_obs = f_obs, ! abcd = abcd.data()) def target_functor_t(self, selection = None): *************** *** 112,117 **** return maximum_likelihood_criterion_hl( f_obs = f_obs, ! abcd = abcd.data(), ! step_for_integration = self.step_for_integration) --- 110,114 ---- return maximum_likelihood_criterion_hl( f_obs = f_obs, ! abcd = abcd.data()) *************** *** 206,210 **** def __init__(self, f_obs, abcd, ! step_for_integration): adopt_init_args(self, locals(), hide=True) --- 203,207 ---- def __init__(self, f_obs, abcd, ! step_for_integration = 5.0): adopt_init_args(self, locals(), hide=True) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 06:19:31
|
Update of /cvsroot/cctbx/cctbx/sgtbx/boost_python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14605/sgtbx/boost_python Modified Files: space_group.cpp tst_sgtbx.py Log Message: new space_group.average_u_star(); generic average_tensor(), used by the new function, site_symmetry.average_u_star() and space_group.average_metrical_matrix() Index: space_group.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/boost_python/space_group.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** space_group.cpp 22 Dec 2004 00:24:54 -0000 1.12 --- space_group.cpp 28 Jan 2005 06:19:21 -0000 1.13 *************** *** 144,147 **** --- 144,151 ---- &w_t::is_compatible_unit_cell, is_compatible_unit_cell_overloads()) + .def("average_u_star", + (scitbx::sym_mat3<double>(w_t::*)( + scitbx::sym_mat3<double> const&) const) &w_t::average_u_star, ( + arg_("u_star"))) .def("build_derived_acentric_group", &w_t::build_derived_acentric_group) Index: tst_sgtbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/boost_python/tst_sgtbx.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** tst_sgtbx.py 28 Jan 2005 04:27:10 -0000 1.61 --- tst_sgtbx.py 28 Jan 2005 06:19:21 -0000 1.62 *************** *** 668,671 **** --- 668,673 ---- g = space_group("C 2y (x+y,-x+y+z,z)") assert g.is_compatible_unit_cell(u) + assert approx_equal(g.average_u_star(u_star=range(6,0,-1)), + (6.5, 5.5, 4.0, 3.5, 2.5, 1.5)) g = space_group("C 2 -2c") h = g.build_derived_reflection_intensity_group(anomalous_flag=True) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 06:19:30
|
Update of /cvsroot/cctbx/cctbx/include/cctbx/sgtbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14605/include/cctbx/sgtbx Modified Files: rt_mx.h site_symmetry.h space_group.h Log Message: new space_group.average_u_star(); generic average_tensor(), used by the new function, site_symmetry.average_u_star() and space_group.average_metrical_matrix() Index: space_group.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/sgtbx/space_group.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** space_group.h 22 Dec 2004 00:24:53 -0000 1.11 --- space_group.h 28 Jan 2005 06:19:20 -0000 1.12 *************** *** 477,481 **** */ uc_sym_mat3 ! average_metrical_matrix(uc_sym_mat3 const& g) const; //! Computes a unit cell compatible with the space group symmetry. --- 477,484 ---- */ uc_sym_mat3 ! average_metrical_matrix(uc_sym_mat3 const& g) const ! { ! return average_tensor(smx_.const_ref(), g, false); ! } //! Computes a unit cell compatible with the space group symmetry. *************** *** 504,507 **** --- 507,524 ---- } + /*! \brief Averages symmetrically equivalent u_star tensors to + obtain a tensor that satisfies the symmetry constraints. + */ + /*! The averaged tensor is equivalent to beta_inv + of Giacovazzo, Fundamentals of Crystallography 1992, + p. 189. + */ + template <class FloatType> + scitbx::sym_mat3<FloatType> + average_u_star(scitbx::sym_mat3<FloatType> const& u_star) const + { + return average_tensor(smx_.const_ref(), u_star, true); + } + //! The translation parts of the symmetry operations are set to 0. /*! If discard_z = false, the lattice translation vectors are not Index: rt_mx.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/sgtbx/rt_mx.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rt_mx.h 16 Dec 2004 02:53:44 -0000 1.8 --- rt_mx.h 28 Jan 2005 06:19:20 -0000 1.9 *************** *** 4,7 **** --- 4,8 ---- #include <cctbx/sgtbx/rot_mx.h> #include <cctbx/sgtbx/parse_string.h> + #include <scitbx/sym_mat3.h> #include <scitbx/array_family/tiny_types.h> #include <cctbx/import_scitbx_af.h> *************** *** 488,491 **** --- 489,528 ---- }; + //! Symmetry-averaged tensor. + /*! reciprocal_space = false: + sum[tensor.tensor_transpose_transform(r)] / matrices.size() + + reciprocal_space = true: + sum[tensor.tensor_transform(r)] / matrices.size() + + over all rotation parts r of matrices. + + See also: + Giacovazzo, Fundamentals of Crystallography 1992, p. 189. + + Not available in Python. + */ + template <class FloatType> + scitbx::sym_mat3<FloatType> + average_tensor( + af::const_ref<rt_mx> const& matrices, + scitbx::sym_mat3<FloatType> const& tensor, + bool reciprocal_space) + { + scitbx::sym_mat3<FloatType> result(0,0,0,0,0,0); + for (std::size_t i=0;i<matrices.size();i++) { + scitbx::mat3<FloatType> + r = matrices[i].r() + .as_floating_point(scitbx::type_holder<FloatType>()); + if (reciprocal_space) { + result += tensor.tensor_transform(r); + } + else { + result += tensor.tensor_transpose_transform(r); + } + } + return result / static_cast<FloatType>(matrices.size()); + } + }} // namespace cctbx::sgtbx Index: site_symmetry.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/sgtbx/site_symmetry.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** site_symmetry.h 4 Jul 2004 04:47:43 -0000 1.9 --- site_symmetry.h 28 Jan 2005 06:19:20 -0000 1.10 *************** *** 106,110 **** template <class FloatType> scitbx::sym_mat3<FloatType> ! average_u_star(scitbx::sym_mat3<FloatType> const& u_star) const; /*! \brief Construct a new site_symmetry_ops instance with the --- 106,113 ---- template <class FloatType> scitbx::sym_mat3<FloatType> ! average_u_star(scitbx::sym_mat3<FloatType> const& u_star) const ! { ! return average_tensor(matrices_.const_ref(), u_star, true); ! } /*! \brief Construct a new site_symmetry_ops instance with the *************** *** 182,200 **** } - template <class FloatType> - scitbx::sym_mat3<FloatType> - site_symmetry_ops:: - average_u_star(scitbx::sym_mat3<FloatType> const& u_star) const - { - scitbx::sym_mat3<FloatType> sum_r_u_rt(0,0,0,0,0,0); - for (std::size_t i=0;i<matrices_.size();i++) { - scitbx::mat3<FloatType> - r = matrices_[i].r() - .as_floating_point(scitbx::type_holder<FloatType>()); - sum_r_u_rt += u_star.tensor_transform(r); - } - return sum_r_u_rt / static_cast<FloatType>(matrices_.size()); - } - //! Numerically robust algorithm for the determination of site-symmetries. class site_symmetry : public site_symmetry_ops --- 185,188 ---- |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 06:19:29
|
Update of /cvsroot/cctbx/cctbx/sgtbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14605/sgtbx Modified Files: space_group.cpp Log Message: new space_group.average_u_star(); generic average_tensor(), used by the new function, site_symmetry.average_u_star() and space_group.average_metrical_matrix() Index: space_group.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/space_group.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** space_group.cpp 22 Dec 2004 00:24:54 -0000 1.9 --- space_group.cpp 28 Jan 2005 06:19:21 -0000 1.10 *************** *** 565,581 **** } - uc_sym_mat3 - space_group:: - average_metrical_matrix(uc_sym_mat3 const& g) const - { - typedef uc_sym_mat3::value_type float_type; - uc_sym_mat3 sum_r_g_rt(0,0,0,0,0,0); - for(std::size_t i_smx=0;i_smx<n_smx();i_smx++) { - uc_mat3 r(smx_[i_smx].r().as_double()); - sum_r_g_rt += g.tensor_transpose_transform(r); - } - return sum_r_g_rt / float_type(n_smx()); - } - af::shared<rt_mx> space_group::all_ops(int mod, bool cancel) const --- 565,568 ---- |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 06:19:29
|
Update of /cvsroot/cctbx/cctbx/cctbx/regression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14605/cctbx/regression Modified Files: tst_sgtbx.py Log Message: new space_group.average_u_star(); generic average_tensor(), used by the new function, site_symmetry.average_u_star() and space_group.average_metrical_matrix() Index: tst_sgtbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/regression/tst_sgtbx.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tst_sgtbx.py 28 Jan 2005 02:27:04 -0000 1.14 --- tst_sgtbx.py 28 Jan 2005 06:19:20 -0000 1.15 *************** *** 66,69 **** --- 66,70 ---- from cctbx import crystal from cctbx import adptbx + from scitbx import matrix site_symmetry = crystal.special_position_settings( crystal_symmetry).site_symmetry(site=(0,0,0)) *************** *** 72,79 **** assert site_symmetry.n_matrices() == group.order_p() adp_constraints = group.adp_constraints() ! u_cart = adptbx.random_rotate_ellipsoid( u_cart=[random.random() for i in xrange(3)] + [0,0,0]) ! u_star = adptbx.u_cart_as_u_star(unit_cell, u_cart) ! u_star = site_symmetry.average_u_star(u_star) independent_params = adp_constraints.independent_params(u_star) assert adp_constraints.n_independent_params() == independent_params.size() --- 73,84 ---- assert site_symmetry.n_matrices() == group.order_p() adp_constraints = group.adp_constraints() ! u_cart_p1 = adptbx.random_rotate_ellipsoid( u_cart=[random.random() for i in xrange(3)] + [0,0,0]) ! u_star_p1 = adptbx.u_cart_as_u_star(unit_cell, u_cart_p1) ! u_star = site_symmetry.average_u_star(u_star_p1) ! f = unit_cell.volume()**(2/3.) ! assert approx_equal( ! list(matrix.col(group.average_u_star(u_star=u_star_p1))*f), ! list(matrix.col(u_star)*f)) independent_params = adp_constraints.independent_params(u_star) assert adp_constraints.n_independent_params() == independent_params.size() |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 04:27:49
|
Update of /cvsroot/cctbx/cctbx/cctbx/sgtbx/direct_space_asu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25615/cctbx/sgtbx/direct_space_asu Modified Files: facet_analysis.py Log Message: second step of move cctbx::sgtbx::row_echelon -> scitbx::matrix::row_echelon: use code from new location; old implementation removed Index: facet_analysis.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/sgtbx/direct_space_asu/facet_analysis.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** facet_analysis.py 6 Sep 2004 07:40:50 -0000 1.6 --- facet_analysis.py 28 Jan 2005 04:26:57 -0000 1.7 *************** *** 1,8 **** from cctbx.sgtbx.direct_space_asu import cut_plane - from cctbx import sgtbx from cctbx.array_family import flex from scitbx import matrix ! from boost import rational from scitbx.python_utils import list_algebra def intersection(facets): --- 1,8 ---- from cctbx.sgtbx.direct_space_asu import cut_plane from cctbx.array_family import flex from scitbx import matrix ! import scitbx.math from scitbx.python_utils import list_algebra + from boost import rational def intersection(facets): *************** *** 18,27 **** m.resize(flex.grid(3,3)) t.resize(flex.grid(3,1)) ! r = sgtbx.row_echelon_form_t(m, t) assert r in (2,3) if (r != 3): return None t.resize(flex.grid(3)) sol = flex.int(3) ! d = sgtbx.row_echelon_back_substitution(m, t, sol) assert d > 0 return tuple([rational.int(s,d) for s in sol]) --- 18,27 ---- m.resize(flex.grid(3,3)) t.resize(flex.grid(3,1)) ! r = scitbx.math.row_echelon_form_t(m, t) assert r in (2,3) if (r != 3): return None t.resize(flex.grid(3)) sol = flex.int(3) ! d = scitbx.math.row_echelon_back_substitution_int(m, t, sol) assert d > 0 return tuple([rational.int(s,d) for s in sol]) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 04:27:49
|
Update of /cvsroot/cctbx/cctbx/cctbx/sgtbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25615/cctbx/sgtbx Modified Files: __init__.py Log Message: second step of move cctbx::sgtbx::row_echelon -> scitbx::matrix::row_echelon: use code from new location; old implementation removed Index: __init__.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/sgtbx/__init__.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** __init__.py 28 Jan 2005 01:42:38 -0000 1.29 --- __init__.py 28 Jan 2005 04:26:56 -0000 1.30 *************** *** 176,182 **** return uctbx.unit_cell(params) - def row_echelon_back_substitution(rt_mx, v=None, sol=None, indep=None): - return ext.row_echelon_back_substitution(rt_mx, v, sol, indep) - class _tr_vec(boost.python.injector, tr_vec): --- 176,179 ---- |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 04:27:49
|
Update of /cvsroot/cctbx/cctbx/include/cctbx/sgtbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25615/include/cctbx/sgtbx Modified Files: row_echelon_solve.h smith_normal_form.h Removed Files: row_echelon.h Log Message: second step of move cctbx::sgtbx::row_echelon -> scitbx::matrix::row_echelon: use code from new location; old implementation removed Index: smith_normal_form.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/sgtbx/smith_normal_form.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** smith_normal_form.h 9 Nov 2002 00:46:59 -0000 1.2 --- smith_normal_form.h 28 Jan 2005 04:26:58 -0000 1.3 *************** *** 1,15 **** - /* Copyright (c) 2001-2002 The Regents of the University of California - through E.O. Lawrence Berkeley National Laboratory, subject to - approval by the U.S. Department of Energy. - See files COPYRIGHT.txt and LICENSE.txt for further details. - - Revision history: - 2002 Sep: Refactored part of sgtbx/math.cpp (rwgk) - */ - #ifndef CCTBX_SGTBX_SMITH_NORMAL_FORM_H #define CCTBX_SGTBX_SMITH_NORMAL_FORM_H ! #include <cctbx/sgtbx/row_echelon.h> namespace cctbx { namespace sgtbx { --- 1,6 ---- #ifndef CCTBX_SGTBX_SMITH_NORMAL_FORM_H #define CCTBX_SGTBX_SMITH_NORMAL_FORM_H ! #include <scitbx/matrix/row_echelon.h> namespace cctbx { namespace sgtbx { *************** *** 26,34 **** for (;;) { ! row_echelon::form_t(m, p); if (m.is_diagonal()) break; m.transpose_in_place(); ! row_echelon::form_t(m, q); if (m.is_diagonal()) break; m.transpose_in_place(); --- 17,25 ---- for (;;) { ! scitbx::matrix::row_echelon::form_t(m, p); if (m.is_diagonal()) break; m.transpose_in_place(); ! scitbx::matrix::row_echelon::form_t(m, q); if (m.is_diagonal()) break; m.transpose_in_place(); Index: row_echelon_solve.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/sgtbx/row_echelon_solve.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** row_echelon_solve.h 9 Nov 2002 00:46:59 -0000 1.2 --- row_echelon_solve.h 28 Jan 2005 04:26:58 -0000 1.3 *************** *** 1,15 **** - /* Copyright (c) 2001-2002 The Regents of the University of California - through E.O. Lawrence Berkeley National Laboratory, subject to - approval by the U.S. Department of Energy. - See files COPYRIGHT.txt and LICENSE.txt for further details. - - Revision history: - 2002 Sep: Created (rwgk) - */ - #ifndef CCTBX_SGTBX_ROW_ECHELON_SOLVE_H #define CCTBX_SGTBX_ROW_ECHELON_SOLVE_H ! #include <cctbx/sgtbx/row_echelon.h> namespace cctbx { namespace sgtbx { namespace row_echelon { namespace solve { --- 1,8 ---- #ifndef CCTBX_SGTBX_ROW_ECHELON_SOLVE_H #define CCTBX_SGTBX_ROW_ECHELON_SOLVE_H ! #include <cctbx/sgtbx/basic.h> ! #include <cctbx/import_scitbx_af.h> ! #include <scitbx/matrix/row_echelon.h> namespace cctbx { namespace sgtbx { namespace row_echelon { namespace solve { *************** *** 17,21 **** af::tiny<sg_vec3, 4> homog_rank_1(scitbx::mat_const_ref<int> const& re_mx, ! row_echelon::independent<int> const& indep); af::tiny<sg_vec3, 4> --- 10,14 ---- af::tiny<sg_vec3, 4> homog_rank_1(scitbx::mat_const_ref<int> const& re_mx, ! scitbx::matrix::row_echelon::independent<int> const& indep); af::tiny<sg_vec3, 4> --- row_echelon.h DELETED --- |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 04:27:22
|
Update of /cvsroot/cctbx/cctbx/sgtbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25615/sgtbx Modified Files: find_affine.cpp rot_mx_info.cpp row_echelon_solve.cpp rt_mx.cpp seminvariant.cpp space_group_type.cpp Log Message: second step of move cctbx::sgtbx::row_echelon -> scitbx::matrix::row_echelon: use code from new location; old implementation removed Index: row_echelon_solve.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/row_echelon_solve.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** row_echelon_solve.cpp 9 Nov 2002 00:47:01 -0000 1.2 --- row_echelon_solve.cpp 28 Jan 2005 04:26:59 -0000 1.3 *************** *** 1,11 **** - /* Copyright (c) 2001-2002 The Regents of the University of California - through E.O. Lawrence Berkeley National Laboratory, subject to - approval by the U.S. Department of Energy. - See files COPYRIGHT.txt and LICENSE.txt for further details. - - Revision history: - 2002 Sep: Created with fragments from several files (rwgk) - */ - #include <cctbx/sgtbx/row_echelon_solve.h> --- 1,2 ---- *************** *** 14,18 **** af::tiny<sg_vec3, 4> homog_rank_1(scitbx::mat_const_ref<int> const& re_mx, ! row_echelon::independent<int> const& indep) { CCTBX_ASSERT(re_mx.n_rows() == 1); --- 5,9 ---- af::tiny<sg_vec3, 4> homog_rank_1(scitbx::mat_const_ref<int> const& re_mx, ! scitbx::matrix::row_echelon::independent<int> const& indep) { CCTBX_ASSERT(re_mx.n_rows() == 1); *************** *** 31,36 **** } int* n_a = 0; ! CCTBX_ASSERT( ! row_echelon::back_substitution(re_mx, n_a, sol[i_tv].begin()) > 0); } return sol; --- 22,27 ---- } int* n_a = 0; ! CCTBX_ASSERT(scitbx::matrix::row_echelon::back_substitution_int( ! re_mx, n_a, sol[i_tv].begin()) > 0); } return sol; *************** *** 40,44 **** homog_rank_1(scitbx::mat_const_ref<int> const& re_mx) { ! row_echelon::independent<int> indep(re_mx); return homog_rank_1(re_mx, indep); } --- 31,35 ---- homog_rank_1(scitbx::mat_const_ref<int> const& re_mx) { ! scitbx::matrix::row_echelon::independent<int> indep(re_mx); return homog_rank_1(re_mx, indep); } *************** *** 66,76 **** { CCTBX_ASSERT(re_mx.n_rows() == 2); ! row_echelon::independent<int> indep(re_mx); CCTBX_ASSERT(indep.indices.size() == 1); sg_vec3 ev(0,0,0); ev[indep.indices[0]] = 1; int* n_a = 0; ! CCTBX_ASSERT( ! row_echelon::back_substitution(re_mx, n_a, ev.begin()) >= 1); if (sign_hemisphere(ev) < 0) ev *= -1; return ev; --- 57,67 ---- { CCTBX_ASSERT(re_mx.n_rows() == 2); ! scitbx::matrix::row_echelon::independent<int> indep(re_mx); CCTBX_ASSERT(indep.indices.size() == 1); sg_vec3 ev(0,0,0); ev[indep.indices[0]] = 1; int* n_a = 0; ! CCTBX_ASSERT(scitbx::matrix::row_echelon::back_substitution_int( ! re_mx, n_a, ev.begin()) >= 1); if (sign_hemisphere(ev) < 0) ev *= -1; return ev; Index: rt_mx.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/rt_mx.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** rt_mx.cpp 16 Dec 2004 02:53:44 -0000 1.6 --- rt_mx.cpp 28 Jan 2005 04:26:59 -0000 1.7 *************** *** 1,4 **** #include <cctbx/sgtbx/rt_mx.h> ! #include <cctbx/sgtbx/row_echelon.h> #include <ctype.h> #include <string.h> --- 1,4 ---- #include <cctbx/sgtbx/rt_mx.h> ! #include <scitbx/matrix/row_echelon.h> #include <ctype.h> #include <string.h> *************** *** 282,289 **** scitbx::mat_ref<int> ref_rmi(rmi.num().begin(), 3, 3); scitbx::mat_ref<int> ref_p(p.num().begin(), 3, 3); ! row_echelon::form_t(ref_rmi, ref_p); tr_vec pwl = p * wl; tr_vec sh(0); ! sh.den() = row_echelon::back_substitution( ref_rmi, pwl.num().begin(), sh.num().begin()); CCTBX_ASSERT(sh.den() > 0); --- 282,289 ---- scitbx::mat_ref<int> ref_rmi(rmi.num().begin(), 3, 3); scitbx::mat_ref<int> ref_p(p.num().begin(), 3, 3); ! scitbx::matrix::row_echelon::form_t(ref_rmi, ref_p); tr_vec pwl = p * wl; tr_vec sh(0); ! sh.den() = scitbx::matrix::row_echelon::back_substitution_int( ref_rmi, pwl.num().begin(), sh.num().begin()); CCTBX_ASSERT(sh.den() > 0); Index: space_group_type.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/space_group_type.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** space_group_type.cpp 6 Dec 2004 15:34:54 -0000 1.4 --- space_group_type.cpp 28 Jan 2005 04:27:03 -0000 1.5 *************** *** 178,182 **** rot_mx cum_mx = r[0].accumulate(ord[0]); scitbx::mat_ref<int> re_mx(cum_mx.num().begin(), 3, 3); ! CCTBX_ASSERT(row_echelon::form(re_mx) == 1); af::tiny<sg_vec3, 4> sol = row_echelon::solve::homog_rank_1(re_mx); std::size_t n_ix = 1; if (ord[0] == 2) n_ix++; --- 178,182 ---- rot_mx cum_mx = r[0].accumulate(ord[0]); scitbx::mat_ref<int> re_mx(cum_mx.num().begin(), 3, 3); ! CCTBX_ASSERT(scitbx::matrix::row_echelon::form(re_mx) == 1); af::tiny<sg_vec3, 4> sol = row_echelon::solve::homog_rank_1(re_mx); std::size_t n_ix = 1; if (ord[0] == 2) n_ix++; Index: seminvariant.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/seminvariant.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** seminvariant.cpp 22 Apr 2004 21:21:00 -0000 1.29 --- seminvariant.cpp 28 Jan 2005 04:26:59 -0000 1.30 *************** *** 72,77 **** af::tiny<int, 3 * 3 * 3> gen_rmi = construct_gen_rmi(gen, false); scitbx::mat_ref<int> re_mx(gen_rmi.begin(), gen.n_all() * 3, 3); ! CCTBX_ASSERT(row_echelon::form(re_mx) <= 3); ! row_echelon::independent<int> indep(re_mx); if (indep.indices.size() != 2) { for (std::size_t i_indep=0;i_indep<indep.indices.size();i_indep++) { --- 72,77 ---- af::tiny<int, 3 * 3 * 3> gen_rmi = construct_gen_rmi(gen, false); scitbx::mat_ref<int> re_mx(gen_rmi.begin(), gen.n_all() * 3, 3); ! CCTBX_ASSERT(scitbx::matrix::row_echelon::form(re_mx) <= 3); ! scitbx::matrix::row_echelon::independent<int> indep(re_mx); if (indep.indices.size() != 2) { for (std::size_t i_indep=0;i_indep<indep.indices.size();i_indep++) { *************** *** 80,85 **** vm.v[indep.indices[i_indep]] = 1; int* n_a = 0; ! CCTBX_ASSERT( ! row_echelon::back_substitution(re_mx, n_a, vm.v.begin()) > 0); vm.m = 0; result.push_back(vm); --- 80,85 ---- vm.v[indep.indices[i_indep]] = 1; int* n_a = 0; ! CCTBX_ASSERT(scitbx::matrix::row_echelon::back_substitution_int( ! re_mx, n_a, vm.v.begin()) > 0); vm.m = 0; result.push_back(vm); Index: find_affine.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/find_affine.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** find_affine.cpp 13 Dec 2004 18:11:10 -0000 1.3 --- find_affine.cpp 28 Jan 2005 04:26:59 -0000 1.4 *************** *** 1,4 **** #include <cctbx/sgtbx/find_affine.h> ! #include <cctbx/sgtbx/row_echelon.h> #include <scitbx/math/unimodular_generator.h> #include <scitbx/array_family/loops.h> --- 1,4 ---- #include <cctbx/sgtbx/find_affine.h> ! #include <scitbx/matrix/row_echelon.h> #include <scitbx/math/unimodular_generator.h> #include <scitbx/array_family/loops.h> *************** *** 71,76 **** } scitbx::mat_ref<int> m_ref(&*m.begin(), n_rows, 9); ! std::size_t r = row_echelon::form(m_ref); ! row_echelon::independent<int, 9> indep(m_ref); typedef af::nested_loop<af::small<int, 9> > loop_t; af::small<int, 9> loop_begin(indep.indices.size(), -range); --- 71,76 ---- } scitbx::mat_ref<int> m_ref(&*m.begin(), n_rows, 9); ! std::size_t r = scitbx::matrix::row_echelon::form(m_ref); ! scitbx::matrix::row_echelon::independent<int, 9> indep(m_ref); typedef af::nested_loop<af::small<int, 9> > loop_t; af::small<int, 9> loop_begin(indep.indices.size(), -range); *************** *** 81,85 **** c[indep.indices[i]] = loop()[i]; } ! int den = row_echelon::back_substitution( m_ref, static_cast<int*>(0), --- 81,85 ---- c[indep.indices[i]] = loop()[i]; } ! int den = scitbx::matrix::row_echelon::back_substitution_int( m_ref, static_cast<int*>(0), Index: rot_mx_info.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/rot_mx_info.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rot_mx_info.cpp 9 Nov 2002 00:47:01 -0000 1.2 --- rot_mx_info.cpp 28 Jan 2005 04:26:59 -0000 1.3 *************** *** 56,60 **** rot_mx rmi = proper_r.minus_unit_mx(); scitbx::mat_ref<int> re_mx(rmi.num().begin(), 3, 3); ! if (row_echelon::form(re_mx) != 2) { throw error("Cannot determine Eigenvector of rotation matrix."); } --- 56,60 ---- rot_mx rmi = proper_r.minus_unit_mx(); scitbx::mat_ref<int> re_mx(rmi.num().begin(), 3, 3); ! if (scitbx::matrix::row_echelon::form(re_mx) != 2) { throw error("Cannot determine Eigenvector of rotation matrix."); } |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 04:27:22
|
Update of /cvsroot/cctbx/cctbx/sgtbx/boost_python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25615/sgtbx/boost_python Modified Files: SConscript sgtbx_ext.cpp tst_sgtbx.py Removed Files: row_echelon.cpp Log Message: second step of move cctbx::sgtbx::row_echelon -> scitbx::matrix::row_echelon: use code from new location; old implementation removed Index: sgtbx_ext.cpp =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/boost_python/sgtbx_ext.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sgtbx_ext.cpp 5 Jul 2004 07:21:44 -0000 1.15 --- sgtbx_ext.cpp 28 Jan 2005 04:27:10 -0000 1.16 *************** *** 18,22 **** void wrap_reciprocal_space_asu(); void wrap_rot_mx(); - void wrap_row_echelon(); void wrap_rt_mx(); void wrap_search_symmetry(); --- 18,21 ---- *************** *** 101,105 **** wrap_reciprocal_space_asu(); wrap_rot_mx(); - wrap_row_echelon(); wrap_rt_mx(); wrap_search_symmetry(); --- 100,103 ---- Index: SConscript =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/boost_python/SConscript,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SConscript 17 Apr 2004 08:04:46 -0000 1.11 --- SConscript 28 Jan 2005 04:27:09 -0000 1.12 *************** *** 11,15 **** "reciprocal_space_asu.cpp", "rot_mx.cpp", - "row_echelon.cpp", "rt_mx.cpp", "search_symmetry.cpp", --- 11,14 ---- --- row_echelon.cpp DELETED --- Index: tst_sgtbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/sgtbx/boost_python/tst_sgtbx.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** tst_sgtbx.py 22 Dec 2004 00:24:54 -0000 1.60 --- tst_sgtbx.py 28 Jan 2005 04:27:10 -0000 1.61 *************** *** 1427,1457 **** assert ss_discrete.vectors_and_moduli()[1].v == (0,1,0) - def exercise_row_echelon(): - m = flex.int((1,1,1,1)) - m.resize(flex.grid(2,2)) - t = flex.int((2,3)) - t.resize(flex.grid(2,1)) - assert sgtbx.row_echelon_form_t(m, t) == 1 - assert m.focus() == (1,2) - assert tuple(m) == (1,1) - assert tuple(t) == (2,1) - assert sgtbx.row_echelon_form(m) == 1 - assert m.focus() == (1,2) - assert tuple(m) == (1,1) - m = flex.int((0,-24,0,0,0,-24,24,0,24)) - m.resize(flex.grid(3,3)) - t = flex.int((-3, -6, 0)) - t.resize(flex.grid(3,1)) - assert sgtbx.row_echelon_form_t(m, t) == 3 - assert tuple(m) == (24,0,24,0,24,0,0,0,24) - assert tuple(t) == (0,3,6) - t.resize(flex.grid(3)) - sol = flex.int(3) - assert sgtbx.row_echelon_back_substitution(m, t, sol) == 8 - assert tuple(sol) == (-2,1,2) - indep = flex.bool((True,True,True)) - assert sgtbx.row_echelon_back_substitution(m, indep=indep) == 1 - assert tuple(indep) == (False,False,False) - def exercise_lattice_symmetry(): niggli_cell = uctbx.unit_cell((12,13,14,80,83,86)) --- 1427,1430 ---- *************** *** 1641,1645 **** exercise_sym_equiv_sites() exercise_seminvariant() - exercise_row_echelon() exercise_lattice_symmetry() exercise_find_affine() --- 1614,1617 ---- |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 02:27:45
|
Update of /cvsroot/cctbx/cctbx/cctbx/regression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1099/regression Modified Files: tst_sgtbx.py Log Message: adp_constraints.n_independent_params(), n_dependent_params() convenience methods Index: tst_sgtbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/regression/tst_sgtbx.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tst_sgtbx.py 28 Jan 2005 01:42:38 -0000 1.13 --- tst_sgtbx.py 28 Jan 2005 02:27:04 -0000 1.14 *************** *** 77,80 **** --- 77,83 ---- u_star = site_symmetry.average_u_star(u_star) independent_params = adp_constraints.independent_params(u_star) + assert adp_constraints.n_independent_params() == independent_params.size() + assert adp_constraints.n_independent_params() \ + + adp_constraints.n_dependent_params() == 6 u_star_vfy = adp_constraints.all_params(independent_params) u_cart = adptbx.u_star_as_u_cart(unit_cell, u_star) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 02:27:27
|
Update of /cvsroot/cctbx/cctbx/cctbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1099 Modified Files: adptbx.py Log Message: adp_constraints.n_independent_params(), n_dependent_params() convenience methods Index: adptbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/adptbx.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** adptbx.py 28 Jan 2005 01:42:37 -0000 1.7 --- adptbx.py 28 Jan 2005 02:27:04 -0000 1.8 *************** *** 23,26 **** --- 23,32 ---- independent_flags=self.independent_flags) + def n_independent_params(self): + return self.independent_flags.count(True) + + def n_dependent_params(self): + return self.independent_flags.count(False) + def independent_params(self, u_star): return flex.double(u_star).select(self.independent_flags) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:42:50
|
Update of /cvsroot/cctbx/cctbx/dox/rst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24843/dox/rst Modified Files: versions.txt Log Message: new cctbx.sgtbx.space_group.adp_constraints() method Index: versions.txt =================================================================== RCS file: /cvsroot/cctbx/cctbx/dox/rst/versions.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** versions.txt 25 Aug 2004 00:16:53 -0000 1.8 --- versions.txt 28 Jan 2005 01:42:38 -0000 1.9 *************** *** 26,29 **** --- 26,31 ---- - `No. 4, 2004/08 <http://cci.lbl.gov/publications/download/iucrcompcomm_aug2004.pdf>`_ + - `No. 5, 2005/01 <http://iucrcomputing.ccp14.ac.uk/iucr-top/comm/ccom/newsletters/2005jan/>`_ + - Python interfaces: `libtbx <current_cvs/python/libtbx/>`_ |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:42:47
|
Update of /cvsroot/cctbx/cctbx/cctbx/sgtbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24843/cctbx/sgtbx Modified Files: __init__.py Log Message: new cctbx.sgtbx.space_group.adp_constraints() method Index: __init__.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/sgtbx/__init__.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** __init__.py 21 Jan 2005 08:59:08 -0000 1.28 --- __init__.py 28 Jan 2005 01:42:38 -0000 1.29 *************** *** 9,12 **** --- 9,13 ---- from cctbx.array_family import flex + import scitbx.math from scitbx import matrix from boost import rational *************** *** 14,17 **** --- 15,49 ---- import sys + class _space_group(boost.python.injector, ext.space_group): + + def tensor_constraints(self, reciprocal_space): + """row-reduced echelon form of coefficients + r.transpose() * t * r - t = 0 + Mathematica code: + r={{r0,r1,r2},{r3,r4,r5},{r6,r7,r8}} + t={{t0,t3,t4},{t3,t1,t5},{t4,t5,t2}} + FortranForm[Expand[Transpose[r].t.r - t]] + """ + result = flex.int() + for i_smx in xrange(1,self.n_smx()): + r = self(i_smx).r() + if (reciprocal_space): + r = r.transpose() + r0,r1,r2,r3,r4,r5,r6,r7,r8 = r.num() + result.extend(flex.int(( + r0*r0-1, r3*r3, r6*r6, 2*r0*r3, 2*r0*r6, 2*r3*r6, + r1*r1, r4*r4-1, r7*r7, 2*r1*r4, 2*r1*r7, 2*r4*r7, + r2*r2, r5*r5, r8*r8-1, 2*r2*r5, 2*r2*r8, 2*r5*r8, + r0*r1, r3*r4, r6*r7, r1*r3+r0*r4-1, r1*r6+r0*r7, r4*r6+r3*r7, + r0*r2, r3*r5, r6*r8, r2*r3+r0*r5, r2*r6+r0*r8-1, r5*r6+r3*r8, + r1*r2, r4*r5, r7*r8, r2*r4+r1*r5, r2*r7+r1*r8, r5*r7+r4*r8-1))) + result.resize(flex.grid(result.size()//6,6)) + scitbx.math.row_echelon_form(result) + return result + + def adp_constraints(self): + from cctbx import adptbx + return adptbx.constraints(space_group=self) + class space_group_info: |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:42:46
|
Update of /cvsroot/cctbx/cctbx/cctbx/regression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24843/cctbx/regression Modified Files: tst_sgtbx.py Log Message: new cctbx.sgtbx.space_group.adp_constraints() method Index: tst_sgtbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/regression/tst_sgtbx.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tst_sgtbx.py 6 Sep 2004 07:40:49 -0000 1.12 --- tst_sgtbx.py 28 Jan 2005 01:42:38 -0000 1.13 *************** *** 1,4 **** --- 1,6 ---- from cctbx import sgtbx + import cctbx.sgtbx.bravais_types from libtbx.test_utils import approx_equal + import random import pickle *************** *** 61,67 **** --- 63,99 ---- (212, 213)] + def exercise_tensor_constraints_core(crystal_symmetry): + from cctbx import crystal + from cctbx import adptbx + site_symmetry = crystal.special_position_settings( + crystal_symmetry).site_symmetry(site=(0,0,0)) + unit_cell = crystal_symmetry.unit_cell() + group = crystal_symmetry.space_group() + assert site_symmetry.n_matrices() == group.order_p() + adp_constraints = group.adp_constraints() + u_cart = adptbx.random_rotate_ellipsoid( + u_cart=[random.random() for i in xrange(3)] + [0,0,0]) + u_star = adptbx.u_cart_as_u_star(unit_cell, u_cart) + u_star = site_symmetry.average_u_star(u_star) + independent_params = adp_constraints.independent_params(u_star) + u_star_vfy = adp_constraints.all_params(independent_params) + u_cart = adptbx.u_star_as_u_cart(unit_cell, u_star) + u_cart_vfy = adptbx.u_star_as_u_cart(unit_cell, list(u_star_vfy)) + assert approx_equal(u_cart_vfy, u_cart) + + def exercise_tensor_constraints(): + from cctbx import crystal + for symbol in sgtbx.bravais_types.acentric + sgtbx.bravais_types.centric: + space_group_info = sgtbx.space_group_info(symbol=symbol) + crystal_symmetry = crystal.symmetry( + unit_cell=space_group_info.any_compatible_unit_cell(volume=1000), + space_group_info=space_group_info) + exercise_tensor_constraints_core(crystal_symmetry) + exercise_tensor_constraints_core(crystal_symmetry.minimum_cell()) + def run(): exercise_space_group_info() test_enantiomorphic_pairs() + exercise_tensor_constraints() print "OK" |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:42:46
|
Update of /cvsroot/cctbx/cctbx/cctbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24843/cctbx Modified Files: adptbx.py Log Message: new cctbx.sgtbx.space_group.adp_constraints() method Index: adptbx.py =================================================================== RCS file: /cvsroot/cctbx/cctbx/cctbx/adptbx.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** adptbx.py 18 Mar 2004 18:09:12 -0000 1.6 --- adptbx.py 28 Jan 2005 01:42:37 -0000 1.7 *************** *** 1,3 **** ! import cctbx.array_family.flex # for tuple mappings import boost.python --- 1,3 ---- ! from cctbx.array_family import flex # for tuple mappings import boost.python *************** *** 5,13 **** from cctbx_adptbx_ext import * ! from scitbx.math import euler_angles_as_matrix import random def random_rotate_ellipsoid(u_cart): ! c = euler_angles_as_matrix( [random.uniform(0,360) for i in xrange(3)]).elems return c_u_c_transpose(c, u_cart) --- 5,34 ---- from cctbx_adptbx_ext import * ! import scitbx.math import random def random_rotate_ellipsoid(u_cart): ! c = scitbx.math.euler_angles_as_matrix( [random.uniform(0,360) for i in xrange(3)]).elems return c_u_c_transpose(c, u_cart) + + class constraints: + + def __init__(self, space_group): + self.row_echelon_form = space_group.tensor_constraints( + reciprocal_space=True) + self.independent_flags = flex.bool(6, True) + scitbx.math.row_echelon_back_substitution_int( + row_echelon_form=self.row_echelon_form, + independent_flags=self.independent_flags) + + def independent_params(self, u_star): + return flex.double(u_star).select(self.independent_flags) + + def all_params(self, independent_params): + result = flex.double(6, 0) + result.set_selected(self.independent_flags, independent_params) + scitbx.math.row_echelon_back_substitution_float( + row_echelon_form=self.row_echelon_form, + solution=result) + return result |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:41:12
|
Update of /cvsroot/cctbx/scitbx/scitbx/math In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24532/scitbx/math Modified Files: __init__.py Log Message: row_echelon code moved from cctbx::sgtbx::row_echelon to scitbx::matrix::row_echelon Index: __init__.py =================================================================== RCS file: /cvsroot/cctbx/scitbx/scitbx/math/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 6 Sep 2004 07:40:17 -0000 1.9 --- __init__.py 28 Jan 2005 01:40:57 -0000 1.10 *************** *** 91,92 **** --- 91,108 ---- else: return minimum_covering_sphere_nd(points=points, epsilon=epsilon) + + def row_echelon_back_substitution_int( + row_echelon_form, + v=None, + solution=None, + independent_flags=None): + return ext.row_echelon_back_substitution_int( + row_echelon_form, v, solution, independent_flags) + + def row_echelon_back_substitution_float( + row_echelon_form, + v=None, + solution=None): + assert solution is not None + return ext.row_echelon_back_substitution_float( + row_echelon_form, v, solution) |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:41:07
|
Update of /cvsroot/cctbx/scitbx/math/boost_python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24532/math/boost_python Modified Files: SConscript math_ext.cpp tst_math.py Added Files: row_echelon.cpp Log Message: row_echelon code moved from cctbx::sgtbx::row_echelon to scitbx::matrix::row_echelon Index: SConscript =================================================================== RCS file: /cvsroot/cctbx/scitbx/math/boost_python/SConscript,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SConscript 31 Mar 2004 05:32:09 -0000 1.12 --- SConscript 28 Jan 2005 01:40:57 -0000 1.13 *************** *** 8,11 **** "golay.cpp", "minimum_covering_sphere.cpp", ! "principal_axes_of_inertia.cpp"], ) --- 8,12 ---- "golay.cpp", "minimum_covering_sphere.cpp", ! "principal_axes_of_inertia.cpp", ! "row_echelon.cpp"] ) Index: math_ext.cpp =================================================================== RCS file: /cvsroot/cctbx/scitbx/math/boost_python/math_ext.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** math_ext.cpp 6 Dec 2004 21:20:38 -0000 1.20 --- math_ext.cpp 28 Jan 2005 01:40:57 -0000 1.21 *************** *** 19,22 **** --- 19,23 ---- void wrap_minimum_covering_sphere(); void wrap_principal_axes_of_inertia(); + void wrap_row_echelon(); namespace { *************** *** 89,92 **** --- 90,94 ---- wrap_minimum_covering_sphere(); wrap_principal_axes_of_inertia(); + wrap_row_echelon(); def("time_eigensystem_real_symmetric", time_eigensystem_real_symmetric); Index: tst_math.py =================================================================== RCS file: /cvsroot/cctbx/scitbx/math/boost_python/tst_math.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tst_math.py 6 Dec 2004 21:20:38 -0000 1.34 --- tst_math.py 28 Jan 2005 01:40:57 -0000 1.35 *************** *** 767,770 **** --- 767,826 ---- other=flex.double([345*f]), deg=deg), [-15*f]) + def exercise_row_echelon(): + m = flex.int((1,1,1,1)) + m.resize(flex.grid(2,2)) + t = flex.int((2,3)) + t.resize(flex.grid(2,1)) + assert scitbx.math.row_echelon_form_t(m, t) == 1 + assert m.focus() == (1,2) + assert tuple(m) == (1,1) + assert tuple(t) == (2,1) + assert scitbx.math.row_echelon_form(m) == 1 + assert m.focus() == (1,2) + assert tuple(m) == (1,1) + m = flex.int((0,-24,0,0,0,-24,24,0,24)) + m.resize(flex.grid(3,3)) + t = flex.int((-3, -6, 0)) + t.resize(flex.grid(3,1)) + assert scitbx.math.row_echelon_form_t(m, t) == 3 + assert tuple(m) == (24,0,24,0,24,0,0,0,24) + assert tuple(t) == (0,3,6) + t.resize(flex.grid(3)) + sol = flex.int(3) + assert scitbx.math.row_echelon_back_substitution_int(m, t, sol) == 8 + assert tuple(sol) == (-2,1,2) + indep = flex.bool((True,True,True)) + assert scitbx.math.row_echelon_back_substitution_int( + row_echelon_form=m, independent_flags=indep) == 1 + assert tuple(indep) == (False,False,False) + # + for n_cols in xrange(1,5): + for n_rows in xrange(5): + for i_trial in xrange(10): + m = flex.int() + for i in xrange(n_rows): + coeffs = flex.int([random.randrange(-5,5) for j in xrange(n_cols)]) + m.extend(coeffs) + m.resize(flex.grid(n_rows,n_cols)) + rank = scitbx.math.row_echelon_form(m) + assert m.focus()[0] == rank + assert m.focus()[1] == n_cols + indep = flex.bool(n_cols, True) + scitbx.math.row_echelon_back_substitution_int( + row_echelon_form=m, independent_flags=indep) + mm = matrix.rec(m, m.focus()) + s = matrix.col([random.random() for j in xrange(n_cols)]) + sol = flex.double(n_cols, 0) + sol.set_selected(indep, flex.double(s).select(indep)) + assert scitbx.math.row_echelon_back_substitution_float( + row_echelon_form=m, solution=sol, v=flex.double(mm * s)) + assert approx_equal(sol, s) + sol = flex.double(n_cols, 0) + sol.set_selected(indep, flex.double(s).select(indep)) + assert scitbx.math.row_echelon_back_substitution_float( + row_echelon_form=m, solution=sol) + zeros = mm * matrix.col(sol) + assert approx_equal(zeros, [0]*rank) + def exercise_minimum_covering_sphere(epsilon=1.e-3): s3 = sphere_3d(center=[1,2,3], radius=4) *************** *** 895,898 **** --- 951,955 ---- exercise_principal_axes_of_inertia() exercise_phase_error() + exercise_row_echelon() forever = "--Forever" in sys.argv[1:] while 1: --- NEW FILE: row_echelon.cpp --- #include <scitbx/array_family/boost_python/flex_fwd.h> #include <scitbx/matrix/row_echelon.h> #include <boost/python/def.hpp> namespace scitbx { namespace matrix { namespace boost_python { namespace { template <typename ElementType> scitbx::mat_ref<ElementType> flex_as_mat_ref(af::versa<ElementType, af::flex_grid<> >& a) { SCITBX_ASSERT(a.accessor().nd() == 2); SCITBX_ASSERT(a.accessor().is_0_based()); SCITBX_ASSERT(!a.accessor().is_padded()); return scitbx::mat_ref<ElementType>( a.begin(), a.accessor().all()[0], a.accessor().all()[1]); } std::size_t row_echelon_form_t( af::versa<int, af::flex_grid<> >& m, af::versa<int, af::flex_grid<> >& t) { scitbx::mat_ref<int> m_ref = flex_as_mat_ref(m); scitbx::mat_ref<int> t_ref = flex_as_mat_ref(t); std::size_t rank = row_echelon::form_t(m_ref, t_ref); m.resize(af::flex_grid<>(m_ref.n_rows(), m_ref.n_columns())); return rank; } std::size_t row_echelon_form( af::versa<int, af::flex_grid<> >& m) { scitbx::mat_ref<int> m_ref = flex_as_mat_ref(m); std::size_t rank = row_echelon::form(m_ref); m.resize(af::flex_grid<>(m_ref.n_rows(), m_ref.n_columns())); return rank; } int row_echelon_back_substitution_int( af::versa<int, af::flex_grid<> >& re_mx, af::const_ref<int> const& v, af::ref<int> const& sol, af::ref<bool> const& indep) { scitbx::mat_ref<int> re_mx_ref = flex_as_mat_ref(re_mx); const int* v_ptr = 0; int* sol_ptr = 0; bool* indep_ptr = 0; if (v.size()) { SCITBX_ASSERT(v.size() == re_mx_ref.n_rows()); v_ptr = v.begin(); } if (sol.size()) { SCITBX_ASSERT(sol.size() == re_mx_ref.n_columns()); sol_ptr = sol.begin(); } if (indep.size()) { SCITBX_ASSERT(indep.size() == re_mx_ref.n_columns()); indep_ptr = indep.begin(); } return row_echelon::back_substitution_int( re_mx_ref, v_ptr, sol_ptr, indep_ptr); } bool row_echelon_back_substitution_float( af::versa<int, af::flex_grid<> >& re_mx, af::const_ref<double> const& v, af::ref<double> const& sol) { scitbx::mat_ref<int> re_mx_ref = flex_as_mat_ref(re_mx); const double* v_ptr = 0; double* sol_ptr = 0; if (v.size()) { SCITBX_ASSERT(v.size() == re_mx_ref.n_rows()); v_ptr = v.begin(); } if (sol.size()) { SCITBX_ASSERT(sol.size() == re_mx_ref.n_columns()); sol_ptr = sol.begin(); } return row_echelon::back_substitution_float( re_mx_ref, v_ptr, sol_ptr); } void wrap_row_echelon() { using namespace boost::python; def("row_echelon_form_t", row_echelon_form_t); def("row_echelon_form", row_echelon_form); def("row_echelon_back_substitution_int", row_echelon_back_substitution_int); def("row_echelon_back_substitution_float", row_echelon_back_substitution_float); } }}} // namespace matrix::boost_python::<anoymous> namespace math { namespace boost_python { void wrap_row_echelon() { matrix::boost_python::wrap_row_echelon(); } }}} // namespace scitbx::math::boost_python |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-28 01:41:05
|
Update of /cvsroot/cctbx/scitbx/include/scitbx/matrix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24532/include/scitbx/matrix Added Files: row_echelon.h Log Message: row_echelon code moved from cctbx::sgtbx::row_echelon to scitbx::matrix::row_echelon --- NEW FILE: row_echelon.h --- #ifndef SCITBX_SCITBX_MATRIX_ROW_ECHELON_H #define SCITBX_SCITBX_MATRIX_ROW_ECHELON_H #include <scitbx/mat_ref.h> #include <scitbx/array_family/small.h> #include <scitbx/array_family/misc_functions.h> #include <boost/rational.hpp> namespace scitbx { namespace matrix { namespace row_echelon { namespace detail { template <typename AnyType> inline void swap(AnyType* a, AnyType* b, std::size_t n) { for(std::size_t i=0;i<n;i++) std::swap(a[i], b[i]); } } // namespace detail template <typename IntType> std::size_t form_t(scitbx::mat_ref<IntType>& m, scitbx::mat_ref<IntType> const& t) { // C++ version of RowEchelonFormT from the CrystGAP package // (GAP Version 3.4.4). // B. Eick, F. Ga"hler and W. Nickel // Computing Maximal Subgroups and Wyckoff Positions of Space Groups // Acta Cryst. (1997). A53, 467 - 474 using std::size_t; size_t mr = m.n_rows(); size_t mc = m.n_columns(); size_t tc = t.n_columns(); if (tc) { SCITBX_ASSERT(t.begin() != 0 && t.n_rows() >= mr); } size_t i, j; for (i = j = 0; i < mr && j < mc;) { size_t k = i; while (k < mr && m(k,j) == 0) k++; if (k == mr) j++; else { if (i != k) { detail::swap(&m(i,0), &m(k,0), mc); if (tc) detail::swap(&t(i,0), &t(k,0), tc); } for (k++; k < mr; k++) { IntType a = scitbx::fn::absolute(m(k, j)); if (a != 0 && a < scitbx::fn::absolute(m(i,j))) { detail::swap(&m(i,0), &m(k,0), mc); if (tc) detail::swap(&t(i,0), &t(k,0), tc); } } if (m(i,j) < 0) { for(size_t ic=0;ic<mc;ic++) m(i,ic) *= -1; if (tc) for(size_t ic=0;ic<tc;ic++) t(i,ic) *= -1; } bool cleared = true; for (k = i+1; k < mr; k++) { IntType a = m(k,j) / m(i,j); if (a != 0) { for(size_t ic=0;ic<mc;ic++) m(k,ic) -= a * m(i,ic); if (tc) for(size_t ic=0;ic<tc;ic++) t(k,ic) -= a * t(i,ic); } if (m(k,j) != 0) cleared = false; } if (cleared) { i++; j++; } } } m = scitbx::mat_ref<IntType>(m.begin(), i, mc); return i; } template <typename IntType> std::size_t form(scitbx::mat_ref<IntType>& m) { scitbx::mat_ref<IntType> t(0,0,0); return form_t(m, t); } template <typename IntType> IntType back_substitution_int( scitbx::mat_const_ref<IntType> const& re_mx, const IntType* v = 0, IntType* sol = 0, bool* flag_indep = 0) { using std::size_t; size_t nr = re_mx.n_rows(); size_t nc = re_mx.n_columns(); if (flag_indep) { for(size_t ic=0;ic<nc;ic++) flag_indep[ic] = true; } IntType d = 1; for (size_t ir = nr; ir > 0;) { ir--; size_t ic; for(ic=0;ic<nc;ic++) { if (re_mx(ir,ic)) goto set_sol_ic; } if (v && v[ir] != 0) return 0; continue; set_sol_ic: if (flag_indep) flag_indep[ic] = false; if (sol) { size_t icp = ic + 1; size_t nv = nc - icp; if (nv) { scitbx::matrix::multiply(&re_mx(ir,icp), &sol[icp], 1, nv, 1, &sol[ic]); sol[ic] *= -1; } else { sol[ic] = 0; } if (v) sol[ic] += d * v[ir]; IntType mrc = re_mx(ir,ic); IntType f = boost::gcd(sol[ic], mrc); if (mrc < 0) f *= -1; sol[ic] /= f; f = mrc / f; if (f != 1) { for(size_t jc=0;jc<nc;jc++) if (jc != ic) sol[jc] *= f; d *= f; } } } return d; } template <typename IntType, typename FloatType> bool back_substitution_float( scitbx::mat_const_ref<IntType> const& re_mx, const FloatType* v, FloatType* sol) { SCITBX_ASSERT(sol != 0); using std::size_t; size_t nr = re_mx.n_rows(); size_t nc = re_mx.n_columns(); for (size_t ir = nr; ir > 0;) { ir--; size_t ic; for(ic=0;ic<nc;ic++) { if (re_mx(ir,ic)) goto set_sol_ic; } if (v && v[ir] != 0) return false; continue; set_sol_ic: size_t icp = ic + 1; size_t nv = nc - icp; if (nv) { scitbx::matrix::multiply(&re_mx(ir,icp), &sol[icp], 1, nv, 1, &sol[ic]); sol[ic] = -sol[ic]; } else { sol[ic] = 0; } if (v) sol[ic] += v[ir]; sol[ic] /= static_cast<FloatType>(re_mx(ir,ic)); } return true; } template <typename IntType, std::size_t MaxIndependentIndices = 6> struct independent { independent() {} independent(scitbx::mat_const_ref<IntType> const& re_mx) { using std::size_t; size_t nc = re_mx.n_columns(); SCITBX_ASSERT(nc <= MaxIndependentIndices); bool flag_indep[MaxIndependentIndices]; IntType* n_a = 0; SCITBX_ASSERT(back_substitution_int(re_mx, n_a, n_a, flag_indep) >= 1); for(size_t ic=0;ic<nc;ic++) { if (flag_indep[ic]) indices.push_back(ic); } } af::small<std::size_t, MaxIndependentIndices> indices; }; }}} // namespace scitbx::matrix::row_echelon #endif // SCITBX_SCITBX_MATRIX_ROW_ECHELON_H |
|
From: Ralf W. Grosse-K. <rw...@us...> - 2005-01-27 02:32:16
|
Update of /cvsroot/cctbx/scitbx/scitbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29669 Modified Files: matrix.py Log Message: mathematica_form bug fix: matrix with 0 rows -> {} Index: matrix.py =================================================================== RCS file: /cvsroot/cctbx/scitbx/scitbx/matrix.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** matrix.py 6 Dec 2004 21:20:38 -0000 1.10 --- matrix.py 27 Jan 2005 02:32:05 -0000 1.11 *************** *** 218,222 **** if (one_row_per_line): s += "\n " else: s += " " ! return s[:-2] + "}" def as_sym_mat3(self): --- 218,223 ---- if (one_row_per_line): s += "\n " else: s += " " ! if (self.n_rows() > 0): s = s[:-2] ! return s + "}" def as_sym_mat3(self): *************** *** 334,337 **** --- 335,340 ---- from libtbx.test_utils import approx_equal from boost import rational + a = rec((),(0,0)) + assert a.mathematica_form() == "{}" a = rec(range(1,7), (3,2)) assert len(a) == 6 |