Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implementation of the GraphBLAS spec using MLIR python bindings

License

NotificationsYou must be signed in to change notification settings

python-graphblas/python-mlir-graphblas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementation of the GraphBLAS spec using MLIR python bindings

A full GraphBLAS implementation is possible in relatively few linesof Python code because we rely heavily on thelinalg.generic operationin MLIR, specifically its appropriate handling of different Sparse Tensorlayouts. Each GraphBLAS operation becomes essentially a singlelinalg.generic operation with some minor pre- and post-handling ofobject creation.

Usage

Create a Matrix or Vector

>>>frommlir_graphblasimporttypes,operations,operators,Matrix,Vector>>>m=Matrix.new(types.FP64,2,5)>>>m.build([0,0,1,1,1], [1,3,0,3,4], [1.,2.,3.,4.,5.75])>>>mMatrix<FP64,shape=(2,5),format=CSR>>>>v=Vector.new(types.FP64,5)>>>v.build([0,2,3,4], [3.,-2.,4.,1.5])>>>vVector<FP64,size=5>

Perform Operations

Each operation requires an output object to be passed in.

>>>frommlir_graphblas.operatorsimportSemiring>>>z=Vector.new(types.FP64,2)>>>operations.mxv(z,Semiring.plus_times,m,v)>>>zVector<FP64,size=2)

View Results

>>>indices,values=z.extract_tuples()>>>indicesarray([0,1],dtype=uint64)>>>valuesarray([8.   ,33.625])

About

Implementation of the GraphBLAS spec using MLIR python bindings

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp