code
stringlengths
114
1.05M
path
stringlengths
3
312
quality_prob
float64
0.5
0.99
learning_prob
float64
0.2
1
filename
stringlengths
3
168
kind
stringclasses
1 value
// Zero-knowledge proof of knowledge of the discrete logarithm over safe prime product // A proof of knowledge of the discrete log of an element h2 = hx1 with respect to h1. // In our protocol, we will run two of these in parallel to prove that two elements h1,h2 generate the same group modN. package dlnproof impor...
crypto/dlnproof/proof.go
0.554712
0.562477
proof.go
starcoder
package content import ( "bytes" "fmt" "math/rand" "strings" "github.com/nboughton/go-roll" "github.com/nboughton/swnt/content/culture" "github.com/nboughton/swnt/content/format" "github.com/nboughton/swnt/content/name" ) // TagsTable represents the collection of Tags type TagsTable []Tag // Roll selects a ...
content/world.go
0.661376
0.406567
world.go
starcoder
package main import ( rl "github.com/gen2brain/raylib-go/raylib" "math" ) const ZOOM_FACTOR = 1.2 func NewGolState(world World, rules Rules) GoLState { goLState := GoLState{ updateEnabled: false, updateTickPeriod: 10, updateTicks: 0, camera2d: rl.Camera2D{}, world: world, ru...
golstate.go
0.532425
0.444384
golstate.go
starcoder
package utils import ( "math/big" "github.com/daoleno/uniswapv3-sdk/constants" ) var MaxFee = new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) func ComputeSwapStep(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, amountRemaining *big.Int, feePips constants.FeeAmount) (sqrtRatioNextX96, amountIn, amountOut,...
utils/swap_math.go
0.521959
0.522141
swap_math.go
starcoder
package grid /* A grid is an array of bools which indicate whether or not a fox can be there or not. */ type Grid struct { Values []bool Checks []map[int]bool } /* Function for generating a new grid with the appropriate preallocated space. */ func CreateBlankGrid() *Grid { values := make([]bool, len(BaseGri...
grid/grid.go
0.776708
0.487002
grid.go
starcoder
package arrowutil import ( "fmt" "github.com/influxdata/flux/array" ) // CompareFunc defines the interface for a comparison function. // The comparison function should return 0 for equivalent values, // -1 if x[i] is before y[j], and +1 if x[i] is after y[j]. type CompareFunc func(x, y array.Array, i, j int) int ...
internal/arrowutil/compare.gen.go
0.60743
0.663587
compare.gen.go
starcoder
package agent import ( "encoding/json" "fmt" "math" "github.com/stellentus/cartpoles/lib/logger" "github.com/stellentus/cartpoles/lib/rlglue" ) type handControllerSettings struct { EnableDebug bool `json:"enable-debug"` // PlanDuration is the number of actions that should be taken before looking at state aga...
lib/agent/hand.go
0.73431
0.451447
hand.go
starcoder
package jsondiff import ( "encoding/json" "fmt" "github.com/clarify/subtest" "github.com/nsf/jsondiff" ) // EqualJSON returns a check functions that fails if the the test value is not // equivalent to the expected JSON, or if either value is not valid JSON. func EqualJSON(expect string) subtest.CheckFunc { retu...
examples/jsondiff/chek.go
0.744656
0.44565
chek.go
starcoder
package model type Series struct { Type SeriesType `json:"type"` CoordinateSystem CoordinateSystem `json:"coordinateSystem"` Name string `json:"name"` ItemStyle *ItemStyle `json:"itemStyle,omitempty"` // Mark point in a chart. MarkPoint *MarkPoints `json:"markPoint,omite...
model/series.go
0.807726
0.425367
series.go
starcoder
package epd4in2 import ( "image/color" "machine" "time" ) type Config struct { Width int16 // Width is the display resolution Height int16 LogicalWidth int16 // LogicalWidth must be a multiple of 8 and same size or bigger than Width Rotation Rotation // Rotation is clock-wise } type Device...
waveshare-epd/epd4in2/epd4in2.go
0.597021
0.462837
epd4in2.go
starcoder
package generator import ( "crypto/rand" "fmt" ) type sequenceValueGenerator struct { valueStorage ValueStorage rangeStep uint64 sequences map[string]*SequenceRange rangeStepsToReserve map[string]uint64 } func NewSequenceValueGenerator(valueStorage ValueStorage, rangeStep uint64) Val...
generator/SequenceValueGenerator.go
0.699152
0.527499
SequenceValueGenerator.go
starcoder
package money import "errors" // Money stores amount and currency value type Money struct { amount *Amount currency *Currency } var calc = &calculator{} const ( greaterThanCheckResult = 1 equalCheckResult = 0 lessThanCheckResult = -1 ) // New creates and returns a new Money instance func New(amount...
money.go
0.846006
0.506836
money.go
starcoder
package decoder import ( "aoc-2021-day16/packet" "aoc-2021-day16/packet/lentype" "aoc-2021-day16/packet/pkgtype" "errors" "fmt" "github.com/dropbox/godropbox/container/bitvector" ) func Decode(vector *bitvector.BitVector) (packet.Packet, *bitvector.BitVector, error) { h, err := GetHeader(vector) if err != ni...
2021/day16/decoder/decoder.go
0.563858
0.419351
decoder.go
starcoder
package iso20022 // Chain of parties involved in the settlement of a transaction, including receipts and deliveries, book transfers, treasury deals, or other activities, resulting in the movement of a security or amount of money from one account to another. type SettlementParties49 struct { // First party in the set...
SettlementParties49.go
0.679498
0.468
SettlementParties49.go
starcoder
package path import ( "github.com/weworksandbox/lingo" "github.com/weworksandbox/lingo/expr" "github.com/weworksandbox/lingo/expr/operator" "github.com/weworksandbox/lingo/expr/set" "github.com/weworksandbox/lingo/sql" ) func NewFloat32WithAlias(e lingo.Table, name, alias string) Float32 { return Float32{ en...
expr/path/float32.go
0.701406
0.414543
float32.go
starcoder
package miris import ( "github.com/mitroadmaps/gomapinfer/common" "encoding/json" "io/ioutil" "sort" ) type Detection struct { FrameIdx int `json:"frame_idx"` TrackID int `json:"track_id"` Left int `json:"left"` Top int `json:"top"` Right int `json:"right"` Bottom int ...
miris/detection.go
0.674908
0.415847
detection.go
starcoder
package schemes import "image/color" // Fire is a gradient color scheme from grey to white through red and // yellow. var Fire []color.Color func init() { Fire = []color.Color{ color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}, color.RGBA{R: 0xff, G: 0xff, B: 0xfd, A: 0xff}, color.RGBA{R: 0xff, G: 0xff, B: 0xfa,...
schemes/fire.go
0.545286
0.667926
fire.go
starcoder
// Package mmf provides a sample match function that uses the GRPC harness to set up 1v1 matches. // This sample is a reference to demonstrate the usage of the GRPC harness and should only be used as // a starting point for your match function. You will need to modify the // matchmaking logic in this function based on...
examples/functions/golang/soloduel/mmf/matchfunction.go
0.752559
0.448547
matchfunction.go
starcoder
package test_version1 import ( "testing" "time" "github.com/pip-services-users/pip-clients-organizations-go/version1" "github.com/stretchr/testify/assert" ) type OrganizationsClientFixtureV1 struct { Client version1.IOrganizationsClientV1 } var ORGANIZATION1 = &version1.OrganizationV1{ Id: "1", Code...
test/version1/OrganizationsClientFixtureV1.go
0.570571
0.435121
OrganizationsClientFixtureV1.go
starcoder
package main import ( "math" ) func mathBboxes(bbox1 []float64, bbox2 []float64) bool { if bbox1[0] == bbox2[0] { if bbox1[1] == bbox2[1] { if bbox1[2] == bbox2[2] { if bbox1[3] == bbox2[3] { return true } } } } return false } //IOU Computes IUO (Intersection Over Union) between two bboxes...
utils.go
0.628635
0.473049
utils.go
starcoder
package yamlpatch import ( "fmt" "strconv" "github.com/pkg/errors" "gopkg.in/yaml.v3" ) // container is an interface to abstract away indexing into sequence (list) and mapping (object) nodes. // Keys are strings for compatibility with JSONPatch and JSON map keys. // Sequence containers parse integer indices fro...
yamlpatch/container.go
0.619701
0.514644
container.go
starcoder
package ahocorasick const ( AlphabetSize int64 = 256 // The size of the alphabet is fixed to the size of a byte. RootState int64 = 0 // The root state of the trie is always 0. EmptyCell int64 = -1 // Represents an unused cell. DefaultBase int64 = 0 // The default base for new states. ) // A TrieBuilde...
builder.go
0.736969
0.47244
builder.go
starcoder
package behavioural import "fmt" /* Summary: Template Method is used to define the skeleteon of the algorithm as a sequence of operations. How the operation is performed is left to the concrete implementations. Example: SurgeryWorkflowTemplate method Let's perform a surgery workflow for a patient using this. Surger...
behavioural/template_method.go
0.729712
0.452838
template_method.go
starcoder
package aws import ( "context" "time" "github.com/aws/aws-sdk-go/service/costexplorer" "github.com/golang/protobuf/ptypes/timestamp" "github.com/turbot/steampipe-plugin-sdk/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/plugin" ) // AllCostMetrics is a constant returning all the cost metrics func AllCost...
aws/cost_explorer.go
0.765944
0.46041
cost_explorer.go
starcoder
package neuralnet func multMatrixVect(m [][]float64, v []float64) []float64 { result := make([]float64, len(m)) for i := range result { var sum float64 for j := range v { sum += m[i][j] * v[j] } result[i] = sum } return result } func applySigmoidVector(v []float64) { for i := range v { v[i] = Sig...
linearalg.go
0.676086
0.528351
linearalg.go
starcoder
package token import ( "fmt" ) // Pos encodes a line, column and offset into a uint with max sizes of 4095x2 // and 127 in order Col (12 bits) | Off (12 bits) | Line (8 bits). type Pos uint // Zero is the zero position. const ( Zero Pos = (1 << 20) | 1 ) // At returns a position set to the given line, column and ...
internal/token/token.go
0.834069
0.574335
token.go
starcoder
// Package sortedset implements an AVL tree with ordered set behaviors. package sortedset import ( "fmt" coll "github.com/maguerrido/collection" ) // node of a AVL tree. type node struct { // value stored in the node. value interface{} // left points to a node smaller than this. // right points to a node grea...
sortedset/sortedset.go
0.901724
0.587411
sortedset.go
starcoder
package main import ( "fmt" "github.com/rooklift/sgf" ) func main() { // Start a new game tree and get the root node... root := sgf.NewTree(19) node := root // Here we create the ancient Chinese pattern... node.AddValue("AB", sgf.Point(3, 3)) node.AddValue("AB", sgf.Point(15, 15))...
examples/basic.go
0.637595
0.423637
basic.go
starcoder
package fp func BoolEquals(a, b Bool) bool { return a == b } func StringEquals(a, b String) bool { return a == b } func IntEquals(a, b Int) bool { return a == b } func Int8Equals(a, b Int8) bool { return a == b } func Int16Equals(a, b Int16) bool { return a == b } func Int32Equals(a, b Int32) bool { retur...
fp/bootstrap_func_equal.go
0.841077
0.707821
bootstrap_func_equal.go
starcoder
package svg import ( "fmt" "strings" "golang.org/x/image/math/fixed" ) // This file defines the basic path structure // Operation groups the different SVG commands type Operation interface { // SVG text representation of the command fmt.Stringer } // OpMoveTo moves the current point. type OpMoveTo fixed.Point...
path.go
0.822474
0.528473
path.go
starcoder
package kzg import ( "bytes" "encoding/binary" "golang.org/x/crypto/blake2b" "io" "io/ioutil" "go.dedis.ch/kyber/v3" "go.dedis.ch/kyber/v3/pairing/bn256" "golang.org/x/xerrors" ) // TrustedSetup is a trusted setup for KZG calculations with degree D. // The domain of Lagrange polynomials is either defined by ...
kzg/trusted.go
0.548432
0.42913
trusted.go
starcoder
package main import ( "fmt" gospec "github.com/AlaxLee/go-spec-util" ) func main() { representableExample01() representableExample02() } type Info struct { x string T string } func representableExample01() { /* x is representable by a value of T because x T 'a' byte ...
tutorial/02-assignability/representable.go
0.681303
0.501221
representable.go
starcoder
package edgedbtypes // Optional represents a shape field that is not required. type Optional struct { isSet bool } // Missing returns true if the value is missing. func (o *Optional) Missing() bool { return !o.isSet } // SetMissing sets the structs missing status. true means missing and false // means present. fun...
internal/edgedbtypes/numbers.go
0.933211
0.494385
numbers.go
starcoder
package athena type Operator struct { Column string `json:"column"` Operation operation `json:"operation"` Value OpValue `json:"value"` } type OpValue interface{} type operation string const ( EqualOp operation = "=" NotEqualOp operation = "!=" GreaterThanOp operation...
operators.go
0.757077
0.402099
operators.go
starcoder
package matrix var ( ident = Matrix3x3{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, } ) // Point3 is a point in 3-space. type Point3 [3]int func (p Point3) Sub(q Point3) Vector3 { return Vector3{q[0] - p[0], q[1] - p[1], q[2] - p[2]} } func (p Point3) Mul(rot Matrix3x3) Point3 { return Point3(Vector3(p).Mul(rot)) } ...
commongen/matrix/matrix.go
0.728265
0.670538
matrix.go
starcoder
package influxdbclient import "sort" type DataStat struct { Name string Min float64 Max float64 Mean float64 Median float64 Length int } type DataStats []DataStat func (ds *DataStats) FieldSort(field string) { switch field { case "name": sort.Sort(NameDataStats{*ds}) case "min": sort.Sort(Min...
datastat.go
0.603348
0.48749
datastat.go
starcoder
package main import "fmt" func MaximumCrossingArray(array []int, start, middle, end int) (startIndex, endIndex, maximum int) { maxUInt := ^uint(0) // inverse of 0 maxInt := int(maxUInt >> 1) // one int to the right (because first bit is used for the sign) minInt := -maxInt - 1 // zero is part of the ...
common_problems/maximum_subarray.go
0.718199
0.453806
maximum_subarray.go
starcoder
package types import ( "math/big" "github.com/vs-ude/tinyfyr/internal/errlog" "github.com/vs-ude/tinyfyr/internal/parser" ) // ExprType represents type information about an expression. // It is more powerful than type alone, because it can store values in case the expression is constant. // Furthermore, it expose...
internal/types/exprtype.go
0.655667
0.541833
exprtype.go
starcoder
package helpers import ( cryptoRand "crypto/rand" "fmt" "io" "math/rand" "reflect" "strconv" "time" "github.com/spf13/cast" ) func Empty(val interface{}) bool { if val == nil { return true } v := reflect.ValueOf(val) switch v.Kind() { case reflect.String, reflect.Array: return v.Len() == 0 case ref...
helpers/helpers.go
0.647687
0.404978
helpers.go
starcoder
package opt import ( "github.com/cockroachdb/cockroach/pkg/util" "github.com/cockroachdb/errors" ) // ColSet efficiently stores an unordered set of column ids. type ColSet struct { set util.FastIntSet } // MakeColSet returns a set initialized with the given values. func MakeColSet(vals ...ColumnID) ColSet { var...
pkg/sql/opt/colset.go
0.851537
0.456168
colset.go
starcoder
package simplersa import ( "bytes" "crypto/rand" "fmt" "math/big" ) // PublicKey is the public part of an RSA key pair. type PublicKey struct { N *big.Int E *big.Int } // PrivateKey is the private part of an RSA key pair. According to RFC 2313 we // could include the prime factors of N and other data here to m...
2019/rsa/simplersa.go
0.633183
0.429728
simplersa.go
starcoder
package camera import ( "github.com/anthonyrego/gosmf/shader" "github.com/go-gl/gl/v4.1-core/gl" "github.com/go-gl/mathgl/mgl32" ) var state struct { activeCam *Camera } func init() { state.activeCam = &Camera{} } // GetActiveCamera get the current camera in the state func GetActiveCamera() *Camera { return s...
camera/camera.go
0.830388
0.436562
camera.go
starcoder
package msgraph // RiskEventType undocumented type RiskEventType int const ( // RiskEventTypeVUnlikelyTravel undocumented RiskEventTypeVUnlikelyTravel RiskEventType = 0 // RiskEventTypeVAnonymizedIPAddress undocumented RiskEventTypeVAnonymizedIPAddress RiskEventType = 1 // RiskEventTypeVMaliciousIPAddress undoc...
v1.0/RiskEventTypeEnum.go
0.601828
0.41253
RiskEventTypeEnum.go
starcoder
package velocypack import ( "fmt" "io" ) // vpackAssert panics if v is false. func vpackAssert(v bool) { if !v { panic("VELOCYPACK_ASSERT failed") } } // readBytes reads bytes from the given reader until the given slice is full. func readBytes(dst []byte, r io.Reader) error { offset := 0 l := len(dst) for ...
deps/github.com/arangodb/go-velocypack/util.go
0.7237
0.416441
util.go
starcoder
package mysql_nodejs import ( . "github.com/gocircuit/circuit/gocircuit.org/render" ) func RenderBoot() string { return RenderHtml("Boot the circuit cluster", Render(bootBody, nil)) } const bootBody = ` <h1>Boot the circuit cluster</h1> <p>Booting the cluster involves starting your hosts, running the circuit on ...
gocircuit.org/tutorial/mysql-nodejs/boot.go
0.707506
0.663584
boot.go
starcoder
package siafile import ( "path/filepath" "gitlab.com/NebulousLabs/errors" "gitlab.com/NebulousLabs/writeaheadlog" "go.sia.tech/siad/modules" ) // CombinedChunkIndex is a helper method which translates a chunk's index to the // corresponding combined chunk index dependng on the number of combined chunks. func Com...
modules/renter/filesystem/siafile/partialssiafile.go
0.562898
0.441793
partialssiafile.go
starcoder
package kl import "github.com/rannoch/cldr" var calendar = cldr.Calendar{ Formats: cldr.CalendarFormats{ Date: cldr.CalendarDateFormat{Full: "EEEE dd MMMM y", Long: "dd MMMM y", Medium: "MMM dd, y", Short: "y-MM-dd"}, Time: cldr.CalendarDateFormat{Full: "h:mm:ss a zzzz", Long: "h:mm:ss a z", Medium: "h:m...
resources/locales/kl/calendar.go
0.526099
0.462109
calendar.go
starcoder
package common import ( "fmt" "github.com/cadmean-ru/amphion/common/a" ) // Boundary represents the boundaries of an object, like collider in unity type Boundary interface { IsPointInside(point a.Vector3) bool IsPointInside2D(point a.Vector3) bool } // RectBoundary represents a boundary in 3D space type RectBoun...
common/boundary.go
0.874185
0.722992
boundary.go
starcoder
package matchers import ( "fmt" "github.com/onsi/gomega" "github.com/onsi/gomega/format" "github.com/onsi/gomega/types" "reflect" ) type orderconsistofMatcher struct { Elements []interface{} } func OrderedConsistOf(elements ...interface{}) types.GomegaMatcher { return &orderconsistofMatcher{ Elements: eleme...
vmlifecycle/matchers/ordered_consist_of.go
0.705379
0.423875
ordered_consist_of.go
starcoder
package templates import ( "fmt" "reflect" "strconv" "time" ) func templateToInt(of interface{}) int { t := reflect.ValueOf(of).Kind() if t == reflect.Int || t == reflect.Int16 || t == reflect.Int32 || t == reflect.Int64 || t == reflect.Float32 || t == reflect.Float64 || t == reflect.Uint || t == ...
common/templates/general.go
0.523177
0.614886
general.go
starcoder
package bitmap import ( "errors" "fmt" "math" ) // Bitmap is a alias for map[int]bool used for better code reading. type Bitmap = map[int]bool const ( _bitmapLength = 8 _bitsInByte = 8 _firstByteIndex = 0 _firstBitOffset = 7 _lastBitOffset = 0 ) var ( // ErrBitmapISOWrongLength exported error for asser...
pkg/bitmap/bitmap.go
0.791902
0.478651
bitmap.go
starcoder
package interval import ( "math" "sync" ) type color int const ( red color = 0 black color = 1 sentinelPayload string = "sentinel" ) type ErrNotFound string func (e ErrNotFound) Error() string { return string(e) } // Tree represents an Interval tree with a root node and Mutex to // p...
interval/tree.go
0.872673
0.516474
tree.go
starcoder
package editdist import ( "unicode/utf8" ) type eventType uint8 const ( none eventType = iota same subst ins del ) func (e eventType) String() string { switch e { case subst: return "subst" case ins: return "ins" case del: return "del" default: return "" } } // ComputeDistanceMax computes the l...
ent/editdist/editdist.go
0.609524
0.411702
editdist.go
starcoder
package intertitle import ( "time" cabiriaImage "github.com/liampulles/cabiria/pkg/image" cabiriaTime "github.com/liampulles/cabiria/pkg/time" "github.com/liampulles/cabiria/pkg/time/period" ) // Range defines a set of frames which encapsulate an intertitle. // Range can be used as a Period. type Range struct {...
pkg/intertitle/range.go
0.842896
0.407274
range.go
starcoder
package DG2D import ( "fmt" "math" "github.com/notargets/gocfd/DG1D" "github.com/notargets/gocfd/utils" ) type Basis2D interface { PolynomialTerm(r, s float64, i, j int) (p float64) PolynomialTermDr(r, s float64, i, j int) (dr float64) PolynomialTermDs(r, s float64, i, j int) (ds float64) GetInterpMatrix(R, ...
DG2D/BasisFunctions.go
0.57344
0.64919
BasisFunctions.go
starcoder
package Summary //InferredDecision is a simple struct that contains a legal summary the classification of it. type InferredDecision struct { Summary string `json:"summary,omitempty"` Class string `json:"classificcao,omitempty"` } //Classify attempts up to four times to classify a text of an legal summary. //Every...
Summary/summary.go
0.77768
0.443359
summary.go
starcoder
package timeframe import ( "strconv" "strings" "time" ) //Absolute parses a token like 2017-03-18 and returns the Range it represents func Absolute(s string, loc *time.Location) (Range, error) { if len(s) < 4 || len(s) > 23 { //2017, 2017-03-18T22:50:00.000 return err() //cannot be a valid structure } if loc ...
absolute.go
0.598782
0.455622
absolute.go
starcoder
package storage import ( "encoding/json" "fmt" "testing" "github.com/ingrammicro/cio/api/types" "github.com/ingrammicro/cio/utils" "github.com/stretchr/testify/assert" ) // TODO exclude from release compile // ListVolumesMocked test mocked function func ListVolumesMocked(t *testing.T, volumesIn []*types.Volu...
api/storage/volumes_api_mocked.go
0.5144
0.435181
volumes_api_mocked.go
starcoder
package mol import "github.com/fogleman/ln/ln" type Atom struct { X, Y, Z float64 Symbol string } type Bond struct { I, J int Type int } type Molecule struct { Atoms []Atom Bonds []Bond } type Sphere struct { Center Vector Radius float64 Symbol string } type Cylinder struct { A, B Vector Radius floa...
vendor/github.com/fogleman/mol/mol/model.go
0.596786
0.51623
model.go
starcoder
// A sequence of elements supporting sequential and parallel aggregate // operations. The following example illustrates an aggregate operation using // SEE java/util/function/Consumer.java package consumer import ( "github.com/searKing/golang/go/error/exception" "github.com/searKing/golang/go/util/class" "github....
go/util/function/consumer/consumer.go
0.840423
0.409929
consumer.go
starcoder
package main import ( "image" "image/color" ) const ( VRAMTilePattern = 0x8000 // 0x8000-0x97FF VRAMTilePatternEnd = 0x97FF // 0x8000-0x97FF VRAMBackgroundMap = 0x9800 // 0x9800-0x9BFF VRAMBackgroundMapEnd = 0x9BFF // 0x9800-0x9BFF ) const ( TileWidth = 8 // Each tile is 8 pixels across TileHeigh...
goboy/video.go
0.570571
0.425904
video.go
starcoder
package handy import ( "strings" "unicode/utf8" ) const ( // TransformNone No transformations are ordered. Only constraints maximum length // TransformNone turns all other flags OFF. TransformNone = 1 // TransformFlagTrim Trim spaces before and after process the input // TransformFlagTrim Trims the string, rem...
transform.go
0.538255
0.491456
transform.go
starcoder
package operator import ( "github.com/matrixorigin/matrixone/pkg/container/nulls" "github.com/matrixorigin/matrixone/pkg/container/vector" "github.com/matrixorigin/matrixone/pkg/vm/process" ) func ColXorCol(lv, rv *vector.Vector, proc *process.Process) (*vector.Vector, error) { lvs, rvs := lv.Col.([]bool), rv.Col...
pkg/sql/plan2/function/operator/xor.go
0.545044
0.494507
xor.go
starcoder
package csv import ( "bufio" "encoding/csv" "fmt" "os" "pinmap/pm" ) // CSVReader reads the EC pin references from a comma separated // values file. type CSVReader struct { } // Name returns the name of this reader. func (r *CSVReader) Name() string { return "csv" } // Read reads the CSV file (provided as t...
util/pinmap/readers/csv/csv.go
0.579995
0.400486
csv.go
starcoder
package heap import ( "math" ) // Comparator is the interface to be implemented by heap value comparators. type Comparator interface { // Equal returns whether i is equal to j. Equal(i, j interface{}) bool // Less returns whether is is lower than j. Less(i, j interface{}) bool } // parentIndex returns the inde...
heap.go
0.851135
0.515254
heap.go
starcoder
package functions import ( "regexp" ) var FuncRegexpMatch = Function{ Description: `Reports whether the string <str> contains any match of the regular expression <pattern>. See https://golang.org/pkg/regexp/ for more details.`, Parameters: Parameters{{ Name: "pattern", }, { Name: "str", }}, }.MustWithFunc(fu...
template/functions/regexp.go
0.76366
0.523664
regexp.go
starcoder
package dataorg import ( "github.com/erician/gpdDB/common/gpdconst" "github.com/erician/gpdDB/utils/byteutil" ) //dnode means data node, and it has the same header with node //dnode is leaf node //DNodeGetPairLen get the space that a pair occupies func DNodeGetPairLen(key string, value string) int { return len(ke...
dataorg/dnode.go
0.508544
0.57332
dnode.go
starcoder
package main import ( "encoding/binary" . "github.com/mmcloughlin/avo/build" . "github.com/mmcloughlin/avo/operand" . "github.com/mmcloughlin/avo/reg" ) // preamble loads the input data and returns variables referencing those values func preamble(dataByteCount, dataByteMask Mem) (encoded Mem, encodedCap Register...
gen_decode_sse3.go
0.713132
0.464476
gen_decode_sse3.go
starcoder
package pbutil import ( "math" "math/big" "time" "google.golang.org/protobuf/types/known/timestamppb" ) // DuplicateTimestamp duplicates the Timestamp without any check. func DuplicateTimestamp(x *timestamppb.Timestamp) *timestamppb.Timestamp { if x == nil { return nil } return &timestamppb.Timestamp{ Sec...
timestamputils.go
0.850593
0.44559
timestamputils.go
starcoder
package iso20022 // Set of elements used to provide the total sum of entries per bank transaction code. type TotalsPerBankTransactionCode2 struct { // Number of individual entries for the bank transaction code. NumberOfEntries *Max15NumericText `xml:"NbOfNtries,omitempty"` // Total of all individual entries inclu...
TotalsPerBankTransactionCode2.go
0.781038
0.507751
TotalsPerBankTransactionCode2.go
starcoder
package horeb import ( "errors" "fmt" "math/rand" "sort" "strconv" ) // UnicodeBlock values represent a contiguous range of Unicode codepoints. type UnicodeBlock struct { Start, End rune } // Blocks is a map of short string labels to UnicodeBlock values. var Blocks = map[string]UnicodeBlock{ // Basic Multili...
pkg/horeb/blocks.go
0.586878
0.412767
blocks.go
starcoder
package support import ( "fmt" "unsafe" ) // CheckSize checks if the length of a byte slice is equal to the expected length, // and panics when this is not the case. func CheckSize(buf []byte, expected int, descrip string) { if len(buf) != expected { panic(fmt.Sprintf("Incorrect %s buffer size, expected (%d), go...
vendor/github.com/GoKillers/libsodium-go/support/support.go
0.72331
0.609437
support.go
starcoder
package leetcode // https://leetcode-cn.com/problems/asteroid-collision/ /** 735. 行星碰撞 给定一个整数数组 asteroids,表示在同一行的行星。 对于数组中的每一个元素,其绝对值表示行星的大小,正负表示行星的移动方向(正表示向右移动,负表示向左移动)。每一颗行星以相同的速度移动。 找出碰撞后剩下的所有行星。碰撞规则:两个行星相互碰撞,较小的行星会爆炸。如果两颗行星大小相同,则两颗行星都会爆炸。两颗移动方向相同的行星,永远不会发生碰撞。 示例 1: 输入: asteroids = [5, 10, -5] 输出: [5, 10] 解释:...
leetcode/golang/735_asteroid_collision.go
0.532911
0.538194
735_asteroid_collision.go
starcoder
package schemax /* Macros is a map structure associating a string value known as "macro" name with a dot-delimited ASN.1 object identifier. Use of this is limited to scenarios involving LDAP implementations that support OID macros for certain schema definition elements. */ type Macros map[string]OID func (r *Macros)...
map.go
0.783906
0.403332
map.go
starcoder
package hierarchical import ( "fmt" "github.com/knightjdr/prohits-viz-analysis/pkg/heatmap/dimensions" "github.com/knightjdr/prohits-viz-analysis/pkg/interactive" "github.com/knightjdr/prohits-viz-analysis/pkg/minimap" "github.com/knightjdr/prohits-viz-analysis/pkg/svg" "github.com/knightjdr/prohits-viz-analysi...
pkg/tools/analyze/dotplot/hierarchical/writedistance.go
0.540924
0.464234
writedistance.go
starcoder
package sensors import ( "encoding/binary" "fmt" "github.com/tinogoehlert/gobuki/utils" ) // GyroData stores XYZ Data from Gyro type GyroData struct { X float64 Y float64 Z float64 } const digitToDPS float64 = 0.00875 // ToVelocity rotates 90 degree counterclockwise about z-axis. // Sensing axis of 3d gyro i...
sensors/gyro.go
0.76454
0.544378
gyro.go
starcoder
package awsutil import ( "fmt" "github.com/aws/aws-sdk-go/aws/endpoints" "reflect" "sort" "strconv" "strings" "time" ) var ( scalarTypes = []string{ "bool", "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "float32", "float64", "string", } ...
aws/awsutil/blinkutil.go
0.653459
0.402157
blinkutil.go
starcoder
package buildin import ( "fmt" "math/big" ) // Number represents a casted integer type Number struct { Value *big.Int } // NewNumber creates new Number object as pointer func NewNumber(x int64) *Number { n := new(Number) n.Value = big.NewInt(x) return n } // SetUint64 sets uint64 to Number object func (x *Nu...
buildin/numbers.go
0.807764
0.47317
numbers.go
starcoder
package model // ParallelComponent is the option set for parallel component. type ParallelComponent struct { // Distance between parallel component and the left side of the container. // Left value can be instant pixel value like 20. // It can also be a percentage value relative to container width like '20%'; // ...
model/parallel.go
0.802285
0.483222
parallel.go
starcoder
package vector import ( "math" "github.com/revzim/azmath" ) type ( Vector struct { X float64 `json:"x"` Y float64 `json:"y"` Z float64 `json:"z"` } ) func New(n ...float64) *Vector { if len(n) == 1 { return &Vector{n[0], n[0], n[0]} } else if len(n) == 3 { return &Vector{n[0], n[1], n[2]} } return...
vector/vector.go
0.69368
0.608012
vector.go
starcoder
package oots import "math" type ConfidenceTree struct { Root *ConfidenceNode } func GetConfidenceTree() *ConfidenceTree { return &ConfidenceTree{Root:GetConfidenceNode()} } type ConfidenceNode struct { Child map[string]*ConfidenceNode `json:"c"` SuitableId string `json:"s,omitempty"` }...
oots/ConfidenceTree.go
0.649801
0.442034
ConfidenceTree.go
starcoder
package qppb import "github.com/snowzach/queryp" func (qp *QueryParameters) QueryParameters() *queryp.QueryParameters { return &queryp.QueryParameters{ Filter: FilterQP(qp.Filter), Sort: SortQP(qp.Sort), Options: qp.Options, Limit: int64(qp.Limit), Offset: int64(qp.Offset), } } func FilterQP(ftpb...
qppb/pbqp.go
0.578091
0.46873
pbqp.go
starcoder
package evo // Crosser creates a new child from the parents through crossover (or cloning if there is only one parent). The crosser is not responsible for mutation or for assigning the genome an ID or to a species. type Crosser interface { Cross(parents ...Genome) (child Genome, err error) } // Evaluator utilises th...
helpers.go
0.867233
0.683261
helpers.go
starcoder
package core import ( "math" ) func basePressure(stream FlightData) float64 { pressures := make([]float64, 0) for _, segment := range stream.AllSegments() { if segment.Computed.SmoothedPressure > 0 { pressures = append(pressures, segment.Computed.SmoothedPressure) } if len(pressures) >= 10 { var sum fl...
ground/core/computed.go
0.756178
0.528473
computed.go
starcoder
package piButterfly import ( "math" "github.com/czebos/pi/supportCode" ) // Input: lambda - security parameter, B - important variable for security // parties - all involved peoplesID, reci - the person expexting the message(Bob) // Output: an array of paths struct that contains array on IDs and Nonces // Creates...
piButterfly/supportCode.go
0.551091
0.482307
supportCode.go
starcoder
package codelab import ( "github.com/google/differential-privacy/privacy-on-beam/pbeam" "github.com/apache/beam/sdks/go/pkg/beam" ) // ComputeCountMeanSum computes the three aggregations (count, mean and sum) we // compute separately in the other files in a differentially private way. // This pipeline uses a singl...
privacy-on-beam/codelab/multiple.go
0.816589
0.453867
multiple.go
starcoder
package types import ( "sort" "strings" ) // Type represents a data type. type Type struct { // Kind will not be set when Ref is supplied. Kind Kind `json:",omitempty"` // Name is used as the descriptive name for the object. Name string `json:",omitempty"` // Element is used when Kind is an Array or Map. El...
types/type.go
0.739986
0.418578
type.go
starcoder
package ewkb import ( "database/sql/driver" "errors" "fmt" "github.com/kcasctiv/go-ewkb/geo" ) // Polygon presents Polygon geometry object type Polygon struct { header poly geo.Polygon } // NewPolygon returns new Polygon, // created from geometry base and coords data func NewPolygon(b Base, poly geo.Polygon) ...
polygon.go
0.786295
0.40807
polygon.go
starcoder
package counts import ( "math" ) // Count32 is a count of something, capped at math.MaxUint32. type Count32 uint32 // NewCount32 initializes a Count32 from a uint64, capped at // math.MaxUint32. func NewCount32(n uint64) Count32 { if n > math.MaxUint32 { return Count32(math.MaxUint32) } return Count32(n) } //...
counts/counts.go
0.851645
0.520679
counts.go
starcoder
package loerr func longestCollection(collections ...[]interface{}) int { max := 0 for _, collection := range collections { if len(collection) > max { max = len(collection) } } return max } // Zip2 creates a slice of grouped elements, the first of which contains the first elements // of the given arrays, ...
tuples.go
0.810516
0.809012
tuples.go
starcoder
package iso20022 // Provides the details of the interest calculation. type InterestCalculation4 struct { // Indicates the calculation date of the interest amount. CalculationDate *ISODate `xml:"ClctnDt"` // Provides the identification of the collateral account. CollateralAccountIdentification *CollateralAccount2...
InterestCalculation4.go
0.860882
0.736756
InterestCalculation4.go
starcoder
package mapstriface import ( "fmt" "time" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/schema" ) type ConvMap struct { Key string // The key in the data map Schema schema.Schema // The schema describing how to convert the sub-...
vendor/github.com/elastic/beats/metricbeat/schema/mapstriface/mapstriface.go
0.788827
0.411939
mapstriface.go
starcoder
package swagger type JsonWebKey struct { // The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resist...
sdk/go/hydra/swagger/json_web_key.go
0.83612
0.487063
json_web_key.go
starcoder
package p460 import ( "fmt" ) /** Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. put(key, value) - Set or insert t...
algorithms/p460/460.go
0.606265
0.525186
460.go
starcoder
package go2linq import ( "sort" "sync" ) // Reimplementing LINQ to Objects: Part 16 – IntersectErr (and build fiddling) // https://codeblog.jonskeet.uk/2010/12/30/reimplementing-linq-to-objects-part-16-intersect-and-build-fiddling/ // https://docs.microsoft.com/dotnet/api/system.linq.enumerable.intersect // Inter...
intersect.go
0.804751
0.50177
intersect.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // CertificateAuthority type CertificateAuthority struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be ...
models/microsoft/graph/certificate_authority.go
0.575469
0.451327
certificate_authority.go
starcoder
package ffnn import ( "gonum.org/v1/gonum/mat" "../utils/matrices" "../utils/matrices/ops" "math" "errors" "fmt" ) type FFLayer struct { // Layer Spec // Size of the input this layer requires inputSize int // Size of the output this layer brings outputSize int // The f function (will also hold its deriva...
ffnn/layers.go
0.678433
0.4165
layers.go
starcoder
package mdp import ( "fmt" "math" "math/rand" "github.com/misteroda/go-rl/base" ) const ( pqSize = 10000 minTDError = 0.001 minSDError = 0.0001 maxIterations = 1000000 numAnnealing = 7 ) // ValueIterator represents Value Iteration algorithm. type ValueIterator struct { model *Model V []float64 // state va...
mdp/value_iterator.go
0.660939
0.405243
value_iterator.go
starcoder
package r3 import ( "fmt" "math/big" ) const ( // prec is the number of bits of precision to use for the Float values. // To keep things simple, we use the maximum allowable precision on big // values. This allows us to handle all values we expect in the s2 library. prec = big.MaxPrec ) // define some commonl...
vendor/github.com/golang/geo/r3/precisevector.go
0.853211
0.716243
precisevector.go
starcoder
package gomock import ( "unsafe" ) // Trie is base trie tree interface{} type Trie interface { Insert(path string, response Response) Search(path string) (Response, bool) } type trie struct { root *node } type node struct { child *node bros *node path string partPath string queries Queries res...
pkg/gomock/trie.go
0.645455
0.400427
trie.go
starcoder