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 simulating a music beat tracker. You are given a series of "Beat" events, each with a timestamp and a beat number. Additionally, you are given a series of "Note" events, each with a start and end timestamp, and a note value. Your task is to write a program that can identify which beat number each no... | glaive | [
0.04425672069191933,
0.04037836939096451,
-0.05324016883969307,
-0.00468656187877059,
0.026712296530604362,
-0.02242054045200348,
-0.019966838881373405,
0.05758969858288765,
0.03618248924612999,
-0.008165300823748112,
0.03894944489002228,
0.004979083314538002,
-0.028655102476477623,
0.0175... | 0.815825 | 0.789752 | 0.026073 |
How can I write a C++ program that finds the maximum sum subarray of a given array? | glaive | [
0.0028292429633438587,
0.021470624953508377,
-0.03669491037726402,
-0.025381768122315407,
0.038659483194351196,
-0.011335286311805248,
-0.029554570093750954,
0.07014921307563782,
0.037768397480249405,
-0.02990168146789074,
0.028496967628598213,
0.04879504442214966,
-0.033356890082359314,
-... | 0.802562 | 0.777472 | 0.02509 |
Is there a way to write a program that can display all the prime numbers from 1 to a given number N? | glaive | [
0.02521686442196369,
0.015974361449480057,
-0.023961903527379036,
-0.038310155272483826,
0.0280253104865551,
-0.05353058874607086,
-0.00000857584564073477,
0.04239717498421669,
0.02553582563996315,
-0.03724724054336548,
0.031904518604278564,
0.05603398010134697,
-0.03982088714838028,
-0.02... | 0.799497 | 0.782949 | 0.016548 |
You are tasked with implementing an insertion sort function in Haskell, with the following constraints:
1. The function should take a list of elements and return a sorted list.
2. The sorted list should have the same size as the input list.
3. The sorted list should contain the same elements as the input list, with th... | glaive | [
0.04685109108686447,
-0.005716592539101839,
-0.02707025408744812,
-0.03193940967321396,
0.05514833331108093,
-0.0132024846971035,
-0.00798023957759142,
0.0414399690926075,
0.05583172291517258,
-0.011263750493526459,
0.01919441856443882,
0.0414062924683094,
-0.009390832856297493,
-0.0195768... | 0.809919 | 0.788587 | 0.021332 |
You are tasked with implementing a program that handles mathematical operations on vectors and transformations. The program should include the following functionalities:
1. Define a struct MVector3 with three required double fields (X, Y, Z) to represent a 3-dimensional vector.
2. Define a struct MVector2 with two requ... | glaive | [
0.031148338690400124,
0.024729885160923004,
-0.03538865968585014,
-0.045966506004333496,
0.04547920078039169,
-0.0012657491024583578,
-0.03493918478488922,
0.07963019609451294,
0.04677169770002365,
-0.017680492252111435,
0.012636067345738411,
0.03629036247730255,
-0.023571785539388657,
-0.... | 0.804286 | 0.780292 | 0.023994 |
You are tasked with creating a JavaScript module that exports a function to 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 JavaScrip... | glaive | [
0.015862150117754936,
0.03615277260541916,
-0.025584621354937553,
-0.02572501450777054,
0.04721401259303093,
-0.024833321571350098,
-0.023188956081867218,
0.051083143800497055,
0.04376803711056709,
-0.0167818795889616,
0.014668116346001625,
0.04223407059907913,
-0.04888320714235306,
-0.008... | 0.801336 | 0.779723 | 0.021613 |
You are tasked with implementing a C/C++ function that calculates the minimum of two input values. The function should be named "min" and should take two parameters, A and B, and return the minimum of the two values. | glaive | [
0.01387977134436369,
0.019229549914598465,
-0.035015616565942764,
-0.020603179931640625,
0.05380544811487198,
-0.014159820973873138,
-0.027858763933181763,
0.07296539843082428,
0.052397243678569794,
-0.009592284448444843,
0.027899766340851784,
0.04047555848956108,
-0.0004184342105872929,
-... | 0.810472 | 0.769892 | 0.04058 |
You are tasked with implementing a primitive hardened counter module in SystemVerilog. The module should support two styles of hardened counting: duplicate count and cross count. In duplicate count mode, there are two copies of the relevant counter that are constantly compared. In cross count mode, there is an up count... | glaive | [
0.024569712579250336,
0.024713942781090736,
-0.01839694194495678,
-0.03491554036736488,
0.02945060469210148,
-0.029496392235159874,
-0.0077920835465192795,
0.10316002368927002,
0.02943548560142517,
-0.025578003376722336,
0.024687575176358223,
0.03708658739924431,
-0.007446181960403919,
-0.... | 0.813373 | 0.797461 | 0.015912 |
You are tasked with implementing a program that manipulates bignums, rationals, and complex numbers in Racket. Your program needs to support creating bignums, converting bignums to floating-point numbers, creating rationals from a numerator and denominator, and creating complex numbers from real and imaginary parts. Ad... | glaive | [
0.042946502566337585,
0.033127445727586746,
-0.023377282544970512,
-0.04533795267343521,
0.037812020629644394,
-0.02175113372504711,
-0.004230924881994724,
0.038864947855472565,
0.0459049753844738,
-0.03039451874792576,
0.028455276042222977,
0.06139633432030678,
-0.031378328800201416,
-0.0... | 0.80728 | 0.77751 | 0.02977 |
You are required to write a program that calculates the probability of a quantum state for a given set of quantum bits (qubits) and then visualizes the probability distribution in a 3D plot and a contour plot.
The program should include the following components:
- Define a function `amplitude[x_, y_]` that calculates ... | glaive | [
-0.009470431134104729,
0.02807411178946495,
-0.03401574119925499,
-0.023705292493104935,
0.033709704875946045,
-0.019833512604236603,
-0.02081480249762535,
0.07010610401630402,
0.04258868470788002,
0.0055478462018072605,
0.02927311696112156,
0.031338468194007874,
-0.013348262757062912,
-0.... | 0.800184 | 0.776402 | 0.023782 |
You are required to implement a function that calculates the distance between image patches using CUDA on an Nvidia GPU. The function should take in two 3D tensors representing the target and reference images, a 2D tensor of block labels, and various other parameters such as the number of nearest neighbors (k), image d... | glaive | [
-0.006555419415235519,
0.04326464608311653,
-0.02788221836090088,
-0.010340694338083267,
0.030185425654053688,
-0.009167972952127457,
-0.045838382095098495,
0.08344736695289612,
0.048137009143829346,
-0.020861338824033737,
0.030566664412617683,
0.02577666938304901,
-0.016638897359371185,
0... | 0.800992 | 0.781299 | 0.019693 |
You are given the task to solve a finite difference discretization of the Helmholtz equation using Jacobi iterative method. The equation is as follows:
(d2/dx2)u + (d2/dy2)u - alpha u = f
Here are the input parameters you need to consider:
- n: grid dimension in x direction
- m: grid dimension in y direction
- alpha: H... | glaive | [
0.008522517047822475,
0.028347203508019447,
-0.041651401668787,
-0.04594317451119423,
0.02207253687083721,
-0.031700797379016876,
-0.026809411123394966,
0.061118144541978836,
0.049504898488521576,
0.0007820689352229238,
0.016337253153324127,
0.03346370533108711,
-0.018229400739073753,
0.00... | 0.7959 | 0.764812 | 0.031088 |
You are tasked with creating a function that compares two input values and provides information about their types and their relationship with each other. The function should display the type of each input value and whether one value is strictly less than, less than or equal to, strictly greater than, greater than or eq... | glaive | [
0.028315581381320953,
0.015906671062111855,
-0.0380210317671299,
-0.027202019467949867,
0.046728361397981644,
-0.03741588070988655,
0.0027627735398709774,
0.062338948249816895,
0.05684708058834076,
-0.02152433805167675,
0.03625958785414696,
0.044776156544685364,
-0.011677599512040615,
-0.0... | 0.800389 | 0.778272 | 0.022117 |
You are tasked with creating a class that will test the size of an integer set. The class should include a method called `sizeInteger` that will return the size of the integer set. The method should be called using the following syntax: `TiSetTest new sizeInteger.` | glaive | [
0.023325016722083092,
0.01752386800944805,
-0.03144657239317894,
-0.03611224517226219,
0.05054980143904686,
-0.03657766804099083,
-0.01295567862689495,
0.05093229562044144,
0.04147873446345329,
-0.014108091592788696,
0.0408514179289341,
0.044508468359708786,
-0.030694589018821716,
-0.01337... | 0.807226 | 0.789499 | 0.017727 |
You are tasked with creating a program that calculates the probability distribution of a quantum state for a given set of amplitudes. The program should be able to find the maximum probability of the quantum state and visualize the probability distribution in a 3D plot and a contour plot. | glaive | [
0.005519109778106213,
0.024495558813214302,
-0.03821645677089691,
-0.033425021916627884,
0.04424838721752167,
-0.02153678424656391,
-0.02541656605899334,
0.07091887295246124,
0.04212458059191704,
-0.011909086257219315,
0.028101226314902306,
0.036723580211400986,
-0.018061000853776932,
-0.0... | 0.796365 | 0.777576 | 0.018789 |
You are tasked with creating a query to retrieve the total count of units in stock for each category in a product database. The database contains two relevant tables: "Product" and "Category". The "Product" table has a column "unitsInStock" to store the number of units in stock for each product, and a column "inCategor... | glaive | [
0.047277145087718964,
0.01994217559695244,
-0.050505828112363815,
-0.02892933413386345,
0.03215820714831352,
-0.038029737770557404,
-0.06437039375305176,
0.05550328269600868,
0.040960464626550674,
-0.002504142699763179,
0.010218346491456032,
0.02999892830848694,
-0.02033023163676262,
-0.00... | 0.760539 | 0.733564 | 0.026975 |
You are tasked with creating a program to calculate and visualize the probability of quantum states for a given set of qubits. The program should utilize the given amplitude and probability functions to find the maximum probability and generate 3D and contour plots for visualization. | glaive | [
0.004349495749920607,
0.03549378365278244,
-0.03339109197258949,
-0.02248515747487545,
0.0458039827644825,
-0.02606155350804329,
-0.023250222206115723,
0.07058902084827423,
0.037880416959524155,
-0.0031425359193235636,
0.03403770178556442,
0.042659975588321686,
-0.011205042712390423,
-0.01... | 0.793035 | 0.770809 | 0.022226 |
You are tasked with implementing a program that tests a workload distribution using the given code snippet as a reference. Essentially, you are required to create a worker function and a set of input data. The worker function will be applied in parallel to each data set, and if one of the workers reports success, the t... | glaive | [
0.018928881734609604,
0.02892211265861988,
-0.030358560383319855,
-0.029937710613012314,
0.04061773419380188,
-0.005267800763249397,
-0.00475009111687541,
0.08122001588344574,
0.04195524752140045,
-0.010483420453965664,
0.02889849618077278,
0.037040919065475464,
-0.012868196703493595,
0.00... | 0.829851 | 0.813404 | 0.016447 |
You are tasked with implementing a quantum probability distribution using a given set of quantum state amplitudes. The goal is to find the maximum probability of a quantum state and visualize the probability distribution in 3D and 2D.
You are given the following quantum state amplitudes:
```
amplitude[x_,y_] := (Exp[-... | glaive | [
-0.0018293787725269794,
0.025048743933439255,
-0.02547873929142952,
-0.030556483194231987,
0.03623297065496445,
-0.01421589870005846,
-0.01712787337601185,
0.07018103450536728,
0.03949197009205818,
0.014493332244455814,
0.03179194778203964,
0.0372110940515995,
-0.011186892166733742,
-0.016... | 0.791186 | 0.761443 | 0.029743 |
You are tasked with implementing a cleavage propagation routine in Fortran using the given code snippet as a reference. You need to write a subroutine called cgca_clvgp that takes in various inputs such as coarray, rt, t, scrit, sub, gcus, periodicbc, iter, heartbeat, and debug, and performs cleavage propagation on a c... | glaive | [
0.010335559956729412,
0.03978719189763069,
-0.017955148592591286,
-0.028985517099499702,
0.027783378958702087,
-0.02413764037191868,
-0.01905152201652527,
0.08138781040906906,
0.02272140234708786,
-0.01239718683063984,
0.0052964044734835625,
0.03270840272307396,
-0.027666699141263962,
0.00... | 0.799488 | 0.784816 | 0.014672 |
You are tasked with implementing a CUDA program that performs cubic B-spline interpolation on a given input image.
The program needs to perform the following steps:
1. Compute the geometry based on the input angle, xShift, yShift, xOrigin, and yOrigin.
2. Allocate memory for the output image.
3. Visit all pixels of th... | glaive | [
-0.004077655728906393,
0.03862868249416351,
-0.02099333517253399,
-0.021078651770949364,
0.024321099743247032,
-0.023133592680096626,
-0.01362577360123396,
0.08723920583724976,
0.0573028139770031,
-0.018740195780992508,
0.03391087427735329,
0.03527526184916496,
-0.003254008712247014,
0.013... | 0.789541 | 0.774768 | 0.014773 |
You are tasked with creating a function in Clojure that takes in a list of numbers and returns a new list with each number multiplied by 2. The function should be named "double-numbers" and should take in a single parameter "numbers". | glaive | [
0.019790980964899063,
0.045550864189863205,
-0.025883762165904045,
-0.04625220596790314,
0.026866436004638672,
-0.020836830139160156,
-0.0066074891947209835,
0.032765407115221024,
0.02918175235390663,
-0.01538913231343031,
0.019606485962867737,
0.048458974808454514,
-0.01903104968369007,
-... | 0.796755 | 0.773578 | 0.023177 |
You are tasked with implementing a program that models the action of a group G on a set Ω. Specifically, you need to define a function that takes in a group G, a set Ω, and a pair (α, g) where α is an element of Ω and g is an element of G, and returns the element α^g of Ω resulting from the action of g on α. Additional... | glaive | [
0.03434848412871361,
0.03501711040735245,
-0.015857547521591187,
-0.038488537073135376,
0.038397178053855896,
-0.04202107712626457,
-0.01012500375509262,
0.07188354432582855,
0.04124407470226288,
-0.013497048057615757,
0.01014941930770874,
0.025221535935997963,
-0.018245629966259003,
-0.02... | 0.80621 | 0.77185 | 0.03436 |
You are given a grid representing a puzzle. The grid contains cells, each of which can be one of the following types:
- Empty: An empty cell
- Shape of id: A cell containing a shape with a specific ID
- Start of id: A cell marking the start of a path with a specific ID
- End of id: A cell marking the end of a path with... | glaive | [
0.009370765648782253,
0.01626548357307911,
-0.016247790306806564,
-0.022451195865869522,
0.02647334337234497,
-0.024754652753472328,
-0.024963734671473503,
0.05997245013713837,
0.03089909628033638,
-0.02803516760468483,
0.026131026446819305,
0.01445301715284586,
-0.01893758587539196,
-0.01... | 0.836464 | 0.785296 | 0.051168 |
You are tasked with implementing a function to calculate the product of two matrices. The matrices are represented as two-dimensional arrays, and the product of two matrices A and B is a matrix C, where C[i][j] is the sum of the products of the elements in the i-th row of A and the j-th column of B. The dimensions of t... | glaive | [
0.02274354360997677,
0.03679367154836655,
-0.04071539267897606,
-0.02680845931172371,
0.058721981942653656,
-0.007208907976746559,
-0.03542466089129448,
0.07971253991127014,
0.04493006691336632,
-0.010943453758955002,
0.0033684370573610067,
0.033457882702350616,
-0.03144052252173424,
-0.03... | 0.787903 | 0.742356 | 0.045546 |
You are tasked with creating a program that calculates the score of a hand in a card game. The program should take a set of cards as input and calculate the score based on the following rules:
- Each numeric card contributes its face value to the total score.
- Each face card (J, Q, K) contributes 10 points to the tota... | glaive | [
-0.008030978962779045,
0.039299238473176956,
-0.0268170777708292,
-0.027760086581110954,
0.03845379129052162,
-0.041028253734111786,
-0.016787517815828323,
0.034999530762434006,
0.020953645929694176,
-0.017852790653705597,
0.018767710775136948,
0.03479655459523201,
-0.04231635108590126,
-0... | 0.813556 | 0.785777 | 0.027779 |
I was asked the following question today at Adobe interview for the position of software engineer.
**Problem** Given a array `arr[1..n]` of integers. Write an algorithm to find the sum of contiguous subarray within the array which has the largest sum. Return 0 if all the numbers are negative.
**Example**
Given ar... | glaive | [
0.01520243939012289,
0.02381066046655178,
-0.052209313958883286,
-0.0364454910159111,
0.029823757708072662,
-0.018171541392803192,
-0.023341279476881027,
0.0776100754737854,
0.037186965346336365,
-0.013360652141273022,
0.03672351688146591,
0.017748957499861717,
-0.026145942509174347,
-0.01... | 0.82543 | 0.784458 | 0.040973 |
You are tasked with creating a program to calculate the volume of a 3D linear Landau system using the provided linear_landau_3d_ls.cpp library. The program should take input for the length, width, and height of the system and then output the calculated volume. Ensure that the program handles both positive and negative ... | glaive | [
0.003073408966884017,
0.03257157281041145,
-0.0422741137444973,
-0.05642694607377052,
0.05022658407688141,
-0.021275971084833145,
-0.04406602680683136,
0.07144847512245178,
0.03604137897491455,
-0.009266323409974575,
0.0304001122713089,
0.05764545127749443,
-0.025152800604701042,
-0.028921... | 0.788814 | 0.771106 | 0.017708 |
Can you help me classify the following algorithms as sorting or searching algorithms? | glaive | [
0.028482118621468544,
0.013707281090319157,
-0.010152269154787064,
-0.016564451158046722,
0.018786070868372917,
-0.02377098985016346,
-0.029593905434012413,
0.03745957836508751,
0.034836918115615845,
-0.016296077519655228,
0.020093640312552452,
0.00854493211954832,
-0.02873532474040985,
-0... | 0.801867 | 0.773869 | 0.027998 |
I am trying to create a program for a matchmaking event held by Subcity Radio, where participants can find potential matches based on their interests and preferences. I need to implement a function that takes in a list of participants with their interests and returns the best matches for each participant based on their... | glaive | [
0.03442249074578285,
0.009827842004597187,
-0.05424303188920021,
-0.01873200573027134,
0.041088394820690155,
-0.016830161213874817,
-0.010249589569866657,
0.0008873341139405966,
0.038996268063783646,
-0.028214942663908005,
0.01828853227198124,
0.02673046477138996,
-0.00729098217561841,
0.0... | 0.804829 | 0.788595 | 0.016234 |
What is an algorithm in Python that efficiently calculates the sum of numbers in an array? | glaive | [
0.0010997421341016889,
0.03586222976446152,
-0.044073596596717834,
-0.04067020118236542,
0.042058881372213364,
-0.026748668402433395,
-0.029438441619277,
0.034443024545907974,
0.017650172114372253,
-0.03475439175963402,
0.013801103457808495,
0.03862488269805908,
-0.03856630623340607,
-0.00... | 0.7885 | 0.768248 | 0.020253 |
You are tasked with implementing a simple moving average (SMA) calculation using parallel prefix-sum or "scan" operation on a data series. The SMA is the average of a data series over a specified window size w. The goal is to efficiently compute the SMA using the given data series and window size.
Your task is to crea... | glaive | [
0.001225918997079134,
0.041281361132860184,
-0.02974611520767212,
-0.028788024559617043,
0.04874046891927719,
-0.01803823933005333,
-0.05503377690911293,
0.10577593743801117,
0.04697590693831444,
-0.01189209520816803,
0.02326596900820732,
0.03226587176322937,
-0.02110535092651844,
-0.01105... | 0.805322 | 0.785335 | 0.019987 |
How can I write a program in C++ to calculate the sum of two given numbers? | glaive | [
-0.006805436685681343,
0.017087137326598167,
-0.030855627730488777,
-0.030404046177864075,
0.050664324313402176,
-0.007471243850886822,
-0.01747593656182289,
0.0805414542555809,
0.04453757405281067,
-0.02801472693681717,
0.022002749145030975,
0.05213765799999237,
-0.036916811019182205,
-0.... | 0.777365 | 0.762784 | 0.014581 |
You are tasked with implementing a Java enumeration for a set of Thrift opcodes. The enumeration should include the following opcodes:
- INVALID_OPCODE
- COMPOUND_NOT
- COMPOUND_AND
- COMPOUND_OR
- CAST
- FILTER_IN
- FILTER_NOT_IN
- FILTER_NEW_IN
- FILTER_NEW_NOT_IN
- EQ
- NE
- LT
- LE
- GT
- GE
- CONDITION_IF
- CONDI... | glaive | [
0.023119762539863586,
0.022755809128284454,
-0.012138563208281994,
-0.04334907606244087,
0.02442963235080242,
-0.04227324575185776,
-0.015087895095348358,
0.06033375859260559,
0.0264351274818182,
-0.004419610369950533,
0.03819582983851433,
0.0240787323564291,
-0.03456879034638405,
0.002088... | 0.810342 | 0.78705 | 0.023291 |
You are tasked with writing a program to calculate the bispectrum of a set of galaxy data and random data. The bispectrum is a statistical measure of the clustering of matter in the universe, which is important for understanding the large-scale structure of the cosmos.
The program should read in two files containing t... | glaive | [
-0.001390968100167811,
0.026027599349617958,
-0.03179951012134552,
-0.03564324975013733,
0.03441431000828743,
-0.02788401022553444,
-0.03034091740846634,
0.04786204919219017,
0.04147179797291756,
-0.025118350982666016,
0.013217701576650143,
0.03261301666498184,
-0.03409465402364731,
-0.005... | 0.796728 | 0.775905 | 0.020822 |
You are tasked with creating a program that reads input from a user and checks if the input is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your program should take a string as input and... | glaive | [
0.0212454404681921,
0.012424605898559093,
-0.012981465086340904,
-0.020382825285196304,
0.03159760683774948,
-0.01846887171268463,
0.013789640739560127,
0.07158173620700836,
0.030367501080036163,
-0.01498002465814352,
0.015479221940040588,
0.019387254491448402,
-0.018783872947096825,
-0.03... | 0.806567 | 0.771035 | 0.035532 |
You are tasked with implementing a Fortran subroutine called DPPTRS that solves a system of linear equations A*X = B with a symmetric positive definite matrix A in packed storage using the Cholesky factorization A = U**T*U or A = L*L**T computed by DPPTRF.
The subroutine takes the following arguments:
- UPLO: a charac... | glaive | [
0.016015660017728806,
0.014809924177825451,
-0.05056126415729523,
-0.05063839256763458,
0.03297729790210724,
-0.03641361743211746,
0.010171699337661266,
0.06430542469024658,
0.04361690208315849,
-0.004970494657754898,
0.00840403139591217,
0.04210175946354866,
-0.022730553522706032,
-0.0048... | 0.808984 | 0.778911 | 0.030072 |
You are tasked with creating a function in a programming language of your choice that can perform equivalences between finite numbers. The function should be able to perform the following equivalences:
1. Equivalence between fin 0 and empty
2. Equivalence between fin 1 and punit
3. Equivalence between fin 2 and bool
4.... | glaive | [
0.03966211527585983,
0.020048238337039948,
-0.027068793773651123,
-0.05201321467757225,
0.04766212776303291,
-0.026653388515114784,
-0.013716921210289001,
0.0655524730682373,
0.03374098613858223,
-0.025002846494317055,
0.024507641792297363,
0.04134096950292587,
-0.03313899785280228,
-0.011... | 0.833927 | 0.802964 | 0.030963 |
You are tasked with implementing a function in ACL2 called `explode-atom` that takes in an integer `x` and a base and returns a list of characters representing the integer in the given base. The function should satisfy the following properties:
1. The result of `explode-atom` should be a true list.
2. If the input is a... | glaive | [
0.05602448433637619,
0.029043324291706085,
-0.02148788422346115,
-0.049831733107566833,
0.04411863535642624,
-0.05369885265827179,
0.004827076103538275,
0.0672585740685463,
0.04962489381432533,
-0.018972743302583694,
0.03477828949689865,
0.02655470371246338,
-0.02943541295826435,
-0.030719... | 0.822179 | 0.80101 | 0.021169 |
I am trying to generate all different iterable sets of a given sequence with different lengths, considering repetitions. For example, if the sequence is "ABC" and the maximum allowed length is 3, I want to generate all possible sequences with lengths 0, 1, 2, and 3. The total number of sequences can be calculated using... | glaive | [
0.016855943948030472,
0.021304277703166008,
-0.01793859153985977,
-0.029468202963471413,
0.031105726957321167,
-0.04327080398797989,
-0.035996370017528534,
0.07935809344053268,
0.02385098859667778,
-0.036877475678920746,
0.025262780487537384,
0.03528233617544174,
-0.039141397923231125,
-0.... | 0.81598 | 0.78878 | 0.027201 |
You are tasked with creating a program to model and analyze learning behaviors in a hypothetical scenario. The program will be used to estimate individual learning parameters and make predictions based on a set of input data. The program should take into account the following data:
- N: The number of subjects (N > 0)
... | glaive | [
0.0005627325735986233,
0.004330724477767944,
-0.04624613747000694,
-0.041736625134944916,
0.0419088639318943,
-0.03883777931332588,
-0.017504094168543816,
0.06751895695924759,
0.032533857971429825,
-0.014990853145718575,
0.010636960156261921,
0.016472121700644493,
-0.022043377161026,
0.006... | 0.795706 | 0.77399 | 0.021716 |
You are tasked with simulating the probability distribution for a quantum system with 12 qubits. The system is described by a complex-valued function called `amplitude`, which takes two input parameters, `x` and `y`. The probability of measuring a specific state is given by the square of the absolute value of `amplitud... | glaive | [
0.0028064996004104614,
0.022845864295959473,
-0.02851620689034462,
-0.023746851831674576,
0.04033908620476723,
-0.02766416035592556,
-0.02235652692615986,
0.0652666985988617,
0.03294882923364639,
0.0015745674027130008,
0.02281367965042591,
0.0375872366130352,
-0.0023610196076333523,
-0.010... | 0.799748 | 0.769343 | 0.030405 |
You are tasked with creating a function in R that takes a matrix as input and performs a series of vectorization operations on it. The function should include the following operations:
1. Raise each element of the matrix to the power of -1
2. Multiply each column of the matrix by a given vector of length equal to the n... | glaive | [
0.031081320717930794,
0.038445644080638885,
-0.023312116041779518,
-0.04092585667967796,
0.05112611502408981,
-0.021794551983475685,
-0.01319874357432127,
0.07615047693252563,
0.044343575835227966,
-0.0009583164355717599,
-0.005638803821057081,
0.021611569449305534,
-0.03305710479617119,
-... | 0.793221 | 0.762713 | 0.030507 |
Can you provide a program that can find the missing element in an array of consecutively increasing numbers? | glaive | [
0.018934275954961777,
0.033125318586826324,
-0.033529143780469894,
-0.039788685739040375,
0.02883915603160858,
-0.029683059081435204,
-0.017439091578125954,
0.06495992094278336,
0.034448809921741486,
-0.040665529668331146,
0.030557427555322647,
0.019438451156020164,
-0.0519874282181263,
-0... | 0.807419 | 0.786041 | 0.021378 |
You are tasked with implementing a function in C++ that performs a sparse matrix-vector multiplication using the Unsymmetric Blocked Compressed Sparse Row (UBCSR) format. The function should take in three parameters: a pointer to a UBCSR matrix (u), a pointer to a vector (v), and a pointer to the resulting vector (r). ... | glaive | [
0.01109329704195261,
0.04437723383307457,
-0.018405158072710037,
-0.018047727644443512,
0.03725820779800415,
-0.004208290949463844,
-0.03385733440518379,
0.10636682063341141,
0.04319047927856445,
-0.01432771049439907,
0.016061706468462944,
0.04173263907432556,
0.0008652795804664493,
-0.014... | 0.799687 | 0.770007 | 0.02968 |
You are asked to write a program that takes an input of a number and determines whether it is even or odd. If the number is even, the program should return "Even", and if the number is odd, the program should return "Odd". If the input is not a number, the program should print "Usage: please input a number". | glaive | [
0.031111160293221474,
0.011342121288180351,
-0.031441543251276016,
-0.04135867580771446,
0.026585018262267113,
-0.011164023540914059,
-0.01236190926283598,
0.06187186762690544,
0.045498862862586975,
-0.02311733365058899,
0.018100107088685036,
0.040079839527606964,
-0.03358033671975136,
-0.... | 0.797133 | 0.767774 | 0.029359 |
You are tasked with implementing a CUDA kernel for a pair potential calculation in molecular dynamics simulations. The potential function is defined as follows:
For the first potential function (potnum = 1):
\[ u_1(x_{ij}, \mu, \eta, \kappa) = \left( \mu_1 \cdot \left( x_0 \right)^{\mu_2} , \mu_3 \cdot \left( x_0 \rig... | glaive | [
0.018246138468384743,
0.04610618203878403,
-0.020483942702412605,
-0.020244773477315903,
0.03729213401675224,
-0.024049345403909683,
-0.02293243631720543,
0.09347905218601227,
0.05384281650185585,
-0.01988178677856922,
0.03239165246486664,
0.042029526084661484,
-0.015932312235236168,
-0.02... | 0.80513 | 0.788861 | 0.016269 |
You are tasked with creating a quantum computing program that calculates the probability of a quantum state. The program should take in the number of qubits, the name of the state, and the number of states as input. The program should then use the given amplitude and probability functions to calculate the maximum proba... | glaive | [
0.0002627550857141614,
0.0338718481361866,
-0.023594705387949944,
-0.018094779923558235,
0.03812951222062111,
-0.013742530718445778,
-0.022020289674401283,
0.07285171747207642,
0.03269451856613159,
-0.0076739429496228695,
0.029811887070536613,
0.036616649478673935,
-0.013844963163137436,
-... | 0.796411 | 0.770683 | 0.025728 |
You are required to implement a CUDA kernel for calculating the divergence of a vector with a variable coefficient in the term in the momentum equation. The input parameters for the kernel are double* Dn, double* Phi, double* U, double* V, int row, int col, double delX, double delY. The calculation involves a series of... | glaive | [
0.003080040216445923,
0.04223199933767319,
-0.024805868044495583,
-0.022299254313111305,
0.023517461493611336,
-0.01413955632597208,
-0.043610330671072006,
0.08893543481826782,
0.05473516136407852,
-0.0012467291671782732,
0.020367739722132683,
0.0370195135474205,
-0.015324796549975872,
-0.... | 0.795832 | 0.772497 | 0.023335 |
You are tasked with optimizing a complex mathematical function using the NMaximize function in Mathematica. The function is defined as follows:
function[x_, y_] := $Conjugate[Exp[-11 I y] (1 (I Sin[x])^3 Cos[x]^8 + 1 (I Sin[x])^8 Cos[x]^3) + Exp[-9 I y] (8 (I Sin[x])^2 Cos[x]^9 + 8 (I Sin[x])^9 Cos[x]^2 + 18 (I Sin[x]... | glaive | [
0.010546339675784111,
0.02499239705502987,
-0.03626421093940735,
-0.03800204023718834,
0.03519682213664055,
-0.02208484709262848,
-0.03536229953169823,
0.05363049358129501,
0.047495946288108826,
0.023469625040888786,
0.017995381727814674,
0.034592628479003906,
-0.04494522139430046,
-0.0081... | 0.803885 | 0.772657 | 0.031228 |
You are tasked with creating a program that calculates the probability of a given quantum state. The amplitude of the state is defined by the function `amplitude[x,y]`, and the probability is calculated using the `probability[x,y]` function. The program should then use the `NMaximize` function to find the maximum proba... | glaive | [
-0.0021123031619936228,
0.026576906442642212,
-0.03173511102795601,
-0.02034151367843151,
0.04332435876131058,
-0.01944117806851864,
-0.014314878731966019,
0.07285108417272568,
0.03970477730035782,
0.007032033521682024,
0.02667083963751793,
0.04090723767876625,
-0.01608365774154663,
-0.008... | 0.791681 | 0.764917 | 0.026764 |
You are tasked with creating a program to calculate the probability distribution for a quantum system with 16 qubits and 4 states. The probability is determined by the amplitude of the wave function, which is given by the function `amplitude[x_,y_]`. You need to find the maximum probability and its corresponding values... | glaive | [
-0.006658919155597687,
0.027511635795235634,
-0.034641083329916,
-0.01689060963690281,
0.05002521350979805,
-0.028487639501690865,
-0.029720760881900787,
0.06446600705385208,
0.0420362651348114,
0.0017237304709851742,
0.023144960403442383,
0.03682210296392441,
-0.0034564360976219177,
-0.01... | 0.795596 | 0.76276 | 0.032836 |
You are tasked with creating a CUDA program that performs binarization on an image. The input to your program will be an unsigned integer array representing the image, along with the width and height of the image. Additionally, a threshold value will be provided for the binarization process. The goal is to convert the ... | glaive | [
-0.014956727623939514,
0.03602807596325874,
-0.022016732022166252,
-0.005483841057866812,
0.01680454984307289,
-0.0026707511860877275,
-0.01635734736919403,
0.10830003768205643,
0.06711283326148987,
-0.017523398622870445,
0.02394566312432289,
0.022240126505494118,
0.0016034244326874614,
0.... | 0.793813 | 0.777225 | 0.016587 |
You are tasked with creating a CUDA program that reads a matrix from a file, applies a threshold to the matrix, and then displays the resulting matrix. The program needs to take a filename as a command-line argument, open the file, read the matrix dimensions and threshold value, allocate memory for the matrix, read the... | glaive | [
0.011272095143795013,
0.028067534789443016,
-0.01479587983340025,
-0.03364374116063118,
0.029347728937864304,
-0.030758650973439217,
-0.023712249472737312,
0.09144233167171478,
0.03460213169455528,
-0.022666648030281067,
0.00658013392239809,
0.03216581419110298,
-0.008936022408306599,
0.00... | 0.801078 | 0.785656 | 0.015422 |
You are tasked with implementing a program that calculates the maximum probability of a quantum state given certain parameters. The program should define the amplitude, probability, and then find the maximum probability using simulated annealing method. Finally, it should plot a 3D and contour plot of the probability. | glaive | [
0.01320804562419653,
0.03019784949719906,
-0.030522312968969345,
-0.028027066960930824,
0.0386415496468544,
-0.0198258887976408,
-0.02193925529718399,
0.07148268073797226,
0.034674469381570816,
-0.009841320104897022,
0.027521245181560516,
0.038598399609327316,
-0.010946203954517841,
-0.007... | 0.805519 | 0.781081 | 0.024439 |
I want to create a program that calculates the area of a circle, rectangle, or triangle based on user input. The program should prompt the user to enter the shape they want to calculate the area for, as well as the necessary dimensions for each shape. Then, the program should display the calculated area.
Write a prog... | glaive | [
0.0049004568718373775,
0.04188991338014603,
-0.03802019730210304,
-0.036206312477588654,
0.04508303105831146,
-0.016132399439811707,
-0.032183341681957245,
0.08573324233293533,
0.049039505422115326,
-0.024642478674650192,
0.03129349648952484,
0.046119898557662964,
-0.029959674924612045,
-0... | 0.780842 | 0.766431 | 0.014411 |
How can I classify the given data into separate classes of 'A', 'B', and 'C' in Python? | glaive | [
0.015527182258665562,
0.02493802085518837,
-0.026660636067390442,
-0.016104673966765404,
0.0347277857363224,
-0.03692030906677246,
-0.018873540684580803,
0.04544026404619217,
0.032779913395643234,
-0.02304435893893242,
0.009172794409096241,
0.03204192966222763,
-0.017784740775823593,
-0.01... | 0.800384 | 0.785757 | 0.014628 |
You are tasked with creating a class that represents a Gaussian Mixture, which is a probabilistic model used in statistics. Your implementation should include the following functionalities:
- A constructor that initializes the Gaussian Mixture with a vector of WeightedGaussian objects
- A method to return the number of... | glaive | [
-0.003462557215243578,
0.000441225478425622,
-0.009962267242372036,
-0.021130984649062157,
0.04666197672486305,
-0.0120620746165514,
-0.019226448610424995,
0.07356686145067215,
0.04440940171480179,
-0.0022539901547133923,
0.03643128275871277,
0.04455127567052841,
0.003706687828525901,
-0.0... | 0.800486 | 0.783107 | 0.01738 |
You are required to create a module for a typed lambda calculus abstract syntax tree (AST) using Haskell. The abstract syntax should include a type language and a term language. The type language should consist of boolean and integer types, as well as arrow types for functions. The term language should include boolean ... | glaive | [
0.027833430096507072,
0.019891805946826935,
-0.026257632300257683,
-0.03632061928510666,
0.0498877614736557,
-0.02594306692481041,
-0.0051323589868843555,
0.05517808720469475,
0.029374685138463974,
-0.03362666442990303,
0.023905372247099876,
0.05328024923801422,
-0.012595778331160545,
-0.0... | 0.794153 | 0.779497 | 0.014656 |
You are tasked with creating a program to generate a two-parameter family of embeddings of the trefoil in R^3. The program should take in parameters a and b, and output the coordinates of the trefoil knot in R^3 using the given formula:
[(1 + a * cos(3 * t)) * cos(2 * t),
(1 + a * cos(3 * t)) * sin(2 * t),
b * sin(... | glaive | [
0.02463134191930294,
0.040856149047613144,
-0.025694990530610085,
-0.04632240906357765,
0.03368144854903221,
-0.00823625735938549,
-0.02916571870446205,
0.06264536827802658,
0.03287466615438461,
-0.0066421483643352985,
0.024111155420541763,
0.043294280767440796,
-0.019477317109704018,
-0.0... | 0.812398 | 0.782731 | 0.029667 |
How can I write a C program that generates a Fibonacci sequence of N numbers? | glaive | [
0.0013622503029182553,
0.01229091640561819,
-0.026114637032151222,
-0.021462654694914818,
0.03143627941608429,
-0.0336601585149765,
-0.03140145167708397,
0.07610669732093811,
0.02364281378686428,
-0.03717675060033798,
0.023581858724355698,
0.05124858021736145,
-0.048719294369220734,
-0.023... | 0.794019 | 0.776682 | 0.017338 |
You are tasked with implementing a program to handle a social network of friends. The network consists of five people named Alice, Bob, Carol, Donald, and Ester, each with a list of buddies. The buddies of a person are divided into direct buddies and indirect buddies, with the set of all direct and indirect buddies bei... | glaive | [
0.016022706404328346,
0.018552124500274658,
-0.037935320287942886,
-0.011339832097291946,
0.012724131345748901,
-0.028070950880646706,
-0.004720938391983509,
0.030259905382990837,
0.044719260185956955,
-0.021150561049580574,
0.03745967894792557,
0.020940473303198814,
-0.021489595994353294,
... | 0.820277 | 0.792323 | 0.027955 |
You are tasked with implementing a function in C++ that takes a 2D array as input and applies a specific stencil operation to each element of the array. The stencil operation involves performing a weighted sum of the values in the neighborhood of each element and updating the element with the result of the sum. The nei... | glaive | [
0.006946754176169634,
0.0391932837665081,
-0.014194195158779621,
-0.03346393629908562,
0.047015801072120667,
-0.016278672963380814,
-0.038312822580337524,
0.11663223803043365,
0.04095664620399475,
-0.010918766260147095,
0.04697059094905853,
0.04925023391842842,
-0.007308415602892637,
-0.00... | 0.814998 | 0.782539 | 0.032459 |
You are tasked with creating a CUDA kernel to compute the ambient occlusion for every voronoi vertex. The kernel should remember every vertex with a higher ao value than the threshold and the intersected faces. The input parameters for the kernel include the Octree of the surface in CUDA representation, the faces that ... | glaive | [
0.02143697440624237,
0.04670400172472,
-0.03185974061489105,
-0.0374772772192955,
-0.00007590380118926987,
-0.008576811291277409,
-0.018099594861268997,
0.07431524246931076,
0.054446738213300705,
-0.01838354580104351,
0.03645586967468262,
0.03863465413451195,
-0.0017310072435066104,
0.0173... | 0.797552 | 0.778368 | 0.019184 |
You are tasked with creating a program that calculates the probability of a quantum state given a set of parameters. The program should be able to maximize the probability and then visualize the results in a 3D plot and a contour plot. The parameters involved are `nqubits`, `name`, `nstates`, `amplitude`, `amplitude2`,... | glaive | [
0.0024621845223009586,
0.03305625542998314,
-0.03645846247673035,
-0.02212170511484146,
0.037298183888196945,
-0.024806490167975426,
-0.017018817365169525,
0.06992591917514801,
0.02746209129691124,
0.007596062030643225,
0.03429529815912247,
0.0473671481013298,
-0.020675938576459885,
-0.009... | 0.799453 | 0.779148 | 0.020304 |
You are tasked with implementing a function to perform multiplication of floating-point numbers in Zig programming language. The function should follow the IEEE-754 round-to-nearest, ties-to-even rounding mode. The input of the function includes the two floating-point numbers to be multiplied. The function should retur... | glaive | [
0.014955984428524971,
0.05077545717358589,
-0.01324778888374567,
-0.03520230948925018,
0.057772327214479446,
-0.019895607605576515,
-0.0036377173382788897,
0.03344948589801788,
0.01610495150089264,
-0.01251172088086605,
0.014388319104909897,
0.03499036282300949,
-0.021480949595570564,
-0.0... | 0.799522 | 0.777986 | 0.021536 |
You are tasked with creating a program that calculates the maximum probability of a quantum state and visualizes the probability distribution in 3D and 2D.
The program should include the following:
- Define a function `amplitude` that takes two parameters `x` and `y` and returns a complex number.
- Define a function `... | glaive | [
0.0012317030923441052,
0.03576837480068207,
-0.029182761907577515,
-0.026682870462536812,
0.04629003629088402,
-0.01735110580921173,
-0.02492682635784149,
0.07155729085206985,
0.04001450538635254,
0.006127018015831709,
0.03551183268427849,
0.04194174334406853,
-0.01191173680126667,
-0.0134... | 0.80193 | 0.770244 | 0.031686 |
You are tasked with creating a program that demonstrates the concept of pointer dereferencing and assignment in the C programming language. Write a program that declares a variable "a" of type i32 (32-bit integer) and assigns it the value 2. Then, declare a pointer "b" that points to the address of variable "a". Finall... | glaive | [
0.0036638639867305756,
0.04886167123913765,
-0.030008133500814438,
-0.008256921544671059,
0.027215389534831047,
-0.030194098129868507,
-0.014298644848167896,
0.07589501142501831,
0.04218847677111626,
-0.007308109197765589,
0.006983898114413023,
0.04530758410692215,
-0.050403326749801636,
0... | 0.789313 | 0.764285 | 0.025028 |
You are tasked with creating a program that simplifies logical formulas using a specific set of operations. The program must be able to handle various logical expressions and simplify them according to certain rules. The logical expressions will include existential quantifiers, conjunctions, disjunctions, and equality ... | glaive | [
0.012114018201828003,
0.025202041491866112,
-0.037663426250219345,
-0.031277596950531006,
0.04989142715930939,
-0.02985447458922863,
-0.018352922052145004,
0.06976887583732605,
0.05367487668991089,
-0.03513774275779724,
0.00820245686918497,
0.020673466846346855,
-0.027978163212537766,
-0.0... | 0.80034 | 0.785746 | 0.014594 |
You are tasked with creating a function that intersects a list of arrays for common dimension names. The function should take in the following parameters:
- l: List of arrays to perform operations on
- along: The axis along which to intersect
- drop: Drop unused dimensions on result
- fail_if_empty: Stop if intersectio... | glaive | [
0.02625041827559471,
0.028537429869174957,
-0.03235464170575142,
-0.04754799231886864,
0.047666288912296295,
-0.006915672216564417,
-0.017130432650446892,
0.019124643877148628,
0.0300169475376606,
-0.012162541039288044,
0.02198958955705166,
0.023619739338755608,
-0.012567974627017975,
-0.0... | 0.796564 | 0.771395 | 0.025168 |
You are tasked with creating a program that will generate a visual effect using a specific set of mathematical operations. The program should take into account the provided code snippet and use the given framework and technology to create the desired output.
Your program should include the following key components:
- ... | glaive | [
0.020644666627049446,
0.03470771387219429,
-0.018156252801418304,
-0.031703509390354156,
0.03238322585821152,
-0.023181015625596046,
-0.029467863962054253,
0.08402612805366516,
0.037907470017671585,
-0.008518318645656109,
0.032599061727523804,
0.038134414702653885,
-0.017818260937929153,
0... | 0.807378 | 0.788073 | 0.019305 |
You are tasked with creating a SQL query to retrieve all records from a table 't3' where the value in the column 'x' is greater than NULL. Write a SQL query to achieve this. | glaive | [
0.012115038000047207,
0.01962033286690712,
-0.03843754157423973,
-0.02770271897315979,
0.0245195422321558,
-0.03407016769051552,
-0.0021772815380245447,
0.05436841398477554,
0.052077990025281906,
-0.015088374726474285,
0.04197630658745766,
0.02141995169222355,
-0.0337199829518795,
0.002739... | 0.777101 | 0.761736 | 0.015365 |
You are tasked with creating a program that performs matrix multiplication using both CPU and GPU. The program must include functions to initialize matrix data, print the matrix, perform matrix multiplication on the host, perform matrix multiplication on the GPU, and check the results for correctness. You are required ... | glaive | [
0.01743299886584282,
0.042853642255067825,
-0.024543195962905884,
-0.02777179889380932,
0.03592045232653618,
-0.0024902005679905415,
-0.0360402837395668,
0.0907372459769249,
0.030588746070861816,
-0.03837230056524277,
0.0038191168569028378,
0.036403838545084,
-0.008530743420124054,
-0.0112... | 0.790635 | 0.769896 | 0.02074 |
You are tasked with implementing a CUDA kernel that calculates the fused L2 distance and 1-nearest-neighbor computation in a single call. This function will eliminate the need for an intermediate buffer to store the output of gemm and reduce the memory read traffic on this intermediate buffer needed during the reductio... | glaive | [
-0.005100317299365997,
0.05543021857738495,
-0.02183384634554386,
-0.02135458216071129,
0.02863849140703678,
-0.004011076409369707,
-0.03845863416790962,
0.09617642313241959,
0.04562283307313919,
-0.005478659179061651,
0.029878083616495132,
0.03567631542682648,
-0.0056064496748149395,
0.00... | 0.814688 | 0.792494 | 0.022195 |
You are tasked with implementing a TensorProductQuadrature structure in Julia. The structure should have the following properties:
- It should be a subtype of Quadrature{D,T}
- It should have a field called coordinates of type Vector{Point{D,T}}
- It should have a field called weights of type Vector{T}
- It should have... | glaive | [
-0.007943213917315006,
0.021376214921474457,
-0.03687657043337822,
-0.03539703041315079,
0.04136873409152031,
-0.008543048985302448,
-0.016159538179636,
0.07980237901210785,
0.0483517199754715,
-0.009087697602808475,
0.015699146315455437,
0.040864478796720505,
-0.021606197580695152,
-0.023... | 0.792999 | 0.775475 | 0.017525 |
You are tasked with creating a program that takes in a list of integers and returns the maximum and minimum values in the list. Your program should be able to handle both positive and negative integers and should return the maximum and minimum values as separate outputs. | glaive | [
0.03956379368901253,
0.0037357783876359463,
-0.038244325667619705,
-0.03542443364858627,
0.046373043209314346,
-0.030931200832128525,
-0.03434693440794945,
0.038562167435884476,
0.047653935849666595,
-0.0194846224039793,
0.033348195254802704,
0.06038700044155121,
-0.0377025380730629,
-0.02... | 0.816291 | 0.775064 | 0.041227 |
You have been tasked with implementing a packing algorithm for rectangles in a 2D space. The algorithm should efficiently pack a given set of rectangles into the smallest possible area without overlapping. The rectangles have unique IDs and dimensions (width and height). Your task is to write a class called MaxRects th... | glaive | [
0.016544098034501076,
0.04950054734945297,
-0.025572340935468674,
-0.011800386011600494,
0.0230781901627779,
-0.012273617088794708,
-0.01712404377758503,
0.05268396437168121,
0.043046124279499054,
-0.0021383969578891993,
0.02029525488615036,
0.040855664759874344,
-0.013390672393143177,
-0.... | 0.829732 | 0.797026 | 0.032706 |
You are tasked with optimizing a complex mathematical function using a nested loop and then finding the maximum value using the NMaximize function. The function to be optimized is defined as a combination of exponential and trigonometric functions, and the optimization process involves iterating through a range of valu... | glaive | [
0.016462773084640503,
0.03602665290236473,
-0.04756605625152588,
-0.03321048989892006,
0.037518683820962906,
-0.020174920558929443,
-0.0387507900595665,
0.05654466897249222,
0.042066093534231186,
0.006823441479355097,
0.007116192951798439,
0.0299876369535923,
-0.03609447181224823,
0.011006... | 0.799251 | 0.767131 | 0.03212 |
You are tasked with implementing a function in a principal ideal ring (PIR) that determines whether a given ideal is maximal. A principal ideal ring is a commutative ring in which all ideals are principal. Your function should take an ideal as input and return true if the ideal is maximal, and false otherwise.
Impleme... | glaive | [
0.0312485508620739,
0.02685764618217945,
-0.010616198182106018,
-0.020082298666238785,
0.025739291682839394,
-0.023573745042085648,
-0.007742798887193203,
0.06349638104438782,
0.028502993285655975,
-0.007722960785031319,
0.018676985055208206,
0.030765794217586517,
-0.008205652236938477,
-0... | 0.806714 | 0.779327 | 0.027387 |
You are tasked with implementing a function in a programming language that takes two input parameters x and t, and calculates the value of the function fx(x, t) according to the following equations:
p(x) = X2S^2*x^2
z(x, t) = x^2/(8*t)
alpha(x, t) = (t - x^2/8)/K_FACTOR_C
qb(x, t) = 9/20 * (alpha(x, t) - 1)/sqrt(1 + p... | glaive | [
0.024203337728977203,
0.03752350062131882,
-0.05540453642606735,
-0.03900696709752083,
0.049995798617601395,
-0.032777633517980576,
-0.025703728199005127,
0.07225092500448227,
0.040830742567777634,
-0.0010203954298049212,
0.019742639735341072,
0.04548203945159912,
-0.034632548689842224,
0.... | 0.822547 | 0.797753 | 0.024794 |
You are tasked with implementing a function in Racket that calculates the sum of a given term over a specified range. The function should take in the term to be summed, the starting value of the range, the next value function, and the end value of the range. The term function should define the operation to be performed... | glaive | [
0.026671944186091423,
0.03163004666566849,
-0.03134491667151451,
-0.03119685873389244,
0.05743231624364853,
-0.015800245106220245,
-0.03142820671200752,
0.05975695326924324,
0.0406336709856987,
0.00018197775352746248,
0.016514427959918976,
0.06169189140200615,
-0.031478311866521835,
-0.003... | 0.80299 | 0.778373 | 0.024617 |
You are tasked with implementing a message decoder in VHDL. The decoder should receive a packet and extract various pieces of information from it, such as destination coordinates, multicast group, matrix type, matrix coordinates, and matrix element. Based on this information, the decoder should assign the extracted pac... | glaive | [
0.02343335561454296,
0.0273889247328043,
-0.009396634064614773,
-0.045680880546569824,
0.045990604907274246,
-0.03457055240869522,
-0.03533206507563591,
0.06707131862640381,
0.04542875662446022,
-0.010190203785896301,
0.0228563342243433,
0.037471070885658264,
-0.008004110306501389,
-0.0020... | 0.783032 | 0.763466 | 0.019566 |
Can you provide an algorithm to determine whether an integer is even or odd? | glaive | [
0.028166064992547035,
0.0029664456378668547,
-0.012795989401638508,
-0.032142143696546555,
0.017001541331410408,
-0.03988561034202576,
-0.02455703541636467,
0.04410921037197113,
0.047204457223415375,
-0.041219886392354965,
0.022740555927157402,
0.022668786346912384,
-0.03558703884482384,
-... | 0.793147 | 0.773996 | 0.019151 |
You are tasked with implementing a 2-dimensional distance transform algorithm in C++ that operates on an input grid of pixels. The goal is to calculate the distance of each pixel from the closest pixel and perform a customizable action on the squared pixel distance from the closest pixel. The algorithm should have a ti... | glaive | [
-0.005802164785563946,
0.047652918845415115,
-0.02777048572897911,
-0.03809692710638046,
0.030850566923618317,
-0.008039253763854504,
-0.030591018497943878,
0.09580165892839432,
0.04227714613080025,
-0.014433234930038452,
0.025070426985621452,
0.025296766310930252,
-0.021689174696803093,
0... | 0.815653 | 0.772697 | 0.042956 |
You are tasked with implementing a CUDA kernel to perform integer arithmetic operations. Your task is to write the code for the following operations:
1. Compute the shift amount of a given unsigned 32-bit integer using the `ushiftamt` function.
2. Compare two unsigned 32-bit integers using the `ucmp` function.
3. Calc... | glaive | [
0.013930886052548885,
0.06207723170518875,
-0.006759264972060919,
-0.015093576163053513,
0.028040146455168724,
-0.006508314982056618,
-0.02675366774201393,
0.08984768390655518,
0.050105005502700806,
-0.02102637104690075,
0.035259831696748734,
0.022264011204242706,
-0.0046475171111524105,
-... | 0.812065 | 0.78528 | 0.026785 |
You are tasked with implementing a CUDA kernel function icgNablaTForward, which calculates the forward pass of the NablaT operation. The NablaT operation computes the discrete divergence of a 2D or 3D vector field. The input to the kernel function is a 1D float array in, representing the input vector field, and the out... | glaive | [
0.0030639776960015297,
0.04297176003456116,
-0.031398240476846695,
-0.01240490097552538,
0.03747141733765602,
-0.007487785536795855,
-0.03856458514928818,
0.07790825515985489,
0.028674134984612465,
0.0025404193438589573,
0.019251512363553047,
0.03167654573917389,
-0.024190817028284073,
-0.... | 0.800781 | 0.773516 | 0.027264 |
You are tasked with creating a program to calculate and display the number of months required for the salary of two employees, Carlos and João, to become equal. Carlos's colleague João receives a salary that is one-third of Carlos's. Carlos invests his entire salary in a savings account that yields a 2% monthly interes... | glaive | [
0.0341002382338047,
0.02796264924108982,
-0.06156862899661064,
-0.049145836383104324,
0.04172088950872421,
0.0011245919158682227,
-0.020967988297343254,
0.0901717096567154,
0.025285599753260612,
-0.029428716748952866,
0.03486897051334381,
0.019206508994102478,
-0.03944937512278557,
0.00163... | 0.817366 | 0.790484 | 0.026882 |
You are tasked with implementing a function to calculate the least common multiple (LCM) and greatest common divisor (GCD) of a multiset of elements of a commutative cancel monoid with zero and a normalized GCD monoid. You need to define the functions `lcm` and `gcd` for a multiset of elements of type `α`, with the fol... | glaive | [
0.0263000950217247,
0.04260832816362381,
-0.021510448306798935,
-0.046531517058610916,
0.05880499258637428,
-0.02970554679632187,
-0.03301640972495079,
0.060150228440761566,
0.03225147724151611,
-0.03031734935939312,
0.016828669235110283,
0.024642925709486008,
-0.01387306023389101,
0.00305... | 0.819919 | 0.779443 | 0.040477 |
You are tasked with implementing a program that performs a specific operation on a given input. The program should initialize a variable, perform a calculation, and return the result.
The program should take a single argument, `arg1`, which represents the input value for the calculation. The program should then perfo... | glaive | [
0.03825165331363678,
0.0336742177605629,
-0.038345348089933395,
-0.026421796530485153,
0.05412321910262108,
-0.03328486159443855,
-0.016624366864562035,
0.06831959635019302,
0.047223050147295,
-0.015858512371778488,
0.030841825529932976,
0.03575095534324646,
-0.01870376616716385,
0.0041533... | 0.829312 | 0.805096 | 0.024216 |
You are tasked with implementing a function that calculates the probability of success based on the "quick" function. The function takes in several vectors and returns the probability of success. Additionally, you need to implement another function that calculates the partial log probability mass function using the Ber... | glaive | [
0.004529960453510284,
0.02543063275516033,
-0.041146744042634964,
-0.024552462622523308,
0.0460878424346447,
-0.02155820094048977,
-0.03099925071001053,
0.05526741221547127,
0.03681979328393936,
-0.004504299256950617,
0.0038792912382632494,
0.0325574055314064,
0.00008990053174784407,
-0.00... | 0.808198 | 0.784387 | 0.023811 |
You are tasked with implementing lazy sequence utilities in Gauche Scheme. Specifically, you need to write functions to perform operations on lazy sequences, such as mapping, filtering, taking elements, and concatenating sequences.
Your task is to implement the following functions:
- `lmap`: A function that applies a ... | glaive | [
0.03795189782977104,
0.03199515864253044,
0.0018246110994368792,
-0.041214197874069214,
0.0349130816757679,
-0.01291442196816206,
-0.007795798592269421,
0.06071075052022934,
0.019935961812734604,
-0.006068042479455471,
0.02333848550915718,
0.030703958123922348,
-0.0210631862282753,
-0.0053... | 0.80149 | 0.784106 | 0.017384 |
You have been tasked with implementing dimension reduction using unsupervised machine learning techniques. Your task is to write a program that takes a dataset as input and applies dimension reduction to reduce the number of features while retaining the most important information. You are required to use a specific uns... | glaive | [
-0.013963056728243828,
0.037133947014808655,
-0.034818027168512344,
-0.04482569172978401,
0.05301181972026825,
0.0032006308902055025,
-0.004218488000333309,
0.05898931249976158,
0.04421530291438103,
-0.008630520664155483,
0.013099262490868568,
0.01650705188512802,
-0.007927453145384789,
0.... | 0.807388 | 0.788964 | 0.018424 |
You are tasked with creating a function that takes a list of numbers as input and generates a list of equations as output. The equations should be formed by combining the numbers in the input list using the operators +, -, *, and /, in such a way that the equations are valid and unique.
Write a function `equationize` ... | glaive | [
0.04465479776263237,
0.030302302911877632,
-0.02610143832862377,
-0.04102175682783127,
0.04781043902039528,
-0.028565144166350365,
-0.005410980898886919,
0.04223277419805527,
0.04654102399945259,
-0.005496134050190449,
0.02920089289546013,
0.028263520449399948,
-0.018260838463902473,
-0.01... | 0.811724 | 0.777344 | 0.03438 |
You are tasked with implementing the feed-forward computation for a BERT model using the CUDA platform in C++. The feed-forward computation involves matrix multiplication and element-wise addition. The goal is to implement a GPU-accelerated version of the feed-forward computation using the given code snippet as a refer... | glaive | [
0.019737830385565758,
0.043778933584690094,
-0.003974596504122019,
-0.028535248711705208,
0.02547883428633213,
-0.013699893839657307,
-0.021964747458696365,
0.12291871011257172,
0.04671751335263252,
-0.025440195575356483,
0.014558935537934303,
0.05286131426692009,
-0.019466722384095192,
-0... | 0.795835 | 0.780236 | 0.015599 |
You are tasked with writing a CUDA kernel for unpacking neighbors from a given array into a matrix for coalesced access. The goal is to only unpack neighbors that match a specified inclusive range of forms and are within a certain cutoff. The kernel should be able to handle a large number of particles and efficiently c... | glaive | [
0.0013902424834668636,
0.0683407112956047,
-0.024010155349969864,
-0.008248340338468552,
0.027187541127204895,
-0.0013047485845163465,
-0.022692104801535606,
0.07908990979194641,
0.05092763528227806,
-0.002554982900619507,
0.026521719992160797,
0.035867176949977875,
-0.009305660612881184,
... | 0.810331 | 0.785638 | 0.024693 |
You are tasked with writing a Dart program that checks whether a given element occurs in a stream of elements. You will need to create a function that takes in a list of elements and a target element, and returns a boolean value indicating whether the target element is present in the list.
For example, given the inpu... | glaive | [
0.00985042192041874,
0.019905749708414078,
-0.02070457488298416,
-0.02978057786822319,
0.04835035651922226,
-0.020839225500822067,
-0.0007792860851623118,
0.07767500728368759,
0.03518816828727722,
-0.01571611501276493,
0.015133405104279518,
0.03340482711791992,
-0.006718554999679327,
-0.01... | 0.802309 | 0.786748 | 0.01556 |
What is the Matlab code to find the number that occurs most frequently in a matrix? | glaive | [
0.0004302311281207949,
0.017209837213158607,
-0.03647041320800781,
-0.040793515741825104,
0.051343124359846115,
-0.006521434988826513,
-0.023031754419207573,
0.04784879460930824,
0.01735934056341648,
-0.021145466715097427,
0.014700351282954216,
0.023938575759530067,
-0.01582496426999569,
-... | 0.796163 | 0.773271 | 0.022891 |
You are tasked with solving the n-queens problem. The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, you are to write a function totalNQueens(n int) int that returns the number of distinct solutions to the n-queens puzzle.
For exam... | glaive | [
0.021401481702923775,
0.008909600786864758,
-0.03623567894101143,
-0.022735532373189926,
0.041965194046497345,
0.005341541953384876,
-0.020102469250559807,
0.05790654942393303,
0.03428308293223381,
0.0016818889416754246,
0.012936776503920555,
0.02933022379875183,
-0.047717027366161346,
-0.... | 0.820516 | 0.764068 | 0.056447 |
I need help devising a computational procedure to calculate the number of trailing zeros in the factorial of extremely large numbers (up to 10^18). The algorithm should be efficient in terms of time complexity and handle cases where direct computation of the factorial is not possible due to its large size. Can someone ... | glaive | [
0.004544258117675781,
0.04314267262816429,
-0.012998177669942379,
-0.015731588006019592,
0.009664450772106647,
-0.010640118271112442,
-0.01736636459827423,
0.0521637424826622,
0.017389686778187752,
-0.026005029678344727,
0.010910464450716972,
0.016819527372717857,
-0.02196546085178852,
-0.... | 0.806797 | 0.781147 | 0.025651 |
You are tasked with creating a program to calculate the probability distribution and visualize the probability density function for a quantum system with 10 qubits. The system is described by the amplitude function, which takes two input variables x and y, and the probability function, which calculates the absolute val... | glaive | [
0.00902051106095314,
0.02491820976138115,
-0.045923005789518356,
-0.016816740855574608,
0.041012827306985855,
-0.03457530215382576,
-0.03007918782532215,
0.06638411432504654,
0.03942045941948891,
0.0026490027084946632,
0.016634570434689522,
0.03423706814646721,
-0.01726425252854824,
-0.012... | 0.797651 | 0.77171 | 0.025941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.