instruction_seed
stringlengths
43
8.03k
source
stringclasses
1 value
embeddings
listlengths
1.02k
1.02k
mean_positive_score
float64
0.73
0.85
mean_negative_score
float64
0.71
0.82
difference_score
float64
0.01
0.07
You are tasked with creating a program that defines a class called "Integer" in C++ that represents integer values and provides various operations on them. The class should have a constructor that initializes the integer value, a method to retrieve the integer value, and methods to perform arithmetic operations such as...
glaive
[ 0.04193638637661934, 0.022796208038926125, -0.010201740078628063, -0.01422022096812725, 0.041885942220687866, -0.01960584707558155, -0.027092162519693375, 0.09771408140659332, 0.0456424318253994, -0.03154170140624046, 0.01655951887369156, 0.03341241925954819, -0.03252255916595459, -0.01114...
0.796409
0.76713
0.029279
You are tasked with creating a function in F# that calculates the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. Write a function called "factorial" that takes an integer parameter and returns the factorial of that number.
glaive
[ 0.027788393199443817, 0.031098803505301476, -0.026223670691251755, -0.03835710510611534, 0.05242321640253067, -0.04707631468772888, -0.012625528499484062, 0.049881912767887115, 0.0438285730779171, -0.00974889937788248, 0.014048493467271328, 0.047513753175735474, -0.04506780579686165, -0.02...
0.799266
0.776898
0.022368
You are tasked with creating a program that calculates the probability of a quantum state given certain amplitudes. The program should also plot a 3D and contour graph of the probability distribution. Create a function that calculates the probability of a quantum state using the given amplitude function: probability[x...
glaive
[ -0.0028173059690743685, 0.03185776621103287, -0.03618675470352173, -0.024336813017725945, 0.03981216251850128, -0.018304359167814255, -0.017422450706362724, 0.07496841996908188, 0.03692895174026489, 0.008949331007897854, 0.02836013026535511, 0.04032103717327118, -0.019200723618268967, -0.0...
0.774015
0.746348
0.027668
You are required to implement a function that takes a specific type of input and returns a specific type of output. The input type is a positional function type, T0, which is a subtype of another positional function type, T1. The function should satisfy the following rules: - T0 is a U0 Function<X0 extends B00, ... , X...
glaive
[ 0.012316686101257801, 0.035950902849435806, -0.028328895568847656, -0.02588583156466484, 0.038258425891399384, -0.02605772577226162, -0.018631255254149437, 0.07818660140037537, 0.04050993546843529, -0.0029728368390351534, 0.04034776985645294, 0.04138786718249321, -0.013765859417617321, -0....
0.827218
0.803363
0.023855
You are tasked with creating a utility method that compares two boxed primitives (such as Integer, Long, Double, etc.) and returns true if they are equal, and false if they are not. The method should also handle cases where one or both of the operands are null, and allow for the default value of the primitive to be ove...
glaive
[ 0.005933235865086317, 0.0224005114287138, -0.025469813495874405, -0.02994195744395256, 0.03870954364538193, -0.02937503531575203, 0.02275143563747406, 0.07822304964065552, 0.03543310612440109, -0.04061561077833176, 0.02131478115916252, 0.012551052495837212, -0.010546178556978703, -0.014542...
0.808675
0.788847
0.019828
You are tasked with processing a large dataset containing information about X and Y coordinates, a timestamp, pressure, and endpoints. The data is formatted as follows: X, Y, TStamp, Pres., EndPts DataSize: 459 5809 13010 0 16 0 5809 13010 10 20 0 5809 13010 15 25 0 ... (more data points) Your task is to write a prog...
glaive
[ 0.014447231777012348, 0.020608510822057724, -0.052962590008974075, -0.03804449364542961, 0.029861507937312126, -0.05532119795680046, -0.03146302327513695, 0.07532184571027756, 0.04542674869298935, -0.010707716457545757, 0.0440363846719265, 0.021901868283748627, -0.021982142701745033, -0.00...
0.816382
0.800348
0.016034
You are tasked with creating a function to determine the number of invalid UTF-8 sequences in a given Unicode string. An invalid UTF-8 sequence may contain one byte or multiple bytes. Your function should take a Unicode string as input and return the count of invalid UTF-8 sequences present in the string.
glaive
[ -0.01445669773966074, 0.020935839042067528, 0.01786153018474579, -0.023501789197325706, 0.04447019472718239, -0.0004680503043346107, -0.011789393611252308, 0.08440075069665909, 0.015547542832791805, 0.0012238534400239587, 0.006074621342122555, 0.02732522413134575, -0.010173806920647621, -0...
0.797148
0.780678
0.016471
You are tasked with implementing a function that can gather a list column from a hierarchy of list columns in C++ using CUDA and RAPIDS libraries (cuDF). The input to your function will be a `lists_column_view` representing the list column to gather from and a `gather_data` struct containing the information needed to ...
glaive
[ 0.010550273582339287, 0.03669765591621399, -0.02514520473778248, -0.033001575618982315, 0.03430440276861191, -0.015702977776527405, -0.014699466526508331, 0.10680842399597168, 0.055135227739810944, -0.011455959640443325, 0.023559631779789925, 0.0393218919634819, -0.004848006647080183, 0.01...
0.803205
0.782419
0.020786
You are given a very large number as a string, where the digits are separated by spaces and new lines. You need to find the greatest product of thirteen adjacent digits in the number. Write a function to solve this problem. The function should take the string as input and return the greatest product of thirteen adjace...
glaive
[ 0.04641955345869064, 0.040271032601594925, -0.032138146460056305, -0.04724736139178276, 0.046676281839609146, -0.009208614937961102, -0.03468601405620575, 0.06466948986053467, 0.02371145598590374, -0.006427465938031673, 0.014464943669736385, 0.03906189650297165, -0.04162690043449402, -0.03...
0.832789
0.770608
0.062181
You are tasked with implementing a Red-Black Tree data structure that provides an efficient way to determine membership. Red-Black Trees are a classic data structure used to efficiently represent sets, using trees whose nodes are labeled by the set's elements and are colored red or black. The key to efficiency is that ...
glaive
[ 0.011428587138652802, 0.021814603358507156, -0.029539311304688454, -0.01992000639438629, 0.024602683261036873, -0.04027557745575905, -0.004708437714725733, 0.04757304862141609, 0.05007304251194, -0.024453867226839066, 0.028629601001739502, 0.019006717950105667, -0.028782092034816742, -0.01...
0.821166
0.804799
0.016366
You are tasked with creating a programming problem related to the Move programming language. Move is a statically-typed, resource-oriented programming language designed for building safe and secure smart contracts on the Libra blockchain. Your task is to define a function in Move that takes in an integer input and ret...
glaive
[ 0.03451543673872948, 0.028953617438673973, -0.017799170687794685, -0.02143002487719059, 0.03275475651025772, -0.021706705912947655, -0.03689829632639885, 0.05246925354003906, 0.03709737956523895, -0.02520710602402687, 0.01614006608724594, 0.04604608193039894, -0.02522227354347706, -0.00385...
0.825463
0.800503
0.02496
You are tasked with writing a program that takes in the age of a person and the age difference with their twin, and then outputs a statement indicating the age of the twin and the age difference. Write a program that prompts the user to input their age as an integer, followed by the age difference with their twin as a...
glaive
[ 0.02714415267109871, 0.03151383996009827, -0.024414850398898125, -0.03445035219192505, 0.03212985396385193, -0.0264931358397007, -0.02077067643404007, 0.0858687087893486, 0.0790446549654007, -0.024920232594013214, 0.03636684641242027, 0.030668925493955612, -0.05059241130948067, 0.025374401...
0.796129
0.775111
0.021018
You are tasked with implementing a discrete gradient numerical method using CUDA in C++. This method involves performing various operations on complex numbers, handling memory allocation and deallocation, and utilizing the Fast Fourier Transform (FFT) and Generalized Minimal RESidual (GMRES) algorithms. Your task is t...
glaive
[ -0.0028832347597926855, 0.031771279871463776, -0.007642378099262714, -0.04022263363003731, 0.02523704431951046, -0.010489575564861298, -0.0195646733045578, 0.09897768497467041, 0.048450060188770294, -0.021307917311787605, 0.012877791188657284, 0.041205763816833496, -0.013299468904733658, 0...
0.798655
0.771217
0.027438
You are tasked with implementing a CUDA program to perform matrix multiplication. Given three 2D arrays A, B, and C of size Size x Size, where Size is a pre-defined constant, you need to write a CUDA kernel function to compute the product of A and B and store the result in C. You should then allocate memory for the arr...
glaive
[ 0.01611119695007801, 0.054938796907663345, -0.027333086356520653, -0.019666872918605804, 0.03674669936299324, 0.0007001084741204977, -0.03774954006075859, 0.0996653139591217, 0.041031356900930405, -0.033588957041502, 0.01399913989007473, 0.03928731754422188, -0.010293527506291866, -0.02353...
0.796906
0.773194
0.023712
You are tasked with implementing a function that calculates the relative difference between two real numbers, given a maximum and minimum threshold. The function should reject the input if the difference is outside the specified range and return the relative difference if it falls within the range. Additionally, you ne...
glaive
[ 0.005414816550910473, 0.027054112404584885, -0.028436286374926567, -0.027772897854447365, 0.0462675467133522, -0.015418320894241333, -0.03424537554383278, 0.071140356361866, 0.06339425593614578, -0.01246652752161026, 0.016411134973168373, 0.05239323899149895, -0.0388680063188076, 0.0145546...
0.806165
0.784681
0.021484
You are tasked with implementing a CUDA kernel to calculate the sum of the logarithm of the diagonal elements of a given matrix. The matrix is represented as a 1D array in row-major order, and the size of the matrix (N) is also provided. The CUDA kernel should use cub::DeviceReduce to efficiently compute the sum. Writ...
glaive
[ 0.008544841781258583, 0.04199479520320892, -0.040600161999464035, -0.033577024936676025, 0.03568923473358154, -0.0032026004046201706, -0.03438037261366844, 0.09648361057043076, 0.044390320777893066, -0.01655186153948307, 0.03131559491157532, 0.030401526018977165, -0.017803935334086418, -0....
0.810621
0.776902
0.03372
You are tasked with implementing a subroutine ZPGEX2 that swaps adjacent diagonal 1-by-1 blocks in a complex generalized matrix product. The input consists of various parameters such as the number of factors (K), the order of each factor (N), the index of the first block to be swapped (J), the signatures of the factors...
glaive
[ 0.03149665147066116, 0.03856997191905975, -0.015668699517846107, -0.03191203996539116, 0.014788800850510597, -0.016400394961237907, -0.021479614078998566, 0.04234037920832634, 0.014625626616179943, -0.013465355150401592, 0.016587382182478905, 0.010355415754020214, -0.02874826453626156, 0.0...
0.810435
0.784856
0.025578
You are tasked with implementing a Fortran subroutine that performs Gaussian elimination to factor a double precision band matrix. The subroutine should take as input the band matrix in band storage, the leading dimension of the array, the order of the original matrix, the number of diagonals below the main diagonal, t...
glaive
[ 0.016548771411180496, 0.024912092834711075, -0.037197768688201904, -0.03813544288277626, 0.024646613746881485, -0.025615347549319267, -0.01229194924235344, 0.06334711611270905, 0.03731495514512062, 0.004466474987566471, 0.0030834581702947617, 0.036501865833997726, -0.0205818023532629, -0.0...
0.805263
0.774239
0.031024
You are given the task of implementing a function in Haskell that takes a number as input and returns the value of the exponential function at that number. You should implement the function using power series representation and define the required numeric instances for the power series data type. The power series repre...
glaive
[ 0.023621471598744392, 0.017456408590078354, -0.01899127848446369, -0.06025843322277069, 0.03463418409228325, -0.03955854848027229, -0.003737617516890168, 0.062191277742385864, 0.05940769985318184, -0.023063676431775093, 0.02713203988969326, 0.04417571797966957, -0.018649304285645485, -0.02...
0.800737
0.783038
0.017698
You are tasked with implementing a smart contract function that utilizes the SafeMath library to perform arithmetic operations on unsigned integers. The function should take two unsigned integer inputs and return the result of the arithmetic operation with safety checks to prevent overflow, underflow, and division by z...
glaive
[ 0.03795677423477173, 0.04287026450037956, -0.02715994231402874, -0.030013680458068848, 0.03237801417708397, -0.02401290461421013, -0.01627015508711338, 0.07933482527732849, 0.037400905042886734, -0.01160036027431488, 0.015227308496832848, 0.033132925629615784, -0.0014712662668898702, -0.03...
0.81061
0.795227
0.015383
You are tasked with implementing a ray intersection algorithm for a CUDA-accelerated ray tracer. The goal is to efficiently determine whether a given ray intersects with a specific geometric object or a bounding volume hierarchy (BVH). The code should be written in C++ and utilize CUDA for parallel processing. Your ta...
glaive
[ 0.04530485346913338, 0.042710088193416595, -0.00802122987806797, -0.004016434773802757, 0.02246473915874958, 0.00029293698025867343, -0.03616460785269737, 0.10022417455911636, 0.06288060545921326, -0.012481202371418476, 0.0357360914349556, 0.015368262305855751, 0.0149054154753685, -0.02054...
0.792635
0.773747
0.018888
I am working on a CUDA program and I need to implement a kernel function to compute the Euclidean distance between a given input vector and a set of symbol vectors. The input vector and symbol vectors are all of type float. The symbol vectors are stored in a 1D array of length symbols * symbolSize, where symbols is the...
glaive
[ 0.0038615770172327757, 0.05049071088433266, -0.030951546505093575, -0.028759019449353218, 0.039163485169410706, -0.01720570959150791, -0.04737968370318413, 0.07683403789997101, 0.03866592422127724, -0.018554139882326126, 0.028446728363633156, 0.048456963151693344, -0.007813280448317528, -0...
0.801472
0.778298
0.023174
You are tasked with implementing a CUDA program to calculate betweeness centrality, current length, dependency, and number of shortest paths for a given graph. The program should be able to reset the values for each of these fields, get the values for specific nodes, set the values for specific nodes, add values to spe...
glaive
[ 0.002079433761537075, 0.03331384435296059, -0.0372002087533474, -0.01824282482266426, 0.0236189067363739, -0.010167727246880531, -0.019684087485074997, 0.07252589613199234, 0.04849519208073616, -0.033511992543935776, 0.0297404732555151, 0.026192806661128998, 0.0005166810587979853, -0.00687...
0.806678
0.787078
0.0196
You are tasked with implementing a function to create and print rational numbers in Racket. The function should take two integers, the numerator and denominator, and return a simplified rational number in the form of a pair. Additionally, negative denominators should be handled properly. Write a function make-rat2 that...
glaive
[ 0.03569725900888443, 0.05101090669631958, -0.026877230033278465, -0.027395816519856453, 0.049439337104558945, -0.017790453508496284, 0.00312243215739727, 0.05940532311797142, 0.0588335283100605, -0.014751519076526165, 0.013500216417014599, 0.05283390358090401, -0.029958220198750496, -0.019...
0.798391
0.772948
0.025443
You are tasked with implementing a function called `logicalAnd` that takes in two boolean values and returns the result of performing a logical AND operation on them. The function should take in two boolean parameters `x` and `y`, and return a boolean value representing the logical AND of the two input parameters. The ...
glaive
[ 0.0039603980258107185, 0.029509957879781723, -0.02885623276233673, -0.0333290621638298, 0.03344688192009926, -0.022468850016593933, -0.030305027961730957, 0.0726194977760315, 0.050349872559309006, -0.029217224568128586, 0.025338560342788696, 0.06960229575634003, -0.008851790800690651, -0.0...
0.801737
0.785921
0.015816
You are tasked with implementing a subroutine called "STZPADCPY" that copies an array A into an array B. The unchanged part of B is padded with zeros, and the diagonal of B specified by IOFFD may be set to ones. The subroutine takes the following arguments: - UPLO: A character specifying which trapezoidal part of the ...
glaive
[ 0.023964520543813705, 0.028261424973607063, -0.028891878202557564, -0.03540540486574173, 0.0433228462934494, -0.007492884062230587, 0.003923141863197088, 0.054758768528699875, 0.016176659613847733, -0.014117605984210968, 0.02759488858282566, 0.028034741058945656, -0.027102645486593246, -0....
0.809609
0.781879
0.02773
You are working with a program that involves creating interaction terms and dropping the most frequent category for certain variables. You need to implement a solution for creating interaction terms and dropping the most frequent category for a given set of variables. Write a program that takes in variables and create...
glaive
[ 0.019491637125611305, 0.015744058415293694, -0.044631216675043106, -0.009024444036185741, 0.03924521431326866, -0.019627686589956284, -0.018718866631388664, 0.07513736188411713, 0.044624753296375275, 0.0029603338334709406, 0.012430834583938122, 0.025058787316083908, -0.004506397992372513, ...
0.817287
0.798196
0.019091
You are tasked with creating a function in C++ that takes a list of strings and a delimiter as input and returns a single string with the elements of the list joined together by the delimiter. The function prototype should be: ```cpp void join(const std::vector<std::string>& values, const std::string& glue, std::strin...
glaive
[ 0.030285755172371864, 0.026651708409190178, -0.017327994108200073, -0.03245878219604492, 0.040464650839567184, -0.017375489696860313, -0.013728576712310314, 0.09170623868703842, 0.038833893835544586, 0.0005941963754594326, 0.016827639192342758, 0.05722460523247719, -0.019505295902490616, -...
0.793634
0.778372
0.015262
You are tasked with writing a program to generate the sequence defined by the following recurrence relation: a(n) = a(n-1) + a(n-3) + a(n-4), where a(0) = 2, a(1) = 1, a(2) = 0, a(3) = 2. The program should take an input n and output the value of a(n) in the sequence.
glaive
[ 0.025644587352871895, 0.033362843096256256, -0.026233043521642685, -0.027206312865018845, 0.027322646230459213, -0.013587758876383305, -0.029980193823575974, 0.08363817632198334, 0.03137844055891037, -0.011266492307186127, 0.030371343716979027, 0.04470432922244072, -0.03165915980935097, -0...
0.827942
0.778961
0.048981
How can I find the elbow point in an array using an algorithm?
glaive
[ 0.009024281054735184, 0.02596738189458847, -0.021357977762818336, -0.029059309512376785, 0.021462691947817802, -0.029360678046941757, -0.025842199102044106, 0.032690878957509995, 0.020171577110886574, -0.02188858762383461, 0.01444724015891552, 0.02461414411664009, -0.01803433708846569, -0....
0.792079
0.768495
0.023584
You are tasked with implementing a package in VHDL to perform arithmetic operations on signed numbers. The package should define a subtype called `arithmetic_t` which represents a signed number of a specific size. It should also include a constant `ZERO` initialized to all zeros and a component `arithmetic` with ports ...
glaive
[ 0.05323583260178566, 0.03173148259520531, -0.039836060255765915, -0.03996856138110161, 0.043042153120040894, -0.016022490337491035, 0.0031762411817908287, 0.07679598033428192, 0.037433478981256485, -0.01178517285734415, 0.019009605050086975, 0.03923741355538368, -0.00367324729450047, -0.00...
0.800413
0.786001
0.014412
You are tasked with implementing a function in the `list` namespace of a programming language that takes two lists and returns a new list that is the result of performing pointwise addition on the elements of the input lists. The pointwise addition of two lists `as` and `bs` is defined as a new list where each element ...
glaive
[ 0.012570371851325035, 0.023901259526610374, -0.01581793650984764, -0.03850024938583374, 0.05147028714418411, -0.005359317176043987, 0.002109003718942404, 0.04723633453249931, 0.05642567202448845, -0.0025340779684484005, 0.001852593501098454, 0.05490908771753311, -0.018987899646162987, -0.0...
0.819552
0.791283
0.028269
You are given a sequence of numbers defined by the formula: a(n) = floor((2nd elementary symmetric function of 2,3,...,n+2)/(2+3+...+n+2)) Your task is to write a program to calculate the value of a given n.
glaive
[ 0.02676260657608509, 0.03015778213739395, -0.04742053523659706, -0.029609575867652893, 0.031827542930841446, -0.03779933601617813, -0.020023223012685776, 0.06148483604192734, 0.038240496069192886, -0.02533676102757454, 0.023325251415371895, 0.040776994079351425, -0.051185548305511475, -0.0...
0.843661
0.803523
0.040139
You are tasked with implementing a CUDA kernel function for computing Hessian features including curvature, confidence, and deviation from horizontality. The function takes in a 3x3 symmetric matrix representing the Hessian, and computes the eigenvectors using the Jacobian iterative method. The resulting eigenvectors a...
glaive
[ -0.01637137681245804, 0.043813467025756836, -0.01614285074174404, -0.02308253012597561, 0.02766546979546547, -0.007308014668524265, -0.034417301416397095, 0.08314210921525955, 0.03861808404326439, -0.025597523897886276, 0.012514196336269379, 0.03109891340136528, -0.006336734630167484, -0.0...
0.792069
0.776433
0.015636
You are tasked with designing a data structure to represent the geometry information for a tracking system used in a sports event. The tracking system includes the geometry field size and camera calibration data. The field size includes parameters such as line width, field length, field width, boundary width, referee w...
glaive
[ 0.012097427621483803, 0.003915657289326191, -0.06077318266034126, -0.043825991451740265, 0.040462009608745575, -0.03265662118792534, -0.039958491921424866, 0.05234243720769882, 0.04297850653529167, -0.03660861402750015, 0.017523957416415215, 0.0428725965321064, -0.0230000838637352, -0.0001...
0.796854
0.772056
0.024798
You are tasked with implementing a function that calculates the logarithm of the sum of two positive real numbers. The input to the function will be four real numbers (x, y, z, w) and four proofs that x, y, z, and w are positive (pos x, pos y, pos z, pos w). Your function should return the logarithm of the sum of z and...
glaive
[ 0.013621879741549492, 0.04604307562112808, -0.044185519218444824, -0.039723437279462814, 0.041632454842329025, 0.0019534463062882423, -0.027154918760061264, 0.04375946521759033, 0.03703371435403824, -0.03158849850296974, 0.017624227330088615, 0.039080191403627396, -0.020374735817313194, -0...
0.813027
0.776094
0.036933
You are tasked with implementing a VHDL program for a leading zero count (LZC) module. The module should take a 256-bit input and produce an 8-bit output along with a valid signal. The LZC module should be implemented using the IEEE standard logic library and a custom lzc_lib. Write the VHDL code for the entity "lzc_2...
glaive
[ -0.0011070952750742435, 0.0400964729487896, -0.00043261927203275263, -0.03180089220404625, 0.022236742079257965, -0.020948657765984535, -0.03421713039278984, 0.057770080864429474, 0.02455543726682663, -0.027407342568039894, 0.015313972719013691, 0.038740213960409164, 0.0038301562890410423, ...
0.794981
0.776104
0.018877
You are tasked with implementing the Boyer-Moore-Horspool algorithm to find a needle in a haystack. The algorithm involves preprocessing the needle and then searching for it in the haystack using the preprocessed table. The preprocess function takes a pattern (needle) as input and creates a table T, which is used for s...
glaive
[ 0.040263839066028595, 0.01564970053732395, -0.017442315816879272, -0.03186311945319176, 0.04561047628521919, -0.040798284113407135, -0.028599845245480537, 0.07044417411088943, 0.03879334777593613, 0.009607568383216858, 0.004881863482296467, 0.02757876180112362, -0.016001416370272636, -0.00...
0.810217
0.786738
0.023479
You are tasked with implementing a subroutine in Fortran called DLAG2S. This subroutine is responsible for converting a DOUBLE PRECISION matrix, A, to a SINGLE PRECISION matrix, SA. The subroutine takes the following arguments: - M: The number of lines of the matrix A. M >= 0. - N: The number of columns of the matrix ...
glaive
[ 0.0010830351384356618, 0.03343210741877556, -0.01578350178897381, -0.0482342354953289, 0.0249270461499691, -0.011384788900613785, -0.016611037775874138, 0.07117128372192383, 0.019282573834061623, -0.004178802017122507, 0.010114871896803379, 0.043181419372558594, -0.021550126373767853, -0.0...
0.800253
0.781308
0.018945
You are tasked with creating a program that calculates the number of elements in the continued fraction for the sum of 1/(2^2^k) for a given range of k values. The program should take an input n and return the number of elements in the continued fraction for the sum of 1/(2^2^k) for k ranging from 0 to n.
glaive
[ 0.020290834829211235, 0.0493670329451561, -0.04760858416557312, -0.03756000101566315, 0.047406747937202454, -0.011300772428512573, -0.009562474675476551, 0.06431328505277634, 0.03643960505723953, -0.009647773578763008, 0.015359821729362011, 0.03215565159916878, -0.024920061230659485, -0.00...
0.82512
0.773899
0.051221
You are tasked with writing a CUDA C code that performs operations on arrays and then outputs the results. The specific requirements are as follows: - Create an array of 5 integers: { 1, 2, 3, 4, 5 } - Allocate memory on the GPU for the array and copy the array to the GPU - Create two additional arrays of the same siz...
glaive
[ 0.014515891671180725, 0.05987994000315666, -0.01821916364133358, -0.009881849400699139, 0.017426270991563797, -0.027106737717986107, -0.04325861856341362, 0.10902710258960724, 0.04112735018134117, -0.03184361383318901, 0.02496778592467308, 0.02879446931183338, -0.002172666834667325, -0.018...
0.796614
0.765892
0.030721
You are tasked with implementing a function in Fortran to calculate the determinant of a matrix. The determinant of a matrix is a scalar value that can be computed from the elements of a square matrix and provides important information about the matrix. The function should take as input a square matrix of real numbers ...
glaive
[ 0.03433991223573685, 0.03327936306595802, -0.052159152925014496, -0.05057135224342346, 0.0604107640683651, -0.025929700583219528, -0.009950804524123669, 0.07378640025854111, 0.05236794054508209, -0.009754178114235401, -0.00040780880954116583, 0.04794083163142204, -0.04809242859482765, -0.0...
0.777567
0.761156
0.016411
I am trying to implement matrix multiplication using CUDA in C++. I have already written a kernel function `kernelFunc` that takes in three matrices `ad`, `bd`, and `cd` along with their dimensions `m` and `n`. The kernel function uses shared memory to optimize the matrix multiplication process. I need help in writing...
glaive
[ 0.002955674659460783, 0.05647960677742958, -0.03850911930203438, -0.03803158551454544, 0.042143821716308594, -0.011771050281822681, -0.043175697326660156, 0.09593973308801651, 0.03626963496208191, -0.013072153553366661, 0.012451636604964733, 0.027092212811112404, -0.022360386326909065, -0....
0.784673
0.769548
0.015125
You are tasked with implementing a CUDA-based function that performs a matrix transpose operation. The function should take a 2D array as input and return the transposed array. The template for the function is as follows: ```cpp template <typename T> void transpose_2d(const T* a, const dim_t* dims, T* b); ``` Where: ...
glaive
[ 0.024847127497196198, 0.04168620705604553, -0.017011165618896484, -0.031970977783203125, 0.04346262663602829, -0.016851430758833885, -0.020580651238560677, 0.11193790286779404, 0.04585370048880577, -0.0031789392232894897, 0.028021400794386864, 0.02815982513129711, -0.004838319029659033, 0....
0.789427
0.766859
0.022568
Write a program to create a matrix of dimensions 3x4 and populate it with the numbers 1 to 12 in a column-major order. Then, print the resulting matrix.
glaive
[ 0.03235863149166107, 0.030536074191331863, -0.01604073867201805, -0.041282057762145996, 0.05422284081578255, -0.030783480033278465, -0.0271372701972723, 0.04993147775530815, 0.03446023911237717, -0.018011679872870445, 0.02927815541625023, 0.0493357889354229, -0.04183613881468773, -0.035200...
0.809138
0.78451
0.024628
You want to create a custom function in Julia that calculates Legendre polynomials and their associated Legendre functions for a given input value `x` and maximum degree `lmax`. The Legendre polynomials are defined as the solutions to the Legendre differential equation. The Legendre functions are the associated Legendr...
glaive
[ -0.013461939990520477, 0.04139985516667366, -0.03342261537909508, -0.052984364330768585, 0.040492236614227295, -0.03519079461693764, -0.025748495012521744, 0.05274871736764908, 0.05365588515996933, 0.0012702802196145058, 0.023233119398355484, 0.04927026107907295, -0.025710754096508026, 0.0...
0.786276
0.769378
0.016897
You are tasked with implementing a repeat operator in a C++ program using CUDA for parallel computing. The goal is to create a function that takes in a queue, a symbol, and shared memory, and then execute the repeat operation based on the provided parameters. The repeat operation involves subdividing a shape based on t...
glaive
[ 0.00466395216062665, 0.04205714166164398, -0.017392529174685478, -0.028431857004761696, 0.02913600392639637, 0.015731262043118477, -0.039068665355443954, 0.1338212490081787, 0.03612257540225983, -0.02842864766716957, 0.02681143209338188, 0.038307514041662216, 0.005341022741049528, 0.007347...
0.794464
0.778351
0.016112
You are tasked with implementing a function that prints the values of the general-purpose registers in a specific format. The function should take a pointer to a structure as an argument and print the hexadecimal values of the registers in pairs. The format should be as follows: - "r0 <hex value>\t" - "r1 <hex val...
glaive
[ 0.01929672248661518, 0.04274856671690941, -0.03727094829082489, -0.028294943273067474, 0.032545581459999084, -0.04644474387168884, -0.01690622791647911, 0.06855370104312897, 0.06093297898769379, -0.01752467080950737, 0.02887996844947338, 0.041871149092912674, -0.01240445300936699, -0.01414...
0.801535
0.7867
0.014835
You are tasked with creating a Vector3 and Vector2 class in JavaScript, with specific methods and properties. The Vector3 class should have properties x, y, and z, all initialized to 0. It should also have the following methods: - toDegrees: converts the vector to degrees - angleTo: calculates the angle to another vect...
glaive
[ 0.009540830738842487, 0.035810187458992004, -0.01596272923052311, -0.040114328265190125, 0.03108561970293522, -0.022975411266088486, -0.02357058972120285, 0.03052823431789875, 0.03869608789682388, -0.02074314095079899, 0.029403138905763626, 0.03423534333705902, -0.02449996955692768, -0.003...
0.784567
0.762208
0.022359
How can an AI algorithm in Java find the sum of all even numbers in a given integer array?
glaive
[ 0.012059858068823814, 0.015622269362211227, -0.026425104588270187, -0.04743630066514015, 0.02466616779565811, -0.0347505621612072, -0.019330685958266258, 0.03670622035861015, 0.03257504105567932, -0.04454550892114639, 0.007870133966207504, 0.026300091296434402, -0.029151583090424538, -0.00...
0.80528
0.784013
0.021268
You are tasked with implementing a program that calculates the probability of a quantum state given an input of two variables, a and b. The quantum state is defined by the function amplitude[x_,y_], and the probability is calculated using the function probability[x_, y_]. The maximum probability is to be found using th...
glaive
[ -0.004034304525703192, 0.030795970931649208, -0.039025384932756424, -0.01227189414203167, 0.044521965086460114, -0.013945549726486206, -0.007544345688074827, 0.08421765267848969, 0.04314396157860756, 0.0011951460037380457, 0.025038601830601692, 0.03328942507505417, -0.006473631598055363, -...
0.792047
0.768534
0.023513
Can you provide an algorithm to calculate the sum of all the elements in an array?
glaive
[ 0.018477272242307663, 0.03191858157515526, -0.028563514351844788, -0.037253204733133316, 0.03713470697402954, -0.05672897771000862, -0.02291366271674633, 0.029087213799357414, 0.037046898156404495, -0.040074072778224945, 0.022305358201265335, 0.02979673631489277, -0.045763757079839706, -0....
0.788062
0.764751
0.023311
You are tasked with implementing a function in a programming language that supports dependent types. The function should take in two tuples of the same type, and concatenate them together to create a new tuple. You should also define three axioms for the behavior of the concatenation operation, ensuring that it satisfi...
glaive
[ 0.035039402544498444, 0.03694445267319679, -0.014366318471729755, -0.017180873081088066, 0.04368306323885918, -0.015023786574602127, 0.0019034574506804347, 0.08246342092752457, 0.02554289996623993, -0.01235285960137844, 0.021378714591264725, 0.041627973318099976, -0.01869492419064045, 0.00...
0.809538
0.794966
0.014572
You are tasked with creating a program to implement the formal group law for integral Morava K-theory. The program should truncate powers of d+1 and higher. The program will take three input parameters: p, n, and d. The program should then calculate the formal group law using the given inputs and return the result.
glaive
[ 0.020015647634863853, 0.039136745035648346, -0.033928751945495605, -0.030595580115914345, 0.033745575696229935, -0.02230038307607174, 0.0003428791824262589, 0.0499858558177948, 0.044856488704681396, -0.018764520063996315, 0.017182864248752594, 0.03238868713378906, -0.036168236285448074, -0...
0.815748
0.789252
0.026496
You are tasked with writing a program to calculate the 10's complement of nonnegative numbers. The 10's complement of a nonnegative number is obtained by subtracting each digit from 9. For example, the 10's complement of 123 is 876. Your program should take a nonnegative integer as input and output its 10's complement.
glaive
[ 0.012210752815008163, 0.01244467031210661, -0.021846838295459747, -0.02256663143634796, 0.03934109956026077, -0.04084894433617592, -0.010570215992629528, 0.043664440512657166, 0.036974165588617325, -0.02817646600306034, 0.026376932859420776, 0.0290520042181015, -0.0758846327662468, -0.0031...
0.802078
0.772131
0.029946
You are tasked with creating a program that calculates and visualizes the probability distribution of a quantum system with a given number of qubits and states. The system is described by the amplitude function, which takes two input parameters (x and y) and returns a complex number. The probability of finding the syst...
glaive
[ 0.012469434179365635, 0.02465064451098442, -0.03533630073070526, -0.022728921845555305, 0.04386506602168083, -0.03287994861602783, -0.028729334473609924, 0.06501542031764984, 0.04096236079931259, -0.002610172377899289, 0.02339712716639042, 0.03343210741877556, -0.009176984429359436, -0.011...
0.807371
0.775644
0.031727
You are tasked with implementing a function to find the common tags among a list of tags. The function should take in a 2D array of strings, where each inner array represents a list of tags. The function should return an array of strings representing the common tags among all the inner arrays. For example, given the i...
glaive
[ 0.023836204782128334, 0.033197663724422455, -0.03468995541334152, -0.04046516492962837, 0.05508638545870781, -0.04161345586180687, -0.011888287030160427, 0.02715114690363407, 0.01781739667057991, -0.017632247880101204, 0.004688875749707222, 0.02326084114611149, -0.026391932740807533, -0.01...
0.801536
0.775147
0.026389
Write a program to calculate the value of a sequence using the following recursive formula: a(n) = 2*a(n-1) + 15*a(n-2); a(0)=1, a(1)=1 The program should take an integer input n (>1) and output the value of a(n) in the sequence.
glaive
[ 0.0333678163588047, 0.045130349695682526, -0.026342425495386124, -0.03700222074985504, 0.048848770558834076, -0.02117118611931801, -0.017705684527754784, 0.08510829508304596, 0.02452831342816353, -0.02673015370965004, 0.03264831006526947, 0.03179074078798294, -0.039860114455223083, -0.0244...
0.825496
0.782697
0.042799
You are tasked with implementing a program that performs element-wise multiplication on two arrays of different data types. The program should be able to handle different modes of operation, such as H_SWISH, and support a specific number of input arguments (arity). Additionally, the program should be able to handle spe...
glaive
[ 0.02402200736105442, 0.03973761573433876, -0.02020689658820629, -0.028906431049108505, 0.02768692933022976, -0.015546774491667747, -0.017546789720654488, 0.08925163745880127, 0.044084709137678146, -0.021053215488791466, 0.016178365796804428, 0.05197435989975929, -0.018356207758188248, -0.0...
0.804241
0.787102
0.017139
Write a program to generate the sequence defined by the following formula: A000277: 3*n - 2*floor(sqrt(4*n+5)) + 5 The sequence should start from 1 and continue to the 200th term.
glaive
[ 0.00964156910777092, 0.036841120570898056, -0.021623093634843826, -0.051263876259326935, 0.02779809944331646, -0.021273039281368256, -0.05096597597002983, 0.06457556784152985, 0.02520158886909485, -0.01124662160873413, 0.023067468777298927, 0.044441305100917816, -0.044613804668188095, 0.00...
0.828336
0.777227
0.051109
How can I find the longest increasing sub-sequence in a given array using an algorithm?
glaive
[ -0.0012069117510691285, 0.027690157294273376, -0.02518782578408718, -0.036486633121967316, 0.01544757280498743, -0.0239899680018425, -0.046309202909469604, 0.045651983469724655, 0.013718442060053349, -0.029450548812747, 0.024199353531003, 0.008525311015546322, -0.041563667356967926, 0.0056...
0.803035
0.771064
0.031971
You are tasked with implementing a function in OCaml to calculate the dot product of two given arrays. The function should take two arrays of floats as input and return the dot product as an integer. The dot product of two vectors v1 and v2 is calculated as the sum of the products of their corresponding elements. For e...
glaive
[ 0.011434107087552547, 0.042450688779354095, -0.023041632026433945, -0.05131876468658447, 0.050465185195207596, -0.014049789868295193, -0.035282887518405914, 0.05896957963705063, 0.04834213852882385, -0.01716756634414196, 0.012863988988101482, 0.040651336312294006, -0.010081964544951916, -0...
0.792844
0.762617
0.030226
You are tasked with creating a Python program that can generate a melody using a given set of notes and durations. The program should be able to take in a list of notes and a corresponding list of durations, and output a melody by playing each note for the specified duration. The melody should be played using the `pyga...
glaive
[ 0.03748985379934311, 0.013073128648102283, -0.039148591458797455, -0.021251661702990532, 0.021034767851233482, -0.03956463932991028, -0.03132665157318115, 0.062018055468797684, 0.011759666725993156, -0.01724281720817089, 0.05358440801501274, 0.03281256929039955, -0.026418883353471756, 0.00...
0.783391
0.764646
0.018745
You are tasked with creating a program that manages and tracks various gaming statistics for a gaming platform. The program should be able to handle different types of games, quests, achievements, multipliers, rank priorities, rank multipliers, total coins, total kills, and total wins. Your program should be able to st...
glaive
[ 0.02796253375709057, 0.004720653872936964, -0.0469830296933651, -0.03363028168678284, 0.029849331825971603, -0.02462841384112835, -0.03138548880815506, 0.043139707297086716, 0.039964061230421066, -0.0305849127471447, 0.03246501088142395, 0.02188209630548954, -0.02652972936630249, 0.0032026...
0.782021
0.763247
0.018774
You are required to implement a FIFO (First-In-First-Out) memory component in VHDL-2008 that stores the same data in two adjacent cells. The FIFO should have the following features: - It should have a configurable width and depth, with default values of 16 for the width and 4 for the depth. - It should have input ports...
glaive
[ 0.02876858226954937, 0.009985603392124176, -0.017880026251077652, -0.05152357369661331, 0.04567328095436096, -0.021881259977817535, -0.009869031608104706, 0.09555703401565552, 0.03353312984108925, -0.004945251625031233, 0.02631571888923645, 0.027178438380360603, -0.010280339978635311, -0.0...
0.802641
0.782999
0.019642
You are tasked with creating a function in CUDA that checks for overlapping indices in a given tensor. The function should take a THCState pointer and a THCudaTensor pointer as input, and return a boolean value indicating whether the tensor has overlapping indices. You should implement the function THC_overlappingInd...
glaive
[ 0.01096899714320898, 0.031074054539203644, -0.009039822034537792, -0.025465378537774086, 0.03885680437088013, -0.018480772152543068, -0.03456852585077286, 0.08257728815078735, 0.02780611254274845, -0.01121480856090784, 0.016359927132725716, 0.014039964415133, -0.009337701834738255, -0.0213...
0.81095
0.78441
0.026541
You are tasked with creating a function in the programming language Lean that takes a list of integers and returns a string representation of the list, with each element separated by a comma. For example, given the input [1, 2, 3], the function should return the string "[1, 2, 3]". Create a function called `int_list_t...
glaive
[ 0.03196615353226662, 0.027035458013415337, -0.022027689963579178, -0.05924671143293381, 0.048423103988170624, -0.05186904966831207, -0.023739144206047058, 0.04347667470574379, 0.03519630432128906, -0.028078963980078697, 0.03675311431288719, 0.0711476057767868, -0.04022686928510666, -0.0245...
0.804218
0.781324
0.022894
You are tasked with implementing the GPU k-nearest neighbors (knn) algorithm using CUDA. The goal is to compute the distance between two matrices A (reference points) and B (query points) containing respectively wA and wB points. The matrix A is a texture, and the distance is computed using the cuComputeDistanceTexture...
glaive
[ 0.00955231674015522, 0.04607272520661354, -0.02584395930171013, -0.02403038553893566, 0.02510117180645466, -0.016135532408952713, -0.030072899535298347, 0.06500402837991714, 0.036769259721040726, -0.0045683737844228745, 0.04262250289320946, 0.033914994448423386, -0.011080372147262096, 0.03...
0.798856
0.768152
0.030704
You are tasked with creating a program that calculates the probability of a quantum state given a certain set of parameters. The program should include functions to calculate the amplitude and probability of the quantum state, as well as to find the maximum probability using simulated annealing. Additionally, the progr...
glaive
[ -0.0024128148797899485, 0.03426314517855644, -0.029093964025378227, -0.024467581883072853, 0.048935722559690475, -0.017926793545484543, -0.01988317258656025, 0.07684510201215744, 0.028683315962553024, -0.009390643797814846, 0.025042543187737465, 0.036191441118717194, -0.011045259423553944, ...
0.789865
0.764816
0.025049
You are tasked with implementing a Stochastic Gradient Descent (SGD) optimization algorithm using CUDA for GPU acceleration. The goal is to create a forward pass for the SGD algorithm that updates the weights of a neural network. The algorithm will update the weights based on the gradients of the loss function with res...
glaive
[ -0.01610942929983139, 0.02858247235417366, -0.022647226229310036, -0.02025722526013851, 0.0415806770324707, -0.01890973374247551, -0.03671204298734665, 0.08637094497680664, 0.03399249166250229, -0.032164014875888824, 0.021583793684840202, 0.02004009485244751, -0.010468288324773312, 0.01110...
0.794238
0.776798
0.017441
You are tasked with writing a function in Python that takes in a list of numbers and returns the sum of all the even numbers in the list. Your function should be able to handle both positive and negative numbers, and should return 0 if the list is empty or does not contain any even numbers.
glaive
[ 0.011512585915625095, 0.0124436616897583, -0.039226483553647995, -0.05550222843885422, 0.04955395683646202, -0.016490185633301735, -0.016444606706500053, 0.031873274594545364, 0.030807117000222206, -0.006048785522580147, 0.006314996629953384, 0.04807872697710991, -0.040584031492471695, -0....
0.804046
0.775741
0.028305
You are required to implement a splay tree data structure in Erlang. A splay tree is a self-adjusting binary search tree with the additional property that recently accessed elements are quick to access again. The problem is to implement various operations on the splay tree including insertion, deletion, searching, find...
glaive
[ 0.010282118804752827, 0.03139172121882439, -0.013211608864367008, -0.049069687724113464, 0.025248313322663307, -0.03325125575065613, -0.002633594674989581, 0.06444122642278671, 0.03822389245033264, -0.018656032159924507, 0.05514651909470558, 0.022260498255491257, -0.03725354000926018, 0.00...
0.811813
0.796039
0.015774
You are tasked with creating a Java program that utilizes the JavaDrawing library to draw a simple shape on the screen. Your program should allow the user to choose between drawing a circle, a square, or a triangle. Once the shape is selected, the user should be prompted to input the size and color of the shape. After ...
glaive
[ -0.01085594855248928, 0.03504876419901848, -0.03997909277677536, -0.04525450989603996, 0.047041378915309906, -0.02810656651854515, -0.02280188910663128, 0.04398152604699135, 0.04294046014547348, -0.03966900333762169, 0.046031467616558075, 0.0389704629778862, -0.008539551869034767, -0.01481...
0.782209
0.765579
0.01663
You are tasked with implementing a program to calculate the number of n X 4 0..1 arrays that avoid specific patterns horizontally and vertically. The patterns to avoid are 0 0 0 and 0 1 0 horizontally, and 0 1 1 and 1 1 0 vertically. Your program should take an input 'n' and output the number of arrays that meet these ...
glaive
[ -0.0008635254926048219, 0.021662285551428795, -0.047624800354242325, -0.013990122824907303, 0.03619196638464928, -0.019396230578422546, -0.036384217441082, 0.054400261491537094, 0.03988596051931381, -0.008261040784418583, 0.01535826362669468, 0.02713363990187645, -0.024255048483610153, -0....
0.844324
0.78802
0.056303
You are tasked with creating a Verilog module that performs operations on arrays using variable slices. The module should initialize two 8-bit arrays, arr_a and arr_b, with the values 0xff and 0x00, respectively. You need to implement logic that assigns a slice of arr_a to a slice of arr_b based on a parameter c, and t...
glaive
[ 0.013886624947190285, 0.048809926956892014, -0.03141765668988228, -0.014324328862130642, 0.022876473143696785, -0.016771536320447922, -0.027161527425050735, 0.08280140906572342, 0.036520231515169144, -0.026621254161000252, 0.020663756877183914, 0.037009041756391525, -0.01465405523777008, 0...
0.798649
0.780418
0.018231
You are tasked with creating a function in R that takes a list of numbers as input and returns the mean, median, and mode of the numbers. The function should be called "calculate_statistics" and should handle the case when there are multiple modes in the list. Additionally, the function should be able to handle empty l...
glaive
[ 0.02716546319425106, 0.023388871923089027, -0.05940983071923256, -0.04355702921748161, 0.05645284801721573, -0.0033595189452171326, -0.037642452865839005, 0.05446653068065643, 0.03703773766756058, -0.004484653472900391, 0.009185876697301865, 0.05135791003704071, -0.011392474174499512, -0.0...
0.778119
0.759681
0.018438
You are tasked with implementing a CUDA kernel function to perform a specific mathematical operation on an array of numbers. The operation involves updating the elements of two arrays, g and h, based on a given momentum and local rate. The kernel function should iterate through the elements of the arrays and update the...
glaive
[ 0.005185423884540796, 0.06503777951002121, -0.012999852187931538, -0.023397136479616165, 0.03559449687600136, -0.023995807394385338, -0.03162339702248573, 0.09542332589626312, 0.04757334291934967, -0.008455929346382618, 0.024246422573924065, 0.02641410566866398, -0.005916396621614695, 0.01...
0.793391
0.77479
0.018602
Can you provide a solution to find the longest common subsequence between two given strings?
glaive
[ 0.01963556744158268, 0.013063089922070503, -0.03195331245660782, -0.03562849014997482, 0.021534869447350502, -0.03490615636110306, -0.017516858875751495, 0.025413228198885918, 0.03924175724387169, -0.03781818225979805, 0.025315547361969948, 0.021075507625937462, -0.02138753980398178, -0.01...
0.810469
0.781909
0.02856
You are tasked with creating a program that will calculate the values of alpha and beta using the algebra_solver function in a Bayesian model. The program should take in two real numbers, u and l, and use them to perform the necessary calculations to find the values of alpha and beta. Additionally, the program should u...
glaive
[ 0.02121577598154545, 0.0238097682595253, -0.046297136694192886, -0.04425541311502457, 0.04217139631509781, -0.030198058113455772, -0.022538818418979645, 0.07086210697889328, 0.05362815782427788, -0.019904548302292824, -0.005599510855972767, 0.039340805262327194, -0.03541439399123192, -0.01...
0.789198
0.770069
0.01913
You are tasked with creating a Python program that calculates the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 (denoted as 5!) is 5 x 4 x 3 x 2 x 1 = 120. Your program should take a user input for ...
glaive
[ 0.019852008670568466, 0.024649420753121376, -0.03527034819126129, -0.03590364381670952, 0.048226285725831985, -0.03172754868865013, -0.017425809055566788, 0.03912948817014694, 0.03887170925736427, -0.017940590158104897, 0.01401781477034092, 0.05035046488046646, -0.05563719570636749, -0.014...
0.80184
0.766961
0.034879
You are tasked with implementing a datatype for representing a binary tree in a programming language that supports inductive types. The datatype should have two constructors: `node` which takes a list of trees, and `leaf` which takes a value of type α. Additionally, you need to define a type for representing a list of ...
glaive
[ 0.009315678849816322, 0.0204458050429821, -0.031226029619574547, -0.040931932628154755, 0.04422293230891228, -0.046969927847385406, 0.02431405335664749, 0.08669701218605042, 0.04222030192613602, -0.027072858065366745, 0.032837603241205215, 0.03004908189177513, -0.010224287398159504, 0.0089...
0.809283
0.7909
0.018383
You are tasked with creating a Dart program that involves working with lists. Your goal is to write a function that takes in a list of integers and returns a new list that is a fixed-length version of the input list. The function should have the option to make the new list growable or fixed-length. Write a function ca...
glaive
[ 0.012977192178368568, 0.02867100015282631, -0.01903190277516842, -0.04570198431611061, 0.05037297308444977, -0.04128381609916687, -0.018664030358195305, 0.056539393961429596, 0.04826563596725464, -0.019387956708669662, 0.01116446778178215, 0.04743295535445213, -0.02608303725719452, -0.0002...
0.812352
0.795874
0.016477
You are tasked with implementing a function that trims leading whitespace from a string based on a specified condition. Your function should take a string and a predicate as input, and return the string with leading whitespace removed based on the predicate. For example: Input: " SELECT * FROM Foo ", predicate: ...
glaive
[ 0.030834557488560677, 0.031919557601213455, 0.005148126278072596, -0.05188765376806259, 0.0519162118434906, -0.0421437993645668, -0.01007335539907217, 0.08284986019134521, 0.03813431039452553, -0.011613292619585991, 0.019852612167596817, 0.018499765545129776, -0.025781676173210144, -0.0055...
0.797903
0.782367
0.015536
You are tasked with implementing a function that converts a natural number to its binary representation using a bitstring data type. The bitstring is represented using the following constructors: - `nil`: Represents the end of the bitstring - `x0_`: Represents a zero bit followed by another bitstring - `x1_`: Represent...
glaive
[ 0.015143382363021374, 0.0186535082757473, -0.019701765850186348, -0.03839803487062454, 0.03950586915016174, -0.0469902940094471, -0.01682218722999096, 0.037563715130090714, 0.04973967745900154, 0.0010251359781250358, 0.026852909475564957, 0.03593231365084648, -0.041462287306785583, -0.0054...
0.800305
0.777087
0.023218
You are given a list of 500 aunts, each with a set of properties. Your task is to implement two functions to solve the following problems: 1. `solve1`: Find the aunt whose properties match the following criteria: - Has 3 children - Has 7 cats - Has 2 samoyeds - Has 3 pomeranians - Has 0 akitas - Has 0...
glaive
[ 0.010587011463940144, 0.03293147683143616, -0.03817228972911835, -0.023951105773448944, 0.02892397716641426, -0.026491273194551468, -0.03608177602291107, 0.06930006295442581, 0.04584234207868576, -0.0013728204648941755, 0.02556459978222847, 0.022766314446926117, -0.02568882517516613, -0.02...
0.818971
0.777789
0.041182
I need to write a Prolog predicate `triangle2(N, T)` that takes a number `N` and returns the value of the Nth triangle number. The Nth triangle number is the sum of the first N natural numbers. For example, the 4th triangle number is 1 + 2 + 3 + 4 = 10. Can someone help me write a Prolog predicate to calculate the Nth...
glaive
[ 0.026415415108203888, 0.01823491044342518, -0.01620875857770443, -0.04289627447724342, 0.046923525631427765, -0.028908122330904007, -0.026548948138952255, 0.03476415574550629, 0.02907877415418625, -0.006262244191020727, 0.03612672910094261, 0.04179005324840546, -0.037747129797935486, -0.01...
0.799606
0.781712
0.017894
You are tasked with implementing a k-means clustering algorithm using the stochastic gradient descent (SGD) approach in F#. The k-means clustering method aims to partition a given set of observations into k clusters, where observations within the same cluster are more similar to each other than to those in other cluste...
glaive
[ -0.004924674518406391, 0.030436336994171143, -0.03208047151565552, -0.0391598641872406, 0.055416565388441086, -0.022657958790659904, -0.024599792435765266, 0.05461500212550163, 0.04109182208776474, -0.0013369971420615911, 0.015837837010622025, 0.017628364264965057, -0.027388490736484528, 0...
0.80895
0.782202
0.026748
You are given a set of numbers and are required to perform various statistical computations manually. Specifically, you need to compute the mean, sample variance, median, inter-quartile range (IQR), and the mode of the given dataset. Write an R program to perform the following tasks: - Compute the mean and sample vari...
glaive
[ 0.005650747567415237, 0.030822044238448143, -0.032017119228839874, -0.027782835066318512, 0.032876890152692795, -0.008036530576646328, -0.015774043276906013, 0.05591094121336937, 0.03418729826807976, 0.0003700855595525354, 0.0060527087189257145, 0.0395040363073349, -0.03013947233557701, -0...
0.794577
0.772612
0.021965
You have been tasked with implementing a double-precision one-dimensional nonuniform fast Fourier transform (NUFFT) in Fortran. The NUFFT is to be implemented using the algorithm described in the comments of the given code snippet. The specific steps for the NUFFT are as follows: 1. Spread data to an oversampled regul...
glaive
[ 0.0024895223323255777, 0.046402979642152786, -0.006534774787724018, -0.03347891569137573, 0.042830076068639755, -0.008931769989430904, -0.003380768932402134, 0.06841026991605759, 0.027679268270730972, -0.0013854583958163857, 0.028543131425976753, 0.03136804699897766, -0.01996886357665062, ...
0.793344
0.77423
0.019114
You are tasked with implementing a CUDA kernel that performs element-wise multiplication of two vectors. The vectors are represented as arrays of floats, and the result should be stored in a third array. Your CUDA kernel should take in three parameters: the two input vectors and the output vector. Your goal is to write...
glaive
[ 0.02415621466934681, 0.0521719716489315, -0.01814073882997036, -0.024967718869447708, 0.025626111775636673, 0.004279628396034241, -0.02233581431210041, 0.10335947573184967, 0.029811687767505646, -0.029176650568842888, 0.020436223596334457, 0.037428900599479675, -0.010387023910880089, -0.00...
0.797437
0.777584
0.019852
You are required to create a program that calculates the probability of a given quantum state. The quantum state is represented by the amplitude function, which takes two parameters x and y. The probability is calculated using the formula Abs[amplitude[x, y]]^2. You are then required to use the NMaximize function to fi...
glaive
[ 0.0044328575022518635, 0.029228540137410164, -0.029034599661827087, -0.022888464853167534, 0.03898315131664276, -0.0224292129278183, -0.010633252561092377, 0.07363482564687729, 0.029860561713576317, 0.007198079023510218, 0.02668614313006401, 0.040178071707487106, -0.007657240144908428, -0....
0.795737
0.768669
0.027068
You are tasked with creating a function that takes in a number and returns a string representation of that number, with the following conditions: - If the number is 1, the function should return 'one' - If the number is 2, the function should return 'two' - If the number is 3, the function should return 'three' - If th...
glaive
[ 0.02258395217359066, 0.02577984146773815, -0.020695216953754425, -0.05595344305038452, 0.06162557378411293, -0.04254157096147537, -0.022736869752407074, 0.05264676362276077, 0.031686972826719284, 0.0008177994750440121, 0.03242747113108635, 0.042246442288160324, -0.0405694805085659, -0.0092...
0.796306
0.76792
0.028386
You are required to implement a program that performs GPU matrix-matrix multiplication for square matrices. Your program should prompt the user to input the size of the square matrix and then dynamically allocate memory for the matrices A, B, and C. The matrices A and B should be initialized with values based on their ...
glaive
[ 0.03313111141324043, 0.03559347987174988, -0.038697339594364166, -0.03411434590816498, 0.03686864301562309, -0.009259174577891827, -0.024478701874613762, 0.0822620764374733, 0.0302154328674078, -0.040661364793777466, 0.003312184475362301, 0.02441241964697838, -0.02613389492034912, -0.02020...
0.800362
0.777164
0.023198
You are tasked with creating a function that determines whether a given year is a leap year or not. A leap year is defined as being evenly divisible by 4, except for years that are evenly divisible by 100, unless the year is also evenly divisible by 400. Your function should take a single argument, the year to be evalu...
glaive
[ -0.0019516393076628447, 0.008305424824357033, -0.01739463396370411, -0.034307681024074554, 0.04534134641289711, -0.03556657209992409, -0.034457698464393616, 0.0810118243098259, 0.03812775760889053, 0.007466180715709925, 0.019629597663879395, 0.025899820029735565, -0.034250494092702866, -0....
0.788999
0.761515
0.027484
You are tasked with implementing a program that computes the singular value decomposition (SVD) of a batch of matrices using the CUDA library. The SVD is a factorization of a real or complex matrix, with applications in data compression, dimensionality reduction, and solving linear systems of equations. In this proble...
glaive
[ -0.0028783720917999744, 0.049135029315948486, -0.03424539044499397, -0.02011803165078163, 0.028248852118849754, -0.010400114580988884, -0.010780696757137775, 0.08651414513587952, 0.04932434484362602, -0.027846205979585648, 0.01961303874850273, 0.018638208508491516, 0.002485189586877823, -0...
0.803004
0.777041
0.025963
You are tasked with writing a program that processes a file containing DNA sequence alignment data and extracts specific information from it. The file contains multiple lines, each representing a DNA sequence alignment record. Each record consists of 11 tab-separated fields: 1. A string representing the type of DNA pol...
glaive
[ 0.013765822164714336, -0.0019184706034138799, -0.055640242993831635, -0.048903968185186386, 0.0223998986184597, -0.024140551686286926, -0.00830146949738264, 0.05075753107666969, 0.032047469168901443, -0.017245521768927574, 0.023387564346194267, 0.01401350274682045, -0.02910592034459114, 0....
0.805082
0.784332
0.02075
I need help creating a program that takes an array of integers and a target value. The program should find all combinations of three numbers from the array that add up to the target value. Can someone provide a solution in Python?
glaive
[ 0.018462689593434334, 0.021982187405228615, -0.047083448618650436, -0.03279969096183777, 0.053773216903209686, -0.021486278623342514, -0.024417473003268242, 0.03331837058067322, 0.02595122531056404, -0.019091498106718063, 0.026896992698311806, 0.030237453058362007, -0.046634599566459656, -...
0.810915
0.795906
0.01501
You are tasked with implementing a function that takes in a vector of integers and a target integer, and returns another vector of integers that represents the offsets of the occurrences of the target integer within the input vector. The offsets are 0-indexed and should be in ascending order. For example, if the input ...
glaive
[ 0.057318732142448425, 0.03636923432350159, -0.02812010981142521, -0.022669076919555664, 0.043772079050540924, 0.009395556524395943, -0.05174148082733154, 0.05874732881784439, 0.029301956295967102, -0.022709829732775688, 0.034385330975055695, 0.01743577979505062, -0.03611062467098236, -0.00...
0.830507
0.776777
0.05373
How can I write a function that finds the maximum value in a given sequence of numbers?
glaive
[ 0.02789153717458248, 0.031933750957250595, -0.03287263959646225, -0.023860568180680275, 0.03862118721008301, -0.01985897123813629, -0.02753148414194584, 0.045821283012628555, 0.025524111464619637, -0.02766055427491665, 0.02741466835141182, 0.046419885009527206, -0.02880898304283619, -0.007...
0.79879
0.776363
0.022427
You are tasked with creating a program that analyzes a sequence of "Beats" and "Notes" in a musical composition. Each "Beat" entry in the sequence represents a time interval and a number, while each "Note" entry represents a start time, end time, and a pitch. Your program should be able to: 1. Determine the duration ...
glaive
[ 0.03567076846957207, 0.019800430163741112, -0.04842560365796089, -0.00702661881223321, 0.02622855268418789, -0.02522391453385353, -0.020041614770889282, 0.05877895653247833, 0.026776190847158432, -0.0056260256096720695, 0.04568423703312874, 0.006267326883971691, -0.032691698521375656, 0.00...
0.803605
0.775217
0.028388