Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Static Public Member Functions | List of all members
gadgetlib2::LooseMUX_Gadget Class Reference

#include <gadget.hpp>

Static Public Member Functions

static GadgetPtr create (ProtoboardPtr pb, const MultiPackedWordArray &inputs, const Variable &index, const VariableArray &output, const Variable &successFlag)
 
static GadgetPtr create (ProtoboardPtr pb, const VariableArray &inputs, const Variable &index, const Variable &output, const Variable &successFlag)
 

Detailed Description

Definition at line 423 of file gadget.hpp.

Member Function Documentation

◆ create() [1/2]

GadgetPtr gadgetlib2::LooseMUX_Gadget::create ( ProtoboardPtr  pb,
const MultiPackedWordArray inputs,
const Variable index,
const VariableArray output,
const Variable successFlag 
)
static

Definition at line 556 of file gadget.cpp.

562 {
563  GadgetPtr pGadget;
564  if (pb->fieldType_ == R1P) {
565  pGadget.reset(
566  new R1P_LooseMUX_Gadget(pb, inputs, index, output, successFlag));
567  } else {
569  "Attempted to create gadget of undefined Protoboard type.");
570  }
571  pGadget->init();
572  return pGadget;
573 }
Here is the caller graph for this function:

◆ create() [2/2]

GadgetPtr gadgetlib2::LooseMUX_Gadget::create ( ProtoboardPtr  pb,
const VariableArray inputs,
const Variable index,
const Variable output,
const Variable successFlag 
)
static
An overload for the private case in which we only want to multiplex one

Variable. This is usually the case in R1P.

Definition at line 579 of file gadget.cpp.

585 {
586  MultiPackedWordArray inpVec;
587  for (size_t i = 0; i < inputs.size(); ++i) {
588  MultiPackedWord cur(pb->fieldType_);
589  cur.push_back(inputs[i]);
590  inpVec.push_back(cur);
591  }
592  VariableArray outVec;
593  outVec.push_back(output);
594  auto result =
595  LooseMUX_Gadget::create(pb, inpVec, index, outVec, successFlag);
596  return result;
597 }
Here is the call graph for this function:

The documentation for this class was generated from the following files:
gadgetlib2::MultiPackedWordArray
::std::vector< MultiPackedWord > MultiPackedWordArray
Definition: variable.hpp:421
gadgetlib2::LooseMUX_Gadget::create
static GadgetPtr create(ProtoboardPtr pb, const MultiPackedWordArray &inputs, const Variable &index, const VariableArray &output, const Variable &successFlag)
Definition: gadget.cpp:556
GADGETLIB_FATAL
#define GADGETLIB_FATAL(msg)
Definition: infrastructure.hpp:85
gadgetlib2::GadgetPtr
::std::shared_ptr< Gadget > GadgetPtr
Definition: gadget.hpp:119
gadgetlib2::R1P
@ R1P
Definition: variable.hpp:37