Giter VIP home page Giter VIP logo

sparsemat's Introduction

sparsemat

A simple sparse matrix for values over binary Galois Field - GF(2).

Currently implemented:

Future implementations:

Usage

Importing:

import mat "github.com/nathanhack/sparsemat"

Creating a matrix:

m1 := mat.CSRIdentity(3)
m2 := mat.DOKMat(3,3, 1,0,0,0,1,0,0,0,1)

Multiplying: Mul

r := mat.CSRMat(3,3)
r.Mul(m1,m2) // multiplies m1xm2 and stores into r

Accessors: At and Set

fmt.Printf("value at (%v,%v) is %v\n",1,1,r.At(1,1))
r.Set(1,1,0)
fmt.Printf("value at (%v,%v) is now %v\n",1,1,r.At(1,1))

Slices: Slice

m := mat.DOKMat(1,4, 1,1,1,1) // creates matrix [1 1 1 1]
s := m.Slice(0,1,1,2) // creates a slice (new matrix) of the two middle 1's [1 1]

Transposes: T

t := m.T() // note this creates a new allocated matrix

Deps

Golang

Version 1.14+

Libs

github.com/olekukonko/tablewriter

sparsemat's People

Contributors

nathanhack avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.