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
package movers import ( "github.com/wieku/danser-go/app/beatmap/objects" "github.com/wieku/danser-go/app/bmath" "github.com/wieku/danser-go/app/settings" "github.com/wieku/danser-go/framework/math/curves" "github.com/wieku/danser-go/framework/math/math32" "github.com/wieku/danser-go/framework/math/vector" "math...
app/dance/movers/angleoffset.go
0.664649
0.438545
angleoffset.go
starcoder
package util // PacketHeader that is sent with every packet // 24 bytes type PacketHeader struct { PacketFormat uint16 // 2020 GameMajorVersion uint8 // Game major version - "X.00" GameMinorVersion uint8 // Game minor version - "1.XX" PacketVersion uint8 // Version of this...
pkg/util/udp_structs.go
0.561095
0.495911
udp_structs.go
starcoder
package plot import ( "math" ) // Axis defines an axis that defines how values are transformed to canvas space. type Axis struct { // Min value of the axis (in value space) Min float64 // Max value of the axis (in value space) Max float64 Flip bool Ticks Ticks MajorTicks int MinorTicks int Transform...
axis.go
0.875188
0.641128
axis.go
starcoder
package resp import ( "math" "strconv" ) // Buffer is a utility buffer to write RESP values type Buffer struct { B []byte scratch []byte } // Reset resets the buffer func (b *Buffer) Reset() { b.B = b.B[:0] } // SimpleString writes a RESP simple string to the buffer func (b *Buffer) SimpleString(s string...
resp/buffer.go
0.591841
0.522385
buffer.go
starcoder
package genex import ( "math" "regexp/syntax" ) // Count computes the total number of matches the `input` regex would generate after whitelisting `charset`. // The `infinite` argument caps the maximum boundary of repetition operators. func Count(input, charset *syntax.Regexp, infinite int) float64 { var count func...
count.go
0.76934
0.41117
count.go
starcoder
package main import ( "math" "github.com/jakoblorz/sdfx/render" "github.com/jakoblorz/sdfx/sdf" ) var ( Bailout = 2.0 Power = 10.0 Iterations = 15 Epsilon = 0.01 ) type Mandelbulb struct { render.Material } func (m Mandelbulb) Evaluate(pos sdf.V3) float64 { var ( z = pos dr = 1.0 r = 0....
mandelbulb.go
0.71423
0.518973
mandelbulb.go
starcoder
package fp func (l BoolList) FoldLeftBool(z bool, f func(bool, bool) bool) bool { acc := z l.Foreach(func (e bool) { acc = f(acc, e) }) return acc} func (l BoolList) FoldLeftString(z string, f func(string, bool) string) string { acc := z l.Foreach(func (e bool) { acc = f(acc, e) }) return acc} func (l Bo...
fp/bootstrap_list_foldleft.go
0.755005
0.507995
bootstrap_list_foldleft.go
starcoder
package tree import ( "github.com/bestgopher/fucker" ) // BST节点 type bstTreeNode struct { value interface{} left *bstTreeNode right *bstTreeNode } func (b *bstTreeNode) Value() interface{} { return b.value } // 二叉查找树 type BinarySearchTree struct { root *bstTreeNode compare fucker.CompareFunc } func NewBi...
tree/binary_search_tree.go
0.500488
0.470068
binary_search_tree.go
starcoder
package smd import ( "fmt" "math" "math/rand" "strings" "time" "github.com/gonum/matrix/mat64" "github.com/gonum/stat/distmv" ) const ( r2d = 180 / math.Pi d2r = 1 / r2d ) var ( σρ = math.Pow(5e-3, 2) // m , but all measurements in km. σρDot = math.Pow(5e-6, 2) // m/s , but all measu...
station.go
0.697197
0.487429
station.go
starcoder
*/ package numf import ( "math" ) // Returns the delta between all consecutive floats. Returned slice length is one item shorter. func Delta(slice []float64) []float64 { if len(slice) < 2 { return nil } res := make([]float64, len(slice)-1) for i := 1; i < len(slice); i++ { res[i-1] = slice[i] - slice[i-1] ...
numf/numeric.go
0.800341
0.52141
numeric.go
starcoder
package bob //go:generate go run ./gen/main.go . PartX3 Mat6Pair mat6big all PartNotX3 mat6small import ( "bytes" "fmt" "io" "math" ) /* * Whoever designed this "binary" format should take a hard look at * himself in the mirror. Mixing 32 bit and 16 bit array sizes and * special casing types we decode to by f...
xt/bob/bob.go
0.577257
0.477981
bob.go
starcoder
package config import ( "os" "strings" "time" authorizerd "github.com/yahoojapan/athenz-authorizer/v5" "github.com/pkg/errors" yaml "gopkg.in/yaml.v2" ) const ( // currentVersion represents the current configuration version. currentVersion = "v2.0.0" ) // Config represents the configuration (config.yaml) o...
config/config.go
0.749179
0.426919
config.go
starcoder
package runtime import "reflect" func GT(left interface{}, right interface{}) bool { switch typedLeft := left.(type) { case int: switch typedRight := right.(type) { case int: return int(typedLeft) > typedRight case float64: return float64(typedLeft) > typedRight default: panic("can not compare int ...
docstore/runtime/comparison.go
0.657538
0.625867
comparison.go
starcoder
package tree import "github.com/strict-lang/sdk/pkg/compiler/input" // Node is implemented by every node of the tree. type Node interface { Locate() input.Region // Accept makes the visitor visit this node. Accept(visitor Visitor) // AcceptRecursive makes the visitor visit this node and its children. AcceptRecur...
pkg/compiler/grammar/tree/node.go
0.639511
0.518973
node.go
starcoder
package main import ( "fmt" ) // Key ... type Key int // Value ... type Value interface{} // Node ... type Node struct { key Key value Value left *Node right *Node } // Map implements a map from Key to Value. // The underlying datastructure is BST (binary search tree). // It is not guaranteed to be auto-ba...
cmd/map/main.go
0.745306
0.451871
main.go
starcoder
package chart import ( "time" ) // SecondsPerXYZ const ( SecondsPerHour = 60 * 60 SecondsPerDay = 60 * 60 * 24 ) // TimeMillis returns a duration as a float millis. func TimeMillis(d time.Duration) float64 { return float64(d) / float64(time.Millisecond) } func AbsWithBranch(n int64) int64 { if n < 0 { retur...
timeutil.go
0.862757
0.491883
timeutil.go
starcoder
package builders import ( "github.com/hashicorp/terraform/helper/schema" "github.com/juliosueiras/terraform-provider-packer/packer/communicators" ) func AmazonChrootResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeStr...
vendor/github.com/juliosueiras/terraform-provider-packer/packer/builders/amazonchroot.go
0.59408
0.426083
amazonchroot.go
starcoder
package toscalib // RequirementDefinition as described in Appendix 6.2 type RequirementDefinition struct { Capability string `yaml:"capability" json:"capability"` // The required reserved keyname used that can be used to provide the name of a valid Capability Type that can fulfil the requirement Node ...
requirements.go
0.823328
0.528898
requirements.go
starcoder
package schema import ( "math" "strings" "github.com/liquidata-inc/dolt/go/store/types" ) // KindToLwrStr maps a noms kind to the kinds lowercased name var KindToLwrStr = make(map[types.NomsKind]string) // LwrStrToKind maps a lowercase string to the noms kind it is referring to var LwrStrToKind = make(map[strin...
go/libraries/doltcore/schema/column.go
0.677581
0.420421
column.go
starcoder
// Package utility implements a reasoner AI based on utility theory. package utility import "fmt" // Utility theory based AI system configuration. type Config struct { Input []InputConf Combo []ComboConf } // Configuration for input based utility curve(s). type InputConf struct { Id int // A referable i...
performance/contadortest/vendor/gopkg.in/karalabe/cookiejar.v2/ai/utility/system.go
0.681833
0.404802
system.go
starcoder
package token import ( "unicode" "unicode/utf8" ) // isSection compares a number of positions (skipping whitespace) to determine if the runes are sectionAdornments and returns // a true if the positions match each other. Rune comparison begins at the current lexer position. isSection returns false if // there is a ...
pkg/token/section.go
0.619817
0.412589
section.go
starcoder
package core import ( "fmt" "math" ) type RotatedRect struct { Center Point Size Size Angle float64 } func NewRotatedRect() (rcvr *RotatedRect) { rcvr = &RotatedRect{} rcvr.Center = *NewPoint2() rcvr.Size = *NewSize2() rcvr.Angle = 0 return } func NewRotatedRect2(c *Point, s *Size, a float64) (rcvr *Rot...
opencv3/core/RotatedRect.java.go
0.675658
0.497376
RotatedRect.java.go
starcoder
package ahrs import ( "github.com/skelterjohn/go.matrix" "log" "math" ) type KalmanState struct { State } func (s *KalmanState) CalcRollPitchHeadingUncertainty() (droll float64, dpitch float64, dheading float64) { droll, dpitch, dheading = VarFromQuaternion(s.E0, s.E1, s.E2, s.E3, math.Sqrt(s.M.Get(6, 6)), ma...
ahrs/ahrs_kalman.go
0.678327
0.522141
ahrs_kalman.go
starcoder
package day7 import ( "fmt" "ryepup/advent2021/utils" "sync" ) /* The crabs don't seem interested in your proposed solution. Perhaps you misunderstand crab engineering? As it turns out, crab submarine engines don't burn fuel at a constant rate. Instead, each change of 1 step in horizontal position costs 1 more un...
day7/part2.go
0.532668
0.512815
part2.go
starcoder
package datety import "time" // IsSameDay returns true if both dates are on the same day, same month and same year func IsSameDay(t1, t2 time.Time) bool { t1 = t1.UTC() t2 = t2.UTC() y1, m1, d1 := t1.Date() y2, m2, d2 := t2.Date() return y1 == y2 && m1 == m2 && d1 == d2 } // IsSameMonth return true if both date...
datety.go
0.820073
0.768321
datety.go
starcoder
// Protocol buffer comparison. package proto import ( "bytes" "log" "reflect" "strings" "google.golang.org/protobuf/reflect/protoreflect" ) /* Equal returns true iff protocol buffers a and b are equal. The arguments must both be pointers to protocol buffer structs. Equality is defined in this way: - Two me...
vendor/github.com/golang/protobuf/proto/equal.go
0.703855
0.400456
equal.go
starcoder
package splines import ( "bytes" "fmt" "math" "time" "github.com/spencer-p/surfdash/pkg/noaa" ) // Curve represents a curve that links a tide event to another smoothly. Its // derivitative at Start and End are zero and it is undefined outside Start and // End. type Curve struct { Start, End time.Time a, b, c,...
pkg/noaa/splines/spline.go
0.779741
0.437343
spline.go
starcoder
package pso import ( "math" "math/rand" "time" ) // Range of values. type Range struct { min []float64 max []float64 } // Create a new range. func NewRange(min, max []float64) *Range { switch { case min == nil: panic("min cannot be nil.") case max == nil: panic("max cannot be nil.") case len(m...
particle.go
0.715623
0.533762
particle.go
starcoder
package common import ( "math/big" ) // Polynomial with coefficients in Z_prime. Coefficients are given as [a_0, a_1, ..., a_degree] where // polynomial is p(x) = a_0 + a_1 * x + ... + a_degree * x^degree type Polynomial struct { coefficients []*big.Int degree int prime *big.Int // coefficients are i...
common/polynomials.go
0.796411
0.781997
polynomials.go
starcoder
package gomaasapi import ( "encoding/json" "errors" "fmt" ) // JSONObject is a wrapper around a JSON structure which provides // methods to extract data from that structure. // A JSONObject provides a simple structure consisting of the data types // defined in JSON: string, number, object, list, and bool. To get...
vendor/github.com/juju/gomaasapi/jsonobject.go
0.666388
0.464112
jsonobject.go
starcoder
package gremlingo // TraversalStrategies is interceptor methods to alter the execution of the traversal (e.g. query re-writing). type TraversalStrategies struct { } // GraphTraversalSource can be used to start GraphTraversal. type GraphTraversalSource struct { graph *Graph traversalStrategies *Travers...
gremlin-go/driver/graphTraversalSource.go
0.891841
0.515376
graphTraversalSource.go
starcoder
package search import ( "database/sql" "math" "strconv" "github.com/GaryBoone/GoStats/stats" "github.com/kellydunn/golang-geo" ) func fixFeatures(features map[string]float64) map[string]float64 { fixedFeatures := map[string]float64{ "nearby": 0.0, "accessible": 0.0, "delicious": 0.0, "acc...
util.go
0.694303
0.479747
util.go
starcoder
package analysis import ( "fmt" "strings" "github.com/google/gapid/gapil/semantic" ) // Value interface compliance checks. var ( _ = Value(&EnumValue{}) _ = SetRelational(&EnumValue{}) ) // Labels is a map of value to name. type Labels map[uint64]string // Merge adds all the labels from o into l. func (l Lab...
gapil/analysis/enum_value.go
0.817793
0.453988
enum_value.go
starcoder
package hammurabi import ( "bufio" "fmt" "strconv" "strings" "github.com/pkg/errors" ) const ( requiredInput int = 3 ) const ( intro = ` Congratulations, you are the newest ruler of ancient Samaria, elected for %d-year term of office. Your duties are to dispsense food, direct farming, and buy and sell land a...
pkg/hammurabi/interactive.go
0.680454
0.42668
interactive.go
starcoder
package pathbuilding import "sort" // A TrustGraph is abstractly a directed graph (potentially with cycles). It represents the trust relationship between // entities where are arrow represents a certificate signed by the source entity for the destination entity. A // TrustGraph can also label some edges as "invalid" ...
pathbuilding/trust_graph.go
0.772659
0.425486
trust_graph.go
starcoder
package templates const JsIndex = `var DS = require('dslink'); // creates a node with an action on it var Increment = DS.createNode({ onInvoke: function(columns) { // get current value of the link var previous = link.val('/counter'); // set new value by adding an amount to the previous amount link....
templates/js_templates.go
0.504883
0.409752
js_templates.go
starcoder
package codec import ( "math" "github.com/fileformats/graphics/jt/model" ) type DeeringCodec struct { lookupTable *deeringLookupTable numBits float64 } func NewDeeringCodec(numBits int) *DeeringCodec { return &DeeringCodec{ numBits: float64(numBits), lookupTable: newDeeringLookupTable(), } } type deering...
jt/codec/deering_codec.go
0.594787
0.512266
deering_codec.go
starcoder
package strings import ( "reflect" "sort" "strings" ) // Set is a representation of a set of strings. // If you have a []string that you want to do a lot of // set operations on, prefer using this type. // If you only have a one-off usage, use SliceContains. type Set map[string]bool // Equal reports whether expec...
shipshape/util/strings/strings.go
0.81468
0.459864
strings.go
starcoder
package bridge import ( "log" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/storage" "github.com/rapidloop/sop/model" "github.com/rapidloop/sop/sopdb" ) // Closer is an object that has a Close() method that needs to be called to // f...
bridge/storage.go
0.739328
0.433262
storage.go
starcoder
package values import "image/color" type Color struct { Primary color.NRGBA Primary50 color.NRGBA PrimaryHighlight color.NRGBA // text colors Text color.NRGBA // default color #091440 InvText color.NRGBA // inverted default color #ffffff GrayText1 color.NRGBA // darker shade #3D5873 Gr...
ui/values/colors.go
0.577734
0.439567
colors.go
starcoder
package httptesting import ( "net/http" "github.com/golib/assert" ) // AssertStatus asserts that the response status code is equal to value. func (r *Request) AssertStatus(status int) bool { return assert.EqualValues(r.t, status, r.Response.StatusCode, "Expected response status code of %d, but got %d", status...
request_assertions.go
0.732018
0.466663
request_assertions.go
starcoder
package common import "math" type GraphNode struct { location Location edges []Node } func newNode(location Location) Node { graphNode := GraphNode{} graphNode.location = location graphNode.edges = make([]Node, 0) return graphNode } func (g GraphNode) getLocation() Location { return g.location } func (g...
common/graphNode.go
0.651133
0.434701
graphNode.go
starcoder
package types type DataInputAvailability int // Matcher describes a type that can produce a match result from a set of matching data. type Matcher interface { Match(MatchingData) (Result, error) } // OnMatch is a node in the match tree, either describing an action (leaf node) or // the start of a subtree (internal ...
xdsmatcher/pkg/matcher/types/types.go
0.670393
0.498535
types.go
starcoder
package Euler2D import ( "fmt" "math" "sort" "sync" "github.com/notargets/gocfd/DG2D" "github.com/notargets/gocfd/utils" ) type VertexToElement [][3]int32 // Vertex id is the first int32, element ID is the next, threadID third func (ve VertexToElement) Len() int { return len(ve) } func (ve VertexTo...
model_problems/Euler2D/dissipation.go
0.600423
0.427188
dissipation.go
starcoder
package pg_query import "encoding/json" /* ---------------- * ArrayRef: describes an array subscripting operation * * An ArrayRef can describe fetching a single element from an array, * fetching a subarray (array slice), storing a single element into * an array, or storing a slice. The "store" cases work with ...
nodes/array_ref.go
0.688887
0.558869
array_ref.go
starcoder
package vector import ( "bytes" "io" "os" "sync/atomic" "github.com/RoaringBitmap/roaring/roaring64" "github.com/matrixorigin/matrixone/pkg/container/nulls" "github.com/matrixorigin/matrixone/pkg/container/types" gvec "github.com/matrixorigin/matrixone/pkg/container/vector" "github.com/matrixorigin/matrixon...
pkg/vm/engine/tae/container/vector/stdvec.go
0.509032
0.430626
stdvec.go
starcoder
package iso20022 // Transfer from one investment fund/fund class to another investment fund or investment fund class by the investor. A switch is composed of one or several subscription legs, and one or several redemption legs. type SwitchOrder2 struct { // Date and time at which the order was placed by the investor...
SwitchOrder2.go
0.78403
0.439988
SwitchOrder2.go
starcoder
package main import ( "fmt" "log" ) var AstOps = []string{"+", "-", "*", "/"} // Given an AST, interpret the // operators in it and return // a final value. func interpretAST(n *AstNode) string { var leftval, rightval string // Get the left and right sub-tree values if n.left != nil { leftval = interpretAST(...
13_SymbolTables/compiler.go
0.503662
0.436802
compiler.go
starcoder
package fuzzy import ( "bytes" "unicode" "unicode/utf8" "golang.org/x/text/runes" "golang.org/x/text/transform" "golang.org/x/text/unicode/norm" ) func noopTransformer() transform.Transformer { return transform.Nop } func foldTransformer() transform.Transformer { return unicodeFoldTransformer{} } func norm...
fuzzy/fuzzy.go
0.820073
0.440409
fuzzy.go
starcoder
package main import ( "bufio" "fmt" "log" "math/bits" "math/rand" "os" "strconv" "strings" "time" ) // the min similarity we're looking for const THRESHOLD = 70 // the cutoff for a single uint64's similarity to be considered const CUTOFF = 15 // the number of bits each vector holds const AMOUNT_OF_BITS = 2...
CorrelatedPair/minhash.go
0.632616
0.520253
minhash.go
starcoder
package mountlib // "@" will be replaced by the command name, "|" will be replaced by backticks var mountHelp = ` rclone @ allows Linux, FreeBSD, macOS and Windows to mount any of Rclone's cloud storage systems as a file system with FUSE. First set up your remote using |rclone config|. Check it works with |rclone ls...
cmd/mountlib/help.go
0.765243
0.451931
help.go
starcoder
package analysis // TokenLocation represents one occurrence of a term at a particular location in // a field. Start, End and Position have the same meaning as in analysis.Token. // Field and ArrayPositions identify the field value in the source document. // See document.Field for details. type TokenLocation struct { ...
example/github/starred/limo/vendor/github.com/blevesearch/bleve/analysis/freq.go
0.704567
0.429429
freq.go
starcoder
package ast import ( "github.com/goplus/gop/token" ) // ----------------------------------------------------------------------------- // A SliceLit node represents a slice literal. type SliceLit struct { Lbrack token.Pos // position of "[" Elts []Expr // list of composite elements; or nil Rbrack ...
ast/ast_gop.go
0.742608
0.499329
ast_gop.go
starcoder
package cbor import ( "io" . "github.com/ipsn/go-ipfs/gxlibs/github.com/polydawn/refmt/tok" ) type Encoder struct { w quickWriter stack []encoderPhase // When empty, and step returns done, all done. current encoderPhase // Shortcut to end of stack. // Note unlike decoder, we need no statekeeping space for...
gxlibs/github.com/polydawn/refmt/cbor/cborEncoder.go
0.600305
0.540803
cborEncoder.go
starcoder
package bytesutil import ( "bytes" "fmt" "sort" ) // Sort sorts a slice of byte slices. func Sort(a [][]byte) { sort.Sort(byteSlices(a)) } func IsSorted(a [][]byte) bool { return sort.IsSorted(byteSlices(a)) } func SearchBytes(a [][]byte, x []byte) int { return sort.Search(len(a), func(i int) bool { return by...
plugin/mq2db/vendor/github.com/influxdata/influxdb/pkg/bytesutil/bytesutil.go
0.784195
0.608361
bytesutil.go
starcoder
package operations import ( "hash/crc32" "github.com/rameshvarun/ups/common" ) // Diff takes in a base buffer, a modified buffer, and returns a PatchData object // that can be used to write to a UPS file. func Diff(base []byte, modified []byte) *common.PatchData { // Cumulative list of blocks that we construct as...
operations/diff.go
0.665845
0.434221
diff.go
starcoder
package gldriver import ( "encoding/binary" "image" "image/color" "image/draw" "github.com/oakmound/shiny/screen" "golang.org/x/mobile/gl" ) type textureImpl struct { w *windowImpl id gl.Texture fb gl.Framebuffer size image.Point } func (t *textureImpl) Size() image.Point { return t.size } f...
driver/gldriver/texture.go
0.522933
0.440229
texture.go
starcoder
package arrowtools import ( "fmt" "github.com/apache/arrow/go/arrow" "github.com/apache/arrow/go/arrow/array" "github.com/stretchr/testify/assert" ) // ColumnsEqual returns a boolean indicating whether the data in the // two given columns are equal. If the data are not equal, a brief // message describing the ...
gen_equality.go
0.72594
0.690898
gen_equality.go
starcoder
package cephes import ( "math" "gonum/mathext/internal/gonum" ) const ( maxGam = 171.624376956302725 big = 4.503599627370496e15 biginv = 2.22044604925031308085e-16 ) // Incbet computes the regularized incomplete beta function. func Incbet(aa, bb, xx float64) float64 { if aa <= 0 || bb <= 0 { panic(badPar...
mathext/internal/cephes/incbeta.go
0.712432
0.439627
incbeta.go
starcoder
package evaluator import ( "fmt" "github.com/optimizely/go-sdk/pkg/entities" ) const customAttributeType = "custom_attribute" const ( // "and" operator returns true if all conditions evaluate to true andOperator = "and" // "not" operator negates the result of the given condition notOperator = "not" // "or" o...
pkg/decision/evaluator/condition_tree.go
0.760117
0.422564
condition_tree.go
starcoder
package graphics import ( "github.com/go-gl/mathgl/mgl32" "math" ) const cameraSpeed = float64(320) * 2 const sensitivity = float32(0.03) var minVerticalRotation = mgl32.DegToRad(90) var maxVerticalRotation = mgl32.DegToRad(270) // Camera type Camera struct { transform Transform fov float32 aspectRati...
framework/graphics/camera.go
0.885675
0.679128
camera.go
starcoder
package diff import ( "github.com/pusinc/golang-support/helper/contain" "reflect" ) func Interface(x interface{}, y interface{}) (reflect.Value, reflect.Value) { xValue, yValue := reflect.Value{}, reflect.Value{} if xValueNode, ok := x.(reflect.Value); ok { xValue = xValueNode } else { xValue = reflect.Value...
helper/diff/diff.go
0.579995
0.449091
diff.go
starcoder
package sweetiebot import ( "fmt" "strconv" "strings" "github.com/bwmarrin/discordgo" ) type AddCommand struct { funcmap map[string]func(string) string } func (c *AddCommand) Name() string { return "Add" } func (c *AddCommand) Process(args []string, msg *discordgo.Message, info *GuildInfo) (string, bool) { i...
sweetiebot/collections_command.go
0.657648
0.556159
collections_command.go
starcoder
package de import ( "github.com/nlpodyssey/spago/pkg/mat" "github.com/nlpodyssey/spago/pkg/mat/rand" "github.com/nlpodyssey/spago/pkg/utils" "math" ) type Mutator interface { Mutate(p *Population) } var _ Mutator = &RandomMutation{} type RandomMutation struct { Bound float64 } func NewRandomMutation(bound f...
pkg/ml/optimizers/de/mutator.go
0.625781
0.449755
mutator.go
starcoder
package rpn import "math/big" // Evaluation context. This type is exported to allow eventual user-supplied // operations. type Evaluator struct { Stack []interface{} Vars map[string]interface{} Names []string Consts []*big.Rat N, C int } func (e *Evaluator) eval(ops []operator) (err error) { for _, op :=...
eval.go
0.571408
0.464476
eval.go
starcoder
package circuit import ( "encoding/json" "fmt" "math" "github.com/heustis/tsp-solver-go/model" "github.com/heustis/tsp-solver-go/stats" ) type disparityClonableCircuit struct { edges []model.CircuitEdge distances map[model.CircuitVertex]*stats.DistanceGaps length float64 } func (c *disparityClonableC...
circuit/disparityclonablecircuit.go
0.732687
0.605099
disparityclonablecircuit.go
starcoder
package iso20022 // Specifies periods related to a corporate action option. type CorporateActionPeriod7 struct { // Period during which the price of a security is determined. PriceCalculationPeriod *Period3Choice `xml:"PricClctnPrd,omitempty"` // Period during which both old and new equity may be traded simultane...
CorporateActionPeriod7.go
0.859339
0.498413
CorporateActionPeriod7.go
starcoder
package Challenge1_Next_Interval import "container/heap" /* Given an array of intervals, find the next interval of each interval. In a list of intervals, for an interval ‘i’ its next interval ‘j’ will have the smallest ‘start’ greater than or equal to the ‘end’ of ‘i’. Write a function to return an array containing ...
Pattern09 - Two Heaps/Challenge1-Next_Interval/solution.go
0.646349
0.718385
solution.go
starcoder
package leabra import ( "fmt" "unsafe" "github.com/goki/ki/bitflag" "github.com/goki/ki/kit" ) // NeuronVarStart is the byte offset of fields in the Neuron structure // where the float32 named variables start. // Note: all non-float32 infrastructure variables must be at the start! const NeuronVarStart = 8 // l...
leabra/neuron.go
0.698021
0.663511
neuron.go
starcoder
package main // TrieNode represents a single node in a Trie type TrieNode struct { children map[rune]*TrieNode isWord bool } // NewTrieNode creates a new pre-defined trie node // This method should only be called by trie library methods // Users should not call this method directly func NewTrieNode() *TrieNode { ...
trie.go
0.780077
0.472805
trie.go
starcoder
package cryptypes import "database/sql/driver" // EncryptedFloat32 supports encrypting Float32 data type EncryptedFloat32 struct { Field Raw float32 } // Scan converts the value from the DB into a usable EncryptedFloat32 value func (s *EncryptedFloat32) Scan(value interface{}) error { return decrypt(value.([]byte...
cryptypes/type_float32.go
0.827724
0.595022
type_float32.go
starcoder
package specs import ( "errors" "fmt" "github.com/jexia/semaphore/v2/pkg/specs/metadata" ) // Enum represents a enum configuration type Enum struct { *metadata.Meta Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" ya...
pkg/specs/enum.go
0.791338
0.417717
enum.go
starcoder
package genericlist import ( "fmt" "sort" ) type FloatList struct { Values []float64 } func (floatlist *FloatList) Append(x float64) { floatlist.Values = append(floatlist.Values, x) } func (floatlist *FloatList) Extend(x []float64) { floatlist.Values = append(floatlist.Values, x...) } func (floatlist *FloatLi...
pyutils/genericList/FloatList.go
0.589126
0.431405
FloatList.go
starcoder
package trueskill import ( "github.com/ChrisHines/GoSkills/skills" "github.com/ChrisHines/GoSkills/skills/numerics" "math" "sort" ) // Calculates new ratings for only two teams where each team has 1 or more players. // When you only have two teams, the math is still simple: no factor graphs are used yet. type Two...
vendor/github.com/ChrisHines/GoSkills/skills/trueskill/TwoTeamCalc.go
0.747892
0.464902
TwoTeamCalc.go
starcoder
// Package dep analyzes dependencies between values. package dep import ( "errors" "cuelang.org/go/internal/core/adt" ) // A Dependency is a reference and the node that reference resolves to. type Dependency struct { // Node is the referenced node. Node *adt.Vertex // Reference is the expression that referenc...
internal/core/dep/dep.go
0.604632
0.438545
dep.go
starcoder
package service import ( "image" "math" ) type rotate struct { dx float64 dy float64 sin float64 cos float64 neww float64 newh float64 src *image.RGBA } func (r *rotate) rotate(angle float64, src *image.RGBA) *rotate { r.src = src srsize := src.Bounds().Size() width, height := srsize.X, srsize.Y ...
app/interface/main/captcha/service/rotate.go
0.521715
0.425904
rotate.go
starcoder
package skyhook import ( "fmt" "runtime" ) type ExecOp interface { Parallelism() int Apply(task ExecTask) error Close() } // A wrapper for a simple exec op that needs no persistent state. // So the wrapper just wraps a function, along with desired parallelism. type SimpleExecOp struct { ApplyFunc func(ExecTask...
skyhook/exec_op.go
0.5769
0.418103
exec_op.go
starcoder
package codegen const fragmentTypeTmpl = ` {{- define "ArgumentName" -}} {{- if .Access -}} {{ .ArgumentName }}() {{- else if .MutableAccess -}} mutable_{{ .ArgumentName }}() {{- else -}} {{ .ArgumentName }} {{- end -}} {{- end -}} {{- define "ArgumentValue" -}} {{- if .Access -}} {{ .Argum...
tools/fidl/fidlgen_llcpp/codegen/fragment_type.tmpl.go
0.527073
0.452959
fragment_type.tmpl.go
starcoder
package xpfunds import ( "fmt" "io/ioutil" "math" "strconv" "strings" "xpfunds/binarysearch" "xpfunds/check" "xpfunds/median" ) type Fund struct { name string active string min string // The monthly return of the fund, starting from the last month. monthly []float64 // The position of the first slic...
src/xpfunds/xpfunds.go
0.647241
0.511473
xpfunds.go
starcoder
package panorama import ( "fmt" "math" "github.com/gotk3/gotk3/cairo" "github.com/gotk3/gotk3/gtk" "github.com/ftl/hamradio/bandplan" "github.com/ftl/panacotta/core" ) type rect struct { top, left, bottom, right float64 } func (r rect) width() float64 { return math.Abs(r.left - r.right) } func (r rect) he...
ui/panorama/draw.go
0.675336
0.407746
draw.go
starcoder
package main import ( "fmt" "os" "strconv" "math" "encoding/csv" ) type CensusGroup struct { population int latitude, longitude float64 } func ParseCensusData(fname string) ([]CensusGroup, error) { file, err := os.Open(fname) if err != nil { return nil, err } defe...
Go/Assignment_5/1_3_backup.go
0.500977
0.536677
1_3_backup.go
starcoder
package configtable import ( "bufio" "encoding/hex" "fmt" "io" "reflect" "strconv" "strings" ) const ( typeDelimiter = "!" columnDelimiter = "|" structTag = "configtable" ) type column struct { name string colType string byteLen int } // A Decoder reads a Blizzard config table from an input strea...
ngdp/configtable/configtable.go
0.551332
0.463384
configtable.go
starcoder
package config import "strings" //Key is the entity that allows access to values stored within a Values instance. type Key []string //NewKey creates a Key with all strings in parts in the returned Key. //It essentially casts the string slice to a Key. func NewKey(parts ...string) Key { return Key(parts) } //NewKey...
key.go
0.804406
0.438184
key.go
starcoder
package quadtree import "fmt" type Quadrant int const ( NW Quadrant = iota NE SW SE ) type Node struct { area *Area points []PointPtr num int children []*Node } func NewNode(a *Area, cap int) *Node { if cap <= 0 { return nil } return &Node{area: a, points: make([]PointPtr, 0, cap), children: nil...
node.go
0.51562
0.447883
node.go
starcoder
package triangle import ( "fluorescence/geometry" "fluorescence/geometry/primitive" "fluorescence/geometry/primitive/aabb" "fluorescence/shading/material" "fmt" "math" ) // Triangle is an internal representation of a Triangle geometry contruct type Triangle struct { A geometry.Point `json:...
geometry/primitive/triangle/triangle.go
0.785391
0.492188
triangle.go
starcoder
package gohbv import ( "math" "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/integrate" ) // Helper function to calculate MAXBAS triangular weights // This function outputs the values that are integrated in RoutingMaxbasWeights func routingMaxbas(x []float64, p_maxbas float64) []float64 { a := 2 / p_maxbas c :...
hbv_routines.go
0.666605
0.416945
hbv_routines.go
starcoder
package bindings import ( "github.com/vmware/vsphere-automation-sdk-go/runtime/data" "github.com/vmware/vsphere-automation-sdk-go/runtime/lib" "reflect" ) type BindingType interface { Definition() data.DataDefinition Type() data.DataType } type VoidType struct{} func (i VoidType) Definition() data.DataDefiniti...
runtime/bindings/type.go
0.803906
0.513851
type.go
starcoder
package continuous import ( "github.com/jtejido/ggsl/specfunc" "github.com/jtejido/linear" "github.com/jtejido/stats" "github.com/jtejido/stats/err" smath "github.com/jtejido/stats/math" "math" "math/rand" ) // (Scaled) Inverse chi-squared distribution // https://en.wikipedia.org/wiki/Scaled_inverse_chi-square...
dist/continuous/inverse_chi_squared.go
0.767777
0.460168
inverse_chi_squared.go
starcoder
package testcase import ( "fmt" "testing" "github.com/adamluzsi/testcase/internal" ) // Contract meant to represent a Role Interface Contract. // A role interface is a static code contract that expresses behavioral expectations as a set of method signatures. // A role interface used by one or many consumers. // T...
Contract.go
0.691497
0.549641
Contract.go
starcoder
package entity import "go/ast" // Miner interface is used to define a custom miner. type Miner interface { // Name provides the name of the miner. Name() string // Visit applies the mining logic while traversing the Abstract Syntax Tree. Visit(node ast.Node) ast.Visitor // SetCurrentFile specifies the current fi...
entity/algorithm.go
0.616243
0.427516
algorithm.go
starcoder
package bmr import "math" func Calculate(gender, standard string, weight, height float64, age int) (int, error) { switch gender { case "male": switch standard { case "metric": return calculateMaleMetric(weight, height, age) case "imperial": return calculateMaleImperial(weight, height, age) default: ...
pkg/bmr/bmr.go
0.770206
0.609757
bmr.go
starcoder
package main import ( "fmt" "math" "math/rand" "sort" "sync" "time" ) // By : <NAME> // ------- Please Solve the Problem ------- // I’m trying to find the closest point from some points that I have, for example I have about 1000 set of geographhical coordinates (lat,long). // Given one coordinates, I want to fi...
main.go
0.643665
0.443661
main.go
starcoder
package main import ( "fmt" "math" "time" "unicode" "github.com/faiface/pixel" "github.com/faiface/pixel/imdraw" "github.com/faiface/pixel/pixelgl" "github.com/faiface/pixel/text" "github.com/golang/freetype/truetype" "golang.org/x/image/font" "golang.org/x/image/font/gofont/goregular" ) func ttfFromByte...
exp/fabrik2d/ik2d.go
0.692746
0.484014
ik2d.go
starcoder
package plan import ( "fmt" "strings" "time" ) // Config describes the unstructured test plan type Config struct { Reports []string CallTimeout time.Duration WaitForTimeout time.Duration WaitForHosts []string Axes Axes Behaviors Behaviors JSONReportPath string } // Axes is a col...
plan/entities.go
0.743913
0.537041
entities.go
starcoder
package main import ( "image" "image/color" "image/draw" "image/png" "log" "math" "os" "github.com/qeedquan/go-media/math/f64" ) func main() { P := [][4]float64{ {3, 4.5, 10, 10}, {4, 12, 15, 15}, {7, 10, 6, 6}, {5, 4, 4, 4}, {5, 2, 7, 7}, {5, 2, 13, 13}, {4, 1, 1, 1}, {4, 1, 7, 8}, {6, 1,...
gfx/superformula-plot.go
0.564098
0.493714
superformula-plot.go
starcoder
package slice import ( "constraints" "math/rand" "time" ) func init() { rand.Seed(time.Now().UnixNano()) } // Each calls the function on each item in the slice. func Each[A ~[]T, T any](arr A, f func(T)) { for _, v := range arr { f(v) } } // Collect returns a new slice of values by mapping each value of ori...
slice/slice.go
0.875933
0.648049
slice.go
starcoder
package snowflake var ( // Epoch defines a start time and recommended to be set as the project on-line time. Epoch int64 = 1288834974657 // OvertimeBits defines the number of bits occupied by Overtime. Automatic initialization. OvertimeBits uint8 = 64 // SequenceBits defines the number of bits occupied b...
snowflake.go
0.684686
0.419826
snowflake.go
starcoder
package functional import ( "math" "math/rand" ) type UnaryFn func(float64) float64 func (f UnaryFn) Add(f2 UnaryFn) UnaryFn { return func(x float64) float64 { return f(x) + f2(x) } } func (f UnaryFn) Sub(f2 UnaryFn) UnaryFn { return func(x float64) float64 { return f(x) - f2(x) } } func (f UnaryFn) Mul(...
math/functional/function.go
0.828384
0.610076
function.go
starcoder
package audio import ( "time" "github.com/oakmound/oak/v4/audio/pcm" ) // FadeIn wraps a reader such that it will linearly fade in over the given duration. func FadeIn(dur time.Duration, in pcm.Reader) pcm.Reader { perSec := in.PCMFormat().BytesPerSecond() bytesToFadeIn := int((time.Duration(perSec) / 1000) * (d...
audio/fade.go
0.739328
0.404272
fade.go
starcoder
package slab import ( "fmt" compgeo "github.com/200sc/go-compgeo" "github.com/200sc/go-compgeo/dcel" "github.com/200sc/go-compgeo/dcel/pointLoc" "github.com/200sc/go-compgeo/dcel/pointLoc/visualize" "github.com/200sc/go-compgeo/geom" "github.com/200sc/go-compgeo/search" "github.com/200sc/go-compgeo/search/tr...
dcel/pointLoc/slab/slabDecomp.go
0.617743
0.455441
slabDecomp.go
starcoder