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 |
|---|---|---|---|---|---|
What is the code to create a program that takes an array of integers and returns an array with all numbers multiplied by two? | glaive | [
0.015159734524786472,
0.0426904559135437,
-0.0367429181933403,
-0.037495922297239304,
0.027490384876728058,
-0.03851034864783287,
-0.027788974344730377,
0.06096963584423065,
0.009888232685625553,
-0.04470684751868248,
0.014077224768698215,
0.04627389460802078,
-0.042593974620103836,
-0.022... | 0.807834 | 0.790524 | 0.01731 |
You are tasked with implementing a subroutine in Fortran that performs a fast Fourier transform (FFT) using the MRADF4 algorithm. The subroutine should take in the following parameters:
- M: an integer representing the size of the transform
- IDO: an integer representing the transform type
- L1: an integer representing... | glaive | [
0.02815817855298519,
0.05367562919855118,
-0.0207485593855381,
-0.04171036183834076,
0.0598636195063591,
-0.01933976076543331,
-0.006143263075500727,
0.04240642115473747,
0.04651910811662674,
0.012767085805535316,
0.027640150859951973,
0.02001860737800598,
-0.016302714124321938,
-0.0082655... | 0.784723 | 0.759271 | 0.025453 |
How can I implement a program in C to find the two missing numbers in an array of size n, where the elements of the array are from 1 to n+2? | glaive | [
0.013081048615276814,
0.03140151500701904,
-0.03436490148305893,
-0.03641175478696823,
0.03228097781538963,
-0.02735467068850994,
-0.025401795282959938,
0.06122920662164688,
0.013647305779159069,
-0.031262896955013275,
0.029006484895944595,
0.036424435675144196,
-0.043613363057374954,
-0.0... | 0.807775 | 0.784481 | 0.023293 |
I am using GCC + the terminal to make an array of prime numbers. I once asked on #C@irc.freenode.net, but I still don't understand: An int can store values on 32 bits (so a total of 2^32 unique values), but can't an array have more than 2^24 values? I'm not sure, but is [Why 24 bits registers?](https://stackoverflow.co... | glaive | [
0.02421683259308338,
0.0373915359377861,
-0.01542073953896761,
-0.015910813584923744,
0.03743601590394974,
-0.05432266741991043,
-0.04492916166782379,
0.08338134735822678,
0.026669496670365334,
-0.03773459792137146,
0.03337293118238449,
0.028880221769213676,
-0.0317864790558815,
-0.0348804... | 0.797633 | 0.775972 | 0.021661 |
You are tasked with implementing a Fortran subroutine that computes the RQ factorization of a complex matrix A. The RQ factorization decomposes the matrix A into the product of an upper triangular matrix R and a unitary matrix Q. The subroutine has the following signature:
```fortran
SUBROUTINE ZGERQF(M,N,A,LDA,TAU,WO... | glaive | [
0.02254151739180088,
0.050357669591903687,
-0.014976585283875465,
-0.03707093372941017,
0.030002538114786148,
-0.01079447753727436,
0.002493028063327074,
0.0407346710562706,
0.033952903002500534,
-0.011517973616719246,
0.017911020666360855,
0.03486820310354233,
-0.025012066587805748,
-0.00... | 0.807631 | 0.783663 | 0.023967 |
You are tasked with creating a program to calculate the probability amplitudes and visualize the probability distribution for a quantum system with 16 qubits and 4 states. The program should use the given amplitude and probability functions to find the maximum probability and plot a 3D graph and contour plot of the pro... | glaive | [
0.01174222119152546,
0.02092987857758999,
-0.033742550760507584,
-0.026824383065104485,
0.05233633890748024,
-0.03969576954841614,
-0.03415251895785332,
0.06362324953079224,
0.03867844492197037,
-0.007156963460147381,
0.027096303179860115,
0.03826478496193886,
-0.006063262466341257,
-0.025... | 0.802706 | 0.779445 | 0.023261 |
You are tasked with writing a program that generates prime numbers written in base 4. The program should output the sequence of prime numbers written in base 4, where each number is represented as a string. The output should be a comma-separated list of these prime numbers. | glaive | [
0.03905103728175163,
0.030335664749145508,
-0.009034314192831516,
-0.03268275782465935,
0.04467495158314705,
-0.04539002478122711,
-0.01093809213489294,
0.047861285507678986,
0.052113424986600876,
-0.01699179783463478,
0.03216566517949104,
0.03484613820910454,
-0.034508220851421356,
-0.031... | 0.801974 | 0.770893 | 0.031081 |
You are required to create a C++ class that calculates the training log-likelihood for a Gaussian process. The class should take in a set of points, targets, a kernel, and a noise parameter, and should be able to evaluate the log-likelihood for a given set of parameters. The class should also provide the number of para... | glaive | [
-0.01740391179919243,
0.016832968220114708,
-0.02407960779964924,
-0.03478747978806496,
0.05077056959271431,
-0.012730889022350311,
-0.03490794822573662,
0.08063638210296631,
0.030910633504390717,
-0.03043459542095661,
0.01707988604903221,
0.04079641401767731,
-0.020402483642101288,
-0.000... | 0.802114 | 0.785078 | 0.017036 |
I have a C++ program that needs to calculate the sum of numbers in an array. In addition to the sum, I also need to calculate the sum of the products of adjacent pair elements and the sum of the absolute differences between adjacent pair elements. There is some erroneous code that I need to fix. The array is initialize... | glaive | [
0.026459872722625732,
0.030634615570306778,
-0.012743024155497551,
-0.021817997097969055,
0.05776897072792053,
0.008040614426136017,
-0.03566615656018257,
0.11153677850961685,
0.030457433313131332,
-0.011015948839485645,
0.0072393110021948814,
0.021235359832644463,
-0.03876817598938942,
-0... | 0.81451 | 0.777538 | 0.036973 |
You are tasked with implementing a CUDA kernel to perform complex matrix multiplication using the given code snippet as a reference. Your task is to write a CUDA kernel function that takes in three arrays of type `struct ComplexFloat`, named AT, X, and Y, along with four scalars of type float, named alpha_im, alpha_re,... | glaive | [
0.021632948890328407,
0.06064016744494438,
-0.020008748397231102,
-0.027467891573905945,
0.031222224235534668,
-0.008263067342340946,
-0.03119577094912529,
0.09468336403369904,
0.04344495013356209,
-0.021373001858592033,
0.023728396743535995,
0.03416302800178528,
-0.02042483352124691,
-0.0... | 0.794546 | 0.776623 | 0.017923 |
You are tasked with implementing a function to calculate the floor of 1 divided by the fractional part of the nth root of a given number x. The function should take two parameters: the number x and the value of n. The fractional part of a number is the non-integer part of the number after the decimal point. For example... | glaive | [
0.016807254403829575,
0.044738538563251495,
-0.01693078503012657,
-0.034631215035915375,
0.0462832897901535,
-0.03112100437283516,
-0.004216304048895836,
0.052563417702913284,
0.024793636053800583,
0.004327079281210899,
0.02186872623860836,
0.03191785514354706,
-0.04876839369535446,
0.0134... | 0.804796 | 0.766339 | 0.038457 |
You are given a list of boarding passes, where each pass is a string of 10 characters. The first 7 characters represent the row number (in binary space partitioning format, where "F" means lower half and "B" means upper half), and the last 3 characters represent the column number (in binary space partitioning format, w... | glaive | [
0.012931742705404758,
0.041946813464164734,
-0.02751564234495163,
-0.0468776635825634,
0.03594059869647026,
-0.03349515050649643,
-0.0045400941744446754,
0.030933381989598274,
0.05327427759766579,
-0.004221728537231684,
0.03333986923098564,
0.026917358860373497,
-0.023227998986840248,
-0.0... | 0.813209 | 0.790228 | 0.022982 |
You are required to create a program that generates two random numbers, factor1 and factor2, each within a specific range. You then need to calculate the product of each factor with another randomly generated number, factor3 and factor4 respectively. After this, the program should randomly choose whether to add or subt... | glaive | [
0.02041078731417656,
0.028639866039156914,
-0.028713662177324295,
-0.03010951168835163,
0.033655568957328796,
-0.010785745456814766,
-0.0392623245716095,
0.06661548465490341,
0.04561104625463486,
-0.015623275190591812,
0.009657826274633408,
0.048487044870853424,
-0.03597838431596756,
-0.01... | 0.815763 | 0.790487 | 0.025276 |
You are tasked with writing a program that performs integer division using the `idiv` instruction in x86 assembly language. The program should take two input integers and return the result of dividing the first integer by the second integer. You are required to use the 32-bit register for this division and ensure that ... | glaive | [
0.016592275351285934,
0.016835834830999374,
-0.01843106746673584,
-0.013015864416956902,
0.03249499574303627,
-0.011752573773264885,
-0.013657668605446815,
0.07923606038093567,
0.05513506755232811,
-0.02300325594842434,
0.03937074542045593,
0.020433446392416954,
-0.02532489039003849,
-0.00... | 0.803173 | 0.781684 | 0.021489 |
You are tasked with implementing a function in CUDA and/or C++ that calculates the derivative of a rotation matrix (R) with respect to the input vector (u). The rotation matrix is represented as a 3x3 matrix and the input vector is a 1x3 vector. You are provided with the following helper functions:
- `static float safe... | glaive | [
0.011786592192947865,
0.03874669969081879,
-0.0355583131313324,
-0.03514007478952408,
0.03390314057469368,
-0.009856504388153553,
-0.0217988770455122,
0.09100404381752014,
0.03386712819337845,
-0.007631317246705294,
0.01811995729804039,
0.041218746453523636,
-0.021439623087644577,
0.001079... | 0.788516 | 0.769892 | 0.018624 |
How can I design a program that finds the maximum value in an array of numbers? | glaive | [
0.01866680383682251,
0.02253173291683197,
-0.04651550203561783,
-0.02504701167345047,
0.041550710797309875,
-0.034556642174720764,
-0.018774081021547318,
0.05027565360069275,
0.024919969961047173,
-0.040497664362192154,
0.02589103765785694,
0.05527711287140846,
-0.039325594902038574,
-0.01... | 0.799933 | 0.77991 | 0.020024 |
You are required to preprocess a network to make it look properly and then define clusters for the network using a specific algorithm. After defining the clusters, you need to compute the density of the obtained clusters and then compute the ratio of inner cluster connections to outer ones. Finally, you are tasked with... | glaive | [
0.012545572593808174,
0.011620243079960346,
-0.05239655822515488,
-0.01236121729016304,
0.029134878888726234,
-0.013105575926601887,
-0.05138710141181946,
0.02882874198257923,
0.040140651166439056,
0.000330920098349452,
0.02995304949581623,
0.028665045276284218,
-0.020773667842149734,
-0.0... | 0.810432 | 0.788242 | 0.02219 |
You are tasked with creating a Haskell program that generates anagrams for a given input. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once. The program should take an integer n as a command line argument and read a list of words ... | glaive | [
0.034807488322257996,
0.015309949405491352,
-0.0028448961675167084,
-0.02173861861228943,
0.011878418736159801,
-0.02912367880344391,
-0.018154993653297424,
0.04902788624167442,
0.03790930658578873,
-0.04945414885878563,
0.006234649568796158,
0.03248926252126694,
-0.03091210126876831,
-0.0... | 0.796277 | 0.778484 | 0.017793 |
You are tasked with implementing a proximal mapping function in Julia. The proximal mapping is defined as follows:
prox_{γf}(x) = argminz { f(z) + (1/2γ)‖z-x‖^2 }
The function should take in the function f, the input vector x, and the stepsize γ, and return the output vector y and the value of f at y.
Write a Julia fu... | glaive | [
-0.011361275799572468,
0.04535307362675667,
-0.017353754490613937,
-0.0484265461564064,
0.03788166120648384,
-0.01627051830291748,
-0.0032154370564967394,
0.07020945847034454,
0.04453723132610321,
0.008984417654573917,
0.010863978415727615,
0.02738531492650509,
-0.010126445442438126,
-0.00... | 0.789197 | 0.77159 | 0.017607 |
You are required to implement a subroutine that computes the SVD of the coefficient matrix in compact form. This is an intermediate step in solving the least squares problem by computing the SVD of the coefficient matrix in compact form. The singular vectors are computed as products of simple orthogonal matrices. The s... | glaive | [
0.0010774896945804358,
0.04118715971708298,
-0.03821033984422684,
-0.03788844123482704,
0.04342532530426979,
-0.0002464645658619702,
-0.012638029642403126,
0.07795370370149612,
0.051297325640916824,
-0.012414337135851383,
0.014548733830451965,
0.029727259650826454,
-0.011242498643696308,
-... | 0.806818 | 0.781969 | 0.024849 |
You are tasked with creating a program that manipulates and processes collections in Kotlin.
You need to write a program that does the following:
- Takes a string "1234123412341234" and chunks it into groups of 4, then joins them with a hyphen between each group.
- Creates a map with integer keys representing months... | glaive | [
0.03144846856594086,
0.014525615610182285,
-0.010229255072772503,
-0.037348952144384384,
0.038874413818120956,
-0.05045222491025925,
-0.006419193930923939,
0.05099974945187569,
0.016670146957039833,
-0.017744693905115128,
0.011556153185665607,
0.035334810614585876,
-0.02957915887236595,
0.... | 0.821558 | 0.801745 | 0.019813 |
How can I write an algorithm in Python to find the element with the highest frequency in an array?
Data = [1, 4, 2, 6, 2, 1, 2, 9] | glaive | [
0.03260950744152069,
0.026086943224072456,
-0.036531589925289154,
-0.02129669114947319,
0.024784531444311142,
-0.028660684823989868,
-0.015710048377513885,
0.05288415402173996,
0.015286439098417759,
-0.018208086490631104,
0.028786614537239075,
0.03398667648434639,
-0.031473223119974136,
0.... | 0.814537 | 0.782651 | 0.031887 |
You are tasked with implementing a program to calculate the values of the sequence A105635, where a(n) = (2*Pell(n+1) - (1+(-1)^n))/4.
Write a function or program that takes an input n and returns the value of a(n).
For example, for n = 5, the output should be 35. | glaive | [
0.02954855002462864,
0.04185182973742485,
-0.009670994244515896,
-0.027199827134609222,
0.02744121290743351,
-0.026021938771009445,
-0.03559532389044762,
0.072175994515419,
0.028601597994565964,
-0.00793907418847084,
0.02881905809044838,
0.039603155106306076,
-0.04037894681096077,
-0.00840... | 0.831856 | 0.783882 | 0.047974 |
You are tasked with creating a VHDL program for a display driver for a seven-segment display. The program should take in input values and decimal points and output the corresponding decimal points and seven-segment display values. The program should also include a clock enable entity and a 4-to-1 mux for selection bits... | glaive | [
0.02383344992995262,
0.01556805893778801,
-0.029419714584946632,
-0.035797715187072754,
0.03670315816998482,
-0.02301396243274212,
-0.04560881853103638,
0.059764716774225235,
0.04353765770792961,
-0.02639622427523136,
0.02658778801560402,
0.05885006859898567,
-0.006313089746981859,
0.00147... | 0.804691 | 0.78928 | 0.015411 |
You are tasked with creating a function that generates product fields for a given number n. The function should take an integer n as input and return a list of product fields with the following format: (FIELD1 integerp), (FIELD2 integerp), ... (FIELDn integerp).
Create the function make-prod-fields that takes an integ... | glaive | [
0.03301849588751793,
0.019776510074734688,
-0.04473891481757164,
-0.03291724622249603,
0.04751849174499512,
-0.03623075410723686,
-0.037436410784721375,
0.05546901002526283,
0.03760896995663643,
0.008626269176602364,
0.008054298348724842,
0.04691716656088829,
-0.03863685205578804,
-0.02894... | 0.794041 | 0.774259 | 0.019781 |
You are given a set of input values represented as an array of unsigned 32-bit integers. Your task is to implement a function to calculate the most common bit-values in the input set and return an integer representing these bit-values.
You need to define a function `getMostCommonBitSet(num_bits: u5, inputs: []u32) u32... | glaive | [
0.018506521359086037,
0.029383765533566475,
-0.032092295587062836,
-0.016047492623329163,
0.05577465146780014,
-0.03321893885731697,
-0.03172780200839043,
0.061043865978717804,
0.03838302567601204,
-0.009129000827670097,
0.0398189015686512,
0.02366291917860508,
-0.011936276219785213,
0.005... | 0.832886 | 0.798501 | 0.034385 |
You are tasked with writing a program in assembly language that calculates the least prime factor of a given number n. The program should take the input number n, and then output the least prime factor of n. | glaive | [
0.017853032797574997,
0.03334668278694153,
-0.01874212734401226,
-0.04464120417833328,
0.03388958424329758,
-0.035249512642621994,
-0.01414539571851492,
0.056750956922769547,
0.040332499891519547,
-0.014529990032315254,
0.02899477258324623,
0.028993703424930573,
-0.03049144335091114,
-0.02... | 0.818159 | 0.786421 | 0.031738 |
You are tasked with creating a program that simulates the behavior of a system of nodal cilia, which are microscopic hair-like structures found in the respiratory system. The program takes in several input parameters and uses them to calculate the motion and behavior of the cilia over a specified number of time steps.
... | glaive | [
-0.0065425727516412735,
0.008525526151061058,
-0.0363122932612896,
-0.02645827829837799,
0.030649421736598015,
-0.031020289286971092,
-0.04357628524303436,
0.07332240790128708,
0.01784672960639,
-0.010405826382339,
0.02359905280172825,
0.04170047491788864,
-0.03008982352912426,
-0.01202771... | 0.808718 | 0.782771 | 0.025948 |
You are tasked with writing a program to calculate the dimension of the space of weight 2n cuspidal newforms for a given group. The input will consist of the weight (2n) and the group (in this case, Gamma_0(22)). Your program should then output the dimension of the space of weight 2n cuspidal newforms for the given gro... | glaive | [
0.0041450816206634045,
0.04239270091056824,
-0.04803941026329994,
-0.045782119035720825,
0.035402413457632065,
-0.029099196195602417,
-0.030937111005187035,
0.07240191102027893,
0.03284323215484619,
-0.013132392428815365,
0.026518477126955986,
0.03693469613790512,
-0.03211789205670357,
-0.... | 0.805508 | 0.772654 | 0.032854 |
How can I create a program in Java that rotates an array of elements by a given number of elements? | glaive | [
0.00879413727670908,
0.02154815010726452,
-0.02841443568468094,
-0.014676577411592007,
0.01984502375125885,
-0.03426135331392288,
-0.016354717314243317,
0.038610100746154785,
0.010330590419471264,
-0.04528454691171646,
0.014201964251697063,
0.029885683208703995,
-0.05367923155426979,
-0.01... | 0.788333 | 0.770307 | 0.018026 |
You are tasked with implementing a function that facilitates the movement of chess pieces on a board. The function should take into account the color of the piece and the direction it is moving in. The goal is to create a function that can accurately calculate the possible movements of a chess piece based on its color ... | glaive | [
0.011716191656887531,
0.029418693855404854,
-0.03357590734958649,
-0.02236875891685486,
0.033479396253824234,
-0.003974834457039833,
-0.04307088628411293,
0.058659594506025314,
0.04419510066509247,
-0.012273082509636879,
0.03110416978597641,
0.03469329699873924,
-0.013289747759699821,
-0.0... | 0.794883 | 0.775085 | 0.019798 |
You are tasked with creating a program that calculates the maximum value of a complex function over a specified range of variables. The function to be maximized is defined as follows:
function[x_, y_] := $Conjugate[Exp[-16 I y] (1 (I Sin[x])^7 Cos[x]^9 + 1 (I Sin[x])^9 Cos[x]^7) + ... + 1 (I Sin[x])^9 Cos[x]^7)]
You ... | glaive | [
0.02425548993051052,
0.02889702469110489,
-0.05609343573451042,
-0.03615156188607216,
0.038331568241119385,
-0.01367612462490797,
-0.0239256639033556,
0.04980197548866272,
0.05273748189210892,
-0.005392259918153286,
0.04396172985434532,
0.0578254871070385,
-0.030720459297299385,
-0.0055708... | 0.797271 | 0.76605 | 0.03122 |
You are tasked with creating a C++ program that calculates the square of a given number. Your program should take an input from the user, calculate the square, and then display the result. | glaive | [
0.02386368252336979,
0.04040908068418503,
-0.03678830713033676,
-0.04111691564321518,
0.055785171687603,
-0.011823653243482113,
-0.018900146707892418,
0.08709429949522018,
0.052717871963977814,
-0.025588246062397957,
0.027735870331525803,
0.03845894709229469,
-0.04931563138961792,
-0.03217... | 0.794461 | 0.763557 | 0.030904 |
You are tasked with creating a program that calculates the decimal expansion of the mathematical constant phi (Φ) rounded to a specified number of decimal places. The program should take an input, n, representing the number of decimal places to round phi to, and then output the decimal expansion of phi to n places.
Fo... | glaive | [
0.006967316847294569,
0.031205935403704643,
-0.024086564779281616,
-0.039304934442043304,
0.04805665463209152,
-0.03401181846857071,
0.0008185061160475016,
0.04267670959234238,
0.039744652807712555,
-0.012945832684636116,
0.012524064630270004,
0.0306366216391325,
-0.05674342066049576,
-0.0... | 0.812755 | 0.783532 | 0.029223 |
You are tasked with implementing a function in R that converts a set of coordinates into a linear index based on the given dimensions of a multi-dimensional array.
The function should take in two parameters:
- coords: a matrix of coordinates, where each row represents a set of coordinates for a specific dimension
- di... | glaive | [
0.0027527420315891504,
0.05679512023925781,
-0.03165354207158089,
-0.05338001996278763,
0.040677037090063095,
-0.018159497529268265,
-0.04111912101507187,
0.05837755277752876,
0.032559409737586975,
-0.0016687631141394377,
0.008670798502862453,
0.031765200197696686,
-0.03473246097564697,
-0... | 0.792927 | 0.764325 | 0.028602 |
Can you provide an optimized solution to find the longest common subsequence of characters between two given strings? | glaive | [
0.018257705494761467,
0.013121471740305424,
-0.03342815861105919,
-0.03518884256482124,
0.024113062769174576,
-0.03553106263279915,
-0.01447363942861557,
0.023937156423926353,
0.04361587017774582,
-0.04186973348259926,
0.021350029855966568,
0.024486517533659935,
-0.02197463996708393,
-0.00... | 0.814511 | 0.791317 | 0.023194 |
Can you provide a Java algorithm for performing a linear search on a given data structure? | glaive | [
-0.017075393348932266,
0.013336283154785633,
-0.052478838711977005,
-0.03438384458422661,
0.02243063785135746,
-0.04563938453793526,
-0.016966687515378,
0.03986567258834839,
0.0330965593457222,
-0.04929578676819801,
0.03217368200421333,
0.010062006302177906,
-0.03985460847616196,
-0.011708... | 0.798747 | 0.7834 | 0.015348 |
You are tasked with implementing a Fortran function that calculates the value of the one norm, Frobenius norm, infinity norm, or the largest absolute value of any element of an upper Hessenberg matrix. The function will take in the type of norm to be calculated, the order of the matrix, the matrix itself, the leading d... | glaive | [
0.0033629564568400383,
0.014449541456997395,
-0.03513503447175026,
-0.037344589829444885,
0.03842853382229805,
-0.01729906164109707,
-0.02789897657930851,
0.06143525615334511,
0.03590035066008568,
-0.009370465762913227,
0.00619560107588768,
0.04349643737077713,
-0.02177741564810276,
-0.013... | 0.805886 | 0.778735 | 0.027151 |
You are tasked with implementing a function that merges two weighted streams based on a given weight function. The function should take two streams `s1` and `s2`, and a weight function `weight`. The weight function takes a pair of elements from the streams and returns a numerical value representing their weight.
Your... | glaive | [
0.01908314973115921,
0.029000921174883842,
-0.02005808800458908,
-0.027770329266786575,
0.04665716364979744,
-0.01592368446290493,
-0.011944366618990898,
0.07730437070131302,
0.03317355737090111,
0.005554668605327606,
0.031433362513780594,
0.022708095610141754,
-0.019824497401714325,
-0.01... | 0.808814 | 0.785533 | 0.023281 |
You are tasked with creating a function to compute the sum of integers from 0 to a given number. The function should take a single parameter, the upper limit of the range, and return the sum of all integers from 0 to that number. You should also create a benchmarking function to test the performance of your sum functio... | glaive | [
0.009449883364140987,
0.03136913478374481,
-0.03166546672582626,
-0.011191853322088718,
0.04530918598175049,
-0.014624673873186111,
-0.03306224197149277,
0.04566358029842377,
0.03114929050207138,
-0.006461231037974358,
0.007819433696568012,
0.045439183712005615,
-0.03400043398141861,
-0.01... | 0.810401 | 0.781115 | 0.029285 |
You are tasked with implementing a quantum probability distribution function using the given code snippet as an inspiration. The goal is to create a function that calculates the probability of a quantum state using the provided amplitude function. Additionally, you need to find the maximum probability for a given range... | glaive | [
-0.005822526291012764,
0.026568682864308357,
-0.026794711127877235,
-0.02921529859304428,
0.04658964276313782,
-0.020356560125947,
-0.015471162274479866,
0.06631172448396683,
0.03579995408654213,
0.007612011395394802,
0.028430413454771042,
0.02832869067788124,
-0.0035214016679674387,
-0.01... | 0.779756 | 0.76313 | 0.016626 |
You are tasked with implementing a function in Zig that combines four unsigned 8-bit integers into a single 32-bit integer. The function signature should be `fn combine(a: u8, b: u8, c: u8, d: u8) u32`. You should shift the bits of each input value to the left by a specific number of positions and then combine them usi... | glaive | [
0.006507369223982096,
0.04003671556711197,
-0.010950612835586071,
-0.02773667685687542,
0.048107121139764786,
0.007480979431420565,
-0.01493479497730732,
0.03920750692486763,
0.03950336202979088,
0.0038800740148872137,
0.023613525554537773,
0.027850573882460594,
-0.01410615537315607,
-0.03... | 0.814006 | 0.796247 | 0.017759 |
You are tasked with implementing a subroutine in Fortran called SGTSVX to solve a system of linear equations A * X = B for GT matrices. The subroutine takes in various input parameters such as the factored form of the matrix A, the form of the system of equations, the order of the matrix A, the number of right hand sid... | glaive | [
0.00877803098410368,
0.011436672881245613,
-0.03212042897939682,
-0.05154244974255562,
0.039328668266534805,
-0.02699158526957035,
-0.012162446975708008,
0.0695745050907135,
0.04607788100838661,
-0.013967270962893963,
0.020308298990130424,
0.04043349251151085,
-0.0181571114808321,
-0.00222... | 0.798399 | 0.774112 | 0.024287 |
You are tasked with implementing a CUDA program that adds two arrays of floating-point numbers together. The program should use the CUDA framework and the provided code snippet as a reference. The program should include a kernel function `sum2arrays` that takes in two arrays `a` and `b`, and computes the sum into array... | glaive | [
-0.007162242662161589,
0.048540495336055756,
-0.01833128184080124,
-0.028750838711857796,
0.03988851606845856,
-0.004746865015476942,
-0.022334517911076546,
0.08708272129297256,
0.04727223515510559,
-0.022076841443777084,
0.017491957172751427,
0.042422279715538025,
-0.0006024098256602883,
... | 0.793574 | 0.774758 | 0.018816 |
You are tasked with creating a program that reads data from a file and performs a Gaussian Mixture Model (GMM) on the data using both CPU and GPU. The program should take command-line arguments for the file name, the number of clusters (k), the number of iterations, and the dimensionality of the data.
The program shou... | glaive | [
-0.003280358389019966,
0.01066308282315731,
-0.012458044104278088,
-0.04089290648698807,
0.0345962718129158,
-0.0017662623431533575,
-0.042935848236083984,
0.08581593632698059,
0.03386496752500534,
-0.02416384592652321,
0.009486806578934193,
0.03933422267436981,
0.0018573615234345198,
0.01... | 0.796801 | 0.781262 | 0.015539 |
You are tasked with implementing a CUDA-accelerated function for ROI merging in a computer vision application. The function should take as input five CUDA tensors: S, J, C, D, and P. These tensors represent the following:
- S: A 2D CUDA tensor with dimensions (num_roi, 1)
- J: A 2D CUDA tensor with dimensions (num_roi,... | glaive | [
0.020832635462284088,
0.050933122634887695,
-0.014184811152517796,
-0.01944641023874283,
0.02139679528772831,
0.006710459012538195,
-0.02245490439236164,
0.08966577053070068,
0.048267628997564316,
-0.002083485946059227,
0.022351272404193878,
0.00818467978388071,
0.01519723143428564,
-0.002... | 0.811298 | 0.792902 | 0.018395 |
You are tasked with creating a simulation of a world with different types of animals. The world is represented by a grid, and each grid cell can either be empty or occupied by a specific type of animal. The animals can be predators, prey, or inert objects.
You need to implement the following functionalities:
1. Add an... | glaive | [
0.0008069569594226778,
0.028052065521478653,
-0.021448442712426186,
-0.03784657642245293,
0.034367676824331284,
-0.05533283203840256,
-0.037215836346149445,
0.06900598853826523,
0.03758261352777481,
-0.027906032279133797,
0.025828955695033073,
0.038532353937625885,
-0.03161182627081871,
-0... | 0.806468 | 0.792164 | 0.014304 |
You are tasked with creating a program that can flatten a nested list. The input will be a custom data structure called UAList, which can have three possible forms:
1. NoItems: This represents an empty list.
2. One: This represents a single item in the list.
3. Append: This represents a nested list, with two sublists t... | glaive | [
-0.0018193976720795035,
0.022978177294135094,
-0.01999036781489849,
-0.035626474767923355,
0.05607923865318298,
-0.004321965854614973,
0.0012172781862318516,
0.07423080503940582,
0.05690013989806175,
-0.011026425287127495,
0.00929900910705328,
0.036318790167570114,
-0.020541666075587273,
-... | 0.80941 | 0.794452 | 0.014959 |
You are given a set of domains, where each domain contains a list of options. You need to solve a logic puzzle based on the given constraints. The constraints are in the form of logical operations and comparisons between the options in the domains. Your task is to determine the exact values of each option within the do... | glaive | [
0.0035164880100637674,
0.016331112012267113,
-0.03463352471590042,
-0.026546848937869072,
0.03657347708940506,
-0.027337873354554176,
-0.0166952945291996,
0.029790204018354416,
0.06729234009981155,
-0.0240174587816,
0.01243511214852333,
0.049377989023923874,
-0.022519957274198532,
0.008665... | 0.810542 | 0.778217 | 0.032326 |
You need to implement a CUDA kernel that performs tensor concatenation and splitting. The kernel should be able to concatenate or split tensors of different data types (int8, int16, int32, int64, float16, bfloat16, float32, float64) and handle different dimensions of tensors.
The concatenation kernel should take in a ... | glaive | [
0.014566518366336823,
0.041680507361888885,
-0.013319524936378002,
-0.01995239034295082,
0.0327964648604393,
0.000736340822186321,
-0.027125494554638863,
0.08333441615104675,
0.03660701960325241,
-0.02882651425898075,
0.03086397424340248,
0.03702632337808609,
-0.008110263384878635,
-0.0044... | 0.803112 | 0.785941 | 0.017171 |
You are tasked with creating a JavaScript function that takes in an array of strings and returns a new array that contains only the unique strings from the original array. The function should ignore case sensitivity, meaning "hello" and "Hello" should be considered the same string. The output array should maintain the ... | glaive | [
-0.0022575363982468843,
0.0467134527862072,
-0.007539493031799793,
-0.03265834599733353,
0.037371035665273666,
-0.03356609493494034,
-0.010438695549964905,
0.048758067190647125,
0.03788634389638901,
-0.009452935308218002,
0.01756095327436924,
0.002933256793767214,
-0.027025381103157997,
-0... | 0.786179 | 0.759044 | 0.027135 |
Write a C++ program to calculate the Body Mass Index (BMI) of a person using the formula:
BMI = weight (kg) / (height (m) * height (m))
The program should take input for weight and height from the user and then calculate and display the BMI. It should also provide a message indicating whether the person is underweight,... | glaive | [
0.015789540484547615,
0.019639980047941208,
-0.036258358508348465,
-0.048987437039613724,
0.04825383797287941,
-0.04575314000248909,
-0.032701559364795685,
0.07864250987768173,
0.05167116969823837,
-0.027028381824493408,
0.02907930314540863,
0.03838915005326271,
-0.020993411540985107,
-0.0... | 0.77821 | 0.763841 | 0.014369 |
Can you provide a function that checks if an array contains all the numbers from 1 to n? | glaive | [
0.014326898381114006,
0.030167540535330772,
-0.02814985252916813,
-0.0207472275942564,
0.03266828879714012,
-0.0574030838906765,
-0.005101287271827459,
0.0413823164999485,
0.013346471823751926,
-0.028283707797527313,
0.016467692330479622,
0.03770885989069939,
-0.03564102202653885,
-0.03115... | 0.808265 | 0.788338 | 0.019927 |
You are tasked with implementing a program that simulates a specific process of cycling through a given collection of integers. The process involves repeatedly applying a set of rules to the collection for a specified number of cycles. For each cycle, the program must modify the collection based on the rules, and at th... | glaive | [
0.01982189156115055,
0.0121208680793643,
-0.025862345471978188,
-0.011449139565229416,
0.03658679500222206,
-0.043696869164705276,
-0.022859085351228714,
0.07162788510322571,
0.022827068343758583,
-0.03590629622340202,
0.018278174102306366,
0.0272838082164526,
-0.03365651145577431,
0.00623... | 0.829587 | 0.798662 | 0.030926 |
You are tasked with implementing a Point3D class in C++ that supports various operations. The Point3D class should have the following functionality:
1. The ability to find the minimum and maximum elements of a Point3D object.
2. Overloading the + and - operators to support addition and subtraction of a scalar value or... | glaive | [
0.02652052976191044,
0.021352950483560562,
-0.024569006636738777,
-0.02855725958943367,
0.036976102739572525,
-0.023032918572425842,
-0.021430904045701027,
0.09898743778467178,
0.05473187193274498,
-0.004537633620202541,
0.02901557646691799,
0.05515580251812935,
-0.013935953378677368,
-0.0... | 0.788837 | 0.767854 | 0.020983 |
You are tasked with implementing a parallel algorithm to compute a GMT (Graph-based Motion Planning) wavefront. The wavefront spans from an initial point to a goal point through a field of obstacles, and the algorithm aims to find the optimal path that avoids these obstacles. The wavefront is represented by a series of... | glaive | [
0.00032375543378293514,
0.04412364959716797,
0.00027655958547256887,
-0.02272866666316986,
0.025567078962922096,
0.003858365584164858,
-0.05010503903031349,
0.10204576700925827,
0.04236544296145439,
-0.01966579258441925,
0.019540030509233475,
0.03543471172451973,
0.007664983626455069,
0.00... | 0.802924 | 0.772681 | 0.030243 |
You are tasked with creating a quantum circuit in Qiskit to solve an optimization problem. Given a graph G with nodes V and edges E, and a set of parameters gamma and beta, you need to create a quantum circuit to find the optimal values of gamma and beta that minimize a given function F1. The graph and its parameters a... | glaive | [
-0.016480300575494766,
0.029789362102746964,
-0.02666296996176243,
-0.025978049263358116,
0.031115306541323662,
-0.045392367988824844,
-0.038660936057567596,
0.050426434725522995,
0.024952616542577744,
-0.015804896131157875,
0.030254371464252472,
0.03553689271211624,
-0.0160954799503088,
-... | 0.808882 | 0.784686 | 0.024197 |
You are tasked with implementing the sweep operator in Julia, as described by Goodnight, J. (1979) in "A Tutorial on the SWEEP Operator" in The American Statistician. The sweep operator is used for matrix manipulation and is implemented in the `sweep_op_internal!` function. The function takes in an AbstractMatrix of ty... | glaive | [
-0.006781031843274832,
0.03430033102631569,
-0.035328663885593414,
-0.05133527144789696,
0.0447031706571579,
-0.020055998116731644,
-0.013116174377501011,
0.0829964354634285,
0.04344050958752632,
-0.012016060762107372,
0.01861891709268093,
0.029888538643717766,
-0.02482081949710846,
-0.019... | 0.804484 | 0.78815 | 0.016334 |
How can I sort a given list of tuples in ascending order based on the second element of each tuple? Additionally, if two or more tuples have the same second element, how can I sort those tuples among themselves in descending order based on the first element?
For example, consider the following list of tuples:
```Pyth... | glaive | [
0.038848135620355606,
0.026866085827350616,
-0.016970248892903328,
-0.03432474285364151,
0.033987537026405334,
-0.038704074919223785,
-0.012825820595026016,
0.0562220960855484,
0.014225638471543789,
-0.022747134789824486,
0.020876986905932426,
0.007193295750766993,
-0.03706512972712517,
0.... | 0.800265 | 0.783494 | 0.01677 |
You are tasked with implementing the InsertionSortWithoutExchanges class in C# that extends the AbstractSort class. This class should include a method called Sort that takes in an array of generic type T and returns the sorted array. The Sort method should implement the insertion sort algorithm without using exchanges.... | glaive | [
0.02604297362267971,
0.010062940418720245,
-0.00897958129644394,
-0.017779259011149406,
0.027872223407030106,
-0.025899900123476982,
-0.020097075030207634,
0.07850378751754761,
0.044366154819726944,
-0.030731871724128723,
0.02294554002583027,
0.022549279034137726,
-0.030031392350792885,
-0... | 0.808876 | 0.784036 | 0.02484 |
How can I generate a C++ program to implement a binary search algorithm on a sorted array of integers and return the number of iterations needed to find the target number? | glaive | [
0.0036743974778801203,
0.021216554567217827,
-0.03676925599575043,
-0.024845857173204422,
0.03409108147025108,
-0.02421623095870018,
-0.04563480615615845,
0.06820407509803772,
0.03795488178730011,
-0.028377842158079147,
0.020963342860341072,
0.03214934095740318,
-0.02792421728372574,
-0.00... | 0.813095 | 0.797094 | 0.016 |
You are tasked with developing a program to calculate load curves for different activities in a rural area of Kenya. The load curves represent the variation in electricity demand over time for specific activities. The activities include crop processing, irrigation, and productive activities. The load curves are essenti... | glaive | [
0.009245232678949833,
0.04234553873538971,
-0.04104861989617348,
-0.05337872728705406,
0.03504948318004608,
-0.04645343869924545,
-0.01139833778142929,
0.043595779687166214,
0.0184076689183712,
-0.01012334693223238,
0.012690062634646893,
0.008372693322598934,
-0.03273818641901016,
0.015194... | 0.760911 | 0.746554 | 0.014357 |
You are tasked with creating a program that calculates the probability of a quantum state for a given set of parameters and then visualizes the probability distribution in a 3D plot and a contour plot. The quantum state is defined by the amplitude function, which takes two input parameters (x and y) and returns a compl... | glaive | [
0.007477087900042534,
0.03589722886681557,
-0.0363490954041481,
-0.030252696946263313,
0.04924432560801506,
-0.019586196169257164,
-0.013262161053717136,
0.08590229600667953,
0.029827646911144257,
0.007705224212259054,
0.02844134531915188,
0.03160366415977478,
-0.023554973304271698,
-0.014... | 0.797197 | 0.769026 | 0.028171 |
You are tasked with implementing a CUDA kernel function to reverse the data along a specified axis in a given array. The function should take in the input data, reverse it along the specified axis, and store the result in an output array.
The signature of the CUDA kernel function should be:
```cpp
template <typename D... | glaive | [
-0.0011431906605139375,
0.05552402883768082,
-0.01402194332331419,
-0.023311251774430275,
0.028296247124671936,
-0.021470624953508377,
-0.027302421629428864,
0.10756940394639969,
0.052413973957300186,
0.0038062555249780416,
0.020658018067479134,
0.0377570204436779,
-0.004505356773734093,
0... | 0.796903 | 0.777332 | 0.019571 |
You are tasked with creating a program that calculates the probability of a quantum system being in a certain state, and then visualizing the results. The program should use the given functions `amplitude[x_,y_]`, `amplitude2[x_,y_]`, and `probability[x_, y_]` to calculate the probability, and then use the `NMaximize` ... | glaive | [
-0.003994770813733339,
0.028415506705641747,
-0.030080825090408325,
-0.022324977442622185,
0.04072609171271324,
-0.02520606480538845,
-0.014559686183929443,
0.06972938776016235,
0.050426557660102844,
0.014577521942555904,
0.02512258104979992,
0.04091635346412659,
-0.001443250454030931,
-0.... | 0.790333 | 0.766374 | 0.023959 |
You are tasked with implementing a Julia struct and associated functions for the Inverse Gaussian distribution. The Inverse Gaussian distribution has a probability density function defined as:
f(x; μ, λ) = sqrt(λ/(2πx^3)) * exp(-λ(x-μ)^2/(2μ^2x))
You need to define a struct `InverseGaussian` that represents the Inver... | glaive | [
-0.028207501396536827,
0.03432796895503998,
-0.02436540462076664,
-0.023946134373545647,
0.034402135759592056,
-0.028058428317308426,
-0.022848933935165405,
0.08346720039844513,
0.03391214832663536,
0.0038365323562175035,
0.02100183069705963,
0.02821234054863453,
-0.0291201863437891,
0.010... | 0.800611 | 0.783182 | 0.017429 |
You are tasked with implementing a Kalman filter algorithm in ACL2, a programming language. The Kalman filter is a mathematical method used in control systems and signal processing to estimate the state of a dynamic system. Your task is to create the necessary functions and definitions to implement the Kalman filter al... | glaive | [
0.005856421310454607,
0.04151437431573868,
-0.016602184623479843,
-0.052796538919210434,
0.037944480776786804,
-0.019391149282455444,
-0.024484781548380852,
0.07418057322502136,
0.027748513966798782,
-0.025458209216594696,
0.010783356614410877,
0.01759965904057026,
-0.02179897576570511,
0.... | 0.79517 | 0.77955 | 0.01562 |
You are tasked with creating a program to calculate the value of a sequence defined by the formula a(n) = floor(n!/3^n), where n! represents the factorial of n. You need to implement a function or program that takes an input integer n and returns the corresponding value of a(n) according to the given formula.
For exam... | glaive | [
0.012041001580655575,
0.039128974080085754,
-0.040721017867326736,
-0.03214455395936966,
0.047913771122694016,
-0.019619425758719444,
-0.018365733325481415,
0.061898570507764816,
0.035406436771154404,
-0.020937267690896988,
0.021586503833532333,
0.04111560061573982,
-0.055444758385419846,
... | 0.82663 | 0.787913 | 0.038717 |
You are tasked with implementing a SDF (signed distance function) called "Infinite Repetition" using the Zig programming language. The SDF should define an infinite repetition pattern based on a given period value. Your task is to implement the necessary functions and data structures to achieve this.
The SDF should in... | glaive | [
-0.003057971131056547,
0.027020994573831558,
-0.024803517386317253,
-0.04253482446074486,
0.029371371492743492,
-0.03535046800971031,
-0.004279156681150198,
0.06460124999284744,
0.03611912578344345,
-0.023651625961065292,
0.03883679211139679,
0.018679896369576454,
-0.006468791514635086,
-0... | 0.821383 | 0.797072 | 0.024311 |
You are tasked with creating a SAS program to perform tabulation analysis on a dataset (ADQSADAS) and generate output in CSV format. The dataset contains variables such as EFFFL, ANL01FL, AVISIT, PARAMCD, trtpn, sitegr1, base, chg, and aval. The tabulation analysis should filter records where EFFFL='Y', ANL01FL='Y', AV... | glaive | [
0.030298829078674316,
0.015886373817920685,
-0.04230756685137749,
-0.03073325753211975,
0.02655135653913021,
-0.023220738396048546,
0.0022975474130362272,
0.07882560789585114,
0.030931761488318443,
0.009967281483113766,
0.01812489703297615,
0.018368223682045937,
-0.026559967547655106,
0.00... | 0.780754 | 0.766079 | 0.014676 |
I am trying to implement a program that reads a series of integers from the user and then prints the frequency of each integer in the input. For example, if the user inputs the following integers:
1 2 3 1 2 3 4 5 6 1 2 3
The program should output:
1: 3
2: 3
3: 3
4: 1
5: 1
6: 1
How can I achieve this in my program? I am... | glaive | [
0.025783976539969444,
0.026124954223632812,
-0.04502563551068306,
-0.016221217811107635,
0.03424140065908432,
-0.02755202353000641,
-0.010753095149993896,
0.04354889318346977,
0.015814244747161865,
-0.017607713118195534,
0.013328545726835728,
0.026066625490784645,
-0.02977319434285164,
-0.... | 0.814351 | 0.793383 | 0.020967 |
You are tasked with implementing an extended Minimum Independent Set (MIS) algorithm for graph aggregation. The goal is to create partitions of a given graph such that nodes within the same partition have a limited number of neighbors in other partitions. The algorithm should be able to handle a large number of nodes a... | glaive | [
0.033460237085819244,
0.012453649193048477,
-0.013737631030380726,
-0.009689299389719963,
0.02745482325553894,
-0.025358639657497406,
-0.032171256840229034,
0.04436128959059715,
0.046397436410188675,
0.0002209926169598475,
0.028179900720715523,
0.0007233265205286443,
-0.020115138962864876,
... | 0.821253 | 0.780261 | 0.040992 |
You are tasked with creating a CUDA kernel function that takes an array of integers as input, squares each element, and stores the result in an output array. The kernel function should be able to handle a variable number of elements in the input array. Your task is to implement the CUDA kernel function squared_kernel t... | glaive | [
0.018605845049023628,
0.05865451321005821,
-0.03520682454109192,
-0.022750163450837135,
0.04483183100819588,
-0.01317509263753891,
-0.029264261946082115,
0.09159895032644272,
0.045104049146175385,
-0.01802261359989643,
0.03236858919262886,
0.029448887333273888,
-0.02780824527144432,
-0.012... | 0.805105 | 0.786019 | 0.019086 |
You are required to write a CUDA kernel that performs read operations on two sparse matrices, `matA` and `matB`, and computes various statistics for each row of the matrices. The stats to be computed for each row include the total number of operations, the minimum and maximum column indices, and the maximum number of o... | glaive | [
0.004459375515580177,
0.027789786458015442,
-0.028039222583174706,
-0.0193985216319561,
0.03564538434147835,
0.003388669341802597,
-0.03844968602061272,
0.08606700599193573,
0.04864857718348503,
-0.007958187721669674,
0.019973793998360634,
0.02682533860206604,
-0.0009371619671583176,
0.006... | 0.805274 | 0.786554 | 0.01872 |
You are required to implement a subroutine that computes a grid function on a vertically staggered grid using a given uniform grid function with options of 2nd/4th order accuracy and LogP transfer. The input parameters include the top pressure (ptop), surface pressure (psfc), grid spacing ratio relative to psfc (znw), ... | glaive | [
0.009826689958572388,
0.027095183730125427,
-0.03671928122639656,
-0.035545464605093,
0.04366099834442139,
-0.04614584147930145,
-0.026030467823147774,
0.0636618584394455,
0.03287830948829651,
0.01374072302132845,
0.03235317021608353,
0.03595983609557152,
-0.010055378079414368,
0.001029699... | 0.798625 | 0.782793 | 0.015832 |
You are tasked with implementing a CUDA kernel for a function that sets a specific value in an array, takes the reciprocal of each element in an array, scales an array by a given factor, performs an axpy operation (y = alpha * x + y), and computes the pointwise multiplication of two arrays. The CUDA kernel should be ab... | glaive | [
0.007052599918097258,
0.051063667982816696,
-0.024516968056559563,
-0.0292915478348732,
0.029116813093423843,
-0.01087107602506876,
-0.025943923741579056,
0.10048426687717438,
0.0452243834733963,
-0.02757330611348152,
0.02613207884132862,
0.0365285724401474,
-0.014779439195990562,
-0.00655... | 0.810022 | 0.793797 | 0.016225 |
How can I construct a recursive algorithm in Python to find the maximum number in a list? | glaive | [
0.01585051417350769,
0.024288034066557884,
-0.018830982968211174,
-0.049986582249403,
0.03518231213092804,
-0.0170234814286232,
-0.019813869148492813,
0.02596975862979889,
0.019634801894426346,
-0.03330671414732933,
0.021748220548033714,
0.04075120761990547,
-0.03521866723895073,
0.0095079... | 0.805229 | 0.789623 | 0.015606 |
You are tasked with creating a Java program that processes stock data. The program should define a class called Stock with the following attributes: symbol (String), date (String), open (double), high (double), low (double), close (double), volume (int), and adjClose (double). Additionally, the program should define a ... | glaive | [
0.00994856283068657,
0.007643159944564104,
-0.044857725501060486,
-0.03303289785981178,
0.04017256945371628,
-0.05637280270457268,
-0.03389358147978783,
0.05061978101730347,
0.037980563938617706,
-0.013009910471737385,
0.030903981998562813,
0.03766521438956261,
-0.04161437973380089,
-0.002... | 0.790557 | 0.774407 | 0.01615 |
You are tasked with implementing a function to tessellate corners of a mesh based on given input. The function should take in two parameters:
- p: a slice of tuples representing the vertices of the mesh in 3D space
- f: a slice representing the scalar field at each vertex
The function should return a Mesh, which is de... | glaive | [
0.04572814330458641,
0.029543561860919,
-0.0274109598249197,
-0.03492840752005577,
0.04339732602238655,
-0.016447020694613457,
-0.023841092362999916,
0.04668516665697098,
0.014670192264020443,
0.0019457130692899227,
0.02817094512283802,
0.035948943346738815,
-0.011999819427728653,
0.002633... | 0.793493 | 0.773112 | 0.020382 |
You are tasked with implementing a parallel reduction algorithm using CUDA for a given array of floating-point numbers. The goal is to reduce the array to a single value by adding up all the elements in the array. You need to implement two different parallel reduction algorithms: global reduction and shared memory redu... | glaive | [
-0.009840858168900013,
0.05098407343029976,
-0.01920635998249054,
-0.01723404973745346,
0.041768353432416916,
-0.00032232163357548416,
-0.020871641114354134,
0.09462963789701462,
0.05328214541077614,
-0.0007858707685954869,
0.011558466590940952,
0.027520986273884773,
0.00018428366456646472,
... | 0.802088 | 0.77488 | 0.027208 |
You are tasked with writing a program to analyze a given RNA sequence and identify specific segments within it. The program should take a RNA sequence as input and identify segments within it based on the given criteria. The segments should be identified based on certain patterns within the RNA sequence.
The program s... | glaive | [
0.011392386630177498,
0.019521037116646767,
-0.03520268574357033,
-0.032549865543842316,
0.01904613897204399,
-0.02477017231285572,
-0.007890477776527405,
0.08157462626695633,
0.01653578132390976,
-0.006915820296853781,
0.024257494136691093,
0.03290910646319389,
-0.028156958520412445,
0.03... | 0.802365 | 0.783021 | 0.019344 |
You are tasked with creating a program to simulate a game of Keno. The game is played by choosing 8 different numbers from 1 to 80 and then the computer selects 20 numbers at random. The program should compare the player's numbers with the computer's numbers and determine the payout based on the number of correct guess... | glaive | [
0.014407643117010593,
0.030047129839658737,
-0.04084419831633568,
-0.029716119170188904,
0.03752343729138374,
-0.0349692776799202,
-0.01342345867305994,
0.051913339644670486,
0.036161649972200394,
-0.03639523312449455,
0.03143482282757759,
0.0375557579100132,
-0.048838064074516296,
0.02042... | 0.802268 | 0.771456 | 0.030811 |
You are tasked with creating a function that takes in a list of numbers and returns the sum of all the numbers in the list. The function should be implemented in Common Lisp. | glaive | [
0.017430732026696205,
0.03398400917649269,
-0.03736286610364914,
-0.06252865493297577,
0.062278877943754196,
-0.030426405370235443,
-0.013498875312507153,
0.02102130837738514,
0.040092311799526215,
-0.015543907880783081,
0.024607177823781967,
0.05762143433094025,
-0.03931069001555443,
-0.0... | 0.806391 | 0.77924 | 0.027151 |
You are tasked with identifying the number of IPs that support TLS (transport-layer snooping) and SSL (super-secret listening) based on certain criteria within the IP addresses.
For TLS support, an IP must have an Autonomous Bridge Bypass Annotation (ABBA) outside of any hypernet sequences (contained by square bracket... | glaive | [
0.02349306270480156,
0.04410873353481293,
-0.008826646953821182,
-0.041927218437194824,
0.03091352805495262,
-0.0075347889214754105,
-0.02587592601776123,
0.03806908801198006,
0.013103087432682514,
0.006433588452637196,
0.020121194422245026,
0.02987319603562355,
-0.039362549781799316,
-0.0... | 0.786357 | 0.762597 | 0.023761 |
You are tasked with implementing a program to define and manipulate different data structures in a specific programming language. The program should include the following components:
1. Define an enum called `some_enum` with the following fields: `field0`, `field1`, and `field2`.
2. Create a struct called `simple_stru... | glaive | [
0.01062805112451315,
0.02410346455872059,
-0.034887075424194336,
-0.026924852281808853,
0.04065375030040741,
-0.041977111250162125,
-0.011626491323113441,
0.07944897562265396,
0.043471962213516235,
-0.022511601448059082,
0.024891745299100876,
0.05311020091176033,
-0.022915979847311974,
-0.... | 0.809538 | 0.794145 | 0.015393 |
You have been tasked with implementing a program that works with complex numbers and their topology. Your program should include the following features:
- Define a metric space for complex numbers with a distance function, `dist`, that calculates the absolute difference between two complex numbers.
- Implement a unifor... | glaive | [
0.03254254534840584,
0.03576039522886276,
-0.037639882415533066,
-0.03563419729471207,
0.0380871444940567,
-0.005110674072057009,
-0.018274158239364624,
0.045020923018455505,
0.04553128033876419,
-0.004808048252016306,
0.020313268527388573,
0.04505399614572525,
-0.025310097262263298,
-0.01... | 0.808152 | 0.782782 | 0.02537 |
You are tasked with creating a program to calculate the probability of a quantum state for a given set of quantum bits (qubits). The quantum state is defined by the function `probability[x, y]`, which takes two parameters `x` and `y` and returns the absolute square of the amplitude of the quantum state. The maximum pro... | glaive | [
-0.0010970988078042865,
0.038187138736248016,
-0.028508322313427925,
-0.015070653520524502,
0.03954577073454857,
-0.01951216533780098,
-0.02068500779569149,
0.07962637394666672,
0.03419286012649536,
0.005834593903273344,
0.033595163375139236,
0.03149352967739105,
-0.024566693231463432,
-0.... | 0.798087 | 0.76457 | 0.033517 |
You are tasked with writing a program to calculate the number of ways to paint some (possibly none or all) of the trees over all forests on n labeled nodes. The input will be an integer n representing the number of labeled nodes. Your program should output the number of ways to paint the trees for the given number of n... | glaive | [
-0.0026454387698322535,
0.019707951694726944,
-0.03179198503494263,
-0.0155030507594347,
0.02939041703939438,
-0.03890743851661682,
-0.016707131639122963,
0.055558182299137115,
0.041871555149555206,
-0.011025971733033657,
0.04036765545606613,
0.051531847566366196,
-0.030290788039565086,
-0... | 0.82617 | 0.786441 | 0.039729 |
You are tasked with implementing a recursive callback function using the array_map() function in PHP. The goal is to apply the given callback function to the elements of the given array, including subarrays, and return the modified array.
Create a callback function called square_recur_single_array that takes a single ... | glaive | [
0.018080996349453926,
0.07783257961273193,
-0.004763154778629541,
-0.042581137269735336,
0.04456855356693268,
-0.015744075179100037,
-0.016620421782135963,
0.08537188172340393,
0.02463964931666851,
-0.008098084479570389,
0.024855688214302063,
0.019107552245259285,
-0.0374864898622036,
0.00... | 0.800448 | 0.778074 | 0.022374 |
You are tasked with implementing a program to calculate the n-th partial sum of the Beatty sequence for 1/2 + sqrt(2). The Beatty sequence for a real number alpha is defined as the sequence of floor(n*alpha) for n = 1, 2, 3,... Your program should take an input n and calculate the sum of floor(j*(1/2 + sqrt(2))) for j ... | glaive | [
0.012211647816002369,
0.03267296031117439,
-0.04766065627336502,
-0.027346085757017136,
0.04181937128305435,
-0.023759154602885246,
-0.022920671850442886,
0.05445254221558571,
0.04292016848921776,
-0.009652022272348404,
0.01582326367497444,
0.03046783246099949,
-0.050404224544763565,
-0.01... | 0.812485 | 0.774911 | 0.037574 |
You are tasked with implementing a function that calculates the CFL (Courant-Friedrichs-Lewy) number for a given set of data. The CFL number is a dimensionless number used in the numerical analysis of partial differential equations. It is used to ensure the stability of the numerical solution. The function should take ... | glaive | [
-0.03120839037001133,
0.03951205313205719,
-0.039654821157455444,
-0.0494120791554451,
0.0386415459215641,
-0.011779782362282276,
-0.01566251739859581,
0.06524498760700226,
0.044505637139081955,
-0.0099467309191823,
0.018371321260929108,
0.02553687058389187,
-0.020961463451385498,
0.017775... | 0.791298 | 0.763144 | 0.028154 |
You are tasked with implementing a program that utilizes assignment operators for different operations. You need to create an enum AssignOpType with the following assignment operators:
- ASSIGN: represents the assignment operator a = b
- PLUS: represents the addition assignment operator a += b
- MINUS: represents the s... | glaive | [
0.0344877690076828,
0.018990645185112953,
-0.03528586030006409,
-0.020742086693644524,
0.03725489601492882,
-0.02921675331890583,
-0.008967193774878979,
0.06700751185417175,
0.04817016050219536,
-0.030842972919344902,
0.02831142581999302,
0.03868072107434273,
-0.023019757121801376,
-0.0080... | 0.796762 | 0.768529 | 0.028233 |
How can I build an algorithm in Java to find the number of occurrences of a particular number in an array? | glaive | [
-0.00004301796434447169,
0.012440246529877186,
-0.04221388325095177,
-0.02313547022640705,
0.03661838918924332,
-0.030247991904616356,
-0.03907877206802368,
0.037572331726551056,
0.016119468957185745,
-0.037223029881715775,
0.011119935661554337,
0.006457864306867123,
-0.04061363637447357,
... | 0.796313 | 0.771337 | 0.024976 |
You are given a dataset called 'have' with the following variables: ID, TIME, VAR1, VAR2, and VAR3. Your task is to create two new variables, VAR1N2 and VAR1N3, based on the following rules:
- VAR1N2 should equal 1 if VAR1 equals 1 and VAR2 equals 1.
- VAR1N3 should equal 1 if VAR1 equals 1 and VAR3 equals 1.
For eac... | glaive | [
0.032250069081783295,
0.020877154543995857,
-0.03867466375231743,
-0.016234511509537697,
0.034558191895484924,
-0.021285301074385643,
-0.02131764404475689,
0.09503328800201416,
0.029583150520920753,
-0.005697500426322222,
0.027287766337394714,
0.008691536262631416,
-0.015716135501861572,
-... | 0.80441 | 0.778433 | 0.025977 |
You are tasked with creating a program that calculates the probability of a quantum state for a given set of qubits. The program should also include a function to plot the probability distribution in 3D and a contour plot.
Write a function to calculate the probability of a quantum state using the given amplitude funct... | glaive | [
-0.0011171585647389293,
0.04199989140033722,
-0.027752218768000603,
-0.023026250302791595,
0.04603608325123787,
-0.018624674528837204,
-0.01873290352523327,
0.08678881078958511,
0.03301828354597092,
0.006227566860616207,
0.024676451459527016,
0.03232574462890625,
-0.021433142945170403,
-0.... | 0.792385 | 0.765227 | 0.027158 |
You are tasked with implementing a C++ program to calculate various statistical aggregates such as sum, variance, skewness, kurtosis, average, and integral. Your program should include the necessary data structures and functions to calculate these aggregates for a given set of input data. You should also consider both ... | glaive | [
0.009185457602143288,
0.018636947497725487,
-0.05245525389909744,
-0.027700450271368027,
0.05018599331378937,
-0.00505293533205986,
-0.0366881787776947,
0.0753665342926979,
0.04519878327846527,
-0.004269362427294254,
0.011125474236905575,
0.03404536843299866,
-0.014171769842505455,
0.00149... | 0.790849 | 0.772801 | 0.018048 |
What is the assembly code to add two numbers? | glaive | [
0.019730329513549805,
0.013742637820541859,
-0.01663338579237461,
-0.027480317279696465,
0.029652632772922516,
-0.02443757839500904,
-0.018629377707839012,
0.05231977626681328,
0.019184598699212074,
-0.01629364676773548,
0.013392599299550056,
0.045223720371723175,
-0.03347513824701309,
-0.... | 0.77941 | 0.763568 | 0.015842 |
Can you provide a code that takes two numbers and an operator as inputs and outputs the result of the operation? | glaive | [
0.03520459309220314,
0.025739243254065514,
-0.028432035818696022,
-0.04073331505060196,
0.02757427468895912,
-0.019566552713513374,
-0.02328488975763321,
0.054927363991737366,
0.05093609169125557,
-0.027418171986937523,
0.0172312892973423,
0.038658495992422104,
-0.035507410764694214,
-0.03... | 0.80741 | 0.787577 | 0.019833 |
You are tasked with implementing a single-source shortest path (SSSP) algorithm in C++ using the Gunrock library. The goal is to find the shortest path from a single source vertex to all other vertices in a given graph.
You need to define a function that takes a filename as an argument, reads the graph from the file, ... | glaive | [
0.0015108652878552675,
0.027853460982441902,
-0.018233705312013626,
-0.04237831383943558,
0.026316536590456963,
-0.026142973452806473,
-0.035871148109436035,
0.09571719914674759,
0.05189596489071846,
-0.01570611260831356,
0.03527996689081192,
0.040977802127599716,
0.01465274766087532,
-0.0... | 0.812056 | 0.790057 | 0.021999 |
You are tasked with creating a program that calculates the probability of a quantum state given a set of amplitudes. The program should use the provided amplitude and probability functions to find the maximum probability for a given set of states. The program should also generate a 3D plot and a contour plot of the pro... | glaive | [
0.0024251530412584543,
0.029248125851154327,
-0.029699858278036118,
-0.0211651474237442,
0.03778964281082153,
-0.022660868242383003,
-0.014178304001688957,
0.07146631926298141,
0.03674929961562157,
0.006728137843310833,
0.02989879809319973,
0.03348720818758011,
-0.014300622045993805,
-0.01... | 0.788445 | 0.75861 | 0.029835 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.