query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
pubSubClient returns an authenticated Google PubSub client instance.
func pubSubClient(ctx context.Context, cloudProject string) (*pubsub.Client, error) { ts, err := auth.GetTokenSource(ctx, auth.AsSelf, auth.WithScopes(auth.CloudOAuthScopes...)) if err != nil { return nil, errors.Annotate(err, "failed to get the token source").Err() } client, err := pubsub.NewClient(ctx, cloudProject, option.WithTokenSource(ts)) if err != nil { return nil, errors.Annotate(err, "failed to create the PubSub client").Err() } return client, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewPubSubClient(projectID string) (*pubsub.Client, *context.Context, error) {\n\tctx := context.Background()\n\tclient, err := pubsub.NewClient(ctx, projectID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn client, &ctx, nil\n}", "func NewClient(ctx context.Context, projectID string, sensor ins...
[ "0.67263144", "0.64401406", "0.6434849", "0.6243881", "0.61175317", "0.59619075", "0.5948689", "0.59461606", "0.5833395", "0.5774761", "0.57634735", "0.56945395", "0.55894965", "0.5566611", "0.556053", "0.55195254", "0.55149347", "0.55052865", "0.5441519", "0.543098", "0.5423...
0.7993007
0
dstech Let T be the tridiagonal matrix with diagonal entries A(1) ,..., A(N) and offdiagonal entries B(1) ,..., B(N1)). DSTECH checks to see if EIG(1) ,..., EIG(N) are indeed accurate eigenvalues of T. It does this by expanding each EIG(I) into an interval [SVD(I) EPS, SVD(I) + EPS], merging overlapping intervals if any, and using Sturm sequences to count and verify whether each resulting interval has the correct number of eigenvalues (using DSTECT). Here EPS = TOLMAZHEPSMAXEIG, where MACHEPS is the machine precision and MAXEIG is the absolute value of the largest eigenvalue. If each interval contains the correct number of eigenvalues, INFO = 0 is returned, otherwise INFO is the index of the first eigenvalue in the first bad interval.
func dstech(n int, a, b, eig *mat.Vector, tol float64, work *mat.Vector) (info int) { var emin, eps, lower, mx, tuppr, unflep, upper, zero float64 var bpnt, count, i, isub, j, numl, numu, tpnt int zero = 0.0 // Check input parameters info = 0 if n == 0 { return } if n < 0 { info = -1 return } if tol < zero { info = -5 return } // Get machine constants eps = golapack.Dlamch(Epsilon) * golapack.Dlamch(Base) unflep = golapack.Dlamch(SafeMinimum) / eps eps = tol * eps // Compute maximum absolute eigenvalue, error tolerance mx = math.Abs(eig.Get(0)) for i = 2; i <= n; i++ { mx = math.Max(mx, math.Abs(eig.Get(i-1))) } eps = math.Max(eps*mx, unflep) // Sort eigenvalues from EIG into WORK for i = 1; i <= n; i++ { work.Set(i-1, eig.Get(i-1)) } for i = 1; i <= n-1; i++ { isub = 1 emin = work.Get(0) for j = 2; j <= n+1-i; j++ { if work.Get(j-1) < emin { isub = j emin = work.Get(j - 1) } } if isub != n+1-i { work.Set(isub-1, work.Get(n+1-i-1)) work.Set(n+1-i-1, emin) } } // TPNT points to singular value at right endpoint of interval // BPNT points to singular value at left endpoint of interval tpnt = 1 bpnt = 1 // Begin loop over all intervals label50: ; upper = work.Get(tpnt-1) + eps lower = work.Get(bpnt-1) - eps // Begin loop merging overlapping intervals label60: ; if bpnt == n { goto label70 } tuppr = work.Get(bpnt) + eps if tuppr < lower { goto label70 } // Merge bpnt = bpnt + 1 lower = work.Get(bpnt-1) - eps goto label60 label70: ; // Count singular values in interval [ LOWER, UPPER ] numl = dstect(n, a, b, lower) numu = dstect(n, a, b, upper) count = numu - numl if count != bpnt-tpnt+1 { // Wrong number of singular values in interval info = tpnt return } tpnt = bpnt + 1 bpnt = tpnt if tpnt <= n { goto label50 } return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func ddrvgt(dotype []bool, nn int, nval []int, nrhs int, thresh float64, tsterr bool, a, af, b, x, xact, work, rwork *mat.Vector, iwork []int, t *testing.T) {\n\tvar zerot bool\n\tvar dist, fact, _type byte\n\tvar trans mat.MatTrans\n\tvar ainvnm, anorm, anormi, anormo, cond, one, rcond, rcondc, rcondi, rcondo, ze...
[ "0.5577864", "0.51757", "0.49949348", "0.491764", "0.4837769", "0.48017088", "0.47225007", "0.46483636", "0.46271884", "0.46165404", "0.45453176", "0.45346412", "0.45028895", "0.44566214", "0.4451624", "0.44084874", "0.4402889", "0.4395967", "0.43845516", "0.43688878", "0.435...
0.70653516
0
Seed uses the provided seed value to initialize the generator to a deterministic state.
func (pcg *PCGSource) Seed(seed uint64) { pcg.low = seed pcg.high = seed // TODO: What is right? }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (g *Generator) Seed(seed int64) {\n\tif _, err := g.hash.Write(int64ToBytes(seed)); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := g.reseed(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (rng *Rng) Seed(seed int64) {\n\trng.State = uint64(seed)\n}", "func (r *IncrementRand) Seed(seed int64) {\n\tr.seed...
[ "0.81474304", "0.80678666", "0.80196023", "0.79634714", "0.7962229", "0.7902593", "0.789541", "0.7818182", "0.778867", "0.7637324", "0.7571526", "0.7546818", "0.7346723", "0.7326138", "0.719774", "0.7144702", "0.71144444", "0.7054397", "0.7032221", "0.6991642", "0.6984232", ...
0.72496384
14
Uint64 returns a pseudorandom 64bit unsigned integer as a uint64.
func (pcg *PCGSource) Uint64() uint64 { pcg.multiply() pcg.add() // XOR high and low 64 bits together and rotate right by high 6 bits of state. return bits.RotateLeft64(pcg.high^pcg.low, -int(pcg.high>>58)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Uint64() uint64 { return globalRand.Uint64() }", "func Uint64() uint64 { return globalRand.Uint64() }", "func Uint64() uint64 { return globalRand.Uint64() }", "func Uint64() uint64 {\n\treturn uint64(rand.Int63n(math.MaxInt64))\n}", "func (r *Rand) Uint64() uint64 {\n\t*r ^= Rand(uint64(*r) >> 12)\n\t...
[ "0.85524464", "0.85524464", "0.85524464", "0.8548207", "0.82831895", "0.8275276", "0.8270503", "0.81276894", "0.8116648", "0.8092832", "0.8072181", "0.803838", "0.8019394", "0.8018397", "0.80127335", "0.7956805", "0.7886797", "0.78492033", "0.7765266", "0.77565616", "0.773682...
0.7374187
30
MarshalBinary returns the binary representation of the current state of the generator.
func (pcg *PCGSource) MarshalBinary() ([]byte, error) { var buf [16]byte binary.BigEndian.PutUint64(buf[:8], pcg.high) binary.BigEndian.PutUint64(buf[8:], pcg.low) return buf[:], nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *State) Marshall() []byte {\n\to := make([]byte, 136)\n\tbinary.BigEndian.PutUint64(o, s.counter)\n\tcopy(o[8:], s.static[:])\n\tcopy(o[40:], s.dynamic[:])\n\tcopy(o[72:], s.privateKey[:])\n\tcopy(o[104:], s.PublicKey[:])\n\treturn o\n}", "func (tx *Genesis) MarshalBinary(scheme Scheme) ([]byte, error) {...
[ "0.6328394", "0.6176267", "0.6165976", "0.60621375", "0.606017", "0.60486805", "0.60226256", "0.59424466", "0.59332556", "0.5898915", "0.58767116", "0.58736074", "0.58614975", "0.5788809", "0.57764137", "0.5723125", "0.56919384", "0.56767684", "0.5666373", "0.56379133", "0.56...
0.6075811
3
UnmarshalBinary sets the state of the generator to the state represented in data.
func (pcg *PCGSource) UnmarshalBinary(data []byte) error { if len(data) < 16 { return io.ErrUnexpectedEOF } pcg.low = binary.BigEndian.Uint64(data[8:]) pcg.high = binary.BigEndian.Uint64(data[:8]) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (v Palette) UnmarshalBinary(data []byte) error {\n\tif len(v)*3 != len(data) {\n\t\treturn fmt.Errorf(\"Len is not valid. required: %d, actual: %d\", len(v)*3, len(data))\n\t}\n\tfor i := 0; i < len(v); i++ {\n\t\tv[i].r = data[i*3]\n\t\tv[i].g = data[i*3+1]\n\t\tv[i].b = data[i*3+2]\n\t}\n\treturn nil\n}", ...
[ "0.6078023", "0.5822415", "0.57675517", "0.5730266", "0.57153803", "0.5686104", "0.5648046", "0.56441903", "0.5585511", "0.55330825", "0.55255497", "0.55208737", "0.5503409", "0.54295784", "0.5417937", "0.5416214", "0.5415113", "0.536192", "0.5359965", "0.53555477", "0.535200...
0.5605674
8
XXX_OneofFuncs is for the internal use of the proto package.
func (*ConfigSource) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ConfigSource_OneofMarshaler, _ConfigSource_OneofUnmarshaler, _ConfigSource_OneofSizer, []interface{}{ (*ConfigSource_Path)(nil), (*ConfigSource_ApiConfigSource)(nil), (*ConfigSource_Ads)(nil), } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (*EncapVal) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {\n\treturn _EncapVal_OneofMarshaler, _EncapVal_OneofUnmarshaler, _EncapVal_OneofSizer, []interface{}{\n\t\t(*Enc...
[ "0.8907044", "0.8906012", "0.88909197", "0.8869721", "0.8868361", "0.88635784", "0.886303", "0.8862766", "0.8862009", "0.88613117", "0.88597536", "0.8855407", "0.8853634", "0.8852364", "0.8852364", "0.8852364", "0.88475925", "0.8846927", "0.8845165", "0.8844588", "0.88421", ...
0.0
-1
init initialises player's state
func (player *musicPlayer) init(playlistDir string) error { player.Lock() defer player.Unlock() player.state = new(state) player.state.status = waiting player.state.current = 0 player.state.queue = make([]string, 0) player.playlistsDir = playlistDir return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Spyfall) Init(id, code string) {\n\ts.Id = id\n\ts.Code = code\n\ts.cmds = make(chan *lib.PlayerCmd)\n\ts.Players = []*Player{}\n\n\ts.timer = time.NewTimer(1 * time.Minute)\n\tif !s.timer.Stop() {\n\t\t<-s.timer.C\n\t}\n\tlog.Println(\"New game initialized\", s)\n\t// TODO: save to mongo\n}", "func (p ...
[ "0.65159065", "0.65004194", "0.6413254", "0.6379241", "0.62930393", "0.6197151", "0.6149264", "0.6026874", "0.593727", "0.58678484", "0.5866485", "0.5839084", "0.5800773", "0.5747296", "0.57451427", "0.5694042", "0.56623226", "0.5645326", "0.56179804", "0.5587653", "0.5583001...
0.75993264
0
waitEnd is used to wait the end of playing queue
func (player *musicPlayer) waitEnd() { player.playQueueMutex.Lock() defer player.playQueueMutex.Unlock() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (q *Queue) WaitFinish() {\n <- q.finishChan\n}", "func (m *Music) Wait() {\n\t<-m.played\n}", "func (p *EventReplay) Wait() {}", "func (async *async) wait() {\n\t<-async.done\n}", "func (w *Worker) WaitForFinish() {\n\t<-w.done\n}", "func (ircConn *Connection) WaitForQueue() {\n\tfor ircConn.open...
[ "0.6722909", "0.6711166", "0.63364303", "0.6256194", "0.60566604", "0.60402995", "0.5934097", "0.58663464", "0.5863885", "0.57432836", "0.57182705", "0.5690095", "0.5673604", "0.5608103", "0.55525565", "0.55524963", "0.5551658", "0.55320144", "0.54965353", "0.54899", "0.54876...
0.8340487
0
playSingleFile plays single file Returns error if file could not be played
func (player *musicPlayer) playSingleFile(filename string, trim float64, ch chan error) error { // Open the input file (with default parameters) in := sox.OpenRead(filename) if in == nil { err := errors.New(no_sox_in_msg) if ch != nil { ch <- err } return err } defer in.Release() // Open the output device: Specify the output signal characteristics. // Since we are using only simple effects, they are the same as the // input file characteristics. // Using "alsa" or "pulseaudio" should work for most files on Linux. // "coreaudio" for OSX // On other systems, other devices have to be used. out := sox.OpenWrite("default", in.Signal(), nil, "alsa") if out == nil { out = sox.OpenWrite("default", in.Signal(), nil, "pulseaudio") if out == nil { out = sox.OpenWrite("default", in.Signal(), nil, "coreaudio") if out == nil { out = sox.OpenWrite("default", in.Signal(), nil, "waveaudio") if out == nil { err := errors.New(no_sox_out_msg) if ch != nil { ch <- err } return err } } } } // It's observed that sox crashes at this step sometimes defer out.Release() if ch != nil { ch <- nil } // Create an effects chain: Some effects need to know about the // input or output encoding so we provide that information here. chain := sox.CreateEffectsChain(in.Encoding(), out.Encoding()) defer chain.Release() // The first effect in the effect chain must be something that can // source samples; in this case, we use the built-in handler that // inputs data from an audio file. e := sox.CreateEffect(sox.FindEffect("input")) e.Options(in) // This becomes the first "effect" in the chain chain.Add(e, in.Signal(), in.Signal()) e.Release() if trim > 0 { interm_signal := in.Signal().Copy() e = sox.CreateEffect(sox.FindEffect("trim")) e.Options(strconv.FormatFloat(trim, 'f', 2, 64)) chain.Add(e, interm_signal, in.Signal()) e.Release() } // The last effect in the effect chain must be something that only consumes // samples; in this case, we use the built-in handler that outputs data. e = sox.CreateEffect(sox.FindEffect("output")) e.Options(out) chain.Add(e, in.Signal(), in.Signal()) e.Release() player.Lock() player.state.chain = chain player.state.status = playing player.state.startTime = time.Now() if trim > 0 { var milis int64 = int64(-trim * 1000) player.state.startTime = player.state.startTime.Add(time.Duration(milis) * time.Millisecond) } player.Unlock() // Flow samples through the effects processing chain until EOF is reached. // Flow process is not locked as it must be possible to delete chain effects // while Flow is being executed // note: sox crashes at this step sometimes(rarely) chain.Flow() player.Lock() if player.state.status == playing { player.state.status = waiting } player.Unlock() return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (player *AudioPlayer) PlayFile(fileName string) error {\n\tmplayer := exec.Command(\"mplayer\", player.AudioFolder+\"/\"+fileName+\".mp3\")\n\treturn mplayer.Run()\n}", "func (s *Service) PlayFile(path string) error {\n\t// check if file exists if it is not a remote video.\n\tif _, err := os.Stat(path); os....
[ "0.7252763", "0.7192853", "0.67938113", "0.6674443", "0.6330063", "0.6231709", "0.61893684", "0.60480857", "0.596612", "0.5936501", "0.59290355", "0.59035736", "0.5845777", "0.5829224", "0.5784471", "0.5781998", "0.57748026", "0.5744766", "0.5742472", "0.5707918", "0.5701077"...
0.6597008
4
play plays a file, directory or playlists Returns error if nothing is to be played
func (player *musicPlayer) play(playItem string) ([]string, error) { player.Lock() player.stopFlow() player.state.queue = make([]string, 0) player.state.current = 0 items, err := player.addPlayItem(playItem) player.Unlock() // play all items ch := make(chan error) defer close(ch) if err == nil { go player.playQueue(0, ch) err = <-ch } return items, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (player *AudioPlayer) PlayFile(fileName string) error {\n\tmplayer := exec.Command(\"mplayer\", player.AudioFolder+\"/\"+fileName+\".mp3\")\n\treturn mplayer.Run()\n}", "func playHelper(fname string) {\n\tcolorprint.Info(\">>>> Please enter the name of the file that you would like to play\")\n\tfmt.Scan(&fn...
[ "0.707698", "0.69615823", "0.68848103", "0.6590502", "0.6539397", "0.6478501", "0.6460065", "0.6454496", "0.6398643", "0.6380446", "0.632894", "0.6316868", "0.6291548", "0.62592703", "0.6197194", "0.6156544", "0.6078066", "0.6060008", "0.6050678", "0.60488045", "0.6047431", ...
0.6251563
14