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 tasked with implementing a maximum likelihood optimization algorithm using Stata. Your task is to write the code that maximizes likelihood functions using the specified iterative maximization options and convergence tolerances. The code must be able to handle nonconcave regions of the likelihood and use differe...
glaive
[ -0.016770916059613228, 0.013685420155525208, -0.03129374235868454, -0.036598529666662216, 0.045681435614824295, 0.0006177063914947212, -0.029312869533896446, 0.06457481533288956, 0.041865184903144836, -0.0233609601855278, 0.0018339434172958136, 0.03235124424099922, -0.013229936361312866, 0...
0.801508
0.784412
0.017096
You are tasked with implementing a k-nearest neighbors (KNN) algorithm using C++ for a given graph. The algorithm should find the k nearest neighbors for each vertex in the graph. The input parameters include the graph, the value of k, and the indices of two reference points (point_x and point_y). The algorithm should ...
glaive
[ 0.016291387379169464, 0.03497502580285072, -0.01611875183880329, -0.028037836775183678, 0.03332128748297691, -0.008875052444636822, -0.01937982067465782, 0.07863365858793259, 0.0356663316488266, 0.0011048648739233613, 0.026295360177755356, 0.029343070462346077, -0.007119623478502035, 0.021...
0.809077
0.768844
0.040234
You are tasked with creating a CUDA kernel for a spoof cellwise operation on matrices, which involves performing a specific operation on each cell of the matrices A and B and storing the result in matrix C. The operation to be performed is defined by the provided code snippet, which includes the necessary data structur...
glaive
[ -0.003628677222877741, 0.04292324185371399, -0.013555401004850864, -0.025706812739372253, 0.01929524727165699, -0.024943893775343895, -0.011025454849004745, 0.09338382631540298, 0.028015488758683205, -0.022886373102664948, 0.017758427187800407, 0.035489216446876526, -0.012689472176134586, ...
0.802093
0.786775
0.015317
You are tasked with creating a seed dispersal model using an exponential power kernel in a programming language that supports Stan, such as R or Python. The model should calculate the expected number of seeds per trap and year based on various parameters such as trap area, number of observations, years, trees, and trap...
glaive
[ -0.008155464194715023, 0.028977006673812866, -0.026429416611790657, -0.04462119936943054, 0.033166129142045975, -0.03936811909079552, -0.041774846613407135, 0.06897144764661789, 0.03371167927980423, -0.023306090384721756, 0.015621999278664589, 0.03442041203379631, -0.05128093436360359, 0.0...
0.805195
0.788491
0.016704
I am trying to implement Chebyshev iteration to solve a linear system of equations Ax=b, where A is a symmetric, definite matrix. I want to use the Chebyshev iteration algorithm to find the solution x, given an initial guess, right-hand side vector b, and the lower and upper bounds for the real eigenvalues of A. I nee...
glaive
[ 0.013446854427456856, 0.031014811247587204, -0.04405966401100159, -0.02644198201596737, 0.035381823778152466, -0.019748128950595856, -0.014629673212766647, 0.07701020687818527, 0.03942248970270157, -0.016621829941868782, 0.0017323748907074332, 0.0009558796882629395, -0.023745207116007805, ...
0.799101
0.779886
0.019214
What is the algorithm to calculate the sum of all numbers between two given numbers?
glaive
[ 0.01819257251918316, 0.016921203583478928, -0.03037208318710327, -0.03604219853878021, 0.03349412977695465, -0.017332375049591064, -0.02056741900742054, 0.033591192215681076, 0.036861903965473175, -0.041594069451093674, 0.020041923969984055, 0.05950899049639702, -0.03212805464863777, -0.00...
0.802296
0.763351
0.038945
You are tasked with creating a program that handles routes for a transportation system. The system should be able to determine whether it is possible to use only parts of multiple routes, or if the route must be followed from start to finish without any deviations. Each route is defined by a set of locations and their ...
glaive
[ 0.03349003568291664, 0.008609317243099213, -0.032680120319128036, 0.0021152168046683073, 0.02809642255306244, -0.022877264767885208, -0.018336273729801178, 0.06208769604563713, 0.028674419969320297, -0.020392782986164093, 0.021886928007006645, 0.05512085184454918, 0.00467804167419672, -0.0...
0.790035
0.773304
0.016731
You are tasked with writing a GLSL program that computes a color value for each pixel on the screen based on its coordinates. The program should have a function `compute_value` that takes in two parameters: `limit` (a float) and `thirty_two` (a float). The `compute_value` function should iterate through a loop, updatin...
glaive
[ -0.004506885074079037, 0.04116416350007057, -0.026157153770327568, -0.05080248787999153, 0.02673356607556343, -0.04319468140602112, -0.037418216466903687, 0.04304404556751251, 0.030657490715384483, -0.028274700045585632, 0.05337011069059372, 0.062037523835897446, -0.012298610992729664, 0.0...
0.794326
0.775277
0.019049
You are tasked with creating a program to generate an image of an Archimedes spiral using Pascal. The program should use the `graph` library and must define the necessary variables and constants to draw the spiral. The program should calculate the coordinates for each pixel on the screen based on the mathematical formu...
glaive
[ -0.014984313398599625, 0.03958912566304207, -0.00908675231039524, -0.05824374407529831, 0.03232812136411667, -0.03437398746609688, -0.022478673607110977, 0.06992391496896744, 0.048866283148527145, -0.015123476274311543, 0.03426767885684967, 0.03831969574093819, -0.006111518479883671, -0.01...
0.799605
0.774653
0.024953
You are tasked with creating a function in F# that takes in a list of integers and returns the sum of all the even numbers in the list. The function should be named "sumEvenNumbers" and should take a single parameter, which is a list of integers. You should ensure that the function handles an empty list appropriately a...
glaive
[ 0.018341071903705597, 0.01783103309571743, -0.029778489843010902, -0.06049272045493126, 0.046461280435323715, -0.01888488046824932, -0.0031116120517253876, 0.0378740057349205, 0.03239009156823158, -0.008717473596334457, 0.015174821019172668, 0.052194710820913315, -0.04550235718488693, -0.0...
0.802752
0.769502
0.03325
You are tasked with writing a function that takes in a list of numbers and calculates the sum of the squares of those numbers. You need to implement a function called "sum_of_squares" which takes a list of numbers as input and returns the sum of the squares of those numbers. For example, given the input [1, 2, 3], the...
glaive
[ 0.006233288440853357, 0.049311187118291855, -0.04444634169340134, -0.053453076630830765, 0.07516994327306747, -0.008698724210262299, -0.009288858622312546, 0.060340262949466705, 0.037830181419849396, -0.010060091502964497, 0.01920461840927601, 0.038189176470041275, -0.04893725365400314, -0...
0.806186
0.767281
0.038906
What is the solution to the 0-1 Knapsack problem using a dynamic programming approach?
glaive
[ -0.014142053201794624, 0.02563956193625927, -0.021230796352028847, -0.016771405935287476, 0.028675146400928497, -0.0016989362193271518, 0.0026463638059794903, 0.0503656305372715, 0.023235848173499107, -0.02753092721104622, 0.011686696670949459, 0.027359556406736374, -0.0276961512863636, -0...
0.801615
0.787081
0.014535
You are tasked with querying data from two different parquet files and combining the results into a single output. The first parquet file is named `union_01.parquet` and the second parquet file is named `union_02.parquet`. The goal is to select all columns (c1, c2, c3, c4, c5, c6, c7, c8, c9) from both files where the ...
glaive
[ 0.025451969355344772, 0.03605428710579872, -0.0413697212934494, -0.0170416422188282, 0.0072334641590714455, -0.01717475987970829, -0.0265838410705328, 0.04200037196278572, 0.044394366443157196, 0.00534844072535634, 0.04005173221230507, 0.029439102858304977, -0.013157729059457779, 0.0052287...
0.788324
0.770441
0.017883
You are tasked with implementing a subroutine that determines the values of matrix elements of a two-particle operator. The subroutine takes in several integer and double precision arguments and performs a series of calculations using various functions and subroutines. The problem is to write the implementation for the...
glaive
[ 0.030555175617337227, 0.025643324479460716, -0.03242308646440506, -0.03817185387015343, 0.04381571337580681, -0.0035463962703943253, -0.01674928516149521, 0.08773861080408096, 0.037176720798015594, 0.009615936316549778, 0.027443980798125267, 0.03404483199119568, -0.008476117625832558, 0.00...
0.795701
0.780431
0.015271
You are tasked with creating a stored procedure in a MySQL database that calculates the transactional distance between students and courses. The transactional distance is defined as the level of interaction and communication between students and instructors within a course. The stored procedure should take in the name ...
glaive
[ 0.02098594233393669, 0.01202480960637331, -0.03315429389476776, -0.04461609572172165, 0.0323297344148159, -0.03153572604060173, -0.060880403965711594, 0.05742655694484711, 0.03901120275259018, -0.002096293494105339, 0.03273383900523186, 0.04056404158473015, -0.02212631143629551, 0.00718160...
0.778636
0.759825
0.01881
Can you provide an algorithm to calculate the factorial of a given number?
glaive
[ 0.022997237741947174, 0.029426291584968567, -0.014827785082161427, -0.025093210861086845, 0.02721649408340454, -0.04647780582308769, -0.022873613983392715, 0.03451775759458542, 0.039377082139253616, -0.03260268643498421, 0.01977751962840557, 0.04173358529806137, -0.05258455127477646, -0.01...
0.79551
0.769872
0.025638
You are tasked with implementing a program that calculates the decimal expansion of the cube root of 25. The program should take as input the value 25 and output the decimal expansion of its cube root. The output should be a sequence of decimal digits.
glaive
[ 0.029117560014128685, 0.03330392763018608, -0.0400552824139595, -0.030277272686362267, 0.02281072735786438, -0.043506912887096405, 0.0033050181809812784, 0.06383905559778214, 0.03639969602227211, -0.025870980694890022, 0.035705532878637314, 0.009103821590542793, -0.056082651019096375, -0.0...
0.800269
0.770278
0.029991
You are tasked with implementing a program that processes a series of mathematical operations based on the given instructions. The operations include subtraction (sub), addition (add), multiplication (mul), and movement of data between registers (mov). The program will read a series of input values and perform the spec...
glaive
[ 0.04772533103823662, 0.01643766649067402, -0.03456979990005493, -0.029305212199687958, 0.04387018084526062, -0.026058342307806015, -0.02766481600701809, 0.06290062516927719, 0.06784921884536743, -0.005625595338642597, 0.015372972935438156, 0.03245481848716736, -0.026740333065390587, -0.023...
0.815184
0.782661
0.032523
I am working on a project that requires passing 2D arrays from Java to C++ using JNA. I have successfully managed to pass 1D arrays without any issues. However, I am facing problems when trying to pass a 2D array. I have included my Java and C++ code below. Can someone please help me understand what is causing the issu...
glaive
[ 0.0030591522809118032, 0.0427321158349514, -0.025799863040447235, -0.022592900320887566, 0.039552923291921616, -0.026968564838171005, -0.02605896070599556, 0.09725277870893478, 0.02602482959628105, -0.03614022955298424, 0.018760640174150467, 0.029684552922844887, -0.03650582209229469, -0.0...
0.785391
0.770601
0.01479
I need to create a program that implements a stack data structure with a maximum size of 1024. The program should have a method called "stackOfSize" that returns a stack of the specified size. The stack should have the ability to push and pop elements, as well as check if it is empty or full. Additionally, the program ...
glaive
[ 0.03325049206614494, 0.0236982312053442, -0.02400745451450348, -0.024331359192728996, 0.03305019065737724, -0.05759454518556595, -0.02355150133371353, 0.07842785120010376, 0.025264529511332512, -0.02751082181930542, 0.03522299975156784, 0.033808447420597076, -0.03476990386843681, -0.020676...
0.805496
0.790555
0.014941
You are tasked with creating a program to model the spread of infectious diseases using a specific mathematical model. Your program needs to take into account past incidences of the disease, as well as various parameters such as infectiousness, dispersion, and rate of spread. The program should also be able to make pre...
glaive
[ 0.020637160167098045, 0.016443096101284027, -0.034633345901966095, -0.026251697912812233, 0.0446789488196373, -0.027896463871002197, -0.04949991777539253, 0.06420537084341049, 0.026923494413495064, -0.03793435916304588, 0.015455590561032295, 0.05128154903650284, -0.022514769807457924, 0.00...
0.779231
0.759941
0.01929
You are tasked with creating a program to determine the winner of a poker game. In the card game poker, a hand consists of five cards and is ranked in various ways, such as high card, one pair, two pairs, three of a kind, straight, flush, full house, four of a kind, straight flush, and royal flush. If two players have ...
glaive
[ 0.02265692502260208, 0.034764066338539124, -0.050620853900909424, -0.02073752135038376, 0.022124355658888817, -0.02121841162443161, -0.023791702464222908, 0.06401828676462173, 0.0336306057870388, -0.019498640671372414, 0.014424393884837627, 0.045130059123039246, -0.03232024237513542, -0.01...
0.800224
0.757287
0.042937
I have a zero-indexed array A consisting of N integers. I need to find an equilibrium index of this array, which is any integer P such that 0 ≤ P < N and the sum of elements of lower indices is equal to the sum of elements of higher indices. Can you help me write a function to find any equilibrium index in the array? I...
glaive
[ 0.03983554244041443, 0.012500094249844551, -0.029081299901008606, -0.02591060660779476, 0.04400666430592537, -0.022135481238365173, -0.022734293714165688, 0.0922340527176857, 0.02981046587228775, -0.022901451215147972, 0.033579591661691666, 0.020575160160660744, -0.03198917582631111, -0.02...
0.827123
0.773272
0.053851
You are tasked with writing a SQL query to retrieve customer information and their corresponding total sales for two consecutive years. The query should retrieve the customer ID, first name, and last name of customers who made both store sales ('s') and web sales ('w') in the years 2001 and 2002. Additionally, the quer...
glaive
[ 0.01096755638718605, 0.016913535073399544, -0.05650823563337326, -0.039680372923612595, 0.025355953723192215, -0.01078448724001646, -0.05259174108505249, 0.02359059453010559, 0.05198723450303078, 0.027030160650610924, 0.05019818991422653, 0.02855478599667549, -0.03965688496828079, 0.010784...
0.762642
0.745671
0.016971
What is the code to create a 4x4 square matrix with a given number as the input?
glaive
[ 0.010780506767332554, 0.0260374303907156, -0.027184030041098595, -0.03874428942799568, 0.04843896999955177, -0.0219410452991724, -0.023790627717971802, 0.05197575315833092, 0.03811401128768921, -0.026007365435361862, 0.02193048782646656, 0.04354676231741905, -0.03071441687643528, -0.031775...
0.794438
0.77674
0.017697
You are tasked with implementing a function that evaluates arithmetic expressions in OCaml. The expressions can consist of numerals, addition, subtraction, multiplication, division, and negation. Your function should take in an expression and return the result of the evaluation. For example: Input: Plus(Numeral 5, Num...
glaive
[ 0.04433728754520416, 0.016778921708464622, -0.021971091628074646, -0.05863667279481888, 0.04608793929219246, -0.028298432007431984, -0.01931723766028881, 0.055855993181467056, 0.05940256267786026, -0.005739875603467226, 0.02168516255915165, 0.04851970076560974, -0.03966205567121506, -0.024...
0.808112
0.770536
0.037576
You are tasked with implementing a program to generate the values of the Newton-Gregory forward interpolating polynomial for a given set of input values. The values of the polynomial are defined by the formula (1/3)*(2*n - 3)*(2*n^2 - 3*n + 4), where n is the input value. You need to create a function or method that ta...
glaive
[ 0.03771170228719711, 0.029443254694342613, -0.02368430607020855, -0.05006638914346695, 0.026867136359214783, -0.05428594723343849, -0.003817965043708682, 0.05232856422662735, 0.036567892879247665, -0.015721028670668602, 0.03933260217308998, 0.05645269155502319, -0.047130730003118515, -0.01...
0.808185
0.77513
0.033055
Write a Prolog predicate to implement the functionality of finding the maximum and minimum elements in a given list. The predicate should take a list as input and return the maximum and minimum elements in separate variables.
glaive
[ 0.033071331679821014, 0.015643181279301643, -0.020077336579561234, -0.04289216548204422, 0.04762587696313858, -0.032162632793188095, -0.01853412389755249, 0.047019485384225845, 0.04009976238012314, -0.002675927011296153, 0.022322839125990868, 0.05959147959947586, -0.013017967343330383, 0.0...
0.799623
0.778859
0.020764
You are tasked with creating a macro in Assembly language that takes in two input parameters and calculates their sum based on the following rules: - If the first input parameter is greater than the second input parameter, add the first input parameter twice to the sum. - If the second input parameter is greater than t...
glaive
[ 0.02779226563870907, 0.009641013108193874, -0.030000003054738045, -0.01719544269144535, 0.04290620982646942, -0.012598467990756035, -0.016308799386024475, 0.07885198295116425, 0.03295066952705383, -0.005400142632424831, 0.025513697415590286, 0.036657944321632385, -0.038515836000442505, -0....
0.800759
0.780533
0.020225
You are given a graph represented by a list of vertices and their dependencies. Each vertex has a unique key and a payload of user data. The dependencies of each vertex are listed as a list of keys it depends on. Your task is to implement a function to construct a graph from the list of vertices and their dependencies,...
glaive
[ 0.03499941900372505, 0.03522685170173645, -0.0150859784334898, -0.026535702869296074, 0.029979970306158066, -0.02703486941754818, -0.00495103420689702, 0.04673090949654579, 0.036192212253808975, -0.01379523053765297, 0.01987590454518795, 0.03988540172576904, -0.008516522124409676, 0.001620...
0.824683
0.801518
0.023165
You are tasked with creating a text-based battle system game in the BASIC programming language. The game should include the following features: - Two soldiers approaching and engaging in battle - A menu loop with options to attack, cast magic, use items, or quit - Attack routine with physical and magical damage calcula...
glaive
[ 0.024245453998446465, 0.019054649397730827, -0.03247471898794174, -0.030546939000487328, 0.05146273970603943, -0.05597948655486107, 0.02229473367333412, 0.045502983033657074, 0.05950168892741203, -0.04100167751312256, 0.0360015407204628, 0.030890023335814476, -0.04205916449427605, -0.03118...
0.78336
0.768855
0.014506
You are tasked with implementing a module that manipulates coefficient representations of arithmetic expressions in Standard ML. The module should include functions for negating constant values and coefficients of variables in a binding, summing constant values and merging bindings by adding coefficients of any variabl...
glaive
[ 0.03927034139633179, 0.020168868824839592, -0.03904253616929054, -0.04412994906306267, 0.0370902344584465, -0.021550197154283524, -0.016465870663523674, 0.06368112564086914, 0.0483514741063118, -0.013345418497920036, -0.009899253025650978, 0.03158005699515343, -0.014418993145227432, -0.005...
0.815771
0.791512
0.024259
You are tasked with creating a program that implements an adder interface using the provided Adder_Types package. The program should include the following components: - Input_posit: This data structure should consist of the zero flag, infinity flag, sign of posit, scale, and fraction for two inputs. - Stage0: This data...
glaive
[ 0.03873360529541969, 0.026524340733885765, -0.018425878137350082, -0.027322279289364815, 0.0401456393301487, -0.02062121592462063, -0.009148798882961273, 0.07737193256616592, 0.04821192845702171, -0.005814284551888704, 0.017312686890363693, 0.024787116795778275, -0.014654853381216526, -0.0...
0.815153
0.795504
0.01965
You are tasked with implementing a CUDA kernel that performs a 3D finite-difference computation on a given input array. The kernel should take two input arrays `f1` and `f2`, each of size `nx * ny * nz`, and calculate the sum of neighboring elements for each element in the arrays. The computation should be repeated `IT...
glaive
[ 0.005144124384969473, 0.05687360838055611, -0.021895086392760277, -0.027319781482219696, 0.03558606654405594, -0.011217135936021805, -0.03560502827167511, 0.08280625194311142, 0.05065222457051277, -0.014627884142100811, 0.0429316908121109, 0.04688051715493202, -0.021706843748688698, 0.0013...
0.807224
0.78405
0.023173
You are tasked with creating a C++ template structure to calculate the logarithm base 2 of a given integer value at compile time. The structure should be able to handle any positive integer input and return the corresponding logarithmic value as a constexpr. You are not allowed to use any standard library functions for...
glaive
[ 0.028355322778224945, 0.029145434498786926, -0.045192472636699677, -0.027176689356565475, 0.035840943455696106, -0.03291218727827072, -0.022221699357032776, 0.09473946690559387, 0.0350547656416893, -0.039316657930612564, 0.036488138139247894, 0.03398913890123367, -0.029724763706326485, -0....
0.80347
0.780011
0.023459
You are tasked with creating a program that manipulates and processes a tree of expression nodes, represented by the following data structures: 1. TBoolLiteral: a boolean literal with a required boolean value. 2. TCaseExpr: a case expression with required boolean values indicating the presence of case and else express...
glaive
[ 0.02376466616988182, 0.026158954948186874, -0.042270202189683914, -0.027464743703603745, 0.051628824323415756, -0.04705304279923439, 0.0017792569706216455, 0.09289559721946716, 0.04568345472216606, -0.013248777948319912, 0.03655410185456276, 0.02259773388504982, -0.04279538616538048, -0.01...
0.809935
0.795601
0.014334
You are given a sequence u which is a function from natural numbers to real numbers (u : ℕ → ℝ). The definition of a limit of the sequence is as follows: A sequence u tends to a real number l if for every ε > 0, there exists a natural number N such that for every n greater than or equal to N, the absolute difference be...
glaive
[ 0.006194107700139284, 0.0241659265011549, 0.0016827068757265806, -0.015726441517472267, 0.0334579274058342, -0.006796936504542828, -0.016422178596258163, 0.0723496675491333, 0.02389804646372795, -0.01116867084056139, 0.007374059874564409, 0.03715698793530464, -0.022299304604530334, -0.0041...
0.821946
0.778374
0.043573
You are tasked with implementing a program to compute the eigenvalues of a small symmetric, tridiagonal matrix. The program should be able to handle matrices smaller than a specified maximum size and should determine the eigenvalues with a desired precision. The computation of eigenvalues should be based on the input d...
glaive
[ 0.015744822099804878, 0.04218956455588341, -0.02958001010119915, -0.0377594418823719, 0.03367925435304642, -0.008246125653386116, -0.011890336871147156, 0.07858084887266159, 0.04577348753809929, -0.024046165868639946, 0.02049071155488491, 0.044530440121889114, -0.02272181026637554, -0.0072...
0.799275
0.776151
0.023125
You are tasked with implementing a CUDA program to perform matrix multiplication. Given two input matrices A and B of size N x N, you need to write a CUDA kernel function to calculate the product of these two matrices and store the result in matrix C. Additionally, you need to compare the result obtained from the CUDA ...
glaive
[ 0.015724148601293564, 0.04927109554409981, -0.0212554968893528, -0.023703571408987045, 0.04281013831496239, 0.003313917899504304, -0.025841709226369858, 0.09819447994232178, 0.04278034344315529, -0.03144333139061928, 0.008498849347233772, 0.02727351151406765, -0.006682961247861385, -0.0129...
0.799567
0.78165
0.017917
You are tasked with creating a function that takes a string as input and returns the number of times the word "Polyglot" appears in the string. The function should be case-insensitive, meaning it should count occurrences of "Polyglot", "polyglot", "POLYGLOT", etc. as the same word. For example, if the input string is "...
glaive
[ 0.018144845962524414, 0.01607077568769455, -0.007802590262144804, -0.028600269928574562, 0.028110340237617493, -0.021857548505067825, -0.031463027000427246, 0.042619504034519196, 0.010067280381917953, -0.009205806069076061, -0.004720997530966997, 0.022788995876908302, -0.025052867829799652, ...
0.795424
0.758004
0.03742
You are tasked with writing a program to calculate the probability of a quantum state. The amplitude of the quantum state is given by the function amplitude(x, y), and the probability of the state is given by the function probability(x, y) which calculates the absolute square of the amplitude. Your task is to find th...
glaive
[ 0.002367328852415085, 0.03530502691864967, -0.03293066471815109, -0.02809642255306244, 0.041682593524456024, -0.02013872005045414, -0.024220163002610207, 0.07125182449817657, 0.030905960127711296, -0.0053512342274188995, 0.030566273257136345, 0.03492434695363045, -0.020444214344024658, -0....
0.805823
0.776983
0.02884
You are tasked with creating a formal version of the proposition that, for any natural number n, if n is even, then n + 1 is odd. You should fill in the hole in the following definition to complete the formal version of this proposition.
glaive
[ 0.020717985928058624, 0.010156581178307533, -0.013993554748594761, -0.05476349592208862, 0.03498093783855438, -0.026966486126184464, -0.015388425439596176, 0.06550384312868118, 0.03936716914176941, -0.005646025761961937, 0.016726436093449593, 0.007805811706930399, -0.054444532841444016, -0...
0.793984
0.767337
0.026648
You are given a dataset representing X, Y, TStamp, Pres., and EndPts. The DataSize is 662. Each row contains 5 values. Your task is to process this dataset and perform the following operations: 1. Calculate the average X and Y coordinates. 2. Determine the maximum and minimum values of TStamp. 3. Calculate the sum of a...
glaive
[ 0.011834251694381237, 0.011478658765554428, -0.05367152392864227, -0.03696093335747719, 0.039448194205760956, -0.05197563022375107, -0.029987167567014694, 0.057817135006189346, 0.046504225581884384, -0.0025814829859882593, 0.03258799389004707, 0.016680531203746796, -0.03383660316467285, -0...
0.810004
0.789592
0.020412
How can I create a new array where each element is twice its original value from a given array of numbers?
glaive
[ 0.019851503893733025, 0.019668715074658394, -0.031370654702186584, -0.025294210761785507, 0.023591767996549606, -0.04568656161427498, -0.010203709825873375, 0.06323079764842987, 0.03235330432653427, -0.04426635801792145, 0.012353437021374702, 0.019244886934757233, -0.0467834398150444, -0.0...
0.79712
0.782353
0.014767
How can I write a program to find the maximum and minimum numbers from a given array?
glaive
[ 0.0178222693502903, 0.01571962982416153, -0.03947688639163971, -0.028157781809568405, 0.03961680456995964, -0.0405014231801033, -0.03222047537565231, 0.040037401020526886, 0.028124608099460602, -0.03286843001842499, 0.029238274320960045, 0.046265214681625366, -0.04596871882677078, -0.01214...
0.802295
0.776113
0.026183
You are required to write a function that calculates the size of a given directory, including all its contents. The function should take the directory path as input and return the total size of the directory and its contents in bytes. The function should handle the following scenarios: 1. Calculate the size of an empt...
glaive
[ -0.026483118534088135, 0.029275309294462204, -0.023045167326927185, -0.040896929800510406, 0.031681355088949203, -0.02614792250096798, -0.038949813693761826, 0.03363386169075966, 0.04672137275338173, -0.0201061200350523, 0.034814633429050446, 0.02473393641412258, -0.034028321504592896, -0....
0.792198
0.777711
0.014486
You are tasked with implementing a subroutine in Fortran for calculating the line-absorption coefficients of Balmer lines according to the VCS-Theory. The subroutine should take in the following input parameters: divtn (integer), w (real), n (integer), kappa_lam (real), and resscale (real). The subroutine should calcul...
glaive
[ 0.006699159741401672, 0.021173134446144104, -0.023176316171884537, -0.046542659401893616, 0.032759834080934525, -0.02666630782186985, -0.005725878290832043, 0.0823567733168602, 0.04063674807548523, 0.01508400309830904, 0.024177609011530876, 0.051821090281009674, -0.026366040110588074, 0.00...
0.793575
0.772712
0.020863
You are tasked with implementing a program that calculates the definite integral of a given function over a specified interval. The function to be integrated is of the form: \[Integrate_{0}^{\pi} \frac{2\pi \cdot \sin(\theta)}{\sqrt{1 - v^2} \cdot (1 - v \cdot \cos(\theta))} d\theta You need to write a function that ...
glaive
[ 0.023014044389128685, 0.04295619949698448, -0.043352868407964706, -0.021027889102697372, 0.04091155156493187, -0.010446836240589619, -0.024860253557562828, 0.06941339373588562, 0.05734022334218025, 0.010605806484818459, 0.029012756422162056, 0.023852113634347916, -0.018682124093174934, -0....
0.803536
0.783095
0.020442
You are tasked with implementing a matrix multiplication operation using CUDA in C. The objective is to create a CUDA kernel that will perform the matrix multiplication of two input matrices A and B and store the result in matrix C. The matrices are of size n x n, and the kernel should be designed to handle each cell o...
glaive
[ 0.022761886939406395, 0.05483721196651459, -0.018551306799054146, -0.023662718012928963, 0.039390988647937775, -0.0034046852961182594, -0.03591262176632881, 0.11129817366600037, 0.0418931320309639, -0.030863171443343163, 0.010224247351288795, 0.029905155301094055, -0.02369220368564129, -0....
0.793843
0.768594
0.025249
Write a CUDA C program that utilizes the cuSolver and cuSparse libraries to solve a system of linear equations using the CSRQR method. The program should define a matrix A in CSR (Compressed Sparse Row) format, a batch of right-hand side vectors b, and should solve for the unknowns x in the equation Ax = b for multiple...
glaive
[ -0.000707903818693012, 0.042335789650678635, -0.04181179404258728, -0.0431867316365242, 0.037451185286045074, -0.004509845748543739, -0.013399120420217514, 0.09191381186246872, 0.04431271553039551, -0.024814914911985397, 0.01375457551330328, 0.03663007169961929, -0.010365927591919899, -0.0...
0.799001
0.78328
0.015722
You are tasked with creating a CUDA program to perform a square matrix transpose using GPU acceleration. The program should allocate space for host and device copies of the matrix, initialize the input values, and then use CUDA to transpose the matrix on the GPU. Finally, the program should copy the result back to the ...
glaive
[ 0.019257068634033203, 0.05232631415128708, -0.024787968024611473, -0.03053634986281395, 0.037575408816337585, 0.0001771582174114883, -0.023337455466389656, 0.09320690482854843, 0.04632406309247017, -0.023278243839740753, 0.02424268238246441, 0.025775650516152382, -0.016986703500151634, -0....
0.79257
0.777161
0.015409
You are tasked with creating a soundness proof for a given set of modal logic rules in a tableaux system. The goal is to prove that the rules are sound for specific classes of models, including reflexive, serial, symmetric, transitive, and euclidean models. Your task is to complete the proof for each rule, demonstrati...
glaive
[ 0.031351760029792786, 0.014337461441755295, -0.030028855428099632, -0.04165421053767204, 0.03338596969842911, -0.032843466848134995, -0.024735087528824806, 0.056111015379428864, 0.026334509253501892, -0.031353726983070374, 0.011116541922092438, 0.033022455871105194, -0.017238799482584, -0....
0.79401
0.775868
0.018142
I'm trying to create a C++ program that can find the largest number in a given list of integers. How can I achieve this?
glaive
[ 0.021721091121435165, 0.023393478244543076, -0.020354773849248886, -0.0325397327542305, 0.046498268842697144, -0.013015463948249817, -0.017074011266231537, 0.07348097115755081, 0.03732296824455261, -0.0347990021109581, 0.027401505038142204, 0.05526280030608177, -0.037945456802845, -0.00600...
0.790409
0.7759
0.014509
You are tasked with finding the answer to a specific cryptographic problem. Given a key "ckczppom" and a set of criteria for the hash of a given input, you need to find the smallest positive number (answer) that, when appended to the key, produces a hash that meets the specified criteria. The criteria for the hash is t...
glaive
[ 0.02815723791718483, 0.026417816057801247, -0.026340870186686516, -0.03228668123483658, 0.029004652053117752, -0.01580602303147316, -0.004613569006323814, 0.059913475066423416, 0.042278554290533066, -0.03164650499820709, 0.0238155759871006, 0.013484098017215729, -0.0297694094479084, -0.015...
0.826502
0.799771
0.026731
You are tasked with creating a C++ program that generates a multiplication table for a given range of numbers. The program should take two inputs from the user: the starting and ending numbers for the range. It should then display a multiplication table showing the products of all numbers within the given range. Your ...
glaive
[ 0.029272031038999557, 0.03607263043522835, -0.02610580064356327, -0.02136770635843277, 0.04874029755592346, -0.026551833376288414, -0.029905110597610474, 0.09599219262599945, 0.037160370498895645, -0.030120784416794777, -0.0037809726782143116, 0.04336529225111008, -0.030983053147792816, -0...
0.80665
0.770441
0.036209
I need to implement a function in Racket that takes a list of numbers as input and returns the sum of all the numbers in the list.
glaive
[ 0.02810410037636757, 0.024330470710992813, -0.03965655341744423, -0.0424785353243351, 0.06633252650499344, -0.018856052309274673, -0.009630778804421425, 0.03090614639222622, 0.0313529297709465, -0.027223609387874603, 0.011082323268055916, 0.06764928996562958, -0.03701948747038841, -0.01456...
0.796868
0.779363
0.017506
You are tasked with writing a Fortran program that manipulates bits in integer values. Your program should include the following functionalities: - Changing a specific bit in an integer value and displaying the updated bit pattern - Copying a bit from a value to itself and displaying the updated bit pattern - Changing ...
glaive
[ 0.026115775108337402, 0.039657365530729294, -0.020680367946624756, -0.02940836362540722, 0.03368094563484192, -0.04587307199835777, -0.01601731963455677, 0.0579490102827549, 0.04260598495602608, -0.025876350700855255, 0.030097300186753273, 0.03468121215701103, -0.03551236540079117, -0.0159...
0.802904
0.785022
0.017882
You are tasked with implementing a parallel version of the standard sequential fast Fourier transform algorithm. The algorithm should do O(n log n) work and have O(log n) depth. The code should include a general FFT that works with any commutative ring, taking as arguments the n roots of unity (an array w) and the +, *...
glaive
[ 0.019026927649974823, 0.04558952525258064, -0.03608681261539459, -0.029819069430232048, 0.03355777636170387, -0.001522834412753582, -0.02008979022502899, 0.05673623085021973, 0.03595944866538048, -0.02089633233845234, 0.017004678025841713, 0.026839520782232285, -0.021857760846614838, -0.02...
0.805819
0.778298
0.027521
You are tasked with implementing a function in Julia that calculates the number of Standard Tableau of the Young Diagram of a given Partition. The function should take in two parameters: 1. N (Int) - the size of the partition 2. P (Array{Int, 1}) - the partition itself You need to write a function called degree(N::Int...
glaive
[ 0.008024363778531551, 0.01214511413127184, -0.04489639028906822, -0.04958323761820793, 0.0287826769053936, -0.01977541483938694, -0.0312764048576355, 0.07677686959505081, 0.039389800280332565, -0.0018852634821087122, 0.031342513859272, 0.039419986307621, -0.01382504589855671, 0.01565305702...
0.813638
0.790484
0.023154
You are tasked with creating a program that reads a text file and counts the occurrences of each word in the file. The program should then display the word and its corresponding count in descending order of frequency. For example, given the following input in the text file: ``` The quick brown fox jumps over the lazy ...
glaive
[ 0.011817654594779015, 0.013689362443983555, -0.025371674448251724, -0.0292515829205513, 0.03136100992560387, -0.0238755214959383, -0.0321069173514843, 0.047546327114105225, 0.022437356412410736, -0.013824778608977795, 0.009232007898390293, 0.009695601649582386, -0.03187470883131027, -0.013...
0.804757
0.76786
0.036897
You are tasked with defining a new datatype in Agda called "Bin" to represent natural numbers using a binary system. The new datatype should consist of the following constructors: 1. `nil` - representing the end of the bitstring 2. `x0_` - representing appending a 0 to the bitstring 3. `x1_` - representing appending a...
glaive
[ 0.012027142569422722, 0.007192776072770357, -0.03438742086291313, -0.03655296936631203, 0.05064186826348305, -0.04355460777878761, -0.00776525167748332, 0.04458180069923401, 0.03788991644978523, -0.006659540813416243, 0.030447937548160553, 0.03499586135149002, -0.024596381932497025, -0.003...
0.808083
0.786287
0.021796
You are tasked with creating a program that takes a string as input and checks if the string is balanced. A balanced string is defined as a string that has an equal number of opening and closing quotes (either single or double quotes). For example, the string '"hello"' is balanced, while the string '"unbalanced' is not...
glaive
[ 0.02558073028922081, 0.013475118204951286, -0.01939818263053894, -0.029480408877134323, 0.060342852026224136, -0.035878147929906845, 0.02052972838282585, 0.06952593475580215, 0.03704698011279106, -0.02905167080461979, 0.01712692342698574, 0.04513395205140114, -0.04109145700931549, -0.03047...
0.793566
0.777508
0.016058
How can I create a Java program that finds the smallest and largest number in an array of numbers?
glaive
[ 0.004660541657358408, 0.029384136199951172, -0.042718857526779175, -0.03885708749294281, 0.040947314351797104, -0.02377195656299591, -0.015501621179282665, 0.033612508326768875, 0.025452177971601486, -0.04271882027387619, 0.030816147103905678, 0.03648565337061882, -0.044510457664728165, -0...
0.79761
0.772912
0.024698
You are required to create a SAS macro that can generate components of the ORDER option in an AXIS statement for linear-scale axes. The macro should take in the following arguments: - Data: Input dataset (required) - Var: Space-separated list of variables on which to base axis range (required) - Val: Space-separated li...
glaive
[ 0.015748413279652596, 0.02238769829273224, -0.04278666526079178, -0.047591984272003174, 0.031076580286026, -0.03488172963261604, -0.026931846514344215, 0.05653367564082146, 0.03397836908698082, 0.011074264533817768, 0.026439392939209938, 0.029063018038868904, -0.02785218507051468, 0.008295...
0.791811
0.776054
0.015757
You are tasked with implementing a function that converts a given mathematical expression into a string representation. The mathematical expression is represented using a custom data type called "expr", which can consist of variables (VarX, VarY), sine, cosine, average, times, threshold, and a custom "Hoi" operation. T...
glaive
[ 0.023394929245114326, 0.012915710918605328, -0.01695541851222515, -0.06195937842130661, 0.047933969646692276, -0.05177092179656029, -0.021839944645762444, 0.0695895105600357, 0.06950902193784714, -0.02027764730155468, 0.037029068917036057, 0.039201121777296066, -0.03629375621676445, -0.009...
0.790371
0.775
0.015371
You are tasked with creating a program to calculate the probability distribution and visualize the results for a quantum system with a given number of qubits and states. The program should use the provided amplitude and probability functions to find the maximum probability and plot the 3D and contour graphs for visuali...
glaive
[ 0.006871153134852648, 0.026032788679003716, -0.04165322333574295, -0.022642580792307854, 0.04544273391366005, -0.031956031918525696, -0.03114536590874195, 0.06486435234546661, 0.04186207056045532, -0.0045328098349273205, 0.026567978784441948, 0.04264313727617264, -0.00940500758588314, -0.0...
0.801186
0.777462
0.023724
You are tasked with implementing a CUDA kernel function that performs element-wise multiplication of two arrays and stores the result in an output array. The input arrays and output array are all of type T, and the arrays have a size of arr_size. You need to write the CUDA kernel function to accomplish this task.
glaive
[ 0.01676439493894577, 0.06695724278688431, -0.028628114610910416, -0.017263265326619148, 0.04225973039865494, -0.005326211918145418, -0.040179964154958725, 0.09571444243192673, 0.04957899451255798, -0.02183561585843563, 0.028683213517069817, 0.03504025191068649, -0.007976758293807507, -0.01...
0.803524
0.779035
0.024488
You are tasked with implementing a data structure to represent a pair of values and providing various operations on this pair. The structure should include functions to swap the values in the pair, swizzle the values with another pair, access the first and second value of the pair, apply functions to the values, map fu...
glaive
[ 0.02124685049057007, 0.016384463757276535, -0.038012586534023285, -0.009294231422245502, 0.04320491477847099, -0.01283255685120821, -0.024355078116059303, 0.0715218186378479, 0.04447639361023903, -0.021357232704758644, 0.032452285289764404, 0.0398922935128212, -0.028469454497098923, -0.024...
0.816049
0.789305
0.026744
I need to write a function in Erlang that takes an integer N as input and calculates the sum of all the numbers from 1 to N that are multiples of either 3 or 5. For example, if N is 10, the function should return the sum of 3, 5, 6, and 9, which is 23. Write a function sum_mul(N) that takes an integer N and returns th...
glaive
[ 0.014139564707875252, 0.017431195825338364, -0.015004552900791168, -0.038045983761548996, 0.05516444146633148, -0.02195434458553791, -0.03689924255013466, 0.03629298508167267, 0.014419516548514366, -0.0017070044996216893, 0.02708609588444233, 0.055936504155397415, -0.04104971885681152, -0....
0.815966
0.789225
0.026741
You are required to implement a C++ program that utilizes the LOBPCG EigenSolver to solve a generalized eigenvalue problem. The problem involves computing the largest eigenvalue and the corresponding eigenvector of a given matrix A, using the LOBPCG algorithm. The algorithm involves the following steps: 1. Initialize a...
glaive
[ 0.014710589312016964, 0.020803652703762054, -0.022775838151574135, -0.04792077839374542, 0.021347956731915474, -0.010534093715250492, -0.018337387591600418, 0.0957617536187172, 0.03500574082136154, -0.020394597202539444, 0.016655178740620613, 0.03914067894220352, -0.03937268257141113, 0.00...
0.807114
0.779072
0.028042
You are tasked with creating a program that calculates the probability of a quantum state. The program should include a function that takes two input variables, x and y, and returns the probability of a quantum state based on the given amplitude function. Additionally, you need to implement a function that uses the NMa...
glaive
[ -0.005950357299298048, 0.03417246416211128, -0.03344177082180977, -0.01782994531095028, 0.049662034958601, -0.008603776805102825, -0.01240540761500597, 0.07986538112163544, 0.03775041550397873, 0.00017963482241611928, 0.025671321898698807, 0.037025485187768936, -0.01203472912311554, -0.012...
0.791377
0.766255
0.025122
You are tasked with implementing a CUDA kernel function to perform arithmetic operations on two arrays of floating-point numbers. Specifically, you need to create kernel functions for addition, subtraction, multiplication, and division of two arrays of floating-point numbers. The arrays are of size 6 and contain the fo...
glaive
[ 0.016417818143963814, 0.06174701824784279, -0.010777649469673634, -0.029378561303019524, 0.04812640696763992, -0.015010262839496136, -0.02987145446240902, 0.09000936150550842, 0.041008032858371735, -0.017045600339770317, 0.022433502599596977, 0.030739471316337585, -0.004918290767818689, -0...
0.797587
0.77114
0.026448
You are tasked with creating a function that takes in a logical expression in the form of "p/\q==>r" and returns the equivalent expression "p==>q==>r". The input expression will consist of logical variables (p, q, r) combined with the logical operators /\ (conjunction) and ==> (implication). Your function should be abl...
glaive
[ 0.020857421681284904, 0.027627740055322647, -0.04167952015995979, -0.015420064330101013, 0.029484322294592857, -0.016524014994502068, -0.010403107851743698, 0.07304001599550247, 0.053396787494421005, -0.024554597213864326, 0.008768372237682343, 0.03279385715723038, -0.026010768488049507, -...
0.806766
0.785725
0.021041
You are tasked with implementing a CUDA program to reverse an array using static shared memory. Write a CUDA kernel function called staticReverse that takes in an integer array d and its length n as arguments. Inside the kernel function, you should declare a shared memory array s with a size of 64 integers. Each thre...
glaive
[ 0.013752767816185951, 0.06179467961192131, -0.01370995957404375, -0.025411047041416168, 0.03282029554247856, -0.016979562118649483, -0.023025423288345337, 0.10090885311365128, 0.04668624326586723, -0.011142315343022346, 0.01692219264805317, 0.031415242701768875, -0.013096769340336323, -0.0...
0.80313
0.779277
0.023853
You are tasked with creating a Python program that reads a text file and counts the frequency of each word in the file. You need to ignore case sensitivity and punctuation, and only count alphanumeric characters. The program should then print out the top 5 most frequent words and their respective counts.
glaive
[ -0.00017831838340498507, 0.013256896287202835, -0.021749071776866913, -0.029353300109505653, 0.030710626393556595, -0.02889283373951912, -0.02990918792784214, 0.03683049976825714, 0.01828267239034176, -0.012744634412229061, 0.012813659384846687, 0.008024794049561024, -0.016187112778425217, ...
0.787919
0.770782
0.017137
I need to create a CUDA-based function that performs the maximum reduction operation on an input array. The function should take the maximum value along specified axes of the input array and return the result. Additionally, it should also be able to return the indices of the maximum values if required. Create a CUDA f...
glaive
[ 0.003207175061106682, 0.04536068066954613, -0.0392778255045414, -0.0077770771458745, 0.038103312253952026, -0.010911999270319939, -0.027952484786510468, 0.08972901850938797, 0.05677513778209686, 0.0010516095208004117, 0.0149076534435153, 0.02558010444045067, 0.0016352738020941615, -0.00275...
0.803156
0.787288
0.015868
You are tasked with implementing a CUDA kernel for matrix multiplication using the given parameters and constraints. The goal is to optimize the matrix multiplication process by leveraging the parallel processing capabilities of CUDA. The matrices A, B, and C are represented as float4 arrays, and their dimensions are ...
glaive
[ 0.023269597440958023, 0.05404215678572655, -0.013783451169729233, -0.02802545391023159, 0.04028276354074478, -0.011392115615308285, -0.037700310349464417, 0.09038291871547699, 0.03328825905919075, -0.02290898747742176, 0.0038712345995008945, 0.02611605077981949, -0.009020722471177578, 0.00...
0.792452
0.772786
0.019666
You are tasked with creating a programming solution to implement a power prior model with a Poisson likelihood and a gamma prior. The model should also include an approximation function for the conditional mean of a Poisson distribution. The model should be implemented using the Stan probabilistic programming language....
glaive
[ 0.000774229527451098, 0.016605906188488007, -0.02669590711593628, -0.06337013095617294, 0.03811706602573395, -0.040374647825956345, -0.020803231745958328, 0.0667143315076828, 0.03628711402416229, -0.018572963774204254, 0.0128615228459239, 0.04272998496890068, -0.01746896654367447, -0.01028...
0.803147
0.786401
0.016747
You are tasked with implementing a function that calculates Euler's totient function for a given input. Euler's totient function, also known as Euler's phi function, is a mathematical function that counts the number of positive integers up to a given integer that are relatively prime to it. The function should take a s...
glaive
[ 0.022773388773202896, 0.023317674174904823, -0.018199509009718895, -0.03336411714553833, 0.04423364996910095, -0.010964766144752502, -0.021348610520362854, 0.10045035928487778, 0.03849414736032486, 0.0130613436922431, 0.0067761423997581005, 0.05321647226810455, -0.012786420993506908, -0.01...
0.813872
0.772819
0.041053
You are tasked with implementing a function to compute the count of paths in a graph. The function takes in a work context, the current execution level, and various other data structures. The function then gathers data, computes the path count, and performs various operations using functors and GPU utilities. Your task...
glaive
[ 0.014593495987355709, 0.019048340618610382, -0.025875689461827278, -0.009179861284792423, 0.044852256774902344, -0.002510461723431945, -0.02694343589246273, 0.07955646514892578, 0.044112678617239, -0.00373807898722589, 0.018622105941176414, 0.041820548474788666, 0.003170800395309925, -0.00...
0.803553
0.787422
0.01613
You are tasked with implementing a function to calculate the hypotenuse of a right-angled triangle given the lengths of its two perpendicular sides. The function should handle special cases, such as when one or both of the input values are infinity or NaN. The function should be able to handle both 32-bit and 64-bit fl...
glaive
[ -0.002785733202472329, 0.03574947267770767, -0.031353287398815155, -0.016938500106334686, 0.031372178345918655, 0.0003787027089856565, -0.022310638800263405, 0.06742025166749954, 0.04395442456007004, -0.004692794289439917, 0.02972729131579399, 0.03965551778674126, -0.009560820646584034, -0...
0.797392
0.774451
0.022941
You have been tasked with creating a program that uses the Plot library in Racket to generate a scatter plot of a set of data points. The program should take in a list of x-coordinates and y-coordinates and plot them on a 2D graph, with the x-coordinates on the horizontal axis and the y-coordinates on the vertical axis...
glaive
[ 0.005407191347330809, 0.0361342579126358, -0.022658027708530426, -0.05301008000969887, 0.04645119979977608, -0.0442894771695137, -0.03465000540018082, 0.05388861149549484, 0.06425023823976517, -0.022814564406871796, 0.01264188066124916, 0.061538636684417725, -0.023679982870817184, 0.013971...
0.783904
0.768668
0.015236
You are required to implement a function that calculates the Adler-32 checksum for a given input string. The Adler-32 checksum is a checksum algorithm which was invented by Mark Adler and is a part of the widely used zlib compression library. The algorithm is used to detect errors in data transmission and is commonly u...
glaive
[ -0.006328726653009653, 0.029502954334020615, -0.006477589253336191, -0.04100887104868889, 0.042093779891729355, -0.01616135612130165, -0.020295584574341774, 0.07611535489559174, 0.04437403380870819, -0.015807518735527992, 0.024095948785543442, 0.012267518788576126, -0.028249841183423996, -...
0.808183
0.787989
0.020194
Write a function in Scheme that takes an integer as input and returns #t if the integer has all different digits, and #f otherwise. For example, if the input is 1234, the function should return #t, but if the input is 1224, the function should return #f.
glaive
[ 0.046741098165512085, 0.023921187967061996, -0.03867389261722565, -0.030972691252827644, 0.052624791860580444, -0.054677702486515045, -0.025924894958734512, 0.05230523273348808, 0.01762491837143898, 0.005952548235654831, 0.026182005181908607, 0.03801914304494858, -0.024346226826310158, -0....
0.812371
0.79784
0.014531
You are tasked with implementing a program to compute the histogram of an array of unsigned characters using both CPU and GPU. The CPU and GPU implementations are already provided, but you need to complete the code by implementing the kernel function `hist_kernel` for the GPU histogram computation. The `cpu_hist` func...
glaive
[ 0.0036973280366510153, 0.038495905697345734, -0.0092155197635293, -0.020330699160695076, 0.03673062473535538, -0.004735233262181282, -0.04201311990618706, 0.09121610969305038, 0.04390762746334076, -0.02327042631804943, 0.025669872760772705, 0.030801456421613693, 0.0133872264996171, 0.00594...
0.806126
0.782464
0.023662
You are tasked with implementing a function that will apply Jensen's inequality for integrals. Given a convex function `g : E → ℝ` that is continuous on a convex closed set `s`, a measure `μ` on `α`, and a function `f : α → E` such that `f` maps `μ`-almost everywhere points to `s`, you need to write a function that che...
glaive
[ 0.009191077202558517, 0.036645010113716125, -0.041987232863903046, -0.019205324351787567, 0.03317373991012573, 0.00016106077237054706, -0.016162067651748657, 0.07017434388399124, 0.02822955511510372, -0.012363668531179428, 0.020137468352913857, 0.039479609578847885, -0.018641455098986626, ...
0.813303
0.779655
0.033647
You are tasked with creating a function that can match the number of points in two given polygons. The function should take in two vectors of points, `poly_1` and `poly_2`, that define the first and second polygons, respectively. The goal is to add points to the polygon with fewer points until both polygons have the sa...
glaive
[ 0.015749191865324974, 0.005952330771833658, -0.028427764773368835, -0.05782720074057579, 0.04034670442342758, 0.00040557305328547955, 0.0033304274547845125, 0.07255156338214874, 0.045116230845451355, -0.009171077981591225, -0.011586497537791729, 0.0387783907353878, -0.007692007347941399, 0...
0.812396
0.779962
0.032435
How can I create an algorithm to find the maximum sum path in a given matrix?
glaive
[ 0.010794333182275295, 0.009904141537845135, -0.026749562472105026, -0.04254564270377159, 0.039788875728845596, -0.02716950513422489, -0.030119402334094048, 0.04056493937969208, 0.01819155551493168, -0.032413169741630554, 0.02017241157591343, 0.028066018596291542, -0.01728549785912037, -0.0...
0.793906
0.765826
0.02808
You are tasked with creating a program that scans two numbers from STDIN and prints their sum to STDOUT. You should use the OCaml language to write the solution. The program should include scanning the two integers, calling a function, returning a value, and printing it to STDOUT.
glaive
[ 0.011383512988686562, 0.023967640474438667, -0.027246670797467232, -0.057589758187532425, 0.04517931863665581, -0.006347656715661287, -0.033260054886341095, 0.04352736473083496, 0.06281685084104538, -0.012588045559823513, 0.03142600134015083, 0.043539050966501236, -0.020630551502108574, -0...
0.813436
0.796845
0.01659
You are tasked with implementing a set of rules for manipulating binary values in a programming language. The rules involve bitwise operations and must adhere to specific conditions. Your task is to write the code to implement the following rules: 1. `bit-of-bit-of-when-0`: A rule that returns a bit value based on a sp...
glaive
[ 0.011876819655299187, 0.009938814677298069, -0.020287321880459785, -0.011521860957145691, 0.03308407962322235, -0.03873088210821152, -0.010193771682679653, 0.05650223419070244, 0.034405067563056946, -0.02337580733001232, 0.019028548151254654, 0.03209996968507767, -0.03554300218820572, -0.0...
0.818249
0.797596
0.020653
You are required to write a program to calculate the maximum probability of a quantum system with 15 qubits and 4 states. The probability is determined by the amplitude of the quantum state, which is computed using the given complex functions `amplitude` and `amplitude2`. The program should use the `NMaximize` function...
glaive
[ 0.012474729679524899, 0.0263624619692564, -0.03010891005396843, -0.023878008127212524, 0.05347994714975357, -0.02913474477827549, -0.03138233721256256, 0.06976255029439926, 0.03302253037691116, 0.00026483123656362295, 0.029628129675984383, 0.03334735333919525, -0.009591156616806984, -0.022...
0.810316
0.78023
0.030086
You are tasked with implementing a subroutine in Fortran that calculates the force components acting on a particle. The subroutine takes in various input parameters and uses them to calculate the force components. The subroutine should iterate over a 3D grid and calculate the force components for each particle that mat...
glaive
[ 0.02925935387611389, 0.04250255599617958, -0.019286131486296654, -0.05083760991692543, 0.04538309574127197, -0.027092913165688515, -0.0030730380676686764, 0.06051398068666458, 0.045270584523677826, 0.008458179421722889, 0.012710914947092533, 0.056062787771224976, -0.035336147993803024, -0....
0.79293
0.77684
0.01609
You are working with a dataset that contains five columns: X, Y, TStamp, Pres., and EndPts. The DataSize of the dataset is 172. You need to write a program that processes this dataset and performs the following tasks: 1. Calculate the average of the X column 2. Determine the maximum value in the Y column 3. Find the ra...
glaive
[ 0.006072510499507189, 0.008684473112225533, -0.05124763026833534, -0.049476027488708496, 0.038342200219631195, -0.046019747853279114, -0.027439141646027565, 0.07313604652881622, 0.04882628470659256, -0.0193020086735487, 0.03322819620370865, 0.03457721695303917, -0.029851093888282776, 0.005...
0.814102
0.793723
0.020379
You are tasked with implementing a function that performs data analysis on a given dataset. The function should calculate the minimum, maximum, sum, and count of the values in the dataset. Additionally, it should provide the domain and limits of the dataset based on a specified mode and number of intervals. Your task ...
glaive
[ 0.00454563507810235, 0.01639852672815323, -0.046259958297014236, -0.034856829792261124, 0.027297774329781532, -0.02198885940015316, -0.007436986546963453, 0.05462053790688515, 0.039465613663196564, 0.004478003364056349, 0.025399422273039818, 0.038803961127996445, -0.016578204929828644, -0....
0.801454
0.776896
0.024558
You are tasked with writing a Fortran subroutine to interpolate scalar fields for budget data from any input grid to any output grid. The algorithm will compute weighted averages of neighbor points arranged in a square box centered around each output grid point and stretching nearly halfway to each of the neighboring g...
glaive
[ -0.006710526533424854, 0.043262094259262085, -0.014678523875772953, -0.041339341551065445, 0.03613286837935448, -0.026627251878380775, -0.002626727567985654, 0.052964065223932266, 0.03680913522839546, -0.0169605053961277, 0.028423907235264778, 0.04326878860592842, -0.037612803280353546, -0...
0.800099
0.778659
0.021441
You are tasked with implementing a map function for a specific type of sigma (Σ) data structure. The sigma data structure consists of a pair (a, b), where 'a' is of type α and 'b' is of type β a. Your task is to create a function that takes two functions as arguments: 'f₁' which maps 'a' from type α₁ to type α₂, and 'f...
glaive
[ 0.011466755531728268, 0.02346501313149929, -0.04381226375699043, -0.02715831808745861, 0.04366602376103401, -0.022322291508316994, -0.01148976944386959, 0.0787271186709404, 0.028657829388976097, -0.011866969056427479, 0.02730814926326275, 0.0388246513903141, -0.026751535013318062, -0.01218...
0.802837
0.778451
0.024386
You need to create a Julia program that implements a Binomial distribution to characterize the number of successes in a sequence of independent trials. The program should have the following functionalities: - Define a struct `Binomial` that takes in the parameters `n` (number of trials) and `p` (probability of success ...
glaive
[ -0.0239411573857069, 0.012617312371730804, -0.048784289509058, -0.04009430482983589, 0.028736671432852745, -0.011243700981140137, -0.03298549726605415, 0.07581177353858948, 0.04521487280726433, -0.007490926887840033, 0.023810990154743195, 0.04002698138356209, -0.007642065640538931, 0.01743...
0.803765
0.780079
0.023687
What is the output of the following code? ```python def leap_year(year): if year % 4 == 0 and year % 100 != 0: print("Leap year") elif year % 100 == 0: print("Not a Leap Year") elif year % 400 == 0: print("Leap year") else: print("Not a Leap Year") year = 2020...
glaive
[ -0.005540831480175257, 0.022395862266421318, -0.025202352553606033, -0.029660599306225777, 0.027969516813755035, -0.04141993075609207, -0.0365167073905468, 0.06615742295980453, 0.03692297637462616, -0.007631252519786358, 0.02427467331290245, 0.027097001671791077, -0.024935636669397354, -0....
0.806729
0.792368
0.014361
You are tasked with creating a function in JavaScript that takes in an array of numbers and returns the sum of all the positive numbers in the array. If the array is empty or does not contain any positive numbers, the function should return 0.
glaive
[ 0.0026031897868961096, 0.01720467582345009, -0.038225505501031876, -0.030270949006080627, 0.04666530340909958, -0.01367703452706337, -0.01869574747979641, 0.039547309279441833, 0.036080051213502884, -0.0038031782023608685, 0.016534650698304176, 0.01924116723239422, -0.04758065938949585, -0...
0.811211
0.775551
0.035659
You are tasked with implementing a function to decode an image compressed with the BC1 (DXT1) algorithm. The input data is an uncompressed R8-G8-B8 image, and the output data should be compressed "blocks," where each block is 8-bytes long and stores information for a 4x4 pixel area in the original image. The algorithm ...
glaive
[ 0.00014935850049369037, 0.029682239517569542, -0.009635615162551403, -0.04284251481294632, 0.028453879058361053, -0.03921179845929146, -0.020836232230067253, 0.08028940111398697, 0.05779234692454338, -0.013911937363445759, 0.016832752153277397, 0.015560263767838478, -0.030116625130176544, ...
0.804109
0.787575
0.016534