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 creating a Rust function that calculates the factorial of a given number. Your function should take an integer as input and return the factorial of that number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. | glaive | [
0.04051491618156433,
0.027376556769013405,
-0.01965409517288208,
-0.02848331816494465,
0.0375867635011673,
-0.03434746339917183,
-0.01530366763472557,
0.05440567806363106,
0.05082685127854347,
-0.003253861330449581,
0.013332216069102287,
0.05455906689167023,
-0.03491058945655823,
-0.023419... | 0.802502 | 0.77077 | 0.031732 |
I need to design an algorithm that can efficiently handle the manipulation of three tensors with congruent elements and perform a tensor product operation. The algorithm should be able to handle scenarios where the second or third tensor contains zero values and should display an error message. It should also handle si... | glaive | [
0.02748369239270687,
0.03117951937019825,
-0.03423207998275757,
-0.020912962034344673,
0.028933804482221603,
-0.014765945263206959,
-0.03466692194342613,
0.06444412469863892,
0.014830798842012882,
-0.01903526484966278,
0.007185901515185833,
0.012950530275702477,
-0.010798177681863308,
-0.0... | 0.813448 | 0.787289 | 0.026158 |
You are tasked with creating an R script that will take a list of numbers as input and return the sum of all the even numbers in the list. You need to write a function that can handle a list of any length and return the sum of all the even numbers present in the list. | glaive | [
0.018452446907758713,
0.022727683186531067,
-0.033986881375312805,
-0.05283151566982269,
0.04669791832566261,
-0.017355242744088173,
-0.013533496297895908,
0.038636621087789536,
0.04589305445551872,
-0.016209380701184273,
0.0039331200532615185,
0.0574348084628582,
-0.034094564616680145,
-0... | 0.805744 | 0.780251 | 0.025493 |
You are tasked with creating a function that takes an integer 'a' as input and returns the number of iterations it takes to reach the maximum integer value in the JVM. The function should use a loop to increment a counter 'n' until the value of 'a' reaches the maximum integer value (Int.MAX_VALUE).
Create a function ... | glaive | [
0.04739838093519211,
0.03293454274535179,
-0.021907148882746696,
-0.02366838976740837,
0.04024985432624817,
-0.026372358202934265,
-0.041877951472997665,
0.05654266104102135,
0.026415694504976273,
-0.005628099199384451,
0.025650152936577797,
0.0481809563934803,
-0.026035960763692856,
0.015... | 0.825992 | 0.787927 | 0.038066 |
You are tasked with implementing a hierarchical three-phase prefix-scan using CUDA. The goal is to parallelize the scan operation on a large input array and optimize its performance. The input array size is defined by INPUT_SIZE, and it is assumed to be a multiple of SECTION_SIZE. The hierarchical scan involves three m... | glaive | [
0.007416960317641497,
0.04248516261577606,
-0.03169461339712143,
-0.034394409507513046,
0.021618543192744255,
0.0029634025413542986,
-0.017883921042084694,
0.09616176784038544,
0.05023982375860214,
-0.012654080055654049,
0.034216105937957764,
0.019891342148184776,
-0.0012775802752003074,
-... | 0.804246 | 0.78228 | 0.021966 |
You are tasked with implementing a frequency hashmap used to select the top-k frequency edges of each node in a graph. The frequency hashmap should be able to handle a large number of edges and efficiently select the top-k frequency edges for each node. The frequency hashmap will be used to count the frequency of edges... | glaive | [
0.02390148863196373,
0.0205061174929142,
-0.02474089153110981,
-0.009562192484736443,
0.02467665821313858,
-0.03091161698102951,
-0.01596665196120739,
0.05502241104841232,
0.009201141074299812,
-0.004344180691987276,
0.0334378145635128,
0.01669587381184101,
-0.008885770104825497,
0.0208730... | 0.820157 | 0.788175 | 0.031981 |
You are tasked with creating a C# program that calculates the area of a circle given its radius. The formula to calculate the area of a circle is A = πr^2, where A is the area and r is the radius. Your program should take the radius as input and output the calculated area.
Create a C# program that accomplishes the fol... | glaive | [
-0.002348852576687932,
0.04568095505237579,
-0.026643168181180954,
-0.03298724815249443,
0.019406188279390335,
-0.03745484724640846,
-0.019092444330453873,
0.08206964284181595,
0.04756089672446251,
-0.013211170211434364,
0.015497750602662563,
0.03580079972743988,
-0.04051301255822182,
-0.0... | 0.772699 | 0.746626 | 0.026073 |
You are tasked with creating a program to determine the winner of a game played between two players, Alice and Bob. The game starts with a pile of n stones, and both players take turns making moves. Each move consists of removing any non-zero square number of stones from the pile. If a player cannot make a move, they l... | glaive | [
0.03822683170437813,
0.03875447064638138,
-0.043761033564805984,
-0.03175815939903259,
0.01931409165263176,
-0.03483760729432106,
-0.025048330426216125,
0.07087328284978867,
0.03572103753685951,
-0.02189124934375286,
0.024615401402115822,
0.031702227890491486,
-0.03087744116783142,
-0.0333... | 0.845637 | 0.782778 | 0.062859 |
You are tasked with implementing a multi-attribute Bayesian optimization algorithm for a decision-maker to choose the best design from a set of feasible options. Each design is associated with a vector of attributes that can be evaluated via a time-consuming computer code, and each vector of attributes is assigned a ut... | glaive | [
0.003960775211453438,
0.0031731915660202503,
-0.035711370408535004,
-0.02053655870258808,
0.028076745569705963,
-0.0164815541356802,
-0.04190073162317276,
0.07180424779653549,
0.039479874074459076,
-0.007546153850853443,
0.0075315251015126705,
0.031001180410385132,
-0.006383384112268686,
0... | 0.79586 | 0.771354 | 0.024506 |
You have been tasked with implementing a continuation passing style (CPS) program that acts as a boolean satisfiability (SAT) solver. The solver will take a boolean expression in normal form and try all possible combinations of variable values to determine if the expression is satisfiable. If the expression evaluates t... | glaive | [
0.008290926925837994,
0.016093118116259575,
-0.03596019744873047,
-0.022318871691823006,
0.04535616189241409,
-0.025438550859689713,
0.008302791975438595,
0.06143345311284065,
0.04461931064724922,
-0.024498071521520615,
0.020479265600442886,
0.04944545403122902,
-0.005080859642475843,
-0.0... | 0.813257 | 0.797357 | 0.0159 |
You are tasked with creating a module in Elixir that implements a function to calculate 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.
Write a function called factorial that takes an integer as input and returns the factorial ... | glaive | [
0.03602449223399162,
0.023597637191414833,
-0.01716337352991104,
-0.03448762744665146,
0.03867697715759277,
-0.04650217667222023,
-0.02315044216811657,
0.03792974725365639,
0.04559868201613426,
-0.016148094087839127,
0.01748226396739483,
0.04891379922628403,
-0.033368926495313644,
-0.01942... | 0.803795 | 0.782883 | 0.020913 |
You are tasked with creating a Python function that calculates the distance traveled by a cardboard box thrown "up the table" along an inclined surface. The initial velocity of the box is 1.20 m/s, the angle between the table and the horizontal is 5.00 degrees, and the coefficient of kinetic friction between the box an... | glaive | [
-0.0020897442009299994,
0.03523283824324608,
-0.03177185356616974,
-0.03196128457784653,
0.058279283344745636,
-0.014929177239537239,
-0.03359312564134598,
0.06320082396268845,
0.04268726333975792,
0.00788661278784275,
0.024379044771194458,
0.028642768040299416,
-0.03225061669945717,
0.021... | 0.788657 | 0.773345 | 0.015312 |
You are tasked with writing a program that takes two real numbers x and y as input and verifies if the equation (x + 4)^2 + (y-3)^2 = 5^2 holds true. The program should output a boolean value indicating whether the equation is satisfied or not. | glaive | [
0.034667640924453735,
0.028867298737168312,
-0.06022745370864868,
-0.0423336997628212,
0.04396454989910126,
-0.03799548000097275,
0.01394836325198412,
0.08988799899816513,
0.05403652414679527,
-0.035225581377744675,
0.026446424424648285,
0.05073921009898186,
-0.005832336843013763,
-0.03441... | 0.821897 | 0.789679 | 0.032218 |
You are tasked with implementing a function that takes in a one-dimensional array and performs a specific operation on it. The operation involves distributing the elements of the array in a semi-one-dimensional manner, where each element is distributed to its immediate neighbors. For example, if the input array is [1, ... | glaive | [
0.00705464743077755,
0.055837731808423996,
-0.025209154933691025,
-0.027349069714546204,
0.043649185448884964,
-0.010427902452647686,
-0.036808162927627563,
0.06381944566965103,
0.038937829434871674,
-0.0026327769737690687,
0.020781684666872025,
0.038276009261608124,
-0.03316161781549454,
... | 0.817954 | 0.770564 | 0.04739 |
You are tasked with implementing a GPU parallelized algorithm for graph clustering using CUDA. The goal is to partition a large graph into multiple smaller partitions and run clustering algorithms on each partition in parallel to improve performance. You need to create functions that can handle single GPU runs, paralle... | glaive | [
0.011013761162757874,
0.03632663935422897,
-0.019573582336306572,
-0.007642295677214861,
0.020336847752332687,
0.0040384260937571526,
-0.0449632965028286,
0.07032202184200287,
0.03483017534017563,
-0.0143118966370821,
0.009297729469835758,
0.025202346965670586,
0.007399177644401789,
0.0183... | 0.789924 | 0.768936 | 0.020989 |
You are tasked with implementing the labeled transition rules of the finite $\pi$-calculus as Haskell programs. The transition rules define the operational semantics of the $\pi$-calculus, specifying how processes evolve through various actions and interactions.
The rules cover the behavior of processes such as the |N... | glaive | [
0.012992982752621174,
0.020246217027306557,
-0.007034583017230034,
-0.01899101957678795,
0.04103139415383339,
-0.018519436940550804,
-0.022357240319252014,
0.0489489771425724,
0.03378066048026085,
-0.015185441821813583,
0.02799062989652157,
0.020410332828760147,
-0.014456817880272865,
-0.0... | 0.805474 | 0.788617 | 0.016857 |
You are tasked with implementing a GPU sgemm (matrix-matrix multiplication) algorithm using C++ and CUDA. The goal is to write a function that takes the dimensions of two matrices (matArow, matAcol, matBcol) and performs matrix multiplication using the sgemm algorithm on the GPU. The function must generate input data, ... | glaive | [
0.014490872621536255,
0.03406304121017456,
-0.026169447228312492,
-0.04782047122716904,
0.030369019135832787,
-0.013164167292416096,
-0.054292935878038406,
0.10035912692546844,
0.02088232897222042,
-0.032329101115465164,
0.016712117940187454,
0.029953287914395332,
0.0011508443858474493,
-0... | 0.796539 | 0.775759 | 0.02078 |
You are tasked with implementing a Fortran-95 program that uses the Mersenne Twister algorithm to generate random numbers. The program should define a module called MersenneTwister, which contains a type called randomNumberSequence that represents the state variable for the random number generator. The module should al... | glaive | [
0.007506197784096003,
0.014757640659809113,
-0.006098587065935135,
-0.033197298645973206,
0.025690600275993347,
-0.017515860497951508,
-0.014391057193279266,
0.06730199605226517,
0.022085849195718765,
-0.012694047763943672,
0.014124343171715736,
0.03506755828857422,
-0.03330571576952934,
-... | 0.804878 | 0.7746 | 0.030278 |
You are required to implement a routine that tests the least squares driver routines DGELS, DGELSS, DGELSX, DGELSY and DGELSD. The tests are to be conducted on matrices of various types, generated as follows:
- Type 1: A = U*D*V where U and V are random orthogonal matrices and D has random entries (> 0.1) taken from a ... | glaive | [
-0.004442221485078335,
0.019463106989860535,
-0.031769149005413055,
-0.050651855766773224,
0.03271379694342613,
-0.013692907989025116,
-0.004632891621440649,
0.06850199401378632,
0.028340531513094902,
-0.02194051258265972,
0.005116808228194714,
0.03917188569903374,
-0.003758695675060153,
-... | 0.806262 | 0.788994 | 0.017269 |
You are tasked with creating a VHDL module for a digital circuit that implements a 4-bit binary adder. The module should have two 4-bit input ports (A and B) and one 4-bit output port (Sum). The Sum output should display the result of adding the A and B inputs together. Additionally, the module should have a Carry_out ... | glaive | [
0.014358445070683956,
0.028741082176566124,
-0.019094044342637062,
-0.023458285257220268,
0.04366503283381462,
-0.01984233409166336,
-0.026065103709697723,
0.06828111410140991,
0.05869811400771141,
-0.0086324168369174,
0.005745284724980593,
0.04904930666089058,
-0.0020392793230712414,
-0.0... | 0.794704 | 0.77936 | 0.015344 |
I want to find the most significant DWORD which isn't equal to 0 in an DWORD array. The algorithm should be optimized for data sizes up to 128 byte. I've made three different functions, which all return the index of the specific DWORD. Does anybody know a better algorithm?
```c++
unsigned long msb_msvc(long* dw, std::... | glaive | [
0.010729307308793068,
0.022865526378154755,
-0.021709952503442764,
-0.030792921781539917,
0.0282609723508358,
-0.026652362197637558,
-0.025155071169137955,
0.09860637038946152,
0.039440155029296875,
-0.019372638314962387,
0.04247219115495682,
0.03229164332151413,
-0.018342789262533188,
-0.... | 0.81049 | 0.788606 | 0.021884 |
You are tasked with implementing a CUDA kernel for calculating the chamfer distance between two sets of points in 2D space. The distance is calculated between each point in the first set and its nearest neighbor in the second set. The input to the CUDA kernel includes the number of batches (b), the number of points in ... | glaive | [
0.007475486025214195,
0.04438401013612747,
-0.026122380048036575,
-0.01847345009446144,
0.027406269684433937,
-0.007899012416601181,
-0.039878781884908676,
0.08039659261703491,
0.04706084355711937,
-0.02224344201385975,
0.032063793390989304,
0.04338474199175835,
-0.010773765854537487,
0.01... | 0.81287 | 0.78016 | 0.03271 |
You are tasked with creating a program that calculates the probability of a quantum state given a set of amplitudes and then visualizes the probability distribution in 3D and as a contour plot. The amplitudes are defined by the functions `amplitude[x_,y_]` and `amplitude2[x_,y_]`, and the probability is calculated by t... | glaive | [
-0.0022878278978168964,
0.030406028032302856,
-0.03296557068824768,
-0.02720830775797367,
0.03775474801659584,
-0.02373291179537773,
-0.012854796834290028,
0.07163847237825394,
0.04758837819099426,
0.009957220405340195,
0.025139473378658295,
0.03793146088719368,
-0.015798669308423996,
-0.0... | 0.790362 | 0.765221 | 0.025141 |
You are tasked with creating a function in Mathematica that implements the "FlipTensorOrientation" functionality. The function should take in a tensor and either a permutation or a flip, and then perform the appropriate operation on the tensor to flip or permute its internal orientation. The permutation can be any perm... | glaive | [
0.01806456968188286,
0.024623295292258263,
-0.014334958977997303,
-0.05399031937122345,
0.02163160778582096,
0.00027234270237386227,
-0.009470508433878422,
0.059119999408721924,
0.032657139003276825,
-0.003992785234004259,
-0.004509301390498877,
0.029275579378008842,
-0.016575835645198822,
... | 0.791122 | 0.770099 | 0.021023 |
I want to create a double-ended queue (deque) data structure in F# that supports the following operations:
1. Add an element to the beginning of the deque
2. Get the first element of the deque
3. Get a new deque with all the elements except the last one
4. Check if the deque is empty
5. Get the last element of the dequ... | glaive | [
0.03251955658197403,
0.008315506391227245,
-0.025155246257781982,
-0.04103926569223404,
0.020751193165779114,
-0.03127380460500717,
-0.015235156752169132,
0.07955121248960495,
0.041697803884744644,
-0.0020234088879078627,
0.02712167426943779,
0.015841122716665268,
-0.04028870537877083,
-0.... | 0.817436 | 0.800544 | 0.016893 |
You are tasked with creating a CUDA program to perform vector addition on two arrays of floating-point numbers. The program should use the CUDA framework and technology. The program needs to allocate memory on the host and device, initialize the arrays, transfer data from host to device memory, perform the vector addit... | glaive | [
0.0042163049802184105,
0.044951487332582474,
-0.015316586941480637,
-0.01628594845533371,
0.031061256304383278,
-0.006917501334100962,
-0.02875710278749466,
0.09922688454389572,
0.04614479839801788,
-0.028700953349471092,
0.007147353142499924,
0.03987204656004906,
-0.0013290412025526166,
-... | 0.79235 | 0.777174 | 0.015177 |
You are tasked with writing a program to estimate the condition number of a matrix using the ZPTCON function. The ZPTCON function calculates an estimate of the reciprocal of the condition number of a Hermitian packed matrix. Your task is to implement the ZPTCON function in a programming language of your choice and use ... | glaive | [
0.025684304535388947,
0.013442855328321457,
-0.03493611514568329,
-0.03548979386687279,
0.05183782801032066,
-0.019890259951353073,
0.0031643772963434458,
0.05694146081805229,
0.03352515771985054,
-0.020289674401283264,
-0.003254700219258666,
0.04229128733277321,
-0.0336962565779686,
0.010... | 0.807713 | 0.788381 | 0.019332 |
You are tasked with implementing a simulation of an irregular butterfly network using the given framework and technology. The irregular butterfly network has 16 ingress ports, 4 stages, and each stage has a different number of switches. The simulation should run for a maximum of 1000 cycles and at each cycle, the netwo... | glaive | [
0.004478521179407835,
0.02258545532822609,
-0.024285057559609413,
-0.01975838653743267,
0.027886519208550453,
-0.011272302828729153,
-0.028372617438435555,
0.07035651057958603,
0.03365304321050644,
-0.014190581627190113,
0.02969464473426342,
0.03999503329396248,
-0.01557095069438219,
-0.00... | 0.794012 | 0.77807 | 0.015942 |
You are tasked with implementing a program that prints timing metrics for a given array of elements. The program should calculate the average, standard deviation, and throughput across multiple runs of the algorithm. The input will consist of an array of elements of type uint64_t or uint32_t, and the output should disp... | glaive | [
0.016522709280252457,
0.015842188149690628,
-0.031264252960681915,
-0.019918134436011314,
0.030808910727500916,
-0.009772866033017635,
-0.059839311987161636,
0.08993513137102127,
0.048736829310655594,
-0.007666297722607851,
0.02789399027824402,
0.016893867403268814,
-0.0009379296097904444,
... | 0.799964 | 0.778332 | 0.021632 |
You are tasked with creating a program for the "Lights Out" logic game. The game consists of a grid of lights, and the objective is to turn all the lights off. When a light is clicked, it toggles the state of that light as well as the lights above, below, to the left, and to the right of it. Your program should simulat... | glaive | [
0.0017553309444338083,
0.023035842925310135,
-0.04047679528594017,
-0.03246906399726868,
0.033326443284749985,
-0.057494208216667175,
-0.015675319358706474,
0.06143046170473099,
0.05362103506922722,
-0.033835988491773605,
0.028474994003772736,
0.03782948479056358,
-0.01324089989066124,
-0.... | 0.805458 | 0.787458 | 0.018 |
You are tasked with implementing a program that calculates the maximum probability of a quantum state for a given set of parameters. The program should be able to plot the 3D probability function and generate a contour plot for visualization.
The quantum state is defined by the following functions:
- `amplitude[x_,y_]... | glaive | [
0.003626858117058873,
0.030555829405784607,
-0.03143275901675224,
-0.02532917819917202,
0.040896400809288025,
-0.014327339828014374,
-0.013582193292677402,
0.07189087569713593,
0.04036085307598114,
0.00653010793030262,
0.03004097379744053,
0.042055509984493256,
-0.009642737917602062,
-0.00... | 0.795458 | 0.766646 | 0.028812 |
You are tasked with creating a program that generates random guesses for different data types and structures. The program should include functions to generate boolean, character, integer, float, string, and instruction guesses, as well as functions for generating Plush genes, bb8 genes, and bb8 genomes. Each function s... | glaive | [
0.002339391503483057,
0.012543164193630219,
-0.019773906096816063,
-0.022354939952492714,
0.036698855459690094,
-0.0470283217728138,
-0.03875304386019707,
0.0487881563603878,
0.0510677732527256,
-0.0267584677785635,
0.013058224692940712,
0.04634521156549454,
-0.024585915729403496,
-0.00220... | 0.797544 | 0.778565 | 0.018978 |
You are tasked with creating a program that calculates the area of a rectangle. The user should be prompted to input the length and width of the rectangle, and the program should then calculate and display the area. Ensure that the program handles invalid inputs gracefully and provides appropriate error messages. | glaive | [
0.015593412332236767,
0.046740978956222534,
-0.0447499044239521,
-0.03037228062748909,
0.024807816371321678,
-0.017908088862895966,
-0.026745887473225594,
0.05770137161016464,
0.04529120773077011,
-0.015561878681182861,
0.029360055923461914,
0.04404110834002495,
-0.02532527782022953,
-0.02... | 0.782402 | 0.763951 | 0.018451 |
You are tasked with creating a Rust program that implements a weighted graph using the `petgraph` library. The graph will consist of nodes and edges, with each edge having an associated weight. Your program should be able to perform the following tasks:
1. Create an undirected graph with integer nodes and edges with no... | glaive | [
0.005676304921507835,
0.031414978206157684,
-0.014144022017717361,
-0.02962711825966835,
0.03074178285896778,
-0.03503545746207237,
-0.019383447244763374,
0.06368666142225266,
0.039158061146736145,
-0.021558968350291252,
0.03981368616223335,
0.025781944394111633,
-0.007588469423353672,
-0.... | 0.816877 | 0.798113 | 0.018764 |
You are tasked with implementing a C++ class `CudaMatrixOperator` that operates on sparse matrices using CUDA technology. The class should have member functions to perform matrix operations such as apply, transpose, matrix-matrix multiplication, and matrix-vector multiplication.
Your task is to implement the following... | glaive | [
0.01870126649737358,
0.03652786463499069,
-0.017254214733839035,
-0.023175828158855438,
0.04976106062531471,
-0.008933714590966702,
-0.027367275208234787,
0.10197732597589493,
0.056552059948444366,
-0.012652439065277576,
0.015097526833415031,
0.031426459550857544,
-0.0027311763260513544,
-... | 0.791906 | 0.768854 | 0.023052 |
You have been provided with a dataset in a CSV file called 'path'. The data has been loaded into a numpy array called 'data' using the 'np.genfromtxt' function. You have also been given a new record in the form of a list called 'new_record', which needs to be added to the 'data' array to create a new numpy array called... | glaive | [
-0.011490391567349434,
0.01660642772912979,
-0.04722938686609268,
-0.019729116931557655,
0.0328039713203907,
-0.023503059521317482,
-0.025497503578662872,
0.0632309839129448,
0.03649602830410004,
0.0018522307509556413,
0.03657543659210205,
0.014232487417757511,
-0.004578045569360256,
0.001... | 0.810718 | 0.788169 | 0.022548 |
You are tasked with creating a program that will take in a list of numbers and return the average of all the numbers in the list. The program should prompt the user to enter the list of numbers, then calculate the average and display it to the user. | glaive | [
0.02092168852686882,
0.019134042784571648,
-0.04908313229680061,
-0.056131865829229355,
0.06093418970704079,
-0.038147032260894775,
-0.029160521924495697,
0.036271847784519196,
0.03264801204204559,
-0.024905633181333542,
0.016765009611845016,
0.0372827984392643,
-0.039161864668130875,
-0.0... | 0.790411 | 0.766584 | 0.023827 |
You are tasked with creating a SQL query that uses a recursive common table expression (CTE) to generate a sequence of numbers based on user input. The query should take three parameters: starting value, increment value, and the maximum number of iterations. The output should be the final value in the sequence.
Write ... | glaive | [
0.0462660975754261,
0.03775391727685928,
-0.026951782405376434,
-0.02461021952331066,
0.02406301535665989,
-0.027921905741095543,
-0.02211267314851284,
0.06869444251060486,
0.036530062556266785,
-0.015693044289946556,
0.03550078719854355,
0.02746940776705742,
-0.048262253403663635,
0.01986... | 0.80705 | 0.773345 | 0.033705 |
You are tasked with implementing a parallel GPU algorithm for performing winner-takes-all (WTA) computation on disparity maps in the context of stereo matching. The WTA algorithm involves determining the best matching disparity for each pixel based on cost values calculated for different disparity levels.
Your task is... | glaive | [
0.0032420302741229534,
0.03831829875707626,
-0.020059186965227127,
-0.027418620884418488,
0.013889272697269917,
0.010260903276503086,
-0.032501913607120514,
0.07912331819534302,
0.04964243620634079,
-0.02499905228614807,
0.03272514417767525,
0.033014703541994095,
0.010347275994718075,
0.01... | 0.805531 | 0.780665 | 0.024866 |
You are required to write a program that finds the maximum value of a given function and then performs a NMaximize operation on the function using the obtained maximum value. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[11 I y/2] (1 (-I Sin[x])^5 Cos[x]^7 + ... + 1 (-I Sin[x])^3 Cos[x]^9 + 1 (... | glaive | [
0.02174834907054901,
0.021734241396188736,
-0.04584542289376259,
-0.02807602286338806,
0.04122578352689743,
-0.02066652476787567,
-0.028611350804567337,
0.055587150156497955,
0.04076901823282242,
0.01620420254766941,
0.030177723616361618,
0.05382605642080307,
-0.04090022295713425,
-0.00007... | 0.798319 | 0.768175 | 0.030144 |
You are tasked with implementing a program to calculate the score and negative Hessian for a given set of parameters and data. The program should take in the following arguments: todo (a flag indicating whether to calculate the score and negative Hessian or just the negative log-likelihood), b (the parameters), lnf (th... | glaive | [
-0.018550267443060875,
-0.000030033508664928377,
-0.0366801880300045,
-0.028999660164117813,
0.04326224699616432,
-0.04061366990208626,
-0.029583759605884552,
0.050491124391555786,
0.03424850106239319,
-0.019201282411813736,
0.0037803754676133394,
0.03557907044887543,
-0.0384860523045063,
... | 0.798589 | 0.780928 | 0.017661 |
You are tasked with creating a program that will generate a hash map and insert a large number of key-value pairs into it. The program should then print out the number of map inserts that were performed.
You should write a function that takes in a list of strings and returns a hash map with the string as the key and i... | glaive | [
0.04139246791601181,
0.025026975199580193,
-0.027612948790192604,
-0.018032321706414223,
0.04248424619436264,
-0.018586263060569763,
-0.03052070550620556,
0.0688779205083847,
0.03580773249268532,
-0.014639589004218578,
0.0118331890553236,
0.037009283900260925,
-0.0310685858130455,
-0.01581... | 0.813444 | 0.795697 | 0.017746 |
You are tasked with writing a program that performs a series of operations on a given memory address in assembly language. The program must first move the value 1024 into the memory address, then move the value -1 into the next 2 bytes of the memory address. After this, the program should load a word from the memory ad... | glaive | [
0.04209429770708084,
0.028595026582479477,
-0.01282169483602047,
-0.021743815392255783,
0.024853656068444252,
-0.04197312146425247,
-0.012227109633386135,
0.0742446556687355,
0.04802703857421875,
-0.014650397002696991,
0.0258150827139616,
0.030730467289686203,
-0.04571225121617317,
-0.0137... | 0.802325 | 0.78632 | 0.016006 |
You are tasked with implementing the Damerau-Levenshtein distance algorithm in Python. The Damerau-Levenshtein distance is a variation of the Levenshtein distance, with the addition of transposition in the set of basic operations. This algorithm is used to measure the similarity between two strings, taking into account... | glaive | [
-0.0059083206579089165,
0.016993574798107147,
-0.007209506817162037,
-0.045654214918613434,
0.03552636131644249,
-0.009976147674024105,
-0.009529405273497105,
0.04902926832437515,
0.046037882566452026,
-0.012554422952234745,
0.01956234872341156,
0.03752113878726959,
-0.022182105109095573,
... | 0.805148 | 0.774743 | 0.030405 |
You are tasked with optimizing a complex mathematical function in a given range using the NMaximize function in Mathematica. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[...] + ... + Exp[...] + ...]
You need to find the maximum value of the real part of the function multiplied by the number ... | glaive | [
0.03287987783551216,
0.03894287720322609,
-0.039609406143426895,
-0.037844158709049225,
0.03281885012984276,
-0.021516473963856697,
-0.022695550695061684,
0.07813633978366852,
0.03667246550321579,
0.007000297773629427,
0.002934935037046671,
0.03825772553682327,
-0.02742510288953781,
0.0036... | 0.796415 | 0.764842 | 0.031573 |
You are tasked with implementing a subroutine in Fortran called dlwqd1. The subroutine is responsible for the implicit solution of the vertical by double sweep, central discretisation of the advection terms in the water, and upwind discretisation of the advection terms in the bed. The subroutine should also handle the ... | glaive | [
-0.01873370260000229,
0.01804765686392784,
-0.010878217406570911,
-0.04619485139846802,
0.03081572987139225,
-0.009320061653852463,
-0.01543890405446291,
0.06372494995594025,
0.027205776423215866,
0.004928063601255417,
0.019220998510718346,
0.04503137245774269,
-0.011603672057390213,
0.003... | 0.797505 | 0.781753 | 0.015752 |
You are tasked with creating a program that manipulates a list of numbers. The program should be able to extract a sub-list of numbers between the indices 3 and 6, and also create a copy of the original list.
Write a program that takes a list of numbers as input and outputs the sub-list of numbers between indices 3 a... | glaive | [
0.03152552619576454,
0.021477695554494858,
-0.03000873513519764,
-0.021365493535995483,
0.05694745108485222,
-0.028731659054756165,
-0.02108326368033886,
0.05023184046149254,
0.0245272908359766,
-0.03149592876434326,
0.03274763375520706,
0.06595604121685028,
-0.053913477808237076,
-0.03081... | 0.82136 | 0.790846 | 0.030514 |
You are tasked with implementing a program to generate the sequence A099925. The sequence is defined as follows: a(n) = Lucas(n) + (-1)^n, where Lucas(n) represents the n-th number in the Lucas number sequence and (-1)^n represents the alternating sign. The first few terms of the sequence are: 3, 0, 4, 3, 8, 10, 19, 28... | glaive | [
0.01247697789222002,
0.03883060812950134,
-0.008775932714343071,
-0.0386936292052269,
0.020077597349882126,
-0.02980741299688816,
-0.020558394491672516,
0.06293847411870956,
0.014505420811474323,
-0.006103469990193844,
0.031239783391356468,
0.025436120107769966,
-0.04921367019414902,
-0.00... | 0.820218 | 0.763242 | 0.056976 |
You are tasked with creating a program that calculates the probability of a quantum state in a system of 16 qubits. The amplitude of the quantum state is given by the function `amplitude[x,y]`, and the probability is calculated using the function `probability[x,y]`, where `x` and `y` are the input variables. You need t... | glaive | [
-0.003459255676716566,
0.03266448900103569,
-0.030764611437916756,
-0.015603202395141125,
0.051691681146621704,
-0.01989475078880787,
-0.02308906428515911,
0.06716319173574448,
0.03380189836025238,
-0.0033748194109648466,
0.028552059084177017,
0.037183333188295364,
-0.005189316347241402,
-... | 0.800008 | 0.76592 | 0.034088 |
You are tasked with implementing a post-processing algorithm to convert continuous weights into an actionable allocation for portfolio optimization. The goal is to allocate a given total portfolio value among a list of assets based on their optimal weights, but since assets come in discrete units, it is not trivial to ... | glaive | [
0.017603900283575058,
0.026581084355711937,
-0.032327890396118164,
-0.029012242332100868,
0.024918638169765472,
-0.02812347374856472,
-0.02384207397699356,
0.06705428659915924,
0.01739666610956192,
-0.023838959634304047,
0.026759156957268715,
0.026009252294898033,
-0.015285148285329342,
-0... | 0.798969 | 0.780611 | 0.018358 |
I want to create a function that takes a finite set of elements and returns the maximum element according to a given ordering. The function should work for any type of elements and any type of ordering (as long as the ordering is a total order, meaning that any two elements can be compared). The function should return ... | glaive | [
0.05871743708848953,
0.017690308392047882,
-0.047776151448488235,
-0.0328143909573555,
0.027955828234553337,
-0.03460734710097313,
-0.022146910429000854,
0.052091047167778015,
0.022159535437822342,
-0.00704972492530942,
0.02965458855032921,
0.04175331071019173,
-0.027277635410428047,
-0.00... | 0.805353 | 0.78392 | 0.021434 |
You are tasked with creating a function in Scheme called "calculate-area" that takes in the radius of a circle as a parameter and returns the area of the circle. The formula for calculating the area of a circle is A = πr^2, where π (pi) is a constant approximately equal to 3.14159. You are not allowed to use the built-... | glaive | [
0.025610771030187607,
0.0493793785572052,
-0.03331875801086426,
-0.03425679728388786,
0.034775134176015854,
-0.024285288527607918,
-0.030377259477972984,
0.04918474704027176,
0.03376469016075134,
0.006746813654899597,
0.02788783796131611,
0.04327066242694855,
-0.02000766433775425,
-0.00571... | 0.762452 | 0.746136 | 0.016315 |
You are tasked with implementing a function in a programming language that supports group operations. The function should take two arguments, a group element `a` and a group element `b`, and return the result of the operation `a * b` followed by the operation `a * b⁻¹`. You need to ensure that the function is correct a... | glaive | [
0.047929756343364716,
0.04447060078382492,
-0.049763865768909454,
-0.04955669492483139,
0.046423524618148804,
-0.036392517387866974,
-0.01809553988277912,
0.07606370002031326,
0.04840841889381409,
-0.005132630933076143,
0.0156354159116745,
0.04111308977007866,
-0.013605835847556591,
-0.019... | 0.81533 | 0.795169 | 0.020161 |
You are tasked with implementing a function to decide strict inequality for natural numbers. The function should take two natural numbers as input and return a Decidable value, indicating whether the first number is strictly less than the second. You need to define this function from scratch, without referencing any ex... | glaive | [
0.02285587042570114,
0.017002828419208527,
-0.038306593894958496,
-0.03048803098499775,
0.041674621403217316,
-0.010553465224802494,
-0.010309386998414993,
0.0844227597117424,
0.04480559006333351,
-0.02194448933005333,
0.02490321733057499,
0.021704113110899925,
-0.02623305283486843,
-0.022... | 0.814933 | 0.794952 | 0.019981 |
You are tasked with creating a program to calculate the probability of a quantum state using a given amplitude function and then visualize the probability distribution in a 3D plot and contour plot. The amplitude function is defined as follows:
amplitude[x_,y_] := (Exp[-15 I y] (1 (I Sin[x])^9 Cos[x]^7 + 1 (I Sin[x])^... | glaive | [
0.009371437132358551,
0.02939528226852417,
-0.037570107728242874,
-0.03255460411310196,
0.03560455143451691,
-0.027035679668188095,
-0.01831958256661892,
0.07102842628955841,
0.04483224079012871,
0.011086330749094486,
0.03193536028265953,
0.031098878011107445,
-0.01887066476047039,
-0.0114... | 0.782804 | 0.754718 | 0.028086 |
You are tasked with implementing a data type in OCaml to represent non-negative integers using the following constructors:
- Coq_xI of positive
- Coq_xO of positive
- Coq_xH
Your task is to define the 'positive' type and the 'coq_N' type, and then implement a function to convert a non-negative integer to this data ty... | glaive | [
0.007046442478895187,
0.006977619603276253,
-0.03275402635335922,
-0.048635054379701614,
0.02568628080189228,
-0.026316890493035316,
-0.0004034150333609432,
0.05481624975800514,
0.05183856189250946,
-0.030352694913744926,
0.0268100518733263,
0.048733189702034,
0.00031176346237771213,
-0.02... | 0.807821 | 0.791133 | 0.016688 |
How can I count the number of inversions in an array using an algorithm? | glaive | [
0.010005422867834568,
0.019933275878429413,
-0.020971754565835,
-0.021620459854602814,
0.028138628229498863,
-0.028051357716321945,
-0.03962010517716408,
0.05181298404932022,
0.01360477227717638,
-0.025291357189416885,
0.01004868745803833,
0.013334108516573906,
-0.027755139395594597,
-0.02... | 0.804278 | 0.775215 | 0.029063 |
How can I create a program in C++ that finds the smallest and largest number in an array of integers? | glaive | [
0.01008297223597765,
0.034150637686252594,
-0.029430042952299118,
-0.036522869020700455,
0.043354179710149765,
-0.01079677976667881,
-0.027244266122579575,
0.07403378933668137,
0.031830690801143646,
-0.03324258700013161,
0.029157374054193497,
0.04548904672265053,
-0.03427321836352348,
-0.0... | 0.801312 | 0.774291 | 0.027022 |
You are tasked with creating a function that takes a string as input and returns a reversed list of words in the string. The function should split the input string based on spaces, reverse the order of the words, and return the result as a list.
Write a function named `reverseWords` that takes a string `s` as input an... | glaive | [
0.02417796663939953,
0.03552837297320366,
-0.00219768937677145,
-0.038920339196920395,
0.038162410259246826,
-0.03164410963654518,
-0.031122254207730293,
0.04319720342755318,
0.04614082723855972,
0.003978928551077843,
0.003558488329872489,
0.03528063744306564,
-0.037140119820833206,
-0.019... | 0.784556 | 0.76384 | 0.020716 |
Write a function in a programming language that takes a natural number as input and returns a pair consisting of the input number and a function. The function should take another natural number as input and return a string representation of a list containing the original input number incremented by 1 to 8. | glaive | [
0.02388422004878521,
0.019798453897237778,
-0.023624811321496964,
-0.041895702481269836,
0.04457315057516098,
-0.018154941499233246,
-0.027094164863228798,
0.06107930466532707,
0.032044779509305954,
-0.01918116770684719,
0.01433059573173523,
0.044525109231472015,
-0.045255981385707855,
-0.... | 0.8265 | 0.801199 | 0.025301 |
You are tasked with creating a program to analyze the results of a Kaggle competition. Your program should read in a list of accuracy scores from the competition leaderboard, and then determine the number of entries with a perfect accuracy score (1.0). Additionally, your program should calculate the average accuracy sc... | glaive | [
0.004603034351021051,
0.01774422824382782,
-0.038996487855911255,
-0.04441555589437485,
0.04605881869792938,
-0.03022848628461361,
-0.028027739375829697,
0.029603956267237663,
0.030145207419991493,
-0.013683888129889965,
0.013631356880068779,
0.009207844734191895,
-0.014813591726124287,
0.... | 0.803202 | 0.785543 | 0.017659 |
You are tasked with implementing a C++ program that defines various data structures, including structs, unions, exceptions, and enums. The program should include the following data structures:
- struct0 with no fields
- union0 with no fields
- exception0 with no fields
- enum0 with no fields
- struct1 with a single fie... | glaive | [
0.005036458373069763,
-0.0018377203959971666,
-0.02924416959285736,
-0.020054342225193977,
0.03478768467903137,
-0.023709552362561226,
-0.015585926361382008,
0.10282956808805466,
0.036016374826431274,
-0.010972034186124802,
0.02088289149105549,
0.02418043091893196,
-0.009674341417849064,
-... | 0.805364 | 0.782398 | 0.022966 |
You are tasked with creating a Monoid for a custom data type called "Product". The "Product" data type has two fields: "price" of type Double and "quantity" of type Int. Your Monoid implementation should combine two "Product" instances by adding their prices and summing their quantities. Additionally, the empty element... | glaive | [
0.02001780830323696,
0.012333248741924763,
-0.03254232555627823,
-0.02770412527024746,
0.042496778070926666,
-0.028882695361971855,
-0.019213290885090828,
0.08179110288619995,
0.04097020998597145,
-0.015055556781589985,
0.012788514606654644,
0.03756382688879967,
-0.007556663826107979,
-0.0... | 0.793464 | 0.774012 | 0.019452 |
You are tasked with creating a Python script that generates a Fibonacci sequence up to a specified number. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. Your script should take an input from the user for the maximum number in the ... | glaive | [
0.01232355460524559,
0.019619464874267578,
-0.03812145069241524,
-0.022074898704886436,
0.04389412701129913,
-0.03271184861660004,
-0.029283983632922173,
0.05204387009143829,
0.03298649191856384,
-0.017415296286344528,
0.03146927431225777,
0.04986663907766342,
-0.039722882211208344,
0.0144... | 0.807099 | 0.768536 | 0.038563 |
You are required to implement a 32/32 Divider with a 16-stage pipeline in Verilog. The task is to create a module `ycr1_pipe_div` that takes the following inputs:
- `clk`: clock signal
- `rstn`: active low reset signal
- `data_valid`: input valid signal
- `Din1`: 32-bit dividend
- `Din2`: 32-bit divider
- `data_done`: ... | glaive | [
0.007410187739878893,
0.027143485844135284,
-0.02268700860440731,
-0.03332525119185448,
0.037144239991903305,
-0.029638398438692093,
-0.03542061150074005,
0.0827004611492157,
0.03630511090159416,
-0.009970656596124172,
0.04669741913676262,
0.045812107622623444,
0.0019395494600757957,
-0.00... | 0.799694 | 0.782174 | 0.01752 |
You have a dataset with multiple columns, and you want to replace the values in each column with their frequency count across the columns within each row. For example, if a row has values [100, 103, ., 100, 100], the output should be [3, 1, 1, 3, 3], indicating the frequency of each value within the row. | glaive | [
0.0036348223220556974,
0.010830499231815338,
-0.03972095251083374,
-0.028586093336343765,
0.03244879096746445,
-0.04184563457965851,
-0.017670780420303345,
0.0502873957157135,
0.041437990963459015,
-0.012153715826570988,
0.007556966971606016,
0.018775787204504013,
-0.03337378054857254,
0.0... | 0.798359 | 0.781287 | 0.017073 |
You are tasked with creating a program that will find the maximum value of a given mathematical function within a specified range. The function is defined as a series of complex exponential terms multiplied by trigonometric functions. The program should use a nested loop to iterate through the range of values for two v... | glaive | [
0.029897350817918777,
0.03765134885907173,
-0.050379883497953415,
-0.02839813567698002,
0.04084355756640434,
-0.018981250002980232,
-0.03165765106678009,
0.05724826455116272,
0.04014585167169571,
-0.005110017489641905,
0.01270262524485588,
0.04336366802453995,
-0.034806013107299805,
0.0057... | 0.804888 | 0.767333 | 0.037555 |
You are tasked with implementing a function to calculate the Lagrange interpolant for a given set of data points. The function should take in the degree of the interpolant (n), the index of the interpolant (i), and an array of data points (xData). The Lagrange interpolant is calculated using the formula:
L(x) = ∏ j in ... | glaive | [
-0.00503195496276021,
0.055215973407030106,
-0.022445229813456535,
-0.03981901705265045,
0.03648833557963371,
-0.022260505706071854,
-0.019547665491700172,
0.06127193942666054,
0.026749655604362488,
-0.013281943276524544,
0.020217282697558403,
0.03266000747680664,
-0.04477456957101822,
0.0... | 0.798529 | 0.77048 | 0.028049 |
You are required to implement a CUDA parallelized AI for the game 2048. The goal of the game is to slide numbered tiles on a grid to combine them to create a tile with the number 2048. The given code snippet includes the main function and relevant CUDA kernel functions for creating and building a game tree to find the ... | glaive | [
-0.0010969381546601653,
0.04656317085027695,
-0.004675524774938822,
-0.020626381039619446,
0.02281523123383522,
-0.0031119263730943203,
-0.024876395240426064,
0.09712974727153778,
0.03929618000984192,
-0.021123653277754784,
0.0258982814848423,
0.026723360642790794,
-0.0061728013679385185,
... | 0.804507 | 0.781583 | 0.022925 |
You are given a set of integer values represented by a multiset. You need to write a function to determine if the product of all the values in the multiset is equal to 1.
Write a function `isProductOne` that takes a multiset of integer values as input and returns true if the product of all the values in the multiset i... | glaive | [
0.02897724136710167,
0.026632243767380714,
-0.02939699962735176,
-0.023706618696451187,
0.052611637860536575,
-0.024760885164141655,
-0.013567696325480938,
0.07322299480438232,
0.026381894946098328,
-0.012801953591406345,
0.008501118049025536,
0.03461850807070732,
-0.02310066856443882,
-0.... | 0.833843 | 0.794652 | 0.039191 |
You are tasked with writing a program that takes an input, n, representing the number of integers to be entered, followed by n integers. The program should then find and output the minimum of the entered integers. | glaive | [
0.03038509003818035,
0.01626526191830635,
-0.038197435438632965,
-0.020676128566265106,
0.053546443581581116,
-0.02584647759795189,
-0.028509056195616722,
0.03793303668498993,
0.04410743713378906,
-0.02360297366976738,
0.029552243649959564,
0.040266696363687515,
-0.027417542412877083,
-0.0... | 0.833318 | 0.782926 | 0.050392 |
What is the code to find the smallest element in a given list? | glaive | [
0.0038409584667533636,
0.03464250639081001,
-0.020001595839858055,
-0.053055789321660995,
0.05184309929609299,
-0.03373751789331436,
-0.0022813756950199604,
0.04515381157398224,
0.04927117004990578,
-0.02799886092543602,
0.03228633105754852,
0.044125258922576904,
-0.014373699203133583,
-0.... | 0.79421 | 0.77956 | 0.014649 |
You are tasked with implementing a function in ACL2 that calculates the factorial of a given non-negative integer. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. Your function should take an integer as input and return the factorial of that integer. You can as... | glaive | [
0.026332246139645576,
0.028087295591831207,
-0.022507287561893463,
-0.026862844824790955,
0.03088163398206234,
-0.022830311208963394,
-0.027562065050005913,
0.052716370671987534,
0.04434967413544655,
-0.01891849935054779,
0.008444393053650856,
0.04294264689087868,
-0.04010558873414993,
-0.... | 0.804875 | 0.769068 | 0.035807 |
You are tasked with creating a program to implement the k-means algorithm for clustering data points. The algorithm involves assigning each data point to the nearest cluster center and recalculating the cluster centers based on the assigned data points. You are to implement the following steps:
1. Initialize the clust... | glaive | [
0.007026411592960358,
0.036916349083185196,
-0.045912083238363266,
-0.028938686475157738,
0.026308713480830193,
-0.02252793125808239,
-0.01155265886336565,
0.06773287802934647,
0.0514100044965744,
0.001987612573429942,
0.02104034833610058,
0.02169325016438961,
-0.009242520667612553,
0.0263... | 0.804709 | 0.781927 | 0.022782 |
I want to implement a parallel depth-first search (DFS) algorithm to solve the N-queens problem using CUDA in C. The N-queens problem involves placing N queens on an N×N chessboard in such a way that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal.... | glaive | [
0.0005395199405029416,
0.0329095795750618,
-0.03949015960097313,
-0.016654493287205696,
0.018610626459121704,
0.0068940771743655205,
-0.02250620909035206,
0.08264129608869553,
0.0308090653270483,
-0.015227903611958027,
0.030034558847546577,
0.03612994775176048,
-0.011946452781558037,
-0.01... | 0.803374 | 0.780347 | 0.023027 |
You are tasked with implementing a program that models the probability of success based on various predictors and observations. The program should include the following components:
- A function `p_quick` that calculates the probability of success based on input variables such as chance, threshold, slope, and lapse.
- A... | glaive | [
-0.010553372092545033,
0.015292723663151264,
-0.04235111176967621,
-0.033769845962524414,
0.04945364594459534,
-0.014843414537608624,
-0.029441049322485924,
0.05708295851945877,
0.03590171039104462,
-0.003689432516694069,
0.0043440815061330795,
0.02775130420923233,
-0.004900691565126181,
-... | 0.798034 | 0.782269 | 0.015765 |
You are tasked with implementing a statistical model using the Stan programming language. The model involves predicting the size of a data set based on age and other factors. You are given the following data and parameters:
- n: the number of data points
- n_pred: the number of data points to predict
- size_data: a vec... | glaive | [
0.022119134664535522,
0.019441969692707062,
-0.040921516716480255,
-0.06289540231227875,
0.04177626222372055,
-0.021172214299440384,
-0.025628123432397842,
0.07070669531822205,
0.05016522482037544,
-0.014187452383339405,
0.01657729782164097,
0.06343016773462296,
-0.02739335224032402,
0.020... | 0.806639 | 0.784875 | 0.021764 |
You are tasked with implementing a function that walks through integrals and simplifies, recursing through grammar. The function should take an expression, a name, a domain information, and optional options as input, and reduce the expression based on certain conditions. The conditions include handling different types ... | glaive | [
0.011174816638231277,
0.04522060975432396,
-0.018475418910384178,
-0.03933245316147804,
0.05569048225879669,
-0.01290874183177948,
-0.01529047079384327,
0.05763279274106026,
0.049350570887327194,
-0.0008832241292111576,
0.01436917670071125,
0.021622272208333015,
-0.01666305586695671,
-0.01... | 0.807306 | 0.782782 | 0.024525 |
I have a grid with multiple squares on it that I need to detect and travel to. The starting point is (0,0). I have to scan small regions of the grid at a time and when I detect squares that I need to travel, I travel to them. There are 32 locations on the grid but I only need to travel to 16 of them, and I need to do i... | glaive | [
-0.0026881468947976828,
0.029699744656682014,
-0.04280034825205803,
-0.023532124236226082,
0.026039840653538704,
-0.027632325887680054,
-0.03968806192278862,
0.056202322244644165,
0.03023599088191986,
-0.02590249478816986,
0.022961437702178955,
0.03161228075623512,
-0.015270081348717213,
-... | 0.805737 | 0.779679 | 0.026058 |
You are tasked with writing a function to calculate the nth number in the Fibonacci sequence. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. Your function should take an integer n as input and return the nth number in the Fibonacci... | glaive | [
0.02463807724416256,
0.028473839163780212,
-0.02931738644838333,
-0.030831605195999146,
0.05564936622977257,
-0.018722884356975555,
-0.028604397550225258,
0.059226177632808685,
0.030398061498999596,
0.006446967367082834,
0.02541768178343773,
0.022194283083081245,
-0.043309275060892105,
-0.... | 0.808963 | 0.764202 | 0.044762 |
You are tasked with implementing a program to solve a harmonic oscillator ordinary differential equation (ODE). The given ODE is defined by the following system of equations:
dy/dt = x[1] * y[2]
d^2y/dt^2 = -y[1] - theta[1] * y[2]
You are required to create a program that utilizes the Runge-Kutta 4/5 method to integrat... | glaive | [
0.01626601070165634,
0.04054533317685127,
-0.0407349169254303,
-0.03929423168301582,
0.03622870519757271,
-0.026887590065598488,
-0.018023362383246422,
0.07243283838033676,
0.046329859644174576,
-0.007480054162442684,
0.023287273943424225,
0.019918052479624748,
-0.025181105360388756,
-0.00... | 0.796513 | 0.778338 | 0.018174 |
You are tasked with creating a program to calculate the time it takes to complete a certain number of steps. The program should take in the number of steps and calculate the time it takes to complete them based on a predefined time for each step.
Write a function or method called "calculateStepTime" that takes in the ... | glaive | [
0.025780437514185905,
0.029346909373998642,
-0.02944159135222435,
-0.026524094864726067,
0.05212775990366936,
-0.020285042002797127,
-0.057427868247032166,
0.06910361349582672,
0.04000177979469299,
-0.00786422286182642,
0.03244588151574135,
0.038814883679151535,
-0.029978550970554352,
-0.0... | 0.808126 | 0.7807 | 0.027426 |
You are tasked with implementing a function that takes a boolean value and performs a series of logical operations on it. The function should take in a boolean value `x` and perform the following operations:
1. Print the result of `and x y`, and if true, print 11, else print 22.
2. Print the result of `and (##not x) y`... | glaive | [
0.023283086717128754,
0.016562968492507935,
-0.030624879524111748,
-0.015962615609169006,
0.032726678997278214,
-0.029598355293273926,
-0.030753640457987785,
0.066033735871315,
0.04759233444929123,
-0.01373325940221548,
0.029676146805286407,
0.059102483093738556,
-0.02262074500322342,
-0.0... | 0.827792 | 0.790512 | 0.03728 |
You are tasked with creating a function in Elixir that takes a string as input and returns the number of graphemes in the string. A grapheme is a single unit of a written language that can be represented as a single character in Unicode. Your function should accurately count the number of graphemes in the given string,... | glaive | [
0.006941885221749544,
0.015369227156043053,
0.009246673434972763,
-0.07306893169879913,
0.028645435348153114,
-0.04102862626314163,
-0.01253416482359171,
0.03554180637001991,
0.018914610147476196,
-0.01548285037279129,
0.014361641369760036,
0.02617684006690979,
-0.03147074207663536,
-0.031... | 0.801608 | 0.769913 | 0.031695 |
You are given an array of indices and an array of values. Your task is to reorder the values based on the sorted indices. The indices array contains the indices of the values, and the values array contains the corresponding values. You are required to implement a CUDA program to sort the indices and reorder the values ... | glaive | [
0.023402126505970955,
0.03736963868141174,
-0.02675212174654007,
-0.0000611163122812286,
0.02157294750213623,
-0.02912508137524128,
-0.03496221825480461,
0.06839083135128021,
0.050311122089624405,
-0.02272132970392704,
0.02782897651195526,
0.02372313290834427,
-0.028089061379432678,
-0.012... | 0.819975 | 0.796 | 0.023975 |
You are tasked with creating a Python program that simulates a simple Markov chain. A Markov chain is a stochastic model that describes a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.
Your program should have the following functionalities:... | glaive | [
0.024796387180685997,
0.013658363372087479,
-0.017858972772955894,
-0.04683421924710274,
0.04337432608008385,
-0.013754565268754959,
-0.029279207810759544,
0.07165655493736267,
0.0024197837337851524,
-0.025415388867259026,
0.013787103816866875,
0.035430070012807846,
-0.011905515566468239,
... | 0.794288 | 0.77357 | 0.020717 |
You are tasked with creating a program to generate a 6D simplex in N dimensions using the given code snippet as a starting point. The program should define a Model, create variables x[1:N] with values greater than or equal to 0, and add a constraint that the sum of x[i] for i=1 to N equals 1. Additionally, the program ... | glaive | [
-0.0009737322689034045,
0.03647193685173988,
-0.014790107496082783,
-0.03959032893180847,
0.04449744522571564,
-0.023803643882274628,
-0.03725145012140274,
0.05550108850002289,
0.029055994004011154,
-0.03500377759337425,
0.027679964900016785,
0.042344339191913605,
-0.02124224416911602,
-0.... | 0.815853 | 0.780033 | 0.035819 |
You are tasked with creating a program that implements a symbol table lookup function. The function should take in a symbol, an array of integers to store the symbol's data, and a pointer to the symbol table. If the symbol is found in the symbol table, the function should populate the info array with the symbol's data ... | glaive | [
0.035647448152303696,
0.019516577944159508,
-0.03765902295708656,
-0.02559240534901619,
0.036449726670980453,
-0.05507855489850044,
-0.010133816860616207,
0.07466059923171997,
0.04165779426693916,
-0.002842537360265851,
0.0050894711166620255,
0.039729051291942596,
-0.02398490533232689,
-0.... | 0.788316 | 0.769635 | 0.018681 |
You are tasked with implementing a Red-Black tree data structure in a programming language that supports comptime functions and structs. The Red-Black tree should support the following operations:
- Searching for a value in the tree
- Inserting a new value into the tree
Your task is to write the code for the Red-Black... | glaive | [
0.013047583401203156,
0.022261731326580048,
-0.026388775557279587,
-0.030500253662467003,
0.020150858908891678,
-0.03380526602268219,
-0.0004270303761586547,
0.07944826036691666,
0.037668514996767044,
-0.02153158001601696,
0.037270501255989075,
0.015129958279430866,
-0.027515405789017677,
... | 0.807091 | 0.787628 | 0.019463 |
You are tasked with creating a Fortran program that determines whether a given character is an alphabetic letter (i.e., 'A'-'Z' or 'a'-'z'). You must implement a function that takes a single character as input and returns a logical value indicating whether the character is alphabetic. You are required to use the intrin... | glaive | [
0.02109701745212078,
0.021669846028089523,
0.0022299550473690033,
-0.025981171056628227,
0.03578142076730728,
-0.026064839214086533,
0.027229223400354385,
0.07222719490528107,
0.024588951840996742,
-0.01832006871700287,
0.008328176103532314,
0.022976703941822052,
-0.01570644974708557,
-0.0... | 0.801949 | 0.779135 | 0.022814 |
You are tasked with implementing a program that generates a sequence of numbers based on the given algorithm. The algorithm is as follows:
1. Initialize two variables, $2 and $4, both with a value of 1.
2. Start a loop, decrement the value of $0, and then perform the following operations:
a. Multiply the value of $4... | glaive | [
0.0329134427011013,
0.03052266128361225,
-0.018910955637693405,
-0.028039639815688133,
0.034932032227516174,
-0.020741136744618416,
-0.03157850354909897,
0.08897188305854797,
0.030812153592705727,
-0.021920321509242058,
0.030168024823069572,
0.028575560078024864,
-0.04689175635576248,
0.00... | 0.830216 | 0.784403 | 0.045812 |
You are required to implement a CUDA kernel function for downsampling an image using the pyrDown algorithm. The input image will be of type T and the border type will be specified as well. The downsampling process involves averaging the pixel values in a 5x5 window and storing the result in the output image.
Your task... | glaive | [
-0.029755927622318268,
0.03914698585867882,
-0.018408555537462234,
-0.014204968698322773,
0.04235701262950897,
-0.0012994057033210993,
-0.017119241878390312,
0.10070416331291199,
0.04735654965043068,
-0.0056788064539432526,
0.016309762373566628,
0.037161607295274734,
-0.0093730753287673,
0... | 0.79556 | 0.777772 | 0.017788 |
Can someone provide an algorithm in Java to print the elements of a binary tree in level order? | glaive | [
0.013058941811323166,
0.02973295748233795,
-0.036946479231119156,
-0.040068674832582474,
0.018565477803349495,
-0.036321546882390976,
-0.010109903290867805,
0.041915059089660645,
0.03648284077644348,
-0.036576926708221436,
0.03298168629407883,
0.03157946094870567,
-0.05305816978216171,
-0.... | 0.801335 | 0.78257 | 0.018765 |
You are tasked with creating a program that utilizes a Cholesky factorization to calculate the Cholesky factor covariance matrix of a given array of real numbers. Your program should take an input array of 3 real numbers and then compute the Cholesky factor covariance matrix using the transformed parameters. Ensure tha... | glaive | [
0.015390402637422085,
0.029878541827201843,
-0.04850126802921295,
-0.02688504196703434,
0.045464955270290375,
-0.012963492423295975,
-0.0017045533750206232,
0.06246233358979225,
0.0250050351023674,
-0.025855479761958122,
-0.00032592107891105115,
0.034437812864780426,
-0.03216967359185219,
... | 0.808431 | 0.7839 | 0.024531 |
How can I compute the factorial of a natural number and find the maximum digit in the factorial using Python? I need to store the maximum digit in a variable called `y`. The input `x` can be any positive integer between 1 to 100. Additionally, I would like to know the time complexity of the function. | glaive | [
0.0307488851249218,
0.016598084941506386,
-0.03099079616367817,
-0.016909532248973846,
0.021308287978172302,
-0.025905845686793327,
-0.030733929947018623,
0.026842352002859116,
0.03446777164936066,
-0.014767640270292759,
0.024133840575814247,
0.04578617587685585,
-0.03502483293414116,
0.00... | 0.805076 | 0.78718 | 0.017895 |
You are tasked with implementing a FizzBuzz program in F# using the given code snippet as a reference. The FizzBuzz program should take a range of numbers and for each number in the range, it should print "Fizz" if the number is divisible by 3, "Buzz" if the number is divisible by 5, "FizzBuzz" if the number is divisib... | glaive | [
0.015143436379730701,
0.0324215441942215,
-0.012300214730203152,
-0.04504596069455147,
0.04782035946846008,
-0.03174365684390068,
-0.005940538831055164,
0.04379938170313835,
0.03472058102488518,
-0.006497870199382305,
0.029967138543725014,
0.03736533224582672,
-0.03960641473531723,
-0.0325... | 0.801369 | 0.778038 | 0.023331 |
You are tasked with creating a program that calculates the amplitude and probability for a given set of quantum states. The program should take in the number of qubits, the name of the state, and the number of states. It should then use the provided code snippet to calculate the amplitude and probability for the given ... | glaive | [
0.015032188966870308,
0.03717043623328209,
-0.027836862951517105,
-0.02416921779513359,
0.04850059747695923,
-0.03656318411231041,
-0.018834108486771584,
0.07770924270153046,
0.025828169658780098,
-0.012518301606178284,
0.028065113350749016,
0.03682868927717209,
-0.02945423685014248,
-0.01... | 0.800327 | 0.774314 | 0.026013 |
You are tasked with implementing a matrix multiplication function using CUDA in C++. The function should take in two matrices, perform the multiplication, and return the resulting matrix. You need to ensure that the CUDA kernel is correctly written to handle the matrix multiplication, and that memory allocation, memory... | glaive | [
0.018009468913078308,
0.04355848208069801,
-0.020520668476819992,
-0.03242124989628792,
0.04097212478518486,
-0.0026703618932515383,
-0.036304302513599396,
0.13038548827171326,
0.03838294371962547,
-0.01799219660460949,
0.018027551472187042,
0.03696059808135033,
-0.007812588475644588,
-0.0... | 0.782811 | 0.766257 | 0.016553 |
You are tasked with implementing a parallelized non-local means (NLM) filter using CUDA in C++. The goal is to apply a denoising filter to a 2D grid of input values and store the resulting denoised output in another grid. The filter should consider the similarity between pixels in a local window and their corresponding... | glaive | [
-0.0265971552580595,
0.046841464936733246,
-0.018222112208604813,
-0.021480197086930275,
0.03891271352767944,
0.010556819848716259,
-0.045807428658008575,
0.09753461927175522,
0.03381577506661415,
-0.024038570001721382,
0.026832344010472298,
0.034101199358701706,
-0.0008707797969691455,
-0... | 0.799253 | 0.777699 | 0.021554 |
You are tasked with writing a function in ACL2 that calculates the exponentiation of a given base to a given power. The function should take two arguments, the base (r) and the exponent (i), and return the result of raising the base to the power of the exponent. You need to ensure that the function handles both positiv... | glaive | [
0.03688108175992966,
0.04672057926654816,
-0.008338137529790401,
-0.05507320910692215,
0.02008027769625187,
-0.03938420116901398,
-0.0035481401719152927,
0.06900214403867722,
0.041239336133003235,
-0.023618059232831,
0.01680641621351242,
0.04132256656885147,
-0.05314117670059204,
-0.003414... | 0.79762 | 0.778941 | 0.018679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.