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 implementing a CUDA kernel function that performs a proximal operation on an array of elements. The proximal operation is defined by the formula: Zi_proximal[i] = Zi[i] - 1.0/L * df[i], where Zi_proximal, Zi, df are arrays of type T, and L is a scalar value of type T. The kernel function should be a...
glaive
[ 0.006513652857393026, 0.06537550687789917, -0.013356917537748814, -0.0162045881152153, 0.02890145219862461, -0.00907955877482891, -0.014955435879528522, 0.08060818910598755, 0.030044523999094963, -0.010304484516382217, 0.026204338297247887, 0.03446022421121597, -0.0053102318197488785, 0.01...
0.808855
0.777093
0.031762
You are tasked with implementing a program to calculate the diffusion rate of particles in a given medium. The diffusion rate is represented by the equations: dY/dt = D * (d^2Y/dt^2) ≈ 700 um^2/s dX/dt = D * (d^2X/dt^2) ≈ 1200 um^2/s Where: - Y and X represent the concentration of particles in the medium - t represen...
glaive
[ -0.012949920259416103, 0.03255551680922508, -0.03907109797000885, -0.011664745397865772, 0.034330856055021286, -0.032529473304748535, -0.05129193514585495, 0.08417537063360214, 0.0414927713572979, -0.009900671429932117, 0.0353129506111145, 0.04007147252559662, -0.017594613134860992, 0.0139...
0.807992
0.786209
0.021783
You are tasked with implementing a floating point division function in assembly language. The function should divide the value in register X1 by the value in register X2, both of which are in floating point format. The division should handle both normal division and the case where the divisor is zero. Additionally, the...
glaive
[ 0.014006962068378925, 0.00828446913510561, -0.020329270511865616, -0.05280635133385658, 0.0374324768781662, -0.03706785663962364, -0.008223053999245167, 0.07345228642225266, 0.04747913405299187, -0.004855553153902292, 0.047037143260240555, 0.034283947199583054, -0.019452854990959167, 0.009...
0.790994
0.772652
0.018342
You are tasked with implementing a function to trim a graph based on the given nodes and connections. The graph is represented by a list of connections and a list of nodes, where each connection includes information about whether it is active or not, the source node, the target node, and an innovation value. Each node ...
glaive
[ 0.029624903574585915, 0.02664674073457718, -0.02883533202111721, -0.03730470687150955, 0.05011627450585365, -0.030805928632616997, -0.012096589431166649, 0.06605806946754456, 0.035616833716630936, -0.002595138968899846, 0.008587108924984932, 0.025744935497641563, -0.006349610164761543, -0....
0.793213
0.773806
0.019406
You are tasked with creating a program to calculate the probability distribution of a quantum state represented by a given set of amplitudes. The amplitudes are defined by the functions `amplitude[x_,y_]` and `amplitude2[x_,y_]`. The probability distribution is given by the function `probability[x, y]`, which calculate...
glaive
[ -0.009000679478049278, 0.03456679359078407, -0.026028381660580635, -0.022998183965682983, 0.03892585262656212, -0.019846443086862564, -0.01681947335600853, 0.06588178128004074, 0.03497639298439026, -0.0031397577840834856, 0.021191472187638283, 0.03411148115992546, -0.014038319699466228, -0...
0.808149
0.779902
0.028247
You are tasked with implementing a CUDA-accelerated matrix multiplication function. The function should take in three parameters: two input matrices `a` and `b`, and an output matrix `c`. The dimensions of the input matrices are represented by integers `m`, `k`, and `n`. The function should utilize the provided CUDA co...
glaive
[ 0.02174651063978672, 0.0627601146697998, -0.016568433493375778, -0.028280967846512794, 0.05079368129372597, -0.009120484814047813, -0.02565671317279339, 0.09848368912935257, 0.03881830349564552, -0.017111502587795258, 0.015913577750325203, 0.03006327711045742, 0.0003836445102933794, -0.011...
0.78996
0.767929
0.022032
You are tasked with creating a Fortran subroutine that checks a decomposition of the form A = U S U', where A is a symmetric banded matrix, U is orthogonal, and S is diagonal (if KS=0) or symmetric tridiagonal (if KS=1). Specifically, you need to compute two tests: 1. Compute the error matrix: Error = A - U S U' 2. Co...
glaive
[ 0.009091845713555813, 0.019091038033366203, -0.03289233520627022, -0.03961445763707161, 0.04007672891020775, -0.014453069306910038, 0.0006170595297589898, 0.06968773156404495, 0.03039339743554592, 0.003260241821408272, 0.01900675520300865, 0.03833590820431709, -0.00808350183069706, -0.0046...
0.815432
0.789212
0.02622
Write a function in Python that checks if two numbers are congruent modulo n. The function should take three parameters: n, a, and b. It should return True if a and b are congruent modulo n, and False otherwise. For example, if n = 4, a = 6, and b = 10, the function should return True because 6 and 10 are congruent mo...
glaive
[ 0.041103657335042953, 0.030963653698563576, -0.036754872649908066, -0.032746098935604095, 0.0390123575925827, -0.020404178649187088, -0.00373280793428421, 0.05277884379029274, 0.016296260058879852, -0.008794346824288368, -0.0005904555437155068, 0.017191363498568535, -0.016388529911637306, ...
0.809685
0.788823
0.020862
You are tasked with creating a program to calculate prime numbers. You need to create a user interface with a label to display the number of prime numbers calculated so far, a button to start the calculation, a list box to display the calculated prime numbers, and a button to pause the calculation. Additionally, you ne...
glaive
[ 0.03321577236056328, 0.028965892270207405, -0.02451450563967228, -0.02768435701727867, 0.04266561567783356, -0.03214616701006889, -0.008184640668332577, 0.06704160571098328, 0.043576862663030624, -0.008057854138314724, 0.03495151549577713, 0.027282828465104103, -0.03694280609488487, -0.017...
0.806928
0.779515
0.027413
You are tasked with creating image pyramids on the GPU using CUDA and OpenCV. An image pyramid is a multi-scale representation of an image. The task is to implement a function that takes an input image and generates a series of downsampled images, each half the size of the previous one. Your function should be able to...
glaive
[ -0.017759939655661583, 0.028438247740268707, -0.010346912778913975, -0.010607515461742878, 0.0387028306722641, -0.022737089544534683, -0.02326616458594799, 0.0993436798453331, 0.032043758779764175, -0.028874432668089867, 0.0247453935444355, 0.014929709956049919, -0.00013930514978710562, 0....
0.785836
0.771285
0.014551
You are required to write a program that generates a random number and then calculates the sine and cosine of that number. After calculating both the sine and cosine, the program should test if the two values are numerically close to each other. Finally, the program should print out the values of the sine and cosine.
glaive
[ 0.0020408376585692167, 0.024360405281186104, -0.03321931138634682, -0.02671419456601143, 0.038197122514247894, -0.022274671122431755, -0.015559100545942783, 0.05544481426477432, 0.03584253415465355, -0.009180485270917416, 0.036100950092077255, 0.04165581986308098, -0.022087132558226585, -0...
0.810793
0.788692
0.022101
Can you provide a C++ function that takes in an array of integers and sorts them in descending order?
glaive
[ 0.021018613129854202, 0.029527543112635612, -0.028337707743048668, -0.03345019370317459, 0.04384586215019226, -0.025475788861513138, -0.017306027933955193, 0.06544656306505203, 0.03240322694182396, -0.017009152099490166, 0.021572748199105263, 0.025948859751224518, -0.046576667577028275, -0...
0.800536
0.782428
0.018108
You are tasked with creating a program that takes in a list of integers and returns the sum of all the even numbers in the list. The program should also be able to handle an empty list and should return 0 in that case. Create a function called `calculate_even_sum` that takes in a list of integers and returns the sum o...
glaive
[ 0.026448620483279228, 0.02217516489326954, -0.03413458913564682, -0.05537654086947441, 0.04414844512939453, -0.019167304039001465, -0.01633700542151928, 0.03862719610333443, 0.03259015828371048, -0.024872297421097755, 0.01670883223414421, 0.0494396835565567, -0.048725396394729614, -0.02353...
0.812619
0.767211
0.045409
I am trying to implement a program that performs various arithmetic and bitwise operations on three given integer values: x, y, and z. I need to create a function that takes in these three values and performs the following operations: - Addition of x and y divided by z - Division of x by y and then adding z - Multiplic...
glaive
[ 0.04099445790052414, 0.032551854848861694, -0.033597152680158615, -0.03307078778743744, 0.038417838513851166, -0.012983045540750027, -0.02678094059228897, 0.05299736186861992, 0.03291068971157074, -0.006769412197172642, 0.025126777589321136, 0.030490579083561897, -0.036717113107442856, -0....
0.820587
0.795549
0.025038
You are given an array of binary strings representing data collected from different sensors. Each binary string has the same length. Your task is to implement two functions to process this data: 1. The first function should take the input array and determine the majority and minority patterns in the data. For each pos...
glaive
[ 0.003762825159355998, 0.016685526818037033, -0.0371500588953495, -0.021175222471356392, 0.051412537693977356, -0.05304170772433281, -0.028134668245911598, 0.06826534867286682, 0.037687432020902634, 0.010769831947982311, 0.014214820228517056, 0.0210358165204525, -0.027749676257371902, -0.00...
0.84077
0.8015
0.03927
You are tasked with creating a function that determines whether a given character code is a valid identifier character in a programming language. An identifier character is a character that can be used in variable names, function names, etc. The function should return true if the character code is a valid identifier ch...
glaive
[ 0.017281971871852875, 0.02527826838195324, 0.004886839538812637, -0.019536331295967102, 0.04307428002357483, -0.020522139966487885, 0.014734642580151558, 0.06478244066238403, 0.031392015516757965, -0.017781520262360573, 0.01829097978770733, 0.02295231819152832, -0.016957568004727364, -0.02...
0.801439
0.784823
0.016616
You are tasked with creating a function that takes a list of lists and a function as input, and returns a string representation of the lists. The input function will be used to convert the elements of the inner lists to strings. For example, given the input `[[1; 2; 3]; [4; 5]; [6]; []]` and the function `string_of_int...
glaive
[ 0.020853469148278236, 0.0326252356171608, -0.01636998914182186, -0.06405753642320633, 0.04780983552336693, -0.05860345438122749, -0.008315576240420341, 0.03334413841366768, 0.024914391338825226, -0.020556028932332993, 0.02369283139705658, 0.05068548768758774, -0.02783123217523098, -0.02199...
0.797053
0.770801
0.026252
You are given a CSV file "triangles.csv" containing data for triangles. Each row represents a triangle, with the three values representing the lengths of its sides. Your task is to write a program that reads the data from the file and determines the number of triangles that can be formed from the given sides. A valid ...
glaive
[ -0.0029141674749553204, 0.019503965973854065, -0.03135479614138603, -0.02360951155424118, 0.03482130914926529, -0.02114451304078102, -0.020816078409552574, 0.05808206647634506, 0.03763500601053238, -0.009157157503068447, 0.015733961015939713, 0.03643381595611572, -0.021959245204925537, -0....
0.827595
0.789684
0.03791
You are required to implement a distributed vector sum using CUDA, nvshmem, and nvshmemx in C. The program should perform the vector sum operation in a distributed manner using multiple threads and processors. The main function initializes the nvshmem and CUDA environment, allocates memory for the arrays and synchroniz...
glaive
[ 0.02093305066227913, 0.03986293449997902, -0.02005123347043991, -0.026977170258760452, 0.03177526220679283, 0.0018041598377749324, -0.03550024330615997, 0.09901458024978638, 0.04500492662191391, -0.017099127173423767, 0.029787080362439156, 0.0353807732462883, -0.021068042144179344, -0.0111...
0.809028
0.778643
0.030385
You are tasked with implementing a program to process a dataset containing X, Y, TStamp, Pres., and EndPts values. The dataset has a DataSize of 257 and includes multiple rows of data. Each row consists of five space-separated values representing X, Y, TStamp, Pres., and EndPts respectively. Your goal is to write a pro...
glaive
[ 0.013707375153899193, 0.007319465279579163, -0.060844097286462784, -0.05055819824337959, 0.045919205993413925, -0.05494493246078491, -0.02974558435380459, 0.08116663247346878, 0.04772358387708664, -0.012352178804576397, 0.033725347369909286, 0.021735981106758118, -0.031481873244047165, 0.0...
0.80124
0.786778
0.014462
You are tasked with creating a CUDA program to perform various memory copy and arithmetic operations on 2D arrays. The program should be able to handle single precision and double precision data types based on the defined macros. The operations to be performed include simple memory copy, triad operations with both inte...
glaive
[ 0.01585282012820244, 0.05440821871161461, -0.026496069505810738, -0.02416665107011795, 0.028222734108567238, -0.015393887646496296, -0.033169858157634735, 0.09688504040241241, 0.04129898548126221, -0.02529194764792919, 0.01723640225827694, 0.03156152740120888, 0.0020261669997125864, 0.0032...
0.79029
0.768657
0.021632
You are tasked with creating a CUDA program to perform element-wise multiplication of two arrays. The program should allocate memory for the arrays, populate them with random values, and then use a CUDA kernel to perform the multiplication operation. Finally, the program should wait for the GPU to finish and then free ...
glaive
[ 0.017794448882341385, 0.057671740651130676, -0.01993260532617569, -0.01908876933157444, 0.028816495090723038, -0.007460745982825756, -0.02731873095035553, 0.09038295596837997, 0.034169573336839676, -0.029091866686940193, 0.014602437615394592, 0.03954462334513664, -0.015006167814135551, 0.0...
0.800377
0.781612
0.018765
You are tasked with creating a program to calculate the probability of a quantum state given certain amplitudes. The amplitude of a quantum state is given by the function amplitude[x_,y_]. The probability of the state is given by the function probability[x,y]. You need to find the maximum probability of the quantum sta...
glaive
[ 0.008114821277558804, 0.02869291789829731, -0.04018756002187729, -0.026941416785120964, 0.04546346142888069, -0.01978204771876335, -0.020494671538472176, 0.07473522424697876, 0.0337999127805233, -0.007444276474416256, 0.024943077936768532, 0.03393949940800667, -0.023128487169742584, -0.013...
0.804408
0.773875
0.030534
You have been tasked with implementing a CUDA kernel function to perform element-wise addition of two arrays on the GPU. The goal is to efficiently add the elements of two arrays, x and y, each containing N elements. You need to create a kernel function that takes in the size of the arrays (N), and the arrays x and y, ...
glaive
[ 0.002181114861741662, 0.05373691767454147, -0.016855187714099884, -0.01642884686589241, 0.029688743874430656, 0.00237368606030941, -0.021055417135357857, 0.09518983215093613, 0.043502163141965866, -0.006546812132000923, 0.021435072645545006, 0.03781577944755554, -0.010471838526427746, 0.01...
0.799908
0.775569
0.024339
You are tasked with creating a series of functions in a programming language that can handle 0, 1, and 2 arguments and return a real number. These functions should be able to accept both void and non-void arguments and return types. The functions should cover a variety of scenarios, including functions with no argument...
glaive
[ 0.03027147427201271, 0.04229963570833206, -0.027364611625671387, -0.026650985702872276, 0.0378308966755867, -0.017158402130007744, -0.0255549605935812, 0.07005683332681656, 0.028909582644701004, -0.016713568940758705, 0.020467514172196388, 0.04624499753117561, -0.018427519127726555, -0.018...
0.816207
0.798499
0.017708
You are tasked with creating a program that will generate multiple scenarios based on different combinations of variables. The variables to be used are as follows: - v_gmean: a vector containing the values "linear", "log", "sin", "lsin", and "sqrtsin" - v_xsig: a vector containing the values "const", "linear", and "qua...
glaive
[ -0.011165493167936802, 0.02350449375808239, -0.04121783375740051, -0.04772288352251053, 0.03656507655978203, -0.023466018959879875, -0.053311239928007126, 0.07532351464033127, 0.0387040339410305, -0.0034771806094795465, 0.01046505942940712, 0.034676238894462585, -0.013633918017148972, 0.00...
0.804059
0.780867
0.023192
How can I write a C++ program to find all duplicates in an array?
glaive
[ -0.0036168433725833893, 0.028338981792330742, -0.030303537845611572, -0.026206249371170998, 0.02894214168190956, -0.026364151388406754, -0.015900256112217903, 0.07774665206670761, 0.03292094171047211, -0.04272196814417839, 0.01140604354441166, 0.01782706193625927, -0.014504310674965382, -0...
0.797514
0.781789
0.015725
Can you provide a C++ function that takes two integers as parameters and returns the maximum value of the two?
glaive
[ 0.028913218528032303, 0.020944800227880478, -0.029893336817622185, -0.014817288145422935, 0.025777490809559822, -0.01750485599040985, -0.020784026011824608, 0.06869813054800034, 0.03565502539277077, -0.03682691603899002, 0.031839530915021896, 0.056076839566230774, -0.028775654733181, -0.01...
0.804698
0.789308
0.01539
You are tasked with writing a program in assembly language (BITS 32) that performs arithmetic operations on XMM registers. Given the following requirements, write the necessary code to achieve the desired output: 1. Set up the register ECX to be 8. 2. Move the values 0x00FFF000 into the lower 32 bits of each of the fo...
glaive
[ 0.03569668158888817, 0.026863645762205124, -0.008522028103470802, -0.028102081269025803, 0.021854059770703316, -0.03740893676877022, -0.02854362316429615, 0.07265275716781616, 0.047610148787498474, -0.02033688686788082, 0.022225171327590942, 0.033318597823381424, -0.02108827792108059, -0.0...
0.800129
0.782759
0.017371
You are tasked with implementing a signed long remainder routine in x86 assembly language. The purpose of this routine is to calculate the signed long remainder of two arguments without changing the original values. The arguments are passed on the stack, with the divisor being pushed first followed by the dividend. Aft...
glaive
[ 0.0087724095210433, 0.03103828988969326, -0.01650509238243103, -0.0369829386472702, 0.029762843623757362, -0.027217058464884758, -0.028529534116387367, 0.08460059016942978, 0.03741087391972542, -0.029608294367790222, 0.03767198324203491, 0.05273164436221123, -0.03174274414777756, 0.0126775...
0.802753
0.783326
0.019427
I'm trying to develop a Python code to sort a multi-dimensional array using the insertion sort technique. The array consists of both numeric and non-numeric values, and I need to remove the non-numeric values while sorting. Additionally, I want to make sure that duplicate values are placed next to each other in the sor...
glaive
[ 0.012198133394122124, 0.01846371777355671, -0.03099575825035572, -0.02569202147424221, 0.047496091574430466, -0.03240574896335602, -0.009461039677262306, 0.05046013370156288, 0.03607562556862831, -0.005423076916486025, 0.01917439140379429, 0.0012483709724619985, -0.022955458611249924, -0.0...
0.801336
0.784702
0.016635
You need to implement a CUDA kernel that computes Jaccard weights for a matrix. The CUDA kernel should take the following arguments: - The number of rows in the matrix (num_rows) - The number of columns in the matrix (num_cols) - The number of non-zero elements in the matrix J (nnzJ) - An array containing the row indic...
glaive
[ 0.004495913628488779, 0.03491107001900673, -0.028733056038618088, -0.021062219515442848, 0.036708246916532516, -0.013005652464926243, -0.010741663165390491, 0.08523053675889969, 0.048878878355026245, -0.011577305383980274, 0.028783539310097694, 0.03787145018577576, -0.012805893085896969, -...
0.80784
0.788424
0.019416
You are given a dataset `have` containing the following variables: `PID` (patient ID), `Gender`, `Income`, `Year`, and `Exercise`. Each record represents a patient's information and their exercise habits over the years. Your task is to keep only the groups of records where the first value of `Exercise` is zero, and dis...
glaive
[ 0.006485211197286844, 0.02316635474562645, -0.06590291857719421, -0.03278132155537605, 0.03384453430771828, -0.028708862140774727, -0.00724915973842144, 0.06953024119138718, 0.06669101864099503, -0.0008289580000564456, 0.0194721482694149, 0.013724408112466335, -0.01602143608033657, -0.0280...
0.81013
0.7955
0.014631
You are tasked with creating a function that takes in two tuples and joins them to create a Gelly edge with its long index as its value. The first tuple contains three elements: two long values and a GradoopId. The second tuple contains a long value and a GradoopId. Your function should join these tuples to create an E...
glaive
[ 0.005868147127330303, 0.02356790192425251, -0.014667223207652569, -0.043782372027635574, 0.028388813138008118, -0.03342624381184578, -0.03804139420390129, 0.05635242536664009, 0.015966186299920082, -0.0006967503577470779, 0.025362327694892883, 0.03120998665690422, -0.03126261755824089, 0.0...
0.808839
0.790607
0.018232
You are tasked with implementing a quantile function in C++ using the NVIDIA CUDA framework. The quantile function is used to calculate the value below which a certain proportion of data fall. You need to create a function that takes a column of data and calculates the quantile at a given percentage using different int...
glaive
[ -0.008297507651150227, 0.01322594191879034, -0.007586942985653877, -0.029643865302205086, 0.02540821209549904, -0.01942174881696701, -0.005251656286418438, 0.1058850958943367, 0.049478575587272644, -0.0027361821848899126, 0.03453976660966873, 0.02502470277249813, -0.015848513692617416, 0.0...
0.799466
0.776016
0.02345
You are required to create a Prolog program that manipulates sequences of character codes, usually first read in as a line. Your program should provide the following functionalities: 1. Search for a character in a list of codes. 2. Scan the list of codes for an integer and unify the remainder of the line. 3. Scan the ...
glaive
[ 0.013660253956913948, 0.01906990073621273, -0.008873964659869671, -0.043966908007860184, 0.03722754120826721, -0.016951393336057663, -0.004099018406122923, 0.03842507302761078, 0.02338758297264576, -0.011096399277448654, 0.013436618261039257, 0.04785696044564247, -0.02468392439186573, -0.0...
0.80706
0.791421
0.015639
I am trying to implement a function to join two arrays of floating-point numbers and produce a single array as output. The input arrays consist of two parts: a compressed part and a non-compressed part. The compressed part is ANS compressed data, and the non-compressed part is regular data. The goal is to join these tw...
glaive
[ 0.019540902227163315, 0.02457873709499836, -0.029385460540652275, -0.040467869490385056, 0.046086493879556656, -0.006611399818211794, -0.005450665485113859, 0.06449289619922638, 0.03570058196783066, -0.007202344946563244, 0.031039191409945488, 0.025131812319159508, -0.019466044381260872, -...
0.807055
0.7883
0.018755
You are tasked with implementing a function in a programming language that takes four parameters: rs, x, t, and u. The function should calculate the value of f according to the following formula: f(rs, x, t, u) = (h1x(y(x, alpha(x, t))*(1 - f_alpha(alpha(x, t))) + h0x*f_alpha(alpha(x, t)))*gx(x) Where: - h1x(x) and h0x...
glaive
[ 0.03255278989672661, 0.04141915589570999, -0.04037824273109436, -0.036120519042015076, 0.06170937046408653, -0.03409111872315407, -0.02838098630309105, 0.07647547870874405, 0.0417105108499527, -0.005347395781427622, 0.015245486050844193, 0.04335983470082283, -0.015235623344779015, -0.01970...
0.815719
0.790996
0.024723
You are tasked with creating a program that simulates the population of animals in a zoo. Your program should take in the number of animals in the zoo (N) and their respective population numbers. You need to model the population using a normal distribution to predict the population of animals in the future.
glaive
[ -0.004707949236035347, 0.007066457998007536, -0.054910868406295776, -0.023262890055775642, 0.044515460729599, -0.031958386301994324, -0.03401675075292587, 0.035924483090639114, 0.031502217054367065, -0.02108386531472206, 0.018920116126537323, 0.0410601943731308, -0.03009689785540104, 0.011...
0.785585
0.769418
0.016167
You are tasked with creating a function in a programming language that takes an input of 32-bit binary number and performs a specific operation on it. The function should return the result of subtracting 3 from the input number. Write a function that takes a 32-bit binary number as input and returns the result of subt...
glaive
[ 0.019555293023586273, 0.03367337957024574, -0.04549442604184151, -0.024703221395611763, 0.057251978665590286, -0.030889814719557762, -0.03516571596264839, 0.06810400635004044, 0.06263426691293716, -0.006401026621460915, 0.025835419073700905, 0.04123391956090927, -0.04848731309175491, -0.00...
0.802341
0.78512
0.017221
You are tasked with creating a module in a programming language that provides functionality for integer operations. The module should include the following: - Addition - Subtraction - Multiplication - Division - Comparison operators (<, <=, >, >=) - Conversion of numbers from and to integers Your module should also in...
glaive
[ 0.045102063566446304, 0.024971971288323402, -0.02840469777584076, -0.01862877793610096, 0.04245886579155922, -0.025779975578188896, -0.012699129991233349, 0.034511372447013855, 0.04254484176635742, -0.023843567818403244, 0.02352905459702015, 0.018209513276815414, -0.037753500044345856, -0....
0.8122
0.787735
0.024465
You are tasked with creating a program that calculates the factorial of a given number using Python. 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 Python function called `calculate_factorial` that t...
glaive
[ 0.009709291160106659, 0.04360160976648331, -0.02685590833425522, -0.024563485756516457, 0.037528812885284424, -0.034706082195043564, -0.020973170176148415, 0.046323616057634354, 0.027609193697571754, -0.0159493125975132, 0.01567647233605385, 0.05178936570882797, -0.043802659958601, 0.00364...
0.793596
0.756305
0.037291
You are tasked with creating a program that calculates the probability amplitudes for a quantum state and then visualizes the probability distribution in a 3D plot and a contour plot. The quantum state is defined by the amplitude function, which takes in two variables x and y, and returns a complex number. The probabil...
glaive
[ 0.004399909637868404, 0.03605717420578003, -0.031023496761918068, -0.03419409692287445, 0.0405573844909668, -0.02568734809756279, -0.018559016287326813, 0.08294515311717987, 0.040397096425294876, 0.002009305404499173, 0.02649909444153309, 0.03663748875260353, -0.024429041892290115, -0.0133...
0.795077
0.767987
0.02709
You are tasked with implementing a function in the programming language of your choice to calculate the rotation matrix for a given quaternion. Quaternions are represented as a 4-dimensional vector [x1,x2,x3,x4], and the rotation matrix for a quaternion can be computed using the following formula: R = 1/(x1^2+x2^2+x3^...
glaive
[ 0.02294529415667057, 0.030544618144631386, -0.031061215326189995, -0.033419955521821976, 0.04393073916435242, -0.018138494342565536, -0.03472595289349556, 0.05170882120728493, 0.03448265418410301, -0.008246401324868202, 0.011300228536128998, 0.028585761785507202, -0.028140582144260406, -0....
0.810024
0.770699
0.039326
You are tasked with implementing a CUDA kernel that computes the argmax of a given matrix column-wise. The kernel should take as input a matrix of dimensions DxN, where D represents the number of rows and N represents the number of columns. The output should be an array of length N, where each element represents the in...
glaive
[ 0.01566978357732296, 0.04356662929058075, -0.02517639845609665, -0.026775557547807693, 0.027253074571490288, -0.01556756254285574, -0.031098535284399986, 0.07931576669216156, 0.037661172449588776, -0.025995567440986633, 0.029231209307909012, 0.03187943994998932, -0.01457743439823389, 0.001...
0.804353
0.780804
0.02355
Can you provide a C++ program that calculates the nth Fibonacci number?
glaive
[ 0.006298334337770939, 0.01303882896900177, -0.028302064165472984, -0.03302305191755295, 0.03710252419114113, -0.019624633714556694, -0.018704181537032127, 0.07554946094751358, 0.04304927960038185, -0.026560397818684578, 0.029463374987244606, 0.03943052887916565, -0.04812764376401901, -0.02...
0.791877
0.774571
0.017306
You are tasked with implementing a CUDA kernel for computing the dot product of two arrays, as well as a weighted dot product function. The CUDA kernel should take two input arrays x and y of type T, and compute the dot product of these arrays. The weighted dot product function should take three input arrays x, weights...
glaive
[ 0.006907765753567219, 0.0471637099981308, -0.023427097126841545, -0.02102620154619217, 0.043248217552900314, -0.002547002164646983, -0.03298803046345711, 0.10026378929615021, 0.03820081055164337, -0.02201414853334427, 0.030613243579864502, 0.038343530148267746, 0.00409282511100173, -0.0155...
0.799053
0.781447
0.017606
You have been tasked with creating a program to calculate diversity statistics within populations using a simplified VCF file and a 3-column popmap. The program should be able to calculate heterozygosity, transition/transversion ratio, and create a fasta file from the VCF data. The program should filter for invariant s...
glaive
[ -0.006433417089283466, 0.010015109553933144, -0.03722335398197174, -0.028538895770907402, 0.03387931361794472, -0.01816854439675808, -0.028727160766720772, 0.07125040888786316, 0.047375913709402084, -0.014403028413653374, 0.014672764576971531, 0.038652483373880386, -0.009099931456148624, -...
0.79136
0.773843
0.017517
You are tasked with creating a program to implement a simple tic-tac-toe game using Dart. The program should include the following: - A Player enum with values Player1 and Player2 - A GameState enum with values Won, Draw, and Playing - A 3x3 grid to represent the tic-tac-toe board - A function to check for a win condit...
glaive
[ 0.009655380621552467, 0.030196959152817726, -0.019785551354289055, -0.046621549874544144, 0.041340749710798264, -0.02552804909646511, -0.02061333879828453, 0.07447443902492523, 0.036721084266901016, -0.02980675920844078, 0.0299348384141922, 0.030837368220090866, -0.027614442631602287, -0.0...
0.793492
0.769588
0.023904
You are tasked with creating a program that takes a string as input and reverses the order of the words in the string. For example, if the input string is "This is a test", the program should output "test a is This".
glaive
[ 0.03506828472018242, 0.02604614570736885, -0.0007096484769135714, -0.04057040810585022, 0.020421147346496582, -0.02244088612496853, -0.002393207047134638, 0.0755850151181221, 0.04665757343173027, -0.020574327558279037, 0.006329041440039873, 0.029448984190821648, -0.04331565275788307, -0.01...
0.792987
0.770108
0.022879
You need to implement a function, `buddy_strings`, that takes in two strings, `a` and `b`. The function should return true if and only if we can swap two letters in `a` so that the result equals `b`. For example: - `buddy_strings("ab", "ba")` should return true, as we can swap `a` and `b` to get `ba`. - `buddy_string...
glaive
[ 0.018811021000146866, 0.025844771414995193, -0.02899578958749771, -0.02197163738310337, 0.023423798382282257, -0.05230759456753731, 0.007514325436204672, 0.05915920436382294, 0.03416202589869499, -0.037331029772758484, 0.004995710216462612, 0.01789483241736889, -0.009196744300425053, -0.02...
0.829783
0.810624
0.019159
You are tasked with creating a program that processes a series of musical beats and notes. The beats are represented as time intervals and corresponding intensity levels, while the notes are represented as start and end times along with pitch values. Your program should take in the given beats and notes data and outpu...
glaive
[ 0.04010095074772835, 0.02141568996012211, -0.05706026777625084, -0.0053069400601089, 0.03261633962392807, -0.05026502534747124, -0.02590165100991726, 0.0602932870388031, 0.02784550003707409, -0.024156484752893448, 0.04201234132051468, 0.003111865371465683, -0.04856142774224281, 0.007895894...
0.799718
0.7746
0.025118
You are tasked with creating a program that takes in two integer values, Start and End, and returns a list of integers that fall within the range specified by Start and End. The program should include the Start and End values in the output list. For example, if the Start value is 3 and the End value is 8, the program ...
glaive
[ 0.037113580852746964, 0.01689511351287365, -0.04312479496002197, -0.03608740121126175, 0.0510154590010643, -0.01616540551185608, -0.053670916706323624, 0.061455365270376205, 0.04734429344534874, -0.020286228507757187, 0.035492755472660065, 0.06384260207414627, -0.04040743038058281, -0.0256...
0.812478
0.770251
0.042228
You are tasked with creating a program that utilizes the `OrdSet` data structure from the `brique` package in Scala. The program should have the following features: - Define a class called `OrdSetInput` that extends `InputHelper` and implements `BenchInstances` - The class should have a variable called `size` that can ...
glaive
[ 0.03200613334774971, 0.02439146302640438, -0.02857804298400879, -0.02165875770151615, 0.02667447179555893, -0.041324079036712646, -0.01443257462233305, 0.028028402477502823, 0.04002581909298897, -0.020174378529191017, 0.03321919962763786, 0.03284614160656929, -0.026290908455848694, 0.00055...
0.81439
0.792971
0.021419
Is it possible to create a function that calculates the factorial of an integer?
glaive
[ 0.03191010653972626, 0.0422818660736084, -0.02219679392874241, -0.018421748653054237, 0.046865906566381454, -0.03507399186491966, -0.024141184985637665, 0.05231967195868492, 0.035785697400569916, -0.030350280925631523, 0.01395831536501646, 0.04444241151213646, -0.03995232656598091, -0.0394...
0.790595
0.774469
0.016126
How can I find the second largest element in a binary search tree using an algorithm?
glaive
[ 0.021037165075540543, 0.027737876400351524, -0.03251584991812706, -0.05073405057191849, 0.012642079964280128, -0.031782809644937515, -0.014429290778934956, 0.050944503396749496, 0.03197955712676048, -0.03277493640780449, 0.03646044060587883, 0.023656340315937996, -0.03441131114959717, 0.00...
0.794917
0.775174
0.019743
You have been tasked with creating a program that calculates the probability of a quantum state. The amplitude of the quantum state is given by the function amplitude[x,y], and the probability is calculated using the function probability[x,y]. You need to find the maximum probability of the quantum state for given valu...
glaive
[ -0.0032122605480253696, 0.03448240086436272, -0.0357741042971611, -0.017122121527791023, 0.04675520956516266, -0.014198234304785728, -0.015632636845111847, 0.07226604968309402, 0.04100951924920082, 0.00427828636020422, 0.025869041681289673, 0.03562990576028824, -0.015561147592961788, -0.01...
0.789317
0.757497
0.03182
You are tasked with writing a program to generate a sequence of numbers based on the following formula: a(n) = n*(n+1)*(n+2)*(n+3)/4. Your program should take an input n and output the corresponding value of a(n). For example, if the input is 5, the output should be 210.
glaive
[ 0.031190864741802216, 0.024318115785717964, -0.025419320911169052, -0.03534214198589325, 0.02983059734106064, -0.027597576379776, -0.03894480690360069, 0.06488487124443054, 0.03082604520022869, -0.02587948925793171, 0.02731546387076378, 0.04833398014307022, -0.0475127249956131, -0.01044063...
0.82898
0.780163
0.048817
You are tasked with creating a program that calculates the probability of a quantum state given certain parameters and then visualizes the results in 3D and 2D plots. The program should include the following components: - Define a function `amplitude(x, y)` that takes two parameters `x` and `y` and returns a complex n...
glaive
[ -0.002948869951069355, 0.03808851167559624, -0.02616734802722931, -0.0274554044008255, 0.0386224165558815, -0.02815662883222103, -0.019626881927251816, 0.0754711851477623, 0.04018921032547951, 0.010589548386633396, 0.03579965978860855, 0.04275766760110855, -0.01641869731247425, -0.01004195...
0.795326
0.770056
0.02527
I want to write a C++ program that calculates the cumulative total of the initial 100 whole numbers, excluding those that are divisible by 3 or end with the digit 5. Can you provide a solution that optimizes the algorithm for time complexity?
glaive
[ -0.001746838097460568, 0.014408078975975513, -0.03546149283647537, -0.026937318965792656, 0.04685859754681587, -0.03478214517235756, -0.008075281046330929, 0.07761657983064651, 0.03144093230366707, -0.03746160864830017, 0.020418696105480194, 0.026685472577810287, -0.03800239413976669, -0.0...
0.807889
0.790204
0.017685
You are tasked with creating a program that calculates and displays a series of numbers. The program should start with a given number (in this case, 2.3) and then add a fixed amount to it (in this case, 2.1) in a loop until the number reaches a certain value (in this case, 7.6). The program should display each number i...
glaive
[ 0.02481994777917862, 0.03292842209339142, -0.04373440518975258, -0.04264088347554207, 0.055094391107559204, -0.02906627394258976, -0.02043401263654232, 0.054392069578170776, 0.03003179095685482, -0.02807617001235485, 0.032909929752349854, 0.050018567591905594, -0.046327557414770126, 0.0044...
0.813325
0.783848
0.029477
You are tasked with implementing a front-to-end bidirectional search algorithm for classical planning problems. The algorithm should integrate forward and backward width-based search with the additional intersection check between expanded states. The goal is to efficiently solve dual problems when the goal state is res...
glaive
[ -0.008978329598903656, 0.01837788335978985, -0.02705305628478527, -0.027666229754686356, 0.031929727643728256, 0.016821306198835373, -0.02238595299422741, 0.058418311178684235, 0.05079324170947075, -0.0023397302720695734, 0.013433787040412426, 0.03751826658844948, -0.011619293130934238, -0...
0.793242
0.77346
0.019782
You are tasked with creating a program that calculates the area of a circle. Your program should take the radius of the circle as input and return the area as output. The formula for calculating the area of a circle is: area = π * radius^2. You must ensure that your program takes into account the value of π and correct...
glaive
[ 0.0034548738040030003, 0.04085633158683777, -0.04046694189310074, -0.022990284487605095, 0.04693233594298363, -0.02940882183611393, -0.023333467543125153, 0.04611553996801376, 0.038819171488285065, -0.003492833347991109, 0.016291890293359756, 0.03978868946433067, -0.028657179325819016, -0....
0.771444
0.74308
0.028364
I have an array of numbers in JavaScript and I need to find the least common number from the array. However, I also want to handle edge cases where the array has equal frequencies. How can I write a function to solve this problem? ```javascript let provided_array = [1, 2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9] fun...
glaive
[ -0.009355464018881321, 0.02366996370255947, -0.04590902850031853, -0.021960239857435226, 0.04837747663259506, -0.02860940806567669, -0.023862577974796295, 0.06431317329406738, 0.008320581167936325, 0.000362903083441779, 0.01678268238902092, 0.009008084423840046, -0.02576782926917076, 0.003...
0.805795
0.776159
0.029636
You are tasked with implementing a function to calculate the sum of two matrices in a programming language that supports matrix operations. The function should take two matrices as input and return the sum of the matrices. Write a function that accepts two matrices as input and returns the sum of the matrices. The mat...
glaive
[ 0.005292891524732113, 0.029009860008955002, -0.03379552811384201, -0.050121285021305084, 0.06233322247862816, -0.005688811186701059, -0.01771855726838112, 0.05448519065976143, 0.0324690118432045, -0.01308546680957079, 0.00932270847260952, 0.038431450724601746, -0.026614340022206306, -0.009...
0.797094
0.75841
0.038684
You are tasked with creating a program that calculates and visualizes the probability distribution for a quantum system with a given number of qubits and states. The program should include functions to calculate the probability amplitudes and probabilities, as well as to find the maximum probability using simulated ann...
glaive
[ 0.004012962803244591, 0.03142965957522392, -0.025655342265963554, -0.014952067285776138, 0.03600474074482918, -0.036189090460538864, -0.029613962396979332, 0.06892992556095123, 0.030900508165359497, 0.0035268059000372887, 0.01982114091515541, 0.03392981365323067, -0.015524516813457012, -0....
0.79163
0.756915
0.034714
You are tasked with implementing a subroutine that rebin an array of real numbers according to the given algorithm. The subroutine takes in the following parameters: - rc: a real number - nd: an integer representing the size of the array - r: an array of real numbers - xi: an array of real numbers - xin: an array of re...
glaive
[ 0.013829692266881466, 0.03831089660525322, -0.017773350700736046, -0.03745761513710022, 0.022967210039496422, -0.009902499616146088, -0.013865936547517776, 0.0634901151061058, 0.023812638595700264, -0.004114206414669752, 0.023167932406067848, 0.04093587398529053, -0.03255609795451164, 0.01...
0.82894
0.781823
0.047118
You are tasked with creating a program that defines and initializes various constants and lists in a specific programming language. The program should include the following constants and lists: - An integer constant named `I16_CONST` with a value of 10 - A 32-bit integer constant named `I32_CONST` with a value of 10000...
glaive
[ 0.02116386592388153, 0.022425686940550804, -0.02071135863661766, -0.03393043577671051, 0.06467067450284958, -0.05640168488025665, 0.00047015026211738586, 0.04928426817059517, 0.03885732963681221, -0.03331046551465988, 0.03420036658644676, 0.04862048104405403, -0.024753905832767487, -0.0166...
0.801259
0.782865
0.018394
You are tasked with writing a subroutine in Fortran that initializes a 4-dimensional array `phi` with values based on the coordinates `x`, `y`, and `z`. The subroutine should take in the lower and upper bounds of the array `phi`, the number of components `ncomp`, the grid spacing `dx`, and the domain boundaries `prob_l...
glaive
[ -0.005217127967625856, 0.030728552490472794, -0.013712329789996147, -0.04227777197957039, 0.05722355097532272, -0.018268199637532234, -0.010011380538344383, 0.03857576474547386, 0.053002361208200455, 0.009516948834061623, 0.011684582568705082, 0.047955695539712906, -0.01824258454144001, -0...
0.807345
0.776205
0.03114
What is an optimal solution for the knapsack problem and how can it be achieved?
glaive
[ 0.022623395547270775, 0.02344547025859356, -0.03679027035832405, -0.032344017177820206, 0.03341895341873169, -0.012620125897228718, -0.011018122546374798, 0.036015309393405914, 0.036239661276340485, -0.01976109854876995, 0.029441365972161293, 0.01570887863636017, -0.028413034975528717, -0....
0.786746
0.762604
0.024143
You are tasked with implementing a CUDA kernel for performing element-wise binary operations on matrices using the provided CUDA code snippet. The binary operations include addition, subtraction, multiplication, division, finding the maximum, finding the minimum, exponentiation, and reverse subtraction and division. Ea...
glaive
[ 0.016856586560606956, 0.0444057397544384, -0.019509106874465942, -0.012750664725899696, 0.03487193211913109, -0.01789006218314171, -0.0162778552621603, 0.09934616088867188, 0.059245891869068146, -0.019156180322170258, 0.022191809490323067, 0.028813904151320457, -0.006186721380800009, -0.00...
0.803042
0.776571
0.026471
You are tasked with creating a Clojure program that calculates the total count of dependencies for a given project. Your program should take in a project map as input, where the dependencies are listed as vectors within the :dependencies key. Each vector contains the name of the dependency as a string and its version a...
glaive
[ 0.011265106499195099, 0.037263259291648865, -0.04472155496478081, -0.027954641729593277, 0.03828932344913483, -0.004889895208179951, -0.01810498535633087, 0.03212255984544754, 0.02527926117181778, -0.012728583998978138, 0.011573700234293938, 0.03434881195425987, -0.016513878479599953, -0.0...
0.801227
0.784773
0.016454
You are tasked with creating a program that transforms a given string by repeating the characters in the string a certain number of times. The program should take in a string and an integer as input and output the transformed string. For example, if the input string is "hello" and the integer is 3, the output should be...
glaive
[ 0.018961535766720772, 0.03286560997366905, -0.0030024154111742973, -0.05106382071971893, 0.03344773128628731, -0.03557831048965454, -0.01491163857281208, 0.037099406123161316, 0.007992018014192581, -0.032281119376420975, 0.01898578181862831, 0.020210066810250282, -0.04757687449455261, -0.0...
0.808431
0.7823
0.026131
You are tasked with implementing a set of functions to calculate bivariate and trivariate elliptic integrals, as well as handle argument reduction for these integrals. The functions to implement are: 1. `fukushimaB[φ, m]` which calculates the bivariate elliptic integral B(φ, m) 2. `fukushimaD[φ, m]` which calculates th...
glaive
[ 0.012725694105029106, 0.03587004914879799, -0.02002583257853985, -0.03628840669989586, 0.038332048803567886, -0.0359807088971138, -0.01218259148299694, 0.05655871704220772, 0.04462260380387306, -0.003811323083937168, 0.01775304600596428, 0.04495623707771301, -0.01640024408698082, -0.020164...
0.797912
0.774641
0.023271
You are tasked with creating a program to calculate the evaporation rate of different substances based on their initial mass, equilibrium mass, and drying time. The evaporation rate is calculated using the formula: evaporation_rate = (initial_mass - equilibrium_mass) / drying_time You need to write a program that ta...
glaive
[ 0.024416949599981308, 0.021701909601688385, -0.03041008487343788, -0.02639606036245823, 0.04340493306517601, -0.061396706849336624, -0.045993607491254807, 0.08110318332910538, 0.04184071719646454, -0.01922447793185711, 0.02521166391670704, 0.02835785411298275, -0.03791098669171333, 0.00430...
0.784726
0.768508
0.016218
I need to create a function that removes duplicate elements from a list and returns a new list with unique elements. The function should take a list of integers as input and return a new list with only the unique elements in the same order as they appeared in the original list.
glaive
[ 0.02976999618113041, 0.023794032633304596, -0.034448303282260895, -0.03978399932384491, 0.04827190563082695, -0.034015804529190063, -0.019306732341647148, 0.049609988927841187, 0.05034530162811279, -0.018003610894083977, 0.013213942758738995, 0.015559126622974873, -0.015414491295814514, -0...
0.804596
0.786317
0.018279
You are tasked with determining if a given lambda function is a combinator, can be reduced to a normal form, or if it diverges. 1. Determine if the given function is a combinator or not. 2. Determine if the given expression can be reduced to a normal form or if it diverges. 3. Beta reduce each of the given expressions...
glaive
[ 0.00872988160699606, 0.023823324590921402, -0.03212308883666992, -0.01846575178205967, 0.06224030628800392, -0.016806136816740036, -0.017888998612761497, 0.07423188537359238, 0.0385146364569664, 0.01164921559393406, 0.01061901543289423, 0.0371551476418972, -0.034565143287181854, -0.0217421...
0.8035
0.780312
0.023188
You are tasked with designing a VHDL module for a 4-digit 7-segment display. The module should take a 4-bit binary input and display the corresponding digit on a 7-segment display. The module should also have 4 anodes for each digit to control which digit is being displayed at a given time. Design a VHDL entity named ...
glaive
[ 0.022570936009287834, 0.02239099144935608, -0.03084302321076393, -0.04048166796565056, 0.0405077300965786, -0.04658913239836693, -0.037353914231061935, 0.05979248136281967, 0.03598535433411598, -0.00853173527866602, 0.02960662543773651, 0.042779773473739624, -0.0022502015344798565, 0.00949...
0.800226
0.780868
0.019357
You are tasked with creating a program to calculate the maximum probability of a quantum state for a given quantum system. The quantum system is defined by the number of qubits (nqubits), the name of the system (name), and the number of states (nstates). The amplitude of the quantum state is given by the function ampli...
glaive
[ 0.007942220196127892, 0.026899410411715508, -0.0321398489177227, -0.024522531777620316, 0.04644893482327461, -0.020744841545820236, -0.01940799131989479, 0.0688006803393364, 0.02731308899819851, -0.006230234168469906, 0.026416776701807976, 0.037085965275764465, -0.017502037808299065, -0.01...
0.792105
0.755145
0.03696
Can you provide an algorithm in C++ to transpose a matrix?
glaive
[ 0.0160863995552063, 0.017783168703317642, -0.016321025788784027, -0.026674361899495125, 0.04445980489253998, -0.02651132643222809, -0.016115089878439903, 0.0679660439491272, 0.0315304659307003, -0.031132962554693222, 0.01568198949098587, 0.021603748202323914, -0.02859320119023323, -0.02024...
0.78789
0.77261
0.015279
You are tasked with implementing a parallel algorithm using CUDA for solving a heat diffusion problem on a 2D grid. The problem involves initializing a grid with certain values, performing calculations on the grid elements, and calculating the maximum error from the calculations. The provided grid has boundary conditio...
glaive
[ -0.009498442523181438, 0.0490797758102417, -0.009721503593027592, -0.01580834574997425, 0.022117333486676216, -0.016931898891925812, -0.04211026802659035, 0.10357990115880966, 0.030621910467743874, -0.01827802136540413, 0.025127824395895004, 0.04348934441804886, 0.0032078432850539684, -0.0...
0.794546
0.769957
0.024588
You are tasked with creating a program that calculates the probability of a quantum state in a 16-qubit system and then visualizes the results using a 3D plot and a contour plot. The quantum state is determined by the amplitude function, which takes in two parameters, x and y, and returns a complex number. The probabil...
glaive
[ 0.0046049486845731735, 0.03412238508462906, -0.03122522309422493, -0.025543102994561195, 0.04857880249619484, -0.027948720380663872, -0.021947095170617104, 0.08139876276254654, 0.03674153983592987, -0.0034619250800460577, 0.031508930027484894, 0.03745627775788307, -0.013875185512006283, -0...
0.797745
0.770276
0.02747
You are tasked with creating a function that takes in the latitude and longitude of two points in degrees and returns the distance between them in kilometers. You should use the Haversine formula to calculate the distance. The formula for the Haversine distance is given by: a = sin²(Δφ/2) + cos(φ1) * cos(φ2) * sin²(Δλ...
glaive
[ 0.02142462506890297, 0.0318472757935524, -0.028916947543621063, -0.05129588022828102, 0.034247372299432755, -0.036374371498823166, -0.05166081711649895, 0.03660406544804573, 0.04437175765633583, -0.007674774620682001, 0.027500273659825325, 0.030827127397060394, -0.008964808657765388, 0.002...
0.782789
0.752523
0.030266
You have been tasked with creating a program that can process a specific set of input values and compute a result based on a given algorithm. The input values will be provided as an array of strings, which represent integer values. Your task is to create a function that takes this array of strings as input, converts it...
glaive
[ 0.02595117688179016, 0.02841857820749283, 0.004344801884144545, -0.04200338199734688, 0.029253192245960236, -0.0474911630153656, -0.016403507441282272, 0.03905541077256203, 0.025679919868707657, -0.022437185049057007, 0.030774729326367378, 0.031093623489141464, -0.024864790961146355, -0.02...
0.831673
0.802393
0.029279
How can I construct an algorithm to find all prime numbers between two given numbers?
glaive
[ 0.0263370294123888, 0.01168639026582241, -0.02288488857448101, -0.03247694671154022, 0.014866890385746956, -0.032932598143815994, -0.005137458443641663, 0.03750578686594963, 0.030128443613648415, -0.0345941036939621, 0.02248639054596424, 0.032982200384140015, -0.030600521713495255, -0.0147...
0.806988
0.777146
0.029842
You are tasked with creating a program that processes text files and performs various operations on the text data. The main tasks include loading a text file, eliminating punctuation marks, tokenizing the text, and calculating the Mutual Information score for bigrams. The program should also compute the average left an...
glaive
[ 0.02838590368628502, -0.0038315991405397654, -0.022570772096514702, -0.020790735259652138, 0.028596697375178337, -0.03303968161344528, -0.01884552091360092, 0.05080793797969818, 0.03695879876613617, -0.024835621938109398, 0.0074990070424973965, 0.008248980157077312, -0.013483093120157719, ...
0.809453
0.79084
0.018613
You are tasked with implementing a function in CUDA that will perform a step of the Game of Life simulation on a 3D grid. The function signature is as follows: ```cpp __global__ void Grid_D_GoLStep(byte * dev_grid, bool * device_idle, unsigned int size_x, unsigned int size_y, unsigned int size_z); ``` Where: - `dev_gr...
glaive
[ -0.01253964938223362, 0.04204815998673439, -0.01222827099263668, -0.03936811164021492, 0.019608184695243835, -0.021021250635385513, -0.03722996637225151, 0.11153043061494827, 0.03503025323152542, -0.020113114267587662, 0.01985280215740204, 0.04726476967334747, -0.00865102931857109, -0.0044...
0.806732
0.787588
0.019144
You are tasked with writing a Perl program that will print all even numbers from 0 to 10. The program should use a loop to iterate through the numbers and only print the even numbers.
glaive
[ 0.004703999496996403, 0.026245886459946632, -0.015445932745933533, -0.03985382989048958, 0.013515157625079155, -0.02830241061747074, -0.009308552369475365, 0.04378655552864075, 0.03422420471906662, -0.028150949627161026, 0.02159861847758293, 0.05503109097480774, -0.04276932775974274, -0.01...
0.794668
0.772349
0.022319
You are tasked with implementing a function that takes a sequence of elements and returns a new sequence with the elements in reverse order. The function should be generic and able to work with any type of elements. Write a Kotlin function that takes a Sequence<T> as input and returns a Sequence<T> with the elements i...
glaive
[ 0.022882241755723953, 0.04107081517577171, -0.008305080235004425, -0.05198564752936363, 0.028937015682458878, -0.01865038275718689, -0.01103883981704712, 0.06801784783601761, 0.02812759019434452, -0.006500500254333019, 0.012076959945261478, 0.02840379998087883, -0.02872450277209282, 0.0147...
0.792437
0.77785
0.014588
You are required to create a CUDA kernel that compares the colors in a 3D voxel grid and updates the counts of intersecting, first, and second colors. The voxel grid is stored in a surface called voxelGrid, and its size is stored in a constant variable voxelGridSize. The kernel should iterate through the voxel grid and...
glaive
[ -0.0036584248300641775, 0.03155986964702606, -0.017152266576886177, -0.024823367595672607, 0.023388909175992012, -0.00991632230579853, -0.046878743916749954, 0.08389944583177567, 0.04376992583274841, -0.02621227130293846, 0.03761666268110275, 0.04036988317966461, 0.000539516971912235, -0.0...
0.811172
0.796373
0.014799
You are tasked with implementing a CUDA-accelerated histogram equalization algorithm for grayscale images using the given code snippet as a reference. The goal is to improve the contrast of the input image by redistributing the intensity values. The input image is read from the disk, converted to grayscale, and then pr...
glaive
[ -0.0015225474489852786, 0.02695450745522976, -0.002285613911226392, -0.021778859198093414, 0.022537609562277794, -0.014040729962289333, -0.023103991523385048, 0.11009828746318817, 0.059261780232191086, -0.027895262464880943, 0.02444055676460266, 0.016032874584197998, -0.009873694740235806, ...
0.793184
0.778243
0.014941
You are tasked with calculating the 95% confidence interval for a linear regression coefficient in a statistical model. You have the following information: - beta1: the coefficient estimate - se: the standard error of the coefficient estimate - n: the total number of observations - k: the number of predictors in the mo...
glaive
[ -0.027309972792863846, 0.007672398816794157, -0.050014231353998184, -0.04442849010229111, 0.042853545397520065, -0.016424525529146194, 0.00018269549764227122, 0.06773383915424347, 0.040000125765800476, -0.016890456900000572, 0.008560679852962494, 0.02989497035741806, -0.02733159251511097, ...
0.785166
0.76104
0.024126
I need to find all the prime numbers between two given numbers. Can anyone help me with a code that can do that?
glaive
[ 0.025889718905091286, 0.01536343153566122, -0.027209226042032242, -0.037895213812589645, 0.021502219140529633, -0.039633870124816895, 0.003443836234509945, 0.044727642089128494, 0.03670159727334976, -0.034612927585840225, 0.02825268916785717, 0.03245261311531067, -0.04489671066403389, -0.0...
0.8056
0.789691
0.015909
You are tasked with creating a CUDA kernel function that processes data using parallel computing. The goal is to implement the kernel function using the provided guidelines and constraints, ensuring that the code runs efficiently and produces accurate results. The kernel function should take multiple input parameters,...
glaive
[ 0.005197123624384403, 0.06381270289421082, -0.012299717403948307, -0.010017605498433113, 0.0321224108338356, -0.0011420362861827016, -0.026814362034201622, 0.07804330438375473, 0.038337476551532745, -0.00491343392059207, 0.017592497169971466, 0.04193176329135895, -0.0011445299023762345, 0....
0.780701
0.766312
0.014389
You are tasked with implementing a function that calculates the Fibonacci sequence using a provided C module. The C module, example_c_module, contains a function fibstep that takes two numbers as input and returns the next two numbers in the Fibonacci sequence. Your task is to write a Lua script that uses the fibstep f...
glaive
[ 0.022143997251987457, 0.035083480179309845, -0.027775511145591736, -0.03723752498626709, 0.05462533235549927, -0.03533241152763367, -0.03099987655878067, 0.06559836864471436, 0.03853744640946388, -0.0131005784496665, 0.027486514300107956, 0.03816450387239456, -0.040872879326343536, -0.0023...
0.811945
0.797114
0.014831
You are tasked with writing a program that generates an array of 10 random integers between 1 and 30, inclusive. After generating the array, you need to find and output the maximum and minimum values in the array, as well as their respective indices. Finally, you are required to swap the positions of the maximum and mi...
glaive
[ 0.018047286197543144, 0.023968346416950226, -0.023304805159568787, -0.016899006441235542, 0.03395303711295128, -0.0439230352640152, -0.05359068512916565, 0.0453878790140152, 0.030325623229146004, -0.03695644065737724, 0.0346197783946991, 0.04093374311923981, -0.06276372820138931, -0.018766...
0.819378
0.781855
0.037524
You are tasked with implementing a CUDA kernel that performs bilateral filtering on a given image. The bilateral filter is applied to a 2D array of unsigned short values, and the result should be stored in another 2D array. The bilateral filter kernel accepts the source array, destination array, and two float parameter...
glaive
[ -0.01609881781041622, 0.039166614413261414, -0.02355167269706726, -0.017648952081799507, 0.026117058470845222, -0.0006404548184946179, -0.01416048500686884, 0.08984122425317764, 0.0554022379219532, -0.01791953854262829, 0.0353393480181694, 0.024695290252566338, 0.0031753242947161198, 0.007...
0.798143
0.781024
0.01712
You are tasked with creating a Rust program that simulates a parent task spawning multiple subtasks and then waits for all subtasks to complete before calculating the sum of their results. The parent task should output the sum of the subtask results after all subtasks have completed. Write a Rust function that takes a...
glaive
[ 0.02548438124358654, 0.04210209846496582, -0.032212212681770325, -0.02926754020154476, 0.019255999475717545, 0.016132215037941933, -0.026462426409125328, 0.06335462629795074, 0.04108097404241562, 0.0011606145417317748, 0.019496308639645576, 0.059490375220775604, -0.02888471633195877, -0.01...
0.815937
0.793973
0.021964
You are tasked with optimizing the concatenation of two binary numbers in a hardware design. The design consists of three registers: r, s, and counter. The counter is initially set to 0 and should increment by 1 in each clock cycle until it reaches 2, at which point the system should exit. In each clock cycle, the fo...
glaive
[ 0.011323673650622368, 0.03446992486715317, -0.03603891283273697, -0.002727312268689275, 0.028920073062181473, -0.017765015363693237, -0.04893038794398308, 0.0789259746670723, 0.04866652563214302, -0.010302380658686161, 0.002730787731707096, 0.03391313925385475, -0.01646372675895691, 0.0088...
0.819563
0.7827
0.036863
You are tasked with implementing a function that can decode a string representing a character entry in a dictionary. The character entry contains various fields such as character, definition, pinyin, decomposition, etymology, radical, and matches. The decomposition field can have different types of decomposition like C...
glaive
[ 0.01160133071243763, 0.005177315324544907, -0.016947174444794655, -0.04072756692767143, 0.04177389666438103, -0.037816159427165985, -0.014613987877964973, 0.04538616165518761, 0.040650300681591034, -0.005266626365482807, 0.02593819797039032, 0.02476341463625431, -0.018823521211743355, 0.00...
0.804922
0.787074
0.017847