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
Is there a way to design a function that can sort an array of integers in descending order?
glaive
[ 0.024612819775938988, 0.02600644715130329, -0.03631385788321495, -0.02808942086994648, 0.05006583034992218, -0.026464475318789482, -0.026018895208835602, 0.054729387164115906, 0.023864654824137688, -0.014811640605330467, 0.01901358552277088, 0.025968734174966812, -0.04400546848773956, -0.0...
0.797523
0.780103
0.017419
You are tasked with simulating a grid-based game. The game involves a grid of numbers, where each cell in the grid can have a value between 0 and 9. The game progresses through a series of "flashes" which occur when a cell's value exceeds 9. When a cell's value exceeds 9, it "flashes" and increments the values of its n...
glaive
[ -0.0037887473590672016, 0.014925230294466019, -0.0339091494679451, -0.03527988865971565, 0.026345739141106606, -0.04994812235236168, -0.023950990289449692, 0.08253293484449387, 0.0291010532528162, -0.038449060171842575, 0.015874117612838745, 0.018155135214328766, -0.035937510430812836, 0.0...
0.816918
0.775452
0.041466
I need to create an algorithm in Java to find the sum of all numbers between 0 and 100. Can you provide a solution?
glaive
[ -0.013018010184168816, 0.002014532685279846, -0.02667650394141674, -0.02623835578560829, 0.034645743668079376, -0.031722139567136765, -0.01235431432723999, 0.022517723962664604, 0.0324929803609848, -0.04141555726528168, 0.020965060219168663, 0.024473872035741806, -0.0432315468788147, -0.02...
0.795944
0.774618
0.021326
You are tasked with implementing a program that utilizes the CUDA programming framework to perform matrix operations using the cuBLAS library. The program should allocate memory on the host and device, initialize a matrix, perform a modification on the matrix using the cuBLAS library, and then transfer the modified mat...
glaive
[ 0.02583354525268078, 0.04614736884832382, -0.029071860015392303, -0.017850449308753014, 0.043103814125061035, -0.030695633962750435, -0.024462779983878136, 0.08736462891101837, 0.0476856492459774, -0.02455298788845539, 0.005656023044139147, 0.031810443848371506, 0.0034937437158077955, -0.0...
0.804422
0.788534
0.015887
You are tasked with writing a program to calculate the value of a variable 'e' based on the following formula: e = f - ( (a/b) x (c + d) ) The variables are defined as follows: - eVar: a single-precision floating point number to store the result - aVar: a single-precision floating point number with value 3.2 - cVar:...
glaive
[ 0.013841703534126282, 0.03198156878352165, -0.03265814110636711, -0.03691442683339119, 0.045507218688726425, -0.03846924379467964, -0.01500561274588108, 0.08106982707977295, 0.048211000859737396, -0.004453505855053663, 0.03073795698583126, 0.046440474689006805, -0.03690550476312637, -0.009...
0.800906
0.77191
0.028997
You are tasked with implementing a CUDA kernel for matrix multiplication. The goal is to create a CUDA program that can efficiently multiply two matrices A and B and store the result in matrix C. The matrices A, B, and C are represented as arrays of floats, and the matrix multiplication should take into account the pos...
glaive
[ 0.016380108892917633, 0.051397744566202164, -0.021172095090150833, -0.023971622809767723, 0.03771393001079559, 0.002495219698175788, -0.026971127837896347, 0.10102203488349915, 0.039209142327308655, -0.02300373837351799, 0.012538355775177479, 0.034712329506874084, -0.013755391351878643, -0...
0.782436
0.764609
0.017827
You are tasked with implementing Breadth First Search (BFS) on a graph using CUDA. The goal is to create a parallelized BFS algorithm for graph traversal on a GPU, utilizing the algorithm provided in the HiPC'07 paper "Accelerating Large Graph Algorithms on the GPU using CUDA." The input to the problem includes device ...
glaive
[ 0.0073955780826509, 0.04663398116827011, -0.032119087874889374, -0.024631168693304062, 0.01731235347688198, -0.02615000680088997, -0.00974196381866932, 0.07275499403476715, 0.04274841398000717, -0.017313659191131592, 0.013689037412405014, 0.026867814362049103, 0.009383988566696644, 0.00472...
0.799864
0.775715
0.02415
You are tasked with implementing a program that calculates the probability of a quantum state for a given set of qubits. The program should also find the maximum probability and plot a 3D graph of the probability function.
glaive
[ -0.0011617429554462433, 0.03168968856334686, -0.04249832406640053, -0.019959786906838417, 0.045723117887973785, -0.013917526230216026, -0.023387758061289787, 0.06700948625802994, 0.034952033311128616, -0.009758854284882545, 0.03306172043085098, 0.04461947828531265, -0.009154661558568478, -...
0.798026
0.77576
0.022265
You are tasked with creating a function to compute the degree of internationalization (DOI) for a given set of keywords. The DOI is measured based on the distribution of country search scores. The function should use an inverted Gini-coefficient, inverted Herfindahl index, and inverted Entropy as measures for internati...
glaive
[ 0.00456332229077816, 0.01845564693212509, -0.025010917335748672, -0.029182394966483116, 0.016780711710453033, 0.008565428666770458, -0.019976064562797546, 0.047435976564884186, 0.027372894808650017, 0.00875681359320879, 0.011135205626487732, 0.025414451956748962, -0.03754091262817383, 0.01...
0.777819
0.761487
0.016332
You are tasked with implementing a CUDA kernel function to solve a system of linear equations using the Thomas algorithm. The algorithm involves updating a set of arrays (alist, blist, clist, dlist) representing the coefficients of the linear system. The kernel function should iteratively update the arrays until a solu...
glaive
[ 0.002980421530082822, 0.052138008177280426, -0.01955370046198368, -0.03972000256180763, 0.0358508937060833, -0.02906368486583233, -0.023550420999526978, 0.10084754973649979, 0.04341090843081474, -0.014979560859501362, 0.021999390795826912, 0.03624742478132248, -0.006708330009132624, -0.001...
0.799148
0.776831
0.022317
You are tasked with designing and implementing a VHDL program to perform addition using a custom digital logic design. The design should take two 8-bit input vectors (g01_b and t01_b) and produce two 8-bit output vectors (sum_0 and sum_1). The addition should be performed using a series of logic gates and signals defin...
glaive
[ 0.004527421202510595, 0.028001870959997177, -0.017959346994757652, -0.029580455273389816, 0.03967804089188576, -0.014310702681541443, -0.02992556430399418, 0.09170601516962051, 0.052745211869478226, -0.011185777373611927, 0.006311645265668631, 0.041234664618968964, -0.010336433537304401, -...
0.797934
0.780344
0.017589
You are tasked with writing a CUDA kernel to generate samples for a given 2D spiral. The samples should have a standard deviation of sigma and should be generated in either row-major or column-major order, depending on the input flag. The spiral is defined by the parameters 'a' and 'b'. Write a CUDA kernel to generate...
glaive
[ -0.031455446034669876, 0.041775740683078766, -0.030631622299551964, -0.04244771972298622, 0.03209146484732628, -0.026039812713861465, -0.04439198225736618, 0.09412883222103119, 0.02594781666994095, -0.015240393579006195, 0.03888584300875664, 0.03741699084639549, -0.01514347642660141, 0.016...
0.795003
0.77041
0.024592
You are required to create a program that calculates the maximum probability of a quantum state and visualizes the probability distribution in 3D and 2D. The program should define the following functions: - `amplitude[x_,y_]`: calculates the amplitude of a quantum state - `amplitude2[x_,y_]`: calculates the amplitude ...
glaive
[ -0.0030291827861219645, 0.030830586329102516, -0.027579622343182564, -0.028122400864958763, 0.03715614601969719, -0.01909838430583477, -0.01869150437414646, 0.06987728923559189, 0.036767177283763885, 0.007069399580359459, 0.036904122680425644, 0.03551282361149788, -0.006487036123871803, -0...
0.800213
0.775523
0.02469
You are tasked with creating a program that involves defining different types of range fields for a data mapping application. These range fields represent continuous ranges of values between upper and lower bounds and are used for querying and limited support for aggregations. The program should include the following ...
glaive
[ 0.03641856089234352, 0.014146110974252224, -0.04910367727279663, -0.026836108416318893, 0.03223498910665512, -0.046173784881830215, -0.01602744497358799, 0.04361972585320473, 0.04611358791589737, -0.036290157586336136, 0.04056885093450546, 0.04399348050355911, -0.01924399845302105, 0.00897...
0.796727
0.777967
0.01876
How can I calculate the average between three values x, y, and z efficiently?
glaive
[ 0.019670361652970314, 0.025168225169181824, -0.052786048501729965, -0.03907041251659393, 0.030951421707868576, -0.023234080523252487, -0.03221400827169418, 0.024483347311615944, 0.03414856269955635, -0.04492144659161568, 0.024910150095820427, 0.03141661733388901, -0.04754112660884857, -0.0...
0.771734
0.756819
0.014915
You are tasked with creating a Java program that takes a string input and calculates its hash code after removing any spaces and converting the string to lowercase. The program should then print the hash code to the console. Write a program that accomplishes the following: - Takes a string input "description" - Remov...
glaive
[ 0.003897974034771323, 0.019070863723754883, -0.0066128685139119625, -0.019115710631012917, 0.03774601221084595, -0.027827490121126175, -0.008939254097640514, 0.045641567558050156, 0.02749824710190296, -0.023601161316037178, 0.01728762872517109, 0.01819898746907711, -0.03741767629981041, -0...
0.801581
0.786154
0.015427
You are tasked with implementing a histogram function in CUDA C++. The function should take an input array, the number of rows and columns, the number of bins, and a histogram type. The function should then calculate the histogram for the given input array based on the specified histogram type. The histogram types incl...
glaive
[ 0.010059180669486523, 0.01978888362646103, -0.03414026275277138, -0.020044054836034775, 0.04487380012869835, -0.010283777490258217, -0.04893304407596588, 0.10781734436750412, 0.060104288160800934, -0.012538361363112926, 0.02333001233637333, 0.034383438527584076, 0.02452869340777397, -0.004...
0.788064
0.756478
0.031586
You are tasked with implementing a function in Scheme that calculates the width of a given interval. An interval is represented as a pair of numbers, with the first number being the lower bound and the second number being the upper bound. Your function should take an interval as input and return the width of the interv...
glaive
[ 0.034287989139556885, 0.025452088564634323, -0.024240681901574135, -0.026602458208799362, 0.05574337765574455, -0.01642543077468872, -0.05174937844276428, 0.06277567148208618, 0.039278365671634674, -0.0003974512801505625, 0.03757641091942787, 0.05394308269023895, -0.02882571518421173, 0.01...
0.789254
0.76966
0.019595
I need to create a module in a programming language that includes the following functionalities for handling pairs: - Create a pair from two given types - Extract the components of a pair - Create a pair from a list of types - Extract the components of a pair and return them as a list - Create a pair from two given ter...
glaive
[ 0.023417804390192032, 0.02382630668580532, -0.031098967418074608, -0.018362853676080704, 0.05293944478034973, -0.016943734139204025, -0.000002715957634791266, 0.05483217537403107, 0.03535541146993637, -0.029558390378952026, 0.021970463916659355, 0.048222631216049194, -0.014909794554114342, ...
0.815647
0.799412
0.016235
You are required to implement a GPU-based furthest point sampling algorithm, using the given code snippet as a reference. The algorithm involves selecting a set of points from a given dataset that are maximally spread out from each other. Your task is to create a CUDA kernel function that takes as input a batch size (...
glaive
[ 0.007502793334424496, 0.04023067653179169, -0.01539427787065506, -0.02892329730093479, 0.029909946024417877, -0.03765847533941269, -0.02039465866982937, 0.07122519612312317, 0.039301320910453796, -0.006360271945595741, 0.02985633723437786, 0.04823281243443489, -0.005860123783349991, 0.0169...
0.813073
0.785066
0.028007
You are tasked with implementing a function that takes a tree as input and returns the fringe of the tree. The fringe of a tree is defined as the list of all the leaves of the tree, read from left to right. The tree is represented as a nested list, where each element can either be a value or a nested list. Implement a...
glaive
[ 0.022595493122935295, 0.036330100148916245, -0.014482375234365463, -0.04830855503678322, 0.02423752099275589, -0.027530895546078682, 0.0027090897783637047, 0.05939501151442528, 0.04077598825097084, 0.014468989335000515, 0.04293239861726761, 0.028464796021580696, -0.03443852812051773, 0.011...
0.813025
0.7784
0.034625
You are tasked with creating a program to generate simulated data for a batch processing system. The program should take in the number of batches (N_batch) and the total number of samples to generate (N). The program should then generate random values for batch assignments, batch coefficients, resets, and failure times...
glaive
[ 0.013545546680688858, 0.009243521839380264, -0.05651460215449333, -0.026302078738808632, 0.03521212562918663, -0.038002438843250275, -0.02084517292678356, 0.06882408261299133, 0.03355959430336952, -0.020711258053779602, 0.030537337064743042, 0.0431276336312294, -0.02870001643896103, 0.0080...
0.788426
0.772285
0.016141
You are tasked with implementing a CUDA kernel function for performing element-wise addition, subtraction, multiplication, division, and fused multiply-add (FMA) operations on arrays of different data types. The CUDA kernel function should take in two input arrays, perform the specified operation, and store the result ...
glaive
[ 0.014698629267513752, 0.05485973507165909, -0.021270310506224632, -0.02557820826768875, 0.035938140004873276, -0.009449638426303864, -0.02584908902645111, 0.09377149492502213, 0.05391591042280197, -0.008529462851583958, 0.024527691304683685, 0.04144508019089699, -0.005366443190723658, -0.0...
0.797702
0.774051
0.023652
You are tasked with writing a program to identify proteins with the longest stretches of poly-amino acid sequences. This involves querying a database to retrieve the protein entries, their descriptions, and the length of the biased regions. The biased regions are defined as regions with a compositional bias, indicated ...
glaive
[ 0.019248900935053825, -0.002160947769880295, -0.028910787776112556, -0.03855447471141815, -0.010809135623276234, -0.0351671427488327, -0.03027055598795414, 0.05345693975687027, 0.02463405765593052, -0.016497477889060974, 0.009034099988639355, 0.03489217907190323, -0.011945318430662155, 0.0...
0.804163
0.774096
0.030067
You are tasked with implementing a depth-first search (DFS) algorithm for a basic graph data structure. The graph consists of vertices and edges, and each vertex can be connected to multiple other vertices through directed or undirected edges. The DFS algorithm should traverse the graph, visiting each vertex and edge o...
glaive
[ 0.0033720522187650204, 0.0005725181545130908, -0.03423922136425972, -0.02381502091884613, 0.022345414385199547, -0.030993590131402016, 0.01685318350791931, 0.056745193898677826, 0.0211617611348629, -0.020020268857479095, 0.03159303963184357, 0.02333756349980831, -0.015176193788647652, -0.0...
0.803262
0.777723
0.025538
You are tasked with implementing a GPU-based L2 norm computation function for a given set of inputs. The function should be able to handle both dense and sparse input arrays. The input arrays can be of type kRowSparseStorage or kCSRStorage, and the computation should be based on the value of the elements in the arrays....
glaive
[ -0.008541003800928593, 0.03065968118607998, -0.020905589684844017, -0.027931518852710724, 0.019670099020004272, -0.018447495996952057, -0.04612729698419571, 0.07313145697116852, 0.025783497840166092, -0.00917651318013668, 0.020020881667733192, 0.028263797983527184, -0.005433305632323027, 0...
0.809008
0.788833
0.020175
What is an algorithm that can be used to determine the longest common subsequence of two given strings?
glaive
[ 0.011975004337728024, 0.017197314649820328, -0.03411400318145752, -0.032692041248083115, 0.021775703877210617, -0.02705512009561062, -0.027464954182505608, 0.04142211005091667, 0.016797592863440514, -0.042750198394060135, 0.01663343980908394, 0.02234097756445408, -0.022578224539756775, -0....
0.805697
0.777613
0.028084
You are tasked with creating a program to plot the graph of a second-degree polynomial function. The program should be able to handle any second-degree polynomial function of the form $f(x)=ax^2+bx+c$, where $a$, $b$, and $c$ are real numbers and $a \neq 0$. The program should be able to plot the function and display i...
glaive
[ 0.02164013311266899, 0.04960919916629791, -0.05290011689066887, -0.04126801714301109, 0.004233367275446653, -0.035973113030195236, -0.02603713795542717, 0.053308237344026566, 0.04619333893060684, -0.009358787909150124, 0.0185037013143301, 0.03723650053143501, -0.014452941715717316, 0.00760...
0.796882
0.771104
0.025778
Write a program to calculate the secant of various angles in radians using a step value of 0.1. The program should print the angle and its corresponding secant value for each iteration.
glaive
[ 0.006301586516201496, 0.04257292300462723, -0.017529860138893127, -0.03283176198601723, 0.027987387031316757, -0.016093362122774124, -0.024254210293293, 0.06078708916902542, 0.04557373374700546, -0.026034006848931313, 0.02247600257396698, 0.03281207010149956, -0.036730460822582245, -0.0078...
0.804821
0.78434
0.020481
You are tasked with implementing a module for double-extensible arrays in OCaml. The module should provide the following functionalities: - Creation of an empty array - Resizing the array to minimize memory occupancy - Adding an element at the beginning and end of the array - Retrieving the length of the array - Access...
glaive
[ 0.010866710916161537, 0.028672141954302788, -0.01667117513716221, -0.052269551903009415, 0.03396995738148689, -0.037359364330768585, -0.015200400725007057, 0.05250535160303116, 0.054328449070453644, -0.018309295177459717, 0.02805436961352825, 0.03739729896187782, -0.021767431870102882, -0....
0.803731
0.788131
0.0156
You are required to implement a CUDA-accelerated flocking algorithm for simulating the behavior of a group of boids (simulated birds). The given code snippet provides a foundation for this task, including functions for calculating separation, alignment, cohesion, and updating boid positions. Your task is to build upon ...
glaive
[ 0.013107799924910069, 0.039039693772792816, -0.02018025703728199, -0.008399048820137978, 0.007152934558689594, -0.023792976513504982, -0.030291536822915077, 0.07977847754955292, 0.033805377781391144, -0.016299664974212646, 0.013169552199542522, 0.03424688056111336, 0.0008015116327442229, 0...
0.803072
0.778853
0.024219
What is a way to compute the greatest common divisor of two numbers in Java?
glaive
[ 0.007871444337069988, 0.02002812922000885, -0.042508989572525024, -0.03942078351974487, 0.024661991745233536, -0.02063491754233837, -0.015385380946099758, 0.033590126782655716, 0.02184474654495716, -0.057095207273960114, 0.025008579716086388, 0.02492057904601097, -0.02153596095740795, -0.0...
0.78395
0.765493
0.018457
You are tasked with creating a function that calculates Fisher's test on the number of intervals that are shared and unique between two sets of intervals. The function should take in three parameters: - `x` and `y` which are data frames representing intervals - `genome` which is a data frame representing the genome T...
glaive
[ 0.00805090181529522, -0.010127143003046513, -0.047931693494319916, -0.03827596455812454, 0.027725379914045334, -0.004748950246721506, -0.017240095883607864, 0.057432740926742554, 0.039315298199653625, -0.00002380162914050743, 0.027131035923957825, 0.02416696399450302, -0.01999598741531372, ...
0.811368
0.78137
0.029998
You are tasked with implementing a Verlet integration function in Julia. The function should take four inputs: - `f`: the differential equation - `x0`: the initial condition, which is a Vector with the first element as the initial value for position (x_0) and the second initial condition for velocity (v_0) - `tspan`: t...
glaive
[ -0.0034273695200681686, 0.0409126915037632, -0.01484772004187107, -0.04893649369478226, 0.03944898769259453, -0.011346300132572651, -0.02344604581594467, 0.06885889917612076, 0.059744175523519516, 0.004769875202327967, 0.022731155157089233, 0.025892207399010658, 0.011729608289897442, -0.00...
0.792379
0.776509
0.01587
You are required to write a CUDA program that performs a dot product of two arrays on a GPU. The program should utilize multithreading to offload the work to multiple GPUs. The host memory is allocated and filled with data, and then the dot product is calculated using CUDA. The program should then return the calculated...
glaive
[ 0.013258621096611023, 0.03995571658015251, -0.04479631409049034, -0.023000886663794518, 0.029070964083075523, -0.013995880261063576, -0.04659097641706467, 0.09365931898355484, 0.051845185458660126, -0.040378689765930176, 0.01231920626014471, 0.04320494458079338, 0.001448869239538908, -0.01...
0.80464
0.789742
0.014898
You are tasked with implementing a function in a language that supports macros and assembly programming. The function should take a list of integers and perform the following operations: 1. Set the value of variable "x" to 0 2. Create a list "y" containing integers from 1 to 14 3. Assign the length of list "y" to varia...
glaive
[ 0.030769335106015205, 0.038773659616708755, -0.026550475507974625, -0.035614825785160065, 0.05850175768136978, -0.02184903435409069, -0.018017124384641647, 0.0576871782541275, 0.03973936662077904, -0.008030521683394909, 0.03153093531727791, 0.045099515467882156, -0.004397542215883732, -0.0...
0.819104
0.801306
0.017798
You are tasked with creating a program to count the number of (w,x,y) combinations, where each term is in the range {0,...,n}, and the condition |w-x|+|x-y|+|y-w| < w+x+y is satisfied. Write a function or program that takes an integer n as input and returns the count of such combinations.
glaive
[ 0.0209052637219429, 0.013275034725666046, -0.04967707395553589, -0.01930825226008892, 0.039475757628679276, 0.0005381543887779117, -0.045531678944826126, 0.06933841854333878, 0.04567917063832283, 0.003918055910617113, 0.01670432835817337, 0.04833546653389931, -0.0371926873922348, -0.037374...
0.839852
0.778338
0.061514
I need help developing an algorithm to find the least common ancestor (LCA) of multiple given nodes in a balanced K-ary tree using Python. Can you assist me? Here's an example of the tree structure: ``` 1 / | \ 2 3 4 /|\ /|\ /|\ 5 6 7 8 9 10 ``` I want to find the LCA of nodes 5, 6, and 7. I have a few ...
glaive
[ 0.005069947335869074, 0.04873925447463989, -0.047045908868312836, -0.03662485256791115, 0.03056083805859089, -0.018872976303100586, -0.005257351789623499, 0.05711071193218231, 0.010771237313747406, -0.023629089817404747, 0.024064453318715096, 0.008567078039050102, -0.027078106999397278, 0....
0.817669
0.792655
0.025014
You are tasked with creating a simple memory allocation program in C. The program should include a simple allocator, page allocator, and a recycler. You need to write the code to allocate memory, manage pages, and recycle memory in an efficient way. The program should be able to allocate and deallocate memory as needed...
glaive
[ 0.01992310769855976, 0.039730824530124664, -0.007832188159227371, -0.02870441973209381, 0.0422842800617218, -0.034576766192913055, -0.024648668244481087, 0.0775202289223671, 0.035413771867752075, -0.026976443827152252, 0.0035845425445586443, 0.027012722566723824, -0.021300721913576126, 0.0...
0.785125
0.76517
0.019955
You are tasked with implementing a program that can parse, manipulate, and perform operations on various date and time types in Java using the JSR 310 API (java.time package). Your task is to write a program that can perform the following operations: 1. Parse date and time strings into the respective java.time types (L...
glaive
[ 0.022979944944381714, 0.016969382762908936, -0.03360574319958687, -0.02912282943725586, 0.025625960901379585, -0.05444520711898804, -0.02383761666715145, 0.05424617975950241, 0.03698981553316116, -0.023070000112056732, 0.029814690351486206, 0.04639815911650658, -0.02641340345144272, -0.013...
0.792246
0.775766
0.016479
You are tasked with decoding a series of characters using a specific set of rules. The rules for decoding are as follows: - The input consists of a series of displays, each containing a set of characters. - Each display contains a unique set of characters, and the length of the display can be either 2, 3, 4, 5, 6, or 7...
glaive
[ 0.023694386705756187, 0.01905788481235504, -0.015006203204393387, -0.041197843849658966, 0.04579484462738037, -0.03986251726746559, -0.014877677895128727, 0.046539824455976486, 0.03189806267619133, -0.025408383458852768, 0.017022866755723953, 0.02502325549721718, -0.029623841866850853, -0....
0.830706
0.791242
0.039464
How can I generate a Java program that finds and returns an array containing all duplicate numbers from an input array?
glaive
[ -0.0034985968377441168, 0.020432880148291588, -0.04217306524515152, -0.03556254506111145, 0.027300862595438957, -0.03556080535054207, -0.016059542074799538, 0.04245752841234207, 0.01570884883403778, -0.050797078758478165, 0.012975083664059639, 0.02576618082821369, -0.033357858657836914, -0...
0.805832
0.788355
0.017477
I need help developing an algorithm in Python to calculate the sum of integers in each column of a multidimensional matrix. Can you provide a solution? ```python def column_sum(matrix): ''' Function to return the sum of each column in a matrix ''' return [sum(column) for column in zip(*matrix)] # Test the fun...
glaive
[ -0.009242515079677105, 0.01830633357167244, -0.04508434236049652, -0.041953664273023605, 0.06152264401316643, -0.02535768784582615, -0.010473405010998249, 0.030166970565915108, 0.016372431069612503, -0.017191622406244278, 0.015920991078019142, 0.015670975670218468, -0.04689580202102661, -0...
0.786752
0.766673
0.020079
How can I develop a recursive function to calculate the factorial of a number? Can you also explain the base case and recursive case for the algorithm? I would like to test edge cases of large numbers and handle invalid inputs to the function. Additionally, I need help optimizing the function to prevent stack overflow ...
glaive
[ 0.007177240215241909, 0.04446614533662796, -0.011619550175964832, -0.027988912537693977, 0.029767470434308052, -0.021838350221514702, -0.014189326204359531, 0.04985262081027031, 0.00902489572763443, -0.0014187052147462964, 0.017705902457237244, 0.019159138202667236, -0.032438430935144424, ...
0.813623
0.798014
0.015609
You are required to implement a function that calculates the sum of squares of a list of integers, a function that composes a list of functions, a function that concatenates a list of strings with a separator, a function that converts a list to a string, a function that clones a value a specified number of times, a fun...
glaive
[ 0.03024390898644924, 0.03623364120721817, -0.029157180339097977, -0.046872224658727646, 0.05512019246816635, -0.024045811966061592, -0.025891877710819244, 0.04129472374916077, 0.04104236885905266, -0.014486495405435562, 0.021550888195633888, 0.0442788302898407, -0.038877665996551514, -0.03...
0.833303
0.805638
0.027665
You are tasked with creating a CUDA program that utilizes a struct and device memory to print the elements of an array in a kernel function. The struct, named Test, contains a char array of size 5. The main function initializes an instance of the Test struct, assigns values to its array, and then copies it to device me...
glaive
[ -0.0020469818264245987, 0.0538552850484848, -0.013705507852137089, -0.024439718574285507, 0.03772052749991417, -0.03521095961332321, -0.029643036425113678, 0.09510151296854019, 0.04682745039463043, -0.020117780193686485, 0.02916915901005268, 0.0395536907017231, -0.009081702679395676, 0.004...
0.797236
0.782042
0.015194
You are tasked with implementing a three-dimensional line drawing package in FORTRAN. The package should provide the following capabilities: 1. Draw a curve through N points defined by linear arrays U, V, and W. 2. Draw a line connecting two coordinates (UA, VA, WA) and (UB, VB, WB). 3. Position the pen to a specific p...
glaive
[ 0.014460616745054722, 0.01913749985396862, -0.03249545022845268, -0.04626240208745003, 0.03681405633687973, -0.018188150599598885, -0.02256101742386818, 0.07960518449544907, 0.04838903620839119, -0.007586200721561909, 0.02584071084856987, 0.052289947867393494, -0.02455749735236168, -0.0137...
0.784209
0.76692
0.017289
You are tasked with implementing a function that calculates the PAM40 score for a pair of amino acids based on the provided scoring matrix. The PAM40 score for a pair of amino acids is determined by a pre-defined scoring matrix, which is represented as a 27x27 2D array. The scoring matrix is based on the frequency of ...
glaive
[ 0.011484897695481777, 0.019632944837212563, -0.008291102945804596, -0.03273765370249748, 0.03183252364397049, -0.02718161605298519, -0.021907003596425056, 0.07249458134174347, 0.025297537446022034, -0.0047150966711342335, 0.005265804938971996, 0.02662189118564129, -0.02899765968322754, -0....
0.812822
0.780926
0.031896
You are tasked with creating a program that calculates the probability of a quantum state given certain parameters. The program should use the provided functions amplitude, amplitude2, and probability to calculate the probability of a quantum state for different values of x and y. Additionally, the program should use N...
glaive
[ 0.0025381408631801605, 0.032662827521562576, -0.03199591487646103, -0.020196639001369476, 0.04963189736008644, -0.0223759226500988, -0.013395780697464943, 0.07831412553787231, 0.03354405239224434, 0.003527279244735837, 0.03140852600336075, 0.034316472709178925, -0.026014402508735657, -0.01...
0.788797
0.763302
0.025495
You are tasked with implementing a data structure that represents a sorted list of non-overlapping, non-empty, adjacent ranges. The data structure should support the following operations: 1. Adding a new entry to the data structure (assuming there is no range in the structure that overlaps with the provided entry). 2. ...
glaive
[ 0.030316263437271118, 0.01743125170469284, -0.03383529931306839, -0.021647674962878227, 0.03332671895623207, -0.04067906737327576, -0.0173618383705616, 0.06751205027103424, 0.04876730218529701, -0.04044357314705849, 0.030348598957061768, 0.013122300617396832, -0.039786405861377716, -0.0256...
0.827256
0.792933
0.034323
Write a program to calculate the value of n^7 mod 28. The program should take an input value for n and output the result of the calculation.
glaive
[ 0.023910945281386375, 0.026577072218060493, -0.015901003032922745, -0.046314094215631485, 0.04326067119836807, -0.035752180963754654, -0.03394745662808418, 0.044012442231178284, 0.04841005429625511, -0.04130552336573601, 0.023191336542367935, 0.03997952863574028, -0.04537493735551834, -0.0...
0.808744
0.778247
0.030496
You are tasked with implementing a function that compares and sorts paths in a Clojure program. The paths are represented as nested vectors, with each vector containing keywords and values. The function should be able to compare and sort these paths based on certain criteria. Write a function `compare-paths` that take...
glaive
[ 0.02378978580236435, 0.02329622209072113, -0.01554954145103693, -0.02806718647480011, 0.028254156932234764, -0.020096058025956154, -0.008894255384802818, 0.04392411932349205, 0.04351603612303734, -0.01110143307596445, 0.028346799314022064, 0.02469504252076149, -0.026644548401236534, -0.013...
0.803848
0.78389
0.019958
How can I create a Java program that efficiently identifies the most frequent item in an array of integers?
glaive
[ 0.0145802553743124, 0.03015068918466568, -0.046656329184770584, -0.016242489218711853, 0.0350164920091629, -0.03769771382212639, -0.02804541029036045, 0.052575841546058655, 0.028825176879763603, -0.04791678860783577, 0.027587950229644775, 0.01802898570895195, -0.022711819037795067, -0.0065...
0.800038
0.782969
0.01707
You are tasked with creating a program that calculates the maximum probability and plots a 3D graph and a contour plot based on the given quantum mechanics code snippet. The program should use the functions amplitude, amplitude2, and probability to calculate the maximum probability using NMaximize and then plot a 3D g...
glaive
[ 0.00317448191344738, 0.03587907925248146, -0.03211890161037445, -0.029910214245319366, 0.03674198314547539, -0.029878834262490273, -0.02669009193778038, 0.06187346950173378, 0.038902368396520615, 0.0014844246907159686, 0.026149440556764603, 0.03764850273728371, -0.02520226314663887, -0.011...
0.79869
0.769876
0.028813
You are tasked with creating a 4-bit adder in a functional programming language. The adder takes two 4-bit binary numbers as input (a and b) and returns the sum of the two numbers as a 4-bit binary number along with a carry bit. Write a function 4-bit-adder that takes two lists of 4 bits each (a and b) as input and re...
glaive
[ 0.025661932304501534, 0.043288346379995346, -0.011294708587229252, -0.034988924860954285, 0.06286156922578812, -0.01765027642250061, -0.02694936841726303, 0.05776859074831009, 0.050261322408914566, 0.005102582275867462, 0.016528911888599396, 0.055017516016960144, -0.02655407041311264, -0.0...
0.813249
0.784937
0.028312
How can I find all the occurrences of the character 'x' in the fixed-length sentence 'abcdefghijklmnopqrstuvwxyz'? I need a function that takes two parameters: the search string and the target character. The function should return a list containing the indices of all occurrences of the target character in the search s...
glaive
[ 0.013047141022980213, 0.016986144706606865, -0.029593229293823242, -0.04051918163895607, 0.04236482456326485, -0.03845570608973503, -0.007721284404397011, 0.053746819496154785, 0.033522821962833405, -0.02467343769967556, 0.019089892506599426, 0.008510666899383068, -0.025728195905685425, -0...
0.832878
0.810847
0.022031
You are tasked with writing a program that takes a state and prints out its hexadecimal representation. The state is defined as a pair of pairs, each containing a pair of pairs, and so on, up to 16 pairs in total. Each pair contains a value that can be Z0, Zpos, or Zneg, and each Zpos contains a value that can be XH, X...
glaive
[ 0.02455858886241913, 0.02516108937561512, -0.028662744909524918, -0.038483139127492905, 0.04654518514871597, -0.021817537024617195, -0.012270152568817139, 0.08383817225694656, 0.03779986500740051, -0.0320555754005909, 0.036479733884334564, 0.04221883788704872, -0.02618478611111641, -0.0391...
0.803897
0.774985
0.028911
You are tasked with implementing a QR decomposition method in R. The QR factorization involves forming the crossproduct \eqn{X^T X} and taking its Cholesky factorization. The operation is completely local except for forming the crossproduct, which is an \code{allreduce()} call, quadratic on the number of columns. The f...
glaive
[ 0.013554595410823822, 0.045617666095495224, -0.043493449687957764, -0.04024123772978783, 0.038233011960983276, 0.006044539622962475, -0.010687462985515594, 0.0654502883553505, 0.03510197997093201, -0.0070677450858056545, 0.00903579406440258, 0.03729656711220741, -0.031438108533620834, -0.0...
0.78924
0.7719
0.01734
You are required to implement a CUDA kernel function that performs a logical XOR operation on two arrays of floats and stores the result in a third array. The kernel function should take in three input arrays A and B, and an output array C, as well as the size of the arrays. The logical XOR operation should be performe...
glaive
[ 0.012499473057687283, 0.06016765907406807, -0.032410863786935806, -0.01351920422166586, 0.019656015560030937, -0.00406741164624691, -0.04054936394095421, 0.08693572133779526, 0.03885328397154808, -0.018321793526411057, 0.02017100155353546, 0.03655010089278221, -0.012140695005655289, -0.008...
0.805721
0.77817
0.027551
You are tasked with implementing a set of CUDA kernels for performing various mathematical operations on arrays. Specifically, you need to create CUDA kernels for performing addition, subtraction, multiplication, division, and the SAXPY operation (z = alpha * x + y) on arrays. The operations should be performed element...
glaive
[ 0.02900250442326069, 0.04878303036093712, -0.04204001650214195, -0.017291154712438583, 0.03194628655910492, -0.006706977263092995, -0.028647130355238914, 0.0856843888759613, 0.046116627752780914, -0.022154754027724266, 0.017483994364738464, 0.027652444317936897, -0.0027647907845675945, -0....
0.793464
0.772359
0.021106
How can I sort a given odd number array [9, 3, 5, 7, 1] in descending order?
glaive
[ 0.01370411366224289, 0.029268577694892883, -0.03562594950199127, -0.055286046117544174, 0.029527992010116577, -0.024974217638373375, -0.025260135531425476, 0.041409049183130264, 0.0288773812353611, -0.01057596504688263, 0.01568954437971115, 0.019031653180718422, -0.059045206755399704, 0.00...
0.815392
0.775634
0.039758
You are tasked with creating a program that finds the contour of an object in a given image. The input will be a 2D array representing the image where each element is a pixel value. The contour of the object is the set of points that form the boundary of the object in the image. Your program should output the set of po...
glaive
[ 0.00564770121127367, 0.038022447377443314, -0.037202998995780945, -0.029212679713964462, 0.0219524297863245, -0.018832705914974213, -0.03561340272426605, 0.061742015182971954, 0.05156083032488823, -0.015188772231340408, 0.013771417550742626, 0.01843937113881111, -0.04083578288555145, 0.012...
0.794675
0.747064
0.047611
You are tasked with creating a function that generates a specialized theorem for a given application, using a prefix of its arguments. The function should take the given application and an optional arity as input, and return the specialized theorem. The arity represents the number of arguments to consider in the theore...
glaive
[ 0.04559234157204628, 0.026749372482299805, -0.04380716755986214, -0.02403663471341133, 0.027044272050261497, -0.025799551978707314, -0.04264025762677193, 0.06710760295391083, 0.030240263789892197, -0.003723749192431569, 0.014807352796196938, 0.04027009382843971, -0.03281806781888008, 0.011...
0.801257
0.782507
0.01875
You are tasked with implementing a shader program in GLSL that takes in a texture color and a front color, and outputs the closest predefined color to the front color based on Euclidean distance. The shader should also apply the closest color to the fragment color based on certain conditions. The shader program should...
glaive
[ 0.010334279388189316, 0.042245250195264816, -0.01230648159980774, -0.04537106677889824, 0.02314608171582222, -0.05441446974873543, -0.03736544027924538, 0.06709465384483337, 0.037817761301994324, -0.018485931679606438, 0.04892716929316521, 0.04044763371348381, 0.003703504800796509, 0.01947...
0.797435
0.782201
0.015235
You are tasked with implementing a function in C that pads a 3D matrix with zeros around the edges. The function should take in a 3D matrix and two padding values, and return a new matrix with the specified padding. You need to allocate memory for the new matrix, initialize it with zeros, and then copy the original mat...
glaive
[ 0.033654507249593735, 0.03196784853935242, -0.02093837969005108, -0.030118290334939957, 0.05156894028186798, -0.020085712894797325, -0.015178492292761803, 0.08511404693126678, 0.015936892479658127, -0.011099958792328835, 0.01561373844742775, 0.026364559307694435, -0.03907480835914612, -0.0...
0.802608
0.781022
0.021586
You are tasked with implementing a parallel particle filter (PF) using CUDA and C++. A particle filter is a type of recursive Bayesian filter that uses a set of particles to represent the posterior distribution of a system's state. The problem at hand is to implement the `pf` function within the provided code snippet. ...
glaive
[ -0.006932234391570091, 0.04632186144590378, -0.012175609357655048, -0.014211789704859257, 0.036414071917533875, -0.0024422029964625835, -0.02672405354678631, 0.10863879323005676, 0.053208742290735245, -0.01079679373651743, 0.032152798026800156, 0.0447828471660614, 0.010784211568534374, -0....
0.793496
0.777394
0.016102
You are tasked with creating a CUDA program that writes a blocked arrangement of data across a CUDA warp to a linear segment of memory using the WarpStore class. The program should be able to specialize different performance policies for different architectures, data types, and granularity sizes. The WarpStore class pr...
glaive
[ 0.02080204337835312, 0.02886468730866909, -0.023041144013404846, -0.020701006054878235, 0.029794462025165558, -0.021892590448260307, -0.05698949471116066, 0.09790827333927155, 0.05396973341703415, -0.03403710573911667, 0.03784039616584778, 0.0384349562227726, -0.01841932348906994, 0.018638...
0.802428
0.783782
0.018645
You are tasked with writing a function that takes an integer as input and returns a list of its individual digits. For example, given the input 123, the function should return [1; 2; 3].
glaive
[ 0.042755477130413055, 0.024986466392874718, -0.03353322297334671, -0.051135607063770294, 0.041885487735271454, -0.028678040951490402, -0.018519368022680283, 0.027007075026631355, 0.021846920251846313, 0.0027088720817118883, 0.02739506959915161, 0.04439403489232063, -0.05270837992429733, -0...
0.813435
0.763821
0.049613
You are tasked with creating a program that takes in a user input and determines whether it is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your program should be able to handle b...
glaive
[ 0.028970761224627495, 0.013257937505841255, -0.009853447787463665, -0.02692442387342453, 0.03586613014340401, -0.014117924496531487, 0.011174477636814117, 0.10237636417150497, 0.03507103770971298, -0.022829322144389153, 0.01999361254274845, 0.025139646604657173, -0.015131753869354725, -0.0...
0.812883
0.781216
0.031666
You are tasked with implementing a GPU-compatible Numpy-compatible percentile function using CUDA in C++ for a deep learning framework. The function should check if the input data is valid, and if not, return an error. You need to create a function that: - Accepts input data and its size, as well as a pointer to a var...
glaive
[ -0.017274726182222366, 0.02139648236334324, -0.0002743352379184216, -0.020949959754943848, 0.03798883408308029, -0.026692157611250877, -0.00401321891695261, 0.1067754253745079, 0.038487572222948074, -0.01195539627224207, 0.024448946118354797, 0.03200173005461693, 0.018885789439082146, -0.0...
0.813485
0.799109
0.014375
I need to implement a 3-to-8 decoder in VHDL. The decoder should have 3 input lines (s2, s1, s0) and 8 output lines (z0 to z7). The output lines should be determined based on the input according to the following truth table: s2 s1 s0 | z7 z6 z5 z4 z3 z2 z1 z0 0 0 0 | 0 0 0 0 0 0 0 1 0 0 1 | 0 0 0 0 0 0 1 0 0 1 0 | 0 0 ...
glaive
[ 0.027392972260713577, 0.019267817959189415, -0.023207133635878563, -0.03323474898934364, 0.03612876310944557, -0.03058946691453457, -0.035020146518945694, 0.07985907047986984, 0.01789255440235138, -0.024227173998951912, 0.008658093400299549, 0.04730180650949478, -0.013277019374072552, -0.0...
0.806395
0.787438
0.018957
You are tasked with implementing a function that modifies a one-dimensional tensor according to the following rules: - Only support one dimension tensor - Only support LongTensor - Expected to be contiguous - For each element in the tensor, it should be replaced with the minimum value of itself and all elements to its ...
glaive
[ 0.014836132526397705, 0.039823561906814575, -0.014639253728091717, -0.03509888797998428, 0.03593789413571358, -0.037979595363140106, -0.014680614694952965, 0.07699377089738846, 0.039390679448843, -0.0103077357634902, -0.0013829534873366356, 0.014655334874987602, -0.011256655678153038, 0.00...
0.806324
0.788272
0.018051
You are tasked with implementing a function to generate a 'small world' random graph based on the Watts-Strogatz model. The resulting graph should have n vertices, each with a base degree of k (where n > k, k >= 2, and k must be even). There should be a beta chance of each edge being 'rewired', where beta is a real num...
glaive
[ -0.0041991244070231915, 0.03834414854645729, -0.030212759971618652, -0.036531779915094376, 0.02177017368376255, -0.04934767633676529, -0.03202706575393677, 0.049051035195589066, 0.026776714250445366, -0.012343239970505238, 0.027746742591261864, 0.03954977169632912, -0.019960563629865646, -...
0.806361
0.779584
0.026777
How can I use a program to solve a problem that involves counting pairs of numbers in a given range?
glaive
[ 0.0064650424756109715, 0.012595295906066895, -0.04475143924355507, -0.015827540308237076, 0.03827284649014473, -0.0008061387925408781, -0.02235065959393978, 0.046810995787382126, 0.02808161824941635, -0.03932715207338333, 0.0061082858592271805, 0.053635064512491226, -0.027071811258792877, ...
0.800619
0.772881
0.027738
You are tasked with creating a control logic module in VHDL for a digital system. The module will take input from four sets of 4-bit data and a clock signal to control a signal LED. The input data represents thousands, hundreds, tens, and units places and the control logic will manipulate this data based on a code butt...
glaive
[ 0.013396212831139565, 0.031137067824602127, -0.04139533266425133, -0.04022281989455223, 0.02845967747271061, -0.04925178736448288, -0.030728992074728012, 0.07556232064962387, 0.04310336336493492, -0.006042695138603449, 0.02016162872314453, 0.040440961718559265, -0.0042281607165932655, -0.0...
0.795016
0.779275
0.015741
You are tasked with creating a function to calculate the volume of a simplex in a given dimension. A simplex is a geometric shape that exists in any number of dimensions and is the generalization of a triangle (3D) and tetrahedron (4D). Your function should take in an array of points representing the vertices of the si...
glaive
[ 0.013308947905898094, 0.053516142070293427, -0.032985419034957886, -0.043131835758686066, 0.056830622255802155, -0.0156851913779974, -0.04145495593547821, 0.06347684562206268, 0.04885925352573395, 0.0015690817963331938, 0.03239235654473305, 0.050372060388326645, -0.003761474508792162, -0.0...
0.793596
0.757796
0.0358
I need to create a program that can find and display a specified number of prime numbers within a given range. The program should be able to determine if a number is prime and calculate the time it takes to find each prime number within the specified range.
glaive
[ 0.028298787772655487, 0.017648249864578247, -0.04159301519393921, -0.03148370981216431, 0.04078705608844757, -0.04316498711705208, -0.02556747943162918, 0.06284838169813156, 0.028380677103996277, -0.022749988362193108, 0.02333487570285797, 0.03351322561502457, -0.03698787838220596, -0.0168...
0.803386
0.785149
0.018237
You need to implement a subroutine to solve a system of linear equations A*X = B with a symmetric positive definite band matrix A using the Cholesky factorization A = U**T*U or A = L*L**T computed by SPBTRF. The subroutine should have the following signature: ```fortran SUBROUTINE SPBTRS( UPLO, N, KD, NRHS, AB, LDAB, ...
glaive
[ 0.016046516597270966, 0.023399481549859047, -0.05555577203631401, -0.038281574845314026, 0.03956650570034981, -0.030360450968146324, -0.0010110711446031928, 0.06764005124568939, 0.04833707585930824, -0.005518940277397633, 0.009951943531632423, 0.0391923226416111, -0.015813691541552544, -0....
0.818728
0.791927
0.026801
How can an algorithm be designed to calculate the maximum profit achievable from buying and selling stocks?
glaive
[ 0.03407185524702072, 0.01587008684873581, -0.027884049341082573, -0.02678006701171398, 0.028126301243901253, -0.035422492772340775, -0.043086789548397064, 0.03576995059847832, 0.023266157135367393, -0.02502732165157795, 0.01630464568734169, 0.03318094089627266, -0.02596525475382805, -0.032...
0.780268
0.760471
0.019798
You are tasked with creating a program that will find the maximum value of a given function over a specified range of variables. The function is defined as: function[x_, y_] := $Conjugate[Exp[-16 I y] (1 (I Sin[x])^6 Cos[x]^10 + 1 (I Sin[x])^10 Cos[x]^6) + Exp[-12 I y] (22 (I Sin[x])^5 Cos[x]^11 + 22 (I Sin[x])^11 Cos...
glaive
[ 0.023382043465971947, 0.035011231899261475, -0.03783772513270378, -0.03031334839761257, 0.04229104146361351, -0.018244439736008644, -0.030497252941131592, 0.05550625920295715, 0.04504606872797012, 0.0004034196608699858, 0.03633129596710205, 0.04969682916998863, -0.032666534185409546, -0.00...
0.808393
0.765528
0.042865
I am trying to prove some simple logical conjectures in my code using the Lean programming language. I need to prove the following logical statements: 1. True is true by definition 2. There does not exist a proof for false 3. For any proposition P, P ∨ P ↔ P 4. For any proposition P, P ∧ P ↔ P 5. For any propositions P...
glaive
[ 0.011543662287294865, 0.027654696255922318, -0.040010690689086914, -0.039187513291835785, 0.023670941591262817, -0.029400676488876343, -0.022317377850413322, 0.06187346205115318, 0.023769235238432884, -0.026907097548246384, 0.01187970768660307, 0.02624857984483242, -0.014729650691151619, -...
0.80683
0.789187
0.017643
You are tasked with creating a program that calculates the probability of a certain quantum state. The program should utilize the given amplitude and probability functions, and then use the NMaximize function to find the maximum probability for the given quantum state. Additionally, you should create a 3D plot of the p...
glaive
[ 0.0009788530878722668, 0.03380035609006882, -0.033757567405700684, -0.02113145962357521, 0.04719531908631325, -0.01914900541305542, -0.018650135025382042, 0.07644040137529373, 0.03313986957073212, 0.006924998015165329, 0.028163770213723183, 0.03829136863350868, -0.015107044018805027, -0.01...
0.790908
0.765834
0.025075
You are tasked with implementing a ROM (Read-Only Memory) module in VHDL. The ROM should support a data width of 16 bits and at most 32 values, which means the address should be 5 bits. The module should have the following ports: - clk: input std_logic - en: input std_logic - addr: input std_logic_vector(8 downto 0) - ...
glaive
[ 0.018053829669952393, 0.015138637274503708, -0.008967243134975433, -0.03366873040795326, 0.032169222831726074, -0.0475199818611145, -0.03430120274424553, 0.07310879230499268, 0.04180118814110756, -0.012007146142423153, 0.013549675233662128, 0.046307239681482315, 0.006882066838443279, -0.00...
0.786061
0.768255
0.017806
You are tasked with creating a CUDA kernel function that performs a mathematical operation on three input values and returns the result. The operation involves taking the sine of the first input, adding it to the cosine of the second input, and then adding the square root of the third input. Your task is to implement t...
glaive
[ 0.015575273893773556, 0.04150978475809097, -0.04393608868122101, -0.029881425201892853, 0.034042131155729294, 0.0068398877047002316, -0.031462687999010086, 0.08895066380500793, 0.05015251040458679, -0.00038496064371429384, 0.029946256428956985, 0.03637024387717247, -0.01580202579498291, -0...
0.804776
0.787557
0.017219
You are tasked with implementing a module for handling multisets in a programming language. A multiset is an unordered collection that can contain duplicate elements. Your task is to create a module that provides functions for querying multisets, persistently updating multisets, iterating and comprehending over multise...
glaive
[ 0.0361316092312336, 0.011500143446028233, -0.017206884920597076, -0.008887993171811104, 0.04091653600335121, -0.04442499577999115, -0.027559706941246986, 0.0435340590775013, 0.046554792672395706, -0.022730356082320213, 0.030675368383526802, 0.019180212169885635, -0.02430778369307518, 0.004...
0.810551
0.791605
0.018946
You are tasked with implementing a CUDA C++ function to calculate the square root of a 32-bit unsigned integer with the following signature: ```cpp template<class env> __device__ __forceinline__ void core_t<env>::sqrt(uint32_t &s, const uint32_t a, const uint32_t numthreads) ``` The function should take three parameter...
glaive
[ 0.02376602217555046, 0.06538548320531845, -0.03293059021234512, -0.02650213986635208, 0.03382280096411705, -0.015104930847883224, -0.038071587681770325, 0.1190464049577713, 0.045357316732406616, -0.02813652902841568, 0.03838934004306793, 0.035738829523324966, -0.016344301402568817, -0.0247...
0.805049
0.784287
0.020762
How can I sort an array of integers in Java in ascending order?
glaive
[ 0.02685374952852726, 0.02550048753619194, -0.03081725351512432, -0.029221782460808754, 0.018255816772580147, -0.0398826003074646, -0.02404543198645115, 0.02821163274347782, 0.008637851104140282, -0.03692846745252609, 0.020498739555478096, 0.0051500266417860985, -0.05494847893714905, -0.004...
0.790849
0.771604
0.019245
You are tasked with organizing a collection of variables based on their type and value. Given a collection of variables, you need to separate them into three distinct groups: temporary variables (whose label begins with '['), index variables (which are integers), and instance variables (which are of type GTInspectorSlo...
glaive
[ 0.009710168465971947, 0.019475789740681648, -0.04929908365011215, -0.02893693745136261, 0.04619142785668373, -0.038268040865659714, -0.03362886235117912, 0.05713958665728569, 0.03494727611541748, -0.011082437820732594, 0.027154648676514626, 0.027758881449699402, -0.03959984704852104, 0.015...
0.821161
0.799792
0.021369
You are tasked with creating a program that takes a list of numbers and transforms them according to the following rules: 1. If the number is negative, it should be replaced with -1.0 2. If the number is positive, it should be replaced with the word "while" Write a function or method that takes in a list of numbers an...
glaive
[ 0.017724834382534027, 0.013381403870880604, -0.022364666685461998, -0.03271735459566116, 0.052212800830602646, -0.03399905562400818, -0.01951364055275917, 0.04244452342391014, 0.023544911295175552, -0.021332446485757828, 0.010304408147931099, 0.037525154650211334, -0.04762587696313858, -0....
0.819032
0.801182
0.01785
You are tasked with creating a function in Clojure that takes a vector of strings as input and returns a map where the keys are the elements of the input vector and the values are the index of the element in the vector plus 1. For example, given the input ["a" "b"], the output should be {"a" 1, "b" 2}. Write a functio...
glaive
[ 0.0356321781873703, 0.04874476417899132, 0.0005530357011593878, -0.03540279343724251, 0.045270539820194244, -0.03284947946667671, -0.0165391955524683, 0.04803713411092758, 0.019831519573926926, -0.014595560729503632, 0.02552812173962593, 0.024707557633519173, -0.024938423186540604, -0.0172...
0.800724
0.778234
0.02249
You are tasked with implementing a convolution operation for multi-dimensional data. The convolution operation involves applying a filter (also known as a kernel) to the input data to produce an output. The kernel is a small array of weights that is convolved with the input data to perform operations like blurring, sha...
glaive
[ 0.00008232185791712254, 0.04139668866991997, -0.022938409820199013, -0.011656702496111393, 0.03683361038565636, 0.0012810294283553958, -0.02482660859823227, 0.07567085325717926, 0.03999170660972595, -0.018175138160586357, 0.01965980790555477, 0.024394726380705833, -0.018978074193000793, 0....
0.803634
0.779955
0.023679
You are required to implement a 3D convolution operation using CUDA. The goal is to perform a 3D convolution on a given 3D array A, and store the result in another 3D array B. The convolution kernel is provided as: c11 = +2, c21 = +5, c31 = -8 c12 = -3, c22 = +6, c32 = -9 c13 = +4, c23 = +7, c33 = +10 The input arrays ...
glaive
[ 0.00831934716552496, 0.048476774245500565, -0.018386414274573326, -0.014756448566913605, 0.03225249424576759, 0.0027195527218282223, -0.03028912842273712, 0.09040545672178268, 0.039374757558107376, -0.0024954574182629585, 0.032095883041620255, 0.032856278121471405, -0.019938990473747253, -...
0.793591
0.767163
0.026428
You are tasked with implementing collision detection functions in Lua for different shapes. You need to implement the following functions: 1. `RectToRect`: This function takes two rectangles as input and returns `true` if the rectangles are colliding, and `false` otherwise. 2. `CircleToCircle`: This function takes two ...
glaive
[ -0.011346757411956787, 0.0582263357937336, -0.010077619925141335, -0.04074358195066452, 0.04697573557496071, 0.0009252818999812007, -0.02941308729350567, 0.039464741945266724, 0.05558568239212036, -0.02281496860086918, 0.045165251940488815, 0.04052817448973656, -0.0039816368371248245, -0.0...
0.791633
0.775983
0.01565
Can you provide a code snippet to generate a list containing the first 10 Fibonacci numbers?
glaive
[ 0.01598673313856125, 0.027279751375317574, -0.013615893200039864, -0.03506952151656151, 0.0425821915268898, -0.04911211505532265, -0.02838226407766342, 0.04844088479876518, 0.025835445150732994, -0.031662072986364365, 0.03846759721636772, 0.03024173714220524, -0.06872114539146423, -0.01984...
0.79828
0.778629
0.019651
I want to create a function that checks if a binary tree is symmetric. A binary tree is symmetric if the left subtree is a mirror image of the right subtree. This means that the value of the left node in the left subtree equals the value of the right node in the right subtree, and the left node in the right subtree equ...
glaive
[ 0.008625026792287827, 0.02671593427658081, -0.04632691666483879, -0.03637149557471275, 0.03654692694544792, -0.04146869108080864, 0.005722530651837587, 0.07800354808568954, 0.036640942096710205, -0.023028990253806114, 0.022444333881139755, 0.011284167878329754, -0.03301877900958061, -0.022...
0.799054
0.782005
0.017049
You are tasked with creating a program that can efficiently solve a specific problem related to sorting and counting numbers in a given array. The problem is as follows: Given an array of integers, you need to write a function to calculate the number of 1-jolt differences multiplied by the number of 3-jolt differences...
glaive
[ 0.01534008327871561, 0.02886151894927025, -0.03227568790316582, -0.022887136787176132, 0.040050771087408066, -0.029667923226952553, -0.0350433774292469, 0.05787140130996704, 0.020434942096471786, -0.013001270592212677, 0.003672615624964237, 0.01987154595553875, -0.02584545500576496, -0.003...
0.836339
0.795838
0.040501
I have a problem where I need to find the smallest rectangle that encloses all black pixels in a binary matrix. The black pixels are connected horizontally, vertically, and diagonally. Given the location of one black pixel as (x, y), how can I calculate the area of the smallest rectangle that encloses all the black pix...
glaive
[ -0.006706144195050001, 0.04282771795988083, -0.02709089033305645, -0.03200305625796318, 0.028386564925312996, -0.017504921182990074, -0.021694939583539963, 0.04081103205680847, 0.04716523364186287, -0.01678549312055111, 0.02522173896431923, 0.03961896523833275, -0.014047878794372082, 0.001...
0.81407
0.788058
0.026012
You are tasked with creating a VHDL entity for a generic 61x61 multiplier. The entity should have input ports A and B, each of which is a 61-bit std_logic_vector, as well as EN and CLK inputs, and a PRODUCT output which is a 122-bit std_logic_vector. The multiplier should be implemented using combinatorial and sequenti...
glaive
[ 0.023367246612906456, 0.013592788949608803, -0.004087846260517836, -0.03493593633174896, 0.030439365655183792, -0.02018805593252182, -0.04359743744134903, 0.08960811048746109, 0.03821450099349022, -0.02429227903485298, 0.026382070034742355, 0.044129397720098495, -0.01712673529982567, -0.02...
0.788387
0.773109
0.015279
You are tasked with writing a program to solve the standard eigenvalue problem [A-lambda*I]x = 0 using the Lanczos method. The specific problem involves using the famous Wilkinson matrix W(N)+ as the matrix A. The program should use user-supplied subroutines OP and OPM to perform matrix-vector multiplication and vector...
glaive
[ 0.008820315822958946, 0.02534894272685051, -0.013211151584982872, -0.03905066102743149, 0.03294684737920761, -0.015755396336317062, 0.002790464088320732, 0.06411465257406235, 0.02193283848464489, -0.02724994346499443, 0.007037889212369919, 0.047738365828990936, -0.02185647375881672, 0.0170...
0.806466
0.782431
0.024035
You are tasked with implementing a function that converts a Church-encoded natural number to an integer. The Church encoding of natural numbers represents a non-negative integer n as a higher-order function that takes two arguments: a base case value and a function that represents the successor operation. The function ...
glaive
[ 0.052822500467300415, 0.005362821742892265, -0.029971588402986526, -0.03356045484542847, 0.030043629929423332, -0.027407551184296608, -0.015595139004290104, 0.05986303091049194, 0.03529418632388115, -0.0061072553507983685, 0.03991374000906944, 0.036969128996133804, -0.04584357514977455, -0...
0.799609
0.777307
0.022302