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 |
|---|---|---|---|---|---|
Can anyone provide a solution to generate a random integer array of length 10, containing values between 0 and 100? | glaive | [
0.014310699887573719,
0.016339099034667015,
-0.02115020714700222,
-0.01865742728114128,
0.013626785948872566,
-0.05852136015892029,
-0.031747881323099136,
0.04255397990345955,
0.03260478004813194,
-0.04564547538757324,
0.026313118636608124,
0.027024416252970695,
-0.06121893599629402,
-0.02... | 0.79652 | 0.777693 | 0.018827 |
You are tasked with implementing a function to generate a triangle of numbers based on the given formula:
T(n, k) = (3 - (-1)^k) * binomial(n, k) / 2, where 0 <= k <= n
The function should take in two parameters:
- n: the number of rows in the triangle
- k: the index of the specific row in the triangle (0-based indexi... | glaive | [
0.030679382383823395,
0.036051273345947266,
-0.03892768546938896,
-0.043098464608192444,
0.04340450093150139,
-0.027449510991573334,
-0.03688456863164902,
0.052769023925065994,
0.023143945261836052,
-0.004883907735347748,
0.05178876221179962,
0.06035926938056946,
-0.036545317620038986,
0.0... | 0.818526 | 0.767307 | 0.051219 |
You are working on a parallel computing project using CUDA and need to implement a function to pack and unpack buffers in a 3D array. The PackBuffers3D and UnpackBuffers3D functions are responsible for packing and unpacking the data from the c_head array into the buffer array. The PackGhostCells function is also used t... | glaive | [
0.013574394397437572,
0.06581582874059677,
-0.010378167033195496,
-0.023175423964858055,
0.026052499189972878,
-0.0032353766728192568,
-0.031004484742879868,
0.08359317481517792,
0.04032079502940178,
0.000991072622127831,
0.02307155914604664,
0.03916923701763153,
-0.004243890289217234,
0.0... | 0.795177 | 0.780639 | 0.014538 |
You are tasked with creating a program that calculates the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 is 5 * 4 * 3 * 2 * 1 = 120.
Write a function called "calculate_factorial" that takes an inte... | glaive | [
0.022262385115027428,
0.03481661528348923,
-0.026141038164496422,
-0.031653888523578644,
0.046216730028390884,
-0.03633750230073929,
-0.023686770349740982,
0.054595645517110825,
0.03936716914176941,
-0.01918589323759079,
0.014378239400684834,
0.052498649805784225,
-0.045487187802791595,
-0... | 0.80292 | 0.763895 | 0.039025 |
You are tasked with implementing a quantum algorithm to calculate the probability distribution of a given quantum state. The algorithm involves defining a function to calculate the probability amplitude and then using it to find the probability distribution. The algorithm also requires finding the maximum probability a... | glaive | [
0.0017234694678336382,
0.030592314898967743,
-0.015213461592793465,
-0.019497288390994072,
0.03857901319861412,
-0.023368852213025093,
-0.01692729815840721,
0.07124412804841995,
0.03282277286052704,
0.008458701893687248,
0.020580517128109932,
0.02808651328086853,
-0.005774144548922777,
-0.... | 0.794899 | 0.765332 | 0.029567 |
You are required to implement a program that performs matrix-vector multiplication using the CUSP library. The program should create a Compound Diagonal Storage (CDS) matrix with the given dimensions and entries. It should then initialize an input vector and allocate an output vector. After performing the matrix-vector... | glaive | [
0.025400537997484207,
0.018396541476249695,
-0.022846700623631477,
-0.01829368621110916,
0.042030513286590576,
-0.02077232301235199,
-0.02410733886063099,
0.08995646238327026,
0.05255666747689247,
-0.030578473582863808,
0.0077224732376635075,
0.03514403477311134,
-0.022472837939858437,
-0.... | 0.801335 | 0.78456 | 0.016775 |
You are tasked with creating a function that generates Gaussian rewards based on a set of means and a standard deviation. The function should take in an array of anonymous functions representing the means, as well as the standard deviation. The generated rewards should follow a Gaussian distribution with the specified ... | glaive | [
-0.029958371073007584,
0.026523051783442497,
-0.04289546236395836,
-0.04289057105779648,
0.025248024612665176,
-0.030335189774632454,
-0.028327051550149918,
0.0727284625172615,
0.028745053336024284,
-0.009663321077823639,
0.023911163210868835,
0.02947249449789524,
-0.01897977478802204,
0.0... | 0.802695 | 0.785431 | 0.017264 |
You are tasked with implementing a program that handles bitstrings. A bitstring is an immutable, contiguous sequence of bits, represented compactly such that a bitstring of 8N bits consumes N bytes of memory, plus some constant overhead. Your program needs to include the following functionalities:
1. Construct a bitstr... | glaive | [
0.01845451630651951,
0.025144074112176895,
-0.01869368739426136,
-0.020131295546889305,
0.03695528209209442,
-0.05985620990395546,
-0.01186972763389349,
0.07061783224344254,
0.04150944575667381,
-0.017323525622487068,
0.020593957975506783,
0.027033040300011635,
-0.04204360768198967,
0.0124... | 0.813195 | 0.786783 | 0.026411 |
You are tasked with creating an algorithm to help a tourist agency allocate tour guides to destinations. The goal is to assign exactly two tour guides to each destination, with each guide being assigned to exactly one destination. The agency has preferences for each destination regarding the tour guides, and each tour ... | glaive | [
0.030592570081353188,
0.02796756848692894,
-0.043315425515174866,
-0.026596207171678543,
0.03972579911351204,
-0.029834860935807228,
-0.03511645644903183,
0.05580895021557808,
0.0304351095110178,
-0.01739397458732128,
0.0171702541410923,
0.017024924978613853,
0.0011798914056271315,
0.00032... | 0.830707 | 0.793693 | 0.037013 |
You are required to implement a function that calculates various statistical measures for a given series of numeric values. The statistical measures to be implemented include moving count, moving sum, moving mean, moving standard deviation, moving skewness, moving minimum, moving maximum, moving kurtosis, expanding mea... | glaive | [
0.011658195406198502,
0.006920665502548218,
-0.049310166388750076,
-0.04919474571943283,
0.05381673946976662,
-0.010269364342093468,
-0.03807586804032326,
0.06773275882005692,
0.047931451350450516,
-0.0026537624653428793,
0.0035294569097459316,
0.03110853023827076,
-0.041898615658283234,
-... | 0.799271 | 0.775546 | 0.023725 |
I need to implement a Multinomial distribution in Julia. The Multinomial distribution is a generalization of the binomial distribution to multiple categories. It describes the probability of observing each of a set of categories a certain number of times in a fixed number of trials. I need to create a function that tak... | glaive | [
-0.01960892789065838,
0.003853594185784459,
-0.03909725323319435,
-0.02795700542628765,
0.028960533440113068,
-0.02017931453883648,
-0.037113457918167114,
0.06853817403316498,
0.04961543157696724,
-0.0023806572426110506,
0.024612247943878174,
0.03484279289841652,
-0.01121219340711832,
0.00... | 0.796352 | 0.781969 | 0.014383 |
You are tasked with implementing a ring buffer data structure in Clojure. A ring buffer is a data structure that is treated as a fixed-size queue. When the buffer is full and a new element is added, the oldest element is removed to make space for the new element. The ring buffer should support the following operations:... | glaive | [
0.023332366719841957,
0.030719585716724396,
-0.018015528097748756,
-0.023141885176301003,
0.038920171558856964,
-0.04345592111349106,
-0.006829177029430866,
0.07302960008382797,
0.05792998522520065,
-0.006971515715122223,
0.02403692901134491,
0.019721349701285362,
-0.02090291492640972,
0.0... | 0.800913 | 0.783671 | 0.017241 |
You are tasked with designing a Verilog module that implements a dot product calculation using control arrays. The module should have inputs for the clock, r_enable, controlArr, and w_enable, and outputs for init_i_t_a, init_acc_t_a, and result. Additionally, the module should have registers for controlArrWEnable_a, co... | glaive | [
0.024479292333126068,
0.04263903200626373,
-0.047890227288007736,
-0.031739767640829086,
0.019456688314676285,
-0.03614004701375961,
-0.03844263404607773,
0.08111438155174255,
0.034138843417167664,
-0.021223798394203186,
0.012879193760454655,
0.04133368656039238,
-0.003366632154211402,
-0.... | 0.800039 | 0.777035 | 0.023004 |
You are tasked with implementing a recursive subroutine in Fortran called CGEQRT3 that computes a QR factorization of a complex M-by-N matrix A using the compact WY representation of Q. The subroutine takes in the following arguments:
- M: The number of rows of the matrix A. M >= N.
- N: The number of columns of the m... | glaive | [
0.022753020748496056,
0.04657819867134094,
-0.01885766163468361,
-0.03751145675778389,
0.029214143753051758,
-0.02151280827820301,
-0.013567822985351086,
0.07173990458250046,
0.024682002142071724,
-0.011664805002510548,
0.015997182577848434,
0.0310159120708704,
-0.04553505405783653,
0.0060... | 0.812056 | 0.781663 | 0.030393 |
You are tasked with creating a function that can generate a random number within a given range using a provided seed. The function should take in a minimum and maximum value, as well as a seed, and return a random number within the specified range based on the provided seed. You must implement the generate_random_numbe... | glaive | [
0.012881307862699032,
0.03229358792304993,
-0.021130967885255814,
-0.02848030813038349,
0.044700611382722855,
-0.0424593985080719,
-0.05057257041335106,
0.06020795553922653,
0.01528776716440916,
-0.005725366063416004,
0.0206120777875185,
0.03381069377064705,
-0.030515698716044426,
0.007173... | 0.789392 | 0.767345 | 0.022047 |
You are required to implement a CUDA kernel function that performs binary matrix multiplication using XNOR and population count operations. The problem involves multiplying two input matrices A and B of binary values using the XNOR operation and then counting the number of set bits in the result. The matrices A and B a... | glaive | [
0.009497374296188354,
0.04333675652742386,
-0.027526210993528366,
-0.020481811836361885,
0.02192086912691593,
-0.012224694713950157,
-0.04047120735049248,
0.10998094081878662,
0.03948841989040375,
-0.018324246630072594,
0.014174366369843483,
0.028174379840493202,
-0.018346285447478294,
-0.... | 0.806735 | 0.778615 | 0.028121 |
Can you provide a Python program that can calculate the hourglass sum for a given 2D array input? | glaive | [
0.0015465536853298545,
0.026961589232087135,
-0.035359930247068405,
-0.040198374539613724,
0.035604506731033325,
-0.02361755259335041,
-0.028257347643375397,
0.044929053634405136,
0.04958377406001091,
-0.022444050759077072,
0.024320052936673164,
0.026240037754178047,
-0.0219661183655262,
-... | 0.797187 | 0.782406 | 0.014781 |
You are tasked with implementing a CUDA kernel function for nearest neighbor 3D upsampling. The function takes as input two 3D tensors (data1 and data2), and it is responsible for upsampling data1 to match the dimensions of data2 using the nearest neighbor interpolation method. The kernel function should handle both fo... | glaive | [
0.004019026178866625,
0.05573370307683945,
-0.01409248448908329,
-0.021357139572501183,
0.03530457988381386,
0.007967900484800339,
-0.00866003055125475,
0.09456833451986313,
0.02966058813035488,
-0.008334027603268623,
0.03054581955075264,
0.0373963862657547,
-0.024003176018595695,
0.005004... | 0.802544 | 0.785783 | 0.016761 |
You are tasked with implementing a function in CUDA C++ to determine if a given vertex is connected to another vertex in a directed acyclic graph (DAG). The function should return true if the vertices are connected and false if they are not. You need to implement the function `is_connected_dag` which takes three parame... | glaive | [
0.003657266031950712,
0.02827177569270134,
-0.03193867579102516,
-0.020822301506996155,
0.01552130188792944,
-0.009682781994342804,
-0.002753967884927988,
0.08902791887521744,
0.034878622740507126,
-0.001171265379525721,
0.02174486219882965,
0.03175323083996773,
0.023379124701023102,
-0.00... | 0.803744 | 0.786287 | 0.017457 |
You are tasked with creating a program to calculate and verify the DAMM check digit for a given input value. The DAMM algorithm is a checksum formula to detect single-digit errors in data entry. The program should prompt the user to enter a value and then calculate the DAMM check digit for the input value. It should th... | glaive | [
0.01584734208881855,
0.01392998918890953,
-0.011697485111653805,
-0.03891545906662941,
0.025953760370612144,
-0.02175230160355568,
0.0044511454179883,
0.0712851732969284,
0.03498675301671028,
-0.014249010011553764,
0.02284052222967148,
0.04297669604420662,
-0.028936246410012245,
-0.0155392... | 0.810881 | 0.788685 | 0.022196 |
You are tasked with creating a program that drives a servo motor to a desired angle using a specified number of pulses. The program takes in arguments for the required phase angle, number of pulses to send, and the parallel output line to use. Additionally, the program requires three calibration coefficients for the pu... | glaive | [
0.012547987513244152,
0.01387441623955965,
-0.03799309581518173,
-0.027385100722312927,
0.020170629024505615,
-0.017751142382621765,
-0.04869813844561577,
0.0690605416893959,
0.02644120715558529,
-0.006845839787274599,
0.024646982550621033,
0.0429748110473156,
-0.03438775613903999,
-0.0047... | 0.800454 | 0.784752 | 0.015703 |
You are required to write a function that scales the roots of a given polynomial. The function should take a polynomial `p` and a ring element `s` as input and return a new polynomial with roots `r * s` for each root `r` of the input polynomial `p`. Additionally, you need to implement some basic operations for this sca... | glaive | [
0.029950790107250214,
0.060411762446165085,
-0.02391151711344719,
-0.04167011007666588,
0.027587054297327995,
-0.05205332487821579,
0.005534071940928698,
0.057848744094371796,
0.02671285718679428,
-0.0032538233790546656,
0.01958644390106201,
0.032203081995248795,
-0.030582478269934654,
-0.... | 0.807399 | 0.785636 | 0.021763 |
You are tasked with implementing a quantum probability distribution visualization using a given amplitude function and probability function. The goal is to find the maximum probability of a given quantum state and visualize the probability distribution in 3D and 2D plots.
The given amplitude and probability functions ... | glaive | [
-0.001528346911072731,
0.030150502920150757,
-0.02905583195388317,
-0.031698837876319885,
0.028856614604592323,
-0.026391208171844482,
-0.018639903515577316,
0.0651317611336708,
0.035189613699913025,
0.016480587422847748,
0.033979468047618866,
0.02399110049009323,
-0.00024905247846618295,
... | 0.797148 | 0.776581 | 0.020567 |
You are tasked with implementing a data structure for chunk processing in the context of matrix operations. Specifically, you need to create a Chunk data structure with the following member variables:
- firstrow: the row at which the chunk starts
- num_entries: the number of matrix entries and column offsets in the chu... | glaive | [
0.032566651701927185,
0.01977229118347168,
-0.02201196737587452,
-0.03667959198355675,
0.026200802996754646,
-0.031390365213155746,
-0.011770930141210556,
0.0815097987651825,
0.02664962038397789,
-0.027249254286289215,
0.02537648193538189,
0.02020360343158245,
-0.01864893175661564,
-0.0006... | 0.813858 | 0.786563 | 0.027295 |
You are tasked with creating a program that simulates and draws a spirograph mechanism using a given set of parameters. The program should be able to draw a picture of the spirograph mechanism, with the ability to draw with the `spirograph` function first, and then follow with the `mechanism` function using the same pa... | glaive | [
0.011529933661222458,
0.025334540754556656,
-0.027971705421805382,
-0.04608722776174545,
0.04329489544034004,
-0.028742995113134384,
-0.056955184787511826,
0.07092779129743576,
0.040437597781419754,
-0.020805148407816887,
0.012735007330775261,
0.05264946445822716,
-0.017815275117754936,
-0... | 0.793702 | 0.775619 | 0.018083 |
You are tasked with implementing a C++ class that handles convolution indexes for a given set of parameters. The class should have a method that calculates the offset and size based on the input image shape, number of input channels (Ni), stride (Sk), and number of leading dimensions (Nld). Additionally, the class shou... | glaive | [
0.006843780633062124,
0.034265823662281036,
-0.01215702947229147,
-0.01183117926120758,
0.040286388248205185,
-0.001981359673663974,
-0.04232567176222801,
0.10483166575431824,
0.03716091439127922,
-0.02432328090071678,
0.042505715042352676,
0.021903613582253456,
-0.01984700933098793,
0.010... | 0.800537 | 0.785068 | 0.015469 |
You are tasked with implementing a function in a Lisp-like language that takes a syntax object as input and returns a list of all the elements in the syntax object. The syntax object can be a pair, a vector, or a circular list. Your function should be able to handle all these different types of syntax objects and extra... | glaive | [
0.0378572940826416,
0.03500818833708763,
-0.03377514332532883,
-0.060327887535095215,
0.05485524982213974,
-0.038241103291511536,
-0.01907578483223915,
0.055247172713279724,
0.04843975976109505,
-0.015739768743515015,
0.03532784432172775,
0.06305079907178879,
-0.020116185769438744,
-0.0089... | 0.797645 | 0.782521 | 0.015124 |
You are working on developing a new function for nonnegative integer modular arithmetic in ACL2. Your task is to implement a function that calculates the remainder of dividing a nonnegative integer `n` by a positive integer `d`, denoted as `(nonneg-int-mod n d)`. The function should adhere to the following requirements... | glaive | [
0.027820883318781853,
0.02473320998251438,
-0.01787561923265457,
-0.0485929399728775,
0.030298937112092972,
-0.015301397070288658,
-0.019412890076637268,
0.06667599081993103,
0.040951114147901535,
-0.023974934592843056,
0.01089441403746605,
0.022506242617964745,
-0.030056046321988106,
0.00... | 0.825686 | 0.796629 | 0.029057 |
I am working on a music application and I need to write a program to process a list of beats and notes. Each beat has a timestamp and a number of notes, and each note has a start timestamp, end timestamp, and a pitch. The goal is to parse the input and calculate the total duration of each note pitch across all beats.
... | glaive | [
0.025158410891890526,
0.019124262034893036,
-0.05910279229283333,
-0.018533118069171906,
0.03296229988336563,
-0.04764730483293533,
-0.03441900387406349,
0.055779002606868744,
0.03714403510093689,
-0.021846825256943703,
0.04275326803326607,
0.017376650124788284,
-0.04242275282740593,
-0.01... | 0.809115 | 0.790013 | 0.019102 |
What is an algorithm to find the largest element in a binary tree? | glaive | [
0.025485021993517876,
0.033474210649728775,
-0.02902698703110218,
-0.04496205598115921,
0.02346721664071083,
-0.03407192975282669,
-0.005064492579549551,
0.054747872054576874,
0.03016780875623226,
-0.024778584018349648,
0.040761370211839676,
0.037926703691482544,
-0.027710964903235435,
0.0... | 0.791318 | 0.764405 | 0.026912 |
What is the code to detect the type of a triangle (equilateral, isosceles, or scalene) based on the lengths of its sides? | glaive | [
0.006721313577145338,
0.010399759747087955,
-0.02986687608063221,
-0.04169687628746033,
0.015271185897290707,
-0.02680102363228798,
-0.011626441963016987,
0.048149604350328445,
0.016323350369930267,
-0.03398032486438751,
0.03154281899333,
0.04856454208493233,
-0.023441633209586143,
-0.0153... | 0.783532 | 0.768647 | 0.014885 |
You have been tasked with writing a program that filters, maps, and reduces a list of numbers. Specifically, you need to write a function that takes in a list of integers, filters out the even numbers, maps the remaining numbers to their squares, and then reduces the squared numbers by summing them all up. Your task is... | glaive | [
0.024201836436986923,
0.04247693344950676,
-0.03551764041185379,
-0.05120302736759186,
0.07072627544403076,
-0.0232925396412611,
-0.014541077427566051,
0.06253679096698761,
0.05865565314888954,
-0.007460938300937414,
0.014635186642408371,
0.031125253066420555,
-0.058916881680488586,
-0.038... | 0.821515 | 0.795192 | 0.026323 |
What is a simple algorithm that can be used to sort a list of names in alphabetical order? | glaive | [
0.030091693624854088,
0.008523642085492611,
-0.01766599342226982,
-0.03440331667661667,
0.029093245044350624,
-0.042735230177640915,
-0.018228629603981972,
0.02286451868712902,
0.016208192333579063,
-0.03323962166905403,
0.016006426885724068,
0.013640012592077255,
-0.03260422497987747,
-0.... | 0.787929 | 0.769647 | 0.018282 |
You are tasked with implementing an entity in VHDL for a Simon cipher key generator. The entity should have the following specifications:
- It should be named "simon_key"
- It should have a generic "round_ctr" of type integer
- It should have three input ports: "k_0", "k_1", "k_3" of type std_logic_vector(31 downto 0)
... | glaive | [
0.03438011184334755,
0.01899893768131733,
-0.012517430819571018,
-0.04474318027496338,
0.023250393569469452,
-0.039048027247190475,
-0.015056842938065529,
0.0836758017539978,
0.037600018084049225,
-0.00568787008523941,
0.05843885615468025,
0.04423362389206886,
-0.02067446894943714,
-0.0111... | 0.792841 | 0.777732 | 0.015109 |
I want to develop a Python script that takes a list of words as input and analyzes the frequency of each word. Can you provide a solution that will output the word that appears most frequently from the given list? Here is an example of the input: `['apple', 'banana', 'orange', 'apple']`. | glaive | [
0.026816053315997124,
0.027369754388928413,
-0.01706383377313614,
-0.02508164942264557,
0.02880808152258396,
-0.026557667180895805,
-0.028124580159783363,
0.054826520383358,
0.01942466013133526,
-0.015069764107465744,
0.024589333683252335,
0.014863020740449429,
-0.020528050139546394,
0.004... | 0.796294 | 0.773773 | 0.022521 |
You are tasked with creating an XSLT stylesheet to perform repeated division on a set of numbers. The input XML will contain a "doc" element with multiple "n" elements representing the numbers to be used for division. Your task is to create a template that will perform the following division operations:
- n0 divided by... | glaive | [
0.013130199164152145,
0.016959290951490402,
-0.029023030772805214,
-0.03904565051198006,
0.024613186717033386,
-0.024918364360928535,
-0.0027799156960099936,
0.07145906984806061,
0.03239821642637253,
-0.023177221417427063,
0.029641825705766678,
0.027912989258766174,
-0.03598864749073982,
0... | 0.803268 | 0.774978 | 0.02829 |
You are required to generate a list of random numbers and then create a separate list with unique numbers.
Write a program to:
- Generate a list of 'n' random numbers between 0 and 100000 (inclusive). Store these numbers in a list.
- Print the length of the list and the first 5 elements of the list.
- Generate a list ... | glaive | [
0.01745542883872986,
0.02519025094807148,
-0.026251599192619324,
-0.040491923689842224,
0.0420820489525795,
-0.03304192051291466,
-0.03341364115476608,
0.04715694859623909,
0.04140067473053932,
-0.01622360572218895,
0.02339625172317028,
0.046893395483493805,
-0.0466417632997036,
-0.0110871... | 0.819208 | 0.790478 | 0.02873 |
You are tasked with creating a function that takes a list of numbers and returns the sum of all the even numbers in the list. The function should be written in Lean programming language using the Lean syntax. | glaive | [
0.013148266822099686,
0.022087829187512398,
-0.04239547625184059,
-0.06334049999713898,
0.04705043509602547,
-0.011475500650703907,
-0.03119507059454918,
0.042545005679130554,
0.028863372281193733,
-0.014492844231426716,
0.014239461161196232,
0.054259587079286575,
-0.04222628101706505,
-0.... | 0.810301 | 0.778466 | 0.031835 |
You are tasked with solving a cave navigation problem. You are given a list of passages connecting different caves, with each passage having two endpoints. The caves are labeled with strings, and each cave can have multiple passages connecting it to other caves. The passages are bidirectional, meaning that if cave A is... | glaive | [
0.01196911558508873,
0.02836749702692032,
-0.029941538348793983,
-0.0009282869286835194,
0.025362227112054825,
-0.019910141825675964,
-0.017815446481108665,
0.0536235012114048,
0.016810065135359764,
-0.009001010097563267,
0.039094820618629456,
0.01663563773036003,
-0.02181081846356392,
-0.... | 0.826105 | 0.784637 | 0.041468 |
You are tasked with creating a function in Julia that calculates the highest power of a given base that divides evenly into a given number.
Write a function called `highestPower` that takes two arguments:
- `n` (an integer) representing the number for which you need to find the highest power of the base
- `base` (an i... | glaive | [
0.04954293370246887,
0.05105696991086006,
-0.020246103405952454,
-0.040903545916080475,
0.030034827068448067,
-0.03458920866250992,
0.003374476684257388,
0.054830122739076614,
0.05006985738873482,
-0.013004270382225513,
0.03333330154418945,
0.04691336676478386,
-0.04395263269543648,
-0.011... | 0.814056 | 0.777202 | 0.036854 |
You are tasked with creating a program to calculate the probability of a quantum state in a 14-qubit system. The quantum state is described by a complex-valued function called `amplitude` and `amplitude2`, and the probability of the state is given by the absolute square of the amplitude. Your task is to write a program... | glaive | [
-0.000660200952552259,
0.041569605469703674,
-0.0271221324801445,
-0.02265363372862339,
0.05401933938264847,
-0.019765101373195648,
-0.020646970719099045,
0.07174050807952881,
0.03021279349923134,
0.0007155943312682211,
0.027357643470168114,
0.032397761940956116,
-0.006222020834684372,
-0.... | 0.806147 | 0.774778 | 0.031369 |
You are given a filter called `cofinite` which represents the filter of subsets whose complements are finite. You need to define a function `tendsto_at_top` that takes a function `f : α → β` and returns `true` if the function `f` tends to infinity at infinity, i.e., for every `N : β`, the preimage of the set `{n | n > ... | glaive | [
0.02219143509864807,
0.03143602982163429,
-0.022890355437994003,
-0.022632181644439697,
0.036955054849386215,
-0.021654604002833366,
-0.014609886333346367,
0.05983012914657593,
0.027802694588899612,
-0.018869249150156975,
0.01710805669426918,
0.019553912803530693,
-0.004570759367197752,
-0... | 0.831812 | 0.804709 | 0.027103 |
You are tasked with implementing a mutable struct in Julia called `Discrete` that represents a discrete space with elements {0,1,...,n-1}. The struct should have two fields: `n` of type Int and `dtype` of type DataType. Additionally, you need to implement the following methods for the `Discrete` struct:
1. A constructo... | glaive | [
-0.019407562911510468,
0.03560667857527733,
-0.02875429578125477,
-0.023174654692411423,
0.033311694860458374,
-0.02729024551808834,
-0.015712006017565727,
0.08066519349813461,
0.06374501436948776,
-0.0011994382366538048,
0.0332552045583725,
0.034236785024404526,
-0.013568068854510784,
-0.... | 0.817047 | 0.800284 | 0.016763 |
:
You are tasked with implementing a program to test the functionality of a set of cases. Each case consists of an input list of lists, where each inner list contains two sublists: the first sublist contains mathematical expressions, and the second sublist contains variables. Your task is to compute the intersection ... | glaive | [
0.04227697476744652,
0.009591661393642426,
-0.03951767086982727,
-0.031764641404151917,
0.04961016774177551,
0.0029509093146771193,
-0.004930104129016399,
0.07015601545572281,
0.03893839940428734,
-0.0009761475375853479,
0.017422141507267952,
0.03262469172477722,
-0.013009624555706978,
-0.... | 0.832142 | 0.807811 | 0.02433 |
You are tasked with creating a program that can parse a variety of different data types in any order. The program should be able to handle parsing integers, strings, and floats, and should also be able to handle parsing these data types in any order. For example, the input string "10, hello, 3.14" should be parsed as [... | glaive | [
0.04270884022116661,
0.018807919695973396,
-0.035922709852457047,
-0.04570435360074043,
0.04736145958304405,
-0.04847116768360138,
-0.010892115533351898,
0.027552539482712746,
0.04853222891688347,
-0.01831158436834812,
0.024140916764736176,
0.04417926445603371,
-0.018051257357001305,
-0.01... | 0.796436 | 0.780494 | 0.015941 |
```
I am wondering if someone could verify my answer to this question please! I have a midterm next week and the TA has not posted solutions to this question yet:
Consider the following MIPS assembly code and identify all pipeline hazards under the assumption that there are no pipeline optimizations implemented- inclu... | glaive | [
0.0024054895620793104,
0.002982321660965681,
-0.01855415105819702,
-0.007118468638509512,
0.04586414620280266,
-0.022123340517282486,
-0.02270367182791233,
0.08584993332624435,
0.0248480886220932,
-0.0012777915690094233,
0.028950126841664314,
0.025476839393377304,
-0.023899368941783905,
-0... | 0.815545 | 0.800826 | 0.014718 |
You are tasked with implementing a function to perform Diffie-Hellman key exchange in Scheme. Diffie-Hellman (DH) key exchange is a method of securely exchanging cryptographic keys over a public channel. The algorithm involves the use of a large prime number and a generator to generate public and private keys for each ... | glaive | [
0.0192272886633873,
0.03078324720263481,
-0.01947459764778614,
-0.0441008098423481,
0.018863266333937645,
-0.025020448490977287,
-0.017179762944579124,
0.06187397241592407,
0.04319381341338158,
-0.018848842009902,
0.03333263099193573,
0.025162067264318466,
-0.03040749579668045,
-0.00287666... | 0.804201 | 0.787104 | 0.017097 |
You are required to implement a 3D cellular automaton (CA) in CUDA using C++. The CA_GPU3D class contains functions for getting and setting substate values, and for obtaining the index of a neighboring cell in a toroidal grid. The class also includes overloaded functions to operate on a single index representation of t... | glaive | [
0.02449674718081951,
0.043198905885219574,
-0.008063934743404388,
-0.018787622451782227,
0.02007429488003254,
-0.020766640082001686,
-0.03624050319194794,
0.11754553765058517,
0.01516732107847929,
-0.007951200939714909,
0.040776219218969345,
0.03816233575344086,
-0.013614599592983723,
-0.0... | 0.807731 | 0.784082 | 0.023649 |
You are tasked with implementing a function in Scheme that takes a list of numbers and returns a list of pairs, where each pair consists of a unique number from the original list and the number of times it appears in the list. For example, given the input '(2 3 1 3 2 2 2 3 4 6 6 6 7 1)', the output should be '((2 . 4) ... | glaive | [
0.029886147007346153,
0.030271586030721664,
-0.034582074731588364,
-0.034600984305143356,
0.055227965116500854,
-0.016541862860322,
-0.018872573971748352,
0.034525539726018906,
0.029539240524172783,
-0.006989563815295696,
0.01783970557153225,
0.037000179290771484,
-0.022728068754076958,
-0... | 0.815249 | 0.767953 | 0.047296 |
You are tasked with implementing a program that calculates the Fibonacci convolution sequence. The Fibonacci convolution sequence is defined as follows:
a(n) = 2*Fibonacci(2*n+2), where Fibonacci(k) represents the k-th term in the Fibonacci sequence.
Your program should take an input n and return the corresponding valu... | glaive | [
0.021490782499313354,
0.030990058556199074,
-0.023830505087971687,
-0.02184729091823101,
0.04805755615234375,
-0.021223634481430054,
-0.029277872294187546,
0.06695877015590668,
0.034343961626291275,
-0.003570085857063532,
0.03229988366365433,
0.03864990174770355,
-0.045175448060035706,
-0.... | 0.818315 | 0.765596 | 0.052719 |
You are tasked with implementing the Underhill-Zucchini Type 3 repeated measures model using Stan programming language. The model requires defining various data inputs such as the number of recaptured individuals, moult dates, moult indices, individual identifiers, and predictors for start date, duration, and sigma sta... | glaive | [
0.01197206974029541,
0.010350268334150314,
-0.02510129101574421,
-0.04131320118904114,
0.0358317568898201,
-0.025290539488196373,
-0.02069968357682228,
0.07481425255537033,
0.030183324590325356,
-0.027298565953969955,
0.018683789297938347,
0.057855330407619476,
-0.027036627754569054,
0.016... | 0.803872 | 0.788837 | 0.015035 |
I need to create a program in C that can print all prime numbers between two given numbers. Can anyone provide me with a solution? | glaive | [
0.020409760996699333,
0.020708318799734116,
-0.02749781869351864,
-0.026540320366621017,
0.021173380315303802,
-0.039323534816503525,
-0.003977935761213303,
0.06148400157690048,
0.050424568355083466,
-0.03951609134674072,
0.02533932588994503,
0.03752891346812248,
-0.03448176383972168,
-0.0... | 0.799541 | 0.783155 | 0.016386 |
You are tasked with implementing a CUDA program to calculate the silhouette score for a given set of data points and their respective cluster labels. The silhouette score quantifies how similar an object is to its own cluster (cohesion) compared to other clusters (separation). You need to write a CUDA program that take... | glaive | [
-0.024714015424251556,
0.028682256117463112,
-0.017825942486524582,
-0.024830207228660583,
0.02183416858315468,
-0.02165425755083561,
-0.03534857556223869,
0.08466361463069916,
0.05248324200510979,
-0.015275784768164158,
0.014565966092050076,
0.02339697815477848,
-0.0005130661302246153,
0.... | 0.805442 | 0.778866 | 0.026576 |
You are tasked with creating a CUDA C program that performs a matrix operation using parallel processing. The objective is to implement a kernel function that multiplies two arrays and adds a third array element-wise, and then measures the elapsed time for the operation.
You will need to allocate memory for four array... | glaive | [
0.017858844250440598,
0.05931054800748825,
-0.026828905567526817,
-0.016667474061250687,
0.0330049954354763,
-0.0003969207755289972,
-0.0438188873231411,
0.11097860336303711,
0.0366634875535965,
-0.017015736550092697,
0.015145175158977509,
0.03972572460770607,
-0.014089510776102543,
-0.014... | 0.792731 | 0.763958 | 0.028773 |
You are tasked with implementing a function called layout that takes in a list of pairs, where each pair consists of a string and a real number. The function should return a string that represents the layout of the input list in the following format:
- Each pair should be enclosed in curly braces {}.
- Within each pair... | glaive | [
0.037371519953012466,
0.0419791117310524,
-0.04623943567276001,
-0.051994651556015015,
0.04594063013792038,
-0.03498733788728714,
-0.009147047065198421,
0.0416501946747303,
0.03272093087434769,
-0.013837462291121483,
0.02784271351993084,
0.033862028270959854,
-0.02022816613316536,
-0.01250... | 0.802902 | 0.778663 | 0.024239 |
You are tasked with optimizing a complex mathematical function using the `function` defined in the given code snippet. The function takes two input variables, `x` and `y`, and performs a series of mathematical operations on them. Your goal is to maximize the real part of the function `states*function[a, b]/(2^ammount)`... | glaive | [
0.017139233648777008,
0.03599661961197853,
-0.042659465223550797,
-0.03178318962454796,
0.03783097490668297,
-0.01901872456073761,
-0.025109900161623955,
0.06557832658290863,
0.04336187243461609,
-0.0011154194362461567,
0.005928444676101208,
0.03524845838546753,
-0.02252117544412613,
0.008... | 0.819863 | 0.786613 | 0.03325 |
You are tasked with simulating the growth of a two-dimensional cellular automaton defined by "Rule 659" based on the 5-celled von Neumann neighborhood. The goal is to calculate the first differences of the number of active (ON, black) cells in the n-th stage of growth. The initial stage has a single active cell.
Write... | glaive | [
0.021431919187307358,
0.025804683566093445,
-0.025694994255900383,
-0.026785774156451225,
0.019602132961153984,
-0.016855720430612564,
-0.05690084397792816,
0.08925429731607437,
0.016344884410500526,
-0.011056763119995594,
0.018389062955975533,
0.021579453721642494,
-0.06159214302897453,
-... | 0.838095 | 0.789282 | 0.048813 |
You are tasked with implementing a Maple 2018.2 program that calculates transition probabilities for a given set of parameters. The program should include the following functions:
- trans_prob_unequal(a, b, t, lambda, mu): Calculates the transition probability for unequal lambda and mu values.
- trans_prob_equal(a, b, ... | glaive | [
0.01117486972361803,
0.023246100172400475,
-0.03740089759230614,
-0.03450612351298332,
0.05717121809720993,
-0.021514510735869408,
-0.008572690188884735,
0.07035466283559799,
0.0352267250418663,
0.009381064213812351,
0.01422262191772461,
0.01722828857600689,
-0.015809549018740654,
0.007886... | 0.804262 | 0.780953 | 0.023309 |
You are tasked with creating a module in Racket called "sevarog" that will handle various mathematical operations. The module should include functions for adding, subtracting, multiplying, and dividing numbers. Additionally, it should have a function to calculate the factorial of a given number. Your task is to write t... | glaive | [
0.04859691113233566,
0.029662273824214935,
-0.033183593302965164,
-0.030784960836172104,
0.035750240087509155,
-0.025601960718631744,
-0.01795039139688015,
0.041231419891119,
0.054921749979257584,
-0.017617447301745415,
0.005699615925550461,
0.03461937606334686,
-0.02869368903338909,
-0.01... | 0.803313 | 0.786066 | 0.017246 |
I need to create a multidiagonal matrix with the following specifications:
- The matrix size is 6x6
- The matrix has the following diagonals offsets: { -3, -1, 0, 1, 3 }
- The matrix elements are set as follows:
- The main diagonal has the value 4
- The diagonals adjacent to the main diagonal have the value -1
- ... | glaive | [
0.015964219346642494,
0.03028786927461624,
-0.04550177976489067,
-0.04159104824066162,
0.05234508216381073,
-0.015834098681807518,
-0.0303794052451849,
0.08222415298223495,
0.02547825314104557,
-0.02416340447962284,
0.021816333755850792,
0.02032516524195671,
-0.023853186517953873,
-0.02358... | 0.800517 | 0.783739 | 0.016779 |
You are tasked with implementing a CUDA-accelerated image processing algorithm for downsampling and upsampling using the Gaussian pyramid technique. The goal is to create two CUDA kernels, pyrDownsampleKernel and pyrUpsampleKernel, that will perform the downsampling and upsampling operations on an input image, respecti... | glaive | [
-0.025942765176296234,
0.04293331131339073,
-0.002553382655605674,
-0.011313877068459988,
0.038560159504413605,
-0.0009321574470959604,
-0.015905112028121948,
0.09929390996694565,
0.026000555604696274,
-0.031745828688144684,
0.027803240343928337,
0.01364163588732481,
-0.011866338551044464,
... | 0.783223 | 0.767527 | 0.015696 |
You are tasked with implementing a function to calculate the error estimate for a given linear finite element space on a quasi-uniform simplicial triangulation. The function should take into account the regularity of the function and the number of elements in the triangulation. The goal is to provide an accurate estima... | glaive | [
0.006668928544968367,
0.024893246591091156,
-0.05155138671398163,
-0.051604967564344406,
0.04761963710188866,
-0.00010722893057391047,
-0.02443716488778591,
0.05408632010221481,
0.017089717090129852,
0.005918949842453003,
0.03734252229332924,
0.03936716541647911,
0.00535311084240675,
-0.00... | 0.781582 | 0.763392 | 0.018189 |
You are tasked with implementing a set of functions in SML to manipulate and process dates and numbers related to dates. The functions to be implemented are as follows:
1. `is_older` - Takes two dates as input and returns true if the first date is older than the second date.
2. `number_in_month` - Takes a list of date... | glaive | [
0.03147037699818611,
0.024159912019968033,
-0.03797588124871254,
-0.054595284163951874,
0.047250643372535706,
-0.041244104504585266,
-0.025578390806913376,
0.06989891082048416,
0.03594323247671127,
-0.003057377878576517,
0.022369826212525368,
0.04986932873725891,
-0.018945636227726936,
0.0... | 0.807407 | 0.789572 | 0.017834 |
You are tasked with creating a program that processes a series of "Beat" and "Note" events, and calculates the duration of each note. The "Beat" events are defined with a timestamp and a number, while the "Note" events are defined with a start timestamp, end timestamp, and a number. Your program needs to calculate the ... | glaive | [
0.03202532231807709,
0.019096069037914276,
-0.06113835796713829,
-0.013977672904729843,
0.020675232633948326,
-0.03173941746354103,
-0.050339214503765106,
0.07311596721410751,
0.05604081228375435,
-0.004579724278301001,
0.04732518270611763,
0.011078189127147198,
-0.043875761330127716,
0.01... | 0.806117 | 0.773444 | 0.032673 |
You are tasked with implementing a betweenness centrality (BC) algorithm using the Gunrock Graph Library. Your goal is to calculate the BC values for all nodes in a given graph, which is represented in Compressed Sparse Row (CSR) format.
The algorithm involves the following steps:
1. Initialize the graph and allocate ... | glaive | [
0.014658086933195591,
0.025166058912873268,
-0.026886383071541786,
-0.036013271659612656,
0.015486770309507847,
-0.03352488949894905,
-0.007971346378326416,
0.044539857655763626,
0.05218726024031639,
-0.016812821850180626,
0.021060222759842873,
0.04007855802774429,
-0.02611171267926693,
0.... | 0.801018 | 0.780213 | 0.020805 |
You are tasked with creating a program that will take a string as input and then count the number of paragraphs in the string. A paragraph is defined as a group of sentences that are separated by a blank line. Your program should be able to identify these blank lines and count the number of paragraphs in the input stri... | glaive | [
0.012614553794264793,
0.007870140485465527,
-0.013192570768296719,
-0.015692129731178284,
0.041273873299360275,
-0.027734626084566116,
-0.022378845140337944,
0.07064522057771683,
0.02845996432006359,
-0.0040603578090667725,
-0.0066159628331661224,
0.028231337666511536,
-0.031946759670972824,... | 0.796285 | 0.769055 | 0.02723 |
You are tasked with creating a program to generate a hierarchical structure of nodes in a 3D environment. Each node should have a specific name, parent, unique identifier, and position in 3D space. The program should be able to create nodes and set their attributes, such as name, parent, unique identifier, and position... | glaive | [
0.014882346615195274,
0.020216962322592735,
-0.03718631714582443,
-0.025089291855692863,
0.03162647411227226,
-0.02944367006421089,
-0.009534681215882301,
0.06903868168592453,
0.038021981716156006,
-0.015701482072472572,
0.03790511563420296,
0.02980617992579937,
-0.03840490058064461,
0.002... | 0.79706 | 0.7774 | 0.019659 |
How can I modify the following function to make it more efficient by using memoization?
const fibonacci = n => {
if (n <= 2) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}; | glaive | [
0.03670693561434746,
0.03653966635465622,
-0.02252413146197796,
-0.025372320786118507,
0.03443070501089096,
-0.03649532049894333,
-0.02364617958664894,
0.09071318805217743,
0.03291846066713333,
0.001310077728703618,
0.006455630995333195,
0.021404171362519264,
-0.04267703369259834,
-0.00550... | 0.807563 | 0.792347 | 0.015215 |
You are tasked with writing a Haskell function to compute the length of a list of integers. The function should take a list of integers as input and return the length of the list as an integer. You must define the function using pattern matching to handle the cases for an empty list and a non-empty list. | glaive | [
0.023544635623693466,
0.008868582546710968,
-0.030891302973031998,
-0.041065312922000885,
0.0516677089035511,
-0.028187859803438187,
-0.02052844874560833,
0.010563970543444157,
0.042971171438694,
-0.024914460256695747,
0.00968432892113924,
0.048380766063928604,
-0.009161530993878841,
-0.03... | 0.812952 | 0.784327 | 0.028625 |
You are tasked with implementing a class in C++ to represent image data. The class should have the following private members:
- m_width: an unsigned integer representing the image width
- m_height: an unsigned integer representing the image height
- m_numberOfChannels: an unsigned integer representing the number of col... | glaive | [
-0.013669398613274097,
0.015265571884810925,
-0.01957627572119236,
-0.03168278560042381,
0.04204566031694412,
-0.01444201823323965,
-0.02745644934475422,
0.11822254955768585,
0.04463673755526543,
-0.016457410529255867,
0.020583651959896088,
0.03398682177066803,
-0.0252951979637146,
-0.0044... | 0.775335 | 0.760729 | 0.014606 |
You are tasked with implementing a function that performs an exclusive reverse scan on a given array of integers. The exclusive scan operation on an array computes the running sum of the elements, where the current output element is the sum of all the input elements up to but not including the current input element.
W... | glaive | [
0.027782585471868515,
0.0577373243868351,
-0.009534727782011032,
-0.034014083445072174,
0.03129279613494873,
-0.00898030400276184,
-0.009539895690977573,
0.07469354569911957,
0.04409128427505493,
0.004221717361360788,
0.015099717304110527,
0.01511815283447504,
-0.029068084433674812,
-0.011... | 0.818331 | 0.77833 | 0.040001 |
You are tasked with creating a class called "Roster" in Java, which will be used to manage a list of students. The class should have the following functionalities:
1. A constructor that takes an integer argument to set the maximum capacity of the roster.
2. A method called "enrollStudent" that takes a string argument r... | glaive | [
0.03630984574556351,
0.01591189205646515,
-0.02705225721001625,
-0.0230488870292902,
0.03281679376959801,
-0.04970811679959297,
-0.01619299128651619,
0.02878410369157791,
0.04735088720917702,
-0.006637935992330313,
0.04078517109155655,
0.04990394786000252,
-0.03237151354551315,
-0.00590863... | 0.785182 | 0.769339 | 0.015843 |
You are tasked with implementing a program that calculates the greatest common divisor (gcd) of two given numbers using the continuation passing style (cps) in a functional programming language. The gcd function should take two natural numbers as input and return their gcd using the following signature:
fun gcd : [i,j ... | glaive | [
0.011170427314937115,
0.029048681259155273,
-0.03934243693947792,
-0.03727729618549347,
0.04612874984741211,
-0.0176205076277256,
-0.014508438296616077,
0.04630567505955696,
0.032517362385988235,
-0.02973121963441372,
0.023864109069108963,
0.032729506492614746,
-0.014838643372058868,
-0.00... | 0.826622 | 0.792941 | 0.03368 |
You are tasked with writing a MIPS assembly program to determine if a given input string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces and punctuation).
Your program should take a string of up to 1024 characters... | glaive | [
0.025016602128744125,
-0.0014189104549586773,
-0.003616335801780224,
-0.02602064050734043,
0.0384087972342968,
-0.030481847003102303,
0.001634565182030201,
0.08069069683551788,
0.026385381817817688,
-0.0221958477050066,
0.024877969175577164,
0.018670015037059784,
-0.03295743465423584,
-0.0... | 0.813802 | 0.776748 | 0.037054 |
You are tasked with proving the irrationality of the square root of 2 using the proof by contradiction method. You need to define the predicates "irrational" and "is rational" and then use the assumption of ¬P to derive something absurd. Your goal is to prove that the square root of two is indeed irrational. | glaive | [
0.025570660829544067,
0.03861327841877937,
-0.021996429190039635,
-0.04171864688396454,
0.0084214573726058,
-0.03532034903764725,
-0.0077759334817528725,
0.0513133779168129,
0.027984406799077988,
-0.009990653023123741,
0.008017544634640217,
0.0166317205876112,
-0.01756056398153305,
-0.0160... | 0.787158 | 0.766765 | 0.020392 |
You are tasked with implementing a multi-threshold image filtering program. The program should take an input image and based on the grayscale value of each pixel, it should determine the interval in which the pixel falls, and set the corresponding position of the output image to that grayscale value. Any other interval... | glaive | [
-0.016879133880138397,
0.03866816684603691,
-0.006400199141353369,
-0.009592775255441666,
0.041249655187129974,
-0.006777383852750063,
-0.040547072887420654,
0.0935913547873497,
0.05533410981297493,
-0.02107391320168972,
0.01825619675219059,
0.02846519462764263,
-0.0057699247263371944,
0.0... | 0.803637 | 0.781044 | 0.022593 |
You are tasked with creating a program to calculate the probability distribution of a quantum system with a given number of qubits and states. The system is described by the amplitude functions amplitude[x, y] and amplitude2[x, y]. The probability of finding the system in a certain state is given by the function probab... | glaive | [
0.0023160979617387056,
0.030248982831835747,
-0.029481353238224983,
-0.014540963806211948,
0.04364539310336113,
-0.0288376584649086,
-0.02320781722664833,
0.06813761591911316,
0.03244064748287201,
0.006061997730284929,
0.01774686388671398,
0.03460853919386864,
-0.018744878470897675,
-0.018... | 0.805189 | 0.769828 | 0.03536 |
I need to implement a function in C++ using the Thrust library to calculate the prefix sum of a given array of integers. The function should take a column of integers as input and return a new column with the prefix sum of the input values. The function should also handle cases where the input column contains NULL valu... | glaive | [
0.0022087430115789175,
0.029585450887680054,
-0.018089452758431435,
-0.03435046598315239,
0.043026648461818695,
-0.020472632721066475,
-0.00990779884159565,
0.11208755522966385,
0.05252546817064285,
-0.008603960275650024,
0.029857510700821877,
0.026838010177016258,
-0.00506611680611968,
-0... | 0.805426 | 0.788976 | 0.01645 |
You are tasked with implementing the heap sort algorithm in Rust. The heap sort algorithm has a run time complexity of O(n*logn) and a space complexity of O(1). Your task is to define a function `heap` that takes a mutable slice of type T and sorts it using the heap sort algorithm. The function should use a struct `Hea... | glaive | [
0.02226964384317398,
0.02638005092740059,
-0.006770177744328976,
-0.040543023496866226,
0.027636172249913216,
-0.02521972358226776,
-0.01597204990684986,
0.08094581961631775,
0.03668009117245674,
-0.011332324706017971,
0.015924721956253052,
0.028695203363895416,
-0.01758522167801857,
0.000... | 0.816164 | 0.793192 | 0.022972 |
You are tasked with implementing the Bellman-Ford single-source shortest path algorithm using CUDA (Compute Unified Device Architecture) for parallel computing. The algorithm needs to be implemented in C++ and utilize the CUDA library for GPU acceleration.
The input to your program will be a graph represented by its a... | glaive | [
-0.0018194711301475763,
0.03885240852832794,
-0.02520398423075676,
-0.013034939765930176,
0.02581549808382988,
-0.0010031441925093532,
-0.037051957100629807,
0.1045612171292305,
0.05359064042568207,
-0.025175616145133972,
0.023822400718927383,
0.03827821463346481,
0.023865656927227974,
-0.... | 0.81522 | 0.783587 | 0.031633 |
You are tasked with creating a vertex shader in GLSL (OpenGL Shading Language) that takes in input attributes for position, normal, tangent, and UV coordinates, and transforms the vertices using a set of uniform transformations. The goal is to calculate the clip-space position of each vertex based on the given input at... | glaive | [
0.012131084688007832,
0.035196125507354736,
-0.014111833646893501,
-0.0599883571267128,
0.03149864077568054,
-0.03713227063417435,
-0.03749936446547508,
0.07009708136320114,
0.03708261996507645,
-0.02826736308634281,
0.03613434359431267,
0.025815164670348167,
-0.006465142592787743,
0.00551... | 0.787949 | 0.769201 | 0.018747 |
Can you provide a way to generate all the possible permutations of a given list? | glaive | [
0.02036396786570549,
0.025317974388599396,
-0.0060037970542907715,
-0.04323964565992355,
0.033069148659706116,
-0.05563412606716156,
-0.019595257937908173,
0.029199495911598206,
0.05582081153988838,
-0.03966595605015755,
0.023011134937405586,
0.04672805964946747,
-0.03544333204627037,
-0.0... | 0.792515 | 0.775933 | 0.016582 |
You are tasked with creating a program to solve the "word numbers, Part 2" problem. If the integers from 1 to 999,999,999 are written as words, sorted alphabetically, and concatenated, you need to determine what the 51 billionth letter is.
To do this, you need to implement a solution that efficiently counts the total ... | glaive | [
0.01514685619622469,
0.016518624499440193,
-0.01594150997698307,
-0.03719968721270561,
0.014042130671441555,
-0.024105578660964966,
-0.036736175417900085,
0.04583891108632088,
0.04173865169286728,
-0.032916005700826645,
0.02492062747478485,
0.004523574840277433,
-0.03609123080968857,
-0.00... | 0.822703 | 0.781733 | 0.04097 |
You are tasked with creating a program to calculate the benefits under the National Family Benefit Scheme (NFBS) as a part of the National Social Assistance Programme (NSAP). The program should take into account the number of eligible family members, the amount of assistance per family, and any additional criteria spec... | glaive | [
0.016492340713739395,
0.03327234089374542,
-0.03249938786029816,
-0.02619427628815174,
0.04469680041074753,
-0.03215283527970314,
-0.008893509395420551,
0.04904382303357124,
0.03669525682926178,
0.011545302346348763,
0.024056794121861458,
0.035136979073286057,
-0.058613717555999756,
-0.018... | 0.795504 | 0.771533 | 0.023971 |
You are tasked with implementing an outer measure based on a given content on compact sets. The content `μ` is a function from compact sets to extended nonnegative reals that satisfies certain properties. The outer measure is defined as the induced outer measure using the given content.
Your task is to create a functi... | glaive | [
0.018227247521281242,
0.027992215007543564,
-0.03486677259206772,
-0.030698133632540703,
0.037632010877132416,
-0.0014883535914123058,
-0.031728100031614304,
0.05832396075129509,
0.04312349483370781,
-0.007663383148610592,
0.007590798195451498,
0.0290796160697937,
-0.030578335747122765,
-0... | 0.805334 | 0.788342 | 0.016991 |
You are tasked with implementing a program that utilizes hardware intrinsics to perform a logical left shift operation on an array of unsigned 32-bit integers. The program should be able to handle different scenarios, including validating basic functionality, calling via reflection, passing static members, local variab... | glaive | [
0.02007877081632614,
0.032073501497507095,
-0.015603402629494667,
-0.020826855674386024,
0.029367618262767792,
-0.012955265119671822,
-0.02698053978383541,
0.07404649257659912,
0.04302581027150154,
-0.03863583505153656,
0.03214573487639427,
0.04033004492521286,
-0.021333973854780197,
-0.01... | 0.808479 | 0.790717 | 0.017762 |
You are tasked with writing a program to calculate the number of (n+1) X 3 arrays with the number of equal 2 X 2 subblock diagonal pairs and equal antidiagonal pairs differing from each horizontal or vertical neighbor, and new values 0..1 introduced in row major order. Your program should take the input n and output th... | glaive | [
0.014042825438082218,
0.014541607350111008,
-0.053801529109478,
-0.020744211971759796,
0.026267066597938538,
-0.012581600807607174,
-0.042578697204589844,
0.06127886474132538,
0.03887733444571495,
-0.012436985038220882,
0.028159869834780693,
0.02667100727558136,
-0.05841980502009392,
-0.03... | 0.845269 | 0.793377 | 0.051892 |
You are given a set of integers in the form of a code snippet. Your task is to write a program that calculates the sum of all the integers in each row and then finds the average of these sums.
Write a program that takes the given set of integers and calculates the sum of each row. Then, find the average of these sums ... | glaive | [
0.009173956699669361,
0.026153868064284325,
-0.04022316634654999,
-0.04295189306139946,
0.05326233059167862,
-0.04618792235851288,
-0.030907614156603813,
0.0391770601272583,
0.03731901943683624,
-0.028674891218543053,
0.02351706475019455,
0.013853967189788818,
-0.055469390004873276,
-0.007... | 0.809483 | 0.766301 | 0.043182 |
I need to implement a parallel fast Fourier transform (FMT) algorithm using CUDA for a given code snippet. The algorithm should include functions for forward and inverse FMT, multiplication of two arrays, division by N, preprocessing for negative FMT, postprocessing for negative FMT, converting positive and negative FM... | glaive | [
0.02133077383041382,
0.04888623580336571,
-0.021852049976587296,
-0.02486853115260601,
0.0329345166683197,
-0.013485812582075596,
-0.03405557572841644,
0.07562215626239777,
0.03371615335345268,
-0.01628478243947029,
0.015416446141898632,
0.02923184633255005,
-0.008109464310109615,
-0.01105... | 0.790099 | 0.773705 | 0.016393 |
You are tasked with implementing a function that converts a 32-bit floating point number to a 16-bit floating point number (FP16). The function should take a float as input and return the corresponding half-precision (FP16) representation.
Write a C++ function that adheres to the following signature:
```cpp
half1 cpu_... | glaive | [
0.015627000480890274,
0.02699417807161808,
-0.015161444433033466,
-0.04366666451096535,
0.05353056639432907,
-0.023060042411088943,
-0.02094019390642643,
0.1056269034743309,
0.0344521664083004,
-0.013486050069332123,
0.04187443479895592,
0.055209677666425705,
-0.012660977430641651,
-0.0079... | 0.784717 | 0.765079 | 0.019638 |
You have been tasked with implementing a function to calculate the number of factors of a given size for a given set of elements. The factors can include or exclude word boundaries.
You are given the following guidelines:
- The function `kblocksize` should take in three parameters: s (a floating point number), k (an i... | glaive | [
0.024631837382912636,
0.0549369677901268,
-0.032793618738651276,
-0.026479395106434822,
0.050411250442266464,
-0.016380703076720238,
-0.02899962104856968,
0.05222492292523384,
0.04903542622923851,
-0.00019116539624519646,
0.011787953786551952,
0.03947560861706734,
-0.0273797195404768,
0.00... | 0.817592 | 0.774487 | 0.043105 |
How can I create an algorithm in R that calculates the sum of a series with n terms? | glaive | [
-0.009549753740429878,
0.025139160454273224,
-0.027053019031882286,
-0.04700117185711861,
0.03891711309552193,
-0.01528750080615282,
-0.032781604677438736,
0.04698345437645912,
0.013904979452490807,
-0.021137448027729988,
-0.0036392698530107737,
0.044545698910951614,
-0.041705068200826645,
... | 0.792331 | 0.777606 | 0.014726 |
You are tasked with implementing a CUDA-based computation problem. Your task is to write CUDA kernels to compute weights, sum weights, normalize weights, compute transformation matrices, compute control points, and transform vertices. You will be working with arrays of double values and need to perform various mathemat... | glaive | [
0.003907176665961742,
0.04987871274352074,
-0.011935455724596977,
-0.018814951181411743,
0.02960779517889023,
-0.005986884236335754,
-0.015292107127606869,
0.07950584590435028,
0.04802846163511276,
-0.019795609638094902,
0.028577497228980064,
0.030816398561000824,
0.0026057022623717785,
-0... | 0.798725 | 0.783507 | 0.015218 |
I need help writing a C++ code that can perform a circular shift operation on a specific set of integers within an array. The number of positions to shift is explicitly predetermined. Can someone provide a solution for this?
```C++
#include<iostream>
using namespace std;
void rotate(int a[], int n, int k) {
int te... | glaive | [
0.009780039079487324,
0.041788239032030106,
-0.01726479083299637,
-0.0183272548019886,
0.03293884918093681,
-0.01152475643903017,
-0.03538910299539566,
0.10035911947488785,
0.03400462120771408,
-0.023340987041592598,
0.029003826901316643,
0.011998453177511692,
-0.03158564120531082,
-0.0113... | 0.807139 | 0.772188 | 0.034951 |
You are tasked with implementing the Logarithmic Radix Binning (LRB) load balancing method for traversing vertices in a graph using CUDA. LRB is a technique for improving scheduling for irregular applications, and it involves binning vertices into logarithmically sized bins to balance the workload.
Your task is to imp... | glaive | [
0.00961546041071415,
0.0411558635532856,
-0.019755035638809204,
-0.011530974879860878,
0.020741470158100128,
0.00696701742708683,
-0.03074038214981556,
0.08411455154418945,
0.039478834718465805,
-0.035241782665252686,
0.03264123946428299,
0.0372496135532856,
0.004691337235271931,
0.0118672... | 0.806851 | 0.783517 | 0.023335 |
You are given a list of pairs representing orbits in a celestial system. Each pair consists of a planet and its direct orbiting object. For example, ("COM", "B") means planet "B" orbits around planet "COM".
You need to write a function to calculate the total number of direct and indirect orbits in the system. In addit... | glaive | [
0.01442211028188467,
0.03833446279168129,
-0.04277602955698967,
-0.02301151119172573,
0.03363218158483505,
-0.01814165525138378,
-0.03728778287768364,
0.025198180228471756,
0.02217365801334381,
-0.0021744698751717806,
0.0020549597684293985,
0.019619183614850044,
-0.010436530224978924,
-0.0... | 0.806196 | 0.76119 | 0.045006 |
You are tasked with implementing a selection sort algorithm in Julia. The selection sort algorithm sorts an array by repeatedly finding the minimum element from the unsorted part and putting it at the beginning. Your task is to write a function `selectionsort!` that takes an array as input and sorts it in place using t... | glaive | [
-0.006695338990539312,
0.017770839855074883,
-0.032013922929763794,
-0.034838832914829254,
0.039561640471220016,
-0.029953429475426674,
-0.018530869856476784,
0.06116817891597748,
0.03567279875278473,
-0.007192044518887997,
0.022021787241101265,
0.020607270300388336,
-0.023374425247311592,
... | 0.81266 | 0.796422 | 0.016237 |
I want to use the numpy library to perform a multi-step numerical analysis. Specifically, I need to determine and compute the range between the highest and lowest values in a given numerical sequence. Can someone help me with this?
Code:
```python
# importing the numpy library
import numpy as np
# create the numerica... | glaive | [
0.010189402848482132,
0.028844520449638367,
-0.03826857730746269,
-0.014511412009596825,
0.03648918494582176,
-0.025120628997683525,
-0.03109648823738098,
0.05945178493857384,
0.016801418736577034,
-0.010144324973225594,
0.03396188095211983,
0.03437814861536026,
-0.03823744133114815,
-0.00... | 0.799758 | 0.779661 | 0.020097 |
You are tasked with implementing a CUDA kernel to perform multilooking on high-resolution data to produce low-resolution output. Multilooking involves accumulating and averaging neighboring data points to reduce the resolution of the input data.
Your task is to write a CUDA kernel that takes as input a high-resolution... | glaive | [
-0.0127323092892766,
0.054949305951595306,
-0.011442011222243309,
-0.024622566998004913,
0.028635796159505844,
0.006487491074949503,
-0.028990959748625755,
0.08291719853878021,
0.04671628773212433,
-0.0085503114387393,
0.023504242300987244,
0.03272932022809982,
-0.006280675530433655,
0.014... | 0.795628 | 0.778945 | 0.016684 |
You are tasked with creating a program to calculate the probability distribution of a quantum system with a given number of qubits and states. The program should utilize a set of quantum amplitude functions and maximize the probability distribution over a specified range of parameters. Additionally, the program should ... | glaive | [
0.006797967478632927,
0.027628755196928978,
-0.028417296707630157,
-0.01281797606498003,
0.03286813944578171,
-0.03459865599870682,
-0.02838481403887272,
0.05544919893145561,
0.027090907096862793,
-0.005122446455061436,
0.018864735960960388,
0.038316864520311356,
-0.018539024516940117,
-0.... | 0.792584 | 0.761467 | 0.031116 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.