instruction_seed stringlengths 43 8.03k | source stringclasses 1
value | embeddings listlengths 1.02k 1.02k | mean_positive_score float64 0.73 0.85 | mean_negative_score float64 0.71 0.82 | difference_score float64 0.01 0.07 |
|---|---|---|---|---|---|
You are tasked with implementing a function to count the number of truncated elements in a matrix, as well as calculate the new row sums after truncation. The matrix is represented in Compressed Sparse Row (CSR) format.
The function should take the following inputs:
1. A matrix A in CSR format with dimensions N x N
2.... | glaive | [
0.01679975725710392,
0.024280639365315437,
-0.025590870529413223,
-0.036486249417066574,
0.05833413451910019,
-0.010157497599720955,
-0.02032133750617504,
0.06754649430513382,
0.042102959007024765,
0.0033883508294820786,
0.0017453287728130817,
0.017116578295826912,
-0.028526805341243744,
-... | 0.817549 | 0.772922 | 0.044627 |
You are required to implement a CUDA kernel function to calculate the dihedral forces for a molecular dynamics simulation. The dihedral force calculation involves several mathematical operations and vector manipulations, and the code needs to be parallelized using CUDA for efficient execution on a GPU.
The main elemen... | glaive | [
0.01909690909087658,
0.056091632694005966,
-0.011706169694662094,
-0.029222935438156128,
0.029890645295381546,
-0.012314826250076294,
-0.026373950764536858,
0.09486536681652069,
0.048491090536117554,
-0.014424965716898441,
0.022893298417329788,
0.03564605489373207,
-0.015194443985819817,
-... | 0.795161 | 0.774856 | 0.020306 |
Write a function in C programming language that takes an integer parameter and returns the number of threads for a specific operation. The function should handle different cases for different values of the input parameter.
Write three functions:
1. get_hessenbergreduction_MWBthreads_num(int n) that returns the numbe... | glaive | [
0.03317181020975113,
0.03240075334906578,
-0.03383887559175491,
-0.01155837532132864,
0.03740430995821953,
-0.025277920067310333,
-0.04348061978816986,
0.09187266230583191,
0.02717275731265545,
-0.0014388130512088537,
0.006630258169025183,
0.03711152449250221,
-0.03260011598467827,
-0.0147... | 0.815889 | 0.788739 | 0.02715 |
You are given a set of binary strings, each of the same length. Your task is to find the most common bit at each position, and then combine these bits into two new binary strings.
Write a function that takes in the following parameters:
- An array of binary strings, represented as an array of arrays of u8. Each inner... | glaive | [
0.004244561772793531,
0.03217623755335808,
-0.02671993523836136,
-0.01988941617310047,
0.04015225172042847,
-0.03151733800768852,
-0.026386519894003868,
0.05871124938130379,
0.032439302653074265,
-0.012542716227471828,
0.019175516441464424,
0.013488980010151863,
-0.01989438384771347,
-0.01... | 0.828768 | 0.784136 | 0.044632 |
You are tasked with optimizing a complex multivariable function and visualizing its behavior in a 3D plot and a contour plot. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[6 I y] (Exp[6 I y] (Cos[x]^6 + (I Sin[x])^6) + Exp[2 I y] (6 (I Sin[x])^1 Cos[x]^5 + 6 (I Sin[x])^5 Cos[x]^1 + 6 (I Sin[x])... | glaive | [
0.008793951943516731,
0.03219826519489288,
-0.056066788733005524,
-0.03600744903087616,
0.03345518559217453,
-0.022671855986118317,
-0.031559836119413376,
0.056997913867235184,
0.053406864404678345,
0.010466775856912136,
0.02156875655055046,
0.03729736804962158,
-0.029833141714334488,
-0.0... | 0.796973 | 0.769544 | 0.027429 |
You are tasked with implementing a non-backtrackable data structure in Prolog. Specifically, you need to create a module that contains functions to work with Queues, Heaps, and Beam data structures using global non-backtrackable variables.
Your task is to create the following functions within the module:
- nb_create_a... | glaive | [
0.034615982323884964,
0.020832311362028122,
-0.030227839946746826,
-0.03931014612317085,
0.03523971140384674,
-0.030194777995347977,
-0.010368422605097294,
0.07050704210996628,
0.03623714670538902,
-0.012546929530799389,
0.028733626008033752,
0.039281051605939865,
-0.009611841291189194,
0.... | 0.81291 | 0.79628 | 0.01663 |
You are given a list of integers representing the input on a specific day. You need to find the sum of all the digits that match the digit halfway around the circular list. For example, for the input "123123", the sum would be 12, as the first 3 matches the 3rd digit and the second 3 matches the 6th digit.
Write a pro... | glaive | [
-0.007909071631729603,
0.024724170565605164,
-0.04658352956175804,
-0.04805755615234375,
0.04097771644592285,
-0.03159298375248909,
-0.021829912438988686,
0.011077233590185642,
0.028306080028414726,
-0.01754130981862545,
0.02333771251142025,
0.03875169903039932,
-0.02474026009440422,
-0.01... | 0.827948 | 0.781133 | 0.046815 |
You are tasked with creating a module that solves "criss-cross" puzzles, where a list of words must be fitted into a crossword grid. The grid is represented as a character array, with spaces represented as #"#" and puzzle walls as #" ". The module should be able to find all gaps in the grid where a word can fit, determ... | glaive | [
0.019921666011214256,
0.012485116720199585,
-0.011178809218108654,
-0.052971672266721725,
0.03799949958920479,
-0.02539888583123684,
-0.028184780851006508,
0.04621460661292076,
0.028860775753855705,
-0.0280710868537426,
0.0006275531486608088,
0.0239702258259058,
-0.02628740668296814,
-0.00... | 0.815798 | 0.794521 | 0.021276 |
Can you please provide a Java function that checks whether an array of integers contains a duplicate value? | glaive | [
0.0020054904744029045,
0.022642873227596283,
-0.03631237894296646,
-0.02336166612803936,
0.02589082159101963,
-0.04200279340147972,
-0.003255204064771533,
0.05869229510426521,
0.020883720368146896,
-0.04892192780971527,
0.021935129538178444,
0.0013517957413569093,
-0.02597314491868019,
-0.... | 0.805791 | 0.791117 | 0.014673 |
You are tasked with creating a class in C# called "Calculator" that has the following functionalities:
1. A method called "Add" that takes in two integers as parameters and returns their sum.
2. A method called "Subtract" that takes in two integers as parameters and returns their difference.
3. A method called "Multipl... | glaive | [
0.047774698585271835,
0.034070421010255814,
-0.022226568311452866,
-0.03273889049887657,
0.053208570927381516,
-0.051895566284656525,
-0.013918018899857998,
0.08056578785181046,
0.05456880107522011,
-0.02696395106613636,
0.026487601920962334,
0.0431157648563385,
-0.034773897379636765,
-0.0... | 0.78021 | 0.764468 | 0.015742 |
You are required to create a program that takes a series of hexadecimal strings and converts them to binary blobs, following a specific set of rules. The program should be able to handle both positive and negative values. The output should be in the format specified in the given code snippet. | glaive | [
-0.0095708342269063,
0.027780406177043915,
-0.008847285993397236,
-0.024406883865594864,
0.03579145669937134,
-0.05689632147550583,
-0.028360916301608086,
0.05798150971531868,
0.04372495785355568,
-0.0323757641017437,
0.024324463680386543,
0.02569917030632496,
-0.029928022995591164,
-0.026... | 0.79597 | 0.778229 | 0.017741 |
You are tasked with implementing a Fortran subroutine that utilizes the "contiguous" attribute to manipulate arrays. The subroutine should accept an integer array as input, and perform various operations on the array using the "contiguous" attribute. Specifically, the subroutine should call another subroutine "foo" and... | glaive | [
0.029792096465826035,
0.03753228858113289,
-0.008749888278543949,
-0.04519537091255188,
0.030976422131061554,
-0.019635479897260666,
-0.016468560323119164,
0.07441329956054688,
0.027958272024989128,
0.00115773337893188,
0.011378832161426544,
0.04445056617259979,
-0.031249625608325005,
0.00... | 0.817967 | 0.778525 | 0.039442 |
You are tasked with implementing a Fortran subroutine that can compute the eigenvalues of a Hessenberg matrix. The subroutine should also be able to compute the matrices T and Z from the Schur decomposition H = Z T Z^T, where T is an upper quasi-triangular matrix (the Schur form), and Z is the orthogonal matrix of Schu... | glaive | [
0.0073353019542992115,
0.03192461282014847,
-0.01934550330042839,
-0.04685955494642258,
0.03991425409913063,
-0.011029339395463467,
-0.010333605110645294,
0.0557987205684185,
0.03205658867955208,
-0.014840141870081425,
0.0138398427516222,
0.03706549480557442,
-0.029131930321455002,
-0.0179... | 0.799074 | 0.77058 | 0.028494 |
You are tasked with implementing a function to sort a list using the quicksort algorithm in Haskell. The twist is that you need to verify the correctness of your implementation using bounded refinement types.
Your task is to define the `qsort1` function, which takes a list of elements and returns a sorted list in asc... | glaive | [
0.0169939287006855,
0.021744580939412117,
0.004470053128898144,
-0.03273447975516319,
0.03237685561180115,
-0.020832346752285957,
0.005061517469584942,
0.05001362785696983,
0.04292404651641846,
-0.010640263557434082,
0.018473098054528236,
0.03958389163017273,
-0.020747048780322075,
-0.0124... | 0.819433 | 0.80157 | 0.017863 |
You are tasked with implementing a function to determine the transitivity of a directed graph. You will need to create a function that takes in a directed graph and returns a new directed graph representing the transitive closure of the input graph. The transitive closure of a graph G is a graph with the same vertices ... | glaive | [
0.004644831642508507,
0.027162602171301842,
-0.019581904634833336,
-0.0338621512055397,
0.04616135358810425,
-0.026012463495135307,
-0.02505946159362793,
0.059268053621053696,
0.030204573646187782,
-0.014334788545966148,
0.024972641840577126,
0.019325146451592445,
-0.0024804691784083843,
0... | 0.801683 | 0.775849 | 0.025834 |
How can I design an algorithm to check if a given binary tree is symmetric? | glaive | [
0.00028268949245102704,
0.016750112175941467,
-0.03351960331201553,
-0.0350545234978199,
0.022823387756943703,
-0.04228004440665245,
-0.001076085027307272,
0.07247497886419296,
0.02551347203552723,
-0.03290768340229988,
0.014261160977184772,
0.023214135318994522,
-0.027535652741789818,
-0.... | 0.796935 | 0.781172 | 0.015763 |
You are tasked with implementing a Breadth-First Search (BFS) algorithm using different modes (CPU, GPU_GLOBAL_QUEUE, GPU_BLOCK_QUEUE, GPU_WARP_QUEUE) to evaluate and grade the performance of the algorithm. The algorithm involves traversing a graph to visit all the vertices of the graph in a breadthward motion.
Your t... | glaive | [
0.017862657085061073,
0.02481718733906746,
-0.027448512613773346,
-0.025534331798553467,
0.016225477680563927,
-0.029809266328811646,
-0.02174190990626812,
0.07315139472484589,
0.045609503984451294,
-0.011293965391814709,
0.018982138484716415,
0.0304651390761137,
0.0004034764424432069,
0.0... | 0.811119 | 0.793287 | 0.017833 |
You are tasked with implementing a program in Python that defines and uses a structure similar to the given code snippet. Specifically, you need to define a structure `hom` that takes two type parameters `α` and `β`, and has a `to_fun` function that takes an input of type `α` and returns an output of type `β`. Addition... | glaive | [
0.022112952545285225,
0.011227674782276154,
-0.02999650128185749,
-0.03693448007106781,
0.0371331162750721,
-0.02177426405251026,
0.003451854456216097,
0.06407055258750916,
0.033492837101221085,
-0.026910539716482162,
0.00497576454654336,
0.05797986686229706,
-0.024522852152585983,
-0.0060... | 0.811589 | 0.794733 | 0.016856 |
You are tasked with implementing a test for the wide range of integer values in a 32-bit system. The test should check for the operation "nor" and replicate any width binary values to ensure the test is comprehensive. | glaive | [
0.01743817701935768,
-0.0013158456422388554,
-0.049272406846284866,
-0.025817720219492912,
0.024479616433382034,
-0.011269823648035526,
-0.006452777422964573,
0.060883864760398865,
0.036939121782779694,
-0.04326985776424408,
0.033728666603565216,
0.05134935304522514,
-0.017796259373426437,
... | 0.803734 | 0.787509 | 0.016225 |
You are tasked with creating a function that will match a given pattern with a set of dice rolls. The pattern can consist of the following characters:
- `[0-9]`: an exact digit
- `?`: any digit
- `?????`: any 5 digits
- `NNNNN`: any 5 repeating digits
- `N`: any digit
- `NN`: any 2 repeating digits
Your task is to imp... | glaive | [
0.009754357859492302,
0.019243715330958366,
-0.027242757380008698,
-0.032465483993291855,
0.04279918968677521,
-0.01722775399684906,
0.0006986900698393583,
0.04155714809894562,
0.03525683283805847,
-0.016964463517069817,
0.01164085790514946,
0.021030481904745102,
-0.015430073253810406,
-0.... | 0.821773 | 0.79095 | 0.030823 |
You are tasked with creating a program in Lean that will take a list of numbers as input and return the sum of all the even numbers in the list. Your program should be able to handle both positive and negative numbers in the list. | glaive | [
0.013294568285346031,
0.011403669603168964,
-0.045658331364393234,
-0.05630918964743614,
0.04493144154548645,
-0.010746200568974018,
-0.02342895232141018,
0.04580185189843178,
0.0365336611866951,
-0.018021926283836365,
0.018257031217217445,
0.06254911422729492,
-0.042986612766981125,
-0.02... | 0.816541 | 0.790534 | 0.026007 |
You are tasked with creating a program that generates a color-coded visualization of RNA secondary structure using the given sequence and specific coloring rules. The input will be an RNA sequence and the output should be a graphical representation of the secondary structure with specified colors for different regions.... | glaive | [
0.009195278398692608,
0.021751644089818,
-0.016057472676038742,
-0.048301830887794495,
-0.005539359524846077,
-0.03768305853009224,
-0.030181530863046646,
0.0802503377199173,
0.031172459945082664,
-0.010027682408690453,
0.026071278378367424,
0.03258984163403511,
-0.014769204892218113,
0.02... | 0.792015 | 0.767887 | 0.024128 |
Can you provide a function that determines whether a given number is prime or not? | glaive | [
0.03217768296599388,
0.015888255089521408,
-0.018614623695611954,
-0.03207307681441307,
0.023324694484472275,
-0.04102705046534538,
0.009989465586841106,
0.06326884776353836,
0.03711347281932831,
-0.01681470312178135,
0.022587375715374947,
0.020966995507478714,
-0.030265655368566513,
-0.03... | 0.791527 | 0.77168 | 0.019847 |
You are tasked with implementing a module in Elixir that calculates the hash of a list of integers using a specific hashing algorithm. The module should have a function `hash_lists` that takes two lists of integers `x_list` and `y_list` as input and returns a list of their respective hashes. The hashing algorithm is de... | glaive | [
0.033326879143714905,
0.01594482734799385,
-0.0021160165779292583,
-0.030290180817246437,
0.02232774905860424,
-0.030911212787032127,
-0.018625348806381226,
0.03988221287727356,
0.036619409918785095,
-0.02630368433892727,
0.017612341791391373,
0.043337348848581314,
-0.012572437524795532,
-... | 0.815479 | 0.796641 | 0.018838 |
You are tasked with creating a sequential address generator module in Verilog. The module should generate sequential addresses starting from a parametrizable address, with the ability to control the generation of addresses based on certain conditions. The module should have the following parameters:
- ADDR_WIDTH: Width... | glaive | [
0.02973201312124729,
0.0505828894674778,
-0.025624698027968407,
-0.0418548658490181,
0.009905749000608921,
-0.03243737667798996,
-0.03182601183652878,
0.052346810698509216,
0.030995815992355347,
-0.021841462701559067,
0.02512188069522381,
0.046088289469480515,
-0.015141652897000313,
-0.006... | 0.795676 | 0.777054 | 0.018623 |
You are tasked with creating a C++ program that implements a sorting algorithm using GPU algorithms. The program should define different sorting tags to handle various sorting scenarios. The sorting tags should include a tag for arbitrary sorting, a tag for sorting in descending order, a tag for sorting in ascending or... | glaive | [
0.014572507701814175,
0.005964324343949556,
-0.019716670736670494,
-0.016720019280910492,
0.033552318811416626,
-0.01213556993752718,
-0.03606915846467018,
0.07988156378269196,
0.039739154279232025,
-0.020732242614030838,
0.007190175354480743,
0.03363686800003052,
-0.01479976437985897,
0.0... | 0.805433 | 0.779497 | 0.025936 |
You are tasked with writing a program to generate a sequence of numbers based on the given formula: a(n) = A061037(n)^2, where A061037 is the sequence of numerators of 1/4 - 1/n^2. Your program should take an input n and output the corresponding value of a(n). For example, given n=1, the output should be 0. Given n=2, ... | glaive | [
0.03403046727180481,
0.03517447039484978,
-0.015705885365605354,
-0.028868429362773895,
0.03031660057604313,
-0.024799279868602753,
-0.03565431386232376,
0.06773758679628372,
0.014838048256933689,
-0.03395311161875725,
0.030083661898970604,
0.03956899046897888,
-0.043720491230487823,
-0.00... | 0.824832 | 0.768849 | 0.055983 |
You are tasked with designing a cache system in a programming language that supports type declarations and integer declarations. The cache system needs to have the following specifications:
- Cache size: 8KB
- Associativity: 2-way
- Cache line size: 4 cache words
- Physical address size: 64 bits
Your task is to implem... | glaive | [
0.05578286573290825,
0.030837226659059525,
-0.028284495696425438,
-0.016499070450663567,
0.03944207727909088,
-0.03252943232655525,
-0.030661679804325104,
0.07311127334833145,
0.04028527811169624,
-0.03698405995965004,
0.016478965058922768,
0.03494560346007347,
-0.03563438728451729,
-0.006... | 0.800164 | 0.785793 | 0.014371 |
You are working on a project that requires you to implement numerical routines in Python using Numpy and Numba. One of the requirements is to create a function that takes in an array of numbers and returns the square of each number in the array.
Write a Python function called `square_array` that takes in a Numpy array... | glaive | [
0.008763409219682217,
0.04761497676372528,
-0.0566459596157074,
-0.03424643725156784,
0.04628240689635277,
-0.01991306059062481,
-0.024380413815379143,
0.06159264221787453,
0.03058074228465557,
-0.0006272548343986273,
0.02527635358273983,
0.02741081267595291,
-0.03247660771012306,
-0.01243... | 0.800027 | 0.785523 | 0.014504 |
I am trying to solve a problem related to finding a missing seat in an airplane. The seats are arranged in a grid, and each seat has a unique seat ID. The seat IDs are calculated based on the row and column of the seat. The row is represented by the characters 'F' (front) and 'B' (back), and the column is represented b... | glaive | [
0.018555259332060814,
0.03454163670539856,
-0.0303677748888731,
-0.033604081720113754,
0.041832335293293,
-0.021110035479068756,
-0.003458503633737564,
0.04814549535512924,
0.037943050265312195,
-0.0018575022695586085,
0.03042549267411232,
0.024708740413188934,
-0.028069693595170975,
-0.00... | 0.827671 | 0.794507 | 0.033164 |
You are tasked with implementing a program that calculates Strehl's identity using the given formulae S1 and S2. Strehl's identity is given by the equation S1 = S2, where S1 and S2 are defined as follows:
S1 := Sum(z^n*Sum(Binomial3(n,k)*Multinomial([n,k])*Sum(Binomial3(k,j)^3, j=0..infinity), k=0..infinity), n=0..infi... | glaive | [
-0.001731906202621758,
0.023340098559856415,
-0.032790083438158035,
-0.03189767152070999,
0.030258391052484512,
-0.03693406656384468,
0.00077896035509184,
0.07012079656124115,
0.04446904733777046,
-0.018500888720154762,
0.03512433543801308,
0.02230568416416645,
-0.027734793722629547,
-0.01... | 0.82363 | 0.785248 | 0.038382 |
You are tasked with creating a Ruby program that calculates the average of a set of numbers. The program should take an array of numbers as input and return the average of those numbers. If the input array is empty, the program should return 0.
Write a function called `calculate_average` that takes an array of numbers... | glaive | [
0.021096672862768173,
0.04513222351670265,
-0.04890530928969383,
-0.0511900819838047,
0.05329098552465439,
-0.02760833501815796,
-0.027481835335493088,
0.04752861335873604,
0.02182687819004059,
-0.032190509140491486,
0.022142797708511353,
0.014711801894009113,
-0.035100869834423065,
-0.010... | 0.793457 | 0.77478 | 0.018677 |
You are tasked with creating a program to calculate the probability of a quantum state for a given set of qubits. The program should take into account the amplitude and phase of the quantum state to calculate the probability distribution over the range of possible outcomes. The program should then use the maximum proba... | glaive | [
0.003688798053190112,
0.028082584962248802,
-0.04358842223882675,
-0.012185249477624893,
0.046865396201610565,
-0.020080171525478363,
-0.024368561804294586,
0.0670030489563942,
0.04016842320561409,
-0.004140382632613182,
0.027844011783599854,
0.048769738525152206,
-0.010758418589830399,
-0... | 0.796408 | 0.769156 | 0.027252 |
You are tasked with implementing a 3-to-1 multiplexer (MUX) in VHDL. The MUX should have 3 input ports (IN_1, IN_2, IN_3) and a 2-bit selection input (SEL) to choose which input to route to the output port (OUTPUT). The width of the input and output ports is defined by the constant DATA_WIDTH. When SEL is "00", the out... | glaive | [
0.015610110945999622,
0.025870898738503456,
-0.04018566012382507,
-0.0263847466558218,
0.025293996557593346,
-0.008462545461952686,
-0.04157409816980362,
0.06681590527296066,
0.03369132801890373,
-0.012772493064403534,
0.028017884120345116,
0.0689583346247673,
-0.008691295050084591,
-0.042... | 0.793122 | 0.772507 | 0.020616 |
You are tasked with creating a Scala function that takes in a list of integers and returns the sum of all the even numbers in the list. Additionally, you need to handle the case where the input list is empty and return 0 in that scenario.
Write a Scala function called "sumEvenNumbers" that takes a list of integers as ... | glaive | [
0.021886905655264854,
0.022566057741642,
-0.026334034278988838,
-0.04929426684975624,
0.0431126244366169,
-0.016045426949858665,
-0.004699639976024628,
0.034532349556684494,
0.02066115476191044,
-0.018690815195441246,
0.01985420100390911,
0.056251160800457,
-0.031960148364305496,
-0.019803... | 0.806777 | 0.770533 | 0.036244 |
You are tasked with implementing a CUDA kernel function that calculates the Intersection over Union (IoU) overlap between bounding boxes. The function should take as input two sets of bounding boxes, the size of each bounding box, the number of bounding boxes in each set, a mode parameter, and an output tensor. The CUD... | glaive | [
0.016028059646487236,
0.03228110074996948,
-0.017646217718720436,
-0.018382705748081207,
0.028861479833722115,
0.01333217229694128,
-0.04142678901553154,
0.07254888117313385,
0.05649799481034279,
0.0028404707554727793,
0.0384569987654686,
0.03459962084889412,
0.002577705541625619,
0.002955... | 0.810578 | 0.785394 | 0.025184 |
I need to create a program in C/C++ to count the occurrences of k-mers (substrings of length k) in a given input sequence. The program should take a sequence as input and output the count of each distinct k-mer in the sequence.
Write a program that takes a sequence, and an integer k as input, and outputs the count of ... | glaive | [
-0.001265405910089612,
0.01812281832098961,
-0.03455093875527382,
-0.02653106302022934,
0.036138903349637985,
-0.0065902117639780045,
-0.02882510982453823,
0.08093081414699554,
0.04177453741431236,
-0.013219437561929226,
0.009710028767585754,
0.029160337522625923,
-0.016351280733942986,
-0... | 0.820053 | 0.788892 | 0.031161 |
You are tasked with implementing a function in a programming language that takes two natural numbers as input and returns the result of dividing the first number by the second number. However, there is a constraint that the second number must not be zero. You need to ensure that the function complies with this constrai... | glaive | [
0.01019926555454731,
0.021382011473178864,
-0.025286197662353516,
-0.02646874636411667,
0.03479290008544922,
-0.002079922938719392,
-0.010125533677637577,
0.07072575390338898,
0.043482035398483276,
-0.01740262284874916,
0.02493389882147312,
0.03682320564985275,
-0.005152206867933273,
-0.00... | 0.822326 | 0.802623 | 0.019703 |
Is there a way to create a function that can group a list of integers into consecutive ranges? | glaive | [
0.026629649102687836,
0.023734716698527336,
-0.03629743680357933,
-0.03757517784833908,
0.05112602189183235,
-0.02707948163151741,
-0.03395545482635498,
0.05032879859209061,
0.03204722702503204,
-0.03043733537197113,
0.017530029639601707,
0.040863800793886185,
-0.04252893850207329,
-0.0280... | 0.798273 | 0.776403 | 0.021871 |
You are tasked with implementing the Lucas-Lehmer test to determine if a Mersenne number is prime. A Mersenne number is of the form 2^p - 1, where p is a prime number. The Lucas-Lehmer test states that a Mersenne number is prime if and only if the Lucas-Lehmer residue, calculated using a specific recurrence relation, i... | glaive | [
0.004320052452385426,
0.037147410213947296,
-0.016541894525289536,
-0.028436999768018723,
0.03297744318842888,
-0.007185584865510464,
0.003973098937422037,
0.06778264790773392,
0.023792054504156113,
-0.012420279905200005,
0.027170026674866676,
0.023361414670944214,
-0.02382143773138523,
-0... | 0.819699 | 0.781555 | 0.038145 |
You are given a dataset containing flight data with the following columns:
- FL_Date: The date of the flight
You need to perform the following tasks:
1. Calculate the total number of flights for each day.
2. Add the following columns to the dataset:
- Week: The current week of the year for the flight
- Next_Week:... | glaive | [
-0.014797150157392025,
0.023264573886990547,
-0.03837548568844795,
-0.03864023834466934,
0.037440236657857895,
-0.045158058404922485,
-0.01530999131500721,
0.05395244061946869,
0.04071798548102379,
-0.004633505828678608,
0.014084153808653355,
0.02411237545311451,
-0.021769819781184196,
-0.... | 0.784103 | 0.758527 | 0.025576 |
You are tasked with writing a function in Lean that takes two natural numbers, a and b, as input and returns the value of a expression based on the following conditions:
- a and b are both between 1 and 9 (inclusive)
- The expression to be evaluated is 10 * a + b
- The equation 10 * a + b = 2 * (a + b) holds true
Writ... | glaive | [
0.024045461788773537,
0.03580895811319351,
-0.05348432809114456,
-0.05554348975419998,
0.038265127688646317,
-0.017300086095929146,
-0.03291482850909233,
0.08962628245353699,
0.030372081324458122,
0.0014096316881477833,
0.0334496945142746,
0.054526425898075104,
-0.031538549810647964,
-0.01... | 0.807453 | 0.78819 | 0.019263 |
You are tasked with creating a program that calculates the probability of a quantum state of a system and then visualizes the results. The program should use the given code snippet as a reference and should be implemented in the Mathematica language.
The program should define a function called amplitude[x,y] and ampli... | glaive | [
0.0061551895923912525,
0.02953462488949299,
-0.02549423836171627,
-0.030971765518188477,
0.03943518549203873,
-0.025136221200227737,
-0.01570400781929493,
0.08048365265130997,
0.04844944179058075,
0.004456259310245514,
0.027192827314138412,
0.04609258845448494,
-0.013226032257080078,
-0.02... | 0.793897 | 0.765169 | 0.028728 |
You are required to implement a CUDA kernel for the "anode_gpu_smooth_negative_f1_loss_3d1_packed_f32" function. The kernel should take the following input parameters:
- dim0: The size of the first dimension
- cat_dim1: The size of the second dimension
- dim2: The size of the third dimension
- epsilon: A floating-point... | glaive | [
-0.013838154263794422,
0.051847416907548904,
-0.01802186109125614,
-0.03014141507446766,
0.04387244954705238,
-0.01663009077310562,
-0.036034438759088516,
0.07819843292236328,
0.05012793093919754,
-0.017506154254078865,
0.03844168037176132,
0.040101293474435806,
-0.014060701243579388,
-0.0... | 0.790345 | 0.773765 | 0.01658 |
You are tasked with implementing a round-robin arbiter module in Verilog. The arbiter needs to handle a specified number of requests and grant access to one request at a time in a sequential order. The module has inputs for clock, reset, request signals, and free signals, as well as outputs for granted signals. The arb... | glaive | [
0.04480675980448723,
0.03853200376033783,
-0.011189699172973633,
-0.017772911116480827,
0.002425260143354535,
-0.018825573846697807,
-0.04381304234266281,
0.05413469672203064,
0.03959188237786293,
-0.0004922036314383149,
0.018521195277571678,
0.036305077373981476,
-0.019916724413633347,
0.... | 0.788817 | 0.773414 | 0.015402 |
You are tasked with creating a program that uses a struct to represent a student record. The struct should contain the following fields: name, age, and grade. You need to implement a function that takes in an array of student records and sorts them based on their grade in ascending order.
Create a program that prompts... | glaive | [
0.006480942480266094,
0.006457775365561247,
-0.03876052051782608,
-0.03626061603426933,
0.028112610802054405,
-0.03214164450764656,
-0.02904333546757698,
0.06550152599811554,
0.04058447107672691,
0.0004970027366653085,
0.022477276623249054,
0.030486198142170906,
-0.03167890012264252,
-0.00... | 0.802239 | 0.787337 | 0.014902 |
You are tasked with creating a DirectedGraph data structure in Java. The DirectedGraph class should have methods to add vertices, remove vertices, and remove nodes. The addVertex method should add a new vertex to the graph, connecting two nodes. The removeVertex method should remove a specific vertex from the graph. Th... | glaive | [
0.0008767087711021304,
0.00819648802280426,
-0.023861857131123543,
-0.025034071877598763,
0.02122584357857704,
-0.05368650704622269,
-0.00991223007440567,
0.04039573296904564,
0.04419101029634476,
-0.011937732808291912,
0.03299212455749512,
0.012740837410092354,
-0.021859103813767433,
-0.0... | 0.80145 | 0.776044 | 0.025406 |
You are tasked with implementing a path tracing kernel for a 3D rendering application using CUDA. The goal is to generate a realistic image of a Cornell Box made of spheres with a resolution of 1024x1024 pixels. The path tracing algorithm simulates the behavior of light in the scene by casting rays and tracing their pa... | glaive | [
-0.006105722859501839,
0.05205812305212021,
-0.004961760248988867,
-0.017859335988759995,
0.020945146679878235,
-0.008870124816894531,
-0.0370236299932003,
0.08441342413425446,
0.045363008975982666,
-0.010864727199077606,
0.0424821563065052,
0.03698877990245819,
0.019281161949038506,
0.012... | 0.796295 | 0.778106 | 0.018189 |
You are given an array of integers, and you need to sort the array so that all the even numbers come before all the odd numbers. Write a function to implement this sorting logic. The function should take in an array of integers and return the sorted array.
For example:
Input: [3, 1, 2, 4]
Output: [2, 4, 3, 1]
Input: ... | glaive | [
0.04078368470072746,
0.027626877650618553,
-0.031451236456632614,
-0.0431375578045845,
0.02171134203672409,
-0.03424529358744621,
-0.027155274525284767,
0.04440968111157417,
0.04156123101711273,
-0.02404758706688881,
0.016259655356407166,
0.024784041568636894,
-0.043362781405448914,
-0.013... | 0.81581 | 0.771254 | 0.044556 |
You are tasked with creating a program that utilizes MPI with CUDA to perform the following tasks:
1. Generate random numbers on one node.
2. Distribute the random numbers to all nodes.
3. Compute the square root of the numbers on each node's GPU.
4. Calculate the average of the results using MPI.
You need to write a... | glaive | [
-0.000014902479961165227,
0.05341923236846924,
-0.031260665506124496,
-0.02517106756567955,
0.02840796299278736,
-0.015203132294118404,
-0.03746717423200607,
0.06407162547111511,
0.034373484551906586,
-0.02792474254965782,
0.012902389280498028,
0.023147068917751312,
-0.016861191019415855,
... | 0.802136 | 0.783055 | 0.01908 |
You are tasked with implementing a CUDA kernel for the gather operation in C++. The gather operation is used to gather slices from a tensor along a specified axis. The input consists of three arrays: `input` (the source tensor), `indices` (the indices of the slices to be gathered), and `output` (the resulting gathered ... | glaive | [
0.012374370358884335,
0.042914703488349915,
-0.007985405623912811,
-0.016158757731318474,
0.026313770562410355,
-0.0034782292786985636,
-0.02479196898639202,
0.1222081333398819,
0.0555160790681839,
-0.020802905783057213,
0.02795194275677204,
0.04074918106198311,
-0.014632458798587322,
0.01... | 0.798925 | 0.781167 | 0.017758 |
How can I write a program that calculates the sum of all the numbers from 1 to a given number? | glaive | [
0.008882084861397743,
0.02578677609562874,
-0.030711142346262932,
-0.0409669429063797,
0.04497339203953743,
-0.033120159059762955,
-0.010331072844564915,
0.031194714829325676,
0.02964547835290432,
-0.045314863324165344,
0.021313829347491264,
0.05992766469717026,
-0.052821822464466095,
-0.0... | 0.796301 | 0.778229 | 0.018071 |
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. If the array is empty or does not contain any even numbers, the function should return 0.
Write a JavaScript function named `sumOfEvenNumbers` that takes in one parameter:
- `a... | glaive | [
0.013088421896100044,
0.014871734194457531,
-0.038174018263816833,
-0.038410019129514694,
0.03788432851433754,
-0.009820294566452503,
-0.004283460788428783,
0.04629170149564743,
0.027948306873440742,
-0.013318194076418877,
0.017493050545454025,
0.02283661626279354,
-0.045631036162376404,
-... | 0.803305 | 0.761861 | 0.041444 |
You are tasked with writing a CUDA kernel to compute the matrix product C = alpha*A*B + beta*C when alpha == 0 and beta == 0. In other words, you need to implement a function that sets all elements of matrix C to 0. The matrices A, B, and C are all of type float and have dimensions m x n, n x k, and m x k respectively.... | glaive | [
0.018460743129253387,
0.044434551149606705,
-0.03113051876425743,
-0.012997856363654137,
0.04185359552502632,
-0.014959442429244518,
-0.019669977948069572,
0.09629617631435394,
0.052060067653656006,
-0.029100211337208748,
0.010320368222892284,
0.032804179936647415,
-0.007438155822455883,
-... | 0.813283 | 0.790959 | 0.022324 |
You are tasked with implementing a matrix multiplication kernel using CUDA in C++. The problem involves writing a function that takes two input matrices, A and B, and computes their product, C, using the provided CUDA code structure.
The input matrices A and B are of type Matrix, which is a struct containing the width... | glaive | [
0.013236885890364647,
0.05541108548641205,
-0.013102628290653229,
-0.025532636791467667,
0.039567962288856506,
0.009282195940613747,
-0.040920428931713104,
0.12280813604593277,
0.04527256637811661,
-0.02247554063796997,
0.010622796602547169,
0.03554019704461098,
-0.011509072966873646,
0.00... | 0.791431 | 0.766826 | 0.024605 |
You are tasked with optimizing a complex mathematical function in the form of `function[x, y]` using a simulated annealing method. The function is a combination of exponential terms and trigonometric functions involving `x` and `y`. The goal is to find the maximum value of the function within a specified range of `x` a... | glaive | [
0.017245573922991753,
0.032727453857660294,
-0.04557553678750992,
-0.03117169812321663,
0.028277577832341194,
-0.014870326966047287,
-0.03787647932767868,
0.04860447347164154,
0.04882745072245598,
-0.0009771817130967975,
0.009767912328243256,
0.034987494349479675,
-0.020470531657338142,
0.... | 0.813077 | 0.780435 | 0.032643 |
How can I write an algorithm in C to find the minimum value in an array? | glaive | [
-0.0034379642456769943,
0.02804539166390896,
-0.02140636369585991,
-0.026209600269794464,
0.04045984521508217,
-0.044429149478673935,
-0.037873804569244385,
0.05565487593412399,
0.02830178290605545,
-0.03499120473861694,
0.019343607127666473,
0.018895987421274185,
-0.0251153614372015,
-0.0... | 0.799032 | 0.774381 | 0.024651 |
You are tasked with creating a program that uses a map data structure in Go to store key-value pairs. The program should be able to add new key-value pairs to the map, retrieve the value associated with a specific key, determine the number of key-value pairs in the map, and delete a key-value pair from the map.
Write ... | glaive | [
0.0239741001278162,
0.039294999092817307,
-0.02492779865860939,
-0.02821977436542511,
0.0517769418656826,
-0.029826028272509575,
-0.021175893023610115,
0.07321200519800186,
0.03994889184832573,
-0.024226782843470573,
0.018507957458496094,
0.01953895576298237,
-0.03661346808075905,
-0.02040... | 0.81247 | 0.790645 | 0.021824 |
I need to create a function that calculates the sum of all multiples of a list of numbers up to a certain limit. The function should take in two parameters: a list of integers representing the multiples and an integer representing the limit. It should then return the sum of all unique multiples of the numbers in the li... | glaive | [
-0.00096161785768345,
0.03345072641968727,
-0.017155637964606285,
-0.03970637172460556,
0.05202658101916313,
-0.027532601729035378,
-0.014832942746579647,
0.029301511123776436,
0.03867262229323387,
-0.030414387583732605,
0.004164700862020254,
0.049676891416311264,
-0.03261764720082283,
-0.... | 0.809865 | 0.780728 | 0.029138 |
You are tasked with implementing a program that reads in a series of commands from a text file and processes them to calculate the final position and product of two variables. The commands are in the form of strings representing movement and direction, such as "forward", "up", and "down". The program should interpret t... | glaive | [
0.013697909191250801,
0.04189126193523407,
-0.03584044799208641,
-0.04617809131741524,
0.040472354739904404,
-0.026203669607639313,
-0.026120712980628014,
0.06504404544830322,
0.04475002363324165,
-0.020823223516345024,
0.013930725865066051,
0.036408763378858566,
-0.025541992858052254,
-0.... | 0.816665 | 0.792682 | 0.023983 |
You are tasked with creating a program that calculates the length of various finite sets and performs operations on them. You need to define classes and methods to handle the cardinality of the sets and their operations.
Your program should include the following features:
- Addition of finite sets
- Product of finite ... | glaive | [
0.033793747425079346,
0.0319080613553524,
-0.0393906906247139,
-0.018218794837594032,
0.03681912273168564,
-0.036940284073352814,
-0.029611356556415558,
0.038194697350263596,
0.03207837790250778,
-0.023462938144803047,
0.039333853870630264,
0.03689558431506157,
-0.025237465277314186,
-0.01... | 0.827159 | 0.790871 | 0.036288 |
You have been tasked with implementing a CPU join function in C++ that can perform inner, left, right, or outer joins of two arrays. The input to your function will be two arrays, each containing elements of a specific type, and a comparison function that can compare elements of that type. The function should return th... | glaive | [
0.0392143614590168,
0.026315627619624138,
-0.027770286425948143,
-0.00521815475076437,
0.02239917404949665,
0.010832211934030056,
-0.023603852838277817,
0.08139609545469284,
0.055172648280858994,
0.004517460707575083,
0.021261706948280334,
0.038000695407390594,
-0.015466351993381977,
0.000... | 0.80532 | 0.773376 | 0.031943 |
You are required to create a CUDA kernel function that performs a series of mathematical operations based on the input parameters. The function should take in 31 input parameters and an array of floats, and then perform a series of conditional checks and mathematical operations within nested for loops. The function sho... | glaive | [
0.01551375724375248,
0.049092501401901245,
-0.02781308814883232,
-0.022624345496296883,
0.030210575088858604,
-0.01316842995584011,
-0.03760911524295807,
0.07327640801668167,
0.03811831772327423,
-0.010888315737247467,
0.025254564359784126,
0.04744834825396538,
-0.0011342241195961833,
-0.0... | 0.802881 | 0.786926 | 0.015955 |
Can you provide an algorithm that finds the closest two sum pairs in a given array of integers? | glaive | [
0.013475778512656689,
0.030025741085410118,
-0.03786901384592056,
-0.023427331820130348,
0.02694658748805523,
-0.020265424624085426,
-0.028790505602955818,
0.03393132984638214,
0.03439232334494591,
-0.03291110694408417,
0.02688886970281601,
0.025789951905608177,
-0.02042071335017681,
-0.01... | 0.811384 | 0.77428 | 0.037104 |
You are tasked with creating a function that generates capacity requirements for a given set of "from" and "to" variables. The function should take in two vectors, "from" and "to", and return a matrix representing the capacity requirements. Each element in the matrix should correspond to the capacity requirements betwe... | glaive | [
0.03239662945270538,
0.040751904249191284,
-0.028389036655426025,
-0.025828493759036064,
0.04351307451725006,
-0.028029445558786392,
-0.041874032467603683,
0.04718688875436783,
0.024184664711356163,
-0.00855958741158247,
0.008051062934100628,
0.0367949977517128,
-0.02270284853875637,
-0.00... | 0.801004 | 0.76845 | 0.032554 |
You are required to implement a CUDA kernel that shifts the elements of a vector in a specific pattern. The memory layout of the input vector is such that the elements are consecutive in memory, and the vector is made up of multiple rows. The goal is to shift the elements in the vector based on a specified shift number... | glaive | [
0.013995969668030739,
0.030203713104128838,
-0.018990276381373405,
-0.014072409830987453,
0.030149275436997414,
-0.006284650880843401,
-0.02798132784664631,
0.09126410633325577,
0.04276168346405029,
-0.018315203487873077,
0.019983356818556786,
0.028730371966958046,
-0.011071784421801567,
0... | 0.804947 | 0.785035 | 0.019913 |
You are tasked with implementing a Dynamic Programming algorithm for the OSS Problem using the given code snippet as a reference. The OSS Problem involves scheduling tasks on multiple machines to minimize the makespan (i.e., the time it takes to complete all tasks). The problem consists of multiple jobs, each with a se... | glaive | [
0.004762513563036919,
0.02523031085729599,
-0.03269437700510025,
-0.006861110683530569,
0.028010010719299316,
-0.002953639719635248,
-0.0014638592256233096,
0.07817750424146652,
0.04446657374501228,
0.007540884427726269,
0.03397652134299278,
0.0455491878092289,
-0.009570040740072727,
-0.00... | 0.805226 | 0.785773 | 0.019453 |
You are tasked with creating a SAS macro that generates multivariate data with known marginals and known rank correlation using the Iman-Conover method. The macro should take in the following input parameters: seed for random generation, the size of the sample, the number of variables, a list of marginal distributions ... | glaive | [
0.012231526896357536,
0.015952948480844498,
-0.043237265199422836,
-0.027264060452580452,
0.03308188170194626,
-0.011976031586527824,
-0.020631425082683563,
0.0623096264898777,
0.038629960268735886,
0.007083276752382517,
0.02083645574748516,
0.0405396893620491,
-0.013285129331052303,
0.003... | 0.784879 | 0.77031 | 0.014569 |
You are tasked with implementing a parallel search algorithm using CUDA for a bloom filter. The bloom filter is designed to efficiently test for set membership, using a hash function and an array of bits to represent the presence of elements.
You will need to write a CUDA kernel to insert keys into the bloom filter, ... | glaive | [
0.004956942982971668,
0.0468149371445179,
-0.027212249115109444,
-0.00146916089579463,
0.025662794709205627,
-0.010231057181954384,
-0.02987653948366642,
0.08413805812597275,
0.04764662683010101,
-0.02006061188876629,
0.01975199580192566,
0.02895781584084034,
0.011453202925622463,
0.004670... | 0.799707 | 0.779168 | 0.020539 |
You are tasked with implementing a CUDA kernel for a rasterization algorithm in C++ using the CUDA framework. The goal is to write a CUDA kernel that performs rasterization on a set of input data and produces an output based on specific conditions. The input data consists of face vertices, face image, face bounding box... | glaive | [
0.004561341367661953,
0.05106031522154808,
-0.0012160346377640963,
-0.017236890271306038,
0.024276936426758766,
0.00973708089441061,
-0.013116450980305672,
0.11595238000154495,
0.05767715722322464,
-0.011924661695957184,
0.020848531275987625,
0.04015488922595978,
-0.008694000542163849,
0.0... | 0.788938 | 0.772661 | 0.016276 |
Can you provide a Java program that calculates the sum of numbers in a given array? The array should be provided as input to the program. | glaive | [
0.005237101577222347,
0.022409191355109215,
-0.058194600045681,
-0.026453467085957527,
0.05279448628425598,
-0.03741934895515442,
-0.017537305131554604,
0.03719723969697952,
0.03293698653578758,
-0.041570406407117844,
0.01821640506386757,
0.028149668127298355,
-0.061708372086286545,
-0.025... | 0.794374 | 0.770942 | 0.023431 |
You are tasked with creating a program that will find the maximum value of a given mathematical function within a specified range. The function takes two parameters, x and y, and the maximum value should be found within the range of 0 to π/2 for both x and y. Additionally, you are required to plot the 3D graph of the f... | glaive | [
0.017212027683854103,
0.02181783877313137,
-0.05901509150862694,
-0.027452582493424416,
0.04522661119699478,
-0.010961171239614487,
-0.034404538571834564,
0.041892483830451965,
0.04929262027144432,
-0.009674162603914738,
0.02165105938911438,
0.0536382682621479,
-0.023635074496269226,
-0.00... | 0.804164 | 0.770248 | 0.033916 |
You are tasked with implementing a function that performs set operations on ranges in Rust. You need to create a function that takes two ranges as input and returns the intersection of the two ranges. The intersection of two ranges is the set of elements that are common to both ranges. Your function should be able to h... | glaive | [
0.05524338409304619,
0.026269089430570602,
-0.035404983907938004,
-0.023959185928106308,
0.025688672438263893,
-0.01483643613755703,
-0.028168756514787674,
0.07782821357250214,
0.05022565647959709,
-0.004354124888777733,
0.03120352141559124,
0.03948727250099182,
-0.012483895756304264,
-0.0... | 0.802479 | 0.785874 | 0.016605 |
You are tasked with implementing a subroutine in Fortran called DSYTD2 that reduces a real symmetric matrix A to symmetric tridiagonal form T by an orthogonal similarity transformation: Q' * A * Q = T. The subroutine takes in the following arguments:
- UPLO: Specifies whether the upper or lower triangular part of the s... | glaive | [
0.01574736461043358,
0.03325938805937767,
-0.0460389070212841,
-0.04449203982949257,
0.02505558729171753,
-0.025928998365998268,
-0.006035784259438515,
0.07328052818775177,
0.049649566411972046,
-0.00576208857819438,
0.009819691069424152,
0.025241216644644737,
-0.034023698419332504,
-0.001... | 0.804821 | 0.778179 | 0.026641 |
You are tasked with creating a Python program that generates a list of prime numbers up to a given number. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Your program should take an input from the user and then output a list of all prime numbers up to that input... | glaive | [
0.02773054875433445,
0.010054211132228374,
-0.009217490442097187,
-0.042163293808698654,
0.03659270331263542,
-0.042081139981746674,
-0.006200100760906935,
0.036512743681669235,
0.03091311641037464,
-0.022756706923246384,
0.02837318554520607,
0.04804053157567978,
-0.0414089560508728,
-0.01... | 0.807427 | 0.775928 | 0.031499 |
You are tasked with implementing a uniform integer distribution class in C++ for a GPU environment. The class should have the following functionalities:
- Ability to generate random integers within a specified range
- Ability to set and retrieve the range of the distribution
- Ability to reset the distribution
- Abilit... | glaive | [
0.005467022769153118,
0.017896542325615883,
-0.020969461649656296,
-0.027547145262360573,
0.033926039934158325,
-0.014867240563035011,
-0.04959150031208992,
0.09479868412017822,
0.03995530307292938,
-0.03421727567911148,
0.038506992161273956,
0.04052087292075157,
0.0060161505825817585,
0.0... | 0.801343 | 0.779188 | 0.022155 |
You are required to write a CUDA program to perform vector addition using both GPU and host functions. The program should calculate the relative difference between the results obtained from the GPU and host functions. Additionally, it should measure the average execution time for both the GPU and host functions.
The p... | glaive | [
0.006141457241028547,
0.05067753419280052,
-0.01957807131111622,
-0.013683526776731014,
0.028882306069135666,
0.0039158351719379425,
-0.05287358909845352,
0.09810453653335571,
0.0571599081158638,
-0.021847831085324287,
0.009450345300137997,
0.030158212408423424,
-0.00865963939577341,
0.012... | 0.796446 | 0.777476 | 0.01897 |
You are tasked with creating a function in F# that calculates the average of a list of numbers. The function should take in a list of integers as input and return the average of the numbers in the list. If the list is empty, the function should return 0.
Write a function called "calculateAverage" that takes a list of ... | glaive | [
0.01625075750052929,
0.03180352970957756,
-0.03390311449766159,
-0.05598631873726845,
0.07113190740346909,
-0.04339131712913513,
-0.022138448432087898,
0.04997997730970383,
0.041489411145448685,
-0.007336917798966169,
0.007985547184944153,
0.03150239214301109,
-0.03723684325814247,
-0.0118... | 0.787135 | 0.77066 | 0.016475 |
You are tasked with implementing a CUDA kernel to perform a 3D stencil computation. The kernel will take a 3D input array and apply a specific calculation to each element, using a 3D stencil pattern. The input array represents a 3D volume with dimensions dimx, dimy, and dimz. The stencil pattern is defined by a 32x32 t... | glaive | [
0.003581965109333396,
0.06160777062177658,
-0.007592090405523777,
-0.024722140282392502,
0.032388798892498016,
-0.01086198166012764,
-0.043164562433958054,
0.08945376425981522,
0.046630144119262695,
-0.021274695172905922,
0.05371188372373581,
0.052856069058179855,
0.002615919103845954,
0.0... | 0.78418 | 0.766066 | 0.018114 |
You are tasked with analyzing COVID-19 data to identify states with the most deaths and cases per million residents in the past week. You have access to datasets containing COVID-19 cases, deaths, and state population data. Your goal is to create visualizations and tables to present the states with the highest weekly d... | glaive | [
0.02839265950024128,
0.0441204309463501,
-0.03794560581445694,
-0.05994276702404022,
0.025790372863411903,
-0.023278893902897835,
-0.02133897691965103,
0.06480313092470169,
0.03498149290680885,
0.008880909532308578,
0.025825031101703644,
0.02552332915365696,
0.013705767691135406,
0.0261689... | 0.757393 | 0.740206 | 0.017187 |
You have been tasked with creating a module in Erlang to handle unknown cells in a Sudoku game. The module should include functions to create a new unknown cell, retrieve the cell number, determine the possible digits for the cell, place a digit in the cell, and find the unknown cell with the fewest possible digits. Yo... | glaive | [
0.007897830568253994,
0.01945279724895954,
-0.022928079590201378,
-0.04408084601163864,
0.04180755093693733,
-0.019549662247300148,
-0.005656356457620859,
0.054547302424907684,
0.037232618778944016,
-0.023280689492821693,
0.02500079572200775,
0.03267460688948631,
-0.012501058168709278,
0.0... | 0.81945 | 0.793174 | 0.026276 |
You are tasked with simulating and visualizing the probability distribution of a quantum state in a quantum computing context. The quantum state is represented by a complex-valued function amplitude(x, y), and you need to calculate the probability density function defined as the absolute square of the amplitude. Furthe... | glaive | [
-0.003159445943310857,
0.028362056240439415,
-0.039613042026758194,
-0.031160445883870125,
0.03538830950856209,
-0.011919117532670498,
-0.03043527714908123,
0.06318054348230362,
0.04566127061843872,
-0.0038935933262109756,
0.028614996001124382,
0.0395984910428524,
-0.0018802854465320706,
-... | 0.784748 | 0.761126 | 0.023622 |
You are tasked with creating a program that computes the maximum value of a given complex function and then visualizes it in a 3D plot and contour plot. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[-16 I y] (1 (I Sin[x])^4 Cos[x]^12 + 1 (I Sin[x])^12 Cos[x]^4) + Exp[-12 I y] (5 (I Sin[x])^3 Co... | glaive | [
0.02229953370988369,
0.03461025282740593,
-0.04706673324108124,
-0.038543425500392914,
0.0346834771335125,
-0.016690319404006004,
-0.03666950389742851,
0.04928751289844513,
0.052239302545785904,
-0.0007386761135421693,
0.039077240973711014,
0.04894179850816727,
-0.025485744699835777,
-0.00... | 0.800073 | 0.76555 | 0.034523 |
You have been asked to create a parallel coordinate plot using the olive dataset. The plot should display the relationships between different variables (columns 4 to 10) and group the data based on the "area" column (column 3). The plot should use a color palette from the "Dark2" color scheme. | glaive | [
0.004510222934186459,
0.04045826569199562,
-0.03768100216984749,
-0.040063198655843735,
0.011069347150623798,
-0.017447125166654587,
-0.021136412397027016,
0.056357018649578094,
0.052930798381567,
0.015564552508294582,
0.011263635009527206,
0.028584463521838188,
-0.025711774826049805,
0.02... | 0.77677 | 0.762252 | 0.014518 |
You are tasked with creating a 1-bit full adder in VHDL. The adder should have three input ports (A, B, CIN) and two output ports (SUM, COUT). A and B are the addends, CIN is the carry-in, SUM is the sum, and COUT is the carry-out. Your task is to write the VHDL code for the entity and architecture of the 1-bit full ad... | glaive | [
0.027887223288416862,
0.04102377966046333,
-0.02556000091135502,
-0.027670737355947495,
0.05134743079543114,
-0.025075266137719154,
-0.020932015031576157,
0.07313965260982513,
0.04786855727434158,
-0.01557479053735733,
0.012596623040735722,
0.04333110153675079,
-0.016469191759824753,
-0.01... | 0.803654 | 0.78678 | 0.016874 |
You are tasked with implementing a Stan program to model the spread of infectious diseases across multiple countries. The program will use Bayesian statistics to estimate the expected number of cases and deaths per day, taking into account various parameters such as contact rates, age demographics, and disease transmis... | glaive | [
0.02775714360177517,
0.013290304690599442,
-0.04841338470578194,
-0.03866875171661377,
0.0324275903403759,
-0.01490651722997427,
-0.033922456204891205,
0.060780227184295654,
0.027573470026254654,
-0.02354881539940834,
0.010997301898896694,
0.07199862599372864,
-0.01684640720486641,
0.01558... | 0.788972 | 0.769305 | 0.019667 |
You are tasked with creating a program that declares multiple variables with different dimensions and then prints the size of each variable. The program should include the declaration of three arrays: x with 17 elements, y with 2 elements, and z with elements ranging from 1 to 3.
Create a program that properly declare... | glaive | [
-0.0009190358687192202,
0.03321339562535286,
-0.05019184201955795,
-0.03761792555451393,
0.048168107867240906,
-0.0062184096314013,
-0.03293200582265854,
0.048278145492076874,
0.028303971514105797,
-0.01322117354720831,
0.028842929750680923,
0.051424555480480194,
-0.03988965228199959,
-0.0... | 0.813309 | 0.782831 | 0.030478 |
Can someone please classify the following code snippet as either a for statement or a while loop?
```python
count = 0
while count < 5:
print("Count:", count)
count += 1
``` | glaive | [
0.006549174897372723,
0.03886185958981514,
-0.0037386943586170673,
-0.0352967195212841,
0.02414417266845703,
-0.03163643181324005,
-0.030432190746068954,
0.042842499911785126,
0.019095877185463905,
-0.018893735483288765,
0.010820387862622738,
0.03288770839571953,
-0.030423061922192574,
-0.... | 0.790802 | 0.760881 | 0.029922 |
You are tasked with creating a program that calculates the probability amplitudes for a quantum system with a given number of qubits, states, and a specific name. The program should then use simulated annealing to find the maximum probability amplitude and plot the 3D and contour graphs of the probability distribution. | glaive | [
0.01272016204893589,
0.02398986928164959,
-0.03618351370096207,
-0.024882884696125984,
0.036306288093328476,
-0.0356152281165123,
-0.029916005209088326,
0.06165489926934242,
0.026379821822047234,
-0.014057572931051254,
0.017985407263040543,
0.03636951372027397,
-0.023871026933193207,
-0.01... | 0.803602 | 0.778293 | 0.02531 |
You are required to implement a CUDA kernel function for the im2col operation, which rearranges data in the input tensor to a matrix representation. The function should take the input tensor data_im, and rearrange it according to the specified filter size, stride, and padding to produce the output matrix data_col.
The... | glaive | [
0.0028932844288647175,
0.031184112653136253,
-0.009512141346931458,
-0.023202206939458847,
0.0225174892693758,
-0.0017526078736409545,
-0.033380214124917984,
0.09769248962402344,
0.028428399935364723,
-0.007102804724127054,
0.02630193717777729,
0.026245735585689545,
-0.010678628459572792,
... | 0.800167 | 0.78445 | 0.015717 |
You are tasked with implementing a merge sort algorithm using CUDA for parallel processing. The goal is to sort a given array of keys and associated values in ascending order. The algorithm should utilize three stages: blocksort, simple merge, and multi merge. The input includes the array of keys, the associated values... | glaive | [
0.029933616518974304,
0.04222838580608368,
-0.011172236874699593,
-0.007632520515471697,
0.019824741408228874,
0.003261872101575136,
-0.04078967869281769,
0.0823870524764061,
0.04888454079627991,
-0.010929225012660027,
0.006732671055942774,
0.02697073295712471,
-0.009449014440178871,
-0.00... | 0.804596 | 0.780114 | 0.024482 |
You are tasked with implementing the control logic for the final round of a red cryptographic algorithm. The control logic needs to be written in VHDL and should consist of an entity called RedFinalRoundControlLogic. This entity should have a generic for Red_size, and two STD_LOGIC_VECTOR generics for LFTable and LFInv... | glaive | [
0.028806250542402267,
0.04467402771115303,
-0.02525535225868225,
-0.047649454325437546,
0.01014482881873846,
-0.03430919349193573,
-0.04687618464231491,
0.08968306332826614,
0.03269723430275917,
-0.013843395747244358,
0.021323131397366524,
0.034667763859033585,
-0.0034841455053538084,
-0.0... | 0.803107 | 0.784992 | 0.018115 |
You are tasked with creating a program that calculates the perimeter and area of a triangle given its three vertices. The program should include the following functions:
- getabc(xa, ya, xb, yb, xc, yc) : This function should take the coordinates of the three vertices (xa, ya), (xb, yb), and (xc, yc) as input and calcu... | glaive | [
0.02941303327679634,
0.04016345739364624,
-0.040054041892290115,
-0.026003414765000343,
0.03703845292329788,
-0.014642920345067978,
-0.03349146246910095,
0.0552465058863163,
0.036697689443826675,
-0.0036446996964514256,
0.02310207299888134,
0.05589732900261879,
-0.029947444796562195,
-0.03... | 0.789127 | 0.749929 | 0.039198 |
You are tasked with writing a CUDA program to transpose a 4x4 matrix. The given matrix is represented as a 2D array of integers. Your program should use CUDA to create a kernel that transposes the matrix and then copy the result back to the host for printing. | glaive | [
0.019047796726226807,
0.05125351622700691,
-0.011422510258853436,
-0.024641670286655426,
0.048181939870119095,
-0.015339622274041176,
-0.02644573710858822,
0.07617014646530151,
0.04892536997795105,
-0.013700348325073719,
0.025890860706567764,
0.033308327198028564,
-0.012511647306382656,
-0... | 0.797486 | 0.779159 | 0.018326 |
What are some ways to sort an array of integers in programming? | glaive | [
0.02762833796441555,
0.02091831900179386,
-0.02366696484386921,
-0.01750723086297512,
0.026696395128965378,
-0.03821771219372749,
-0.02345352992415428,
0.03262077271938324,
0.035049036145210266,
-0.032603997737169266,
0.027016086503863335,
0.026036405935883522,
-0.05153898149728775,
-0.019... | 0.787427 | 0.768061 | 0.019366 |
You are tasked with implementing a pseudo-random number generator in non-interactive mode using the HolKernel Parse boolLib. The pseudo-random number generator is defined in the given code snippet and includes the definitions of pseudo_linear_hd and pseudo_linear_tl. Additionally, theorems leading to the definition of ... | glaive | [
0.006142558995634317,
0.022987106814980507,
-0.02694421261548996,
-0.03362036496400833,
0.030842436477541924,
-0.029318107292056084,
-0.02074723318219185,
0.06602635234594345,
0.028157778084278107,
-0.019652726128697395,
0.0020073428750038147,
0.026753287762403488,
-0.021571878343820572,
0... | 0.800977 | 0.783533 | 0.017444 |
You are tasked with creating a program that calculates the probability of a quantum state using a given amplitude function. The amplitude is determined by two variables x and y, and the probability is determined by the absolute value squared of the amplitude function. Additionally, you need to use simulated annealing t... | glaive | [
0.00254240189678967,
0.04883071035146713,
-0.03209787234663963,
-0.023670898750424385,
0.038017138838768005,
-0.03498619422316551,
-0.02505241520702839,
0.07457610964775085,
0.0326758548617363,
0.006575120147317648,
0.021053509786725044,
0.021798158064484596,
-0.026844073086977005,
-0.0042... | 0.800644 | 0.766117 | 0.034527 |
You are tasked with analyzing and modeling the macroscopic structure of tags applied by users to annotate and catalogue questions on a large Question-and-Answer (Q&A) platform, similar to Stack Exchange. Your goal is to study the distribution of tag frequencies and the structure of ‘co-tagging’ networks, where nodes ar... | glaive | [
0.016617443412542343,
-0.0012461952865123749,
-0.05155899375677109,
-0.01594170182943344,
0.025146694853901863,
-0.01979473978281021,
-0.01145375706255436,
0.035989366471767426,
0.012425070628523827,
-0.008757744915783405,
-0.004864904098212719,
0.03312670439481735,
-0.006268883589655161,
... | 0.792981 | 0.776658 | 0.016323 |
You are required to implement a CUDA program that performs histogram equalization on a grayscale image. The program should take the path to the image as input, compute the histogram of the image, and then perform the necessary operations to equalize the histogram. Finally, the program should display the equalized image... | glaive | [
-0.0001384130009682849,
0.01548918429762125,
-0.015516449697315693,
-0.028422478586435318,
0.025355640798807144,
-0.010271879844367504,
-0.021666288375854492,
0.11368661373853683,
0.06413523852825165,
-0.03107663430273533,
0.027852879837155342,
0.022726967930793762,
-0.006758679635822773,
... | 0.790434 | 0.772498 | 0.017936 |
You are tasked with implementing a function that evaluates mathematical expressions based on the given grammar. The grammar consists of the following types of expressions:
- VarX and VarY: Represent variables x and y, respectively
- Sine and Cosine: Represent trigonometric functions sine and cosine
- Average: Represent... | glaive | [
0.028383897617459297,
0.017398184165358543,
-0.03410126641392708,
-0.0477125458419323,
0.04726068302989006,
-0.03685468062758446,
-0.013935314491391182,
0.07587111741304398,
0.052069079130887985,
-0.006283494643867016,
0.018213823437690735,
0.036556996405124664,
-0.028713751584291458,
-0.0... | 0.797582 | 0.771737 | 0.025845 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.