示例#1
0
    static inline bool skip(S& stream, O& output) {
        // TODO: may not always have to construct_default
        auto& many_value = output.template construct_default<store_type_many>();

        if (! parse_many::skip(stream, many_value))
            return false;

        if (1 == M::exec(many_value).size()) {
            std::auto_ptr<store_type_many> old_value(
                output.template release<store_type_many>());

            output = store_type_base(M::exec(*old_value).front());
        }
        return true;
    }
double CalculateMaxEigenpair(c_matrix<double, 3, 3>& rA, c_vector<double, 3>& rEigenvector)
{
    double norm = 0.0;
    double step = DBL_MAX;
    while (step > DBL_EPSILON) //Machine precision
    {
        c_vector<double, 3> old_value(rEigenvector);
        rEigenvector = prod(rA, rEigenvector);
        norm = norm_2(rEigenvector);
        rEigenvector /= norm;
        if (norm < DBL_EPSILON)
        {
            //We don't care about a zero eigenvector, so don't polish it
            break;
        }
        step = norm_inf(rEigenvector-old_value);
    }
    return norm;
}
示例#3
0
文件: old.hpp 项目: ASMlover/study
BOOST_CONTRACT_DETAIL_DECLINLINE
old_value null_old() { return old_value(); }