void Miner::reset(const Blockchain &blockchain) { blocksMinedTotal = BlockCount(0); unbroadcastBlocks.clear(); _nextPublishTime = BlockTime(std::numeric_limits<TimeType>::max()); _lastCostUpdate = BlockTime(0); _nextMiningTime = strategy.get().miningStyle->nextMiningTime(blockchain, *this); totalMiningCost = 0; waitingForBroadcast = false; }
bool MultilayerPerceptron::AddLayer( Layer* in_layer) { if(_layers.size() > 0) { if(_layers.back()->outputs != in_layer->inputs) { return false; } size_t input_alloc_size = sizeof(float) * BlockCount(in_layer->inputs) * 4; float* buffer = (float*)AlignedMalloc(input_alloc_size, 16); memset(buffer, 0x00, input_alloc_size); _activations.back() = buffer; _activations.push_back(nullptr); } _layers.push_back(in_layer); return true; }
void LVector::Insert(ZPosition Pos, pvoid pItem, uint ItemSize) { if (ItemSize) { XErrorSetLast(E_INVALIDARG, "Non Zero Item Size Specified for Vector"); XErrorSignal("LVector::Insert"); return; } uint oldCount = m_count++; if (m_count > m_allocCount) { m_allocCount += BlockCount(); m_head = LMem.Std->Realloc(m_head, m_allocCount * m_itemSize); } m_last = (puchar)m_head + oldCount * m_itemSize; pvoid pNewItem; if (ZHead == Pos) { // Insert the Head Item pNewItem = m_head; // Copy the tail puchar pTmp = (puchar)m_last; for (uint i = 0; i < oldCount; i++) { memcpy(pTmp, pTmp - m_itemSize, m_itemSize); pTmp -= m_itemSize; } // Correct the iterators: uint i; for (i = 0; i < m_iterCount; i++) { // Increase indexes of all the valid iterators: if (m_pIter[i]->IsValid()) { ((GIterator*)m_pIter[i])->_IncIndex(); } } } else { // Insert the Last Item pNewItem = m_last; } memcpy(pNewItem, pItem, m_itemSize); AfterInsert(pNewItem, m_itemSize); return; }