| 1 |
/* |
| 2 |
* The MIT License |
| 3 |
|
| 4 |
Conograph (powder auto-indexing program) |
| 5 |
|
| 6 |
Copyright (c) <2012> <Ryoko Oishi-Tomiyasu, KEK> |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 |
of this software and associated documentation files (the "Software"), to deal |
| 10 |
in the Software without restriction, including without limitation the rights |
| 11 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 |
copies of the Software, and to permit persons to whom the Software is |
| 13 |
furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice shall be included in |
| 16 |
all copies or substantial portions of the Software. |
| 17 |
|
| 18 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 |
THE SOFTWARE. |
| 25 |
* |
| 26 |
*/ |
| 27 |
#ifndef LATTICEFIGUREOFMERIT_HH_ |
| 28 |
#define LATTICEFIGUREOFMERIT_HH_ |
| 29 |
|
| 30 |
#include "../utility_data_structure/nrutil_nr.hh" |
| 31 |
#include "../utility_data_structure/SymMat43.hh" |
| 32 |
#include "../utility_data_structure/VecDat3.hh" |
| 33 |
#include "../utility_func/transform_sym_matrix.hh" |
| 34 |
#include "../utility_func/lattice_constant.hh" |
| 35 |
#include "../utility_func/chToDouble.hh" |
| 36 |
#include "../utility_lattice_reduction/matrix_4by4.hh" |
| 37 |
#include "../bravais_lattice/enumBravaisLattice.hh" |
| 38 |
#include "../point_group/enumPointGroup.hh" |
| 39 |
#include "../laue_group/LaueGroup.hh" |
| 40 |
#include "../zparam/ZParawError.hh" |
| 41 |
#include "../model_function/profile_function/global_function/enumPeakShiftFunctionType.hh" |
| 42 |
#include "../bravais_type/BravaisType.hh" |
| 43 |
#include "enumSortCriterion.hh" |
| 44 |
#include "HKL_Q.hh" |
| 45 |
#include "lattice_symmetry.hh" |
| 46 |
|
| 47 |
|
| 48 |
class SetOfFigureOfMerit |
| 49 |
{ |
| 50 |
private: |
| 51 |
Int4 m_num_ref_figure_of_merit; |
| 52 |
Int4 m_num_q_observed; |
| 53 |
Double m_num_total_hkl; |
| 54 |
// Int4 m_num_total_hkl_disc; |
| 55 |
Double m_figure_of_merit_Wolff; |
| 56 |
Double m_figure_of_merit_Wu; |
| 57 |
// Double m_normalized_figure_of_merit_Wolff; |
| 58 |
Double m_reversed_figure_of_merit; |
| 59 |
|
| 60 |
// Double m_figure_of_merit_Wolff_original; |
| 61 |
// Double m_figure_of_merit_Wu_original; |
| 62 |
|
| 63 |
static string putStrFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCM) + num2str(num_ref_fom); }; |
| 64 |
static string putStrFigureOfMeritWu(const Int4& num_ref_fom){ return putLabel(SCWuM) + num2str(num_ref_fom); }; |
| 65 |
// static string putStrNormalizedFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCNormM) + num2str(num_ref_fom); }; |
| 66 |
static string putStrReversedFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCRevM) + num2str(num_ref_fom); }; |
| 67 |
static string putStrSymmetricFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCSymM) + num2str(num_ref_fom); }; |
| 68 |
|
| 69 |
// static string putStrFigureOfMeritWolff_Original(const Int4& num_ref_fom){ return "M" + num2str(num_ref_fom) + "(Original)"; }; |
| 70 |
// static string putStrFigureOfMeritWu_Original(const Int4& num_ref_fom){ return "Mwu" + num2str(num_ref_fom) + "(Original)"; }; |
| 71 |
|
| 72 |
public: |
| 73 |
SetOfFigureOfMerit(){ this->reset(); } |
| 74 |
~SetOfFigureOfMerit(){} |
| 75 |
|
| 76 |
inline void reset() |
| 77 |
{ |
| 78 |
m_num_ref_figure_of_merit = 0; |
| 79 |
m_num_q_observed = 0; |
| 80 |
m_num_total_hkl = 0.0; |
| 81 |
// m_num_total_hkl_disc = 0; |
| 82 |
m_figure_of_merit_Wolff = 0.0; |
| 83 |
m_figure_of_merit_Wu = 0.0; |
| 84 |
// m_normalized_figure_of_merit_Wolff = 0.0; |
| 85 |
m_reversed_figure_of_merit = 0.0; |
| 86 |
|
| 87 |
// m_figure_of_merit_Wolff_original = 0.0; |
| 88 |
// m_figure_of_merit_Wu_original = 0.0; |
| 89 |
} |
| 90 |
|
| 91 |
inline Int4& putNumberOfReflectionsForFigureOfMerit() { return m_num_ref_figure_of_merit; }; |
| 92 |
inline Int4& putNumQobsAssociatedWithCloseHKL() { return m_num_q_observed; }; |
| 93 |
inline Double& putContinuousNumberOfHKLInRange() { return m_num_total_hkl; }; |
| 94 |
// inline Int4& putDiscreteNumberOfHKLInRange() { return m_num_total_hkl_disc; }; |
| 95 |
|
| 96 |
inline const Int4& putNumQobsAssociatedWithCloseHKL() const { return m_num_q_observed; }; |
| 97 |
inline const Int4& putNumberOfReflectionsForFigureOfMerit() const { return m_num_ref_figure_of_merit; }; |
| 98 |
inline const Double& putContinuousNumberOfHKLInRange() const { return m_num_total_hkl; }; |
| 99 |
// inline const Int4& putDiscreteNumberOfHKLInRange() const { return m_num_total_hkl_disc; }; |
| 100 |
|
| 101 |
inline Double& putFigureOfMeritWolff() { return m_figure_of_merit_Wolff; }; |
| 102 |
inline Double& putFigureOfMeritWu() { return m_figure_of_merit_Wu; }; |
| 103 |
// inline Double& putNormalizedFigureOfMeritWolff() { return m_normalized_figure_of_merit_Wolff; }; |
| 104 |
inline Double& putReversedFigureOfMerit() { return m_reversed_figure_of_merit; }; |
| 105 |
|
| 106 |
inline const Double& putFigureOfMeritWolff() const { return m_figure_of_merit_Wolff; }; |
| 107 |
inline const Double& putFigureOfMeritWu() const { return m_figure_of_merit_Wu; }; |
| 108 |
// inline const Double& putNormalizedFigureOfMeritWolff() const { return m_normalized_figure_of_merit_Wolff; }; |
| 109 |
inline const Double& putReversedFigureOfMerit() const { return m_reversed_figure_of_merit; }; |
| 110 |
|
| 111 |
inline string putLabel_FigureOfMeritWolff() const { return putStrFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 112 |
inline string putLabel_FigureOfMeritWu() const { return putStrFigureOfMeritWu(m_num_ref_figure_of_merit); }; |
| 113 |
// inline string putLabel_NormalizedFigureOfMeritWolff() const { return putStrNormalizedFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 114 |
inline string putLabel_ReversedFigureOfMeritWolff() const { return putStrReversedFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 115 |
inline string putLabel_SymmetricFigureOfMeritWolff() const { return putStrSymmetricFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 116 |
|
| 117 |
inline Double putSymmetricFigureOfMerit() const { return m_reversed_figure_of_merit * m_figure_of_merit_Wolff; }; |
| 118 |
|
| 119 |
// inline Double& putFigureOfMeritWolff_Original() { return m_figure_of_merit_Wolff_original; }; |
| 120 |
// inline const Double& putFigureOfMeritWolff_Original() const { return m_figure_of_merit_Wolff_original; }; |
| 121 |
// inline Double& putFigureOfMeritWu_Original() { return m_figure_of_merit_Wu_original; }; |
| 122 |
// inline const Double& putFigureOfMeritWu_Original() const { return m_figure_of_merit_Wu_original; }; |
| 123 |
}; |
| 124 |
|
| 125 |
|
| 126 |
// Class for outputting information about a lattice in index file. |
| 127 |
class LatticeFigureOfMerit |
| 128 |
{ |
| 129 |
friend inline bool operator<(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs); |
| 130 |
|
| 131 |
private: |
| 132 |
static const NRMat<Int4> m_tmat_prim_to_face; |
| 133 |
static const NRMat<Int4> m_tmat_prim_to_body; |
| 134 |
static const NRMat<Int4> m_tmat_prim_to_rhomhex; |
| 135 |
static const NRMat<Int4> m_tmat_prim_to_base[3]; |
| 136 |
static const NRMat<Int4> m_tmat_prim_to_prim; |
| 137 |
|
| 138 |
BravaisType m_brat; |
| 139 |
|
| 140 |
// This matrix is a result of optimization, therefore, it may be not reduced. |
| 141 |
// m_S_optimized.second * m_S_optimized.first * Transpose(m_S_optimized.second) is obtuse. |
| 142 |
SymMat43_Double m_S_optimized; |
| 143 |
|
| 144 |
// The inverse of m_S_red is Minkowski-reduced. |
| 145 |
SymMat<Double> m_S_red; |
| 146 |
|
| 147 |
Double m_determ_S_red; |
| 148 |
|
| 149 |
SetOfFigureOfMerit m_figures_of_merit; |
| 150 |
|
| 151 |
// Sets m_S_red from m_S_optimized. |
| 152 |
// On output, trans_mat gives the matrix such that trans_mat * m_S_red * transpose(trans_mat) equals the original m_S_optimized. |
| 153 |
void setInverseOfMinkowskiReducedForm(NRMat<Int4>& trans_mat); |
| 154 |
|
| 155 |
protected: |
| 156 |
static const Double m_cv2; |
| 157 |
|
| 158 |
public: |
| 159 |
LatticeFigureOfMerit(); |
| 160 |
LatticeFigureOfMerit(const Double& rhs); // Sets only m_determ_GramMat = rhs; |
| 161 |
LatticeFigureOfMerit(const BravaisType& ebrat, |
| 162 |
const SymMat43_Double& S_red); |
| 163 |
virtual ~LatticeFigureOfMerit(){}; |
| 164 |
|
| 165 |
void putMillerIndicesInRange(const Double& qrange_begin, const Double& qrange_end, |
| 166 |
vector<HKL_Q>& cal_hkl_tray) const; |
| 167 |
|
| 168 |
void setWuFigureOfMerit(const Int4& num_ref_figure_of_merit, const vector<QData>& qdata, |
| 169 |
const Double& min_thred_num_hkl, |
| 170 |
const Double& max_thred_num_hkl); |
| 171 |
|
| 172 |
// Return false if Qdata is not set or |
| 173 |
// the number of unindexed reflections is larger max_num_false_peak. |
| 174 |
void setFigureOfMerit(const Int4& num_ref_figure_of_merit, const vector<QData>& qdata, |
| 175 |
vector< VecDat3<Int4> >& closest_hkl_tray, |
| 176 |
Vec_BOOL& Q_observed_flag); |
| 177 |
inline void setFigureOfMerit(const Int4& num_ref_figure_of_merit, const vector<QData>& qdata) |
| 178 |
{ |
| 179 |
vector< VecDat3<Int4> > closest_hkl_tray; |
| 180 |
Vec_BOOL Q_observed_flag; |
| 181 |
setFigureOfMerit(num_ref_figure_of_merit, qdata, closest_hkl_tray, Q_observed_flag); |
| 182 |
}; |
| 183 |
|
| 184 |
// true : NormM has been improved. |
| 185 |
// false : NormM has not been improved. |
| 186 |
pair<bool, ZErrorMessage> fitLatticeParameterLinear(const vector<QData>& qdata, |
| 187 |
const vector< VecDat3<Int4> >& hkl_to_fit, |
| 188 |
const vector<bool>& fix_or_fit_flag, |
| 189 |
const bool& output_view_flag); |
| 190 |
|
| 191 |
// Change the lattice constants to string. |
| 192 |
inline string printOptimizedLatticeConstants(const eABCaxis& axis1, |
| 193 |
const eRHaxis& axis2, |
| 194 |
const Int4& precision) const; |
| 195 |
|
| 196 |
// Output information on the lattice. |
| 197 |
void printLatticeInformation(const eABCaxis& abc_axis, |
| 198 |
const eRHaxis& rh_axis, |
| 199 |
const Int4& label_start0, |
| 200 |
ostream* os) const; |
| 201 |
|
| 202 |
// Set-functions. |
| 203 |
// This method assumes that S.second * S.first * Transpose(S.second) is obtuse. |
| 204 |
void setLatticeConstants43(const BravaisType& brat, const SymMat43_Double& S); |
| 205 |
|
| 206 |
ZErrorMessage setLatticeConstants(const BravaisType& brat, const SymMat<Double>& S); |
| 207 |
|
| 208 |
Int4 checkDominantZone() const; |
| 209 |
|
| 210 |
// Replace m_S_optimized by m_S_red. |
| 211 |
// On output, trans_mat gives the matrix such that trans_mat * m_S_red * transpose(trans_mat) equals the original m_S_optimized. |
| 212 |
inline void reduceLatticeConstants(NRMat<Int4>& trans_mat); |
| 213 |
|
| 214 |
// The unit of alpha, beta, gamma is degree. |
| 215 |
inline ZErrorMessage setLatticeConstantsDegree(const BravaisType& brat, |
| 216 |
const VecDat3<Double>& length_axis, |
| 217 |
const VecDat3<Double>& angle_axis); |
| 218 |
|
| 219 |
static void putLatticeConstantsDegree(const BravaisType& brat, |
| 220 |
const SymMat<Double>& S, |
| 221 |
const eABCaxis& axis1, |
| 222 |
const eRHaxis& axis2, |
| 223 |
VecDat3<Double>& length, VecDat3<Double>& angle); |
| 224 |
|
| 225 |
// Put-functions (Returns a value.) |
| 226 |
inline void putOptimizedLatticeConstantsDegree(const eABCaxis& axis1, |
| 227 |
const eRHaxis& axis2, |
| 228 |
VecDat3<Double>& length, VecDat3<Double>& angle) const; |
| 229 |
|
| 230 |
inline void putReducedLatticeConstantsDegree(const eABCaxis& axis1, |
| 231 |
const eRHaxis& axis2, |
| 232 |
VecDat3<Double>& length, VecDat3<Double>& angle) const; |
| 233 |
|
| 234 |
inline Double putLatticeVolume() const { return 1.0 / sqrt(m_determ_S_red); }; |
| 235 |
|
| 236 |
// Put-functions (Returns a constant reference.) |
| 237 |
inline const Double& putCriticalValueSquare() const { return m_cv2; }; |
| 238 |
|
| 239 |
inline const ePointGroup& enumPointGroup() const { return m_brat.enumPointGroup(); }; |
| 240 |
inline const eBravaisLattice& enumBravaisLattice() const { return m_brat.enumBravaisLattice(); }; |
| 241 |
inline const eCrystalSystem& enumCrystalSystem() const { return m_brat.enumCrystalSystem(); }; |
| 242 |
inline const BravaisType& putBravaisType() const { return m_brat; }; |
| 243 |
|
| 244 |
// The returned matrix is Minkowski-reduced matrix equivalent with m_S_red_optimized. |
| 245 |
inline const SymMat<Double>& putInverseOfMinkowskiReducedForm() const { return m_S_red; }; |
| 246 |
|
| 247 |
// inline const SymMat<Double>& putOptimizedForm() const { return m_S_red_optimized.first; }; |
| 248 |
inline const SymMat43_Double& putOptimizedForm() const { return m_S_optimized; }; |
| 249 |
inline SymMat<Double> putSellingReducedForm() const { return transform_sym_matrix(m_S_optimized.second, m_S_optimized.first); }; |
| 250 |
|
| 251 |
inline const Double& putDeterminantOfGramMatrix() const { return m_determ_S_red; }; |
| 252 |
inline const SetOfFigureOfMerit& putFiguresOfMerit() const { return m_figures_of_merit; }; |
| 253 |
|
| 254 |
// Put-functions (Returns a non-constant reference.) |
| 255 |
inline SetOfFigureOfMerit& putFiguresOfMerit() { return m_figures_of_merit; }; |
| 256 |
|
| 257 |
static bool cmpFOMdeWolff(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 258 |
{ |
| 259 |
return lhs.m_figures_of_merit.putFigureOfMeritWolff() > rhs.m_figures_of_merit.putFigureOfMeritWolff(); |
| 260 |
} |
| 261 |
|
| 262 |
static bool cmpFOMWu(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 263 |
{ |
| 264 |
return lhs.m_figures_of_merit.putFigureOfMeritWu() > rhs.m_figures_of_merit.putFigureOfMeritWu(); |
| 265 |
} |
| 266 |
|
| 267 |
// static bool cmpFOM(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 268 |
// { |
| 269 |
// return lhs.m_figures_of_merit.putNormalizedFigureOfMeritWolff() > rhs.m_figures_of_merit.putNormalizedFigureOfMeritWolff(); |
| 270 |
// } |
| 271 |
|
| 272 |
static bool cmpFOMReversed(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 273 |
{ |
| 274 |
return lhs.m_figures_of_merit.putReversedFigureOfMerit() > rhs.m_figures_of_merit.putReversedFigureOfMerit(); |
| 275 |
} |
| 276 |
|
| 277 |
static bool cmpFOMSymmetric(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 278 |
{ |
| 279 |
return lhs.m_figures_of_merit.putSymmetricFigureOfMerit() > rhs.m_figures_of_merit.putSymmetricFigureOfMerit(); |
| 280 |
} |
| 281 |
|
| 282 |
// static bool cmpFOMdeWolff_Original(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 283 |
// { |
| 284 |
// return lhs.m_figures_of_merit.putFigureOfMeritWolff_Original() > rhs.m_figures_of_merit.putFigureOfMeritWolff_Original(); |
| 285 |
// } |
| 286 |
// |
| 287 |
// static bool cmpFOMWu_Original(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 288 |
// { |
| 289 |
// return lhs.m_figures_of_merit.putFigureOfMeritWu_Original() > rhs.m_figures_of_merit.putFigureOfMeritWu_Original(); |
| 290 |
// } |
| 291 |
|
| 292 |
|
| 293 |
// For GUI |
| 294 |
const BravaisType &getref_m_brat() const {return m_brat;} |
| 295 |
BravaisType &getref_m_brat() {return m_brat;} |
| 296 |
const SetOfFigureOfMerit &getref_m_figures_of_merit() const {return m_figures_of_merit;} |
| 297 |
SetOfFigureOfMerit &getref_m_figures_of_merit() {return m_figures_of_merit;} |
| 298 |
const SymMat43_Double &getref_m_S_red_optimized() const {return m_S_optimized;} |
| 299 |
SymMat43_Double &getref_m_S_red_optimized() {return m_S_optimized;} |
| 300 |
const Double &getref_m_determ_S_red() const {return m_determ_S_red;} |
| 301 |
Double &getref_m_determ_S_red() {return m_determ_S_red;} |
| 302 |
}; |
| 303 |
|
| 304 |
|
| 305 |
inline string LatticeFigureOfMerit::printOptimizedLatticeConstants(const eABCaxis& axis1, |
| 306 |
const eRHaxis& axis2, |
| 307 |
const Int4& precision) const |
| 308 |
{ |
| 309 |
VecDat3<Double> length_axis, angle_axis; |
| 310 |
putOptimizedLatticeConstantsDegree(axis1, axis2, length_axis, angle_axis); |
| 311 |
return chToString(length_axis, angle_axis, precision); |
| 312 |
} |
| 313 |
|
| 314 |
|
| 315 |
inline void LatticeFigureOfMerit::putOptimizedLatticeConstantsDegree(const eABCaxis& axis1, |
| 316 |
const eRHaxis& axis2, |
| 317 |
VecDat3<Double>& length_axis, VecDat3<Double>& angle_axis) const |
| 318 |
{ |
| 319 |
putLatticeConstantsDegree( m_brat, m_S_optimized.first, axis1, axis2, length_axis, angle_axis ); |
| 320 |
} |
| 321 |
|
| 322 |
|
| 323 |
inline void LatticeFigureOfMerit::putReducedLatticeConstantsDegree( |
| 324 |
const eABCaxis& axis1, |
| 325 |
const eRHaxis& axis2, VecDat3<Double>& length_axis, VecDat3<Double>& angle_axis) const |
| 326 |
{ |
| 327 |
putLatticeConstantsDegree( m_brat, this->putInverseOfMinkowskiReducedForm(), |
| 328 |
axis1, axis2, length_axis, angle_axis ); |
| 329 |
} |
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
inline ZErrorMessage LatticeFigureOfMerit::setLatticeConstantsDegree(const BravaisType& brat, |
| 334 |
const VecDat3<Double>& length, |
| 335 |
const VecDat3<Double>& angle) |
| 336 |
{ |
| 337 |
LaueGroup lg(brat.enumPointGroup()); |
| 338 |
ZErrorMessage zerr = lg->checkLatticeConstantError(length, angle); |
| 339 |
if( zerr.putErrorType() != ZErrorNoError ) return zerr; |
| 340 |
|
| 341 |
SymMat<Double> Sval(3); |
| 342 |
calCoParameter(length, angle, Sval); |
| 343 |
|
| 344 |
return this->setLatticeConstants(brat, Sval); |
| 345 |
} |
| 346 |
|
| 347 |
inline void LatticeFigureOfMerit::reduceLatticeConstants(NRMat<Int4>& trans_mat) |
| 348 |
{ |
| 349 |
setInverseOfMinkowskiReducedForm(trans_mat); |
| 350 |
m_S_optimized.first = m_S_red; |
| 351 |
m_S_optimized.second = mprod(m_S_optimized.second, trans_mat); |
| 352 |
} |
| 353 |
|
| 354 |
|
| 355 |
inline VecDat3<Int4> product_hkl(const VecDat3<Int4>& lhs, const NRMat<Int4>& rhs) |
| 356 |
{ |
| 357 |
assert( rhs.nrows() >= 3 && rhs.ncols() == 3 ); |
| 358 |
|
| 359 |
VecDat3<Int4> ans; |
| 360 |
ans[0] = lhs[0]*rhs[0][0] + lhs[1]*rhs[1][0] + lhs[2]*rhs[2][0]; |
| 361 |
ans[1] = lhs[0]*rhs[0][1] + lhs[1]*rhs[1][1] + lhs[2]*rhs[2][1]; |
| 362 |
ans[2] = lhs[0]*rhs[0][2] + lhs[1]*rhs[1][2] + lhs[2]*rhs[2][2]; |
| 363 |
return ans; |
| 364 |
} |
| 365 |
|
| 366 |
|
| 367 |
template<class T> |
| 368 |
inline T norm(const VecDat3<Int4>& lhs, const SymMat<T>& rhs) |
| 369 |
{ |
| 370 |
assert( rhs.size() >= 3 ); |
| 371 |
|
| 372 |
return rhs(0,0)*(lhs[0]*lhs[0]) + rhs(1,1)*(lhs[1]*lhs[1]) + rhs(2,2)*(lhs[2]*lhs[2]) |
| 373 |
+ ( rhs(0,1)*(lhs[0]*lhs[1]) + rhs(0,2)*(lhs[0]*lhs[2]) + rhs(1,2)*(lhs[1]*lhs[2]) )*2.0; |
| 374 |
} |
| 375 |
|
| 376 |
|
| 377 |
inline bool operator<(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 378 |
{ |
| 379 |
return lhs.m_determ_S_red < rhs.m_determ_S_red; |
| 380 |
} |
| 381 |
|
| 382 |
void putTransformMatrixToMinkowskiReduced(const SymMat<Double>& S, NRMat<Int4>& trans_mat); |
| 383 |
|
| 384 |
#endif /*LATTICEFIGUREOFMERIT_HH_*/ |