instruction_seed stringlengths 43 8.03k | source stringclasses 1
value | embeddings listlengths 1.02k 1.02k | mean_positive_score float64 0.73 0.85 | mean_negative_score float64 0.71 0.82 | difference_score float64 0.01 0.07 |
|---|---|---|---|---|---|
You are tasked with creating a CUDA C++ program that involves manipulating arrays using the ecuda library. The program should perform various operations on the arrays such as accessing elements, comparing arrays, and traversing arrays using iterators.
Your task is to implement the following functionalities:
1. Access ... | glaive | [
0.01588585413992405,
0.037435758858919144,
-0.00894969142973423,
-0.01570550911128521,
0.0313928984105587,
-0.029051732271909714,
-0.02564476989209652,
0.10375124216079712,
0.03845915198326111,
-0.034516386687755585,
0.01619061641395092,
0.034819357097148895,
-0.00901446770876646,
-0.00788... | 0.801347 | 0.775004 | 0.026343 |
You are tasked with creating a Fortran subroutine that takes real matrices A (N X N), B (N X M), and C (L X N) and forms the complex frequency response matrix G(FREQ) using the formula:
G(FREQ) := C * (((FREQ * I) - A)-INVERSE) * B
Where I is the N X N identity matrix and FREQ is a complex scalar parameter taking value... | glaive | [
0.02544812113046646,
0.02920682542026043,
-0.03322514891624451,
-0.0496194064617157,
0.036738280206918716,
-0.03346800431609154,
-0.0075452993623912334,
0.06565918028354645,
0.02820727974176407,
0.0017075653886422515,
0.022336740046739578,
0.05035640671849251,
-0.020701918751001358,
0.0063... | 0.798823 | 0.773152 | 0.025671 |
You are tasked with creating a function that calculates the sum of all the elements in a list. The function should take a list of integers as input and return the sum of all the elements in the list. If the list is empty, the function should return 0.
Create a function called `sumList` that takes a list of integers as... | glaive | [
0.019372832030057907,
0.02783525548875332,
-0.03777928650379181,
-0.04502490535378456,
0.07207801192998886,
-0.039280038326978683,
-0.011801693588495255,
0.03733651712536812,
0.04049159586429596,
-0.00346585176885128,
0.016888076439499855,
0.05141336843371391,
-0.02299569547176361,
-0.0251... | 0.803866 | 0.780746 | 0.023121 |
You are tasked with implementing a benchmarking function for sparse matrix operations. The benchmarking function should be able to handle matrix-vector products using various matrix formats such as compressed matrix, coordinate matrix, ell matrix, hyb matrix, and sliced ell matrix. The benchmarking function should be a... | glaive | [
0.039528172463178635,
0.032750654965639114,
-0.030476167798042297,
-0.03420838713645935,
0.031212059780955315,
-0.00391100998967886,
-0.026689914986491203,
0.06747275590896606,
0.05277667194604874,
-0.023587659001350403,
-0.0024560170713812113,
0.024503061547875404,
-0.0033496234100311995,
... | 0.792632 | 0.777896 | 0.014736 |
Can you provide a Java function that finds the maximum element in an array? | glaive | [
0.032629579305648804,
0.028820302337408066,
-0.04275021329522133,
-0.028568007051944733,
0.027023272588849068,
-0.04591042175889015,
-0.01563732884824276,
0.04069879651069641,
0.035705432295799255,
-0.038758739829063416,
0.0337122306227684,
0.027257774025201797,
-0.039003316313028336,
-0.0... | 0.794246 | 0.777375 | 0.016871 |
You are tasked with implementing a program to perform vector addition using both serial and parallel processing methods. The program should take two input arrays, perform element-wise squaring and summation, and store the result in a third array. The serial implementation should consist of nested for loops, while the p... | glaive | [
0.010744784958660603,
0.04227912798523903,
-0.014875968918204308,
-0.025190677493810654,
0.023778103291988373,
0.005639621522277594,
-0.029160302132368088,
0.10646212846040726,
0.04916352033615112,
-0.021616805344820023,
0.013434850610792637,
0.03070869669318199,
-0.008326554670929909,
-0.... | 0.795932 | 0.774804 | 0.021127 |
You are tasked with implementing a function in Common Lisp that takes a list of numbers as input and returns the sum of all the numbers in the list. The function should be named "calculate-sum" and should take a single argument, which is the list of numbers. | glaive | [
0.014600634574890137,
0.03252230957150459,
-0.03797205910086632,
-0.05988102778792381,
0.062322214245796204,
-0.02765882946550846,
-0.007123067509382963,
0.01795577071607113,
0.04046465829014778,
-0.01167516689747572,
0.02711191587150097,
0.053887415677309036,
-0.03026055358350277,
-0.0281... | 0.799357 | 0.775962 | 0.023395 |
Can you provide a C# method that calculates the sum of all the odd numbers between 0 and a given number n? | glaive | [
0.004492057487368584,
0.013068432919681072,
-0.02396775223314762,
-0.039572492241859436,
0.021434782072901726,
-0.03486017882823944,
-0.011152698658406734,
0.046610720455646515,
0.04888669401407242,
-0.026132823899388313,
0.02054470404982567,
0.030386893078684807,
-0.05297674238681793,
-0.... | 0.797747 | 0.78192 | 0.015827 |
You are tasked with implementing a program that involves handling multiple data types such as integers, arrays, matrices, vectors, and row vectors. Your task is to create a program that can transform the given data and parameters using the log1m function. The transformed data and parameters should be stored in their re... | glaive | [
0.01597760058939457,
0.020303133875131607,
-0.042038556188344955,
-0.0497933030128479,
0.05173387750983238,
-0.023861678317189217,
-0.03365040197968483,
0.051813025027513504,
0.0377250500023365,
-0.03470216318964958,
0.011901872232556343,
0.03563157469034195,
-0.015928354114294052,
-0.0044... | 0.805827 | 0.791511 | 0.014316 |
You are tasked with implementing a program that computes sample size, CI width, and probability of CI width for a CI for a population mean. The program should be able to compute sample size for a given CI width and probability of CI width, compute CI width for a given sample size and probability of CI width, and comput... | glaive | [
-0.009864221327006817,
0.022477583959698677,
-0.03879250958561897,
-0.032819755375385284,
0.056394413113594055,
-0.026880929246544838,
-0.027637066319584846,
0.06545592099428177,
0.02601480297744274,
-0.020717239007353783,
0.02199522592127323,
0.038286566734313965,
-0.01799815148115158,
-0... | 0.796935 | 0.781173 | 0.015762 |
You are tasked with implementing a CUDA GPU-accelerated function to calculate the coefficients of a Chebyshev expansion for a given set of hopping amplitudes in a tight-binding model. The function should take in a set of target indices and a source index, and return the coefficients for each target index. The CUDA kern... | glaive | [
0.01844877004623413,
0.054538335651159286,
-0.03717527538537979,
-0.01559542492032051,
0.025963257998228073,
-0.009153773076832294,
-0.03275175020098686,
0.08210624009370804,
0.04705709591507912,
-0.015432031825184822,
0.009891924448311329,
0.02363990619778633,
-0.014869678765535355,
-0.00... | 0.804899 | 0.788602 | 0.016298 |
How can I develop an algorithm to find the longest substring of a given string without any repeating characters? | glaive | [
0.0013190212193876505,
0.014700740575790405,
-0.021587440744042397,
-0.04331936314702034,
0.027478650212287903,
-0.04285185784101486,
-0.001661391812376678,
0.026642246171832085,
0.01669972389936447,
-0.04761028662323952,
0.027061764150857925,
0.011911674402654171,
-0.024084780365228653,
-... | 0.804611 | 0.78706 | 0.017551 |
You are tasked with creating a program that generates n-grams from a given text. An n-gram is a contiguous sequence of n items from a given sample of text or speech. For example, in the sentence "The quick brown fox", the 2-grams (or bigrams) would be "The quick", "quick brown", and "brown fox". Your task is to write a... | glaive | [
0.02259236015379429,
0.005671561695635319,
-0.015507648698985577,
-0.0324801467359066,
0.042915452271699905,
-0.051673583686351776,
-0.042475007474422455,
0.057113539427518845,
0.006920787505805492,
-0.0263175368309021,
0.012473087757825851,
0.03375159949064255,
-0.05396893993020058,
-0.01... | 0.812748 | 0.774968 | 0.03778 |
Can someone help me write a program that generates a matrix of size NxN, where each item is a random number between 0 and 10? I want to provide the size of the matrix as an input. | glaive | [
0.021644117310643196,
0.016742194071412086,
-0.036664146929979324,
-0.027591601014137268,
0.03143961355090141,
-0.04542367532849312,
-0.04023542255163193,
0.04411395639181137,
0.0210624560713768,
-0.0358898900449276,
0.03363616392016411,
0.038585372269153595,
-0.05197394639253616,
-0.02289... | 0.795012 | 0.778702 | 0.016311 |
How can an AI algorithm find the longest substring without repeating characters in a given string? | glaive | [
0.011023998260498047,
0.009773224592208862,
-0.007501974236220121,
-0.037494003772735596,
0.02378361113369465,
-0.0449928417801857,
-0.0048601641319692135,
0.03473668545484543,
0.028542542830109596,
-0.04062928259372711,
0.0233384370803833,
0.013347617350518703,
-0.005706950090825558,
-0.0... | 0.805494 | 0.784844 | 0.02065 |
You are tasked with creating a function that takes in a number and returns a string representation of the binary equivalent of that number. The function should handle both positive and negative numbers and should return the two's complement binary representation for negative numbers.
For example:
Input: 5
Output: "101... | glaive | [
0.018120862543582916,
0.011522018350660801,
-0.022503478452563286,
-0.04617546871304512,
0.036827970296144485,
-0.045207370072603226,
-0.0037445484194904566,
0.06099867448210716,
0.04550155997276306,
-0.018953751772642136,
0.025934917852282524,
0.04350316897034645,
-0.04363603517413139,
-0... | 0.813184 | 0.773405 | 0.039779 |
Write a Python program to create a function that takes in a list of numbers and returns the sum of all the even numbers in the list. | glaive | [
0.011607428081333637,
0.014812753535807133,
-0.03713885694742203,
-0.06347361952066422,
0.05471975728869438,
-0.025637183338403702,
-0.022333675995469093,
0.031013116240501404,
0.030152397230267525,
-0.023447515442967415,
0.0047203293070197105,
0.050120316445827484,
-0.04363860934972763,
-... | 0.793931 | 0.771747 | 0.022183 |
You are tasked with creating a program that simulates the behavior of an ant named Carl. Carl's behavior is governed by a series of commands that instruct him to move in a 2D plane. The commands can be one of four types: "Move North", "Move South", "Move East", or "Move West".
Your task is to write a program that tak... | glaive | [
0.00917063094675541,
0.02799038775265217,
-0.014694511890411377,
-0.03892938047647476,
0.02870292402803898,
-0.009648583829402924,
-0.03880365192890167,
0.08902866393327713,
0.02862963266670704,
-0.021576646715402603,
0.021251454949378967,
0.035667743533849716,
-0.04733232781291008,
-0.023... | 0.819484 | 0.784162 | 0.035323 |
You are tasked with implementing a Prolog predicate called span/5. The span/5 predicate will take in a goal, a list, and three lists as input and will attempt to match a prefix of the input list that satisfies the given goal. The first three lists will be used to match the prefix, and the remaining two lists will repre... | glaive | [
0.022706761956214905,
0.027824275195598602,
-0.01973579078912735,
-0.05046109855175018,
0.05089152231812477,
-0.03173258528113365,
-0.02474377118051052,
0.04913346469402313,
0.028681935742497444,
-0.009254260919988155,
0.01918872259557247,
0.043786223977804184,
-0.01776006445288658,
-0.000... | 0.812319 | 0.79074 | 0.021579 |
You are tasked with implementing a Prolog program that simulates a water jug problem. The problem consists of three jugs labeled A, B, and C, with capacities 4, 3, and 7 liters, respectively. Initially, jug A is full (4L), while the other two jugs are empty (0L). Your task is to write a Prolog program that finds a sequ... | glaive | [
0.0034337739925831556,
0.019781019538640976,
-0.016481760889291763,
-0.03672505542635918,
0.03485631197690964,
-0.027132801711559296,
-0.026747148483991623,
0.05570278316736221,
0.02762138471007347,
-0.009534494951367378,
0.029815159738063812,
0.046810049563646317,
-0.02483740635216236,
-0... | 0.805254 | 0.785121 | 0.020134 |
I have a set of 1 million 5-dimensional points that I need to cluster into k groups, where k is significantly less than 1 million. Each cluster should be such that no two points within it are too far apart, possibly represented as bounding spheres with a specified radius. This implies that many clusters might contain o... | glaive | [
-0.017071068286895752,
0.04632401838898659,
-0.04221394285559654,
-0.021370911970734596,
0.022412335500121117,
-0.01921774260699749,
-0.03458140790462494,
0.03209641948342323,
0.03602883219718933,
-0.00793776847422123,
0.0020144847221672535,
0.016301309689879417,
-0.015547019429504871,
0.0... | 0.789513 | 0.772655 | 0.016857 |
You are tasked with creating a program that handles memory operations and atomic memory instructions in a computer system. Your program should be able to interpret different memory functions, such as load (Ld), store (St), load-reserved (Lr), store-conditional (Sc), and atomic memory operations (Amo). Additionally, it ... | glaive | [
0.034158289432525635,
0.00842638872563839,
-0.027104482054710388,
-0.024893270805478096,
0.04593713581562042,
-0.057507071644067764,
-0.022332781925797462,
0.08312390744686127,
0.03947879374027252,
-0.021295659244060516,
0.014620034955441952,
0.014764401130378246,
-0.023822925984859467,
0.... | 0.786802 | 0.768328 | 0.018473 |
How can I design an algorithm to find the least common ancestor of two given binary tree nodes? | glaive | [
-0.0066783232614398,
0.0223244559019804,
-0.037970613688230515,
-0.031102856621146202,
0.02086591348052025,
-0.022445499897003174,
-0.01184061262756586,
0.05805341526865959,
0.024598028510808945,
-0.023366115987300873,
0.018290529027581215,
0.017417456954717636,
-0.016609640792012215,
0.00... | 0.802872 | 0.782524 | 0.020348 |
You are tasked with writing a program to calculate the length of the n-th Zimin word, where a Zimin word is defined by the sequence A082215(n). The sequence is as follows: 1,3,7,15,31,63,127,255,511,1024,2050,4102,8206,16414,32830,65662,131326,262654,525310,1050622,2101246,4202494,8404990,16809982,33619966,67239934,134... | glaive | [
0.007714491803199053,
0.023433685302734375,
-0.01724739372730255,
-0.035530611872673035,
0.024525482207536697,
-0.024823488667607307,
-0.04593619704246521,
0.03571058437228203,
0.02937343902885914,
-0.02762863226234913,
0.020231734961271286,
0.01688448339700699,
-0.05251073092222214,
-0.00... | 0.824461 | 0.770512 | 0.053949 |
What is the most efficient way to calculate the average of a set of numbers in a programming algorithm? | glaive | [
0.020658345893025398,
0.014379257336258888,
-0.03255872428417206,
-0.03841133415699005,
0.03489511460065842,
-0.026698037981987,
-0.024241359904408455,
0.0334165021777153,
0.04234282672405243,
-0.05166621506214142,
0.00951300747692585,
0.02314508892595768,
-0.03027646243572235,
-0.00595176... | 0.784022 | 0.763467 | 0.020555 |
You are given a programming task to implement a data structure that supports two operations efficiently: update and get. The update operation takes two parameters, i and v, and updates the data structure at index i with the value v. The get operation takes one parameter, i, and returns the sum of all the values in the ... | glaive | [
0.02574623003602028,
0.02569841407239437,
-0.04529733583331108,
-0.022756269201636314,
0.029104270040988922,
-0.04191812127828598,
-0.03712886944413185,
0.08741501718759537,
0.03542323037981987,
-0.02401910349726677,
0.03274771571159363,
0.01381770707666874,
-0.027410952374339104,
-0.01048... | 0.826932 | 0.796652 | 0.03028 |
You are tasked with creating a PacMan clone in C64 Basic. Your goal is to implement a path planning routine for the game. The game involves moving a player (PacMan) and ghosts on a grid-based map. The player can move in four directions (north, south, east, west), and the ghosts also have their own movement logic.
Your... | glaive | [
0.014757837168872356,
0.022127483040094376,
-0.020189909264445305,
-0.016591280698776245,
0.019806157797574997,
-0.01008631568402052,
-0.005135997664183378,
0.05116323381662369,
0.033351823687553406,
-0.023395126685500145,
0.0275884997099638,
0.03260194510221481,
-0.010030525736510754,
-0.... | 0.799241 | 0.779166 | 0.020075 |
You are tasked with implementing a function that calculates the input gradients for a 2D transposed convolution operation. The function should take the output gradients (y) and the kernel as input, along with the strides and input size. The function should then compute the gradients with respect to the input data.
Wri... | glaive | [
0.009499221108853817,
0.041017599403858185,
-0.017713002860546112,
-0.025394583120942116,
0.04462850093841553,
-0.011027650907635689,
-0.02287665754556656,
0.10443184524774551,
0.028409773483872414,
-0.00305370707064867,
0.02218947373330593,
0.026192467659711838,
-0.02275647409260273,
0.00... | 0.801137 | 0.781914 | 0.019222 |
You are tasked with implementing a K-Nearest Neighbors (KNN) enactor using the Gunrock GPU Graph Library. The enactor is responsible for finding the K nearest neighbors for each node in a graph. This involves computing the distance between a reference point and all other points in the graph, sorting the distances, and ... | glaive | [
0.022962473332881927,
0.04738875478506088,
-0.015349957160651684,
-0.03534641116857529,
0.019208421930670738,
-0.03652648255228996,
-0.02534010075032711,
0.054415084421634674,
0.03755800798535347,
-0.004274087492376566,
0.032215118408203125,
0.04078484699130058,
-0.009660459123551846,
0.01... | 0.811412 | 0.795303 | 0.016109 |
You are tasked with implementing a CUDA kernel for a batched DSYRK operation on a GPU. The DSYRK operation computes a rank-k update of a symmetric matrix, i.e., C = alpha*A*A' + beta*C, where A is a matrix, alpha and beta are scalars, and C is the output matrix. The GPU kernel will be used to perform this operation in ... | glaive | [
0.012920316308736801,
0.05404278263449669,
-0.02662571333348751,
-0.02576863020658493,
0.007834373973309994,
-0.0024193229619413614,
-0.03491463512182236,
0.07467881590127945,
0.04170635715126991,
-0.019255300983786583,
0.02536918967962265,
0.03411030024290085,
-0.01926714926958084,
0.0099... | 0.79837 | 0.781135 | 0.017235 |
You are tasked with creating a program that utilizes the origami_path library to calculate the shortest path between two points on a map. The map is represented as a grid, with each cell containing a cost value. The program needs to find the path with the lowest cost from a given starting point to a destination point, ... | glaive | [
0.008508479222655296,
0.02886473946273327,
-0.02336644008755684,
-0.04442722350358963,
0.041214827448129654,
-0.025824513286352158,
-0.02896047569811344,
0.04967934265732765,
0.050854992121458054,
-0.012613008730113506,
0.033174917101860046,
0.01801128126680851,
0.008672956377267838,
-0.00... | 0.814608 | 0.776599 | 0.038009 |
You are required to implement a CUDA kernel function that will take in two inputs, each of type `SelectedRows` and perform an element-wise addition of their values, and store the result in an output `SelectedRows` object. The `SelectedRows` data structure contains a list of selected rows and their corresponding values.... | glaive | [
0.008484003134071827,
0.03559449315071106,
-0.035303402692079544,
-0.01434317510575056,
0.03834555670619011,
-0.020481834188103676,
-0.015297477133572102,
0.09144061803817749,
0.05677935481071472,
0.0013945481041446328,
0.02930639311671257,
0.03815050423145294,
-0.00653423834592104,
0.0033... | 0.810249 | 0.790653 | 0.019596 |
You are tasked with implementing a maze generation algorithm using a simple recursive backtracker. The goal is to create a program that generates a maze based on the given algorithm. The maze will be represented as a hex grid, with cells having walls that can be open or closed. The program should be able to modify cell... | glaive | [
0.01595347747206688,
0.027500228956341743,
-0.004859456792473793,
-0.04438644275069237,
0.03899182751774788,
-0.012795104645192623,
-0.025157378986477852,
0.07398779690265656,
0.028252646327018738,
-0.021367521956562996,
0.01922800950706005,
0.013469245284795761,
-0.03543711081147194,
-0.0... | 0.800081 | 0.768933 | 0.031148 |
You are tasked with creating a program to calculate the probability of a quantum state using a given amplitude function. The amplitude function is defined as follows:
amplitude[x_,y_] := (big long complex function)
You need to write a function to calculate the probability of a quantum state for given values of x and y... | glaive | [
0.0070184324868023396,
0.0344497375190258,
-0.02259656973183155,
-0.025960566475987434,
0.03963690996170044,
-0.0203519556671381,
-0.010682350024580956,
0.07187898457050323,
0.03841531276702881,
0.005634776782244444,
0.029821792617440224,
0.030568081885576248,
-0.015306557528674603,
-0.019... | 0.785239 | 0.756061 | 0.029179 |
You are tasked with creating a function that returns the nth prime number. The function should take in an integer n and return the nth prime number.
For example, if the input is 6, the output should be 13, as 13 is the 6th prime number.
Create the function nst_prime that takes in an integer n and returns the nth prim... | glaive | [
0.04591165482997894,
0.038302548229694366,
-0.014036232605576515,
-0.039090316742658615,
0.03761136159300804,
-0.03267255052924156,
-0.014799565076828003,
0.06139018386602402,
0.022518722340464592,
0.008633153513073921,
0.023211577907204628,
0.016863109543919563,
-0.03986696898937225,
-0.0... | 0.80006 | 0.773674 | 0.026386 |
You are tasked with creating a DE module generator for a queue of 8 links, QUEUE8-L, using the link-joint model. Your goal is to construct the module generator and prove the value and state lemmas for this module generator. Note that QUEUE8-L is a complex link constructed by concatenating two instances of QUEUE4-L via ... | glaive | [
0.031003450974822044,
0.003430005395784974,
-0.029848972335457802,
-0.04410931468009949,
0.009960336610674858,
-0.025710901245474815,
-0.041445765644311905,
0.06727871298789978,
0.03546050190925598,
-0.006637074518948793,
0.013586894609034061,
0.0548177994787693,
-0.027723949402570724,
0.0... | 0.804798 | 0.788408 | 0.016391 |
You are required to write a Fortran subroutine that will create a SWAN data file based on the input variables. The subroutine should take in several input parameters including var1, var2, mmax, nmax, covered, filnam, extr_var1, extr_var2, sumvars, and positiveonly. The subroutine should also include several local varia... | glaive | [
-0.0006257627974264324,
0.03742783144116402,
-0.03633781522512436,
-0.04638206586241722,
0.025884484872221947,
-0.01873880624771118,
-0.005990085192024708,
0.05012558400630951,
0.04128517955541611,
0.010982279665768147,
0.02044013701379299,
0.06838441640138626,
-0.004982228856533766,
-0.00... | 0.813638 | 0.79428 | 0.019358 |
You are given a quantum computing problem to calculate the probability of measuring a state for a quantum system with 15 qubits. The amplitude of the system is given by a complex function, and you need to find the maximum probability for 4 quantum states. You are also required to plot the probability distribution in 3D... | glaive | [
0.003422713605687022,
0.022935383021831512,
-0.03296248987317085,
-0.03130636736750603,
0.046616677194833755,
-0.016156185418367386,
-0.02666095457971096,
0.06442795693874359,
0.03526873514056206,
-0.00531228119507432,
0.023620983585715294,
0.023242704570293427,
-0.007490651682019234,
-0.0... | 0.801892 | 0.773694 | 0.028198 |
You are tasked with implementing a CUDA kernel function that computes the density of particles in a simulation using the Summation Density method. The goal is to calculate the density for each particle based on its position and the positions of its neighboring particles, using a given smoothing length and particle mass... | glaive | [
-0.004471196793019772,
0.050092265009880066,
-0.026378797367215157,
-0.03142344951629639,
0.037372902035713196,
-0.012529818341135979,
-0.030947532504796982,
0.07197009772062302,
0.04515744373202324,
-0.014487805776298046,
0.024753691628575325,
0.0427013598382473,
0.0010904655791819096,
0.... | 0.80118 | 0.780838 | 0.020341 |
You are tasked with implementing a program to perform Backward Euler time-marching on a 1D grid using CUDA for parallel processing. The program involves initializing arrays, performing computations on the GPU and CPU, and releasing memory.
The main program must allocate memory on the host and device, initialize arrays... | glaive | [
0.008502849377691746,
0.0458591990172863,
-0.016830122098326683,
-0.023079944774508476,
0.02477755956351757,
0.006188826635479927,
-0.031312569975852966,
0.09771226346492767,
0.04482491314411163,
-0.014891337603330612,
0.008586942218244076,
0.048828642815351486,
0.0031157764606177807,
0.00... | 0.806845 | 0.78419 | 0.022655 |
You are tasked with creating a program that will calculate the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 (denoted as 5!) is 5*4*3*2*1 = 120.
Write a C program that takes an integer input from t... | glaive | [
0.022495919838547707,
0.03681730851531029,
-0.024473246186971664,
-0.031019223853945732,
0.041324518620967865,
-0.03836015984416008,
-0.026481537148356438,
0.07357519119977951,
0.040144167840480804,
-0.02316007949411869,
0.016132760792970657,
0.04821544885635376,
-0.06228993460536003,
-0.0... | 0.806572 | 0.762458 | 0.044114 |
You are required to implement a max pool layer in a neural network using CUDA. The max pool layer is a crucial component of convolutional neural networks (CNNs) and is responsible for reducing the spatial dimensions of the input data. Your task is to create a class `MaxPoolLayer` in C++ which implements the functionali... | glaive | [
0.013571687042713165,
0.009137672372162342,
-0.01769397035241127,
-0.01005417201668024,
0.029132740572094917,
-0.012596376240253448,
-0.03294607251882553,
0.09681805223226547,
0.04265446215867996,
-0.02747362293303013,
0.0435008779168129,
0.03643183782696724,
-0.03175055608153343,
-0.00062... | 0.806882 | 0.790954 | 0.015928 |
You are tasked with implementing a piecewise defined function in a programming language of your choice. A piecewise defined function is a function that is defined by different algebraic formulas on different subsets of its domain. Your task is to create a function that takes an input value x and returns the correspondi... | glaive | [
0.014172753319144249,
0.022023899480700493,
-0.033719826489686966,
-0.023826638236641884,
0.0353260338306427,
-0.028233958408236504,
-0.011041032150387764,
0.07605396956205368,
0.037604957818984985,
0.0043336437083780766,
0.02569664642214775,
0.03702770546078682,
-0.02284930646419525,
-0.0... | 0.815848 | 0.797922 | 0.017926 |
You are tasked with implementing a pair hidden Markov model (HMM) forward algorithm using the HIP (Heterogeneous-Compute Interface for Portability) framework for parallel programming on GPUs. The goal is to calculate the likelihood of a sequence of observations given a sequence of states and transition probabilities. T... | glaive | [
0.012203065678477287,
0.02157418243587017,
-0.017320243641734123,
-0.023150114342570305,
0.040170684456825256,
0.008594168350100517,
-0.040167149156332016,
0.08310262858867645,
0.028977718204259872,
-0.02587488852441311,
0.0017860101070255041,
0.0426802933216095,
0.00688667967915535,
0.012... | 0.804462 | 0.777308 | 0.027154 |
You are tasked with implementing a CUDA kernel function that performs embedding gradient calculations. The function takes in several input parameters, including embedding indices, embedding output gradients, embedding gradients, indices size, stride size, and a padding index.
The kernel function x7 has already been d... | glaive | [
0.010264288634061813,
0.047145191580057144,
-0.007310640532523394,
-0.03749079629778862,
0.03789278119802475,
-0.01676131598651409,
-0.017975440248847008,
0.08032962679862976,
0.04237721487879753,
-0.02793179824948311,
0.017100896686315536,
0.0354645662009716,
-0.016375722363591194,
0.0050... | 0.801269 | 0.785118 | 0.016152 |
Write a function in a functional programming language that calculates the nth number in the Fibonacci sequence. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. Your function should take an integer n as input and return the nth numbe... | glaive | [
0.02267763391137123,
0.021182622760534286,
-0.029039746150374413,
-0.0393587164580822,
0.05460816249251366,
-0.018985850736498833,
-0.027927741408348083,
0.06099389120936394,
0.02877151407301426,
-0.00966927595436573,
0.020325111225247383,
0.034564308822155,
-0.03725162521004677,
-0.018782... | 0.809387 | 0.772858 | 0.036529 |
Can you provide an optimized C++ program to search for an element in an array of integers? | glaive | [
0.02333562634885311,
0.030084457248449326,
-0.039516668766736984,
-0.015313259325921535,
0.027735797688364983,
-0.03815441578626633,
-0.033444881439208984,
0.06412217020988464,
0.04835605248808861,
-0.04079117253422737,
0.021978717297315598,
0.023335998877882957,
-0.030765535309910774,
-0.... | 0.801161 | 0.782975 | 0.018186 |
You are tasked with implementing a network switch system using SystemVerilog. The switch consists of five modules: up_switch, down_switch, left_switch, right_switch, and local_switch. Each switch module receives a packet and forwards it to one of its neighboring switches based on the packet's x and y coordinates. If th... | glaive | [
0.023376068100333214,
0.025392327457666397,
-0.0334746427834034,
-0.015237545594573021,
0.02137499675154686,
-0.018698109313845634,
-0.03046838752925396,
0.06502681970596313,
0.03799133375287056,
-0.006022730376571417,
0.040988821536302567,
0.03884705528616905,
-0.014465700834989548,
-0.01... | 0.802355 | 0.784447 | 0.017909 |
You are tasked with implementing a program that generates a random number from a normal distribution and then computes the Cholesky factorization of the correlation matrix. The program should take a real number as input and then use it to generate the random number from the normal distribution. After that, it should co... | glaive | [
0.008813994005322456,
0.02104690857231617,
-0.04131804406642914,
-0.03078855760395527,
0.03983149304986,
-0.015459008514881134,
-0.02707226760685444,
0.04554954543709755,
0.04226041957736015,
-0.02548958919942379,
0.011398245580494404,
0.03339368849992752,
-0.030495019629597664,
0.00727136... | 0.805407 | 0.783932 | 0.021475 |
You are tasked with creating a function to calculate the nth Fibonacci number. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. You need to implement a function that takes an integer n as input and returns the nth number in the Fibon... | glaive | [
0.017931584268808365,
0.021188437938690186,
-0.022987689822912216,
-0.024276122450828552,
0.0497899129986763,
-0.01861456222832203,
-0.026414422318339348,
0.06566016376018524,
0.028759850189089775,
0.003526971908286214,
0.025223059579730034,
0.029449526220560074,
-0.04050785303115845,
-0.0... | 0.807808 | 0.765988 | 0.04182 |
You are tasked with creating a function in a programming language that takes two non-negative integers as input and checks if the first integer is less than the second integer. If the first integer is indeed less than the second integer, the function should return true; otherwise, it should return false. | glaive | [
0.0035940096713602543,
0.02075980231165886,
-0.034309323877096176,
-0.025188226252794266,
0.04313551262021065,
-0.0076696728356182575,
0.00175051752012223,
0.08280341327190399,
0.04102279618382454,
-0.020804163068532944,
0.014018307439982891,
0.0350206084549427,
-0.014462522231042385,
-0.0... | 0.823714 | 0.792516 | 0.031198 |
You are required to implement a CUDA kernel function to calculate the loss between neighboring occupancy status. The input to the kernel function is an array of occupancy status, and the output is an array of loss values. The loss is calculated based on the absolute difference between neighboring occupancy status.
The... | glaive | [
-0.006678371224552393,
0.05885464698076248,
-0.03721284493803978,
-0.022726405411958694,
0.02688412554562092,
-0.021896759048104286,
-0.03716057538986206,
0.07936472445726395,
0.05220342427492142,
-0.00551349064335227,
0.037334341555833817,
0.02131796069443226,
-0.013729726895689964,
0.018... | 0.812346 | 0.789065 | 0.023281 |
You have been tasked with implementing a subroutine to perform the symmetric rank 1 operation on a complex symmetric packed matrix. The operation is defined as follows:
A := alpha*x*x**H + A
Where alpha is a complex scalar, x is an n-element vector, and A is an n by n symmetric matrix, supplied in packed form.
You nee... | glaive | [
0.017283305525779724,
0.03639061376452446,
-0.02841055579483509,
-0.04503832757472992,
0.026713144034147263,
-0.03139342740178108,
-0.00410756841301918,
0.07626739889383316,
0.03646792098879814,
-0.02052505686879158,
0.027762917801737785,
0.03499216213822365,
-0.03286496177315712,
-0.01660... | 0.811082 | 0.783614 | 0.027468 |
Can you help me create an algorithm that finds all prime numbers within a given range of numbers? I want to check if each number in the range is prime or not. | glaive | [
0.02539714239537716,
0.0114963473752141,
-0.021723700687289238,
-0.029351450502872467,
0.028737325221300125,
-0.052740879356861115,
-0.005332605913281441,
0.03585727512836456,
0.024394817650318146,
-0.03292698413133621,
0.010153974406421185,
0.015168501064181328,
-0.034750644117593765,
-0.... | 0.801882 | 0.786064 | 0.015818 |
You are tasked with implementing a circuit evaluation function in Racket. A circuit can be represented as a triple (circ EQ I O), where I is a set of input wire names, O is a set of output wire names, and EQ is a set of equations defining the internal wire values. The circuit evaluation function should take in a set of... | glaive | [
0.006476394832134247,
0.024194547906517982,
-0.02220640890300274,
-0.03203404322266579,
0.04046677425503731,
-0.039710190147161484,
-0.007700644433498383,
0.059074584394693375,
0.035031452775001526,
-0.007153791841119528,
0.02834990620613098,
0.05493844673037529,
0.0004562644462566823,
-0.... | 0.792383 | 0.77501 | 0.017373 |
You are tasked with writing a program that takes in a string and returns the frequency of each character in the string. Your program should consider both uppercase and lowercase letters as the same character. Additionally, it should also count special characters and numerical digits.
For example:
Input: "Hello, World... | glaive | [
0.009088544175028801,
0.026012975722551346,
-0.01749390736222267,
-0.0355406254529953,
0.04277892783284187,
-0.027792055159807205,
0.00039464604924432933,
0.045821186155080795,
0.004594501573592424,
-0.01823919452726841,
0.015306956134736538,
0.02853626385331154,
-0.03471880406141281,
-0.0... | 0.804822 | 0.763223 | 0.041599 |
You are tasked with implementing a hash function using the Siphash algorithm in OCaml. Siphash uses the first 16 characters of a seed string to initialize/reset the hash state, padding it to the right with zero bytes if it's too short. The rest of the string is discarded. You need to write functions to allocate the has... | glaive | [
0.026140784844756126,
0.03229430317878723,
-0.0057038795202970505,
-0.028356602415442467,
0.03456525132060051,
-0.026254447177052498,
-0.0051543572917580605,
0.062191154807806015,
0.04463203251361847,
-0.019853385165333748,
0.03002420999109745,
0.024069827049970627,
-0.00873617548495531,
-... | 0.810692 | 0.794612 | 0.01608 |
You are tasked with implementing a function in C/C++ that involves using CUDA for parallel computing. The function should read an integer value N from a file called "tamanho_vetor", allocate memory for an array of integers, populate the array with values from 1 to N, and then perform certain operations using CUDA kerne... | glaive | [
0.013603714294731617,
0.05423981696367264,
-0.006061872001737356,
-0.036975182592868805,
0.020918361842632294,
-0.01270124688744545,
-0.05224023386836052,
0.11361728608608246,
0.03383251279592514,
-0.018583716824650764,
0.017019830644130707,
0.04281233996152878,
-0.010434914380311966,
-0.0... | 0.78342 | 0.765312 | 0.018108 |
How can I write a C++ program to print the numbers sequence: 0, 2, 4, 6, 8, ..? | glaive | [
0.018404653295874596,
0.02568812668323517,
-0.004053415730595589,
-0.025663087144494057,
0.03998229280114174,
-0.009681155905127525,
-0.03787379339337349,
0.09289535135030746,
0.03803033381700516,
-0.026064686477184296,
0.02021125517785549,
0.03884445130825043,
-0.027271568775177002,
-0.03... | 0.813741 | 0.785909 | 0.027832 |
You are required to create a program that performs a simple exclusive or inclusive scan on a set of elements. The scan should be performed using the given `MultiScan` struct, which contains an associative reduction operator for addition and max functions. The program should allow the user to specify the number of eleme... | glaive | [
0.029749900102615356,
0.03346683084964752,
-0.026480969041585922,
-0.03078874573111534,
0.041539233177900314,
-0.01640390418469906,
-0.004650660790503025,
0.07812483608722687,
0.05385225638747215,
0.003198967780917883,
0.019852295517921448,
0.04569431394338608,
-0.0060243732295930386,
-0.0... | 0.821305 | 0.805462 | 0.015843 |
You are tasked with finding all nonnegative integers k satisfying the condition cos(k) <= 0 and cos(k+1) >= 0. Your goal is to write a program that can efficiently determine these integers and output them in a list. | glaive | [
0.024379761889576912,
0.02845495194196701,
-0.02911270037293434,
-0.04439729452133179,
0.03754538297653198,
-0.023754574358463287,
-0.02284676767885685,
0.02811414748430252,
0.04378700628876686,
-0.02118007466197014,
0.03993106260895729,
0.026183558627963066,
-0.02035691775381565,
-0.01992... | 0.836976 | 0.79871 | 0.038266 |
You are tasked with finding the smallest positive number that is evenly divisible by all of the numbers from 1 to 20. In other words, you need to find the smallest number that can be divided by each of the numbers from 1 to 20 without any remainder. | glaive | [
0.003033614018931985,
0.01020282693207264,
-0.0322842001914978,
-0.04645723104476929,
0.04184113070368767,
-0.03527689352631569,
-0.025446351617574692,
0.03600327670574188,
0.03180588036775589,
-0.022983279079198837,
0.015827253460884094,
0.03398982435464859,
-0.04162385314702988,
-0.00739... | 0.812179 | 0.769139 | 0.04304 |
You are tasked with creating a program that manipulates and organizes data for a content management system. Specifically, you need to write a function that takes in a JSON object representing a folder in the system and returns the number of children the folder contains.
For example, the input JSON object may look like... | glaive | [
-0.009734287858009338,
0.018376551568508148,
-0.05132698640227318,
-0.03375700116157532,
0.026499733328819275,
-0.030600203201174736,
-0.02708342857658863,
0.04803775995969772,
0.03674229606986046,
-0.019390249624848366,
0.03303970396518707,
0.03050723858177662,
-0.0420936718583107,
0.0117... | 0.802931 | 0.788249 | 0.014683 |
You are given a list of intervals, where each interval is represented by a pair of integers [start, end]. Your task is to merge overlapping intervals and return a new sorted list of non-overlapping intervals. If there are no overlapping intervals, simply return the original list.
Write a function called `merge` that ... | glaive | [
0.0403941310942173,
0.02452697418630123,
-0.007425720803439617,
-0.023062588647007942,
0.03347301483154297,
0.002248970093205571,
-0.021923329681158066,
0.040331412106752396,
0.044733885675668716,
-0.008750342763960361,
0.03205527737736702,
0.01694762520492077,
-0.026245644316077232,
-0.02... | 0.807554 | 0.777257 | 0.030296 |
You are required to implement a function that performs tensor joining on GPU. The function should take in multiple input tensors and concatenate them along a specified axis to produce a single output tensor. The input tensors are represented as a list of tensor shapes.
Write a function that takes the following paramet... | glaive | [
0.029813721776008606,
0.03917737677693367,
-0.003587851533666253,
-0.021504931151866913,
0.02698574587702751,
0.00596722774207592,
-0.02253222092986107,
0.05120168998837471,
0.03466208651661873,
0.0030456739477813244,
0.024069825187325478,
0.030957084149122238,
-0.0031251157633960247,
0.00... | 0.786083 | 0.76451 | 0.021573 |
You are tasked with implementing a function to find the range of integers between two given numbers. The `range` function should take two integers, `i` and `j`, and return a list of integers between `i` (inclusive) and `j` (exclusive). For example, if `i` is 2 and `j` is 5, the function should return a list containing ... | glaive | [
0.03905658796429634,
0.023163141682744026,
-0.03023742511868477,
-0.015994109213352203,
0.046209707856178284,
-0.02526760846376419,
-0.007293261121958494,
0.04702310264110565,
0.04397474601864815,
-0.01833408698439598,
0.0230674110352993,
0.062185898423194885,
-0.01878327503800392,
-0.0116... | 0.807159 | 0.783018 | 0.024141 |
You are tasked with creating a Python function that takes in a list of integers and returns the maximum and minimum values in the list. The function should be named find_max_min and should take in one parameter: a list of integers. The function should return a tuple containing the maximum and minimum values in the list... | glaive | [
0.0349079854786396,
0.021820446476340294,
-0.03594585880637169,
-0.0521678626537323,
0.04712609201669693,
-0.02366318553686142,
-0.02881624922156334,
0.030611466616392136,
0.02125479280948639,
-0.008695147931575775,
0.03299201652407646,
0.03870062902569771,
-0.02761470526456833,
-0.0045771... | 0.806906 | 0.751337 | 0.055569 |
You are tasked with implementing a subroutine in Fortran called PREP_INT, which is responsible for processing integer data fields. The subroutine takes in several input parameters such as the integer array IA, the number of values in the array NVAL, flags for primary and secondary missing values JMISSP and JMISSS, scal... | glaive | [
0.020046647638082504,
0.021907992660999298,
-0.02027580887079239,
-0.037078313529491425,
0.03556453064084053,
-0.023339375853538513,
0.006869136355817318,
0.07435207068920135,
0.04394909366965294,
-0.0049704816192388535,
0.003724003443494439,
0.037179235368967056,
-0.01211803313344717,
0.0... | 0.801041 | 0.782065 | 0.018976 |
You are tasked with implementing a Java program that utilizes the Stream API to perform specific operations on a given set of strings and integers. Your program should be able to:
1. Use the takeWhile method to stop iterating through a stream of strings when encountering an empty string, and then print the concatenated... | glaive | [
0.004790244624018669,
0.03073609620332718,
-0.00922335870563984,
-0.018009567633271217,
0.042708080261945724,
-0.04539461433887482,
-0.0237790085375309,
0.046361032873392105,
0.031369201838970184,
-0.014933407306671143,
0.02702009119093418,
0.015377976931631565,
-0.04886050894856453,
-0.01... | 0.816919 | 0.787432 | 0.029487 |
You are tasked with implementing a CUDA kernel function that takes in an array of floats and a scalar value, and then divides each element of the array by the scalar value. The CUDA kernel function should be able to handle a large number of elements in the array and efficiently parallelize the division operation using ... | glaive | [
0.020672639831900597,
0.05402779206633568,
-0.020652318373322487,
-0.02763172797858715,
0.0430620014667511,
-0.011135131120681763,
-0.02669554017484188,
0.11301320046186447,
0.03977888822555542,
-0.02409624122083187,
0.029647674411535263,
0.04001225158572197,
-0.016706496477127075,
0.00937... | 0.801996 | 0.787327 | 0.014669 |
You are tasked with implementing a linear combination planar complex operation using CUDA. The linear combination is defined as:
output = alpha * accum + beta * source, where alpha and beta are complex numbers, and accum and source are arrays of planar complex numbers. Your task is to write a CUDA kernel function that... | glaive | [
0.008898137137293816,
0.05337139964103699,
-0.02505452185869217,
-0.03106500767171383,
0.032977864146232605,
-0.0008469792082905769,
-0.025450803339481354,
0.10155865550041199,
0.05451736971735954,
-0.003735471284016967,
0.03404003009200096,
0.05622941628098488,
-0.001230441965162754,
-0.0... | 0.809258 | 0.788833 | 0.020425 |
You are tasked with implementing a C++ class that allows for manipulation of data on a CUDA device. The class, `CudaPaddleTensor`, is designed to work with CUDA tensors and perform various operations on them. Your task is to implement the following member functions in the `CudaPaddleTensor` class:
- `add` : Add two CUD... | glaive | [
0.022189844399690628,
0.028755152598023415,
-0.007998899556696415,
-0.022086089476943016,
0.04197004809975624,
-0.021829023957252502,
-0.01777346432209015,
0.10853950679302216,
0.0578472800552845,
-0.011950161308050156,
0.02068213000893593,
0.04600013047456741,
-0.005477018188685179,
-0.01... | 0.795953 | 0.781646 | 0.014307 |
You are tasked with implementing a Fortran subroutine that solves a complex system of linear equations using the LAPACK routine ZPTSV. The subroutine takes in several input arguments, including the order of the matrix A (N), the number of right-hand sides (NRHS), the diagonal elements of the tridiagonal matrix (D), the... | glaive | [
0.029552333056926727,
0.026087038218975067,
-0.01938754878938198,
-0.04061943292617798,
0.05312870070338249,
-0.012679565697908401,
0.01670510321855545,
0.05414564535021782,
0.02874036319553852,
-0.026749305427074432,
0.00497574545443058,
0.046807512640953064,
-0.02810744009912014,
0.00126... | 0.806301 | 0.779568 | 0.026733 |
I am developing a Java program and I need help with a specific function. The function should take in an array of integers and an integer 'n' as parameters. The task is to output the 'n' number of maximal elements found within this given array. However, I am not allowed to use any built-in sorting functions. Can you pro... | glaive | [
0.026934104040265083,
0.02808033488690853,
-0.0532139427959919,
-0.009935627691447735,
0.031235478818416595,
-0.030757296830415726,
-0.024222617968916893,
0.050294969230890274,
0.027277154847979546,
-0.029268428683280945,
0.027323564514517784,
0.03615302965044975,
-0.04033442586660385,
-0.... | 0.819668 | 0.794294 | 0.025374 |
You are tasked with implementing a quantum circuit simulation for a given number of qubits and states. The goal is to calculate the probability of measuring each state of the system and find the maximum probability using simulated annealing optimization.
You need to define the amplitude and probability functions based... | glaive | [
-0.003388154786080122,
0.021148189902305603,
-0.0355289988219738,
-0.01749272644519806,
0.0384259857237339,
-0.028781410306692123,
-0.0253810565918684,
0.06761649250984192,
0.021744297817349434,
-0.007622541394084692,
0.01908765360713005,
0.036368660628795624,
-0.004627458285540342,
-0.000... | 0.801752 | 0.7731 | 0.028652 |
You are tasked with creating a JavaScript function that will calculate the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n.
Your function should take a single parameter, n, and return the factorial of n as the output.
Write a JavaS... | glaive | [
0.028411101549863815,
0.030690312385559082,
-0.0271536186337471,
-0.021169297397136688,
0.05176856741309166,
-0.02989540621638298,
-0.02032887563109398,
0.04705975949764252,
0.05068238452076912,
-0.007865761406719685,
0.016083505004644394,
0.042390793561935425,
-0.04365170747041702,
-0.016... | 0.799331 | 0.768565 | 0.030766 |
You are tasked with creating a program that generates a specific sequence based on the following rules:
- The sequence is defined as a(n) = 2 + 3 * A001519(n+1), where A001519 is a separate sequence.
- The sequence should start with 5, 8, 17, 41, 104, 269, 701, 1832, 4793, 12545, ...
Your task is to write a program t... | glaive | [
0.03579088672995567,
0.021060992032289505,
-0.02256046235561371,
-0.03444892540574074,
0.026659125462174416,
-0.024675805121660233,
-0.042571671307086945,
0.08268649131059647,
0.023729030042886734,
-0.024133196100592613,
0.03364826366305351,
0.0347423329949379,
-0.051024891436100006,
-0.00... | 0.828733 | 0.789821 | 0.038913 |
You are tasked with creating a function to find the median of two sorted arrays. The function should take in two lists of integers, nums1 and nums2, and return the median of the combined sorted array.
For example, if the input is nums1 = [1, 3] and nums2 = [2], the output should be 2.0. If the input is nums1 = [1] and... | glaive | [
0.02209768071770668,
0.013544169254601002,
-0.044361524283885956,
-0.04045510292053223,
0.03136138617992401,
-0.005269556771963835,
-0.04066426679491997,
0.04923698678612709,
0.03246823698282242,
-0.017686618492007256,
0.03228045254945755,
0.015727614983916283,
-0.02477143332362175,
-0.013... | 0.796019 | 0.76023 | 0.03579 |
You are tasked with implementing a program to perform numerical integration in C++ using CUDA. The goal is to integrate a given function over a specified volume using the GPUcuhre algorithm. The CUDA code snippet provided includes the necessary components for the integration, such as the definition of the function to b... | glaive | [
0.0189104825258255,
0.03393875062465668,
-0.011199808679521084,
-0.03280574828386307,
0.01823042705655098,
0.01168664637953043,
-0.022255415096879005,
0.09995433688163757,
0.0595780573785305,
-0.02072174847126007,
0.019937848672270775,
0.030625052750110626,
0.0056714327074587345,
-0.005455... | 0.79182 | 0.772277 | 0.019543 |
You are tasked with implementing a program that tests the efficiency of three different algorithms for Dirichlet conjugacy. The algorithms are named "dice index", "gmm gibbs", and "naive bayes gibbs". You are given the code snippets for each algorithm, and your task is to write a program that tests the efficiency of th... | glaive | [
0.0005608113133348525,
0.01144911628216505,
-0.008293421007692814,
-0.034714605659246445,
0.01578076370060444,
-0.02012946829199791,
-0.021371763199567795,
0.05440530925989151,
0.036217641085386276,
-0.00998577382415533,
0.004706437233835459,
0.023080507293343544,
-0.021437985822558403,
-0... | 0.807404 | 0.78096 | 0.026445 |
You are tasked with implementing a Fortran subroutine to solve a real generalized symmetric-definite eigenproblem. The subroutine should compute all the eigenvalues and, optionally, the eigenvectors of the problem. The problem type to be solved is specified by the variable `ITYPE`, which can take on values 1, 2, or 3. ... | glaive | [
0.015325712040066719,
0.02455754578113556,
-0.03491708263754845,
-0.050491683185100555,
0.02394017204642296,
-0.007604376412928104,
0.008962959982454777,
0.06592636555433273,
0.04231636971235275,
-0.013570968061685562,
0.01891181245446205,
0.03874967247247696,
-0.02940320409834385,
-0.0045... | 0.813186 | 0.789345 | 0.02384 |
You are tasked with implementing a function to check if a given list of integers represents a valid Narayana path. A Narayana path is a sequence of integers that starts with 1, ends with -1, and has a total length of 2*len, where len is a positive integer. Additionally, the path must have exactly "peaks" occurrences of... | glaive | [
0.025533482432365417,
0.017113784328103065,
-0.018473682925105095,
-0.017560305073857307,
0.025411318987607956,
-0.02592162974178791,
0.004065701737999916,
0.08598960191011429,
0.008511707186698914,
-0.01374140102416277,
0.01811770163476467,
0.030434945598244667,
-0.012841001152992249,
-0.... | 0.824799 | 0.783794 | 0.041006 |
You are tasked with creating a function in F# that takes a list of integers and returns the sum of all the even numbers in the list. | glaive | [
0.020862748846411705,
0.019546715542674065,
-0.026274172589182854,
-0.06551825255155563,
0.045199885964393616,
-0.029413634911179543,
-0.011756558902561665,
0.03576185926795006,
0.033489156514406204,
-0.019461913034319878,
0.012678501196205616,
0.05294657126069069,
-0.049520138651132584,
-... | 0.808154 | 0.773488 | 0.034666 |
You are working with a commutative monoid and need to define a function to check whether one element divides another. You want to implement the function `check_divisibility` that takes two elements `a` and `b` of the monoid and returns true if `a` divides `b`, and false otherwise. The divisibility relation is defined a... | glaive | [
0.03495945781469345,
0.03462199494242668,
-0.0292682908475399,
-0.02329001948237419,
0.04322756826877594,
-0.04406892880797386,
0.011218526400625706,
0.09983827918767929,
0.038304124027490616,
-0.021668529137969017,
0.009903199039399624,
0.022746900096535683,
0.0008196003618650138,
0.00134... | 0.821933 | 0.797819 | 0.024114 |
You are tasked with creating a program that calculates the probability amplitudes for a given set of quantum states. The program should be able to take in the number of qubits, the name of the quantum system, and the number of quantum states as inputs. It should then calculate the probability amplitudes using the given... | glaive | [
0.006544455420225859,
0.03275658190250397,
-0.02963167428970337,
-0.021065618842840195,
0.03799758851528168,
-0.032234903424978256,
-0.0212684478610754,
0.06450730562210083,
0.02617277018725872,
-0.011192075908184052,
0.018286067992448807,
0.03829516842961311,
-0.02087417058646679,
-0.0134... | 0.799929 | 0.76759 | 0.032338 |
You are tasked with implementing a function in Elm that takes a list of integers as input and returns the sum of all the integers in the list. The function should be named "sumList" and should be defined within the Elm.Parser.Declarations module. | glaive | [
0.0044715930707752705,
0.022907661274075508,
-0.027619319036602974,
-0.05638466402888298,
0.0480191670358181,
-0.042534347623586655,
-0.009703477844595909,
0.022522225975990295,
0.04252350702881813,
-0.01616513356566429,
0.025257036089897156,
0.055207882076501846,
-0.019136449322104454,
-0... | 0.804305 | 0.786693 | 0.017612 |
You are tasked with creating a program to analyze musical notes and guess the musical key. The program should take a list of musical notes as input and output the most likely musical key based on the notes provided. The key should be determined using the Krumhansl-Schmuckler-Temperley key finding algorithm, which calcu... | glaive | [
0.022725097835063934,
0.04357939586043358,
-0.04118825122714043,
-0.014485049061477184,
0.037438321858644485,
-0.030735168606042862,
-0.005146078299731016,
0.06192595884203911,
0.03162911534309387,
-0.0024646534584462643,
0.043539442121982574,
0.014591862447559834,
-0.03413859009742737,
0.... | 0.808701 | 0.785083 | 0.023618 |
You are given a binary tree and are required to find the length of its diameter. The diameter of a tree is defined as the number of nodes on the longest path between any two leaf nodes. It is important to note that the diameter of a tree may or may not pass through the root. You can assume that there are at least two l... | glaive | [
-0.006522938143461943,
0.022790350019931793,
-0.04178885743021965,
-0.03264236077666283,
0.03620539978146553,
-0.038406774401664734,
-0.019675787538290024,
0.052569009363651276,
0.029981806874275208,
-0.0029095804784446955,
0.031448159366846085,
0.023619214072823524,
-0.03658243641257286,
... | 0.789825 | 0.756478 | 0.033347 |
Can you provide a code that sorts a given list of numbers based on their modulo 3? | glaive | [
0.03014940768480301,
0.006751751992851496,
-0.021833721548318863,
-0.041562143713235855,
0.048906292766332626,
-0.033936407417058945,
-0.01934581622481346,
0.030273037031292915,
0.019499771296977997,
-0.022887341678142548,
0.024715784937143326,
0.05166817829012871,
-0.06849685311317444,
-0... | 0.80609 | 0.785694 | 0.020397 |
You are tasked with creating a program to solve the All-Pairs Shortest Path (APSP) problem using a multi-search algorithm. The goal is to find the shortest path from every vertex to every other vertex in a given graph. The program should allow the user to choose from different parallel algorithms to run, including line... | glaive | [
0.009144614450633526,
0.0048963408917188644,
-0.019564669579267502,
-0.015363890677690506,
0.019845109432935715,
-0.018945811316370964,
-0.030269332230091095,
0.05185762420296669,
0.021128591150045395,
-0.021059099584817886,
0.027474675327539444,
0.03143154829740524,
0.0037781151477247477,
... | 0.815466 | 0.782053 | 0.033413 |
You are tasked with implementing a function to compute the mean of an input matrix. The mean operation is assumed to be performed on a given column. The function should take the following parameters:
- `mu`: the output mean vector
- `data`: the input matrix
- `D`: number of columns of data
- `N`: number of rows of data... | glaive | [
0.002857402665540576,
0.02708500437438488,
-0.046508826315402985,
-0.039051834493875504,
0.04649696499109268,
-0.025039207190275192,
-0.031648166477680206,
0.07772040367126465,
0.035753220319747925,
-0.007119585759937763,
0.024456020444631577,
0.013208437711000443,
-0.004743880592286587,
-... | 0.785405 | 0.766277 | 0.019128 |
You are tasked with implementing a CUDA kernel to perform adaptive average pooling for a given input tensor. The goal is to take a 4-dimensional input tensor and compute the adaptive average pooling operation to produce a 4-dimensional output tensor.
The input tensor has the shape (N, C, H, W), where:
- N is the batch... | glaive | [
0.00556154502555728,
0.034150563180446625,
-0.0178709514439106,
-0.006613548845052719,
0.02471311390399933,
-0.030042190104722977,
-0.033770740032196045,
0.09191842377185822,
0.052605994045734406,
-0.010960949584841728,
0.03634797781705856,
0.019595080986618996,
-0.014364562928676605,
0.00... | 0.80346 | 0.78704 | 0.01642 |
You are tasked with creating a simple HTML table using Java Server Pages (JSP). The table should have a specific structure and styling, with different levels of hierarchy for the table rows and columns. The table should include headers, sub-headers, and content cells.
Create a JSP file that generates an HTML table wi... | glaive | [
0.024280857294797897,
0.019464612007141113,
-0.030576182529330254,
-0.02127445489168167,
0.028452295809984207,
-0.05576144531369209,
0.00796150229871273,
0.060336291790008545,
0.042070817202329636,
-0.012203829362988472,
0.030967727303504944,
0.02889399603009224,
-0.040738608688116074,
0.0... | 0.776607 | 0.761258 | 0.015349 |
You are tasked with writing a program that can parse a given RNA sequence and its secondary structure information. The RNA sequence is represented by a string of characters, where each character is either 'A', 'U', 'G', or 'C'. The secondary structure information is represented by a dot-bracket notation string, where e... | glaive | [
0.019534602761268616,
0.011846307665109634,
-0.018207190558314323,
-0.044621631503105164,
0.02731136791408062,
-0.04185286909341812,
-0.027443889528512955,
0.07294358313083649,
0.029108284041285515,
-0.012585499323904514,
0.010160853154957294,
0.017751511186361313,
-0.023884743452072144,
0... | 0.800796 | 0.774526 | 0.026271 |
Can you provide a C++ function that takes two strings as parameters and returns the length of the longest common subsequence between them? | glaive | [
0.007466103415936232,
0.013127748854458332,
-0.03615346923470497,
-0.038851190358400345,
0.02869267575442791,
-0.02237117663025856,
-0.02441497892141342,
0.05766335129737854,
0.03738357126712799,
-0.03476431965827942,
0.024164825677871704,
0.03803811967372894,
-0.027716470882296562,
-0.008... | 0.814473 | 0.796113 | 0.018361 |
You are tasked with creating a program to generate transformed data based on a given set of parameters and then infer the parameters from the generated data.
The program should:
- Generate transformed data using the following parameters:
- N = 50 (number of rows)
- M = 100 (number of columns)
- x (N x M matrix)... | glaive | [
0.016890013590455055,
0.012021958827972412,
-0.03703993931412697,
-0.0436822883784771,
0.04015611484646797,
-0.03669528290629387,
-0.012610659003257751,
0.06380531936883926,
0.03267158940434456,
-0.014598941430449486,
0.010943126864731312,
0.0294264517724514,
-0.03140004351735115,
-0.00015... | 0.803321 | 0.781604 | 0.021717 |
You are tasked with creating a program that implements a distributed array in C++ using the DistributedArrayTest.h framework. The distributed array should be able to store and retrieve data across multiple nodes in a distributed system. The program should include functions for initializing the distributed array, adding... | glaive | [
0.023093871772289276,
0.030066899955272675,
-0.01275812741369009,
-0.03577621281147003,
0.033758942037820816,
-0.02669179067015648,
-0.019128140062093735,
0.09748490899801254,
0.03706846386194229,
-0.015653353184461594,
0.022599631920456886,
0.03526227921247482,
-0.029221219941973686,
0.00... | 0.787599 | 0.765716 | 0.021883 |
You are tasked with implementing a GPU-based nearest neighbor and bilinear resizing operation for a deep learning framework using CUDA in C++. The resizing operation takes in an input tensor with shape (batch, channels, height, width) and resizes it to a specified output shape using either nearest neighbor or bilinear ... | glaive | [
0.014651254750788212,
0.053118929266929626,
-0.01831449382007122,
-0.0389474518597126,
0.019498929381370544,
0.0030472325161099434,
-0.024032261222600937,
0.10575763136148453,
0.04502353072166443,
-0.017967049032449722,
0.035751823335886,
0.037907250225543976,
-0.000835988437756896,
0.0148... | 0.800421 | 0.784642 | 0.015779 |
You are given a file `day22.txt` containing a list of regions in a 3D space. Each region is defined by its boundaries along the x, y, and z axes, as well as a boolean value indicating whether the region is "on" or "off". The file contains data in the format:
```
on x=10..12,y=10..12,z=10..12
on x=11..13,y=11..13,z=11..... | glaive | [
0.02533531002700329,
0.047688551247119904,
-0.04466395452618599,
-0.035698384046554565,
0.02889285422861576,
-0.04000358656048775,
-0.015099529176950455,
0.06545288115739822,
0.019100043922662735,
-0.006871845107525587,
0.03375590965151787,
0.03646596521139145,
-0.018004143610596657,
-0.01... | 0.810755 | 0.782963 | 0.027792 |
Can you provide a solution to assign a numerical score to each character in a given string? | glaive | [
0.007822602055966854,
0.005112670827656984,
-0.00838372390717268,
-0.0424199104309082,
0.03558152914047241,
-0.0537254735827446,
-0.0007188701420091093,
0.019263941794633865,
0.0333610400557518,
-0.033593349158763885,
0.011519853956997395,
0.030115563422441483,
-0.04060288518667221,
-0.016... | 0.796972 | 0.778029 | 0.018943 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.