Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/nickng/abelian

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/nickng/abelian

  • v0.0.0-20181028233815-7ca73d4ff4e2
  • Source
  • Go
  • Socket score

Version published
Created
Source

abelian Build Status GoDoc

Implementation of integer-based torsion-free Abelian Group in Go.

Usage

go get github.com/nickng/abelian

Example: creating a group

// This example shows how to create an Integer-pair abelian group.
s := set.NewIntTuple(2) // tuple size set to 2
g := abelian.New(s, s.Add)

// The following g.Op is the + operation for pairs,
// hence the output is (1,2) + (2,3) = (3,5)
//
output := g.Op(s.Tuple(1, 2), s.Tuple(2, 3))
fmt.Println("Group:", g.String())
fmt.Println(output)

// prints out (3,5)

Example: enumerating a finite subset

// This example shows how to enumerate a 2D-interval.
s := set.NewIntTuple(2)
g := abelian.New(s, s.Add)

// The given Set s implements
// - LessEqual(x, y Elem) bool
// - Interval(lo, hi Elem) Enumerable
subset := g.Set.(prop.PartialOrdered).Interval(s.Tuple(1, 1), s.Tuple(2, 2))
for i, tuple := range subset.Slice() {
    fmt.Println(tuple)
}

// prints out (1,1) (1,2) (2,1) (2,2)

More examples can be found in GoDoc.

License

abelian is licensed under the Apache License

FAQs

Package last updated on 28 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc