當前位置: 首頁>>代碼示例>>C++>>正文


C++ Interval::minima方法代碼示例

本文整理匯總了C++中Interval::minima方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::minima方法的具體用法?C++ Interval::minima怎麽用?C++ Interval::minima使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Interval的用法示例。


在下文中一共展示了Interval::minima方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: makeBoxAround

 BoxT
 makeBoxAround(
         const Interval<DIM, T>& interval) const
 {
     Vector<DIM, T> lower = interval.minima();
     Vector<DIM, T> upper = interval.maxima();
     return makeBoxAround(lower, upper);
 }
開發者ID:jwscook,項目名稱:solver,代碼行數:8,代碼來源:tree.hpp

示例2: integral

    virtual
    T
    value(const Interval<DIM, T>& interval,
          const uint order) override
    {
        const uint numberOfQuadraturePoints = order + 1;

        calculateNewNodesAndWeightsIfNecessary(order);
        const auto index = indexFromOrder(order);
        auto nodes =
            mPreviouslyCalculatedUnscaledNodes[index];
        auto weights =
            mPreviouslyCalculatedUnscaledWeights[index];
        assert(numberOfQuadraturePoints == nodes.size());
        assert(weights.size() == nodes.size());

        std::array<std::vector<T>, DIM> arrayOfNodes, arrayOfWeights;
        arrayOfNodes.fill(nodes);
        arrayOfWeights.fill(weights);

        const auto minima = interval.minima();
        const auto maxima = interval.maxima();
        GaussLegendreOps<DIM, T>::scaleNodes(minima, maxima, arrayOfNodes);
        GaussLegendreOps<DIM, T>::scaleWeights(minima, maxima, arrayOfWeights);

        const auto allIndices = this->calculateAllIndicies(
                    numberOfQuadraturePoints);
        T integral(0.0);
        for (auto indices : allIndices) {
            std::array<T, DIM> weights, nodes;
            for (uint i = 0; i < DIM; ++i) {
                assert(i < indices.size());
                assert(indices[i] < numberOfQuadraturePoints);
                weights[i] = arrayOfWeights[i][indices[i]];
                nodes[i] = arrayOfNodes[i][indices[i]];
            }
            Vector<DIM, T> location(nodes);

            assert(interval.isInside(location));
            const auto weight = ContainerUtilities::product<DIM, T>(
                        weights);

            integral += weight * mFunc(location);
        }
        return integral;
    }
開發者ID:jwscook,項目名稱:solver,代碼行數:46,代碼來源:AdaptiveGauss.hpp


注:本文中的Interval::minima方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。