Search Results for

    Show / Hide Table of Contents

    Class model::ClockState

    Clock state representation.

    Represents:

    • N discretized clock spins as a vector
    • M state terms as {x: double, y: double}

    The state terms hold the sum of cosines (sines) of the discretized clock model directions, respectively. I.e., term[j].x = \sum_{i \in j} cos(s_i * 2\pi/q) term[j].y = \sum_{i \in j} sin(s_i * 2\pi/q)

    Inheritance
    markov::State
    model::ClockState
    Inherited Members
    ~Component
    Component
    get_status
    param
    get_class_name

    Constructors

    ClockState()

    Create an uninitialized clock state.

    Declaration
    model::ClockState::ClockState()

    ClockState()

    Create a clock state with N spins and M terms.

    Declaration
    model::ClockState::ClockState(size_t N, size_t M)

    Methods

    configure()

    configure the object from input

    Initialize the object's state from the input utils::Config. This is done by declaring which required and optional parameters are associated with the fields of this object. During initialization, they are checked for their presence, type and any matchers. Example:

    MyClass : public Component {
     public:
      void configure(const utils::Json& json) override {
        this->param(json, "number", my_number)
            .description("some description")
            .matches(GreaterEquals(0))
            .required();
        this->param(json, "name", my_name)
            .description("some description")
            .matches(SizeIs(GreaterThan(0)))
            .default_value("no_name");
      }
    
     private:
      int my_number;
      std::string my_name;
    }
    
    MyClass my_object;
    my_object.configure(utils::json_from_string(R"(
      {
        "number": 42,
        "name": "hello"
      }
    )"));
    
    Note

    By default, nothing is configured from input. You need to overload this method if you want to use this functionality. Don't forget to call the configure method of the parent class if it also needs to be configured (this is not the case for utils::Component itself). HINT: Parameters are not limited to scalars and strings; Any component can be a parameter; in which case it is initialized using its own configure method. utils::Json

    Declaration
    void model::ClockState::configure(const utils::Json&json) override

    copy_state_only()

    Declaration
    void model::ClockState::copy_state_only(const ClockState&other)

    render()

    render the object in structured form

    Return a structured representation of the object. This is intended for output purposes. For instance, the solution your solver finds should have a render method which allows it to be returned as part of the result. Example:

    {c++}
     MySolution : public Component {
      public:
       // Represent the internal bool vector as +-1 output.
       utils::Structure render() const override {
         utils::Structure rendered;
         for (bool item : solution_) rendered.push_back(item ? 1 : -1);
         return rendered;
       }
    
      private:
       std::vector<bool> solution_;
     }
    
     MySolution solution;
     std::cout << solution.render().to_string() << std::endl;
    

    utils::Structure

    Declaration
    utils::Structure model::ClockState::render() const override

    memory_estimate()

    Declaration
    static size_t model::ClockState::memory_estimate(size_t N, size_t M)

    state_only_memory_estimate()

    Declaration
    static size_t model::ClockState::state_only_memory_estimate(size_t N)
    In This Article
    Back to top Generated with Doxygen and DocFX