bool FilterOperations::operationsMatch(const FilterOperations& other) const { size_t numOperations = operations().size(); // If the sizes of the function lists don't match, the lists don't match if (numOperations != other.operations().size()) return false; // If the types of each function are not the same, the lists don't match for (size_t i = 0; i < numOperations; ++i) { if (!operations()[i]->isSameType(*other.operations()[i])) return false; } return true; }
void resolv(char *base, char *opers, int *i, char **tabexpr, t_list **op, t_list **nb) { char *expr1; char *operator; char *expr2; my_put_in_list(op, tabexpr[*i]); *i = *i + 1; if (is_num(base, opers, tabexpr[*i]) == 1) my_put_in_list(nb, tabexpr[*i]); if (is_open_parent(opers, tabexpr[*i]) == 1) my_put_in_list(nb, parenthesis_mode(base, opers, i, tabexpr)); if (is_low_op(opers, tabexpr[*i])) my_put_in_list(nb, check_sp_low(base, opers, i, tabexpr)); if ((expr2 = malloc(sizeof(*expr2) * (my_strlen((*nb)->data) + 1))) == 0) exit(-1); expr2 = (*nb)->data; depile(nb); operator = malloc(sizeof(*operator) * (my_strlen((*op)->data) + 1)); operator = (*op)->data; depile(op); if ((expr1 = malloc(sizeof(*expr1) * (my_strlen((*nb)->data) + 1))) == 0) exit(-1); expr1 = (*nb)->data; depile(nb); my_put_in_list(nb, operations(base, opers, expr1, operator, expr2)); }
char *depile_all(char *base, char *operators, t_list *op, t_list *nb) { char *operator; char *expr1; char *expr2; if (my_list_size(op) > 0) { my_rev_list(&op); my_rev_list(&nb); } while (my_list_size(op) > 0) { operator = op->data; depile(&op); expr1 = nb->data; depile(&nb); if (my_list_size(nb) == 0) return (special_case_one_expr_only(base, operators, expr1, operator)); expr2 = nb->data; depile(&nb); my_put_in_list(&nb, operations(base, operators, expr1, operator, expr2)); } return (nb->data); }
PassRefPtr<AnimatableValue> AnimatableFilterOperations::interpolateTo(const AnimatableValue* value, double fraction) const { if (usesDefaultInterpolationWith(value)) return defaultInterpolateTo(this, value, fraction); const AnimatableFilterOperations* target = toAnimatableFilterOperations(value); FilterOperations result; size_t fromSize = operations().size(); size_t toSize = target->operations().size(); size_t size = std::max(fromSize, toSize); for (size_t i = 0; i < size; i++) { #if ENABLE(OILPAN) FilterOperation* from = (i < fromSize) ? m_operationWrapper->operations().operations()[i].get() : 0; FilterOperation* to = (i < toSize) ? target->m_operationWrapper->operations().operations()[i].get() : 0; #else FilterOperation* from = (i < fromSize) ? m_operations.operations()[i].get() : 0; FilterOperation* to = (i < toSize) ? target->m_operations.operations()[i].get() : 0; #endif RefPtrWillBeRawPtr<FilterOperation> blendedOp = FilterOperation::blend(from, to, fraction); if (blendedOp) result.operations().append(blendedOp); else ASSERT_NOT_REACHED(); } return AnimatableFilterOperations::create(result); }
char *special_case_one_expr_only(char *ba, char *opers, char *expr1, char *operator) { char fake_zero[2]; fake_zero[0] = ba[0]; fake_zero[1] = '\0'; return (operations(ba, opers, fake_zero, operator, expr1)); }
int main(int argc, char *argv[]) { if (argc == 1) printf("Usage: a b c + * / %%\n"); else operations(argv); return 0; }
bool FilterOperations::canInterpolateWith(const FilterOperations& other) const { for (size_t i = 0; i < operations().size(); ++i) { if (!FilterOperation::canInterpolate(operations()[i]->type())) return false; } for (size_t i = 0; i < other.operations().size(); ++i) { if (!FilterOperation::canInterpolate(other.operations()[i]->type())) return false; } size_t commonSize = std::min(operations().size(), other.operations().size()); for (size_t i = 0; i < commonSize; ++i) { if (!operations()[i]->isSameType(*other.operations()[i])) return false; } return true; }
// Add a new operation to the queue. Returns true if this is the only // operation for the given descriptor, in which case the reactor's event // demultiplexing function call may need to be interrupted and restarted. bool enqueue_operation(Descriptor descriptor, reactor_op* op) { typedef typename operations_map::iterator iterator; typedef typename operations_map::value_type value_type; std::pair<iterator, bool> entry = operations_.insert(value_type(descriptor, operations())); entry.first->second.op_queue_.push(op); return entry.second; }
int main() { setlocale(LC_ALL, "Rus"); Node* root = NULL; int operation = 0; int el = 0; operations(); while (true) { printf("Выберите действие: "); scanf("%d", &operation); switch (operation) { case 1: { printf("Введите значение\n"); scanf("%d", &el); add(root, el); break; } case 2: { printf("Введите значение\n"); scanf("%d", &el); remove(root, el); break; } case 3: { printf("Введите значение\n"); scanf("%d", &el); if (find(root, el) != NULL) printf("Элемент принадлежит множеству\n"); else printf("Элемент не принадлежит множеству\n"); break; } case 4: { printUp(root); break; } case 5: { printDown(root); break; } case 0: { exit(root); return 0; break; } } } }
void test_nombres() { operations(); fonctions(); std::cout.precision(dbl::max_digits10); std::cout << "PI = " << PI << std::fixed << std::endl; balle::afficher(); balle::deplacer(); balle::afficher(); }
void Canvas::CopyTransparentWhite(int dest_x, int dest_y, unsigned dest_width, unsigned dest_height, const Canvas &src, int src_x, int src_y) { if (!Clip(dest_x, dest_width, GetWidth(), src_x) || !Clip(dest_y, dest_height, GetHeight(), src_y)) return; SDLRasterCanvas canvas(buffer); TransparentPixelOperations<ActivePixelTraits> operations(canvas.Import(COLOR_WHITE)); canvas.CopyRectangle(dest_x, dest_y, dest_width, dest_height, src.buffer.At(src_x, src_y), src.buffer.pitch, operations); }
TransformOperations TransformOperations::blendByMatchingOperations(const TransformOperations& from, const double& progress) const { TransformOperations result; unsigned fromSize = from.operations().size(); unsigned toSize = operations().size(); unsigned size = max(fromSize, toSize); for (unsigned i = 0; i < size; i++) { RefPtr<TransformOperation> fromOperation = (i < fromSize) ? from.operations()[i].get() : 0; RefPtr<TransformOperation> toOperation = (i < toSize) ? operations()[i].get() : 0; RefPtr<TransformOperation> blendedOperation = toOperation ? toOperation->blend(fromOperation.get(), progress) : (fromOperation ? fromOperation->blend(0, progress, true) : 0); if (blendedOperation) result.operations().append(blendedOperation); else { RefPtr<TransformOperation> identityOperation = IdentityTransformOperation::create(); if (progress > 0.5) result.operations().append(toOperation ? toOperation : identityOperation); else result.operations().append(fromOperation ? fromOperation : identityOperation); } } return result; }
void Canvas::StretchTransparentWhite(int dest_x, int dest_y, unsigned dest_width, unsigned dest_height, ConstImageBuffer src, int src_x, int src_y, unsigned src_width, unsigned src_height) { if (!Clip(dest_x, dest_width, GetWidth(), src_x) || !Clip(dest_y, dest_height, GetHeight(), src_y)) return; SDLRasterCanvas canvas(buffer); TransparentPixelOperations<ActivePixelTraits> operations(canvas.Import(COLOR_WHITE)); canvas.ScaleRectangle(dest_x, dest_y, dest_width, dest_height, src.At(src_x, src_y), src.pitch, src.width, src.height, operations); }
int main() { initWithSingleElement(); initWithContainers(); initWithIterators(); copyAndMove(); appendAndJoin(); iterators(); modify(); operations(); compare(); assignment(); emplace(); merge(); sort(); resize(); }
bool appendKeyframeWithCustomBezierTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize) { bool canBlend = !lastValue; OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize)); if (!operations) return false; if (!canBlend) { OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize)); if (!lastOperations) return false; canBlend = lastOperations->canBlendWith(*operations); } if (canBlend) { curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), x1, y1, x2, y2); return true; } return false; }
bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize) { bool canBlend = !lastValue; OwnPtr<WebTransformOperations> operations(toWebTransformOperations(*value->value(), boxSize)); if (!operations) return false; if (!canBlend) { OwnPtr<WebTransformOperations> lastOperations(toWebTransformOperations(*lastValue->value(), boxSize)); if (!lastOperations) return false; canBlend = lastOperations->canBlendWith(*operations); } if (canBlend) { curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), timingFunctionType); return true; } return false; }
void Canvas::AlphaBlend(int dest_x, int dest_y, unsigned dest_width, unsigned dest_height, ConstImageBuffer src, int src_x, int src_y, unsigned src_width, unsigned src_height, uint8_t alpha) { // TODO: support scaling SDLRasterCanvas canvas(buffer); AlphaPixelOperations<ActivePixelTraits> operations(alpha); canvas.CopyRectangle(dest_x, dest_y, dest_width, dest_height, src.At(src_x, src_y), src.pitch, operations); }
/*Function definitions, etc.*/ int main(){ /*START_OF_MAIN*/ char ch; char ch1; /*END_OF_VARIABLES*/ /*Yatırım yapılacak urunun secim menusu*/ printf("*****************INSTRUMENTS*****************\n"); printf(" TL: (L or l)\n"); printf(" USD: (D or d)\n"); printf(" Gold: (G or g)\n"); printf(" Investment Fund: (F or f)\n"); printf("********************************************\n"); printf("Istediginiz Yatirimin Kodunu Giriniz:"); scanf("%c",&ch1); /*Yapılacak operasyonların secim menusu*/ printf("\n*****************OPERATIONS*****************\n"); printf(" Transaction:(T/t)\n"); printf(" Buy:(B/b)\n"); printf(" Sell:(S/s)\n"); printf(" Input:(I/i)\n"); printf(" Output:(O/o)\n"); printf(" Report to File:(F/f)\n"); printf(" Report to Console:(C/c)\n"); printf(" Exit:(E/e)\n"); printf("********************************************\n"); printf("Istediginiz Islemin Islem Kodunu Giriniz:"); scanf("\n%c",&ch); /*Fonksiyonların cagırılması*/ intruments(ch1); operations(ch); trans(ch); buy(ch); sell(ch); inp(ch); outp(ch); rptfile(ch); rptcnsl(ch); exitt(ch); return 0; /*END_OF_MAIN*/ }
int main(int argc, char *argv[]) { int op, row, col, grey_scale; char *image_file; FILE *fp; scanf("%d\n", &op); //Recebe a operação desejada. image_file = readLine(); //Lê o nome do arquivo. fp = fopen(image_file, "r"); //executa a função caso o arquivo esteja vazio: if(!fp) noFile(image_file, fp); imageDim(&row, &col, &grey_scale, fp); //Recebrá as dimensões. operations(op, fp, row, col, grey_scale);//Executa a operação desejada. free(image_file); fclose(fp); return 0; }
void Canvas::AlphaBlendNotWhite(int dest_x, int dest_y, unsigned dest_width, unsigned dest_height, ConstImageBuffer src, int src_x, int src_y, unsigned src_width, unsigned src_height, uint8_t alpha) { // TODO: support scaling SDLRasterCanvas canvas(buffer); NotWhiteCondition<SDLPixelTraits> c; NotWhiteAlphaPixelOperations<SDLPixelTraits> operations(c, PortableAlphaPixelOperations<SDLPixelTraits>(alpha)); canvas.CopyRectangle(dest_x, dest_y, dest_width, dest_height, src.At(src_x, src_y), src.pitch, operations); }
// // createSubchannelMask: create the DSP subchannel mask // // Synopsis: // void createSubchannelMask(subchannels_, birdieMask_, permRfiMask_, // testSignalMask_); // int32_t subchannels_; # of subchannels in use // DxBirdieMask *birdieMask_; birdie mask // DxPermRfIMask *permRfiMask_; permanent RFI mask // DxTestSignalMask *testSignalMask_; test signal mask // Notes: // The active set of subchannels is specified by subchannels_; // all DX subchannels which lie outside this range are // masked. // Masking is performed by setting the bit representing // that subchannel to 1. // The birdie mask is an IF mask, which means it is independent // of RF frequency. // The permanent RFI mask is an RF mask which requires that // the center frequency be known. // The test signal mask works in reverse: it resets any // subchannel specified. void SubchannelMask::createSubchannelMask(Activity *act) { Assert(act); subchannels = act->getUsableSubchannels(); subchannelBandwidth = act->getSubchannelWidthMHz(); Debug(DEBUG_SUBCHANNEL, act->getActivityId(), "actId"); Debug(DEBUG_SUBCHANNEL, act->getSkyFreq(), "dxSkyFreq"); Debug(DEBUG_SUBCHANNEL, act->getIfcSkyFreq(), "ifcSkyFreq"); Debug(DEBUG_SUBCHANNEL, act->getRcvrSkyFreq(), "rcvrSkyFreq"); float64_t dxSkyFreq = act->getSkyFreq(); float64_t dxIfcFreq = dxSkyFreq - act->getIfcSkyFreq(); float64_t dxRcvrFreq = dxSkyFreq - act->getRcvrSkyFreq(); BirdieMask *birdieMask = act->getBirdieMask(); BirdieMask *rcvrBirdieMask = act->getRcvrBirdieMask(); PermRfiMask *permRfiMask = act->getPermRfiMask(); TestSignalMask *testSignalMask = act->getTestSignalMask(); uint32_t ops = act->getOperationsMask(); Debug(DEBUG_SUBCHANNEL, (int32_t) ops, "operations"); Debug(DEBUG_BIRDIE_MASK, act->getRcvrSkyFreq(), "...act->getRcvrSkyFrequency()"); DxOpsBitset operations(ops); ops = operations.to_ulong(); Debug(DEBUG_SUBCHANNEL, (int32_t) ops, "operations"); mask.reset(); Debug(DEBUG_SUBCHANNEL, 0, "birdieMask"); if (operations.test(APPLY_BIRDIE_MASK)) applyBirdieMask(birdieMask, dxIfcFreq); Debug(DEBUG_SUBCHANNEL, 0, "rcvrBirdieMask"); if (operations.test(APPLY_RCVR_BIRDIE_MASK)) applyBirdieMask(rcvrBirdieMask, dxRcvrFreq); Debug(DEBUG_SUBCHANNEL, 1, "permRfiMask"); if (operations.test(APPLY_PERMANENT_RFI_MASK)) applyPermRfiMask(permRfiMask, dxSkyFreq); Debug(DEBUG_SUBCHANNEL, 2, "testSignalMask"); if (operations.test(APPLY_TEST_SIGNAL_MASK)) applyTestSignalMask(testSignalMask, dxSkyFreq); }
int main(int argc, char **argv) { //test_resize("data/bad.jpg"); //test_box(); //test_convolutional_layer(); if(argc < 2){ fprintf(stderr, "usage: %s <function>\n", argv[0]); return 0; } gpu_index = find_int_arg(argc, argv, "-i", 0); if(find_arg(argc, argv, "-nogpu")) { gpu_index = -1; } #ifndef GPU gpu_index = -1; #else if(gpu_index >= 0){ cuda_set_device(gpu_index); } #endif if (0 == strcmp(argv[1], "average")){ average(argc, argv); } else if (0 == strcmp(argv[1], "yolo")){ run_yolo(argc, argv); } else if (0 == strcmp(argv[1], "super")){ run_super(argc, argv); } else if (0 == strcmp(argv[1], "lsd")){ run_lsd(argc, argv); } else if (0 == strcmp(argv[1], "detector")){ run_detector(argc, argv); } else if (0 == strcmp(argv[1], "detect")){ float thresh = find_float_arg(argc, argv, "-thresh", .5); char *filename = (argc > 4) ? argv[4]: 0; char *outfile = find_char_arg(argc, argv, "-out", 0); int fullscreen = find_arg(argc, argv, "-fullscreen"); test_detector("cfg/coco.data", argv[2], argv[3], filename, thresh, .5, outfile, fullscreen); } else if (0 == strcmp(argv[1], "cifar")){ run_cifar(argc, argv); } else if (0 == strcmp(argv[1], "go")){ run_go(argc, argv); } else if (0 == strcmp(argv[1], "rnn")){ run_char_rnn(argc, argv); } else if (0 == strcmp(argv[1], "coco")){ run_coco(argc, argv); } else if (0 == strcmp(argv[1], "classify")){ predict_classifier("cfg/imagenet1k.data", argv[2], argv[3], argv[4], 5); } else if (0 == strcmp(argv[1], "classifier")){ run_classifier(argc, argv); } else if (0 == strcmp(argv[1], "regressor")){ run_regressor(argc, argv); } else if (0 == strcmp(argv[1], "isegmenter")){ run_isegmenter(argc, argv); } else if (0 == strcmp(argv[1], "segmenter")){ run_segmenter(argc, argv); } else if (0 == strcmp(argv[1], "art")){ run_art(argc, argv); } else if (0 == strcmp(argv[1], "tag")){ run_tag(argc, argv); } else if (0 == strcmp(argv[1], "3d")){ composite_3d(argv[2], argv[3], argv[4], (argc > 5) ? atof(argv[5]) : 0); } else if (0 == strcmp(argv[1], "test")){ test_resize(argv[2]); } else if (0 == strcmp(argv[1], "nightmare")){ run_nightmare(argc, argv); } else if (0 == strcmp(argv[1], "rgbgr")){ rgbgr_net(argv[2], argv[3], argv[4]); } else if (0 == strcmp(argv[1], "reset")){ reset_normalize_net(argv[2], argv[3], argv[4]); } else if (0 == strcmp(argv[1], "denormalize")){ denormalize_net(argv[2], argv[3], argv[4]); } else if (0 == strcmp(argv[1], "statistics")){ statistics_net(argv[2], argv[3]); } else if (0 == strcmp(argv[1], "normalize")){ normalize_net(argv[2], argv[3], argv[4]); } else if (0 == strcmp(argv[1], "rescale")){ rescale_net(argv[2], argv[3], argv[4]); } else if (0 == strcmp(argv[1], "ops")){ operations(argv[2]); } else if (0 == strcmp(argv[1], "speed")){ speed(argv[2], (argc > 3 && argv[3]) ? atoi(argv[3]) : 0); } else if (0 == strcmp(argv[1], "oneoff")){ oneoff(argv[2], argv[3], argv[4]); } else if (0 == strcmp(argv[1], "oneoff2")){ oneoff2(argv[2], argv[3], argv[4], atoi(argv[5])); } else if (0 == strcmp(argv[1], "print")){ print_weights(argv[2], argv[3], atoi(argv[4])); } else if (0 == strcmp(argv[1], "partial")){ partial(argv[2], argv[3], argv[4], atoi(argv[5])); } else if (0 == strcmp(argv[1], "average")){ average(argc, argv); } else if (0 == strcmp(argv[1], "visualize")){ visualize(argv[2], (argc > 3) ? argv[3] : 0); } else if (0 == strcmp(argv[1], "mkimg")){ mkimg(argv[2], argv[3], atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), argv[7]); } else if (0 == strcmp(argv[1], "imtest")){ test_resize(argv[2]); } else { fprintf(stderr, "Not an option: %s\n", argv[1]); } return 0; }
void Key::debugDump() { printf("Key %d type %d size %d mode=0x%x dir=0x%x ACL %s\n", keyNum, keyType, keySize, mode(), operations(), acl().form('u').c_str()); }
bool AnimatableFilterOperations::equalTo(const AnimatableValue* value) const { return operations() == toAnimatableFilterOperations(value)->operations(); }
static int readNetworkStatsDetail(JNIEnv* env, jclass clazz, jobject stats, jstring path, jint limitUid) { ScopedUtfChars path8(env, path); if (path8.c_str() == NULL) { return -1; } FILE *fp = fopen(path8.c_str(), "r"); if (fp == NULL) { return -1; } Vector<stats_line> lines; int lastIdx = 1; char buffer[384]; while (fgets(buffer, sizeof(buffer), fp) != NULL) { stats_line s; int64_t rawTag; if (sscanf(buffer, "%d %31s 0x%llx %u %u %llu %llu %llu %llu", &s.idx, s.iface, &rawTag, &s.uid, &s.set, &s.rxBytes, &s.rxPackets, &s.txBytes, &s.txPackets) == 9) { if (s.idx != lastIdx + 1) { ALOGE("inconsistent idx=%d after lastIdx=%d", s.idx, lastIdx); return -1; } lastIdx = s.idx; s.tag = rawTag >> 32; lines.push_back(s); } } if (fclose(fp) != 0) { return -1; } int size = lines.size(); ScopedLocalRef<jobjectArray> iface(env, env->NewObjectArray(size, gStringClass, NULL)); if (iface.get() == NULL) return -1; ScopedIntArrayRW uid(env, env->NewIntArray(size)); if (uid.get() == NULL) return -1; ScopedIntArrayRW set(env, env->NewIntArray(size)); if (set.get() == NULL) return -1; ScopedIntArrayRW tag(env, env->NewIntArray(size)); if (tag.get() == NULL) return -1; ScopedLongArrayRW rxBytes(env, env->NewLongArray(size)); if (rxBytes.get() == NULL) return -1; ScopedLongArrayRW rxPackets(env, env->NewLongArray(size)); if (rxPackets.get() == NULL) return -1; ScopedLongArrayRW txBytes(env, env->NewLongArray(size)); if (txBytes.get() == NULL) return -1; ScopedLongArrayRW txPackets(env, env->NewLongArray(size)); if (txPackets.get() == NULL) return -1; ScopedLongArrayRW operations(env, env->NewLongArray(size)); if (operations.get() == NULL) return -1; for (int i = 0; i < size; i++) { ScopedLocalRef<jstring> ifaceString(env, env->NewStringUTF(lines[i].iface)); env->SetObjectArrayElement(iface.get(), i, ifaceString.get()); uid[i] = lines[i].uid; set[i] = lines[i].set; tag[i] = lines[i].tag; rxBytes[i] = lines[i].rxBytes; rxPackets[i] = lines[i].rxPackets; txBytes[i] = lines[i].txBytes; txPackets[i] = lines[i].txPackets; } env->SetIntField(stats, gNetworkStatsClassInfo.size, size); env->SetObjectField(stats, gNetworkStatsClassInfo.iface, iface.get()); env->SetObjectField(stats, gNetworkStatsClassInfo.uid, uid.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.set, set.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.tag, tag.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.rxBytes, rxBytes.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.rxPackets, rxPackets.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.txBytes, txBytes.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.txPackets, txPackets.getJavaArray()); env->SetObjectField(stats, gNetworkStatsClassInfo.operations, operations.getJavaArray()); return 0; }
bool AnimatableFilterOperations::usesDefaultInterpolationWith(const AnimatableValue* value) const { const AnimatableFilterOperations* target = toAnimatableFilterOperations(value); return !operations().canInterpolateWith(target->operations()); }