LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
infer_lqn_findbyname.h File Reference

First element of a named LQN container matching a name. More...

#include <cstddef>
#include <string>
#include <vector>
Include dependency graph for infer_lqn_findbyname.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::infer

Functions

std::size_t line::infer::infer_lqn_findbyname (const std::vector< std::string > &names, const std::string &name)
 First element of a named LQN container matching a name.

Variables

static const std::size_t line::infer::INFER_LQN_NOT_FOUND = static_cast<std::size_t>(-1)
 Returned when no element carries the requested name, MATLAB's [].

Detailed Description

First element of a named LQN container matching a name.

Port of matlab/src/api/infer/infer_lqn_findbyname.m. No JAR counterpart.

MATLAB walks a cell array of LQN element handles and returns the first whose .name equals the argument, or [] when none does. The handle itself belongs to the LayeredNetwork model layer, which this phase of the port does not carry, so what crosses is the lookup: the container is the name list (LayeredNetworkStruct.names, the same list infer_lqn_getobs indexes) and the result is the POSITION of the match, which the caller uses to index whatever parallel array holds its elements.

The MATLAB is a linear scan returning the FIRST match, and duplicates are not diagnosed; the port keeps both properties, since an LQN with two elements of one name resolves consistently between the two implementations only if they agree on which one wins.

ARITHMETIC: none. String comparison only, so the function is not templated on the number type and is usable from every instantiation.

Definition in file infer_lqn_findbyname.h.