instruction_seed
stringlengths
43
8.03k
source
stringclasses
1 value
embeddings
listlengths
1.02k
1.02k
mean_positive_score
float64
0.73
0.85
mean_negative_score
float64
0.71
0.82
difference_score
float64
0.01
0.07
You are required to create a programming problem to implement a rational number package with polynomials as the numerator and denominator. The problem should include the creation of the rational number, reduction of the rational number, and addition of two rational numbers.
glaive
[ 0.030312729999423027, 0.017166586592793465, -0.04119511693716049, -0.0372236929833889, 0.037302665412425995, -0.01143341138958931, -0.002508193952962756, 0.05491328239440918, 0.044349197298288345, -0.023999720811843872, -0.002591226249933243, 0.025549741461873055, -0.033677324652671814, -0...
0.808705
0.789871
0.018834
You are tasked with implementing a method that takes a count and a type and creates a stack-allocated array of the given type with the specified count. The method should handle different scenarios based on the given type, such as pointers or span types. Additionally, the method should rewrite the count to size logic, c...
glaive
[ 0.027641303837299347, 0.03481008857488632, -0.016522929072380066, -0.023301908746361732, 0.04218043014407158, -0.029418116435408592, -0.022720942273736, 0.10083403438329697, 0.03214975446462631, -0.01765044406056404, 0.02326975390315056, 0.059299618005752563, -0.01458744890987873, -0.02408...
0.807596
0.787399
0.020197
Can you provide a program that can generate all possible permutations of a given array of integers?
glaive
[ 0.020200397819280624, 0.028429044410586357, -0.017812097445130348, -0.028403926640748978, 0.0293645728379488, -0.04856772720813751, -0.025620151311159134, 0.047630101442337036, 0.03874312713742256, -0.05432872474193573, 0.025900745764374733, 0.03572828695178032, -0.04099968820810318, -0.01...
0.802494
0.779674
0.02282
You are tasked with creating a program that takes in a string and calculates its MD5 hash value. The program should output the MD5 hash value of the input string.
glaive
[ 0.020276185125112534, 0.008412362076342106, -0.013375132344663143, -0.0366104356944561, 0.03998851403594017, -0.046995196491479874, 0.0040178848430514336, 0.06017553433775902, 0.04849054291844368, -0.023204902186989784, 0.00639136740937829, 0.014594335108995438, -0.04089275002479553, -0.02...
0.792903
0.778309
0.014593
You are tasked with implementing a Bitonic Sort algorithm in C++ to sort an array of integers in ascending order. Bitonic Sort is a comparison-based sorting algorithm that can be parallelized and is highly efficient for sorting large data sets. Your task is to create a C++ program that takes an array of integers as inp...
glaive
[ 0.03358536586165428, 0.003977144602686167, -0.022838834673166275, -0.01421449426561594, 0.028813207522034645, -0.03227715194225311, -0.027000918984413147, 0.09135553240776062, 0.047119155526161194, -0.017324063926935196, 0.008601240813732147, 0.025397734716534615, -0.04323647543787956, 0.0...
0.811215
0.773981
0.037233
You are tasked with implementing a quantum computing simulation using the given code snippet as a reference. The goal is to calculate the probability amplitudes for a quantum state and find the maximum probability within a specified range. Additionally, you need to visualize the probability function in 3D and as a cont...
glaive
[ 0.00045477398089133203, 0.034782879054546356, -0.024164773523807526, -0.01874903403222561, 0.04113361984491348, -0.030630791559815407, -0.016983704641461372, 0.07948113977909088, 0.032947082072496414, -0.004159541334956884, 0.028290854766964912, 0.039460353553295135, -0.015032400377094746, ...
0.806648
0.782313
0.024335
You are tasked with implementing a Scheme program to work with fectors. A fector is a data structure similar to a vector or array, but with some specific features. Your task is to create a program that includes the following functionalities: - Building fectors: You need to implement functions to create fectors with a s...
glaive
[ 0.04274807870388031, 0.01792588084936142, -0.02632773667573929, -0.024950696155428886, 0.04500251263380051, -0.0497511588037014, -0.01806262880563736, 0.06030832603573799, 0.030330656096339226, -0.015613216906785965, 0.010957591235637665, 0.062216050922870636, -0.031133310869336128, 0.0001...
0.802424
0.781879
0.020545
You are tasked with implementing a procedure to perform unsigned double division (ud/). The procedure takes two double-cell unsigned integers a0 a1 (in LSW-MSW order) and divides the 4-cell buffer UDres (in q3 q2 q1 q0 order) by a0 a1. The result is stored in UDres (q3 q2 q1 q0). The division should be performed using...
glaive
[ 0.0004570901801344007, 0.02028106339275837, -0.0178449098020792, -0.03976218029856682, 0.027976341545581818, 0.001789855188690126, -0.011183496564626694, 0.08125194162130356, 0.04061686620116234, -0.005047878250479698, 0.03900913894176483, 0.04239659011363983, -0.003441370790824294, -0.014...
0.801243
0.777061
0.024182
What is the C++ code to calculate the sum of a sequence of numbers?
glaive
[ -0.009668889455497265, 0.02354760468006134, -0.023106584325432777, -0.037259429693222046, 0.04595344513654709, -0.0053171939216554165, -0.014404535293579102, 0.0814916267991066, 0.03429137170314789, -0.037742096930742264, 0.008612732402980328, 0.05429952219128609, -0.036043595522642136, -0...
0.791785
0.767053
0.024732
I need to create a function that can return the maximum size of a vector data structure in a programming language. The function should take a pointer to the vector as a parameter and return the maximum size of the vector. The vector data structure is defined as follows: ```c typedef struct { // vector implementati...
glaive
[ 0.019205603748559952, 0.03296152502298355, -0.035333625972270966, -0.03152719885110855, 0.024447491392493248, -0.03775804489850998, -0.037427566945552826, 0.08131470531225204, 0.03450329974293709, -0.02394052967429161, 0.025097301229834557, 0.04183419793844223, -0.027572518214583397, -0.00...
0.79429
0.775774
0.018516
How can I create a C++ program that finds the greatest sum of n consecutive elements in an array of integers, with each element being no greater than k?
glaive
[ 0.008708859793841839, 0.023921117186546326, -0.02724412828683853, -0.046736590564250946, 0.038637675344944, -0.011318672448396683, -0.014491044916212559, 0.07103879004716873, 0.03339376300573349, -0.040093909949064255, 0.03588256612420082, 0.046384576708078384, -0.033580999821424484, 0.001...
0.810358
0.781966
0.028392
You are tasked with calculating the mean number of unemployed individuals for the period 2015 to 2017 per LSOA (Lower Layer Super Output Area) using R's data.table library. Additionally, you need to perform a weighted mean calculation using population probabilities from two separate CSV files, and then write the result...
glaive
[ -0.009643342345952988, 0.04162963479757309, -0.037130821496248245, -0.03546100854873657, 0.04423970356583595, 0.0012588010868057609, -0.03574848547577858, 0.06531156599521637, 0.02622411958873272, 0.010428030975162983, 0.01977030746638775, 0.012782956473529339, -0.028382034972310066, -0.01...
0.795046
0.780672
0.014374
You are tasked with creating a program that transfers algebraic structures across an `equiv`. You need to define a series of functions that transfer various algebraic structures (such as `has_zero`, `has_one`, `has_mul`, `has_add`, `has_inv`, `has_neg`, `semigroup`, `comm_semigroup`, `monoid`, `comm_monoid`, `group`, `...
glaive
[ 0.03877287358045578, 0.02113363891839981, -0.03111136704683304, -0.03102988190948963, 0.03562972694635391, -0.03738074004650116, 0.007623116951435804, 0.050654731690883636, 0.04560228809714317, -0.030344195663928986, 0.003891273168846965, 0.03903758153319359, -0.028970327228307724, -0.0046...
0.80659
0.786285
0.020305
Can someone provide an algorithm in Java to multiply two matrices?
glaive
[ 0.016260603442788124, 0.027290116995573044, -0.03984580934047699, -0.0330401286482811, 0.024474062025547028, -0.029853878542780876, -0.016228271648287773, 0.042350899428129196, 0.02303348295390606, -0.053103163838386536, 0.018239688128232956, 0.01931723952293396, -0.046447355300188065, -0....
0.788771
0.767057
0.021714
You are tasked with implementing a CUDA kernel function in C++ that performs a gradient step update on a given array. The kernel function should take in the following parameters: - A pointer to the array P that will be updated - A pointer to the array dP containing the gradients - A pointer to the array drate containin...
glaive
[ -0.012818263843655586, 0.056874830275774, -0.008250812068581581, -0.03710813820362091, 0.04745744913816452, -0.004968912806361914, -0.034086134284734726, 0.12809298932552338, 0.045913562178611755, -0.012432210147380829, 0.023248890414834023, 0.028483282774686813, -0.02167893573641777, 0.00...
0.797917
0.777313
0.020604
You are tasked with creating a program to calculate the balance left on a scale after a series of weights have been added to the left side. The program should take an array of weights as input and return the total balance left on the scale. For example, given an array of weights [3, 5, 2, 7], the program should calcu...
glaive
[ 0.018490741029381752, 0.033401817083358765, -0.03124713897705078, -0.04746351018548012, 0.05190489441156387, -0.017631225287914276, -0.0143433241173625, 0.06543700397014618, 0.04013450816273689, -0.019998906180262566, 0.01592755690217018, 0.053725358098745346, -0.04787467047572136, -0.0109...
0.809263
0.779297
0.029966
Can you provide an algorithm to sort an array of integers using bubble sort?
glaive
[ 0.011156406253576279, 0.020637638866901398, -0.013783116824924946, -0.017788518220186234, 0.015764988958835602, -0.04765411838889122, -0.03481293097138405, 0.03794068843126297, 0.02357909269630909, -0.033527880907058716, 0.020805153995752335, 0.018452733755111694, -0.039674390107393265, -0...
0.800393
0.779701
0.020692
: You are tasked with creating a program that will calculate the total number of valid passwords based on a given set of rules. The input will consist of a list of password policies and passwords. Each policy indicates the lowest and highest number of times a given letter must appear for the password to be valid. Your...
glaive
[ 0.028622636571526527, 0.024994365870952606, -0.01626141369342804, -0.026689909398555756, 0.041901957243680954, -0.0386430099606514, -0.01899019628763199, 0.03962956741452217, 0.019847894087433815, -0.013962374068796635, 0.018709933385252953, 0.029802421107888222, -0.05605052784085274, -0.0...
0.815122
0.771056
0.044066
You are tasked with implementing the field structure for integers modulo a prime number `p` in the `zmodp` type. The `zmodp` type is defined as a type of integers modulo a prime number, for which a field structure is to be implemented. The field structure should include the operations of addition, multiplication, subtr...
glaive
[ 0.030511699616909027, 0.011672194115817547, -0.023816658183932304, -0.03165578469634056, 0.0506502129137516, -0.04058019071817398, -0.0001991815079236403, 0.05973535776138306, 0.040502648800611496, -0.02465977892279625, 0.016083957627415657, 0.018069256097078323, -0.02565028890967369, -0.0...
0.807723
0.783482
0.024241
You are tasked with writing a program to generate the Nth element of the look-and-say sequence. The look-and-say sequence is generated by starting with the number "1" and then applying a rule to generate the next number in the sequence. To generate the next number, each digit is read in succession and a count is kept o...
glaive
[ 0.03640581667423248, 0.03903011977672577, 0.0028058376628905535, -0.0472695454955101, 0.038477662950754166, -0.012141197919845581, -0.050132498145103455, 0.08173152059316635, 0.022748975083231926, -0.018029138445854187, 0.03703897446393967, 0.03595748543739319, -0.05719192698597908, -0.003...
0.82207
0.779181
0.042889
You are tasked with implementing an online sparse kernel learning algorithm that aims to learn a kernel classifier with a bounded number of support vectors. The goal is to measure the difficulty in correctly classifying a training example by the derivative of a smooth loss function and give more chance to a difficult e...
glaive
[ -0.014943658374249935, 0.040661200881004333, -0.03072187304496765, -0.030638011172413826, 0.03548358008265495, 0.005637886468321085, -0.021220965310931206, 0.06156282126903534, 0.02303902432322502, -0.013827771879732609, -0.0006176474853418767, 0.021216096356511116, -0.01691659912467003, 0...
0.809744
0.788193
0.021551
Can you provide an algorithm for compressing a given array of characters?
glaive
[ 0.017992157489061356, 0.03175792098045349, -0.013470634818077087, -0.03566184267401695, 0.0322352759540081, -0.04507892206311226, -0.0090872123837471, 0.034586016088724136, 0.041417598724365234, -0.037415970116853714, 0.01756592094898224, 0.014357203617691994, -0.037146348506212234, -0.030...
0.797236
0.776235
0.021002
You are tasked with implementing a function that checks whether a given point in 3D space lies within a specified region. The region can be a box, a cylinder aligned with the X, Y, or Z axis. The information of the region is stored in a struct called `region`. The function `InZone` takes a `my_grid* g` which is a point...
glaive
[ 0.019672784954309464, 0.038701388984918594, -0.038902733474969864, -0.031696319580078125, 0.04152435436844826, -0.014002292416989803, -0.011836235411465168, 0.06768514961004257, 0.0347873792052269, 0.00838639959692955, 0.022662905976176262, 0.04924679547548294, -0.016654692590236664, -0.02...
0.805428
0.790555
0.014873
You are required to implement a function to solve a system of linear equations in the form Ax = b, where A is a tridiagonal matrix and b is a vector. The problem involves converting the input data to interleaved format, preparing the workspace, solving the system of equations, and evaluating the residual. Your task is...
glaive
[ 0.01994730718433857, 0.031251631677150726, -0.03186910226941109, -0.049003928899765015, 0.046033188700675964, -0.019609883427619934, -0.009227177128195763, 0.1053227037191391, 0.05395647883415222, -0.019576940685510635, 0.019850684329867363, 0.03570247441530228, -0.0018145234789699316, -0....
0.802502
0.784574
0.017928
You are required to implement a CUDA program that performs segmented sorting of an array of keys. The input to the program includes an array of keys, a vector of segment offsets, and the number of segments. The program should sort the keys within each segment in ascending order. Your task is to write a CUDA program th...
glaive
[ 0.03184103965759277, 0.03865545988082886, -0.029280271381139755, -0.009154880419373512, 0.015900693833827972, -0.009963681921362877, -0.021306823939085007, 0.08558643609285355, 0.028560537844896317, -0.01663023978471756, 0.03462843596935272, 0.02224627695977688, -0.02330932207405567, 0.012...
0.813558
0.788187
0.025371
How can I design an algorithm that prints all possible combinations of words where each letter is taken from a given set?
glaive
[ 0.01430213637650013, 0.023593908175826073, -0.01248400192707777, -0.0267354603856802, 0.03151318058371544, -0.048806190490722656, -0.03149917349219322, 0.04116307199001312, 0.037995170801877975, -0.03119281679391861, 0.012274191714823246, 0.033908165991306305, -0.029436012730002403, -0.025...
0.801928
0.785367
0.016561
Write a function that checks whether a given collection has a specified prefix. The function should return true if the collection has the specified prefix, and false otherwise. The prefix can be a list, vector, sequence, map, set, string, or regular expression. The function should also have an optional parameter to che...
glaive
[ 0.024192027747631073, 0.020258383825421333, -0.014470628462731838, -0.024493519216775894, 0.03019687905907631, -0.03213177248835564, 0.004375451244413853, 0.06496226787567139, 0.02119147777557373, -0.01079640630632639, 0.008627692237496376, 0.018867723643779755, -0.01478375680744648, -0.00...
0.814361
0.787878
0.026483
You are tasked with implementing a program that proves a specific result based on given propositions. You are given the following propositions: P, Q, R, and S, which are all true/false statements. Your task is to create a function that takes in the following arguments: - HP: A proof of proposition P - HnQ: A proof of t...
glaive
[ 0.00841630157083273, 0.02094014175236225, -0.0366949588060379, -0.03432508558034897, 0.01604439690709114, -0.039345573633909225, -0.006336935330182314, 0.07118446379899979, 0.04066632315516472, -0.017996206879615784, 0.01799664832651615, 0.03788294643163681, -0.00971782673150301, -0.016644...
0.798639
0.77756
0.021079
I need help designing an algorithm to compute the median of an unsorted array. The array can contain any number of elements. Can you provide a code solution?
glaive
[ 0.006271770689636469, 0.014512915164232254, -0.023612819612026215, -0.029693786054849625, 0.028508968651294708, -0.0340079590678215, -0.024998202919960022, 0.057736821472644806, 0.023282542824745178, -0.03243330121040344, 0.03300128132104874, -0.0022162545938044786, -0.027471795678138733, ...
0.803571
0.78494
0.018631
You are required to create a program that calculates the probability of a given quantum state using the provided amplitude function. The amplitude function takes in two parameters x and y and returns a complex value. The probability function calculates the absolute square of the amplitude. The program should then use t...
glaive
[ 0.01415778137743473, 0.03554726392030716, -0.03727303445339203, -0.02244596928358078, 0.04217338562011719, -0.02314687706530094, -0.016535494476556778, 0.07818620651960373, 0.034548912197351456, 0.00833094771951437, 0.024856893345713615, 0.04209945723414421, -0.02405967377126217, -0.015820...
0.800177
0.772654
0.027523
I am trying to implement a CUDA kernel function that performs a cumulative sum operation on a 2D array of integers. The input array has dimensions (s, e), where s is the number of rows and e is the number of columns. The goal is to calculate the cumulative sum along the rows of the input array. The cumulative sum opera...
glaive
[ -0.013366122730076313, 0.05906975269317627, -0.03992826119065285, -0.03610672801733017, 0.034711744636297226, 0.0020395484752953053, -0.038879383355379105, 0.09843447804450989, 0.032928671687841415, -0.011509275995194912, 0.026077739894390106, 0.03178258240222931, -0.014989123679697514, -0...
0.795738
0.779471
0.016267
You are tasked with implementing a parallel variant of the GMRES algorithm for solving a linear system of equations. The given code snippet provides a starting point for the implementation, defining the subroutines gmres_ser and gmres_par, which carry out the GMRES algorithm for the serial and parallel cases, respectiv...
glaive
[ 0.004711295012384653, 0.03288932517170906, -0.009144023060798645, -0.05405747517943382, 0.032227445393800735, -0.01920456811785698, -0.03092651441693306, 0.08979247510433197, 0.04535026475787163, -0.0030530316289514303, 0.006317710503935814, 0.05670703575015068, -0.012416195124387741, -0.0...
0.803485
0.778544
0.024941
I am looking to create a function that calculates the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 is 5 * 4 * 3 * 2 * 1 = 120. Please write a function in ML that takes an integer n as input and re...
glaive
[ 0.0247374065220356, 0.023950286209583282, -0.027412984520196915, -0.03658600524067879, 0.05264822766184807, -0.02674832008779049, -0.034563854336738586, 0.04529663547873497, 0.040970608592033386, -0.017367402091622353, 0.005733415484428406, 0.04280293360352516, -0.03962172567844391, -0.022...
0.808248
0.779258
0.02899
You are tasked with implementing a real-time object detection algorithm using the BBF (Brightness Binary Feature) method. The algorithm needs to be able to detect objects in an image based on a given cascade of classifiers. The algorithm should be able to build a pyramid of images, detect objects within the pyramid usi...
glaive
[ -0.0016660400433465838, 0.040922146290540695, -0.030767425894737244, -0.01870238035917282, 0.02371973544359207, -0.021636730059981346, -0.019904380664229393, 0.07166121155023575, 0.06002611294388771, -0.0033467456232756376, -0.00042803262476809323, 0.020802605897188187, -0.0106781255453825, ...
0.804654
0.785292
0.019362
Given two sets of numbers, [12, 24, 36, 48] and [56, 152, 254, 324], I would like to calculate the range of each set, find the difference between the two ranges, and calculate the median for each set using the numpy library. Additionally, I would like to plot a histogram for each set of numbers showcasing their distrib...
glaive
[ 0.01932346262037754, 0.016780436038970947, -0.05597737431526184, -0.03234948217868805, 0.03897497057914734, -0.03553151339292526, -0.03273030370473862, 0.049218617379665375, 0.04657129570841789, -0.03234214335680008, 0.025440555065870285, 0.015676558017730713, -0.04126410931348801, -0.0111...
0.79293
0.775671
0.017259
You are tasked with creating a program in GML (GameMaker Language) that utilizes a sprite sequence for an animated character. The program should include the following properties for the sprite sequence: - Width and height of the sprite should be 32x32 - The sprite sequence should have 4 frames - Each frame should be as...
glaive
[ -0.008046435192227364, 0.02666616253554821, -0.007399865426123142, -0.049182526767253876, 0.03825388476252556, -0.016229452565312386, -0.0455065481364727, 0.08057626336812973, 0.025094378739595413, -0.03680622950196266, 0.04326562210917473, 0.03905486688017845, -0.024272121489048004, 0.003...
0.778028
0.763332
0.014696
You need to implement a CUDA kernel for reducing the sum of boolean values in an array. The kernel should take an input array, a parents array, and the length of the parents array. It should update a boolean output array based on the reduction operation. Additionally, you need to implement an initialization function fo...
glaive
[ -0.008285325020551682, 0.04313099756836891, -0.038847051560878754, -0.00615040585398674, 0.03945406153798103, -0.015434769913554192, -0.01188816037029028, 0.10221970826387405, 0.05656416341662407, -0.013896537944674492, 0.005785318091511726, 0.037535082548856735, -0.009345650672912598, -0....
0.811828
0.790249
0.021579
You are tasked with creating a program that takes in an integer `d_int` and a matrix `d_matrix` of size `d_int` by `d_int`. You need to transform the data by extracting the `d_int` column from the matrix and store it in a vector `transformed_data_vector`. Next, you are required to define parameters `y_p` as a real numb...
glaive
[ 0.002202786970883608, 0.008306872099637985, -0.025462154299020767, -0.05692078545689583, 0.04597169905900955, -0.016584929078817368, -0.01713620498776436, 0.05948696285486221, 0.03497545048594475, -0.01049136184155941, 0.005453548859804869, 0.03832703456282616, -0.025194596499204636, 0.010...
0.805648
0.785454
0.020195
You are tasked with implementing a program to calculate the halo multiplicity function for different cosmological models. The halo multiplicity function is a key component in understanding the distribution of dark matter halos in the universe. Your program should include functions to calculate the Press-Schechter, Shet...
glaive
[ 0.006618240382522345, 0.022309649735689163, -0.02185695990920067, -0.03068837895989418, 0.030906865373253822, -0.02027849107980728, -0.042795829474925995, 0.054348625242710114, 0.03142327442765236, -0.01629033498466015, -0.00011769191769417375, 0.026569414883852005, -0.018444133922457695, ...
0.803411
0.776467
0.026944
You are required to implement a function that calculates the outer product of two tensors. The outer product of two tensors results in a new tensor whose dimension is the sum of the dimensions of the input tensors, and whose elements are the products of the elements of the input tensors. The function should handle tens...
glaive
[ 0.029091928154230118, 0.03626275062561035, -0.04078065976500511, -0.03017580695450306, 0.03845706209540367, 0.010766305029392242, -0.036516353487968445, 0.0763327032327652, 0.038572050631046295, -0.00906415656208992, 0.01325943786650896, 0.03460821136832237, -0.022362632676959038, -0.02337...
0.812423
0.787726
0.024696
You are tasked with implementing a loop iteration control form and destructuring in loop forms. Your goal is to create a function that takes a list of numbers and performs various operations on them using the loop iteration control form. The function should sum all the numbers in the list, return the first even number,...
glaive
[ 0.015123933553695679, 0.03352947533130646, -0.043408215045928955, -0.041301239281892776, 0.044111307710409164, -0.016999293118715286, -0.02819444052875042, 0.08017397671937943, 0.033994171768426895, 0.0072141471318900585, 0.015589150600135326, 0.026093922555446625, -0.02318076603114605, -0...
0.808667
0.785047
0.02362
You are tasked with implementing a CUDA program to perform matrix addition of two input matrices using the GPU. The matrices are of size 1024x1024 and are represented as 1D arrays in row-major order. You need to write a CUDA kernel function to add the matrices and a host function to verify the results. Your task is to...
glaive
[ 0.014774322509765625, 0.047120679169893265, -0.005614397581666708, -0.02108907885849476, 0.04435819014906883, -0.005601036362349987, -0.01771664433181286, 0.10707032680511475, 0.056770406663417816, -0.015145061537623405, 0.006939922459423542, 0.026039212942123413, -0.006699219346046448, -0...
0.790428
0.773336
0.017092
You are tasked with implementing a function that performs matrix multiplication with optional bias addition and batching on a GPU using CUDA and cuBLAS. The function should take in two input tensors A and B, with optional transposition flags, and produce the matrix product C. Additionally, the function should offer the...
glaive
[ 0.026134327054023743, 0.03464295342564583, -0.02385975793004036, -0.019401270896196365, 0.03569020330905914, -0.01622910611331463, -0.03095136024057865, 0.10423217713832855, 0.04895990714430809, -0.008742589503526688, 0.011173085309565067, 0.019590502604842186, -0.002554752863943577, -0.01...
0.802523
0.786083
0.01644
You are tasked with creating a program to generate a single paradiddle sequence. In percussion, the paradiddle is a four-note drum sticking pattern consisting of two alternating notes followed by two notes on the same hand. The program should take an input number and produce the single paradiddle sequence based on the ...
glaive
[ 0.031819138675928116, 0.017410043627023697, -0.00170247966889292, -0.02059827744960785, 0.03554312884807587, -0.030301524326205254, -0.02407483011484146, 0.06922276318073273, 0.035350460559129715, -0.01831222139298916, 0.027454731985926628, 0.030649257823824883, -0.02771451510488987, -0.01...
0.794938
0.770984
0.023953
You are tasked with implementing a 4x1 multiplexer (MUX4x1) in Verilog. The module should have a parameter DATA_WIDTH which specifies the width of the input and output data. The module should have the following ports: - sel: 2-bit input for selecting one of the four input data - in_1, in_2, in_3, in_4: Input data of wi...
glaive
[ 0.01753358356654644, 0.03391217440366745, -0.01950519159436226, -0.038710739463567734, 0.04172465205192566, -0.024602770805358887, -0.029810534790158272, 0.06497790664434433, 0.04100635275244713, 0.002230284968391061, 0.023254210129380226, 0.06332468241453171, 0.0073539456352591515, -0.020...
0.792737
0.775373
0.017364
You are tasked with implementing a brute force attack for the Data Encryption Standard (DES) algorithm using CPU. The goal is to find both the key and message that produce a given ciphertext. The DES algorithm uses a 64-bit key and operates on 64-bit blocks of plaintext. The key and message are represented as strings f...
glaive
[ 0.04002322256565094, 0.04334576055407524, -0.015416694805026054, -0.03489553555846214, 0.02506856806576252, -0.022956350818276405, -0.0070730517618358135, 0.09734144806861877, 0.04072003439068794, -0.030093738809227943, 0.016250193119049072, 0.02104916237294674, -0.026881562545895576, -0.0...
0.812388
0.791009
0.021378
You are tasked with implementing the Bjorklund algorithm in JavaScript for generating "Euclidean Rhythms". The algorithm consists of an initialization step and a subtraction step, and maintains two lists `A` and `B` of strings of bits. The initialization step involves building a string `{1,..k..,1,0,..n..,0}`, and sett...
glaive
[ -0.002025770954787731, 0.03721887245774269, -0.01219270471483469, -0.019516581669449806, 0.019393546506762505, -0.02760331705212593, -0.011709446087479591, 0.04910416528582573, 0.035047467797994614, -0.023021113127470016, 0.015492860227823257, 0.030028926208615303, -0.02348235435783863, 0....
0.825942
0.79183
0.034112
I am trying to solve the percolation problem in a 2D grid using the depth-first search algorithm. Percolation is assumed to occur from the top to the bottom of the grid. The grid consists of cells, where True represents porous cells (part of the path that can be passed through) and False represents blocked cells (no pa...
glaive
[ -0.020698588341474533, 0.022427095100283623, -0.006873192265629768, -0.03256947174668312, 0.015857955440878868, -0.03374085947871208, 0.0006502255564555526, 0.07447706162929535, 0.012113788165152073, -0.019471483305096626, 0.013436948880553246, 0.03249656781554222, -0.016273358836770058, -...
0.812623
0.796697
0.015926
I am trying to implement a program that deals with equivalence relations and partitions. I have a type `α` and a collection `c : set (set α)` of sets, which is a partition of `α` into pairwise disjoint sets. I need to create an equivalence relation based on this partition by defining the relation between elements of `α...
glaive
[ 0.03735261783003807, -0.005896027199923992, -0.03974083065986633, 0.0019212214974686503, 0.02933456562459469, -0.023714762181043625, -0.0007610155153088272, 0.07889102399349213, 0.05000286549329758, -0.02837681584060192, 0.025473354384303093, 0.024559592828154564, -0.0318494588136673, 0.00...
0.812674
0.796322
0.016352
I need to simulate the motion of four moons in a 3D space. Each moon has a position given by its x, y, and z coordinates, and a velocity given by its x, y, and z components. The motion is simulated using the following steps: 1. Read the initial positions of the moons from a file "data/input12.txt". 2. Calculate the ne...
glaive
[ 0.04096158966422081, 0.04698243737220764, -0.03162430226802826, -0.05040162801742554, 0.033714670687913895, -0.04265919700264931, -0.02336268126964569, 0.0618913434445858, 0.013096694834530354, -0.014428487047553062, 0.02507048472762108, 0.03178508207201958, -0.033612847328186035, -0.02100...
0.800995
0.780948
0.020046
I need to write a program that counts the number of (w,x,y) tuples where all terms are in the range {0,...,n}, and where w is less than or equal to the sum of x and y, and x is less than y. I need to implement a function or algorithm to calculate this count for a given value of n.
glaive
[ -0.004206663928925991, 0.006417735479772091, -0.05618278309702873, -0.02663089521229267, 0.047832559794187546, -0.011148465797305107, -0.03453867509961128, 0.05826634168624878, 0.02568855695426464, -0.0186800267547369, 0.015154106542468071, 0.04382755979895592, -0.03640388324856758, -0.032...
0.826142
0.796101
0.030041
You are tasked with creating a program that generates a random number between 1 and 100 and then prompts the user to guess the number. The program should continue to prompt the user for guesses until they correctly guess the number. Once the correct number is guessed, the program should display the number of attempts i...
glaive
[ 0.016327252611517906, 0.014701665379106998, -0.03009815141558647, -0.03583134338259697, 0.05054853856563568, -0.03270672634243965, -0.02529234066605568, 0.03627796098589897, 0.04090806841850281, -0.020533449947834015, 0.026378454640507698, 0.023866167291998863, -0.03421793133020401, 0.0065...
0.809127
0.788701
0.020425
You are working with a dataset and need to calculate the true and imputed probability mass functions (pmf) for combinations of variables in the dataset. Additionally, you need to calculate the mean and 95% credible interval for the imputed pmf, as well as the coverage for the intervals. Write a program to: 1. Load the...
glaive
[ 0.007168013136833906, 0.01766020432114601, -0.039604876190423965, -0.04444761946797371, 0.04211711138486862, -0.049619052559137344, -0.00016748566122259945, 0.05647559463977814, 0.035682160407304764, 0.008452167734503746, 0.008055153302848339, 0.012052737176418304, -0.022678030654788017, -...
0.789815
0.773666
0.016149
You are required to implement a function digit-breakdown that takes two arguments: - expr: a positive integer - parts: a list of positive integers representing the variable base (pre-multiplied) The function should return the digits breakdown in variable base (pre-multiplied). For example: - (digit-breakdown 12345 (10...
glaive
[ 0.038704391568899155, 0.014296584762632847, -0.04869190230965614, -0.048229947686195374, 0.038696274161338806, -0.01991742104291916, -0.003680167719721794, 0.056424904614686966, 0.043646298348903656, 0.015251471661031246, 0.025693751871585846, 0.03713923320174217, -0.05316436290740967, 0.0...
0.821819
0.786968
0.034851
You need to create a program that calculates the histogram for an input image using CUDA. The image is read from a file and its height and width are determined. The program then allocates memory for the image data and reads the image. It also allocates memory for the histogram and CUDA array. Then, it specifies a textu...
glaive
[ -0.00798062514513731, 0.029548844322562218, -0.024171406403183937, -0.01022182684391737, 0.03551625460386276, -0.010633395053446293, -0.038656823337078094, 0.0915115550160408, 0.043584223836660385, -0.028151609003543854, 0.020222624763846397, 0.02331145852804184, -0.00523036066442728, -0.0...
0.792615
0.772039
0.020576
You are tasked with implementing a C++ template for a predicate function that evaluates different comparison modes (e.g., equality, inequality, less than, greater than, etc.) for a given value. The template should be able to handle different data types such as float, int, and bool. The predicate function should take in...
glaive
[ 0.020306183025240898, 0.004007819574326277, -0.017509333789348602, -0.0295907873660326, 0.044475995004177094, -0.034517236053943634, -0.02533421479165554, 0.11009187251329422, 0.03739829733967781, -0.030827641487121582, 0.012119032442569733, 0.06346049904823303, -0.014536901377141476, 0.00...
0.806379
0.789481
0.016898
You are tasked with implementing a multiobjective GRASP (Greedy Randomized Adaptive Search Procedure) for the 1/3 variant of the time and space assembly line balancing problem. In this problem, you are given a set of tasks to be assigned to a set of workstations on an assembly line. Each task has a processing time and ...
glaive
[ 0.02370794303715229, 0.010849053971469402, -0.033646173775196075, -0.01899060606956482, 0.044629499316215515, -0.0029366754461079836, -0.035834670066833496, 0.06880220770835876, 0.030773859471082687, -0.006645893678069115, 0.02171805128455162, 0.04334896430373192, -0.00889983493834734, -0....
0.799536
0.778645
0.020891
I am trying to implement a program that processes a series of integers and counts the frequency of each unique integer. For example, given the input: 1 1 1 1 1 1 0 2 0 2 1 0 1 1 1 0 2 0 1 1 0 1 0 1 1 1 0 2 2 1 0 2 2 2 1 0 1 I want to output the frequency of each unique integer. How can I achieve this in my program?
glaive
[ 0.011187655851244926, 0.021307824179530144, -0.0458001084625721, -0.015576792880892754, 0.027190309017896652, -0.019907528534531593, -0.008591730147600174, 0.06032324582338333, 0.02557266131043434, -0.02358376793563366, 0.014223899692296982, 0.017490653321146965, -0.02256377786397934, -0.0...
0.811234
0.787247
0.023987
You are tasked with creating a program that generates an identity matrix. An identity matrix is a square matrix with all diagonal elements equal to 1 and all other elements equal to 0. Your program should take an integer n as input and generate an n x n identity matrix. If n is not an integer, the program should genera...
glaive
[ 0.03565377742052078, 0.02330695651471615, -0.03033572807908058, -0.03474467247724533, 0.040690962225198746, -0.03565557673573494, -0.010044035501778126, 0.06361681967973709, 0.047640103846788406, -0.028857555240392685, 0.029011983424425125, 0.005749445408582687, -0.0385194793343544, -0.027...
0.810132
0.772915
0.037217
Can you provide an algorithm to count the number of unique elements in an array?
glaive
[ 0.011773520149290562, 0.02271522954106331, -0.02837015688419342, -0.02268662489950657, 0.0259087011218071, -0.03591929376125336, -0.027056341990828514, 0.04760483652353287, 0.03332699090242386, -0.03255455940961838, 0.00977267138659954, 0.011924020946025848, -0.019657418131828308, -0.02300...
0.802199
0.773165
0.029034
You are tasked with implementing a red-black tree data structure in Zig. The red-black tree should have the following functionalities: - Insertion of nodes - Removal of nodes - Lookup of nodes - Replacement of nodes - Finding the first and last nodes in the tree The tree should support insertion of nodes with unique k...
glaive
[ 0.019385049119591713, 0.022167788818478584, -0.02255169302225113, -0.02910119667649269, 0.031144287437200546, -0.0415494404733181, 0.008051937445998192, 0.055628955364227295, 0.02324788272380829, -0.014558148570358753, 0.04576665163040161, -0.0034972040448337793, -0.022842377424240112, 0.0...
0.802131
0.783222
0.018909
You are tasked with creating a C++ program that utilizes the given code snippet as a starting point. The program should include the following components: 1. Libraries: Include the necessary libraries such as iostream, vector, string, and myClass.h. 2. Functions: Define a main function and another custom function calle...
glaive
[ 0.01324759516865015, 0.02405891753733158, -0.022299323230981827, -0.030309928581118584, 0.050322677940130234, -0.026966195553541183, -0.026508474722504616, 0.0905524343252182, 0.04079706221818924, -0.00775851309299469, 0.012621751055121422, 0.025930656120181084, -0.033310066908597946, -0.0...
0.813802
0.775634
0.038168
You are tasked with creating a function in Rust that calculates the factorial of a given number using recursion. The function should take an integer as input and return its factorial as an integer. The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n....
glaive
[ 0.02974693290889263, 0.042158059775829315, -0.013390503823757172, -0.04023352637887001, 0.03443845734000206, -0.02131054736673832, -0.010556028224527836, 0.06409400701522827, 0.04131881147623062, -0.004883479326963425, 0.021050596609711647, 0.05181697756052017, -0.03221990540623665, -0.008...
0.812996
0.7887
0.024297
You are tasked with implementing a demultiplexer module in Verilog. The module should have the following specifications: - The module should have a single input and multiple outputs. - The input should consist of a valid signal, data, channel, start of packet, end of packet, and a ready signal. - There should be two o...
glaive
[ 0.03184574469923973, 0.02750650979578495, -0.03670034557580948, -0.026494471356272697, 0.03273957222700119, -0.033098332583904266, -0.016929348930716515, 0.07675749808549881, 0.04790747910737991, -0.007617546245455742, 0.008957619778811932, 0.02927219681441784, 0.0008655635756440461, -0.00...
0.793474
0.778975
0.014499
You are tasked with implementing a matrix multiplication program using CUDA in C++. The goal is to parallelize the matrix multiplication process using both 2D grid and tiling techniques. The program should be able to compare the results obtained from the different parallelization techniques with the sequential CPU mult...
glaive
[ 0.02034498006105423, 0.0449402742087841, -0.009113228879868984, -0.01662769913673401, 0.035204265266656876, 0.002902708947658539, -0.03583269938826561, 0.12752556800842285, 0.03884097933769226, -0.028281264007091522, 0.00939050130546093, 0.03054991364479065, -0.012165219523012638, -0.00250...
0.785265
0.761538
0.023727
You are tasked with implementing a quantum probability function using a given formula. The function should take two input parameters, x and y, and return the probability calculated based on the given formula. You are also required to find the maximum probability value within a specific range for the input parameters.
glaive
[ 0.008800651878118515, 0.019781164824962616, -0.03972204774618149, -0.011723047122359276, 0.033832114189863205, -0.007711673621088266, -0.019411612302064896, 0.06354707479476929, 0.05212943255901337, 0.0026944943238049746, 0.03153389319777489, 0.04291583225131035, -0.0042986683547496796, -0...
0.788936
0.763817
0.025119
You are tasked with implementing a function that evaluates an expression and returns the sum of the two sub-expressions. The expression can be a simple addition operation represented by the Sum class. Your task is to create a function that takes an expression as input and returns the sum of the left and right sub-expre...
glaive
[ 0.02427791617810726, 0.0074659534730017185, -0.03803740814328194, -0.03936155512928963, 0.04801676422357559, -0.013728798367083073, -0.02893548086285591, 0.07404180616140366, 0.05712909996509552, 0.00111962272785604, 0.03429513797163963, 0.04530913755297661, -0.029432952404022217, -0.02839...
0.802888
0.785424
0.017464
You are required to create a program that performs numerical differentiation and evaluates the convergence of the computed quantities. The program should utilize the dg library to create a grid and matrices for 2D and 3D problems. The program should be able to handle different boundary conditions (Dirichlet, Neumann, p...
glaive
[ -0.009349065832793713, 0.0120649179443717, -0.03929423913359642, -0.044624604284763336, 0.029759086668491364, -0.02745303511619568, -0.023944193497300148, 0.05129483342170715, 0.03951174393296242, -0.005176343955099583, 0.01566450484097004, 0.037609394639730453, -0.03056098148226738, 0.000...
0.809869
0.794576
0.015293
You are tasked with implementing a GPU-based concurrent set data structure using the CUDA programming language. The data structure should support key insertion, key search, and bulk key search operations in a concurrent environment. The data structure is expected to use a slab allocation mechanism for memory management...
glaive
[ 0.018589086830615997, 0.05812470242381096, -0.01921161822974682, -0.0147263053804636, 0.023942485451698303, -0.015542318113148212, -0.030049623921513557, 0.09124959260225296, 0.042742855846881866, -0.020363228395581245, 0.03773362189531326, 0.012969253584742546, -0.009493065997958183, 0.01...
0.805288
0.788839
0.016449
You are given a hypothetical portfolio consisting of two assets: SPY and SPAB. Your goal is to perform a Markowitz Mean-Variance Optimization to determine the optimal allocation of weights for these assets in order to maximize the portfolio's return while minimizing its risk. The portfolio returns and risks are calcula...
glaive
[ 0.009318611584603786, 0.006732915062457323, -0.05550995469093323, -0.017067478969693184, 0.029086032882332802, -0.013179924339056015, -0.02525406889617443, 0.05846491456031799, 0.04389270022511482, -0.0029803181532770395, 0.0014049300225451589, 0.034053366631269455, -0.021167146041989326, ...
0.779244
0.761177
0.018067
You are given a dataset containing five columns: X, Y, TStamp, Pres., and EndPts. The DataSize of the dataset is 579. Each row in the dataset represents a data point with values for X, Y, TStamp, Pres., and EndPts. Your task is to write a program to analyze this dataset and perform the following tasks: 1. Calculate the...
glaive
[ -0.0026416147593408823, 0.003490220056846738, -0.04780472069978714, -0.05331622064113617, 0.04440561309456825, -0.05391530320048332, -0.026734981685876846, 0.06334948539733887, 0.05136740580201149, -0.007831697352230549, 0.034927643835544586, 0.01201329194009304, -0.03088398277759552, 0.01...
0.798075
0.779544
0.018531
You are tasked with writing a CUDA program to generate a Mandelbrot set with configurable parameters. The program should be able to handle the boundaries and sizes of the fractal in both pixels and numbers. The program should also be able to allocate GPU and CPU memory, implement initialization, perform the Mandelbrot ...
glaive
[ -0.004108955152332783, 0.051426395773887634, -0.006282471586018801, -0.03021710366010666, 0.025942692533135414, -0.014236743561923504, -0.030463777482509613, 0.0841391459107399, 0.062256813049316406, -0.04066602140665054, 0.015843257308006287, 0.04340977966785431, -0.016159821301698685, -0...
0.800914
0.777013
0.023902
You are tasked with implementing a GPU-accelerated matrix multiplication layer in C++ using the Caffe deep learning framework. The layer should be able to handle various input configurations such as full matrices and diagonal matrices. The layer should support forward and backward passes for gradient computation. Your ...
glaive
[ 0.033754970878362656, 0.03630063310265541, -0.00990721769630909, -0.03976960852742195, 0.03024197369813919, -0.0097324438393116, -0.038612693548202515, 0.11045954376459122, 0.026583125814795494, -0.02400008961558342, 0.01541343703866005, 0.01823803037405014, -0.024355074390769005, -0.00041...
0.79948
0.784983
0.014497
You are tasked with implementing a program that utilizes the algebraic data types and classes provided in the given code snippet. The program should include instances of the Box, Event, List, Maybe, Truthy, and Values classes, along with their respective operations and examples. Your task is to write code that defines...
glaive
[ 0.05011827498674393, 0.024895578622817993, -0.027686424553394318, -0.019976450130343437, 0.03180551528930664, -0.03946996480226517, -0.001688034157268703, 0.05246458202600479, 0.06305313855409622, -0.017867591232061386, 0.01741613633930683, 0.04237694293260574, -0.004087785724550486, -0.01...
0.810717
0.793071
0.017646
: You are tasked with writing a function that calculates the maximum value for a given integer type. The function should return the maximum value that can be represented by the specified integer type. The function should be generic and work for any integer type.
glaive
[ 0.047230541706085205, 0.031156174838542938, -0.029676666483283043, -0.032149892300367355, 0.04973151907324791, -0.05069931596517563, -0.022791843861341476, 0.05259326845407486, 0.047083381563425064, -0.023306451737880707, 0.04184528812766075, 0.06013140827417374, -0.021999210119247437, -0....
0.81191
0.777817
0.034093
You are tasked with implementing a subroutine in Fortran called DLQT02. This subroutine tests the functionality of DORGLQ, which is responsible for generating an m-by-n matrix Q with orthonormal rows defined as the product of k elementary reflectors. The task is to generate the orthogonal matrix Q using the LQ factoriz...
glaive
[ 0.01253938116133213, 0.03710296005010605, -0.02356700412929058, -0.04611107334494591, 0.015728315338492393, -0.012421906925737858, -0.014725722372531891, 0.07062002271413803, 0.025422850623726845, -0.01330429594963789, 0.015231012366712093, 0.037672389298677444, -0.020405657589435577, 0.00...
0.807101
0.78533
0.02177
You are tasked with implementing a Lennard-Jones potential energy function in C++ using CUDA for GPU acceleration. The Lennard-Jones potential is a pairwise interaction potential used to model the behavior of particles in a gas or liquid. The basic form of the Lennard-Jones potential is given by the equation: \[ V(r) ...
glaive
[ 0.0007847422384656966, 0.05157201737165451, -0.008496405556797981, -0.01758442632853985, 0.024220122024416924, -0.028457913547754288, -0.036691371351480484, 0.11486544460058212, 0.038322944194078445, -0.005117309745401144, 0.04193124175071716, 0.058808665722608566, -0.019981609657406807, -...
0.795198
0.777629
0.017569
You are tasked with writing a program to generate a sequence of numbers based on the following formula: a(n) = 78 * n^2 + 1. Your program should take a positive integer n as input and output the corresponding value of a(n) in the sequence. For example, if the input is 5, the output should be 1951. Write a function or...
glaive
[ 0.037834715098142624, 0.024693120270967484, -0.031474944204092026, -0.044170916080474854, 0.03238360956311226, -0.025842374190688133, -0.0300456453114748, 0.07774403691291809, 0.03168347850441933, -0.0354243740439415, 0.025452861562371254, 0.044594187289476395, -0.05646846443414688, -0.001...
0.826132
0.784043
0.042089
You are working on a project that requires calculating different distance matrices such as Euclidean distance, KL Divergence, Earth Mover's Distance (EMD), and Energy. You need to write functions to calculate these distance matrices and ensure that they produce correct results. Specifically, you need to write the follo...
glaive
[ 0.010955112054944038, 0.039799392223358154, -0.03260517865419388, -0.03949899598956108, 0.048119597136974335, -0.03568558394908905, -0.04242473095655441, 0.03648516535758972, 0.03887435793876648, 0.010403692722320557, 0.016435997560620308, 0.02710866369307041, -0.03205576539039612, -0.0044...
0.793653
0.758304
0.035349
How can I create an algorithm to check if there are two numbers in an array that sum up to a given number?
glaive
[ 0.007706292439252138, 0.01564384065568447, -0.038338664919137955, -0.03347376734018326, 0.035476572811603546, -0.03164199739694595, -0.023461386561393738, 0.05877530574798584, 0.009089233353734016, -0.03133896738290787, 0.01569322682917118, 0.023267759010195732, -0.032754164189100266, -0.0...
0.803538
0.777824
0.025714
You are required to create a package that manipulates integer arrays and provides various functionalities such as reading from a binary file, writing to a binary file, validating data, reallocating arrays, reshaping arrays, appending values, getting values at specific indices, setting values at specific indices, saving...
glaive
[ 0.016383526846766472, 0.036943841725587845, -0.025622611865401268, -0.03384489566087723, 0.041458409279584885, -0.04410254582762718, -0.015879066661000252, 0.036258239299058914, 0.03649919852614403, -0.029105473309755325, 0.014121863059699535, 0.02040903829038143, -0.019705461338162422, -0...
0.810084
0.792893
0.017191
You are tasked with creating a CUDAArray1 class to handle 1D arrays in the CUDA framework. Your task is to implement constructors, CopyFrom, Append, and View functions for this class. The constructors should create the array with the given size and initialize it with the given value. The CopyFrom function should copy t...
glaive
[ -0.0032671079970896244, 0.05270765349268913, -0.009427383542060852, -0.030463064089417458, 0.04903861880302429, -0.021940503269433975, -0.028153587132692337, 0.10196671634912491, 0.058767225593328476, -0.02837526798248291, 0.024167465046048164, 0.026643717661499977, -0.011416330933570862, ...
0.796128
0.777076
0.019052
You are tasked with implementing a quantum amplitude calculation and visualization program. The program should calculate the probability of a quantum state given certain input parameters and then visualize the probability distribution in a 3D plot and a contour plot. The input parameters are the angles `a` and `b`, whi...
glaive
[ 0.011369806714355946, 0.03955364227294922, -0.024839261546730995, -0.03634992614388466, 0.03646682947874069, -0.03167063370347023, -0.012653956189751625, 0.07936478406190872, 0.02967117168009281, 0.0069643668830394745, 0.03058052621781826, 0.03828390687704086, -0.022865677252411842, -0.011...
0.797042
0.776606
0.020436
You are tasked with implementing a program that calculates the upper-right triangle resulting from the binomial transform calculation for nonnegative integers. The binomial transform is a sequence transformation that produces a new sequence from a given sequence using a simple calculation. Your program should take a ...
glaive
[ 0.024454792961478233, 0.03216642141342163, -0.024209603667259216, -0.030917901545763016, 0.018578318879008293, -0.0176012571901083, -0.01675361767411232, 0.056799985468387604, 0.033915746957063675, -0.0076481555588543415, 0.05005444586277008, 0.037761081010103226, -0.02224007621407509, -0....
0.819678
0.76785
0.051828
I need to implement a CUDA kernel function in C++ to calculate the intersection over union (IoU) of two sets of bounding boxes. The function should take in two arrays of bounding boxes `bboxes1` and `bboxes2`, and output an array `ious` containing the IoU values for each pair of bounding boxes. The function should also...
glaive
[ 0.01227377075701952, 0.03758331015706062, -0.029667673632502556, -0.021927054971456528, 0.024727467447519302, 0.011536912061274052, -0.03368363156914711, 0.09308674931526184, 0.062089622020721436, -0.009543589316308498, 0.036965884268283844, 0.04432911053299904, 0.013956032693386078, 0.000...
0.793869
0.778913
0.014956
You are tasked with creating a function that takes in an array of numbers and returns the sum of all the even numbers in the array. If the array is empty or does not contain any even numbers, the function should return 0. Write a function called `sumEvenNumbers` that takes in an array of numbers and returns the sum of...
glaive
[ 0.026310352608561516, 0.028051337227225304, -0.03395378589630127, -0.04510854184627533, 0.04052791744470596, -0.01272125355899334, -0.008735304698348045, 0.04283532872796059, 0.023384295403957367, -0.013777544721961021, 0.009192339144647121, 0.03892110288143158, -0.05283437669277191, -0.02...
0.807262
0.760025
0.047237
How can I generate the Fibonacci sequence up to a given input number n using C++?
glaive
[ 0.00907444953918457, 0.011232459917664528, -0.013908645138144493, -0.02753352001309395, 0.02960824966430664, -0.027697622776031494, -0.022773323580622673, 0.08310514688491821, 0.032310545444488525, -0.02552994340658188, 0.02875673584640026, 0.05594179034233093, -0.035926174372434616, -0.01...
0.801404
0.781497
0.019907
You are tasked with creating a Kotlin function that generates a sequence of random geographical coordinates within a given bounds. The function should take a LatLngBounds object as input and return a Sequence of LatLng objects within the specified bounds. The generated LatLng coordinates should be within the latitude a...
glaive
[ 0.0011691775871440768, 0.03367672115564346, -0.002034018049016595, -0.044877808541059494, 0.02367047592997551, -0.01526727806776762, -0.04110246151685715, 0.03614269942045212, 0.023957451805472374, -0.020066676661372185, 0.01247495412826538, 0.03857836499810219, -0.023084044456481934, 0.01...
0.793926
0.77555
0.018376
You are tasked with implementing a CUDA kernel function that adds two arrays element-wise and stores the result in a third array. The function signature should be as follows: ```cpp extern "C" __global__ void my_add(const float* x1, const float* x2, float* y, long long n) ``` Where: - `x1` and `x2` are arrays of floa...
glaive
[ 0.0020598513074219227, 0.04404459893703461, -0.016008825972676277, -0.023559702560305595, 0.03532346710562706, -0.0018403764115646482, -0.022467264905571938, 0.10821875184774399, 0.04066639393568039, -0.01255797129124403, 0.023095762357115746, 0.04610587656497955, -0.013007596135139465, -0...
0.798953
0.777936
0.021017
You are tasked with implementing a shader function to generate fractal noise in GLSL. The function should take in a 2D coordinate and output a value representing the fractal noise at that position. Your function should incorporate the golden white noise function and the Perlin noise function, as well as the fractal Bro...
glaive
[ -0.012441752478480339, 0.031454265117645264, -0.02109135314822197, -0.046371765434741974, 0.03733792155981064, -0.02919483184814453, -0.03739391267299652, 0.06089549511671066, 0.027487868443131447, -0.005601769313216209, 0.03937944769859314, 0.032682403922080994, -0.005183825269341469, -0....
0.782502
0.767298
0.015204
You are tasked with creating a QueryService in Java that allows for k-nearest neighbor (k-NN) and range queries on a list of ReplyEntry objects. The ReplyEntry struct consists of an integer ID, a distance, an optional external ID, and an optional binary object. The QueryService should have the following functions: - se...
glaive
[ -0.004599628504365683, 0.01970207318663597, -0.02866199240088463, -0.03035782091319561, 0.030268507078289986, -0.030654022470116615, -0.011981639079749584, 0.033252082765102386, 0.0396651066839695, -0.014892333187162876, 0.05056195333600044, 0.0326472632586956, -0.0348924957215786, 0.02631...
0.801948
0.787466
0.014482
I have a dataset with three variables: Category, Value, and Frequency. I need to select all records where the sum of frequencies for each category and value combination is greater than 10. For example, if the sum of frequencies for category A and value RED is 6 and 7, respectively, then both records should be selected ...
glaive
[ 0.01341389399021864, 0.0025922211352735758, -0.05812487751245499, -0.018149683251976967, 0.027781091630458832, -0.03493091091513634, -0.0396886020898819, 0.06408508867025375, 0.039821408689022064, 0.002567268442362547, 0.02389003336429596, 0.030207382515072823, -0.03490521013736725, 0.0075...
0.806105
0.789638
0.016467
You are tasked with implementing a function to calculate the natural logarithm of a given input. The function should return the natural logarithm of the input, with special cases for certain input values: - ln(+inf) = +inf - ln(0) = -inf - ln(x) = nan if x < 0 - ln(nan) = nan Your task is to implement the `...
glaive
[ 0.007134028244763613, 0.04010213166475296, -0.026845350861549377, -0.05081461742520332, 0.032345447689294815, -0.0024686020333319902, -0.03566192463040352, 0.03906627371907234, 0.03587925806641579, -0.017644912004470825, 0.028958724811673164, 0.030151667073369026, -0.0461396798491478, -0.0...
0.794926
0.766207
0.02872
You are tasked with implementing the ECG (Ensemble Clustering for Graphs) algorithm using C++ and CUDA. The ECG algorithm involves several steps, including random permutation of the graph, Louvain clustering, and computation of weights for the original graph edges. Your task is to write the code to perform all these st...
glaive
[ 0.012412924319505692, 0.017408210784196854, -0.009707843884825706, -0.01351753156632185, 0.01690315641462803, -0.01646420732140541, -0.02902372181415558, 0.08964934945106506, 0.032562125474214554, -0.017700068652629852, 0.02819177135825157, 0.03545605018734932, -0.008257199078798294, 0.006...
0.812987
0.780376
0.032612
You are tasked with creating a data type in Haskell to represent points in n-dimensional Euclidean space. The data type should be built on top of the Vector data type, using a Vector to represent the coordinates of the given point. Additionally, you need to provide convenience functions for creating special points in $...
glaive
[ 0.012418589554727077, 0.015093838796019554, -0.024958329275250435, -0.04623391479253769, 0.04119284823536873, -0.02609381079673767, -0.004231496714055538, 0.046827420592308044, 0.04802795127034187, -0.02102326601743698, 0.013571417890489101, 0.060996104031801224, -0.00044151555630378425, -...
0.798782
0.780283
0.018499
You are tasked with implementing a function to generate a sequence of numbers according to the following recursive formula: a(n) = (n-1)*a(n-1)-a(n-2), a(0)=0, a(1)=1 Your task is to write a program or function that takes an input n and returns the nth number in the sequence.
glaive
[ 0.03770432621240616, 0.03576577454805374, -0.0247928686439991, -0.03880074620246887, 0.03074125200510025, -0.014008644968271255, -0.02612774260342121, 0.0768602192401886, 0.028827205300331116, -0.022088149562478065, 0.025727838277816772, 0.03099149279296398, -0.04151061177253723, -0.011236...
0.832813
0.798497
0.034316
You are tasked with creating a program that manipulates a list in Python using specific operations. Your program should be able to perform the following operations: 1. Add a single element to the list 2. Add multiple elements to the list at once 3. Remove specific elements from the list 4. Duplicate the elements in the...
glaive
[ 0.03023768775165081, 0.03433946147561073, -0.018961384892463684, -0.052190057933330536, 0.04946376383304596, -0.03209199756383896, -0.013865116983652115, 0.05527506396174431, 0.046996861696243286, -0.013864011503756046, 0.014901719987392426, 0.04815296828746796, -0.027884604409337044, -0.0...
0.799288
0.784937
0.014351
You are tasked with implementing a function to solve the rod cutting problem. Given a rod of length n and a list of prices for different lengths of rods, your function should determine the maximum revenue that can be obtained by cutting the rod and selling the pieces. The rod has a length of 10 units, and the prices ...
glaive
[ 0.024334728717803955, 0.0210955161601305, -0.009001286700367928, -0.02700447104871273, 0.018346907570958138, -0.01949421316385269, -0.012506955303251743, 0.05086583271622658, 0.0338214710354805, 0.003005905309692025, 0.0258516613394022, 0.032079581171274185, -0.02664759010076523, 0.0062922...
0.829556
0.793687
0.035869
What is the code to find the longest string from a given list of strings?
glaive
[ 0.0014805452665314078, 0.02295679971575737, -0.024255773052573204, -0.05048249661922455, 0.031705353409051895, -0.053893107920885086, -0.015299714170396328, 0.023295221850275993, 0.02281290479004383, -0.03883373737335205, 0.024368485435843468, 0.05216597020626068, -0.038551345467567444, -0...
0.80046
0.785917
0.014543
You are tasked with creating a program that calculates the probability distribution for a quantum system with a given number of qubits and state amplitudes. The program should then find the maximum probability value and display it along with a 3D plot and a contour plot of the probability distribution.
glaive
[ 0.005050381179898977, 0.01634032465517521, -0.04149937257170677, -0.025303659960627556, 0.04116952791810036, -0.025760028511285782, -0.03231910243630409, 0.05942675098776817, 0.040185485035181046, -0.014597771689295769, 0.025739969685673714, 0.039051443338394165, -0.015234645456075668, -0....
0.800009
0.775749
0.024261