/*! Return a string suitable for graphviz output. */ std::string fn::hmm::detail::deterministic_node::graphviz() { std::ostringstream out; out << "[shape=record,label=\"{inputs | "; for(int i=0; i<num_inputs(); ++i) { out << xinput(i) << " "; } for(int i=0; i<(1<<num_inputs()); ++i) { out << "| " << std::bitset<4>(i) << " "; } out << "} | { outputs | "; for(int i=0; i<num_outputs(); ++i) { out << xoutput(i) << " "; } for(int i=0; i<(1<<num_inputs()); ++i) { out << "| " << std::bitset<4>(dtable(i)) << " "; } out << "}\"];"; return out.str(); }
//------------------------------------------------------------------------------------------------------- gsBEncoder::gsBEncoder (audioMasterCallback audioMaster) : AudioEffectX (audioMaster, 1, num_params()) // 1 program, N parameters , gen(0) , bufferSize(512) , sampleRate(44100) , blockSize(512) { inputBuffers.resize(num_inputs()); outputBuffers.resize(num_outputs()); for(int i=0; i < inputBuffers.size(); i++) { inputBuffers[i] = new t_sample[bufferSize]; } for(int i=0; i < outputBuffers.size(); i++) { outputBuffers[i] = new t_sample[bufferSize]; } gen = (CommonState *)create(sampleRate, blockSize); setNumInputs (num_inputs()); setNumOutputs (num_outputs()); setUniqueID ('GSE_I'); // identify canProcessReplacing (); // supports replacing output canDoubleReplacing (); // supports double precision processing vst_strncpy (programName, VST_NAME, kVstMaxProgNameLen); // default program name }
void complain_bad_amount(struct state *state, struct block *block, const struct protocol_proof *proof, const union protocol_tx *tx, const struct protocol_input_ref *refs, const union protocol_tx *intx[]) { struct protocol_pkt_complain_tx_bad_amount *pkt; unsigned int i; assert(num_inputs(tx)); log_unusual(state->log, "Block %u ", le32_to_cpu(block->hdr->depth)); log_add_struct(state->log, struct protocol_double_sha, &block->sha); log_add(state->log, " invalid amounts in tx %u of shard %u ", proof->pos.txoff, le16_to_cpu(proof->pos.shard)); log_add_struct(state->log, union protocol_tx, tx); log_add(state->log, " with inputs: "); pkt = tal_packet(block, struct protocol_pkt_complain_tx_bad_amount, PROTOCOL_PKT_COMPLAIN_TX_BAD_AMOUNT); tal_packet_append_proven_tx(&pkt, proof, tx, refs); for (i = 0; i < num_inputs(tx); i++) { log_add_struct(state->log, union protocol_tx, intx[i]); log_add(state->log, " (output %u)", le16_to_cpu(tx_input(tx, i)->output)); tal_packet_append_tx(&pkt, intx[i]); } publish_complaint(state, block, pkt, NULL); }
bool node_t::is_valid() const { BOOST_FOREACH( const input_plug_type& i, input_plugs()) { if( !i.connected() && !i.optional()) return false; } if( ignored()) { if( num_inputs() == 0) return false; // handle the all inputs optional case bool all_optional = true; bool all_disconnected = true; BOOST_FOREACH( const input_plug_type& i, input_plugs()) { if( i.connected()) all_disconnected = false; if( !i.optional()) all_optional = false; } if( all_optional && all_disconnected) return false; } return do_is_valid(); }
void hash_tx_and_refs(const union protocol_tx *tx, const struct protocol_input_ref *refs, struct protocol_txrefhash *txrefhash) { hash_tx(tx, &txrefhash->txhash); hash_refs(refs, num_inputs(tx), &txrefhash->refhash); }
std::vector<int> calculate_inputs() const { std::vector<int> input_vars; for(size_t i=0; i<num_inputs(); ++i) input_vars.push_back(i); return input_vars; }
static void json_add_inputs(struct json_result *response, const union protocol_tx *tx) { unsigned int i; json_array_start(response, "vin"); for (i = 0; i < num_inputs(tx); i++) json_add_input(response, NULL, tx_input(tx, i)); json_array_end(response); }
u32 find_matching_input(const union protocol_tx *tx, const struct protocol_input *inp) { unsigned int i; /* Figure out which input of other did the spend. */ for (i = 0; i < num_inputs(tx); i++) { if (structeq(&tx_input(tx, i)->input, &inp->input) && tx_input(tx, i)->output == inp->output) return i; } abort(); }
void node_t::do_calc_bounds( const render::render_context_t& context) { if( num_inputs() != 0) { if( input()) { set_bounds( input()->bounds()); return; } } // as a fallback set the domain to the default set_bounds( domain()); }
void node_t::do_calc_domain( const render::render_context_t& context) { if( num_inputs() != 0) { if( input()) { set_domain( input()->domain()); return; } } // as a fallback set the domain to the default set_domain( Imath::Box2i( Imath::V2i( 0, 0), Imath::V2i( context.default_format.area().max.x - 1, context.default_format.area().max.y - 1))); }
void node_t::calc_bounds( const render::render_context_t& context) { if( is_valid_ && !ignored()) { do_calc_bounds( context); return; } if( ignored() && ( num_inputs() != 0) && input()) { set_bounds( input()->bounds()); return; } set_bounds( domain()); }
void node_t::calc_domain( const render::render_context_t& context) { is_valid_ = is_valid(); if( is_valid_ && !ignored()) { do_calc_domain( context); return; } if( ignored() && ( num_inputs() != 0) && input()) { set_domain( input()->domain()); return; } set_domain( Imath::Box2i( Imath::V2i( 0, 0), Imath::V2i( context.default_format.area().max.x - 1, context.default_format.area().max.y - 1))); }
static bool find_pending_doublespend(struct state *state, const union protocol_tx *tx) { unsigned int i; for (i = 0; i < num_inputs(tx); i++) { struct inputhash_elem *ie; struct inputhash_iter iter; const struct protocol_input *inp = tx_input(tx, i); for (ie = inputhash_firstval(&state->inputhash, &inp->input, le16_to_cpu(inp->output), &iter); ie; ie = inputhash_nextval(&state->inputhash, &inp->input, le16_to_cpu(inp->output), &iter)) { /* OK, is the tx which spend it pending? */ if (txhash_get_pending_tx(state, &ie->used_by)) return true; } } return false; }
enum ref_ecode check_tx_refs(struct state *state, const struct block *block, const union protocol_tx *tx, const struct protocol_input_ref *refs, unsigned int *bad_ref, struct block **block_referred_to) { unsigned int i, num = num_inputs(tx); bool all_known = true; assert(check_refs(state, block, refs, num) == PROTOCOL_ECODE_NONE); for (i = 0; i < num; i++) { struct block *b; struct protocol_txrefhash scratch; const struct protocol_txrefhash *txp; b = block_ancestor(block, le32_to_cpu(refs[i].blocks_ago)); txp = txrefhash_in_shard(b->shard[le16_to_cpu(refs[i].shard)], refs[i].txoff, &scratch); if (!txp) { *bad_ref = i; *block_referred_to = b; all_known = false; /* Keep looking in case there are worse issues. */ continue; } if (!structeq(&txp->txhash, &tx_input(tx, i)->input)) { *bad_ref = i; *block_referred_to = b; return ECODE_REF_BAD_HASH; } } if (!all_known) return ECODE_REF_UNKNOWN; return ECODE_REF_OK; }
void prepare_eigensizes() { values_.resize(num_expressions(), 1); derivatives_.resize(num_expressions(), num_inputs()); }
/** * @brief Sets the constant lines of the specification * * Use \ref copy_metadata to assign specification meta-data to a circuit. * * @param constants Vector of constant values * * @since 1.0 */ void set_constants( const std::vector<constant>& constants ) { _constants = constants; _constants.resize( num_inputs(), constant() ); }
//----------------------------------------------------------------------------------------- void gsBEncoder::processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames) { perform(gen, inputs, num_inputs(), outputs, num_outputs(), sampleFrames); }