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 function in a programming language that takes in an array of natural numbers, an index i, and a value v. The function should update the value at index i in the array by adding v to it. Additionally, the function should have a proof that the index i is less than the size of the array. ...
glaive
[ 0.007685326039791107, 0.05300646647810936, -0.0039027498569339514, -0.03650619834661484, 0.052919384092092514, -0.027886951342225075, -0.0162466112524271, 0.06806723773479462, 0.03871816396713257, -0.018467551097273827, 0.02602149173617363, 0.021381428465247154, -0.04216863587498665, -0.00...
0.808952
0.781161
0.027791
You are tasked with implementing a function that creates a sparse ndarray of complex numbers. The function should take in the shape of the ndarray and return a sparse ndarray filled with complex zeros. Write a function called `create_sparse_complex_zeros` that takes in a tuple representing the shape of the sparse ndar...
glaive
[ 0.015616485849022865, 0.057268332690000534, -0.0187874436378479, -0.03503698110580444, 0.036777615547180176, -0.008049196563661098, -0.011553552001714706, 0.03919165953993797, 0.03081478923559189, -0.008247600868344307, 0.02380722388625145, 0.02626633830368519, -0.029678139835596085, -0.00...
0.796815
0.768136
0.02868
You are tasked with implementing a set of determinant kernels in C++ using the AFQMC (Auxiliary-field quantum Monte Carlo) library. The library contains a namespace called "kernels" which provides functions for computing determinants using different algorithms. Your task is to implement the following functions within t...
glaive
[ 0.02390439435839653, 0.041800085455179214, -0.02038632147014141, -0.043546490371227264, 0.035152632743120193, -0.017096921801567078, -0.026879653334617615, 0.09043052047491074, 0.034025996923446655, -0.014291925355792046, 0.01428277138620615, 0.04356358200311661, -0.04248373955488205, -0.0...
0.804818
0.787812
0.017006
You are tasked with creating a program that takes two numbers as input and returns their sum. Additionally, the program should include the capability to output the result in different formats and provide alternative outputs for the same input. Create a function or method that fulfills these requirements.
glaive
[ 0.01790117658674717, 0.017068440094590187, -0.04528271406888962, -0.02353491075336933, 0.042968638241291046, -0.003064829623326659, -0.024203117936849594, 0.07281111925840378, 0.04934263974428177, -0.009967410936951637, 0.023153675720095634, 0.062034908682107925, -0.026028607040643692, -0....
0.807798
0.789462
0.018336
You are tasked with implementing a function to add two floating-point numbers of different sizes. The function should work for 32-bit, 64-bit, 80-bit, and 128-bit floating-point numbers. Your function should handle denormalized numbers, infinities, and NaNs correctly, and the result should be rounded according to the ...
glaive
[ -0.00483158603310585, 0.03224107623100281, -0.02568655274808407, -0.03271152451634407, 0.055859990417957306, -0.0009063047473318875, -0.008523342199623585, 0.06833621859550476, 0.03707212209701538, -0.005193553399294615, 0.0308957751840353, 0.047075528651475906, -0.029751824215054512, -0.0...
0.802065
0.783359
0.018706
You are tasked with creating a program that calculates the number of non-zero digits in the base-3 representation of a given number n. You should define a function or method that takes an integer n as input and returns the count of non-zero digits in its base-3 representation. For example, for n=10, the base-3 represe...
glaive
[ 0.017824314534664154, 0.012705499306321144, -0.04846497252583504, -0.0269060917198658, 0.043305061757564545, -0.011083152145147324, -0.007917906157672405, 0.04838044196367264, 0.023216845467686653, -0.0031005472410470247, 0.0276928823441267, 0.04688110947608948, -0.05457715690135956, -0.03...
0.821232
0.778959
0.042273
You are tasked with implementing a function called `pow_pow` in the `mynat` namespace. The function should take three natural numbers `a`, `m`, and `n` as input and return the value of `(a ^ m) ^ n`. The goal is to prove that for all naturals `a`, `m`, `n`, we have $(a ^ m) ^ n = a ^ {mn}$.
glaive
[ 0.05938231199979782, 0.02724853716790676, -0.02626626566052437, -0.04098789021372795, 0.014261625707149506, -0.03672473877668381, 0.0025341552682220936, 0.06885986775159836, 0.03395940363407135, -0.005880966782569885, 0.012952727265655994, 0.031007930636405945, -0.05378662049770355, -0.048...
0.826081
0.797311
0.02877
You are given a text file "day03" which contains a map of trees represented by '#' and open spaces represented by '.'. Each line in the file represents a row in the map. You need to write a function that reads the input file and parses it into a matrix of boolean values, where true represents a tree and false represen...
glaive
[ -0.0018279401119798422, 0.020693829283118248, -0.04193257540464401, -0.04627195745706558, 0.04912298172712326, -0.04024481028318405, -0.004874105099588633, 0.07176854461431503, 0.0215455275028944, -0.017093384638428688, 0.006164802238345146, 0.012536793015897274, -0.021709615364670753, -0....
0.826394
0.788551
0.037842
You are tasked with implementing a function in the language MPL that calculates the value of the variable "mbeta" based on the input parameters "rs" and "t". The function should use the following expression: mbeta := (rs, t) -> beta_a*(1 + beta_b*rs)/(1 + beta_c*rs) Where: - beta_a = 0.066724550603149220 - beta_b = 0....
glaive
[ 0.02417876571416855, 0.04006233066320419, -0.04885736480355263, -0.04465145245194435, 0.057883258908987045, -0.04629645124077797, -0.022602779790759087, 0.04422974959015846, 0.038962412625551224, -0.01972564309835434, 0.0028288732282817364, 0.047199420630931854, -0.04530763998627663, 0.001...
0.793172
0.774026
0.019147
You are tasked with creating a program that calculates the sum of the numbers in the n-th row of a specific array. The array is defined by the sequence A248664. Your program should be able to take an input n and output the sum of the numbers in the n-th row of the array.
glaive
[ 0.019334595650434494, 0.025162633508443832, -0.030741482973098755, -0.026763271540403366, 0.04084668681025505, -0.02674155682325363, -0.025684000924229622, 0.061486437916755676, 0.04386509209871292, -0.021549129858613014, 0.014911076985299587, 0.024431137368083, -0.04624538868665695, -0.01...
0.824589
0.776322
0.048268
You are tasked with creating a program that calculates the area of a circle. Your program should prompt the user to enter the radius of the circle and then calculate and display the area. The value of pi should be set to 3.14159 for the calculation.
glaive
[ -0.005003984551876783, 0.04386073350906372, -0.043802909553050995, -0.034139249473810196, 0.047369860112667084, -0.01780708320438862, -0.030363334342837334, 0.030912447720766068, 0.04328020662069321, -0.006700495723634958, 0.02972761169075966, 0.03826415538787842, -0.02523738332092762, -0....
0.782345
0.762038
0.020307
Is there a way to reduce a large number of points in a dataset to a fixed number using an algorithm?
glaive
[ 0.008921532891690731, 0.01591045968234539, -0.031587470322847366, -0.033242665231227875, 0.0358300507068634, -0.045696306973695755, -0.021394219249486923, 0.03545568510890007, 0.04596717655658722, -0.022991521283984184, 0.010850613936781883, 0.028039075434207916, -0.030596919357776642, -0....
0.795405
0.774263
0.021141
You are tasked with implementing a set of functions for a circuit simulation in a programming language that supports datatype definitions and pattern matching. Specifically, you need to define the following functions: 1. ex1: Update the state by adding the values of a3 and b3 and storing the result in r3. 2. ex2: Updat...
glaive
[ 0.017576543614268303, 0.02734900265932083, -0.030179809778928757, -0.0481390580534935, 0.05420059710741043, -0.0452650785446167, -0.012675213627517223, 0.07981914281845093, 0.03425968065857887, -0.015370629727840424, 0.02002609893679619, 0.04597178101539612, -0.01660524494946003, -0.006711...
0.822335
0.805034
0.0173
You are tasked with implementing a program that calculates the maximum probability of a quantum state given a certain set of parameters. The program should use the given functions `amplitude`, `amplitude2`, and `probability` to calculate the maximum probability using the `NMaximize` function. Additionally, the program ...
glaive
[ 0.005788215436041355, 0.03615256026387215, -0.028403544798493385, -0.021267075091600418, 0.042590826749801636, -0.016875343397259712, -0.01909092254936695, 0.0703200176358223, 0.0339910052716732, 0.005732892546802759, 0.030779216438531876, 0.03754681348800659, -0.010577228851616383, -0.005...
0.79917
0.773746
0.025424
You are tasked with writing a Python function that takes a list as input and returns the tail of the list as output. The tail of the list is everything in the list except for the first element. Write a function called `get_tail` that takes a list `input_list` as input and returns a new list containing the tail of the ...
glaive
[ 0.021440576761960983, 0.033059053122997284, -0.012790614739060402, -0.054279033094644547, 0.04447690024971962, -0.027822181582450867, -0.04177148640155792, 0.044365473091602325, 0.006061018910259008, -0.008661236613988876, 0.030988823622465134, 0.04409380257129669, -0.03127819299697876, 0....
0.803088
0.777475
0.025613
You are tasked with creating a Haskell program that takes in a file path as input and processes the data in the file to find specific values. Your program should: 1. Read the data from the provided file path. 2. Sort the input data and convert it into a list of integers. 3. Implement the function twoSumN which takes a...
glaive
[ 0.005621287040412426, 0.013769314624369144, -0.03166953846812248, -0.037921588867902756, 0.044672802090644836, -0.018126802518963814, -0.017851706594228745, 0.031300805509090424, 0.03296142816543579, -0.005713051650673151, 0.01902264915406704, 0.04787421226501465, -0.02539440430700779, -0....
0.823983
0.800632
0.023352
Can you provide a code that can find the sum of two matrices?
glaive
[ 0.007938960567116737, 0.019347725436091423, -0.03250328451395035, -0.032201170921325684, 0.02525298111140728, -0.024863580241799355, -0.01821422576904297, 0.06067849323153496, 0.03793156147003174, -0.035569142550230026, 0.012480232864618301, 0.04354119300842285, -0.0395406074821949, -0.031...
0.789651
0.768548
0.021103
You are required to implement a CUDA/HIP kernel that performs a 3D transpose operation on a given input tensor. The input tensor is represented by a 3D array with dimensions (input_shape[0], input_shape[1], input_shape[2]) and the output tensor should be transposed along the last two dimensions. The dimensions of the i...
glaive
[ 0.017310693860054016, 0.040081605315208435, -0.015121661126613617, -0.02592417411506176, 0.04095814749598503, -0.0058007328771054745, -0.010584096424281597, 0.08753194659948349, 0.02655014954507351, -0.010992582887411118, 0.034348901361227036, 0.02792281284928322, -0.013615435920655727, -0...
0.798312
0.782731
0.01558
You are tasked with implementing the idiv8 function in the given programming environment. The idiv8 function takes four parameters: opa, opb, int32, and sgnd. Your task is to write the implementation for the idiv8 function according to a provided specification. Additionally, you need to ensure that the implementation s...
glaive
[ 0.02316882833838463, 0.01835153065621853, -0.024216067045927048, -0.025737203657627106, 0.05095384642481804, -0.014938944950699806, -0.026830200105905533, 0.08214861154556274, 0.049049071967601776, -0.002066594548523426, 0.011701864190399647, 0.019201207906007767, -0.013849273324012756, -0...
0.802343
0.787979
0.014364
You are tasked with implementing the bubble sort algorithm in Lean. Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted. Your task is to write a function...
glaive
[ 0.013827555812895298, 0.029387852177023888, -0.01609005406498909, -0.036518268287181854, 0.03954724222421646, -0.030263185501098633, -0.044686459004879, 0.06911542266607285, 0.02879597619175911, -0.0028654455672949553, 0.022430419921875, 0.025045324116945267, -0.027533235028386116, -0.0110...
0.809554
0.783265
0.026289
You are tasked with writing a program to perform Binary-Coded Decimal (BCD) addition on two 32-bit numbers. Your program should take two 32-bit numbers as input, perform the BCD addition operation, and output the result as a 32-bit BCD number.
glaive
[ -0.006586158182471991, 0.012983742170035839, -0.036073338240385056, -0.02393813617527485, 0.04099242761731148, -0.018774783238768578, -0.01511803362518549, 0.06351903080940247, 0.07426704466342926, -0.025508485734462738, 0.009532999247312546, 0.0446462444961071, -0.03966671600937843, -0.00...
0.797203
0.78279
0.014412
You are tasked with writing a program that calculates the value of n! - n^10 for a given value of n. The value of n! is calculated as the product of all positive integers up to n. You should implement a function that takes an integer n as input and returns the result of the formula n! - n^10.
glaive
[ 0.03392919898033142, 0.03409019112586975, -0.03691292926669121, -0.033138345927000046, 0.058261897414922714, -0.031152449548244476, -0.018450474366545677, 0.05081401765346527, 0.05476462468504906, -0.018510209396481514, 0.01692749746143818, 0.047073788940906525, -0.06254212558269501, -0.02...
0.82
0.786591
0.033408
You are tasked with creating a program for a 8-bit binary counter that counts in 8421 code and displays the count on a seven-segment display. The program should run on a PIC16F877 microcontroller and utilize the assembly language. The counter should count up when the switch on PortA bit 4 is pressed, count down when th...
glaive
[ 0.0183971356600523, 0.019332390278577805, -0.031942643225193024, -0.0343034565448761, 0.024123376235365868, -0.025177551433444023, -0.047869645059108734, 0.07309498637914658, 0.03389770910143852, -0.010681361891329288, 0.017626700922846794, 0.04619958996772766, -0.016219764947891235, -0.00...
0.805895
0.777303
0.028591
You are tasked with creating a Haskell program 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! = 5 x 4 x 3 x 2 x 1 = 120. Write a program that takes a single integer input f...
glaive
[ 0.01938307285308838, 0.02322646975517273, -0.008823318406939507, -0.03772564232349396, 0.04290758818387985, -0.02438482642173767, -0.005761024542152882, 0.039951130747795105, 0.044312842190265656, -0.028559250757098198, 0.011772899888455868, 0.045716457068920135, -0.03930725157260895, -0.0...
0.811421
0.778324
0.033097
You are tasked with implementing a CUDA kernel for computing the softmax function on a GPU. The softmax function is used in machine learning for multiclass classification problems. Given a tensor of input values, the softmax function normalizes the values into a probability distribution, where each value represents the...
glaive
[ 0.008108015172183514, 0.038974061608314514, -0.017367959022521973, -0.02295619249343872, 0.028873087838292122, -0.0002905258152168244, -0.03176937997341156, 0.09350088238716125, 0.04773953929543495, -0.018822606652975082, 0.030271334573626518, 0.04955385625362396, -0.0034937793388962746, -...
0.7997
0.783121
0.016579
You are tasked with creating a program that generates a Mandelbrot set visualization. The Mandelbrot set is a set of complex numbers for which a particular mathematical expression, when iterated, does not diverge to infinity. Your program should take the following parameters: - disp_width: the width of the visualizatio...
glaive
[ -0.006844731047749519, 0.04155237600207329, -0.0117411557585001, -0.046000272035598755, 0.029823143035173416, -0.032714422792196274, -0.010313931852579117, 0.07600145041942596, 0.06287649273872375, -0.010088128969073296, 0.013069408014416695, 0.035029008984565735, -0.019696088507771492, -0...
0.810093
0.773009
0.037084
You are tasked with creating a lookup table of overall durations for each group of songs in a music game. The overall duration for each group should be calculated by summing the durations of all the songs within the group. However, only include songs with playable steps for the current game (dance, pump, etc.) and styl...
glaive
[ 0.023075411096215248, 0.022052569314837456, -0.05887507647275925, -0.03076646849513054, 0.04268193244934082, -0.032155461609363556, -0.034291792660951614, 0.036281343549489975, 0.027954958379268646, -0.020938288420438766, 0.024085046723484993, 0.025316907092928886, -0.037136711180210114, -...
0.798566
0.771124
0.027443
You are tasked with creating a CUDA program that includes a kernel function to perform a specific task on an array. The task involves adding 11 to each element of the array, and then adding the result back to the original element. Your program should take as input an array A of integers and the size N of the array. The...
glaive
[ 0.014858093112707138, 0.05817704647779465, -0.003192288102582097, -0.033520881086587906, 0.03781050071120262, -0.0038855974562466145, -0.030805498361587524, 0.10037782788276672, 0.03656601160764694, 0.0004305325564928353, 0.021539883688092232, 0.042051881551742554, -0.031074700877070427, 0...
0.803392
0.775429
0.027963
You are tasked with implementing a SequenceReader class that will read and process sequences from a given file. The SequenceReader class has the following methods and attributes: - `initialize_sequences`: Allocates memory for an array that will contain all the elements to process. - `sequence_buffer_size`: Returns the...
glaive
[ 0.02381931245326996, 0.014591943472623825, -0.008494976907968521, -0.04650551825761795, 0.031943462789058685, -0.028366388753056526, -0.02566312439739704, 0.10581549257040024, 0.03018329292535782, -0.011813709512352943, 0.011756066232919693, 0.01862124539911747, -0.01412868406623602, 0.002...
0.790829
0.772465
0.018364
You are tasked with creating a program that calculates the value of a function f(x) given the input x. The function is defined as follows: f(x) = 3x^2 + 2x + 1 Write a program that takes an input value x and calculates the value of f(x) using the given function.
glaive
[ 0.04338888078927994, 0.03745996952056885, -0.045888256281614304, -0.04075760021805763, 0.052179161459207535, -0.046698831021785736, -0.016672221943736076, 0.05978655070066452, 0.04797933250665665, -0.010817199945449829, 0.03929527848958969, 0.03785067796707153, -0.029909992590546608, -0.02...
0.803827
0.774046
0.029781
You are tasked with creating a function in Common Lisp that takes two matrices as input and prints out their comparison along with some statistics. The function should output whether the matrices are unitary, print the matrices with comment hashes, and indicate if the matrices are equal or not. Additionally, it should ...
glaive
[ 0.0207795649766922, 0.025953415781259537, -0.029580073431134224, -0.04609933868050575, 0.04656803235411644, -0.03666015714406967, -0.01739867590367794, 0.06515070050954819, 0.05798143893480301, -0.01605328731238842, 0.019531816244125366, 0.01571369543671608, -0.01693219132721424, -0.015149...
0.802513
0.786536
0.015977
I have a sorted array and I need to find the median of the array. Can someone help me with an algorithm that has a time complexity of O(n)?
glaive
[ 0.019232746213674545, 0.021107185631990433, -0.045908574014902115, -0.0339953675866127, 0.014991196803748608, -0.025389742106199265, -0.03964567184448242, 0.05419810116291046, 0.030152618885040283, -0.03729650378227234, 0.024908222258090973, -0.0020562177523970604, -0.02837778627872467, -0...
0.797202
0.774092
0.02311
You are tasked with implementing a program to calculate the probability distribution for a given quantum system. The system is defined by the number of qubits, the state name, and the number of states. You need to create a function that takes the parameters x and y, and uses them to calculate the probability amplitude ...
glaive
[ 0.00009411159408045933, 0.014412542805075645, -0.0358123779296875, -0.01444659661501646, 0.04881381615996361, -0.020305780693888664, -0.01665986329317093, 0.07274281233549118, 0.04108874499797821, 0.0033986482303589582, 0.02164006233215332, 0.04043769836425781, -0.00784123782068491, -0.010...
0.79676
0.770596
0.026163
You are working on a project that involves defining and manipulating filter and set operations in a programming language with support for ordered sets and filters. You need to implement a function that checks whether a given function `f` has a minimum value within a specified filter `l` at a point `a`. The function sho...
glaive
[ 0.0001855962909758091, 0.02352866902947426, -0.0306254830211401, -0.025086654350161552, 0.05400862917304039, -0.01709897257387638, -0.013314815238118172, 0.06036762148141861, 0.04318300634622574, -0.010995217598974705, 0.01833944022655487, 0.031397003680467606, 0.0011843194952234626, -0.02...
0.825315
0.798339
0.026976
You are tasked with implementing a function that determines whether a given node in a sparse voxel octree is occupied or not. The function will take the node's location and return a boolean value indicating whether the node is occupied or not. The sparse voxel octree is represented using an image buffer and an integer ...
glaive
[ 0.005387970246374607, 0.032386139035224915, -0.028337614610791206, -0.034838587045669556, 0.02080131694674492, -0.030590588226914406, -0.006871996447443962, 0.09939214587211609, 0.03507981449365616, 0.000812835933174938, 0.04362046718597412, 0.026078559458255768, -0.005714134778827429, -0....
0.806688
0.785451
0.021237
You are tasked with implementing a general-purpose routine for approximate equality of two real arrays in Fortran. The function RAREQ should compare two arrays of actual and expected values and return true if each element in the actual array is approximately equal to the corresponding element in the expected array, wit...
glaive
[ 0.008171996101737022, 0.027054106816649437, -0.012924556620419025, -0.04212617874145508, 0.030057935044169426, -0.012473013252019882, -0.0013216158840805292, 0.07688922435045242, 0.030707484111189842, -0.03361178934574127, 0.016080038622021675, 0.03486746549606323, -0.015293975360691547, 0...
0.811364
0.789331
0.022033
You are tasked with implementing a k-means clustering algorithm in JavaScript. Your task is to create a class `kMeans` that will handle the clustering process. The class should have the following methods: 1. `initialize`: Initialize a new k-means clustering object with the following options: - `K` (Integer) *Defaul...
glaive
[ 0.008044485002756119, 0.02814607135951519, -0.03225330635905266, -0.03434231877326965, 0.034875355660915375, -0.0250555407255888, -0.010207101702690125, 0.042751848697662354, 0.042237788438797, -0.006656923796981573, 0.02408105693757534, 0.008036895655095577, -0.022579867392778397, 0.02614...
0.802913
0.787508
0.015406
What is an efficient algorithm to determine the longest common substring of two strings?
glaive
[ 0.006030250806361437, 0.02162790857255459, -0.03452582284808159, -0.037447214126586914, 0.01735078915953636, -0.04487352445721626, -0.01754777692258358, 0.028139706701040268, 0.022149797528982162, -0.04734475538134575, 0.020990494638681412, 0.021674491465091705, -0.0179163608700037, -0.007...
0.802258
0.778582
0.023676
You are tasked with creating a program that calculates the probability of a quantum state being in a particular configuration. The program should use the following functions and variables: Variables: - nqubits: an integer representing the number of qubits in the quantum state - name: a string representing the name of ...
glaive
[ -0.003654321888461709, 0.040232185274362564, -0.031638253480196, -0.011756986379623413, 0.04578687995672226, -0.02530268207192421, -0.015491876751184464, 0.07870960235595703, 0.03128146380186081, 0.012940406799316406, 0.023120390251278877, 0.027572719380259514, -0.014894461259245872, -0.01...
0.802223
0.768318
0.033905
I am working on a program that should prompt the user to input a number between 0 and 65,535 and then output its decimal form in nibbles. However, I am facing an issue where if I input a number greater than or equal to 512, the program gets stuck in an infinite loop. Can someone please help me identify the problem in m...
glaive
[ 0.023210491985082626, 0.02324768900871277, -0.013183708302676678, -0.02956043928861618, 0.023315563797950745, -0.04195355623960495, -0.02854173444211483, 0.08404875546693802, 0.04022226482629776, -0.01069911103695631, 0.042689837515354156, 0.018929079174995422, -0.021308880299329758, -0.01...
0.806377
0.791426
0.014951
You are tasked with designing a 4-input Exclusive-Or (XOR) gate in Verilog. The gate should take in four input arrays a, b, c, and d, each of width DW, and produce an output array z also of width DW. The output z should be the result of performing an XOR operation on all four input arrays. Your task is to write the Ve...
glaive
[ 0.033909525722265244, 0.028992289677262306, -0.031676579266786575, -0.018619980663061142, 0.020971033722162247, -0.03587208315730095, -0.04491005465388298, 0.06867291778326035, 0.042929571121931076, -0.010556453838944435, 0.010702203027904034, 0.028463046997785568, -0.014919823966920376, -...
0.810512
0.787592
0.022921
You are tasked with creating a Vector container in Haskell with abstract refinements for domain and range invariants. The Vector container should be parameterized with two abstract refinements: "dom" for the domain on which the Vector is defined, and "rng" for the range and its relationship with the index. Additionally...
glaive
[ 0.034142062067985535, 0.02596209943294525, -0.005671451799571514, -0.024252278730273247, 0.025840546935796738, -0.029475780203938484, -0.022922096773982048, 0.045215778052806854, 0.03146691992878914, -0.009721117094159126, 0.011974806897342205, 0.045192401856184006, -0.009993171319365501, ...
0.797653
0.782178
0.015476
You need to build a RMAT CSR graph by adding edges to nodes. The RMAT graph is constructed by randomly choosing a pair of nodes for each edge, with possibilities of loops and multiple edges between pairs of nodes. The graph can be either undirected or directed. The problem is to implement a function that takes the numb...
glaive
[ 0.005635881796479225, 0.026615628972649574, -0.041276805102825165, -0.03868062421679497, 0.03919127583503723, -0.004882581532001495, -0.04181046783924103, 0.05255454406142235, 0.032354697585105896, -0.014870138838887215, 0.0070541477762162685, 0.024266771972179413, -0.029208429157733917, -...
0.810413
0.792641
0.017773
You are tasked with creating a function in Elm that takes a list of strings and breaks each string into smaller substrings of a specified width. You need to implement the `breakStr` function that takes an integer `width` and a string `string`, and returns a list of substrings where each substring has a maximum length o...
glaive
[ 0.010213782079517841, 0.016242148354649544, -0.015306965447962284, -0.05267616733908653, 0.043921973556280136, -0.02829669415950775, -0.016976460814476013, 0.04321673512458801, 0.04746593162417412, -0.02015240490436554, 0.022920871153473854, 0.04805628955364227, -0.042048681527376175, -0.0...
0.816056
0.801356
0.0147
You are tasked with implementing a function to calculate the 4th derivative approximation stencil for a given input size N. The function should create a matrix A of size (N,N+2) and populate it with values based on the following rules: - The first row of A should contain the values [3.5, -56/3, 42.5, -54.0, 251/6, -20....
glaive
[ 0.022129744291305542, 0.027332782745361328, -0.01849539764225483, -0.040742963552474976, 0.06424134969711304, -0.035238929092884064, -0.04059005156159401, 0.05475466325879097, 0.041216108947992325, 0.006967331748455763, 0.03004312515258789, 0.033843573182821274, -0.02539944276213646, 0.001...
0.806288
0.75986
0.046428
You are tasked with implementing a program in C++ that involves matrix multiplication using CUDA and cuBLAS. The program should perform matrix multiplication using different combinations of input matrices, and then select the best performing algorithm based on the execution time. The program should have the following ...
glaive
[ 0.02147729881107807, 0.039109088480472565, -0.01925458200275898, -0.017393995076417923, 0.03788053244352341, -0.0029946763534098864, -0.0412784069776535, 0.10131356120109558, 0.03614513948559761, -0.022155342623591423, -0.0002171049709431827, 0.030229168012738228, -0.005663388408720493, -0...
0.7975
0.767395
0.030105
You are tasked with creating a program that calculates the maximum probability and generates a 3D plot and contour plot based on the given quantum mechanical amplitudes. Create a program that takes in the number of qubits (nqubits), state name (name), and number of states (nstates), and use the provided amplitude, amp...
glaive
[ 0.011849228292703629, 0.03400871902704239, -0.026199182495474815, -0.03341049328446388, 0.03490296006202698, -0.02509475313127041, -0.02967851236462593, 0.07008391618728638, 0.0371810607612133, 0.008099050261080265, 0.024509336799383163, 0.04045432060956955, -0.023545626550912857, -0.00742...
0.800658
0.770749
0.02991
You are tasked with implementing a parallelized Inverted Index (II) algorithm using the Mars MapReduce framework on graphics processors. The II algorithm scans a set of HTML files and extracts the positions for all links. Each Map process handles one line of HTML files and for each link it finds, it outputs an intermed...
glaive
[ 0.017137374728918076, 0.04030612111091614, 0.006746766623109579, -0.005343545228242874, 0.016757134348154068, -0.005081219598650932, -0.024146156385540962, 0.09280647337436676, 0.03846112638711929, -0.015227334573864937, 0.024339700117707253, 0.03281893581151962, 0.0024175031576305628, 0.0...
0.815861
0.793084
0.022777
I need to write a function to perform a linear search on an array and find the position of a given element. The function should take in an array of numbers and the number to be searched, and then return the position of the number in the array if it is found, or indicate that it is not found. The function should utilize...
glaive
[ 0.0025825791526585817, 0.03998393192887306, -0.05329432338476181, -0.041747111827135086, 0.04538118094205856, -0.031665269285440445, -0.033378757536411285, 0.05359496548771858, 0.029437044635415077, -0.01573379524052143, 0.02470562793314457, 0.011845228262245655, -0.040751270949840546, -0....
0.807933
0.782235
0.025698
How can I write a Python code that iterates over a sequence and returns a dictionary specifying the highest index in the sequence where the value does not exceed its predecessor, along with the index of the next lower item that can be swapped with it to potentially correct the sequence? If no such item is found, the fu...
glaive
[ 0.014992835000157356, 0.03321228176355362, -0.022752312943339348, -0.01560660358518362, 0.03029889240860939, -0.015398073941469193, -0.03200762718915939, 0.048245228826999664, 0.006440059747546911, -0.029273198917508125, 0.025399472564458847, 0.00770128658041358, -0.032045889645814896, 0.0...
0.821549
0.801209
0.020339
I am trying to solve a computational challenge in which I need to find the Lowest Common Ancestor (LCA) in a Binary Search Tree (BST). The LCA is the most inferior node in the tree that counts both specified nodes among its descendants. Can someone help me with the code to find the LCA in a BST? Here are a few scenari...
glaive
[ -0.006296384148299694, 0.03669220209121704, -0.044558700174093246, -0.02671373076736927, 0.025541605427861214, -0.030405599623918533, -0.01024493295699358, 0.07476828247308731, 0.025348633527755737, -0.02569989487528801, 0.012478979304432869, 0.029519181698560715, -0.02618085965514183, 0.0...
0.814533
0.784964
0.029569
You are tasked with creating a VBA function that takes in a range of cells and returns the sum of the values within that range. The function should be able to handle ranges of any size and should return 0 if the range is empty. Your task is to write the VBA code for the function `sum_range` that achieves this functiona...
glaive
[ -0.0014095129445195198, 0.029629554599523544, -0.040443528443574905, -0.03406152501702309, 0.053567878901958466, -0.014976832084357738, -0.014394124038517475, 0.063456691801548, 0.033943548798561096, -0.009777401573956013, 0.02088644728064537, 0.04428451508283615, -0.020514238625764847, -0...
0.783452
0.767112
0.01634
You are tasked with creating a program that generates a sequence of numbers according to the following formula: a(n) = 997 * n + 1009. The program should take an input n and output the corresponding value of a(n). Write a function or program that takes an integer n as input and returns the value of a(n) according to ...
glaive
[ 0.031187742948532104, 0.026959063485264778, -0.03649121895432472, -0.032100263983011246, 0.025965355336666107, -0.028738100081682205, -0.03482856974005699, 0.0745387002825737, 0.023924963548779488, -0.023876449093222618, 0.03610878437757492, 0.05468381941318512, -0.04798324406147003, 0.004...
0.820754
0.777236
0.043518
You are tasked with implementing a program that demonstrates the left cancellation property of addition on the set of natural numbers. In other words, you need to write a function that takes three natural numbers a, b, and c as input and checks if the equation a + b = a + c holds true. If it does, the program should re...
glaive
[ 0.033072859048843384, 0.020021526142954826, -0.04179495945572853, -0.0314202606678009, 0.045335542410612106, -0.009327059611678123, 0.006612980272620916, 0.09757883101701736, 0.044863536953926086, -0.03218365088105202, 0.0020812961738556623, 0.03646993264555931, -0.038328468799591064, -0.0...
0.82212
0.794746
0.027374
You are tasked with creating a data structure to represent a list of integers and a map of integers to integers using the given framework and technology. The list should contain the integers from 0 to 10, and the map should have a single key-value pair where the key is 1 and the value is another map with key-value pair...
glaive
[ 0.038879409432411194, 0.025391222909092903, -0.025706373155117035, -0.02349557913839817, 0.052332088351249695, -0.04619920626282692, -0.028029656037688255, 0.06317202001810074, 0.024056537076830864, -0.03505541756749153, 0.027127280831336975, 0.021921519190073013, -0.03490539267659187, -0....
0.819849
0.788962
0.030887
You are given a quantum computing problem to find the maximum probability of a state in a quantum system. The system has 16 qubits and 4 quantum states. The system is represented by the amplitude function, and the probability of each state is calculated using the probability function. You need to use the NMaximize func...
glaive
[ 0.012090825475752354, 0.015529340133070946, -0.03584713488817215, -0.017391139641404152, 0.05132723227143288, -0.01751594804227352, -0.023920787498354912, 0.07112347334623337, 0.03753184527158737, 0.006816434673964977, 0.025792637839913368, 0.03128374367952347, -0.007571346126496792, -0.01...
0.799295
0.767902
0.031393
You are tasked with creating a module in Elm to handle ordinal indicators for numbers. An ordinal indicator is a suffix added to a number to denote its position in a sequence (e.g., 1st, 2nd, 3rd, 4th). Your task is to implement a function called `ordinalIndicator` that takes an integer as input and returns the appropr...
glaive
[ 0.022804589942097664, 0.020046016201376915, -0.011085080914199352, -0.05326748266816139, 0.017312979325652122, -0.04169229418039322, -0.02009701542556286, 0.03291332349181175, 0.03338963910937309, -0.0201850738376379, 0.01852124184370041, 0.016439158469438553, -0.02722878009080887, 0.01451...
0.802674
0.783993
0.018681
Can you provide an optimal solution for the traveling salesman problem?
glaive
[ -0.002170189516618848, 0.004579086322337389, -0.036636874079704285, -0.019452562555670738, 0.024503536522388458, -0.014852739870548248, -0.019033465534448624, 0.03181338310241699, 0.05448654666543007, -0.0315852127969265, 0.026947731152176857, 0.028620485216379166, -0.01601961813867092, -0...
0.781564
0.764201
0.017364
You are tasked with implementing a program that computes the expansion of a given algebraic expression. The expression is of the form (3 - 4*x + 3*x^2 + x^4)/((1 - x)^2*(1 + x^2 + x^4)). You need to write a function or a program that takes the input value of x and returns the expansion of the given expression as a sequ...
glaive
[ 0.03575342148542404, 0.04179244115948677, -0.03513782471418381, -0.04175933822989464, 0.03389303386211395, -0.020473888143897057, -0.016191622242331505, 0.07095513492822647, 0.055647894740104675, -0.014219914563000202, 0.025818347930908203, 0.02699233405292034, -0.052917201071977615, -0.02...
0.822917
0.782632
0.040285
You are tasked with implementing a function that runs a DBSCAN algorithm on an adjacency graph using CUDA. The function takes in several parameters including a handle, boolean adjacency matrix, vertex degrees, adjacency graph, number of non-zero elements in the adjacency graph, exclusive scan of the degrees, number of ...
glaive
[ 0.026707101613283157, 0.025153016671538353, -0.02025863528251648, -0.01498542632907629, 0.017818469554185867, -0.0023399917408823967, -0.026553839445114136, 0.08787450939416885, 0.05687674134969711, -0.005244523286819458, 0.02181807905435562, 0.033276453614234924, 0.013471047393977642, 0.0...
0.815425
0.794819
0.020606
You are required to create a program that calculates the probability of a quantum state for a given set of qubits. The amplitude of the quantum state is defined by the functions `amplitude[x_,y_]` and `amplitude2[x_,y_]`. The probability of the quantum state is given by the function `probability[x_, y_]`, which calcula...
glaive
[ -0.0060865627601742744, 0.04183052107691765, -0.02852419763803482, -0.019804179668426514, 0.039257898926734924, -0.024560503661632538, -0.01764640398323536, 0.06932950019836426, 0.019889287650585175, 0.0002815957413986325, 0.027506766840815544, 0.027794362977147102, -0.015320762060582638, ...
0.804705
0.769358
0.035347
I need to create a program that will take the input of a co-applicant's sex name and output a corresponding value based on the following criteria: - If the co-applicant is female, the output value should be 0.7401539643 - If the co-applicant's sex information is not provided, the output value should be 0.0067123778 - I...
glaive
[ -0.013176868669688702, 0.020532069727778435, -0.04481774568557739, -0.03699931502342224, 0.027605503797531128, -0.010053398087620735, -0.02189711667597294, 0.049781620502471924, 0.04777776077389717, -0.03381399065256119, 0.035832397639751434, 0.032641008496284485, -0.027197517454624176, -0...
0.808158
0.778699
0.029459
You are working with a normed space `E` over a field `𝕜` and you need to implement a function to calculate the polar of a given subset `s` in `E`. The polar `polar 𝕜 s` is the subset of the topological dual space of `E` consisting of those functionals which evaluate to something of norm at most one at all points in `...
glaive
[ 0.013863209635019302, 0.013118532486259937, -0.025695696473121643, -0.024234438315033913, 0.029324525967240334, -0.03128308802843094, -0.018006859347224236, 0.03272068127989769, 0.04800815507769585, -0.009219275787472725, 0.04198784381151199, 0.04468938708305359, -0.0321703739464283, 0.002...
0.815118
0.798846
0.016272
You are tasked with creating a scoreboard for a rhythm game that displays the top scores for a given song. The scoreboard should display the player's rank, grade, percentage score, maximum combo, modifiers, clear type, and judgment statistics for the top scores. Additionally, the scoreboard should allow for pagination ...
glaive
[ 0.024685639888048172, 0.026750648394227028, -0.030400024726986885, -0.02618507295846939, 0.016687436029314995, -0.020693033933639526, -0.045725494623184204, 0.04310223087668419, 0.034816961735486984, -0.004843384958803654, 0.0271354578435421, 0.03633890300989151, -0.023341093212366104, 0.0...
0.79096
0.764314
0.026646
You are tasked with creating a YogaNode class in Java that performs layout calculations based on the given properties and children nodes. The class should have methods to set the width, height, wrap behavior, direction, and align content. Additionally, it should have a method to calculate the layout. The layout should ...
glaive
[ 0.007004576735198498, 0.024295564740896225, -0.04666350409388542, -0.030132479965686798, 0.025113236159086227, -0.05013665929436684, -0.019097015261650085, 0.05393553897738457, 0.016981089487671852, -0.022460386157035828, 0.036075688898563385, 0.03493084758520126, -0.043395668268203735, 0....
0.790151
0.775499
0.014653
You are given a simplified algorithm of find_interacting_blocks.cu from OpenMM, launched with a threadblock size of 32 (i.e. one warp). The problem is to implement a CUDA kernel that performs the following steps for each block: 1. Load its own row block (32 atoms). 2. Compare the row block against 32 other column bloc...
glaive
[ 0.021013975143432617, 0.047140222042798996, -0.031990695744752884, -0.013973635621368885, 0.028118541464209557, -0.014480473473668098, -0.03089209459722042, 0.08012932538986206, 0.044489290565252304, -0.008721391670405865, 0.03282057121396065, 0.020356515422463417, -0.0009203356457874179, ...
0.807283
0.788626
0.018657
You are tasked with implementing a numerical solution for a two-dimensional harmonic oscillator using the Velocity-Verlet algorithm. The system consists of a particle of mass $m$ moving in a harmonic potential given by $V(r)=\frac{1}{2}kr^2$, where $r$ is the radial distance from the origin. The goal is to simulate the...
glaive
[ 0.028994813561439514, 0.04096304625272751, -0.02107144519686699, -0.030822258442640305, 0.031076529994606972, -0.025577465072274208, -0.032770633697509766, 0.07452146708965302, 0.03841906040906906, -0.009363497607409954, 0.02655690908432007, 0.02402595244348049, -0.013390002772212029, -0.0...
0.788621
0.758074
0.030547
You are given a grid of size N x M, where each cell contains either 0 or 1. The goal is to find the size of the largest connected shape that can be formed by changing exactly one 0 to 1. A connected shape is formed by grouping adjacent cells with the same value (1's form a single connected shape). You should return the...
glaive
[ 0.013500630855560303, 0.0505937859416008, -0.00915609672665596, -0.04301401972770691, 0.024880312383174896, -0.014791233465075493, -0.04043307155370712, 0.05851460620760918, 0.03087255172431469, -0.014617851004004478, 0.025687970221042633, 0.02963734045624733, -0.028269223868846893, -0.012...
0.833679
0.775141
0.058538
You have been tasked with creating a Fortran subroutine that takes an array as input and performs a specific calculation on it. The subroutine should have two versions: one for integer arrays and one for long integer arrays. The calculation involves adding the elements of the array and multiplying the third element by ...
glaive
[ 0.019174618646502495, 0.0322326198220253, -0.024157259613275528, -0.02605106122791767, 0.03959878534078598, -0.033237893134355545, -0.009327609091997147, 0.06214667856693268, 0.03095102868974209, -0.008626226335763931, 0.014071863144636154, 0.039037615060806274, -0.024928268045186996, -0.0...
0.813101
0.785754
0.027348
You are tasked with creating a stochastic programming problem using the Julia programming language. The problem involves two stages, with decision variables, parameters, uncertain variables, and scenarios. At stage 1, you need to define parameters, decision variables, an objective function, and constraints. At stage 2,...
glaive
[ -0.016239218413829803, 0.009772520512342453, -0.043651167303323746, -0.018629027530550957, 0.04120681434869766, -0.0007358925649896264, -0.024368686601519585, 0.07723642885684967, 0.03808922693133354, 0.0012502832105383277, 0.020689301192760468, 0.03158336505293846, -0.008454272523522377, ...
0.785881
0.770004
0.015878
You are tasked with implementing a Queue data structure in JavaScript using the provided code snippet below. A Queue is a data structure that follows the FIFO (First In, First Out) principle, where elements are added to the back and removed from the front. Your task is to implement the following methods for the Queue ...
glaive
[ 0.03128024935722351, 0.010026122443377972, -0.006115725263953209, -0.026546016335487366, 0.029651861637830734, -0.024493828415870667, -0.02178511954843998, 0.06413827836513519, 0.03804648295044899, -0.0030844572465866804, 0.03865402936935425, 0.01452550943940878, -0.039104949682950974, 0.0...
0.795632
0.778298
0.017334
You are tasked with creating a program that defines a function to calculate the area of a circle. The function should take the radius of the circle as input and return the calculated area. You should use the scheme programming language to implement this solution.
glaive
[ 0.0035323253832757473, 0.04868641495704651, -0.039075419306755066, -0.025558115914463997, 0.04418632760643959, -0.019785454496741295, -0.03457177057862282, 0.04586194455623627, 0.037498388439416885, -0.001010686275549233, 0.020530138164758682, 0.041204627603292465, -0.02752980776131153, -0...
0.780964
0.759608
0.021357
You are tasked with creating a SQL query to retrieve the top 10 students based on their average grade. You will need to join the "Students" table with the "StudentsExams" table using the "StudentId" field. The query should return the first name, last name, and the average grade of each student. The results should be or...
glaive
[ 0.03806715086102486, 0.026880351826548576, -0.0266569834202528, -0.047157205641269684, 0.009767522104084492, -0.039646830409765244, -0.03610622137784958, 0.03136446699500084, 0.03322765603661537, 0.0029386396054178476, 0.03140667825937271, 0.010666771791875362, -0.03429778292775154, 0.0094...
0.765858
0.744223
0.021635
You are tasked with implementing a function that performs softmax normalization on a given matrix. The softmax function is used in machine learning and statistics to convert a vector of arbitrary real values into a probability distribution. The function should take a matrix as input and return a matrix with the softmax...
glaive
[ 0.026757098734378815, 0.01634657010436058, -0.029534244909882545, -0.034975890070199966, 0.051012828946113586, -0.024967527016997337, -0.031078627333045006, 0.06598786264657974, 0.05324927344918251, -0.008998580276966095, 0.020886268466711044, 0.03109588660299778, -0.022180819883942604, -0...
0.80178
0.776469
0.025311
You are tasked with implementing a program that fills a section of memory with specific values and then performs various operations on it. The program should start by setting the initial size of memory to 8000 and then fill the memory locations with specific values. Once the memory is filled, the program should copy a ...
glaive
[ 0.03649996593594551, 0.019915349781513214, -0.017562059685587883, -0.018374375998973846, 0.027710549533367157, -0.04650268703699112, -0.007015671581029892, 0.07732881605625153, 0.04011033475399017, -0.023685535416007042, 0.03332032635807991, 0.04043440520763397, -0.03567495569586754, -0.00...
0.801292
0.786576
0.014716
You are tasked with implementing a hardware module in the SV (Symbolic Vector) framework using Verilog. The module should take a 128-bit input vector and perform the following operations: - Split the input vector into individual components: - a9 (9 bits), a4 (4 bits), a1 (1 bit), b9 (9 bits), b6 (6 bits), b2 (2 bits)...
glaive
[ 0.02435748651623726, 0.024635545909404755, -0.03504342958331108, -0.02055715210735798, 0.023993611335754395, -0.033474165946245193, -0.02417338825762272, 0.08488474786281586, 0.04121839627623558, -0.02463635988533497, 0.028044242411851883, 0.054902367293834686, -0.008050299249589443, -0.00...
0.800635
0.780038
0.020597
You are tasked with writing a function in a functional programming language that calculates the integer square root of a given number. The integer square root of a number n is the largest integer m such that m^2 is less than or equal to n. Your function should take a single integer parameter n and return the integer sq...
glaive
[ 0.03667118772864342, 0.04852810129523277, -0.035104185342788696, -0.055177122354507446, 0.046595025807619095, -0.029581980779767036, -0.019982699304819107, 0.041443947702646255, 0.04287112131714821, -0.016539236530661583, 0.03432197868824005, 0.03473984822630882, -0.044456206262111664, -0....
0.818412
0.789951
0.028461
You are tasked with creating a program that reads in a text file containing a list of numbers, one per line, and then calculates the average of these numbers. The program should then output the average to the console. You need to implement a function that takes the file path as input, reads the numbers from the file, ...
glaive
[ 0.006812558509409428, 0.015616616234183311, -0.03222354128956795, -0.046185657382011414, 0.05512157455086708, -0.042410630732774734, -0.03414064645767212, 0.04531445354223251, 0.02186284400522709, -0.020104316994547844, 0.012916535139083862, 0.010681924410164356, -0.03710019588470459, -0.0...
0.785356
0.763241
0.022115
You are tasked with implementing a function that calculates the interpolated amplitude of a given wavelength in a spectral spectrum. The function should take in a spectrum of type Spectrum_29, which contains cycle frequencies and spectral amplitudes, and a specific wavelength. You need to find the two closest wavelengt...
glaive
[ 0.016191333532333374, 0.05526111647486687, -0.024169083684682846, -0.04524599388241768, 0.02847033552825451, -0.04780400171875954, -0.012882651761174202, 0.07157774269580841, 0.03125268220901489, -0.009359796531498432, 0.042094770818948746, 0.03547971323132515, -0.035847608000040054, -0.01...
0.785485
0.763754
0.021731
You are required to create a function that uses the Knuth-Morris-Pratt (KMP) algorithm to find if a given string contains a specified sub-string. The function should return the index at which the sub-string is found in the string, or -1 if it is not found. The function should also have the capability to ignore case whe...
glaive
[ -0.006823842879384756, 0.030522869899868965, -0.016086192801594734, -0.024820979684591293, 0.04001838341355324, -0.03021892160177231, -0.004825967364013195, 0.06569517403841019, 0.0281925480812788, 0.005356986075639725, 0.022597039118409157, 0.02098281867802143, -0.0256038811057806, -0.003...
0.817466
0.799514
0.017951
You are tasked with implementing a parallel algorithm to perform matrix operations on a GPU using CUDA. The algorithm will involve initializing and manipulating arrays, as well as performing bitwise operations and popcount (counting the number of set bits in a 64-bit integer). You will need to create several CUDA kern...
glaive
[ 0.004602283239364624, 0.04217459633946419, -0.0133875273168087, -0.008409782312810421, 0.02679251879453659, 0.0085457107052207, -0.03162034600973129, 0.10259000211954117, 0.0320664644241333, -0.02213878743350506, 0.012992574833333492, 0.027353323996067047, 0.0158260315656662, 0.00037709955...
0.797377
0.766474
0.030903
You are tasked with writing a program that takes three integer inputs (a, b, and c) and checks if all three numbers are distinct from each other. If all three numbers are distinct, the program should output "true", otherwise it should output "false". Write a Kotlin program that takes three integer inputs and outputs w...
glaive
[ 0.025241313502192497, 0.017598038539290428, -0.018579328432679176, -0.0265305507928133, 0.039228253066539764, -0.031268034130334854, 0.0074901576153934, 0.06000707298517227, 0.04160888120532036, -0.027228595688939095, 0.005970611236989498, 0.025006752461194992, -0.026821982115507126, -0.02...
0.820356
0.786222
0.034134
You are tasked with implementing a program that will transform input data by applying a specific formula. The input data will consist of a series of numbers and operations enclosed in curly brackets, with each element separated by a space. The operations will include mathematical operations such as addition, subtractio...
glaive
[ 0.03394189104437828, 0.029838664457201958, -0.032909639179706573, -0.0418979749083519, 0.04158216342329979, -0.01985577680170536, -0.01781855896115303, 0.08069883286952972, 0.04163817688822746, -0.011050197295844555, 0.011704333126544952, 0.02709568664431572, -0.017165163531899452, -0.0229...
0.816427
0.786677
0.02975
You are tasked with writing a program that reads input from the user, consisting of a number of lines followed by a width value. The program should then read a series of key-value pairs, where the key is an identifier and the value is a string of characters. After reading all input, the program should concatenate the s...
glaive
[ 0.026174822822213173, 0.04231010377407074, -0.027119101956486702, -0.03594142198562622, 0.04367280378937721, -0.023295214399695396, -0.006874280050396919, 0.05957736819982529, 0.04681779444217682, -0.01911238580942154, 0.02165931649506092, 0.03775720298290253, -0.041009411215782166, -0.004...
0.814175
0.796652
0.017524
You are tasked with implementing a single precision function that evaluates the reciprocal of the gamma function for a given single precision argument X. Write a function GAMR(X) that computes the reciprocal of the gamma function for the input argument X. The function should return a single precision value. The funct...
glaive
[ -0.00001840901495597791, 0.044347576797008514, -0.005399132613092661, -0.03731363266706467, 0.04580589011311531, -0.029809532687067986, -0.011762007139623165, 0.07169737666845322, 0.03478054702281952, -0.002959967590868473, 0.013346092775464058, 0.04071766138076782, -0.039098989218473434, ...
0.795745
0.772558
0.023187
You are tasked with implementing a VHDL module for a seven-segment display controller. The module should take in a 16-bit input data and output the appropriate 4-bit selection signals for the display and the 7-bit segment data for each digit. The module must have the following ports: - clk: input std_logic for the clo...
glaive
[ 0.029932813718914986, 0.019969049841165543, -0.027162587270140648, -0.041662320494651794, 0.038696009665727615, -0.033432673662900925, -0.026667891070246696, 0.06522481143474579, 0.03637870401144028, -0.02153570018708706, 0.033216360956430435, 0.04884942248463631, -0.0002552447549533099, 0...
0.796263
0.7817
0.014563
You are tasked with implementing a forward kernel function for a convolutional neural network (CNN) on a GPU using CUDA. The goal is to perform the convolution operation on input data `x` with a filter `k` and produce the output `y`. The input data `x` has dimensions (B, C, H, W) where B is the batch size, C is the num...
glaive
[ 0.007608148269355297, 0.057952892035245895, -0.010804891586303711, -0.018396031111478806, 0.030429303646087646, 0.006614950951188803, -0.033133480697870255, 0.09190066158771515, 0.041152823716402054, -0.009911893866956234, 0.02616819180548191, 0.03783472627401352, -0.023188764229416847, 0....
0.796636
0.778547
0.01809
You are required to write a CUDA program that performs matrix transposition using various methods and measure their respective execution times. The matrix is of size N by N, and you are to implement CPU and GPU versions of the transpose function. The program should also include methods for comparing the results of the ...
glaive
[ 0.015172997489571571, 0.018528997898101807, -0.03280028700828552, -0.02147635817527771, 0.03377699851989746, -0.0010488771367818117, -0.02495894953608513, 0.08991147577762604, 0.05081477388739586, -0.015879159793257713, 0.022005459293723106, 0.016050424426794052, -0.0032232552766799927, 0....
0.795054
0.779276
0.015778
You are tasked with implementing a program that calculates the probability of a quantum state for a given set of parameters. The program should use the provided amplitude function and then find the maximum probability using a simulated annealing method. Finally, the program should generate a 3D plot and a contour plot ...
glaive
[ 0.01217940729111433, 0.03437101095914841, -0.03256535157561302, -0.029028214514255524, 0.03987393155694008, -0.0243261456489563, -0.021323008462786674, 0.07835688441991806, 0.035994261503219604, -0.0024119517765939236, 0.02488456666469574, 0.04148120433092117, -0.0116391247138381, -0.00718...
0.801364
0.780668
0.020696
: You are tasked with writing a code that calculates the probability of drawing different colored balls from a bag. The bag contains a total of 10 balls, with 3 black, 5 blue, and 2 green. Your task is to write a program that calculates the probability of drawing a black, blue, red, or green ball, as well as the probab...
glaive
[ -0.013257969170808792, 0.023006215691566467, -0.03266042470932007, -0.016331326216459274, 0.038715850561857224, -0.01698695868253708, -0.03312025964260101, 0.05254961550235748, 0.03827352449297905, -0.016782257705926895, 0.01943095214664936, 0.03933198004961014, -0.019842853769659996, -0.0...
0.811615
0.785978
0.025637
You are tasked with implementing a CUDA kernel function that performs matrix multiplication on GPU. The function should take three parameters: float pointers c[1024], a[1024], and b[1024], representing matrices C, A, and B, each of size 1024x1024. The matrix multiplication should be performed using the following formul...
glaive
[ 0.0181659497320652, 0.05576198920607567, -0.029622385278344154, -0.028848890215158463, 0.041887737810611725, -0.01020055077970028, -0.030804255977272987, 0.09696473181247711, 0.0346967950463295, -0.019945399835705757, 0.011075987480580807, 0.029106734320521355, -0.005613082088530064, -0.01...
0.787357
0.76615
0.021208
You are tasked with implementing a function that extracts the diagonal elements of a matrix and pastes a vector onto the diagonal of a matrix. The function takes in a context, a tensor 'x', an offset, a padding value, and a pointer to the output tensor 'out'. The function should handle both 1D and 2D tensors. For 1D t...
glaive
[ 0.020547594875097275, 0.023289866745471954, -0.027260232716798782, -0.04767770692706108, 0.033862970769405365, -0.009588857181370258, -0.008435478433966637, 0.08400975167751312, 0.043011654168367386, -0.0009048865758813918, 0.030815118923783302, 0.03716159611940384, -0.030960367992520332, ...
0.807781
0.78974
0.018041
You are required to implement a kernel for extracting patches from input 3D matrices and extrapolating them onto output matrices. The kernel function should have the following parameters: - theSame: a boolean value indicating whether the output format is SAME or VALID - batchCount: the number of batches, which is the f...
glaive
[ 0.014826157130300999, 0.04197552055120468, -0.024824855849146843, -0.038383230566978455, 0.040820587426424026, -0.018992029130458832, -0.018203305080533028, 0.07969260960817337, 0.036556705832481384, -0.01470092311501503, 0.023096514865756035, 0.03956223279237747, -0.045293740928173065, 0....
0.813039
0.794166
0.018873
You are required to create a class called "Table" which will handle the management and manipulation of data in a table format. The class should support the following functionalities: 1. Load data from a file and store it in the table. 2. Copy data from an existing table to a new table. 3. Allocate memory for a table wi...
glaive
[ 0.04115143418312073, 0.03192610666155815, -0.02173527516424656, -0.018790053203701973, 0.041585542261600494, -0.0623343288898468, -0.0030296165496110916, 0.07013215124607086, 0.04791969433426857, -0.017156269401311874, 0.021658586338162422, 0.02831614762544632, -0.025042841210961342, 0.000...
0.801906
0.784358
0.017548
You are required to create a function that takes a list of strings as input and outputs a new map, using the string elements as keys and their lengths as values. Write a function called `stringLengths` that takes a list of strings as input and returns a new map with the strings as keys and their lengths as values. Ex...
glaive
[ 0.021874792873859406, 0.022596314549446106, -0.020105717703700066, -0.03575601428747177, 0.044053904712200165, -0.05105837434530258, -0.01491766981780529, 0.03544856235384941, 0.017612876370549202, -0.015790218487381935, 0.013900578022003174, 0.038422174751758575, -0.03243564814329147, -0....
0.818115
0.799822
0.018293
You are tasked with implementing a function that encodes a given nucleotide sequence into a vector of 64-bit integers. The function should take an array of unsigned 8-bit integers (u8) representing the nucleotide sequence and return a vector of 64-bit integers (u64). Your task is to implement the `encode` function, wh...
glaive
[ 0.027397120371460915, 0.03326039016246796, 0.011539463885128498, -0.015782644972205162, 0.01919696107506752, -0.021856941282749176, -0.03922661393880844, 0.10085790604352951, 0.028945883736014366, -0.015909861773252487, 0.028453754261136055, 0.026352768763899803, -0.02142316848039627, 0.00...
0.806577
0.788083
0.018494
You are tasked with creating a program in Java or C# that simulates a simple counter. The program should include a class called "Counter" with the following specifications: - The class should have a private integer variable called "count". - The class should have a public method called "increment" that takes an integer...
glaive
[ 0.006016590166836977, 0.019355202093720436, -0.03544716536998749, -0.03382497280836105, 0.03221072629094124, -0.04560350626707077, -0.012824117206037045, 0.07790174335241318, 0.04168576002120972, -0.04258781671524048, 0.017263252288103104, 0.037657734006643295, -0.037357352674007416, -0.00...
0.811646
0.791202
0.020444
You want to implement a parallel program to solve a linear system Ax = b using Gaussian Elimination. The program should be able to read the input from a file, or generate the input data internally. The algorithm should convert three independent for() loops into three Fans. The input file should contain the dimension of...
glaive
[ 0.01440508384257555, 0.009599263779819012, -0.037279754877090454, -0.045511096715927124, 0.03918859735131264, -0.011837141588330269, -0.02547910064458847, 0.0777624249458313, 0.032784998416900635, -0.018916768953204155, 0.008887143805623055, 0.042798977345228195, -0.019144117832183838, -0....
0.816731
0.78992
0.026812
You are tasked with creating a program that involves transforming and manipulating various data types, such as integers, real numbers, matrices, vectors, and row vectors. The program will also include parameters and transformed parameters. Your goal is to implement the transformation functions and model the data using ...
glaive
[ 0.022483842447400093, 0.024842308834195137, -0.03423009440302849, -0.04426067695021629, 0.04123533517122269, -0.018774420022964478, -0.006904943380504847, 0.05385779216885567, 0.04116540774703026, -0.017569443210959435, 0.006787489168345928, 0.04306108132004738, -0.023386582732200623, -0.0...
0.801636
0.782623
0.019013
You are developing a cellular automaton simulation using CUDA for parallel processing. The objective is to simulate the evolution of a grid of cells based on certain rules. Each cell can be in one of three states: None, Candidate, or Alive. The rules for updating the cells are as follows: - If a cell is Alive and has f...
glaive
[ -0.000396894320147112, 0.03454064577817917, -0.019911790266633034, -0.016247842460870743, 0.022053439170122147, -0.024535084143280983, -0.03660058230161667, 0.10724550485610962, 0.017034323886036873, -0.02663036808371544, 0.02538582868874073, 0.029747730121016502, -0.013036413118243217, 0....
0.803506
0.787385
0.016121