void Foam::BlockLduMatrix<Type>::Amul
(
    TypeField& Ax,
    const TypeField& x
) const
{
    Ax = pTraits<Type>::zero;

    // Initialise the update of coupled interfaces
    initInterfaces(coupleUpper_, Ax, x);

    AmulCore(Ax, x);

    // Update coupled interfaces
    updateInterfaces(coupleUpper_, Ax, x);
}
shared_ptr<SwitchState> ThriftConfigApplier::run() {
    auto newState = orig_->clone();
    bool changed = false;

    processVlanPorts();

    {
        auto newPorts = updatePorts();
        if (newPorts) {
            newState->resetPorts(std::move(newPorts));
            changed = true;
        }
    }

    {
        auto newIntfs = updateInterfaces();
        if (newIntfs) {
            newState->resetIntfs(std::move(newIntfs));
            changed = true;
        }
    }

    // Note: updateInterfaces() must be called before updateVlans(),
    // as updateInterfaces() populates the vlanInterfaces_ data structure.
    {
        auto newVlans = updateVlans();
        if (newVlans) {
            newState->resetVlans(std::move(newVlans));
            changed = true;
        }
    }

    // Note: updateInterfaces() must be called before updateRouteTables(),
    // as updateInterfaces() populates the intfRouteTables_ data structure.
    {
        auto newTables = updateRouteTables();
        if (newTables) {
            newState->resetRouteTables(std::move(newTables));
            changed = true;
        }
    }

    // Make sure all interfaces refer to valid VLANs.
    auto newVlans = newState->getVlans();
    for (const auto& vlanInfo : vlanInterfaces_) {
        if (newVlans->getVlanIf(vlanInfo.first) == nullptr) {
            throw FbossError("Interface ",
                             *(vlanInfo.second.interfaces.begin()),
                             " refers to non-existent VLAN ", vlanInfo.first);
        }
    }

    VlanID dfltVlan(cfg_->defaultVlan);
    if (orig_->getDefaultVlan() != dfltVlan) {
        if (newVlans->getVlanIf(dfltVlan) == nullptr) {
            throw FbossError("Default VLAN ", dfltVlan, " does not exist");
        }
        newState->setDefaultVlan(dfltVlan);
        changed = true;
    }

    std::chrono::seconds arpAgerInterval(cfg_->arpAgerInterval);
    if (orig_->getArpAgerInterval() != arpAgerInterval) {
        newState->setArpAgerInterval(arpAgerInterval);
        changed = true;
    }

    if (!changed) {
        return nullptr;
    }
    return newState;
}