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 given a dataset containing multiple variables. Your task is to perform factor analysis on the dataset to identify underlying factors that can explain the variance in the data. The dataset has columns such as ID, PSDA_sum_f1, PSDA_sum_f2, PSDA_sum_f3, PSDA_h1_f1, PSDA_h1_f2, PSDA_h1_f3, PSDA_h2_f1, PSDA_h2_f2, P... | glaive | [
-0.0021878366824239492,
0.034835245460271835,
-0.03413647413253784,
-0.04406621679663658,
0.027498912066221237,
-0.008004407398402691,
-0.01899508573114872,
0.07203096151351929,
0.04594050720334053,
0.027638064697384834,
0.009170176461338997,
0.03142254799604416,
-0.027310913428664207,
0.0... | 0.77094 | 0.753095 | 0.017845 |
You are tasked with writing a program to generate the sequence of numbers as shown in the code snippet. The sequence starts with 0 and follows a specific pattern to generate the subsequent numbers. Your program should be able to produce the first 100 numbers in this sequence. | glaive | [
0.014003722928464413,
0.018108533695340157,
-0.011462505906820297,
-0.030745452269911766,
0.03128468245267868,
-0.025406474247574806,
-0.02259901911020279,
0.07500755786895752,
0.029576193541288376,
-0.03466796875,
0.030030447989702225,
0.0324532575905323,
-0.045164503157138824,
0.00010441... | 0.818541 | 0.788743 | 0.029798 |
You have a dataset called HAVE with the following variables: ID (string), visit_date (date), and visit_type (string). You need to perform several sorting and deduplication operations on this dataset using SAS.
1. Sort the data in ascending order by visit_date.
2. Sort the data in descending order by visit_date.
3. Use... | glaive | [
0.023893721401691437,
0.02005208656191826,
-0.03276556730270386,
-0.028862077742815018,
0.024522660300135612,
-0.03053896687924862,
-0.00898909941315651,
0.0628814846277237,
0.05175654962658882,
0.016779659315943718,
0.024298233911395073,
0.014308457262814045,
-0.017082227393984795,
-0.017... | 0.794453 | 0.774782 | 0.019671 |
You are tasked with implementing a CUDA kernel to normalize the rows and columns of a matrix using the given CUDA framework and technology. The goal is to efficiently compute the squared sum of the elements in each row and column of the input matrix and store the results in the output array.
As a CUDA programmer, you... | glaive | [
0.0035321081522852182,
0.037785567343235016,
-0.026101553812623024,
-0.0363442525267601,
0.04468616470694542,
-0.015242054127156734,
-0.016002759337425232,
0.07617145776748657,
0.04105759039521217,
-0.025729825720191002,
0.0213328804820776,
0.021734608337283134,
-0.010614619590342045,
-0.0... | 0.794122 | 0.778269 | 0.015853 |
You are tasked with implementing a CUDA kernel to perform permutation on a given input array in a row-major or column-major fashion. The goal is to create a high-performance implementation that efficiently shuffles the elements of the input array based on a set of permutations, and generates an output array with the sh... | glaive | [
-0.002222722163423896,
0.05389977991580963,
-0.01651029661297798,
-0.017874961718916893,
0.02251308038830757,
-0.005937871057540178,
-0.03171961009502411,
0.08320624381303787,
0.030081164091825485,
-0.016609294340014458,
0.018294811248779297,
0.021535225212574005,
-0.006489083636552095,
0.... | 0.810153 | 0.782484 | 0.027669 |
Can you provide a code that can sort an array of numbers in ascending order? | glaive | [
0.026247713714838028,
0.020745251327753067,
-0.018171167001128197,
-0.0270346999168396,
0.018061337992548943,
-0.03723805025219917,
-0.016895728185772896,
0.05013115331530571,
0.016478395089507103,
-0.035540152341127396,
0.019744016230106354,
0.027575211599469185,
-0.0692489817738533,
-0.0... | 0.801817 | 0.784628 | 0.017189 |
You are tasked with writing a program that calculates the probability of a given quantum state. The amplitude of the state is defined by the function `amplitude[x_,y_]`, and the probability of the state is given by the function `probability[x_, y_]`. You need to use the `NMaximize` function to find the maximum probabil... | glaive | [
0.00031700124964118004,
0.024460507556796074,
-0.03470595180988312,
-0.020054129883646965,
0.04095037654042244,
-0.02192864567041397,
-0.010716823861002922,
0.07431638240814209,
0.043824464082717896,
0.007640081457793713,
0.027264107018709183,
0.0416828989982605,
-0.014594366773962975,
-0.... | 0.797074 | 0.772236 | 0.024839 |
You are required to implement a k-nearest neighbors algorithm for a time series analysis project. The algorithm will be used to split the embedded time series into a testing set and a training set, calculate distances, and make predictions based on weighted averages. The specific steps required for this implementation ... | glaive | [
0.018334729596972466,
0.02364266850054264,
-0.03562493249773979,
-0.03722836822271347,
0.0396721325814724,
-0.01902412809431553,
-0.015763409435749054,
0.05254128947854042,
0.034725505858659744,
0.00840082485228777,
0.021044468507170677,
0.01703600026667118,
-0.010058528743684292,
0.029307... | 0.807567 | 0.781629 | 0.025938 |
You are tasked with implementing a CUDA function that performs a scan operation using the Thrust library. The function should take in an array of unsigned integers and output the scan result to another array. The size of the input array should also be provided as an argument.
Write a CUDA function that utilizes the Th... | glaive | [
0.018553519621491432,
0.056839071214199066,
-0.01852954551577568,
-0.022424008697271347,
0.035726387053728104,
-0.008585798554122448,
-0.01874016784131527,
0.08298172801733017,
0.05008719488978386,
0.0012343080015853047,
0.024409225210547447,
0.01796199567615986,
-0.0014048847369849682,
-0... | 0.805238 | 0.786898 | 0.018341 |
You are tasked with implementing a function to compute the LQ factorization of a given matrix `A`. The LQ factorization is a decomposition of a matrix into a lower triangular component `L` and an orthogonal/unitary component `Q`, such that `A ≈ L*Q`. The LQ decomposition is the QR decomposition of `transpose(A)`.
Your... | glaive | [
0.014280355535447598,
0.05775875970721245,
-0.02162107266485691,
-0.0430305041372776,
0.04802045226097107,
-0.009310446679592133,
-0.00920094270259142,
0.051953066140413284,
0.02163568139076233,
-0.007067574188113213,
0.013280597515404224,
0.027540193870663643,
-0.03325119987130165,
0.0013... | 0.798907 | 0.767241 | 0.031666 |
Can anyone help me optimize this function to calculate the greatest common divisor of two numbers? | glaive | [
0.018457964062690735,
0.03219437971711159,
-0.03814869746565819,
-0.03060551919043064,
0.02892184630036354,
-0.026188965886831284,
-0.030828552320599556,
0.05296211317181587,
0.027404891327023506,
-0.03564341738820076,
0.018536468967795372,
0.014523524791002274,
-0.03096099942922592,
-0.01... | 0.809139 | 0.790011 | 0.019128 |
I am trying to implement a CUDA kernel that can efficiently find the top-k elements in a tensor along a specific dimension. The input tensor is of type T and has a dimensionality of N. The kernel should be able to handle both single-block and multi-block scenarios.
The kernel needs to take the following inputs:
- Inpu... | glaive | [
0.01730971783399582,
0.05498132482171059,
-0.040673427283763885,
-0.01406521163880825,
0.023745311424136162,
0.001104495720937848,
-0.02488073706626892,
0.08108029514551163,
0.025173451751470566,
-0.011221745051443577,
0.032237179577350616,
0.033550139516592026,
-0.012877019122242928,
0.01... | 0.804689 | 0.7866 | 0.018089 |
You are tasked with implementing a breadth-first search (BFS) algorithm on a graph using the Gunrock library. The graph is represented in CSR (Compressed Sparse Row) format and may be directed or undirected. The goal is to perform BFS traversal starting from a specified source node and compute the distance of each node... | glaive | [
-0.005995021667331457,
0.042335111647844315,
-0.02590261958539486,
-0.05135181173682213,
0.02305537648499012,
-0.051771193742752075,
0.0007269571069628,
0.05242811515927315,
0.04917729273438454,
-0.00805449578911066,
0.02436724491417408,
0.03734566271305084,
-0.019695954397320747,
0.005150... | 0.815552 | 0.796286 | 0.019266 |
You are tasked with implementing a quantum probability distribution visualization using a given probability function and a set of constraints. The probability function is defined by the amplitude of a quantum state, which is provided as a complex-valued function in terms of variables x and y. The task is to plot the 3D... | glaive | [
-0.007578372489660978,
0.025057367980480194,
-0.039081934839487076,
-0.035702574998140335,
0.030856778845191002,
-0.016607997938990593,
-0.02329639531672001,
0.0653388500213623,
0.0506863072514534,
0.012654723599553108,
0.027109762653708458,
0.0326455757021904,
-0.0019670582842081785,
0.00... | 0.776993 | 0.758259 | 0.018733 |
You are tasked with creating a program that calculates the difference between the square of the sum and the sum of the squares of the first n natural numbers. You need to write three functions:
1. `square_of_sum`: This function takes a single parameter `n` (an unsigned 32-bit integer) and returns the square of the sum ... | glaive | [
0.01032284740358591,
0.03718951344490051,
-0.031577304005622864,
-0.05148562416434288,
0.04882824048399925,
-0.011435292661190033,
-0.030376479029655457,
0.06612544506788254,
0.04987010359764099,
-0.013757836073637009,
0.040018968284130096,
0.01182057335972786,
-0.059018999338150024,
-0.03... | 0.82291 | 0.774026 | 0.048884 |
Can you provide an algorithm that sorts the given input and stores it in an output array? | glaive | [
0.030589574947953224,
0.018157685175538063,
-0.02411065623164177,
-0.019327064976096153,
0.025008581578731537,
-0.042858682572841644,
-0.034749142825603485,
0.045763880014419556,
0.041915688663721085,
-0.03246128186583519,
0.023059332743287086,
0.029144320636987686,
-0.038409702479839325,
... | 0.81981 | 0.799131 | 0.020679 |
You are tasked with implementing a subroutine to solve one of the triangular systems A * x = s*b or A'*x = s*b with scaling to prevent overflow. The matrix A is an upper or lower triangular matrix stored in packed form. The subroutine should handle cases where the unscaled problem will not cause overflow and when the m... | glaive | [
0.023931514471769333,
0.03409823030233383,
-0.016341518610715866,
-0.038022253662347794,
0.03831961378455162,
-0.021375032141804695,
-0.005685018841177225,
0.06699999421834946,
0.02710704132914543,
-0.001751357107423246,
0.0323198065161705,
0.05136688053607941,
-0.007162950932979584,
-0.01... | 0.808746 | 0.777071 | 0.031675 |
Can you provide a function that returns all prime numbers up to a given integer n? | glaive | [
0.03582712635397911,
0.02746325172483921,
-0.02281833067536354,
-0.033603064715862274,
0.015240681357681751,
-0.04714397341012955,
0.001554771326482296,
0.023981984704732895,
0.031943973153829575,
-0.017317205667495728,
0.029592009261250496,
0.048704713582992554,
-0.03173581510782242,
-0.0... | 0.801496 | 0.780006 | 0.021491 |
You are tasked with creating a shader that computes the distance to the Mandelbrot Set for every pixel and colorizes it accordingly. The equation to be used is Z -> Z²+c, where Z0 = 0. The Hubbard-Douady potential G(c) is G(c) = log Z/2^n and G'(c) = Z'/Z/2^n. The distance to be computed is |G(c)|/|G'(c)| = |Z|·log|Z|/... | glaive | [
0.010812980122864246,
0.045645907521247864,
-0.026696495711803436,
-0.04596251994371414,
0.021428175270557404,
-0.06344036757946014,
-0.013971148990094662,
0.06524667143821716,
0.05611996725201607,
-0.034587372094392776,
0.028946103528141975,
0.04094409942626953,
-0.011328566819429398,
-0.... | 0.810277 | 0.790968 | 0.019309 |
You are tasked with implementing a function in Lisp that calculates the factorial of a given number. The function should take a single argument, the number for which we want to find the factorial, and should return the factorial of that number. The factorial of a non-negative integer n is the product of all positive in... | glaive | [
0.032091058790683746,
0.03430183231830597,
-0.026704221963882446,
-0.03440653905272484,
0.04946715757250786,
-0.031835995614528656,
-0.020901627838611603,
0.03881881758570671,
0.0503532849252224,
-0.0054446058347821236,
0.01460216473788023,
0.05305473506450653,
-0.035262834280729294,
-0.02... | 0.799323 | 0.77681 | 0.022513 |
You are required to implement a CUDA kernel function for harmonic angle inference in C++ using the given code snippet as a reference. The function should accept various input parameters and perform calculations to update the values of specified arrays. The function should handle indexing, mathematical operations, and a... | glaive | [
0.004081787541508675,
0.04711632430553436,
-0.014761587604880333,
-0.02194024994969368,
0.0187979768961668,
0.0005849417648278177,
-0.010854166001081467,
0.09630360454320908,
0.049676939845085144,
-0.009604286402463913,
0.035357773303985596,
0.0379132479429245,
-0.002419083844870329,
0.009... | 0.79936 | 0.776182 | 0.023178 |
I need to implement a CUDA kernel function that evaluates the incomplete beta function for positive "a" and "b" and "x" between 0 and 1 for arrays. The shapes of "a", "b", and "x" must be the same. The incomplete beta function is defined as betaIncCoreCuda(a, b, x), which uses the Lentz’s algorithm for continued fracti... | glaive | [
0.001475803554058075,
0.05121665820479393,
-0.039224933832883835,
-0.02195117250084877,
0.040361516177654266,
-0.014721020124852657,
-0.02184009738266468,
0.08641382306814194,
0.03314341604709625,
-0.029964406043291092,
0.03259236738085747,
0.027734892442822456,
-0.016641410067677498,
-0.0... | 0.806364 | 0.788379 | 0.017985 |
You are tasked with writing a program to calculate the antiderivative of the function
\[f(x) = \frac{1}{\cos ^{2}x}\]
within the interval $]-\frac{\pi}{2},\frac{\pi}{2}[$. The program should take the input of the function and interval, and output the antiderivative as a mathematical expression. | glaive | [
0.0182318277657032,
0.030648864805698395,
-0.049966961145401,
-0.025541232898831367,
0.03084367699921131,
-0.03301619738340378,
-0.028248390182852745,
0.06900808215141296,
0.06640268117189407,
0.00021041672152932733,
0.0235473420470953,
0.018339194357395172,
-0.026577116921544075,
-0.01055... | 0.795084 | 0.770502 | 0.024581 |
You are tasked with implementing a CUDA kernel for performing a Fast Fourier Transform (FFT) shift on an input array. The FFT shift operation involves rearranging the input array such that the zero-frequency component is placed at the center of the array. The input array is of type T and has a length of N. The CUDA ker... | glaive | [
0.010056918486952782,
0.05899127945303917,
-0.022183535620570183,
-0.018201276659965515,
0.03406506031751633,
-0.015882480889558792,
-0.024489331990480423,
0.075348399579525,
0.05031237751245499,
-0.013482974842190742,
0.02994702197611332,
0.024970708414912224,
-0.022025587037205696,
0.006... | 0.799772 | 0.779864 | 0.019909 |
You are tasked with implementing a function in OCaml that calculates the sum of all the elements in a given list, as well as a few other related functions.
You need to implement the following functions:
1. `sumList`: This function takes in a list of integers and returns the sum of all the elements in the list.
2. `dig... | glaive | [
0.005759192164987326,
0.02609449066221714,
-0.019574936479330063,
-0.0664774626493454,
0.06294652074575424,
-0.043143972754478455,
-0.0053787692449986935,
0.036767955869436264,
0.05716860294342041,
-0.003311864100396633,
0.02412928268313408,
0.05831609666347504,
-0.019416693598031998,
-0.0... | 0.799756 | 0.774655 | 0.025101 |
You are tasked with implementing a function to calculate the index of a subgroup in a group, and proving several divisibility properties.
Write a function `index` that takes a subgroup `H` of a group `G` and returns the index of `H` as a natural number, returning 0 if the index is infinite. Additionally, write a funct... | glaive | [
0.021284857764840126,
0.042427584528923035,
-0.02276330441236496,
-0.03576720133423805,
0.04078192263841629,
-0.032876837998628616,
-0.01761137694120407,
0.05267481505870819,
0.03666799142956734,
-0.0035278312861919403,
0.037284303456544876,
0.021006660535931587,
-0.022221939638257027,
0.0... | 0.829241 | 0.791426 | 0.037815 |
You are tasked with creating a JavaScript function that takes in an array of numbers and returns the sum of all the even numbers in the array. You must implement the function from scratch without using any built-in JavaScript methods to find even numbers.
For example, given the input array [1, 2, 3, 4, 5, 6], the func... | glaive | [
0.017994865775108337,
0.023215506225824356,
-0.03677070140838623,
-0.04043620452284813,
0.04524507746100426,
-0.018617190420627594,
-0.01810375601053238,
0.055567797273397446,
0.02730541303753853,
-0.016606124117970467,
0.006036153994500637,
0.029053237289190292,
-0.047675635665655136,
-0.... | 0.814262 | 0.789124 | 0.025139 |
I need to create a program that defines a homomorphism between two algebras. The program should be able to define the map and functions for the homomorphism, as well as check for injectivity and surjectivity. The program should also be able to compose two homomorphisms and evaluate the homomorphism for a given term.
W... | glaive | [
0.053084563463926315,
0.015329067595303059,
-0.023893797770142555,
-0.03556283935904503,
0.039331186562776566,
-0.0260234996676445,
-0.004352816380560398,
0.06290700286626816,
0.04798313230276108,
-0.03264760971069336,
0.011292795650660992,
0.035661857575178146,
-0.01096928957849741,
-0.02... | 0.783959 | 0.769451 | 0.014508 |
You are tasked with creating a CUDA program that performs a SPIRAL GPU kernel execution and averages the execution time over a specified number of iterations. The program should allocate memory for input and output buffers, transfer data to the GPU, run the SPIRAL GPU kernel, and then transfer the results back to the h... | glaive | [
-0.015391304157674313,
0.04120074212551117,
-0.01474738772958517,
-0.018359418958425522,
0.026938525959849358,
-0.0032614057417958975,
-0.05750240758061409,
0.083094023168087,
0.05633219704031944,
-0.02358447015285492,
0.02814197912812233,
0.03796064481139183,
-0.0031947228126227856,
0.014... | 0.796531 | 0.782198 | 0.014333 |
You are tasked with creating a program to model a reinforcement learning task. The program should take in data from multiple subjects, each with a specified number of trials, and calculate the learning rate and choice parameters for each subject. The program should also update the values for V based on the rewards rece... | glaive | [
-0.01108839362859726,
0.011757352389395237,
-0.026956599205732346,
-0.03377183526754379,
0.02734600566327572,
-0.04219493269920349,
-0.01847176067531109,
0.052525781095027924,
0.025829514488577843,
-0.036323726177215576,
0.012855205684900284,
0.030143609270453453,
-0.031158490106463432,
0.... | 0.792265 | 0.776867 | 0.015398 |
You are tasked with implementing a function in the LAPACK library to test the QR-factorization with pivoting of a matrix A. The function should return the ||A*P - Q*R||/(||norm(A)||*eps*M) value.
The function should take the following arguments:
- M: The number of rows of the matrices A and AF.
- N: The number of colum... | glaive | [
0.0210738405585289,
0.04093143716454506,
-0.020844897255301476,
-0.030097899958491325,
0.04639893025159836,
0.0018246930558234453,
0.000805117073468864,
0.06492229551076889,
0.01977700926363468,
0.012717724777758121,
0.0042226240038871765,
0.03789721429347992,
-0.03069560043513775,
0.00557... | 0.804861 | 0.783587 | 0.021274 |
You are tasked with implementing a Fortran subroutine called SMMDDACT that performs the following operation:
A := alpha * A + beta * B',
where alpha, beta are scalars; A is an m by n matrix and B is an n by m matrix. The subroutine takes in the following arguments:
- M: an integer specifying the number of rows of A and... | glaive | [
0.006443270016461611,
0.027736205607652664,
-0.03479662165045738,
-0.04397691786289215,
0.05140203237533569,
-0.01615920104086399,
-0.02267833612859249,
0.06940944492816925,
0.058388952165842056,
-0.010117798112332821,
0.003478900296613574,
0.04453611001372337,
-0.01613069884479046,
-0.023... | 0.796929 | 0.769337 | 0.027593 |
You are tasked with implementing a C++ template that can be used to indicate the proper vector type for a given typename and vector size. The template should work with arbitrary typenames and vector sizes and should be designed to be utilized in GPU graph library operations.
Your task is to create a template called Ve... | glaive | [
0.035883255302906036,
0.013199678622186184,
-0.024337608367204666,
-0.03039495088160038,
0.044021930545568466,
-0.027089940384030342,
-0.030342262238264084,
0.09986621886491776,
0.035060230642557144,
-0.035961586982011795,
0.030868148431181908,
0.05332021415233612,
0.015815075486898422,
0.... | 0.795777 | 0.771561 | 0.024216 |
You are tasked with creating a program to analyze sports team data. The program should take in the number of teams, the number of games played, the prior scores of each team, the teams playing in each game, the scores for each team in each game, and a degree of freedom parameter. The program needs to transform the data... | glaive | [
0.007304576691240072,
0.002656393451616168,
-0.061414819210767746,
-0.03713786229491234,
0.044188082218170166,
-0.020738108083605766,
-0.025192320346832275,
0.0450982041656971,
0.04548077657818794,
-0.02845137007534504,
0.008654397912323475,
0.03845761716365814,
-0.02697303332388401,
-0.00... | 0.79471 | 0.77434 | 0.02037 |
You are tasked with implementing a system of differential equations using the DifferentialThomas package in a programming environment. The system of equations is defined by the following variables: x5(t), x6(t), x4(t), x2(t), x1(t), x3(t), y1(t), and y2(t). The system is represented by the following equations:
diff(x5... | glaive | [
0.02643522247672081,
0.015981748700141907,
-0.04287722334265709,
-0.05764485523104668,
0.05348626524209976,
-0.043237753212451935,
-0.027080900967121124,
0.06694802641868591,
0.040137387812137604,
0.0016082099173218012,
0.018979782238602638,
0.03539527207612991,
-0.01920258067548275,
-0.01... | 0.815107 | 0.783415 | 0.031692 |
You are tasked with creating a Matrix class in CUDA C++ that can perform various operations on matrices. The Matrix class should include methods for reading a matrix from a file, transposing a matrix, multiplying two matrices, finding the inverse of a matrix, creating an identity matrix, and determining the height and ... | glaive | [
0.030142437666654587,
0.02324184775352478,
-0.013388562947511673,
-0.023048512637615204,
0.0421845018863678,
-0.027103526517748833,
-0.027229344472289085,
0.11746755242347717,
0.04500667378306389,
-0.01851516030728817,
0.026725053787231445,
0.029485397040843964,
-0.010170475579798222,
-0.0... | 0.788439 | 0.770267 | 0.018172 |
You are tasked with implementing a quantum probability distribution visualization and optimization algorithm. The problem involves defining the amplitude, probability, and result of a quantum system, and then visualizing the probability distribution in 3D and contour plots.
Implement the following tasks:
1. Define the... | glaive | [
-0.01027294248342514,
0.02303711511194706,
-0.02784566394984722,
-0.02677633799612522,
0.028565194457769394,
-0.02423727512359619,
-0.020122814923524857,
0.06071207672357559,
0.054648105055093765,
0.008826213888823986,
0.02423699013888836,
0.02868533506989479,
-0.0031612692400813103,
-0.00... | 0.792167 | 0.765339 | 0.026828 |
I have a list of integers and I want to find the maximum sum of a subset of numbers from this list. However, there is a condition that no consecutive numbers can be chosen. Can anyone help me design an algorithm to solve this problem? | glaive | [
0.020337656140327454,
0.0029916532803326845,
-0.028244217857718468,
-0.02865438535809517,
0.05148586258292198,
-0.014332779683172703,
-0.02094518579542637,
0.0432242751121521,
0.03581501170992851,
-0.030059846118092537,
0.03708803653717041,
0.034882962703704834,
-0.04802531376481056,
-0.01... | 0.817113 | 0.781477 | 0.035636 |
You are required to implement the Brick Sort algorithm using CUDA on the GPU. The Brick Sort algorithm is a parallel sorting algorithm that works by sorting pairs of items in parallel, and then repeatedly merging them. The algorithm starts by comparing every pair of adjacent items and swapping them if they are in the w... | glaive | [
0.013044695369899273,
0.03738609701395035,
-0.013496669940650463,
-0.005965786520391703,
0.016373155638575554,
-0.009244019165635109,
-0.03246299549937248,
0.06574530899524689,
0.043623507022857666,
-0.030683351680636406,
0.00836998876184225,
0.03522885963320732,
-0.010092442855238914,
0.0... | 0.807806 | 0.773689 | 0.034117 |
You are tasked with implementing a function to calculate the greatest common divisor (GCD) of two natural numbers. The GCD of two numbers is the largest positive integer that divides both numbers without leaving a remainder. You should define a function gcd(a, b) that takes two natural numbers a and b as input and retu... | glaive | [
0.024049241095781326,
0.03615212067961693,
-0.02350383810698986,
-0.028698831796646118,
0.03573152795433998,
-0.014706537127494812,
-0.024848900735378265,
0.05047668144106865,
0.027802690863609314,
-0.020427726209163666,
0.018907098099589348,
0.02554594911634922,
-0.01898421347141266,
-0.0... | 0.814165 | 0.75895 | 0.055215 |
What is the code to reset all the elements in a 2D array to 0? | glaive | [
0.009265853092074394,
0.042474761605262756,
-0.032235369086265564,
-0.04610709473490715,
0.03866850212216377,
-0.04008349031209946,
-0.005651718936860561,
0.04884282127022743,
0.03496742621064186,
-0.04029635712504387,
0.024017108604311943,
0.031117253005504608,
-0.019179048016667366,
-0.0... | 0.799013 | 0.782809 | 0.016204 |
What is the area of a rectangle with a length of 3 and a width of 4? | glaive | [
0.008102349936962128,
0.03640732541680336,
-0.04898320883512497,
-0.04698982834815979,
0.02771247737109661,
-0.01836417242884636,
-0.03996528312563896,
0.0259694904088974,
0.03267583250999451,
-0.00930504035204649,
0.02618975192308426,
0.047144465148448944,
-0.02230166830122471,
-0.0360630... | 0.747959 | 0.728458 | 0.019502 |
You are tasked with implementing a C++ program that defines a class called "TrivialLayer" in the "caffe" namespace. This class should have three methods: "Forward_gpu", "Backward_gpu", and "SecForward_gpu". Each method takes two parameters: a vector of Blob pointers called "bottom" and a vector of Blob pointers called ... | glaive | [
0.013224066235125065,
0.03712422773241997,
-0.014217966236174107,
-0.03751663491129875,
0.0330861434340477,
-0.018397541716694832,
-0.02653375454246998,
0.10800464451313019,
0.017881449311971664,
-0.025991108268499374,
0.028824402019381523,
0.05235619097948074,
-0.02938390150666237,
0.0036... | 0.800362 | 0.785801 | 0.014561 |
:
You are required to create a Fortran program that simulates the CLASWP subroutine, which performs a series of row interchanges on a general rectangular matrix. The input to the program will include the matrix A, the leading dimension of the array A (LDA), the number of columns of the matrix A (N), the first element o... | glaive | [
0.0075388443656265736,
0.0284271277487278,
-0.005303069483488798,
-0.0348544679582119,
0.04434408247470856,
-0.00708982115611434,
-0.012220672331750393,
0.07139013707637787,
0.018611755222082138,
-0.0038724574260413647,
0.03405381366610527,
0.027044586837291718,
-0.030950795859098434,
0.00... | 0.810463 | 0.784201 | 0.026263 |
You are tasked with writing a CUDA C program to perform vector addition on an NVIDIA GPU. The program will take two input vectors of 10 integers each, add them together, and store the result in a third vector. You must ensure that the program handles memory allocation, data transfer between the host and the device, and... | glaive | [
0.01397679653018713,
0.0350872240960598,
-0.019108764827251434,
-0.010484959930181503,
0.02426588349044323,
-0.0064447177574038506,
-0.034225281327962875,
0.10030683875083923,
0.04234086722135544,
-0.022287314757704735,
0.012356653809547424,
0.036934539675712585,
-0.0172584131360054,
-0.01... | 0.79462 | 0.778435 | 0.016185 |
You are tasked with implementing a function to generate variant names for variables in a programming language. Each variable has a base name and a variant number. The goal is to create a function that takes a list of variables and generates variants for each variable, ensuring that the variants are unique and not alrea... | glaive | [
-0.0038367831148207188,
0.04455117508769035,
-0.024862775579094887,
-0.006232971325516701,
0.044813938438892365,
-0.03314092382788658,
-0.009480226784944534,
0.06550578027963638,
0.03294714167714119,
-0.00778641551733017,
0.020487118512392044,
0.04391257092356682,
-0.029972122982144356,
0.... | 0.802376 | 0.78801 | 0.014366 |
You are tasked with optimizing the efficiency of a system that involves input and output data processing across multiple garages. The goal is to determine the optimal weight for each garage to minimize inefficiency, as well as identify the most efficient and inefficient garages.
You have the following data available:... | glaive | [
0.019331876188516617,
0.029200216755270958,
-0.056354839354753494,
-0.007329157087951899,
0.021377334371209145,
-0.02272934280335903,
-0.04243403300642967,
0.05623169615864754,
0.0396571047604084,
-0.003137338673695922,
0.020145967602729797,
0.031026571989059448,
-0.03276544064283371,
-0.0... | 0.814271 | 0.790615 | 0.023656 |
You are tasked with implementing a CUDA kernel for sparse matrix-vector multiplication (SpMV) using the SELL-P matrix format. The SELL-P format is a storage scheme for sparse matrices that can be efficiently used for SpMV operations on CUDA devices. The goal is to write a CUDA kernel that performs the SpMV operation fo... | glaive | [
0.0013855383731424809,
0.038567304611206055,
-0.026082288473844528,
-0.02337239868938923,
0.044314101338386536,
-0.004404429346323013,
-0.02429034188389778,
0.1023687794804573,
0.04565466195344925,
-0.021387558430433273,
0.026308685541152954,
0.034473150968551636,
0.00018774275667965412,
-... | 0.795189 | 0.779768 | 0.015421 |
What is the algorithm to determine if a given number is prime? | glaive | [
0.030666561797261238,
0.018626924604177475,
-0.010702393017709255,
-0.032680001109838486,
0.030307510867714882,
-0.04282192513346672,
0.000608686008490622,
0.06649274379014969,
0.02254158817231655,
-0.026798859238624573,
0.01695789210498333,
0.02022918313741684,
-0.035402435809373856,
-0.0... | 0.791494 | 0.760795 | 0.030699 |
You are tasked with implementing a set of CUDA kernels to compute various trigonometric and mathematical functions on an array of floating-point numbers. Specifically, you need to create CUDA kernels for the following functions:
1. Compute the cosine of each element in the input array and store the result in the output... | glaive | [
0.013443768955767155,
0.05870823562145233,
-0.030437344685196877,
-0.02126310206949711,
0.030525607988238335,
-0.009219511412084103,
-0.023967932909727097,
0.07790803909301758,
0.047889091074466705,
-0.012181930243968964,
0.024022301658988,
0.03023112379014492,
-0.008851946331560612,
-0.00... | 0.800408 | 0.774471 | 0.025938 |
Can you design a function that finds the largest number in a given list of integers? | glaive | [
0.03946574404835701,
0.03667599707841873,
-0.03448102995753288,
-0.03582824021577835,
0.04289516061544418,
-0.027700599282979965,
-0.022932536900043488,
0.0317843034863472,
0.03175504505634308,
-0.02468639612197876,
0.02881542406976223,
0.05225241184234619,
-0.026680227369070053,
-0.013805... | 0.805886 | 0.782247 | 0.023638 |
You are tasked with implementing a function in the MPL programming language that performs a logical AND operation on two input variables of type i32 and i64 respectively. The function should take two input variables of the specified types and return the result of performing a logical AND operation on them.
You are req... | glaive | [
0.002942789811640978,
0.02681172639131546,
-0.020648697391152382,
-0.041029758751392365,
0.04666346311569214,
-0.02019895426928997,
-0.028888124972581863,
0.0708332508802414,
0.03225153312087059,
-0.01960337720811367,
0.015355396084487438,
0.05380268394947052,
-0.02121683955192566,
-0.0126... | 0.80293 | 0.787653 | 0.015276 |
You are tasked with implementing a CUDA kernel for the cross-entropy forward and backward calculations using half-precision floating-point numbers. The forward pass involves calculating the softmax function and cross-entropy loss, while the backward pass involves computing the gradients with respect to the input. The i... | glaive | [
0.005081675481051207,
0.034412164241075516,
-0.021352333948016167,
-0.027630945667624474,
0.025604406371712685,
-0.0029327247757464647,
-0.02053089067339897,
0.09050246328115463,
0.043405283242464066,
-0.020148349925875664,
0.027364099398255348,
0.03669139742851257,
-0.008968629874289036,
... | 0.796334 | 0.780635 | 0.015699 |
You are tasked with implementing a subroutine to calculate the LdR decomposition of an overlap matrix. The subroutine should take as input the number of particles `ne`, the overlaps of extended orbitals `orbov`, and output the left transformation matrix `lmat`, the right transformation matrix `rmat`, the eigenvalues `d... | glaive | [
0.011181679554283619,
0.02705731801688671,
-0.031096549704670906,
-0.038858234882354736,
0.03592991456389427,
0.007762853987514973,
-0.03409969061613083,
0.046801164746284485,
0.03752767667174339,
0.007672651670873165,
0.011951249092817307,
0.016802925616502762,
-0.03303831070661545,
-0.00... | 0.79639 | 0.767703 | 0.028686 |
You are working on a spectrograph extraction routine and need to implement a weighted extraction algorithm in 2D for object profiles. The algorithm should interpolate linearly between the nearest two pixels in the wavelength direction, and the mean wavelength extracted for each pixel in the x-direction should correspon... | glaive | [
0.0025417115539312363,
0.03905072063207626,
-0.042301204055547714,
-0.029385697096586227,
0.030597185716032982,
-0.04039422795176506,
-0.02465296909213066,
0.0712517648935318,
0.041956644505262375,
-0.002191566862165928,
0.02662336453795433,
0.026589957997202873,
-0.013218206353485584,
0.0... | 0.799494 | 0.778016 | 0.021478 |
You are tasked with implementing a program that deals with axis-aligned bounding boxes (AA-BBOX) in a 3D space. An axis-aligned bounding box is defined by the coordinates of its lower left corner (lx, ly, lz) and the coordinates of its upper right corner (hx, hy, hz). You need to create a function that takes a bound ve... | glaive | [
0.02833402156829834,
0.033273257315158844,
-0.026436440646648407,
-0.029900122433900833,
0.03796616569161415,
-0.008540458045899868,
-0.022886143997311592,
0.05402881279587746,
0.05182337760925293,
0.00006370643677655607,
0.015642564743757248,
0.03511686995625496,
-0.021410489454865456,
0.... | 0.807074 | 0.784136 | 0.022937 |
You are tasked with implementing a function that calculates the sum of all elements in an array using Scala's Software Transactional Memory (STM) framework. The function should take an array of integers as input and return the sum of all elements using STM for concurrency control. Ensure that the function is thread-saf... | glaive | [
0.025125546380877495,
0.0426766462624073,
-0.024118492379784584,
-0.03814484551548958,
0.0584404431283474,
-0.042005088180303574,
-0.02619047835469246,
0.06018189340829849,
0.024534501135349274,
-0.012192820198833942,
0.02578597329556942,
0.03904404863715172,
-0.009786142036318779,
0.00030... | 0.808581 | 0.790408 | 0.018173 |
You are required to implement a CUDA kernel that preprocesses quantile information for a given dataset. The dataset is represented as a 2D array with n_sampled_rows rows and ncols columns. For each column, the goal is to calculate quantiles for nbins number of bins.
The preprocess_quantile() function takes the followi... | glaive | [
-0.014372199773788452,
0.0329485647380352,
-0.027505753561854362,
-0.03392016887664795,
0.031027335673570633,
-0.030015800148248672,
-0.002132585970684886,
0.09380117803812027,
0.0470828078687191,
-0.004320608917623758,
0.038476526737213135,
0.025200657546520233,
-0.017261775210499763,
0.0... | 0.804505 | 0.786312 | 0.018194 |
You are tasked with implementing a Fortran subroutine that calculates integrals for the transverse photon interaction. The subroutine should take in five input parameters: ia, ib, ic, id, and k, and return the calculated integral as the output parameter tegral. The subroutine should include the necessary modules and in... | glaive | [
0.026715245097875595,
0.04054450988769531,
-0.010937019251286983,
-0.0347171276807785,
0.035860367119312286,
-0.016854533925652504,
-0.01008033286780119,
0.05225267633795738,
0.056852005422115326,
0.007131604012101889,
0.03168787062168121,
0.04295911639928818,
-0.009529857896268368,
-0.009... | 0.792166 | 0.773406 | 0.01876 |
You are tasked with implementing a maximum likelihood estimation (MLE) problem using R. Given a binomial random variable $X$ with $x \sim Binom(n, p)$, you need to show that the MLE of $p$ is $\hat{p} = \frac{X}{n}$. | glaive | [
0.0060094911605119705,
0.007004361134022474,
-0.039113499224185944,
-0.048448823392391205,
0.03992588818073273,
-0.017432738095521927,
-0.009469029493629932,
0.03859621286392212,
0.046701639890670776,
-0.004607737064361572,
0.01981205679476261,
0.043133631348609924,
-0.03295450657606125,
-... | 0.800666 | 0.777923 | 0.022744 |
Can you explain how to implement a Binary Search algorithm in C++? I have an array `[2, 4, 10, 13, 24, 30]` and I want to find the index of the target number 10. | glaive | [
0.002086908556520939,
0.042734771966934204,
-0.0274517685174942,
-0.007747008465230465,
0.031708724796772,
-0.03666121885180473,
-0.03453822806477547,
0.06791805475950241,
0.037581153213977814,
-0.03395629674196243,
0.028190167620778084,
0.023201875388622284,
-0.03772735595703125,
-0.01265... | 0.806446 | 0.789534 | 0.016912 |
You are tasked with creating a program that takes in a series of numbers and counts the frequency of each unique number. You need to implement a function that takes in an array of integers and returns a dictionary or map with the count of each unique number. | glaive | [
0.015143451280891895,
0.017316561192274094,
-0.04837886989116669,
-0.021001804620027542,
0.042147960513830185,
-0.016276121139526367,
-0.021381359547376633,
0.05609867721796036,
0.025238128378987312,
-0.01643144153058529,
0.004567706026136875,
0.01859385333955288,
-0.01693761721253395,
-0.... | 0.824235 | 0.791358 | 0.032877 |
You are tasked with creating a Stan model for simulating the behavior of a random agent. The model should take into account a dataset consisting of the number of trials (n) and an array of outcomes (h). The model must then estimate the parameter theta and generate a quantity theta_p using the inv_logit function.
Creat... | glaive | [
0.020942779257893562,
0.020228780806064606,
-0.03360249102115631,
-0.039858147501945496,
0.03705871105194092,
-0.03258353844285011,
-0.03558298945426941,
0.06066788733005524,
0.025692442432045937,
-0.01726728118956089,
0.008997398428618908,
0.052166882902383804,
-0.025056378915905952,
0.00... | 0.791517 | 0.773247 | 0.01827 |
You are tasked with creating a program that calculates the maximum probability of a given quantum state. The amplitude of the quantum state is defined by the function `amplitude[x_,y_]`, and the probability is calculated using the function `probability[x_,y_]`. The program should use simulated annealing with a perturba... | glaive | [
0.0026707921642810106,
0.03547849506139755,
-0.027084188535809517,
-0.03178736940026283,
0.037723951041698456,
-0.014970810152590275,
-0.021424686536192894,
0.06920250505208969,
0.02575022727251053,
-0.0057547204196453094,
0.024656858295202255,
0.03408513590693474,
-0.008189190179109573,
-... | 0.792917 | 0.759406 | 0.033511 |
Given the differential equation (f''(x) + 3f'(x))/2 = 1 - f(x), with initial conditions f(0) = -1 and f'(0) = 3, solve the equation in two different ways: using power series and using the Laplace transform.
a) Power series: Simplify the equation to f''(x) = 2 - 3*f'(x) - 2*f(x), with initial conditions f(0) = -1 and f... | glaive | [
0.008779584430158138,
0.04274984821677208,
-0.03711938112974167,
-0.04827142879366875,
0.04127362743020058,
-0.0025978439953178167,
-0.010387850925326347,
0.08526740223169327,
0.04146818816661835,
0.009764762595295906,
0.012938778847455978,
0.015769053250551224,
-0.04019972309470177,
-0.01... | 0.778398 | 0.742984 | 0.035414 |
You are given a signed measure `s` and you need to find a pair of complement measurable sets `i` and `j` such that `i` is positive with respect to `s` and `j` is negative with respect to `s`.
You need to write a function that takes the signed measure `s` as input and returns the pair of sets `i` and `j` that satisfy t... | glaive | [
0.016378071159124374,
0.024993255734443665,
-0.047009654343128204,
-0.02963007241487503,
0.049247823655605316,
-0.021785927936434746,
-0.02904989942908287,
0.0595172643661499,
0.05374180153012276,
-0.013330385088920593,
0.028154047206044197,
0.03329457342624664,
-0.03262334316968918,
-0.01... | 0.833938 | 0.795255 | 0.038683 |
You are tasked with creating a CUDA kernel that implements various sampling functions for different geometric primitives. The goal is to generate random points within the given primitives, such as triangles, spheres, disks, parallelograms, and single points. Each sampling function should take as input a RandomGPU objec... | glaive | [
-0.0014840494841337204,
0.039009325206279755,
-0.023926949128508568,
-0.036202572286129,
0.028852079063653946,
-0.019136039540171623,
-0.027882849797606468,
0.06491531431674957,
0.036397241055965424,
-0.011646123602986336,
0.03547353297472,
0.04760734364390373,
-0.0041966685093939304,
0.00... | 0.800349 | 0.78134 | 0.019009 |
You are tasked with implementing a path tracing algorithm using OptiX, a high-performance ray tracing API. The goal is to compute the radiance at each pixel in a deferred shading pipeline, taking into account materials, textures, and light sources in the scene. The program should handle multiple bounces of rays, correc... | glaive | [
0.010131558403372765,
0.045523788779973984,
-0.019900545477867126,
-0.009968232363462448,
0.019691558554768562,
-0.029837507754564285,
-0.029048200696706772,
0.08327595889568329,
0.04720905050635338,
-0.008143146522343159,
0.03665013611316681,
0.02053629793226719,
-0.0015879543498158455,
-... | 0.797778 | 0.779727 | 0.01805 |
You are required to implement a CUDA kernel that will flag isolated vertices in a graph. The graph is represented using the Compressed Sparse Row (CSR) format, where `row_ptr` is an array containing the starting index of each vertex's adjacency list in the `adjacency list` array. The `degrees` array contains the degree... | glaive | [
0.01697922684252262,
0.059054698795080185,
-0.02540094591677189,
-0.023442624136805534,
0.023027552291750908,
-0.03249938040971756,
-0.01946992054581642,
0.092342309653759,
0.04989275336265564,
-0.026697447523474693,
0.015941184014081955,
0.0270551647990942,
-0.0019128754502162337,
0.01522... | 0.816666 | 0.791502 | 0.025163 |
What is an efficient algorithm for implementing bubble sort in Java without using additional memory? | glaive | [
-0.010374203324317932,
0.01595301367342472,
-0.025153204798698425,
-0.028966063633561134,
0.017807824537158012,
-0.042849209159612656,
-0.021278081461787224,
0.03910234943032265,
0.023805955424904823,
-0.052844926714897156,
0.011614126153290272,
0.022838739678263664,
-0.004652739968150854,
... | 0.795518 | 0.77811 | 0.017408 |
You are tasked with creating a web application that calculates the minimum number of coins needed to make a given amount of change. The application should have a route that takes in a parameter representing the amount of change and returns the combination of coins needed to make that amount.
Create a Ruby program usin... | glaive | [
0.0090938750654459,
0.03754618391394615,
-0.023980867117643356,
-0.030676323920488358,
0.03234884515404701,
-0.017975326627492905,
-0.014989812858402729,
0.06338582932949066,
0.024310627952218056,
-0.027415793389081955,
0.034004729241132736,
0.03650456666946411,
-0.01562725193798542,
-0.01... | 0.817171 | 0.801538 | 0.015633 |
You are tasked with creating a parallel computing program using the 'parallel' and 'devtools' libraries in R. The program should generate random numbers using a specific RNG (Random Number Generator) method and then perform a simulation using the generated random numbers. The simulation should use the 'mclapply' functi... | glaive | [
0.00503918994218111,
0.04649089649319649,
-0.012694386765360832,
-0.03442529961466789,
0.023761944845318794,
-0.0026202253066003323,
-0.04852995276451111,
0.06876455247402191,
0.032630570232868195,
-0.02916770800948143,
0.006593375466763973,
0.04435482621192932,
-0.019345086067914963,
0.00... | 0.790063 | 0.774581 | 0.015482 |
You are tasked with creating a program that utilizes an enum in Java. The enum, called EnumMarshalStrict, contains the values "Foo", "Bar", "Baz", and "Bat". Your task is to write a function that takes a string as input and returns the corresponding enum value. If the input string does not match any of the enum values,... | glaive | [
0.027569111436605453,
0.024314479902386665,
-0.04095233231782913,
-0.01843314617872238,
0.03445129469037056,
-0.043424613773822784,
0.002407688181847334,
0.03932489827275276,
0.02553458884358406,
-0.0426979660987854,
0.033957988023757935,
0.033109940588474274,
-0.018376469612121582,
-0.023... | 0.798739 | 0.783547 | 0.015192 |
You are tasked with creating a program that calculates the quantum probability amplitudes of a system with 16 qubits in a given state. The system is represented by a complex-valued function amplitude(x, y) that takes in two input variables, x and y, and returns the quantum probability amplitude. Additionally, you need ... | glaive | [
0.003287363098934293,
0.03725128993391991,
-0.02797900326550007,
-0.021630797535181046,
0.04509454965591431,
-0.026516545563936234,
-0.01790604181587696,
0.07116688787937164,
0.037706200033426285,
0.002034324686974287,
0.027369504794478416,
0.03141186013817787,
-0.021622013300657272,
-0.01... | 0.801168 | 0.767552 | 0.033615 |
You are tasked with implementing a CUDA kernel function to reduce a vector by summing its elements. The kernel function `reduceVector` should take a float array `d_a` of size N as input, and reduce it by summing pairs of elements until there is only one element left. The reduction process should follow the tree structu... | glaive | [
-0.002677726559340954,
0.05079445242881775,
-0.030981076881289482,
-0.02571759559214115,
0.03882560878992081,
-0.007441359106451273,
-0.02051016315817833,
0.09801139682531357,
0.04782530665397644,
0.005144892260432243,
0.020169364288449287,
0.032897330820560455,
-0.016888367012143135,
0.00... | 0.816564 | 0.788472 | 0.028092 |
You are tasked with analyzing a list of passwords to determine the number of valid passwords according to their policies. Each line in the input file contains the policy and password, with the following format:
- The policy specifies the minimum and maximum number of times a given letter must appear in the password.
- ... | glaive | [
0.027180690318346024,
0.022411314770579338,
-0.004593785852193832,
-0.028262697160243988,
0.03603170067071915,
-0.03933281451463699,
-0.019490841776132584,
0.049362070858478546,
0.022443722933530807,
-0.009989758022129536,
0.023473499342799187,
0.02036593295633793,
-0.040588270872831345,
-... | 0.827256 | 0.793705 | 0.033552 |
You are tasked with implementing a function that computes the relationship between nodes and triangles in a 3D system. The function takes in several data structures as input, including CoordInfoVecs, GeneralParams, and AuxVecs. The function should utilize the thrust library for parallel computing, and it should not res... | glaive | [
0.02987399511039257,
0.03717523440718651,
-0.021011652424931526,
-0.024395840242505074,
0.03976435214281082,
-0.004291415214538574,
-0.013983355835080147,
0.07133090496063232,
0.03953906148672104,
0.009703672491014004,
0.03426569700241089,
0.037561915814876556,
-0.006693380884826183,
-0.00... | 0.803919 | 0.778786 | 0.025133 |
You are required to implement a CUDA kernel function for calculating the pairwise distance between two sets of data. The input data is represented as two arrays of type Dtype, bottom_data_1 and bottom_data_0, each of size dim * spatial_dim. The goal is to calculate the square Euclidean distance between each pair of ele... | glaive | [
-0.011853380128741264,
0.05668988078832626,
-0.026641063392162323,
-0.029572665691375732,
0.03080763854086399,
-0.0019414095440879464,
-0.03270197659730911,
0.08384719491004944,
0.04598771408200264,
-0.010429779067635536,
0.02751220390200615,
0.041672684252262115,
-0.008165532723069191,
0.... | 0.806661 | 0.774738 | 0.031923 |
You are tasked with writing a function that calculates the additive persistence of a given number. Additive persistence is the number of times you must add the digits of a number together until you are left with a single digit. For example, the additive persistence of 167 is 3 because 1+6+7=14, 1+4=5, and 5 is a single... | glaive | [
0.02837171033024788,
0.022223936393857002,
-0.012280672788619995,
-0.03885812684893608,
0.05595363676548004,
-0.03039984032511711,
-0.004965159110724926,
0.07740318030118942,
0.04823330417275429,
-0.000961060170084238,
0.010814870707690716,
0.017550986260175705,
-0.0354003943502903,
0.0133... | 0.819185 | 0.783006 | 0.036179 |
You are tasked with implementing a CUDA kernel function to add two arrays and store the result in a third array. The arrays are of size 5 and contain the following values:
Array a: { 1, 2, 3, 4, 5 }
Array b: { 10, 20, 30, 40, 50 }
You need to write a CUDA kernel function called AddKernel that takes two input arrays, a... | glaive | [
0.0028765734750777483,
0.052988797426223755,
-0.01841144822537899,
-0.017681628465652466,
0.041994985193014145,
0.006559636443853378,
-0.02667107991874218,
0.09716460853815079,
0.038151517510414124,
-0.011170241981744766,
0.017113806679844856,
0.03420484811067581,
-0.01514025405049324,
-0.... | 0.788215 | 0.767318 | 0.020897 |
You are tasked with implementing a function called `allTurnDirections` in Elm. This function should take a list of directions and return a new list of all possible turning directions based on the input list. The turning directions should be calculated as follows:
- If the input list contains only one direction, the out... | glaive | [
0.009371139109134674,
0.025276921689510345,
0.00398850766941905,
-0.025023583322763443,
0.02258204109966755,
-0.015830419957637787,
-0.02138655260205269,
0.02438979782164097,
0.04688805714249611,
-0.015157019719481468,
0.010522992350161076,
0.03564254939556122,
-0.01714460179209709,
-0.008... | 0.808001 | 0.782902 | 0.025099 |
Is there a way to create an algorithm that can sort an array of numbers in increasing order? | glaive | [
0.03541747108101845,
0.012747914530336857,
-0.021759487688541412,
-0.023681003600358963,
0.023174727335572243,
-0.0259588323533535,
-0.036578670144081116,
0.05810602381825447,
0.008646423928439617,
-0.032937340438365936,
0.022043583914637566,
0.012004721909761429,
-0.06423008441925049,
-0.... | 0.790523 | 0.763243 | 0.02728 |
I need to create a program that reads a file and counts the number of "nice" words in it. A word is considered "nice" if it meets certain criteria. For part 1, a word is considered "nice" if it contains at least three vowels (a, e, i, o, u) and at least one letter that appears twice in a row, but does not contain the s... | glaive | [
0.004519077483564615,
0.0048576416447758675,
-0.025134455412626266,
-0.022549036890268326,
0.03325027972459793,
-0.013028223998844624,
-0.031066982075572014,
0.05376901850104332,
0.021719086915254593,
-0.004228505305945873,
0.00963323563337326,
0.011935274116694927,
-0.03826593980193138,
-... | 0.815278 | 0.788668 | 0.02661 |
You are tasked with writing a program to find the n-th number k such that s(k) = 2, where s is defined as A026600. The first few numbers that satisfy this condition are: 2,4,9,10,15,17,21,23,25,28,33,35,39,41,43,47,49,54,57,59,61,65,67,72,73,78,80,82,87,89,93,95,97,101,103,108,111,113,115,119,121,126,127,132,134,137,13... | glaive | [
0.02231106534600258,
0.033915113657712936,
-0.02897411398589611,
-0.027736641466617584,
0.02025114744901657,
-0.026836466044187546,
-0.03908078372478485,
0.05331644415855408,
0.019982820376753807,
-0.026198139414191246,
0.042674098163843155,
0.035302188247442245,
-0.03424122929573059,
-0.0... | 0.839839 | 0.784268 | 0.05557 |
You are tasked with implementing a subroutine in Fortran called `crotgf` that performs a complex Givens rotation. The subroutine takes in four parameters: `ca` and `cb` are complex numbers, `c` is a real number, and `s` is a complex number. The subroutine should calculate the values of `c` and `s` based on the input va... | glaive | [
0.014603942632675171,
0.03666086867451668,
-0.02795562334358692,
-0.029686305671930313,
0.01964925415813923,
-0.022925393655896187,
0.0029716056305915117,
0.0466681644320488,
0.03144492954015732,
0.01072352658957243,
0.021075790748000145,
0.0337887667119503,
-0.03619610145688057,
0.0027101... | 0.806214 | 0.781671 | 0.024543 |
You are tasked with implementing a function that calculates subtraction in a specific mathematical structure called \textbf{Cost}. The structure is defined as $\mathbf{Cost}:=([0,\infty],\geq,0,+)$ and has a monoidal closed property. The subtraction operation in \textbf{Cost} is defined as follows: For any $x,y \in [0,... | glaive | [
0.02385995350778103,
0.03849218413233757,
-0.043900903314352036,
-0.01937973126769066,
0.04399082437157631,
-0.009018960408866405,
-0.03418201208114624,
0.07487720251083374,
0.07659512758255005,
-0.004989453125745058,
0.017679238691926003,
0.039658479392528534,
-0.02772114984691143,
-0.001... | 0.830034 | 0.78847 | 0.041563 |
You are tasked with creating a program that calculates the share of money given to three grandchildren by their grandmother. The grandmother gave them a certain amount of money, and each grandchild received a fraction of the total amount along with an additional sum of money. The eldest grandchild received 1/6 of the t... | glaive | [
0.00823245570063591,
0.032328762114048004,
-0.044729143381118774,
-0.02497386746108532,
0.039397530257701874,
-0.01478059682995081,
-0.01137131080031395,
0.07244016975164413,
0.042946670204401016,
-0.027923764660954475,
0.05172348767518997,
0.026791423559188843,
-0.03885719180107117,
-0.01... | 0.819965 | 0.787271 | 0.032694 |
Can you provide a JavaScript function that efficiently calculates the sum of the first n odd natural numbers, with a Big-O notation of O(n)? | glaive | [
0.005732493009418249,
0.02957492135465145,
-0.031046569347381592,
-0.03991920128464699,
0.023788103833794594,
-0.018517501652240753,
-0.017088649794459343,
0.03643808886408806,
0.04749295115470886,
-0.020676303654909134,
0.017909038811922073,
-0.0023227573838084936,
-0.04285934939980507,
-... | 0.814026 | 0.797575 | 0.016451 |
I need to create a program that calculates various statistics for a given set of variables in Stata. The program should be able to handle optional arguments for grouping the data, as well as options for saving the results to a file. The program should also be able to handle different display formats for the output stat... | glaive | [
-0.0071839839220047,
0.026677779853343964,
-0.060340430587530136,
-0.04154201224446297,
0.043276432901620865,
-0.02610274963080883,
-0.02341998927295208,
0.0639297366142273,
0.04684065654873848,
-0.014464047737419605,
0.025860382243990898,
0.04753902181982994,
-0.039627064019441605,
0.0030... | 0.779988 | 0.765616 | 0.014372 |
You are tasked with implementing a function that takes in two integers and returns their sum, using the given programming language and syntax guidelines. The function should have a trailing comma after the second parameter. | glaive | [
0.015063835307955742,
0.029310060665011406,
-0.03254212066531181,
-0.03532310947775841,
0.04784255474805832,
-0.0022627892903983593,
-0.026652857661247253,
0.057818181812763214,
0.0351262167096138,
-0.02188730426132679,
0.03292757645249367,
0.0502207949757576,
-0.0309367123991251,
-0.02432... | 0.816333 | 0.78752 | 0.028814 |
You are tasked with implementing a program that uses the cuComplex data type to perform a sparse matrix-matrix multiplication using the CUSPARSE library in CUDA. The goal is to perform the multiplication of a dense matrix A of size m x k with a sparse matrix B of size k x n, and store the result in a dense matrix C of ... | glaive | [
0.021393008530139923,
0.052225518971681595,
-0.023887822404503822,
-0.022580821067094803,
0.03792385756969452,
-0.01056209858506918,
-0.02107320912182331,
0.0863923579454422,
0.0515391007065773,
-0.0276210755109787,
0.01140920165926218,
0.034167587757110596,
0.008431862108409405,
-0.004497... | 0.799747 | 0.77509 | 0.024657 |
You are tasked with implementing a recursive function in Scheme that counts down from a given number and returns 42 when it reaches 0. The function should take an integer as a parameter and return the result of the countdown. | glaive | [
0.03520467132329941,
0.054376550018787384,
-0.010171701200306416,
-0.0520361103117466,
0.03215504065155983,
-0.01934603974223137,
-0.026167578995227814,
0.05719621106982231,
0.0348757840692997,
-0.0060834395699203014,
0.03566190227866173,
0.04131432995200157,
-0.02689552679657936,
0.014620... | 0.814282 | 0.784608 | 0.029674 |
You are tasked with creating a Kotlin program that performs arithmetic operations and prints the results. Your program should include the following:
- Define two integer variables, numberOne and numberTwo, and assign them the values 1 and 2, respectively.
- Print the sum of numberOne and numberTwo.
- Print the result o... | glaive | [
0.02912170998752117,
0.03130420669913292,
-0.020175782963633537,
-0.049556080251932144,
0.047070421278476715,
-0.026162151247262955,
-0.02342001162469387,
0.06260702013969421,
0.048691991716623306,
-0.01093260757625103,
0.018488386645913124,
0.026005571708083153,
-0.022382987663149834,
-0.... | 0.809353 | 0.781527 | 0.027826 |
You are given a small town with N people, labeled from 1 to N. There is a rumor that one of these people is the town judge. If the town judge exists, then:
1. The town judge is trusted by everyone except for themselves.
2. The town judge does not trust anyone.
You are given a list of trust relationships as a 2D array ... | glaive | [
0.014080666936933994,
0.04266717657446861,
-0.022448768839240074,
-0.013709471561014652,
0.03408603370189667,
-0.03946852684020996,
-0.02176099456846714,
0.03152654320001602,
0.024085095152258873,
-0.020725414156913757,
0.02701805904507637,
0.04153873771429062,
-0.032348476350307465,
0.001... | 0.836415 | 0.811565 | 0.02485 |
You are tasked with implementing a module for handling bounded numbers in a programming language. The module should provide functions for creating a bounded number with a specified range, setting the value within the range, incrementing and decrementing the value while ensuring it stays within the bounds, and mapping a... | glaive | [
0.03773491084575653,
0.03045046143233776,
-0.02133035659790039,
-0.023583494126796722,
0.03904062137007713,
-0.043058764189481735,
-0.00869772955775261,
0.04059557616710663,
0.04222654178738594,
-0.013097632676362991,
0.022156057879328728,
0.04820212721824646,
-0.03885585814714432,
0.00180... | 0.82095 | 0.795808 | 0.025142 |
You are tasked with implementing a program that sets up and solves a linear system of equations using the AMG (Algebraic MultiGrid) method. The system is represented by a sparse matrix A and vectors b and x. The matrix A is initialized with a specific number of points (5, 7, 9, or 27) using the Poisson equation with ei... | glaive | [
0.024843407794833183,
-0.005149458069354296,
-0.027204236015677452,
-0.05477677285671234,
0.05060378089547157,
-0.047611355781555176,
-0.020816124975681305,
0.05328803136944771,
0.032228630036115646,
-0.014736310578882694,
0.01458325982093811,
0.0484175868332386,
-0.01886145770549774,
-0.0... | 0.804168 | 0.780105 | 0.024063 |
You are tasked with creating a program that calculates the probability of a quantum state given certain parameters. The program should include the following functions:
1. amplitude[x_,y_]: This function takes in two parameters x and y, and returns a complex number based on a series of calculations.
2. amplitude2[x_,y_]... | glaive | [
0.0009754809434525669,
0.0425385907292366,
-0.030537748709321022,
-0.026970308274030685,
0.049567218869924545,
-0.021880196407437325,
-0.006945963017642498,
0.07634613662958145,
0.041509538888931274,
0.01176374964416027,
0.029804769903421402,
0.032641466706991196,
-0.021001849323511124,
-0... | 0.791496 | 0.762877 | 0.028619 |
You are tasked with implementing a function to compute the standard deviation and variance of an input matrix. The standard deviation operation is assumed to be performed on a given column. The function should have the following signature:
```cpp
template <typename Type, typename IdxType = int>
void stddev(Type* std,
... | glaive | [
-0.0016617263900116086,
0.019299061968922615,
-0.040195029228925705,
-0.03624583035707474,
0.05554535612463951,
-0.018552090972661972,
-0.03634987771511078,
0.11617311835289001,
0.04936622455716133,
-0.004518474917858839,
0.02634500525891781,
0.034648675471544266,
-0.0062042297795414925,
0... | 0.791206 | 0.771003 | 0.020203 |
You are tasked with creating a function that generates an upper triangular matrix with a specified value on the diagonal. The function should take in a real number `x`, representing the value to be placed on the diagonal, and two integers `m` and `n`, representing the dimensions of the matrix. Additionally, the functio... | glaive | [
0.018064862117171288,
0.02569224312901497,
-0.028995495289564133,
-0.046118658035993576,
0.032515089958906174,
-0.027748549357056618,
-0.02129470184445381,
0.06714455038309097,
0.017567124217748642,
0.005906448699533939,
0.04629950970411301,
0.04028032720088959,
-0.02022070437669754,
-0.00... | 0.798496 | 0.762152 | 0.036344 |
You are tasked with implementing a CUDA-based inclusive scan operation, which computes prefix sums of elements in an input array. The input array will be provided as a vector of uint32_t values. Your task is to write a function that performs the inclusive scan operation and returns the resulting prefix sum array. The f... | glaive | [
-0.0001237858523381874,
0.05058441683650017,
-0.02721591852605343,
-0.02122851088643074,
0.03152725473046303,
-0.01687587797641754,
-0.012127586640417576,
0.08519656211137772,
0.04867766052484512,
-0.0016176088247448206,
0.026676209643483162,
0.030680613592267036,
-0.008387885987758636,
-0... | 0.811132 | 0.791351 | 0.01978 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.