Documentation ¶
Overview ¶
Package GrB provides a binding for GraphBLAS, and more specifically for the SuiteSparse:GraphBLAS implementation of the GraphBLAS specification, for the Go programming language.
The examples shown below currently do not run in the Go Playground. However, they do run when you copy them locally, or when you perform a "go test" from the GrB package.
Example (BatchedBetweennessCentrality) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) /* * Compute partial BC metric for a subset of source vertices, s, in graph A */ func BatchedBetweennessCentrality(A GrB.Matrix[bool], s []GrB.Index) (delta GrB.Vector[float32], err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) delta, err = GrB.VectorNew[float32](n) GrB.OK(err) defer func() { if err != nil { _ = delta.Free() } }() // index and value arrays needed to build numsp iLens := make([]GrB.Index, len(s)) ones := make([]int, len(s)) for i := range s { iLens[i] = i ones[i] = 1 } // numsp: structure holds the number of shortest paths for each node and starting vertex // discovered so far. Initialized to source vertices: numsp[s[i], i] = 1, i = [0, len(s)] numsp, err := GrB.MatrixNew[int](n, len(s)) GrB.OK(err) defer func() { GrB.OK(numsp.Free()) }() dup := GrB.Plus[int]() GrB.OK(numsp.Build(s, iLens, ones, &dup)) iLens, ones = nil, nil // frontier: Holds the current frontier where values are path counts. // Initialized to out vertices of each source node in s. frontier, err := GrB.MatrixNew[int](n, len(s)) GrB.OK(err) defer func() { GrB.OK(frontier.Free()) }() GrB.OK(GrB.MatrixExtract(frontier, numsp.AsMask(), nil, GrB.MatrixView[int, bool](A), GrB.All(n), s, GrB.DescRCT0)) // sigma: stores frontier information for each level of BFS phase. The memory // for an entry in sigmas is only allocated within the for-loop if needed. var sigmas []GrB.Matrix[bool] // nvals == 0 when BFS phase is complete for nvals := 1; nvals > 0; { // sigmas[level](:,s) = frontier from source vertex s for the current level sigma, err := GrB.MatrixNew[bool](n, len(s)) GrB.OK(err) defer func() { GrB.OK(sigma.Free()) }() sigmas = append(sigmas, sigma) // sigmas[level](:,:) = bool(frontier) GrB.OK(GrB.MatrixApply(sigma, nil, nil, GrB.Identity[bool](), GrB.MatrixView[bool, int](frontier), nil)) // numsp += frontier (accum path counts) GrB.OK(GrB.MatrixEWiseAddBinaryOp(numsp, nil, nil, GrB.Plus[int](), numsp, frontier, nil)) // f<!numsp> = A' +.* f (update frontier) GrB.OK(GrB.MxM(frontier, numsp.AsMask(), nil, GrB.PlusTimesSemiring[int](), GrB.MatrixView[int, bool](A), frontier, GrB.DescRCT0)) // number of nodes in frontier at this level nvals, err = frontier.Nvals() GrB.OK(err) } // nspinv: the inverse of the number of shortest paths for each node and starting vertex. nspinv, err := GrB.MatrixNew[float32](n, len(s)) GrB.OK(err) defer func() { GrB.OK(nspinv.Free()) }() // nspinv = 1/numsp GrB.OK(GrB.MatrixApply(nspinv, nil, nil, GrB.Minv[float32](), GrB.MatrixView[float32, int](numsp), nil)) // bcu: BC updates for each vertex for each starting vertex in s bcu, err := GrB.MatrixNew[float32](n, len(s)) GrB.OK(err) defer func() { GrB.OK(bcu.Free()) }() // filled with 1 to avoid sparsity issues GrB.OK(GrB.MatrixAssignConstant(bcu, nil, nil, 1, GrB.All(n), GrB.All(len(s)), nil)) // temporary workspace matrix w, err := GrB.MatrixNew[float32](n, len(s)) GrB.OK(err) defer func() { GrB.OK(w.Free()) }() plusFloat32 := GrB.Plus[float32]() // Tally phase (backward sweep) for i := len(sigmas) - 1; i > 0; i-- { // w<sigmas[i]> = (1 ./ nsp) .* bcu GrB.OK(GrB.MatrixEWiseMultBinaryOp(w, sigmas[i].AsMask(), nil, GrB.Times[float32](), bcu, nspinv, GrB.DescR)) // add contributions by successors and mask with that BFS level's frontier // w<sigmas[i-1]> = (A +.* w) GrB.OK(GrB.MxM(w, sigmas[i-1].AsMask(), nil, GrB.PlusTimesSemiring[float32](), GrB.MatrixView[float32, bool](A), w, GrB.DescR)) // bcu += w .* numsp GrB.OK(GrB.MatrixEWiseMultBinaryOp(bcu, nil, &plusFloat32, GrB.Times[float32](), w, GrB.MatrixView[float32, int](numsp), nil)) } // row reduce bcu and subtract "len(s)" from every entry to account // for 1 extra value per bcu row element. GrB.OK(GrB.MatrixReduceBinaryOp(delta, nil, nil, GrB.Plus[float32](), bcu, nil)) GrB.OK(GrB.VectorApplyBinaryOp2nd(delta, nil, nil, GrB.Minus[float32](), delta, float32(len(s)), nil)) return delta, nil } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[bool](15, 15) OK(err) OK(A.SetElement(true, 0, 1)) OK(A.SetElement(true, 0, 2)) OK(A.SetElement(true, 0, 3)) OK(A.SetElement(true, 0, 4)) OK(A.SetElement(true, 1, 5)) OK(A.SetElement(true, 1, 6)) OK(A.SetElement(true, 2, 7)) OK(A.SetElement(true, 2, 8)) OK(A.SetElement(true, 3, 9)) OK(A.SetElement(true, 3, 10)) OK(A.SetElement(true, 4, 11)) OK(A.SetElement(true, 4, 12)) OK(A.SetElement(true, 6, 13)) OK(A.SetElement(true, 7, 13)) OK(A.SetElement(true, 10, 14)) OK(A.SetElement(true, 11, 14)) delta, err := BatchedBetweennessCentrality(A, []int{0, 1, 2, 3, 4}) OK(err) defer func() { OK(delta.Free()) }() var indices []int var values []float32 OK(delta.ExtractTuples(&indices, &values)) fmt.Println(indices) fmt.Println(values) }
Output: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] [0 2.5 2.5 2.5 2.5 0 1.5 1.5 0 0 1.5 1.5 0 0 0]
Example (BetweennessCentrality) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) /* * Given a boolean n x n adjacency matrix A and a source vertex s, * compute the BC-metric vector delta. */ func BetweennessCentrality(A GrB.Matrix[bool], s GrB.Index) (delta GrB.Vector[float32], err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) delta, err = GrB.VectorNew[float32](n) GrB.OK(err) defer func() { if err != nil { _ = delta.Free() } }() // sigma[d, k] = #shortest paths to node k at level d sigma, err := GrB.MatrixNew[int](n, n) GrB.OK(err) defer func() { GrB.OK(sigma.Free()) }() // path counts q, err := GrB.VectorNew[int](n) GrB.OK(err) defer func() { GrB.OK(q.Free()) }() GrB.OK(q.SetElement(1, s)) // shortest path counts so far p, err := q.Dup() GrB.OK(err) defer func() { GrB.OK(p.Free()) }() // get the first set of out neighbors GrB.OK(GrB.VxM(q, p.AsMask(), nil, GrB.PlusTimesSemiring[int](), q, GrB.MatrixView[int, bool](A), GrB.DescRC)) /* * BFS phase */ // BFS level number d := 0 // sum == 0 when BFS phase is complete for sum := 1; sum > 0; { // sigma[d,:] = q GrB.OK(GrB.MatrixRowAssign(sigma, nil, nil, q, d, GrB.All(n), nil)) // accum path counts on this level GrB.OK(GrB.VectorEWiseAddBinaryOp(p, nil, nil, GrB.Plus[int](), p, q, nil)) // q = #paths to nodes reachable from current level GrB.OK(GrB.VxM(q, p.AsMask(), nil, GrB.PlusTimesSemiring[int](), q, GrB.MatrixView[int, bool](A), GrB.DescRC)) // sum path counts at this level sum, err = GrB.VectorReduce(GrB.PlusMonoid[int](), q, nil) d++ } /* * BC computation phase * (t1, t2, t3, t4) are temporary vectors */ t1, err := GrB.VectorNew[float32](n) GrB.OK(err) defer func() { GrB.OK(t1.Free()) }() t2, err := GrB.VectorNew[float32](n) GrB.OK(err) defer func() { GrB.OK(t2.Free()) }() t3, err := GrB.VectorNew[float32](n) GrB.OK(err) defer func() { GrB.OK(t3.Free()) }() t4, err := GrB.VectorNew[float32](n) GrB.OK(err) defer func() { GrB.OK(t4.Free()) }() for i := d - 1; i > 0; i-- { // t1 = 1+delta GrB.OK(GrB.VectorAssignConstant(t1, nil, nil, 1, GrB.All(n), nil)) GrB.OK(GrB.VectorEWiseAddBinaryOp(t1, nil, nil, GrB.Plus[float32](), t1, delta, nil)) // t2 = sigma[i,:] GrB.OK(GrB.MatrixColExtract(t2, nil, nil, GrB.MatrixView[float32, int](sigma), GrB.All(n), i, GrB.DescT0)) // t2 = (1+delta)/sigma[i,:] GrB.OK(GrB.VectorEWiseMultBinaryOp(t2, nil, nil, GrB.Div[float32](), t1, t2, nil)) // add contributions made by successors of a node GrB.OK(GrB.MxV(t3, nil, nil, GrB.PlusTimesSemiring[float32](), GrB.MatrixView[float32, bool](A), t2, nil)) // t4 = sigma[i-1,:] GrB.OK(GrB.MatrixColExtract(t4, nil, nil, GrB.MatrixView[float32, int](sigma), GrB.All(n), i-1, GrB.DescT0)) // t4 = sigma[i-1,:]*t3 GrB.OK(GrB.VectorEWiseMultBinaryOp(t4, nil, nil, GrB.Times[float32](), t4, t3, nil)) // accumulate into delta GrB.OK(GrB.VectorEWiseAddBinaryOp(delta, nil, nil, GrB.Plus[float32](), delta, t4, nil)) } return delta, nil } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[bool](15, 15) OK(err) OK(A.SetElement(true, 0, 1)) OK(A.SetElement(true, 0, 2)) OK(A.SetElement(true, 0, 3)) OK(A.SetElement(true, 0, 4)) OK(A.SetElement(true, 1, 5)) OK(A.SetElement(true, 1, 6)) OK(A.SetElement(true, 2, 7)) OK(A.SetElement(true, 2, 8)) OK(A.SetElement(true, 3, 9)) OK(A.SetElement(true, 3, 10)) OK(A.SetElement(true, 4, 11)) OK(A.SetElement(true, 4, 12)) OK(A.SetElement(true, 6, 13)) OK(A.SetElement(true, 7, 13)) OK(A.SetElement(true, 10, 14)) OK(A.SetElement(true, 11, 14)) delta, err := BetweennessCentrality(A, 0) OK(err) defer func() { OK(delta.Free()) }() var indices []int var values []float32 OK(delta.ExtractTuples(&indices, &values)) fmt.Println(indices) fmt.Println(values) }
Output: [1 2 3 4 6 7 10 11] [2.5 2.5 2.5 2.5 0.5 0.5 0.5 0.5]
Example (LevelBreadthFirstSearch) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) /* * Given a boolean n x n adjacency matrix A and a source vertex s, performs a BFS traversal * of the graph and sets v[i] to the level in which vertex i is visited (v[i] = 1). * If i is not reachable from s, then v[i] = 0. */ func LevelBreadthFirstSearch(A GrB.Matrix[bool], s GrB.Index) (v GrB.Vector[int], err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) v, err = GrB.VectorNew[int](n) GrB.OK(err) defer func() { if err != nil { _ = v.Free() } }() // vertices visited in each level q, err := GrB.VectorNew[bool](n) GrB.OK(err) defer func() { // q vector no longer needed GrB.OK(q.Free()) }() // q[s] = true, false everywhere else GrB.OK(q.SetElement(true, s)) /* * BFS traversal and label the vertices. */ // d = level in BFS traversal d := 0 // succ == true when some successor found for succ := true; succ; { // next level (start with 1) d++ // v[q] = d GrB.OK(GrB.VectorAssignConstant(v, &q, nil, d, GrB.All(n), nil)) // q [!v] = q ||.&& A ; finds all the unvisited successors from current q GrB.OK(GrB.VxM(q, v.AsMask(), nil, GrB.LorLandSemiringBool, q, A, GrB.DescRC)) // succ = ||(q) succ, err = GrB.VectorReduce(GrB.LorMonoidBool, q, nil) GrB.OK(err) } return v, nil } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[bool](15, 15) OK(err) OK(A.SetElement(true, 0, 1)) OK(A.SetElement(true, 0, 2)) OK(A.SetElement(true, 0, 3)) OK(A.SetElement(true, 0, 4)) OK(A.SetElement(true, 1, 5)) OK(A.SetElement(true, 1, 6)) OK(A.SetElement(true, 2, 7)) OK(A.SetElement(true, 2, 8)) OK(A.SetElement(true, 3, 9)) OK(A.SetElement(true, 3, 10)) OK(A.SetElement(true, 4, 11)) OK(A.SetElement(true, 4, 12)) OK(A.SetElement(true, 6, 13)) OK(A.SetElement(true, 7, 13)) OK(A.SetElement(true, 10, 14)) OK(A.SetElement(true, 11, 14)) v, err := LevelBreadthFirstSearch(A, 0) OK(err) defer func() { OK(v.Free()) }() var indices, values []int OK(v.ExtractTuples(&indices, &values)) fmt.Println(indices) fmt.Println(values) }
Output: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] [1 2 2 2 2 3 3 3 3 3 3 3 3 4 4]
Example (LevelBreadthFirstSearchUsingApply) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) /* * Given a boolean n x n adjacency matrix A and a source vertex s, performs a BFS traversal * of the graph and sets v[i] to the level in which vertex i is visited (v[s] = 1). * If i is not reachable from s, then v[i] does not have a stored element. */ func LevelBreadthFirstSearchUsingApply(A GrB.Matrix[bool], s GrB.Index) (v GrB.Vector[int], err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) v, err = GrB.VectorNew[int](n) GrB.OK(err) defer func() { if err != nil { _ = v.Free() } }() // vertices visited in each level q, err := GrB.VectorNew[bool](n) GrB.OK(err) defer func() { // q vector no longer needed GrB.OK(q.Free()) }() // q[s] = true, false everywhere else GrB.OK(q.SetElement(true, s)) /* * BFS traversal and label the vertices. */ // level = depth in BFS traversal level := 0 accum := GrB.Plus[int]() for nvals := 1; nvals > 0; { // next level (start with 1) level++ // v[q] = level GrB.OK(GrB.VectorApplyBinaryOp2nd(v, nil, &accum, GrB.Second[bool, int](), q, level, nil)) // q [!v] = q ||.&& A ; finds all the unvisited successors from current q GrB.OK(GrB.VxM(q, v.AsMask(), nil, GrB.LorLandSemiringBool, q, A, GrB.DescRC)) nvals, err = q.Nvals() GrB.OK(err) } return v, nil } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[bool](15, 15) OK(err) OK(A.SetElement(true, 0, 1)) OK(A.SetElement(true, 0, 2)) OK(A.SetElement(true, 0, 3)) OK(A.SetElement(true, 0, 4)) OK(A.SetElement(true, 1, 5)) OK(A.SetElement(true, 1, 6)) OK(A.SetElement(true, 2, 7)) OK(A.SetElement(true, 2, 8)) OK(A.SetElement(true, 3, 9)) OK(A.SetElement(true, 3, 10)) OK(A.SetElement(true, 4, 11)) OK(A.SetElement(true, 4, 12)) OK(A.SetElement(true, 6, 13)) OK(A.SetElement(true, 7, 13)) OK(A.SetElement(true, 10, 14)) OK(A.SetElement(true, 11, 14)) v, err := LevelBreadthFirstSearchUsingApply(A, 0) OK(err) defer func() { OK(v.Free()) }() var indices, values []int OK(v.ExtractTuples(&indices, &values)) fmt.Println(indices) fmt.Println(values) }
Output: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] [1 2 2 2 2 3 3 3 3 3 3 3 3 4 4]
Example (MaximalIndependentSet) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) // Assign a random number to each element scaled by the inverse of the node's degree. // This will increase the probability that low degree nodes are selected and larger // sets are selected. const ( setRandomName = "setRandom" setRandomDef = `void setRandom(void *out, const void *in) { uint32_t degree = *(uint32_t*)in; *(float*)out = (0.0001f + random()/(1. + 2.*degree)); // add 1 to prevent divied by zero }` ) /* * A variant of Luby's randomized algorithm [Luby 1985]. * * Given a numeric n x n adjacency matrix A of an unweighted and undirected graph (where * the value true represents an edge), compute a maximal set of independent vertices and * return it in a boolean n-vector, 'iset' where set[i] == true implies vertex i is a member * of the set. */ func MaximalIndependentSet(A GrB.Matrix[bool]) (iset GrB.Vector[bool], err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) // Initialize independent set vector iset, err = GrB.VectorNew[bool](n) GrB.OK(err) defer func() { if err != nil { _ = iset.Free() } }() // holds random probabilities for each node prob, err := GrB.VectorNew[float32](n) GrB.OK(err) defer func() { GrB.OK(prob.Free()) }() // holds value of max neighbor probability neighborMax, err := GrB.VectorNew[float32](n) GrB.OK(err) defer func() { GrB.OK(neighborMax.Free()) }() // holds set of new members to iset newMembers, err := GrB.VectorNew[bool](n) GrB.OK(err) defer func() { GrB.OK(newMembers.Free()) }() // holds set of new neighbors to new iset members newNeighbors, err := GrB.VectorNew[bool](n) GrB.OK(err) defer func() { GrB.OK(newNeighbors.Free()) }() // candidate members to iset candidates, err := GrB.VectorNew[bool](n) GrB.OK(err) defer func() { GrB.OK(candidates.Free()) }() setRandom, err := GrB.NamedUnaryOpNew[float32, uint32](nil, setRandomName, setRandomDef) GrB.OK(err) defer func() { GrB.OK(setRandom.Free()) }() // compute the degree of each vertex degrees, err := GrB.VectorNew[float64](n) GrB.OK(err) defer func() { GrB.OK(degrees.Free()) }() GrB.OK(GrB.MatrixReduceBinaryOp(degrees, nil, nil, GrB.Plus[float64](), GrB.MatrixView[float64, bool](A), nil)) // Isolated vertices are not candidates: candidates[degrees != 0] = true GrB.OK(GrB.VectorAssignConstant(candidates, degrees.AsMask(), nil, true, GrB.All(n), nil)) // add all singletons to iset: iset[degree == 0] = 1 GrB.OK(GrB.VectorAssignConstant(iset, degrees.AsMask(), nil, true, GrB.All(n), nil)) // Iterate while there are candidates to check. nvals, err := candidates.Nvals() GrB.OK(err) for nvals > 0 { // compute a random probability scaled by inverse of degree GrB.OK(GrB.VectorApply(prob, &candidates, nil, setRandom, GrB.VectorView[uint32, float64](degrees), GrB.DescR)) // compute the max probability of all neighbors GrB.OK(GrB.MxV(neighborMax, &candidates, nil, GrB.MaxSecondSemiring[float32](), GrB.MatrixView[float32, bool](A), prob, GrB.DescR)) // select vertex if its probability is larger than all its active neighbors, // and apply a "masked no-op" to remove stored falses GrB.OK(GrB.VectorEWiseAddBinaryOp(newMembers, nil, nil, GrB.Gt[float32](), prob, neighborMax, nil)) GrB.OK(GrB.VectorApply(newMembers, &newMembers, nil, GrB.Identity[bool](), newMembers, GrB.DescR)) // add new members to independent set GrB.OK(GrB.VectorEWiseAddBinaryOp(iset, nil, nil, GrB.LorBool, iset, newMembers, nil)) // remove new members from set of candidates c = c & !new GrB.OK(GrB.VectorEWiseMultBinaryOp(candidates, &newMembers, nil, GrB.LandBool, candidates, candidates, GrB.DescRC)) nvals, err = candidates.Nvals() GrB.OK(err) if nvals == 0 { break } // Neighbors of new members can also be removed from candidates GrB.OK(GrB.MxV(newNeighbors, &candidates, nil, GrB.LorLandSemiringBool, A, newMembers, nil)) GrB.OK(GrB.VectorEWiseMultBinaryOp(candidates, &newNeighbors, nil, GrB.LandBool, candidates, candidates, GrB.DescRC)) nvals, err = candidates.Nvals() GrB.OK(err) } return iset, nil } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[bool](15, 15) OK(err) OK(A.SetElement(true, 0, 1)) OK(A.SetElement(true, 0, 2)) OK(A.SetElement(true, 0, 3)) OK(A.SetElement(true, 0, 4)) OK(A.SetElement(true, 1, 5)) OK(A.SetElement(true, 1, 6)) OK(A.SetElement(true, 2, 7)) OK(A.SetElement(true, 2, 8)) OK(A.SetElement(true, 3, 9)) OK(A.SetElement(true, 3, 10)) OK(A.SetElement(true, 4, 11)) OK(A.SetElement(true, 4, 12)) OK(A.SetElement(true, 6, 13)) OK(A.SetElement(true, 7, 13)) OK(A.SetElement(true, 10, 14)) OK(A.SetElement(true, 11, 14)) iset, err := MaximalIndependentSet(A) OK(err) defer func() { OK(iset.Free()) }() var indices []int OK(iset.ExtractTuples(&indices, nil)) fmt.Println(indices) }
Output: [0 1 2 3 4 6 7 10 11]
Example (ParentBreadthFirstSearch) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) /* * Given a binary n x n adjacency matrix A and a source vertex s, performs a BFS * traversal of the graph and sets parents[i] to the index of vertex i's parent. * The parent of the root vertex, s, will be set to itself (parents[s] = s). If * vertex i is not reachable from s, parents[i] will not contain a stored value. */ func ParentBreadthFirstSearch(A GrB.Matrix[int], s GrB.Index) (parents GrB.Vector[int], err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) parents, err = GrB.VectorNew[int](n) GrB.OK(err) defer func() { if err != nil { _ = parents.Free() } }() GrB.OK(parents.SetElement(s, s)) wavefront, err := GrB.VectorNew[int](n) GrB.OK(err) defer func() { GrB.OK(wavefront.Free()) }() GrB.OK(wavefront.SetElement(1, s)) /* * BFS traversal and label the vertices. */ plusInt := GrB.Plus[int]() for nvals := 1; nvals > 0; { // convert all stored values in wavefront to their 0-based index GrB.OK(GrB.VectorApplyIndexOp(wavefront, nil, nil, GrB.RowIndex[int, int](), wavefront, 0, nil)) // "First" because left-multiplying wavefront rows. Masking out the parent // list ensures wavefront values do not overwrite parents already stored. GrB.OK(GrB.VxM(wavefront, parents.AsMask(), nil, GrB.MinFirstSemiring[int](), wavefront, A, GrB.DescRSC)) // Don't need to mask here since we did it in VxM. Merges new parents in // current wavefrontwith existing parents: parents += wavefront GrB.OK(GrB.VectorApply(parents, nil, &plusInt, GrB.Identity[int](), wavefront, nil)) nvals, err = wavefront.Nvals() GrB.OK(err) } return parents, nil } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[int](15, 15) OK(err) OK(A.SetElement(1, 0, 1)) OK(A.SetElement(1, 0, 2)) OK(A.SetElement(1, 0, 3)) OK(A.SetElement(1, 0, 4)) OK(A.SetElement(1, 1, 5)) OK(A.SetElement(1, 1, 6)) OK(A.SetElement(1, 2, 7)) OK(A.SetElement(1, 2, 8)) OK(A.SetElement(1, 3, 9)) OK(A.SetElement(1, 3, 10)) OK(A.SetElement(1, 4, 11)) OK(A.SetElement(1, 4, 12)) OK(A.SetElement(1, 6, 13)) OK(A.SetElement(1, 7, 13)) OK(A.SetElement(1, 10, 14)) OK(A.SetElement(1, 11, 14)) v, err := ParentBreadthFirstSearch(A, 0) OK(err) defer func() { OK(v.Free()) }() var indices, values []int OK(v.ExtractTuples(&indices, &values)) fmt.Println(indices) fmt.Println(values) }
Output: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14] [0 0 0 0 0 1 1 2 2 3 3 4 4 6 10]
Example (TriangleCount) ¶
package main import ( "fmt" "github.com/intel/forGraphBLASGo/GrB" "testing" ) /* * Given an n x n boolean adjacency matrix, A, of an undirected graph, computes * the number of triangles in the graph. */ func TriangleCount[T GrB.Predefined](A GrB.Matrix[T]) (count int, err error) { defer GrB.CheckErrors(&err) n, err := A.Nrows() GrB.OK(err) // L: NxN, lower-triangular, bool L, err := GrB.MatrixNew[bool](n, n) GrB.OK(err) defer func() { GrB.OK(L.Free()) }() GrB.OK(GrB.MatrixSelect(L, nil, nil, GrB.Tril[bool](), GrB.MatrixView[bool, T](A), 0, nil)) Lint := GrB.MatrixView[int, bool](L) C, err := GrB.MatrixNew[int](n, n) GrB.OK(err) defer func() { GrB.OK(C.Free()) }() // C<L> = L +.* L GrB.OK(GrB.MxM(C, &L, nil, GrB.PlusTimesSemiring[int](), Lint, Lint, nil)) // 1-norm of C return GrB.MatrixReduce(GrB.PlusMonoid[int](), C, nil) } func main() { OK := func(err error) { if err != nil { panic(err) } } if !testing.Testing() { // When run by "go test", this initialization of // GraphBLAS is done elsewhere in TestMain. OK(GrB.Init(GrB.NonBlocking)) defer func() { OK(GrB.Finalize()) }() } A, err := GrB.MatrixNew[bool](15, 15) OK(err) OK(A.SetElement(true, 0, 1)) OK(A.SetElement(true, 0, 2)) OK(A.SetElement(true, 0, 3)) OK(A.SetElement(true, 0, 4)) OK(A.SetElement(true, 1, 3)) OK(A.SetElement(true, 1, 5)) OK(A.SetElement(true, 1, 6)) OK(A.SetElement(true, 2, 4)) OK(A.SetElement(true, 2, 7)) OK(A.SetElement(true, 2, 8)) OK(A.SetElement(true, 3, 9)) OK(A.SetElement(true, 3, 10)) OK(A.SetElement(true, 4, 11)) OK(A.SetElement(true, 4, 12)) OK(A.SetElement(true, 6, 13)) OK(A.SetElement(true, 7, 13)) OK(A.SetElement(true, 10, 14)) OK(A.SetElement(true, 11, 14)) OK(GrB.MatrixEWiseAddBinaryOp(A, nil, nil, GrB.LorBool, A, A, GrB.DescT1)) count, err := TriangleCount(A) OK(err) fmt.Println(count) }
Output: 2
Index ¶
- Constants
- Variables
- func All(size int) []int
- func Backwards(begin, end, inc int) []int
- func CheckErrors(err *error)
- func ContextDisengage(context *Context) error
- func Finalize() error
- func GetVersion() (version, subversion int)
- func GlobalGetBitmapSwitch() (bitmapSwitch [NBitmapSwitch]float64, err error)
- func GlobalGetBurble() (enabledNotDisabled bool, err error)
- func GlobalGetChunk() (float64, error)
- func GlobalGetHyperSwitch() (float64, error)
- func GlobalGetJITCCompilerFlags() (string, error)
- func GlobalGetJITCCompilerName() (string, error)
- func GlobalGetJITCLibraries() (string, error)
- func GlobalGetJITCLinkerFlags() (string, error)
- func GlobalGetJITCPreface() (string, error)
- func GlobalGetJITCachePath() (string, error)
- func GlobalGetNThreads() (int32, error)
- func GlobalGetOpenMP() (bool, error)
- func GlobalGetPrint1Based() (print1Based bool, err error)
- func GlobalSetBitmapSwitch(bitmapSwitch [NBitmapSwitch]float64) error
- func GlobalSetBurble(enableNotDisable bool) error
- func GlobalSetChunk(chunk float64) error
- func GlobalSetHyperSwitch(hyperSwitch float64) error
- func GlobalSetJITCCompilerFlags(flags string) error
- func GlobalSetJITCCompilerName(name string) error
- func GlobalSetJITCControl(control JITControl) error
- func GlobalSetJITCLibraries(libs string) error
- func GlobalSetJITCLinkerFlags(flags string) error
- func GlobalSetJITCPreface(preface string) error
- func GlobalSetJITCachePath(path string) error
- func GlobalSetLayout(format Layout) error
- func GlobalSetNThreads(nthreads int32) error
- func GlobalSetPanicOnError(onNotOff bool) error
- func GlobalSetPrint1Based(print1Based bool) error
- func Init(mode Mode) error
- func InitWithMalloc(mode Mode, malloc UserMallocFunction, calloc UserCallocFunction, ...) error
- func KroneckerBinaryOp[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func KroneckerMonoid[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op Monoid[D], ...) error
- func KroneckerSemiring[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApply[DC, DA any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApplyBinaryOp1st[DC, D, DA any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApplyBinaryOp1stScalar[DC, D, DA any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApplyBinaryOp2nd[DC, DA, D any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApplyBinaryOp2ndScalar[DC, DA, D any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApplyIndexOp[DC, DA, D any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixApplyIndexOpScalar[DC, DA, D any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixAssign[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], ...) error
- func MatrixAssignConstant[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val D, ...) error
- func MatrixAssignScalar[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val Scalar[D], ...) error
- func MatrixColAssign[D any](c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func MatrixColExtract[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], a Matrix[D], ...) error
- func MatrixColSubassign[D any](c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func MatrixEWiseAddBinaryOp[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixEWiseAddMonoid[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op Monoid[D], ...) error
- func MatrixEWiseAddSemiring[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixEWiseMultBinaryOp[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixEWiseMultMonoid[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op Monoid[D], ...) error
- func MatrixEWiseMultSemiring[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixEWiseUnion[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MatrixExtract[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], ...) error
- func MatrixReduce[D any](op Monoid[D], a Matrix[D], desc *Descriptor) (val D, err error)
- func MatrixReduceBinaryOp[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], ...) error
- func MatrixReduceBinaryOpScalar[D any](s Scalar[D], accum *BinaryOp[D, D, D], op BinaryOp[D, D, D], a Matrix[D], ...) error
- func MatrixReduceMonoid[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op Monoid[D], ...) error
- func MatrixReduceMonoidScalar[D any](s Scalar[D], accum *BinaryOp[D, D, D], op Monoid[D], a Matrix[D], ...) error
- func MatrixRowAssign[D any](c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func MatrixRowSubassign[D any](c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func MatrixSelect[D, T any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], ...) error
- func MatrixSelectScalar[D, T any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], ...) error
- func MatrixSubassign[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], ...) error
- func MatrixSubassignConstant[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val D, ...) error
- func MatrixSubassignScalar[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val Scalar[D], ...) error
- func Maximum[D Number]() (result D)
- func Minimum[D Number]() (result D)
- func MxM[DC, DA, DB any](c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], ...) error
- func MxV[Dw, DA, Du any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func OK(err error)
- func Range(begin, end int) []int
- func Stride(begin, end, inc int) []int
- func Transpose[D any](c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], ...) error
- func VectorApply[Dw, Du any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorApplyBinaryOp1st[Dw, D, Du any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorApplyBinaryOp1stScalar[Dw, D, Du any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorApplyBinaryOp2nd[Dw, Du, D any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorApplyBinaryOp2ndScalar[Dw, Du, D any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorApplyIndexOp[Dw, Du, D any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorApplyIndexOpScalar[Dw, Du, D any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorAssign[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func VectorAssignConstant[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val D, ...) error
- func VectorAssignScalar[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val Scalar[D], ...) error
- func VectorEWiseAddBinaryOp[Dw, Du, Dv any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorEWiseAddMonoid[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op Monoid[D], ...) error
- func VectorEWiseAddSemiring[Dw, Du, Dv any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorEWiseMultBinaryOp[Dw, Du, Dv any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorEWiseMultMonoid[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op Monoid[D], ...) error
- func VectorEWiseMultSemiring[Dw, Du, Dv any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorEWiseUnion[Dw, Du, Dv any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- func VectorExtract[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func VectorReduce[D any](op Monoid[D], u Vector[D], desc *Descriptor) (val D, err error)
- func VectorReduceBinaryOpScalar[D any](s Scalar[D], accum *BinaryOp[D, D, D], op BinaryOp[D, D, D], u Vector[D], ...) error
- func VectorReduceMonoidScalar[D any](s Scalar[D], accum *BinaryOp[D, D, D], op Monoid[D], u Vector[D], ...) error
- func VectorSelect[D, T any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], ...) error
- func VectorSelectScalar[D, T any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], ...) error
- func VectorSubassign[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], ...) error
- func VectorSubassignConstant[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val D, ...) error
- func VectorSubassignScalar[D any](w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val Scalar[D], ...) error
- func VersionToInt(major, minor, sub int) int
- func VxM[Dw, Du, DA any](w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], ...) error
- type BinaryFunction
- type BinaryOp
- func Any[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Atan2[D Float]() (f BinaryOp[D, D, D])
- func Band[D Integer]() (f BinaryOp[D, D, D])
- func Bclr[D Integer]() (f BinaryOp[D, D, D])
- func Bget[D Integer]() (f BinaryOp[D, D, D])
- func BinaryOpNew[Dout, Din1, Din2 any](binaryFunc BinaryFunction) (binaryOp BinaryOp[Dout, Din1, Din2], err error)
- func Bor[D Integer]() (f BinaryOp[D, D, D])
- func Bset[D Integer]() (f BinaryOp[D, D, D])
- func Bshift[D Integer]() (f BinaryOp[D, D, int8])
- func Bxnor[D Integer]() (f BinaryOp[D, D, D])
- func Bxor[D Integer]() (f BinaryOp[D, D, D])
- func Cmplx[C Complex, F Float]() (f BinaryOp[C, F, F], err error)
- func Copysign[D Float]() (f BinaryOp[D, D, D])
- func Div[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Eq[D Predefined | Complex]() (f BinaryOp[bool, D, D])
- func First[D Predefined | Complex, Any any]() (f BinaryOp[D, D, Any])
- func Firsti[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Firsti1[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Firstj[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Firstj1[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Fmod[D Float]() (f BinaryOp[D, D, D])
- func Ge[D Predefined]() (f BinaryOp[bool, D, D])
- func Gt[D Predefined]() (f BinaryOp[bool, D, D])
- func Hypot[D Float]() (f BinaryOp[D, D, D])
- func IgnoreDup[Dout, Din1, Din2 any]() BinaryOp[Dout, Din1, Din2]
- func Iseq[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Isge[D Predefined]() (f BinaryOp[D, D, D])
- func Isgt[D Predefined]() (f BinaryOp[D, D, D])
- func Isle[D Predefined]() (f BinaryOp[D, D, D])
- func Islt[D Predefined]() (f BinaryOp[D, D, D])
- func Isne[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Land[D Predefined]() (f BinaryOp[D, D, D])
- func Ldexp[D Float]() (f BinaryOp[D, D, D])
- func Le[D Predefined]() (f BinaryOp[bool, D, D])
- func Lor[D Predefined]() (f BinaryOp[D, D, D])
- func Lt[D Predefined]() (f BinaryOp[bool, D, D])
- func Lxor[D Predefined]() (f BinaryOp[D, D, D])
- func Max[D Predefined]() (f BinaryOp[D, D, D])
- func Min[D Predefined]() (f BinaryOp[D, D, D])
- func Minus[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func NamedBinaryOpNew[Dout, Din1, Din2 any](binaryFunc BinaryFunction, binopname string, binopdefn string) (binaryOp BinaryOp[Dout, Din1, Din2], err error)
- func Ne[D Predefined | Complex]() (f BinaryOp[bool, D, D])
- func Oneb[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Plus[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Pow[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Rdiv[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Remainder[D Float]() (f BinaryOp[D, D, D])
- func Rminus[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func Second[Any any, D Predefined | Complex]() (f BinaryOp[D, Any, D])
- func Secondi[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Secondi1[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Secondj[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Secondj1[D int32 | int64 | int, Din1, Din2 any]() (f BinaryOp[D, Din1, Din2])
- func Times[D Predefined | Complex]() (f BinaryOp[D, D, D])
- func (binaryOp BinaryOp[Dout, Din1, Din2]) Err() (string, error)
- func (binaryOp *BinaryOp[Dout, Din1, Din2]) Free() error
- func (binaryOp BinaryOp[Dout, Din1, Din2]) Print(name string, pr PrintLevel) error
- func (binaryOp BinaryOp[Dout, Din1, Din2]) Valid() bool
- func (binaryOp BinaryOp[Dout, Din1, Din2]) Wait(mode WaitMode) error
- type ColIterator
- func (it ColIterator) Err() (string, error)
- func (it *ColIterator) Free() error
- func (it ColIterator) Get() D
- func (it ColIterator[D]) GetColIndex() int
- func (it ColIterator[D]) GetRowIndex() int
- func (it ColIterator[D]) KSeek(k int) (ok, exhausted bool, err error)
- func (it ColIterator[D]) Kount() int
- func (it ColIterator[D]) NextCol() (ok, exhausted bool, err error)
- func (it ColIterator[D]) NextRow() (ok bool, err error)
- func (it ColIterator[D]) SeekCol(col int) (ok, exhausted bool, err error)
- func (it ColIterator) Valid() bool
- func (it ColIterator) Wait(WaitMode) error
- type Complex
- type Context
- type DescField
- type DescValue
- type Descriptor
- func (descriptor Descriptor) Err() (string, error)
- func (descriptor *Descriptor) Free() error
- func (descriptor Descriptor) Get(field DescField) (DescValue, error)
- func (descriptor Descriptor) Print(name string, pr PrintLevel) error
- func (descriptor Descriptor) Set(field DescField, value DescValue) error
- func (descriptor Descriptor) Valid() bool
- func (descriptor Descriptor) Wait(mode WaitMode) error
- type EntryIterator
- func (it EntryIterator) Err() (string, error)
- func (it *EntryIterator) Free() error
- func (it EntryIterator) Get() D
- func (it EntryIterator[D]) GetIndex() (int, int)
- func (it EntryIterator[D]) Getp() int
- func (it EntryIterator[D]) Getpmax() int
- func (it EntryIterator[D]) Next() (ok bool, err error)
- func (it EntryIterator[D]) Seek(p int) (ok bool, err error)
- func (it EntryIterator) Valid() bool
- func (it EntryIterator) Wait(WaitMode) error
- type Float
- type Format
- type Index
- type IndexUnaryFunction
- type IndexUnaryOp
- func ColIndex[D int32 | int64 | int, Any any]() (f IndexUnaryOp[D, Any, D])
- func Colgt[Any any]() IndexUnaryOp[bool, Any, int64]
- func Colle[Any any]() IndexUnaryOp[bool, Any, int64]
- func Diag[Any any]() IndexUnaryOp[bool, Any, int64]
- func DiagIndex[D int32 | int64 | int, Any any]() (f IndexUnaryOp[D, Any, D])
- func IndexUnaryOpNew[Dout, Din1, Din2 any](indexUnaryFunc IndexUnaryFunction) (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2], err error)
- func NamedIndexUnaryOpNew[Dout, Din1, Din2 any](indexUnaryFunc IndexUnaryFunction, idxopname string, idxopdefn string) (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2], err error)
- func Offdiag[Any any]() IndexUnaryOp[bool, Any, int64]
- func RowIndex[D int32 | int64 | int, Any any]() (f IndexUnaryOp[D, Any, D])
- func Rowgt[Any any]() IndexUnaryOp[bool, Any, int64]
- func Rowle[Any any]() IndexUnaryOp[bool, Any, int64]
- func Tril[Any any]() IndexUnaryOp[bool, Any, int64]
- func Triu[Any any]() IndexUnaryOp[bool, Any, int64]
- func Valueeq[D Predefined | Complex]() (f IndexUnaryOp[bool, D, D])
- func Valuege[D Predefined]() (f IndexUnaryOp[bool, D, D])
- func Valuegt[D Predefined]() (f IndexUnaryOp[bool, D, D])
- func Valuele[D Predefined]() (f IndexUnaryOp[bool, D, D])
- func Valuelt[D Predefined]() (f IndexUnaryOp[bool, D, D])
- func Valuene[D Predefined | Complex]() (f IndexUnaryOp[bool, D, D])
- func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Err() (string, error)
- func (indexUnaryOp *IndexUnaryOp[Dout, Din1, Din2]) Free() error
- func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Print(name string, pr PrintLevel) error
- func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Valid() bool
- func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Wait(mode WaitMode) error
- type Info
- type Integer
- type JITControl
- type Layout
- type Matrix
- func MatrixDeserialize[D any](data []byte) (a Matrix[D], err error)
- func MatrixImport[D any](nrows, ncols int, indptr, indices []int, values []D, format Format) (a Matrix[D], err error)
- func MatrixNew[D any](nrows, ncols int) (matrix Matrix[D], err error)
- func MatrixView[To, From Predefined | Complex](matrix Matrix[From]) (view Matrix[To])
- func (matrix Matrix[D]) AsMask() *Matrix[bool]
- func (matrix Matrix[D]) Build(rowIndices, colIndices []int, values []D, dup *BinaryOp[D, D, D]) error
- func (matrix Matrix[D]) BuildDiag(v Vector[D], k int, desc *Descriptor) error
- func (matrix Matrix[D]) BuildScalar(rowIndices, colIndices []int, scalar Scalar[D]) error
- func (matrix Matrix[D]) Clear() error
- func (matrix Matrix[D]) ColIteratorNew(desc *Descriptor) (it ColIterator[D], err error)
- func (matrix Matrix[D]) Concat(tiles []Matrix[D], m, n int, desc *Descriptor) error
- func (matrix Matrix[D]) Dup() (dup Matrix[D], err error)
- func (matrix Matrix[D]) Err() (string, error)
- func (matrix Matrix[D]) Export(format Format) (indptr, indices []int, values []D, err error)
- func (matrix Matrix[D]) ExportHint() (format Format, ok bool, err error)
- func (matrix Matrix[D]) ExtractElement(rowIndex, colIndex int) (result D, ok bool, err error)
- func (matrix Matrix[D]) ExtractElementScalar(result Scalar[D], rowIndex, colIndex int) error
- func (matrix Matrix[D]) ExtractTuples(rowIndices, colIndices *[]int, values *[]D) error
- func (matrix *Matrix[D]) Free() error
- func (matrix Matrix[D]) GetBitmapSwitch() (bitmapSwitch float64, err error)
- func (matrix Matrix[D]) GetHyperSwitch() (hyperSwitch float64, err error)
- func (matrix Matrix[D]) GetLayout() (format Layout, err error)
- func (matrix Matrix[D]) GetSparsityControl() (sparsity Sparsity, err error)
- func (matrix Matrix[D]) GetSparsityStatus() (status Sparsity, err error)
- func (matrix Matrix[D]) IsStoredElement(rowIndex, colIndex int) (ok bool, err error)
- func (matrix Matrix[D]) Iso() (iso bool, err error)
- func (matrix Matrix[D]) IteratorNew(desc *Descriptor) (it EntryIterator[D], err error)
- func (matrix Matrix[D]) MemoryUsage() (size int, err error)
- func (matrix Matrix[D]) Ncols() (ncols int, err error)
- func (matrix Matrix[D]) Nrows() (nrows int, err error)
- func (matrix Matrix[D]) Nvals() (nvals int, err error)
- func (matrix Matrix[D]) PackBitmapC(ab *SystemSlice[bool], ax *SystemSlice[D], iso bool, nvals int, ...) error
- func (matrix Matrix[D]) PackBitmapCBytes(ab, ax *SystemSlice[byte], iso bool, nvals int, desc *Descriptor) error
- func (matrix Matrix[D]) PackBitmapR(ab *SystemSlice[bool], ax *SystemSlice[D], iso bool, nvals int, ...) error
- func (matrix Matrix[D]) PackBitmapRBytes(ab, ax *SystemSlice[byte], iso bool, nvals int, desc *Descriptor) error
- func (matrix Matrix[D]) PackCSC(ap, ai *SystemSlice[int], ax *SystemSlice[D], iso, jumbled bool, ...) error
- func (matrix Matrix[D]) PackCSCBytes(ap, ai, ax *SystemSlice[byte], iso, jumbled bool, desc *Descriptor) error
- func (matrix Matrix[D]) PackCSR(ap, aj *SystemSlice[int], ax *SystemSlice[D], iso, jumbled bool, ...) error
- func (matrix Matrix[D]) PackCSRBytes(ap, aj, ax *SystemSlice[byte], iso, jumbled bool, desc *Descriptor) error
- func (matrix Matrix[D]) PackFullC(ax *SystemSlice[D], iso bool, desc *Descriptor) error
- func (matrix Matrix[D]) PackFullCBytes(ax *SystemSlice[byte], iso bool, desc *Descriptor) error
- func (matrix Matrix[D]) PackFullR(ax *SystemSlice[D], iso bool, desc *Descriptor) error
- func (matrix Matrix[D]) PackFullRBytes(ax *SystemSlice[byte], iso bool, desc *Descriptor) error
- func (matrix Matrix[D]) PackHyperCSC(ap, ah, ai *SystemSlice[int], ax *SystemSlice[D], iso bool, nvec int, ...) error
- func (matrix Matrix[D]) PackHyperCSCBytes(ap, ah, ai, ax *SystemSlice[byte], iso bool, nvec int, jumbled bool, ...) error
- func (matrix Matrix[D]) PackHyperCSR(ap, ah, aj *SystemSlice[int], ax *SystemSlice[D], iso bool, nvec int, ...) error
- func (matrix Matrix[D]) PackHyperCSRBytes(ap, ah, aj, ax *SystemSlice[byte], iso bool, nvec int, jumbled bool, ...) error
- func (matrix Matrix[D]) PackHyperHash(hash *Matrix[int], desc *Descriptor) error
- func (matrix Matrix[D]) Print(name string, pr PrintLevel) error
- func (matrix Matrix[D]) RemoveElement(rowIndex, colIndex int) error
- func (matrix Matrix[D]) Reshape(byCol bool, nrowsNew, ncolsNew int, desc *Descriptor) error
- func (matrix Matrix[D]) ReshapeDup(byCol bool, nrowsNew, ncolsNew int, desc *Descriptor) (dup Matrix[D], err error)
- func (matrix Matrix[D]) Resize(nrows, ncols int) error
- func (matrix Matrix[D]) RowIteratorNew(desc *Descriptor) (it RowIterator[D], err error)
- func (matrix Matrix[D]) Serialize(data []byte) (size int, err error)
- func (matrix Matrix[D]) SerializeSize() (size int, err error)
- func (matrix Matrix[D]) SetBitmapSwitch(bitmapSwitch float64) error
- func (matrix Matrix[D]) SetElement(val D, rowIndex, colIndex int) error
- func (matrix Matrix[D]) SetElementScalar(val Scalar[D], rowIndex, colIndex int) error
- func (matrix Matrix[D]) SetHyperSwitch(hyperSwitch float64) error
- func (matrix Matrix[D]) SetLayout(format Layout) error
- func (matrix Matrix[D]) SetSparsityControl(sparsity Sparsity) error
- func (matrix Matrix[D]) Size() (nrows, ncols int, err error)
- func (matrix Matrix[D]) Sort(into *Matrix[D], p *Matrix[int], op BinaryOp[bool, D, D], desc *Descriptor) error
- func (matrix Matrix[D]) Split(tileNrows, tileNcols []int, desc *Descriptor) (tiles []Matrix[D], err error)
- func (matrix Matrix[D]) Type() (typ Type, ok bool, err error)
- func (matrix Matrix[D]) UnpackBitmapC(desc *Descriptor) (ab SystemSlice[bool], ax SystemSlice[D], iso bool, nvals int, err error)
- func (matrix Matrix[D]) UnpackBitmapCBytes(desc *Descriptor) (ab, ax SystemSlice[byte], iso bool, nvals int, err error)
- func (matrix Matrix[D]) UnpackBitmapR(desc *Descriptor) (ab SystemSlice[bool], ax SystemSlice[D], iso bool, nvals int, err error)
- func (matrix Matrix[D]) UnpackBitmapRBytes(desc *Descriptor) (ab, ax SystemSlice[byte], iso bool, nvals int, err error)
- func (matrix Matrix[D]) UnpackCSC(allowJumbled bool, desc *Descriptor) (ap, ai SystemSlice[int], ax SystemSlice[D], iso, jumbled bool, err error)
- func (matrix Matrix[D]) UnpackCSCBytes(allowJumbled bool, desc *Descriptor) (ap, ai, ax SystemSlice[byte], iso, jumbled bool, err error)
- func (matrix Matrix[D]) UnpackCSR(allowJumbled bool, desc *Descriptor) (ap, aj SystemSlice[int], ax SystemSlice[D], iso, jumbled bool, err error)
- func (matrix Matrix[D]) UnpackCSRBytes(allowJumbled bool, desc *Descriptor) (ap, aj, ax SystemSlice[byte], iso, jumbled bool, err error)
- func (matrix Matrix[D]) UnpackFullC(desc *Descriptor) (ax SystemSlice[D], iso bool, err error)
- func (matrix Matrix[D]) UnpackFullCBytes(desc *Descriptor) (ax SystemSlice[byte], iso bool, err error)
- func (matrix Matrix[D]) UnpackFullR(desc *Descriptor) (ax SystemSlice[D], iso bool, err error)
- func (matrix Matrix[D]) UnpackFullRBytes(desc *Descriptor) (ax SystemSlice[byte], iso bool, err error)
- func (matrix Matrix[D]) UnpackHyperCSC(allowJumbled bool, desc *Descriptor) (ap, ah, ai SystemSlice[int], ax SystemSlice[D], iso bool, nvec int, ...)
- func (matrix Matrix[D]) UnpackHyperCSCBytes(allowJumbled bool, desc *Descriptor) (ap, ah, ai, ax SystemSlice[byte], iso bool, nvec int, jumbled bool, err error)
- func (matrix Matrix[D]) UnpackHyperCSR(allowJumbled bool, desc *Descriptor) (ap, ah, aj SystemSlice[int], ax SystemSlice[D], iso bool, nvec int, ...)
- func (matrix Matrix[D]) UnpackHyperCSRBytes(allowJumbled bool, desc *Descriptor) (ap, ah, aj, ax SystemSlice[byte], iso bool, nvec int, jumbled bool, err error)
- func (matrix Matrix[D]) UnpackHyperHash(desc *Descriptor) (hash Matrix[int], err error)
- func (matrix Matrix[D]) Valid() bool
- func (matrix Matrix[D]) Wait(mode WaitMode) error
- type MatrixMask
- type Mode
- type Monoid
- func AnyMonoid[D Number | Complex]() (m Monoid[D])
- func BandMonoid[D Unsigned]() (m Monoid[D])
- func BorMonoid[D Unsigned]() (m Monoid[D])
- func BxnorMonoid[D Unsigned]() (m Monoid[D])
- func BxorMonoid[D Unsigned]() (m Monoid[D])
- func MaxMonoid[D Number]() (m Monoid[D])
- func MinMonoid[D Number]() (m Monoid[D])
- func MonoidNew[D any](binaryOp BinaryOp[D, D, D], identity D) (monoid Monoid[D], err error)
- func MonoidTerminalNew[D any](binaryOp BinaryOp[D, D, D], identity, terminal D) (monoid Monoid[D], err error)
- func PlusMonoid[D Number | Complex]() (m Monoid[D])
- func TimesMonoid[D Number | Complex]() (m Monoid[D])
- func (monoid Monoid[D]) Err() (string, error)
- func (monoid *Monoid[D]) Free() error
- func (monoid Monoid[D]) Identity() (identity D, err error)
- func (monoid Monoid[D]) Operator() (binaryOp BinaryOp[D, D, D], err error)
- func (monoid Monoid[D]) Print(name string, pr PrintLevel) error
- func (monoid Monoid[D]) Terminal() (terminal D, ok bool, err error)
- func (monoid Monoid[D]) Valid() bool
- func (monoid Monoid[D]) Wait(mode WaitMode) error
- type Number
- type Predefined
- type PrintLevel
- type RowIterator
- func (it RowIterator) Err() (string, error)
- func (it *RowIterator) Free() error
- func (it RowIterator) Get() D
- func (it RowIterator[D]) GetColIndex() int
- func (it RowIterator[D]) GetRowIndex() int
- func (it RowIterator[D]) KSeek(k int) (ok, exhausted bool, err error)
- func (it RowIterator[D]) Kount() int
- func (it RowIterator[D]) NextCol() (ok bool, err error)
- func (it RowIterator[D]) NextRow() (ok, exhausted bool, err error)
- func (it RowIterator[D]) SeekRow(row int) (ok, exhausted bool, err error)
- func (it RowIterator) Valid() bool
- func (it RowIterator) Wait(WaitMode) error
- type Scalar
- func (scalar Scalar[D]) Clear() error
- func (scalar Scalar[D]) Dup() (dup Scalar[D], err error)
- func (scalar Scalar[D]) Err() (string, error)
- func (scalar Scalar[D]) ExtractElement() (result D, ok bool, err error)
- func (scalar *Scalar[D]) Free() error
- func (scalar Scalar[D]) MemoryUsage() (size int, err error)
- func (scalar Scalar[D]) Nvals() (nvals int, err error)
- func (scalar Scalar[D]) Print(name string, pr PrintLevel) error
- func (scalar Scalar[D]) SetElement(val D) error
- func (scalar Scalar[D]) Type() (typ Type, ok bool, err error)
- func (scalar Scalar[D]) Valid() bool
- func (scalar Scalar[D]) Wait(mode WaitMode) error
- type Semiring
- func AnyDiv[D Number | Complex]() (s Semiring[D, D, D])
- func AnyEq[D Predefined]() (s Semiring[bool, D, D])
- func AnyFirst[D Predefined | Complex]() (s Semiring[D, D, D])
- func AnyFirsti[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnyFirsti1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnyFirstj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnyFirstj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnyGe[D Predefined]() (s Semiring[bool, D, D])
- func AnyGt[D Predefined]() (s Semiring[bool, D, D])
- func AnyIseq[D Number]() (s Semiring[D, D, D])
- func AnyIsge[D Number]() (s Semiring[D, D, D])
- func AnyIsgt[D Number]() (s Semiring[D, D, D])
- func AnyIsle[D Number]() (s Semiring[D, D, D])
- func AnyIslt[D Number]() (s Semiring[D, D, D])
- func AnyIsne[D Number]() (s Semiring[D, D, D])
- func AnyLand[D Predefined]() (s Semiring[D, D, D])
- func AnyLe[D Predefined]() (s Semiring[bool, D, D])
- func AnyLor[D Predefined]() (s Semiring[D, D, D])
- func AnyLt[D Predefined]() (s Semiring[bool, D, D])
- func AnyLxor[D Predefined]() (s Semiring[D, D, D])
- func AnyMax[D Number]() (s Semiring[D, D, D])
- func AnyMin[D Number]() (s Semiring[D, D, D])
- func AnyMinus[D Number | Complex]() (s Semiring[D, D, D])
- func AnyNe[D Number]() (s Semiring[bool, D, D])
- func AnyOneb[D Predefined | Complex]() (s Semiring[D, D, D])
- func AnyPlus[D Number | Complex]() (s Semiring[D, D, D])
- func AnyRdiv[D Number | Complex]() (s Semiring[D, D, D])
- func AnyRminus[D Number | Complex]() (s Semiring[D, D, D])
- func AnySecond[D Predefined | Complex]() (s Semiring[D, D, D])
- func AnySecondi[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnySecondi1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnySecondj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnySecondj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func AnyTimes[D Number | Complex]() (s Semiring[D, D, D])
- func BandBand[D Unsigned]() (s Semiring[D, D, D])
- func BandBor[D Unsigned]() (s Semiring[D, D, D])
- func BandBxnor[D Unsigned]() (s Semiring[D, D, D])
- func BandBxor[D Unsigned]() (s Semiring[D, D, D])
- func BorBand[D Unsigned]() (s Semiring[D, D, D])
- func BorBor[D Unsigned]() (s Semiring[D, D, D])
- func BorBxnor[D Unsigned]() (s Semiring[D, D, D])
- func BorBxor[D Unsigned]() (s Semiring[D, D, D])
- func BxnorBand[D Unsigned]() (s Semiring[D, D, D])
- func BxnorBor[D Unsigned]() (s Semiring[D, D, D])
- func BxnorBxnor[D Unsigned]() (s Semiring[D, D, D])
- func BxnorBxor[D Unsigned]() (s Semiring[D, D, D])
- func BxorBand[D Unsigned]() (s Semiring[D, D, D])
- func BxorBor[D Unsigned]() (s Semiring[D, D, D])
- func BxorBxnor[D Unsigned]() (s Semiring[D, D, D])
- func BxorBxor[D Unsigned]() (s Semiring[D, D, D])
- func EqEq[D Number]() (s Semiring[bool, D, D])
- func EqGe[D Number]() (s Semiring[bool, D, D])
- func EqGt[D Number]() (s Semiring[bool, D, D])
- func EqLe[D Number]() (s Semiring[bool, D, D])
- func EqLt[D Number]() (s Semiring[bool, D, D])
- func EqNe[D Number]() (s Semiring[bool, D, D])
- func LandEq[D Number]() (s Semiring[bool, D, D])
- func LandGe[D Number]() (s Semiring[bool, D, D])
- func LandGt[D Number]() (s Semiring[bool, D, D])
- func LandLe[D Number]() (s Semiring[bool, D, D])
- func LandLt[D Number]() (s Semiring[bool, D, D])
- func LandNe[D Number]() (s Semiring[bool, D, D])
- func LorEq[D Number]() (s Semiring[bool, D, D])
- func LorGe[D Number]() (s Semiring[bool, D, D])
- func LorGt[D Number]() (s Semiring[bool, D, D])
- func LorLe[D Number]() (s Semiring[bool, D, D])
- func LorLt[D Number]() (s Semiring[bool, D, D])
- func LorNe[D Number]() (s Semiring[bool, D, D])
- func LxorEq[D Number]() (s Semiring[bool, D, D])
- func LxorGe[D Number]() (s Semiring[bool, D, D])
- func LxorGt[D Number]() (s Semiring[bool, D, D])
- func LxorLe[D Number]() (s Semiring[bool, D, D])
- func LxorLt[D Number]() (s Semiring[bool, D, D])
- func LxorNe[D Number]() (s Semiring[bool, D, D])
- func MaxDiv[D Number]() (s Semiring[D, D, D])
- func MaxFirstSemiring[D Number]() (s Semiring[D, D, D])
- func MaxFirsti[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxFirsti1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxFirstj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxFirstj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxIseq[D Number]() (s Semiring[D, D, D])
- func MaxIsge[D Number]() (s Semiring[D, D, D])
- func MaxIsgt[D Number]() (s Semiring[D, D, D])
- func MaxIsle[D Number]() (s Semiring[D, D, D])
- func MaxIslt[D Number]() (s Semiring[D, D, D])
- func MaxIsne[D Number]() (s Semiring[D, D, D])
- func MaxLand[D Number]() (s Semiring[D, D, D])
- func MaxLor[D Number]() (s Semiring[D, D, D])
- func MaxLxor[D Number]() (s Semiring[D, D, D])
- func MaxMax[D Number]() (s Semiring[D, D, D])
- func MaxMin[D Number]() (s Semiring[D, D, D])
- func MaxMinSemiring[D Number]() (s Semiring[D, D, D])
- func MaxMinus[D Number]() (s Semiring[D, D, D])
- func MaxOneb[D Number]() (s Semiring[D, D, D])
- func MaxPlus[D Number]() (s Semiring[D, D, D])
- func MaxPlusSemiring[D Number]() (s Semiring[D, D, D])
- func MaxRdiv[D Number]() (s Semiring[D, D, D])
- func MaxRminus[D Number]() (s Semiring[D, D, D])
- func MaxSecondSemiring[D Number]() (s Semiring[D, D, D])
- func MaxSecondi[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxSecondi1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxSecondj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxSecondj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MaxTimes[D Number]() (s Semiring[D, D, D])
- func MaxTimesSemiring[D Number]() (s Semiring[D, D, D])
- func MinDiv[D Number]() (s Semiring[D, D, D])
- func MinFirstSemiring[D Number]() (s Semiring[D, D, D])
- func MinFirsti[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinFirsti1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinFirstj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinFirstj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinIseq[D Number]() (s Semiring[D, D, D])
- func MinIsge[D Number]() (s Semiring[D, D, D])
- func MinIsgt[D Number]() (s Semiring[D, D, D])
- func MinIsle[D Number]() (s Semiring[D, D, D])
- func MinIslt[D Number]() (s Semiring[D, D, D])
- func MinIsne[D Number]() (s Semiring[D, D, D])
- func MinLand[D Number]() (s Semiring[D, D, D])
- func MinLor[D Number]() (s Semiring[D, D, D])
- func MinLxor[D Number]() (s Semiring[D, D, D])
- func MinMax[D Number]() (s Semiring[D, D, D])
- func MinMaxSemiring[D Number]() (s Semiring[D, D, D])
- func MinMin[D Number]() (s Semiring[D, D, D])
- func MinMinus[D Number]() (s Semiring[D, D, D])
- func MinOneb[D Number]() (s Semiring[D, D, D])
- func MinPlus[D Number]() (s Semiring[D, D, D])
- func MinPlusSemiring[D Number]() (s Semiring[D, D, D])
- func MinRdiv[D Number]() (s Semiring[D, D, D])
- func MinRminus[D Number]() (s Semiring[D, D, D])
- func MinSecondSemiring[D Number]() (s Semiring[D, D, D])
- func MinSecondi[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinSecondi1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinSecondj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinSecondj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func MinTimes[D Number]() (s Semiring[D, D, D])
- func MinTimesSemiring[D Number]() (s Semiring[D, D, D])
- func PlusDiv[D Number | Complex]() (s Semiring[D, D, D])
- func PlusFirst[D Number | Complex]() (s Semiring[D, D, D])
- func PlusFirsti[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusFirsti1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusFirstj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusFirstj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusIseq[D Number]() (s Semiring[D, D, D])
- func PlusIsge[D Number]() (s Semiring[D, D, D])
- func PlusIsgt[D Number]() (s Semiring[D, D, D])
- func PlusIsle[D Number]() (s Semiring[D, D, D])
- func PlusIslt[D Number]() (s Semiring[D, D, D])
- func PlusIsne[D Number]() (s Semiring[D, D, D])
- func PlusLand[D Number]() (s Semiring[D, D, D])
- func PlusLor[D Number]() (s Semiring[D, D, D])
- func PlusLxor[D Number]() (s Semiring[D, D, D])
- func PlusMax[D Number]() (s Semiring[D, D, D])
- func PlusMin[D Number]() (s Semiring[D, D, D])
- func PlusMinSemiring[D Number]() (s Semiring[D, D, D])
- func PlusMinus[D Number | Complex]() (s Semiring[D, D, D])
- func PlusOneb[D Number | Complex]() (s Semiring[D, D, D])
- func PlusPlus[D Number | Complex]() (s Semiring[D, D, D])
- func PlusRdiv[D Number | Complex]() (s Semiring[D, D, D])
- func PlusRminus[D Number | Complex]() (s Semiring[D, D, D])
- func PlusSecond[D Number | Complex]() (s Semiring[D, D, D])
- func PlusSecondi[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusSecondi1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusSecondj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusSecondj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func PlusTimes[D Number | Complex]() (s Semiring[D, D, D])
- func PlusTimesSemiring[D Number]() (s Semiring[D, D, D])
- func SemiringNew[Dout, Din1, Din2 any](addOp Monoid[Dout], mulOp BinaryOp[Dout, Din1, Din2]) (semiring Semiring[Dout, Din1, Din2], err error)
- func TimesDiv[D Number | Complex]() (s Semiring[D, D, D])
- func TimesFirst[D Number | Complex]() (s Semiring[D, D, D])
- func TimesFirsti[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesFirsti1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesFirstj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesFirstj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesIseq[D Number]() (s Semiring[D, D, D])
- func TimesIsge[D Number]() (s Semiring[D, D, D])
- func TimesIsgt[D Number]() (s Semiring[D, D, D])
- func TimesIsle[D Number]() (s Semiring[D, D, D])
- func TimesIslt[D Number]() (s Semiring[D, D, D])
- func TimesIsne[D Number]() (s Semiring[D, D, D])
- func TimesLand[D Number]() (s Semiring[D, D, D])
- func TimesLor[D Number]() (s Semiring[D, D, D])
- func TimesLxor[D Number]() (s Semiring[D, D, D])
- func TimesMax[D Number]() (s Semiring[D, D, D])
- func TimesMin[D Number]() (s Semiring[D, D, D])
- func TimesMinus[D Number | Complex]() (s Semiring[D, D, D])
- func TimesOneb[D Number | Complex]() (s Semiring[D, D, D])
- func TimesPlus[D Number | Complex]() (s Semiring[D, D, D])
- func TimesRdiv[D Number | Complex]() (s Semiring[D, D, D])
- func TimesRminus[D Number | Complex]() (s Semiring[D, D, D])
- func TimesSecond[D Number | Complex]() (s Semiring[D, D, D])
- func TimesSecondi[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesSecondi1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesSecondj[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesSecondj1[D int32 | int64 | int]() (s Semiring[D, D, D])
- func TimesTimes[D Number | Complex]() (s Semiring[D, D, D])
- func (semiring Semiring[Dout, Din1, Din2]) Add() (add Monoid[Dout], err error)
- func (semiring Semiring[Dout, Din1, Din2]) Err() (string, error)
- func (semiring *Semiring[Dout, Din1, Din2]) Free() error
- func (semiring Semiring[Dout, Din1, Din2]) Multiply() (multiply BinaryOp[Dout, Din1, Din2], err error)
- func (semiring Semiring[Dout, Din1, Din2]) Print(name string, pr PrintLevel) error
- func (semiring Semiring[Dout, Din1, Din2]) Valid() bool
- func (semiring Semiring[Dout, Din1, Din2]) Wait(mode WaitMode) error
- type Signed
- type Sparsity
- type SystemSlice
- type Type
- type UnaryFunction
- type UnaryOp
- func Abs[D Predefined | Complex]() (f UnaryOp[D, D])
- func Acos[D Float | Complex]() (f UnaryOp[D, D])
- func Acosh[D Float | Complex]() (f UnaryOp[D, D])
- func Ainv[D Predefined | Complex]() (f UnaryOp[D, D])
- func Asin[D Float | Complex]() (f UnaryOp[D, D])
- func Asinh[D Float | Complex]() (f UnaryOp[D, D])
- func Atan[D Float | Complex]() (f UnaryOp[D, D])
- func Atanh[D Float | Complex]() (f UnaryOp[D, D])
- func Bnot[D Integer]() (f UnaryOp[D, D])
- func Carg[D Complex]() (f UnaryOp[D, D])
- func Cbrt[D Float]() (f UnaryOp[D, D])
- func Ceil[D Float | Complex]() (f UnaryOp[D, D])
- func Cimag[D Complex]() (f UnaryOp[D, D])
- func Conj[D Complex]() (f UnaryOp[D, D])
- func Cos[D Float | Complex]() (f UnaryOp[D, D])
- func Cosh[D Float | Complex]() (f UnaryOp[D, D])
- func Creal[D Complex]() (f UnaryOp[D, D])
- func Erf[D Float]() (f UnaryOp[D, D])
- func Erfc[D Float]() (f UnaryOp[D, D])
- func Exp[D Float | Complex]() (f UnaryOp[D, D])
- func Exp2[D Float | Complex]() (f UnaryOp[D, D])
- func Expm1[D Float | Complex]() (f UnaryOp[D, D])
- func Floor[D Float | Complex]() (f UnaryOp[D, D])
- func Frexpe[D Float]() (f UnaryOp[D, D])
- func Frexpx[D Float]() (f UnaryOp[D, D])
- func Identity[D Predefined | Complex]() (f UnaryOp[D, D])
- func Isfinite[D Float | Complex]() (f UnaryOp[bool, D])
- func Isinf[D Float | Complex]() (f UnaryOp[bool, D])
- func Isnan[D Float | Complex]() (f UnaryOp[bool, D])
- func Lgamma[D Float]() (f UnaryOp[D, D])
- func Lnot[D Predefined]() (f UnaryOp[D, D])
- func Log[D Float | Complex]() (f UnaryOp[D, D])
- func Log10[D Float | Complex]() (f UnaryOp[D, D])
- func Log1p[D Float | Complex]() (f UnaryOp[D, D])
- func Log2[D Float | Complex]() (f UnaryOp[D, D])
- func Minv[D Predefined | Complex]() (f UnaryOp[D, D])
- func NamedUnaryOpNew[Dout, Din any](unaryFunc UnaryFunction, unopname string, unopdefn string) (unaryOp UnaryOp[Dout, Din], err error)
- func One[D Predefined | Complex]() (f UnaryOp[D, D])
- func Positioni[D int32 | int64 | int, Din any]() (f UnaryOp[D, Din])
- func Positioni1[D int32 | int64 | int, Din any]() (f UnaryOp[D, Din])
- func Positionj[D int32 | int64 | int, Din any]() (f UnaryOp[D, Din])
- func Positionj1[D int32 | int64 | int, Din any]() (f UnaryOp[D, Din])
- func Round[D Float | Complex]() (f UnaryOp[D, D])
- func Signum[D Float | Complex]() (f UnaryOp[D, D])
- func Sin[D Float | Complex]() (f UnaryOp[D, D])
- func Sinh[D Float | Complex]() (f UnaryOp[D, D])
- func Sqrt[D Float | Complex]() (f UnaryOp[D, D])
- func Tan[D Float | Complex]() (f UnaryOp[D, D])
- func Tanh[D Float | Complex]() (f UnaryOp[D, D])
- func Tgamma[D Float]() (f UnaryOp[D, D])
- func Trunc[D Float | Complex]() (f UnaryOp[D, D])
- func UnaryOpNew[Dout, Din any](unaryFunc UnaryFunction) (unaryOp UnaryOp[Dout, Din], err error)
- type Unsigned
- type UserCallocFunction
- type UserFreeFunction
- type UserMallocFunction
- type UserReallocFunction
- type Vector
- func (vector Vector[D]) AsMask() *Vector[bool]
- func (vector Vector[D]) Build(indices []int, values []D, dup *BinaryOp[D, D, D]) error
- func (vector Vector[D]) BuildScalar(indices []int, scalar Scalar[D]) error
- func (vector Vector[D]) Clear() error
- func (vector Vector[D]) Diag(k int) (diag Matrix[D], err error)
- func (vector Vector[D]) Dup() (dup Vector[D], err error)
- func (vector Vector[D]) Err() (string, error)
- func (vector Vector[D]) ExtractDiag(a Matrix[D], k int, desc *Descriptor) error
- func (vector Vector[D]) ExtractElement(index int) (result D, ok bool, err error)
- func (vector Vector[D]) ExtractElementScalar(result Scalar[D], index int) error
- func (vector Vector[D]) ExtractTuples(indices *[]int, values *[]D) error
- func (vector *Vector[D]) Free() error
- func (vector Vector[D]) GetBitmapSwitch() (bitmapSwitch float64, err error)
- func (vector Vector[D]) GetSparsityControl() (sparsity Sparsity, err error)
- func (vector Vector[D]) GetSparsityStatus() (status Sparsity, err error)
- func (vector Vector[D]) IsStoredElement(index int) (ok bool, err error)
- func (vector Vector[D]) Iso() (iso bool, err error)
- func (vector Vector[D]) IteratorNew(desc *Descriptor) (it VectorIterator[D], err error)
- func (vector Vector[D]) MemoryUsage() (size int, err error)
- func (vector Vector[D]) Nvals() (nvals int, err error)
- func (vector Vector[D]) PackBitmap(vb *SystemSlice[bool], vx *SystemSlice[D], iso bool, nvals int, ...) error
- func (vector Vector[D]) PackBitmapBytes(vb, vx *SystemSlice[byte], iso bool, nvals int, desc *Descriptor) error
- func (vector Vector[D]) PackCSC(vi *SystemSlice[int], vx *SystemSlice[D], iso bool, nvals int, jumbled bool, ...) error
- func (vector Vector[D]) PackCSCBytes(vi, vx *SystemSlice[byte], iso bool, nvals int, jumbled bool, desc *Descriptor) error
- func (vector Vector[D]) PackFull(vx *SystemSlice[D], iso bool, desc *Descriptor) error
- func (vector Vector[D]) PackFullBytes(vx *SystemSlice[byte], iso bool, desc *Descriptor) error
- func (vector Vector[D]) Print(name string, pr PrintLevel) error
- func (vector Vector[D]) RemoveElement(index int) error
- func (vector Vector[D]) Resize(size int) error
- func (vector Vector[D]) SetBitmapSwitch(bitmapSwitch float64) error
- func (vector Vector[D]) SetElement(val D, index int) error
- func (vector Vector[D]) SetElementScalar(val Scalar[D], index int) error
- func (vector Vector[D]) SetSparsityControl(sparsity Sparsity) error
- func (vector Vector[D]) Size() (size int, err error)
- func (vector Vector[D]) Sort(into *Vector[D], p *Vector[int], op BinaryOp[bool, D, D], desc *Descriptor) error
- func (vector Vector[D]) Type() (typ Type, ok bool, err error)
- func (vector Vector[D]) UnpackBitmap(desc *Descriptor) (vb SystemSlice[bool], vx SystemSlice[D], iso bool, nvals int, err error)
- func (vector Vector[D]) UnpackBitmapBytes(desc *Descriptor) (vb, vx SystemSlice[byte], iso bool, nvals int, err error)
- func (vector Vector[D]) UnpackCSC(allowJumbled bool, desc *Descriptor) (vi SystemSlice[int], vx SystemSlice[D], iso bool, nvals int, jumbled bool, ...)
- func (vector Vector[D]) UnpackCSCBytes(allowJumbled bool, desc *Descriptor) (vi, vx SystemSlice[byte], iso bool, nvals int, jumbled bool, err error)
- func (vector Vector[D]) UnpackFull(desc *Descriptor) (vx SystemSlice[D], iso bool, err error)
- func (vector Vector[D]) UnpackFullBytes(desc *Descriptor) (vx SystemSlice[byte], iso bool, err error)
- func (vector Vector[D]) Valid() bool
- func (vector Vector[D]) Wait(mode WaitMode) error
- type VectorIterator
- func (it VectorIterator) Err() (string, error)
- func (it *VectorIterator) Free() error
- func (it VectorIterator) Get() D
- func (it VectorIterator[D]) GetIndex() int
- func (it VectorIterator[D]) Getp() int
- func (it VectorIterator[D]) Getpmax() int
- func (it VectorIterator[D]) Next() (ok bool, err error)
- func (it VectorIterator[D]) Seek(p int) (ok bool, err error)
- func (it VectorIterator) Valid() bool
- func (it VectorIterator) Wait(WaitMode) error
- type VectorMask
- type WaitMode
Examples ¶
Constants ¶
const ( SuiteSparseImplementationName = C.GxB_IMPLEMENTATION_NAME SuiteSparseImplementationDate = C.GxB_IMPLEMENTATION_DATE SuiteSparseImplementationMajor = C.GxB_IMPLEMENTATION_MAJOR SuiteSparseImplementationMinor = C.GxB_IMPLEMENTATION_MINOR SuiteSparseImplementationSub = C.GxB_IMPLEMENTATION_SUB SuiteSparseImplementation = C.GxB_IMPLEMENTATION SuiteSparseImplementationAbout = C.GxB_IMPLEMENTATION_ABOUT SuiteSparseImplementationLicense = C.GxB_IMPLEMENTATION_LICENSE )
SuiteSparse:GraphBLAS extensions
const ( ImplementationName = "Intel® Generic Implementation of GraphBLAS* for Go*" ImplementationDate = "March 1, 2023" ImplementationMajor = 0 ImplementationMinor = 0 ImplementationSub = 0 Implementation = (ImplementationMajor*1000+ImplementationMinor)*1000 + ImplementationSub ImplementationAbout = "Intel® Generic Implementation of GraphBLAS* for Go*. Copyright © 2022-2023, Intel Corporation. All rights reserved." ImplementationLicense = "BSD 3-Clause License" )
forGraphBLASGo extensions
const ( SpecDate = C.GxB_SPEC_DATE SpecMajor = C.GxB_SPEC_MAJOR SpecMinor = C.GxB_SPEC_MINOR SpecSub = C.GxB_SPEC_SUB SpecVersion = (SpecMajor*1000+SpecMinor)*1000 + SpecSub SpecAbout = C.GxB_SPEC_ABOUT )
SuiteSparse:GraphBLAS extensions
const ( Version = C.GRB_VERSION Subversion = C.GRB_SUBVERSION )
Spec version
const IndexMax = 1<<60 - 1
IndexMax is the permissible maximum value for Index.
const MaxNameLen = 127
MaxNameLen is the maximum length for strings naming types.
In C, a null byte has to be added to the end of a string, so this constant is one smaller than the corresponding GxB_MAX_NAME_LEN in SuiteSparse:GraphBLAS.
MaxNameLen is a SuiteSparse:GraphBLAS extension.
const NBitmapSwitch = 8
NBitmapSwitch is the number of float64 values for the global bitmap switch setting. See GlobalSetBitmapSwitch and GlobalGetBitmapSwitch.
NBitmapSwitch is a SuiteSparse:GraphBLAS extension.
Variables ¶
var ( // LorBool is f(x, y) = (x != 0) || (y != 0) LorBool = BinaryOp[bool, bool, bool]{C.GrB_LOR} // LandBool is f(x, y) = (x != 0) && (y != 0) LandBool = BinaryOp[bool, bool, bool]{C.GrB_LAND} // LxorBool is f(x, y) = (x != 0) != (y != 0) LxorBool = BinaryOp[bool, bool, bool]{C.GrB_LXOR} // LxnorBool is f(x, y) = (x != 0) == (y != 0) LxnorBool = BinaryOp[bool, bool, bool]{C.GrB_LXNOR} )
var ( DescT1 = &Descriptor{C.GrB_DESC_T1} DescT0 = &Descriptor{C.GrB_DESC_T0} DescT0T1 = &Descriptor{C.GrB_DESC_T0T1} DescC = &Descriptor{C.GrB_DESC_C} DescS = &Descriptor{C.GrB_DESC_S} DescCT1 = &Descriptor{C.GrB_DESC_CT1} DescST1 = &Descriptor{C.GrB_DESC_ST1} DescCT0 = &Descriptor{C.GrB_DESC_CT0} DescST0 = &Descriptor{C.GrB_DESC_ST0} DescCT0T1 = &Descriptor{C.GrB_DESC_CT0T1} DescST0T1 = &Descriptor{C.GrB_DESC_ST0T1} DescSC = &Descriptor{C.GrB_DESC_SC} DescSCT1 = &Descriptor{C.GrB_DESC_SCT1} DescSCT0 = &Descriptor{C.GrB_DESC_SCT0} DescSCT0T1 = &Descriptor{C.GrB_DESC_SCT0T1} DescR = &Descriptor{C.GrB_DESC_R} DescRT1 = &Descriptor{C.GrB_DESC_RT1} DescRT0 = &Descriptor{C.GrB_DESC_RT0} DescRT0T1 = &Descriptor{C.GrB_DESC_RT0T1} DescRC = &Descriptor{C.GrB_DESC_RC} DescRS = &Descriptor{C.GrB_DESC_RS} DescRCT1 = &Descriptor{C.GrB_DESC_RCT1} DescRST1 = &Descriptor{C.GrB_DESC_RST1} DescRCT0 = &Descriptor{C.GrB_DESC_RCT0} DescRST0 = &Descriptor{C.GrB_DESC_RST0} DescRCT0T1 = &Descriptor{C.GrB_DESC_RCT0T1} DescRST0T1 = &Descriptor{C.GrB_DESC_RST0T1} DescRSC = &Descriptor{C.GrB_DESC_RSC} DescRSCT1 = &Descriptor{C.GrB_DESC_RSCT1} DescRSCT0 = &Descriptor{C.GrB_DESC_RSCT0} DescRSCT0T1 = &Descriptor{C.GrB_DESC_RSCT0T1} )
Predefined GraphBLAS descriptors. The list includes all possible descriptors, according to the current GraphBLAS standard (without SuiteSparse:GraphBLAS-specific extensions).
nil is also a valid descriptor value, indicating default behavior.
var ( // UninitializedObject indicates that a GraphBLAS object is passed to a function before it was properly // initialized by a call to [BinaryOpNew], [ContextNew], [DescriptorNew], [IndexUnaryOpNew], // [Matrix.ColIteratorNew], [Matrix.Dup], [Matrix.IteratorNew], [Matrix.ReshapeDup], [Matrix.RowIteratorNew], // [MatrixDeserialize], [MatrixImport], [MatrixNew], [MonoidNew], [MonoidTerminalNew], [NamedBinaryOpNew], // [NamedIndexUnaryOpNew], [NamedTypeNew], [NamedUnaryOpNew], [Scalar.Dup], [ScalarNew], [SemiringNew], [TypeNew], // [UnaryOpNew], [Vector.Diag], [Vector.Dup], [Vector.IteratorNew], or [VectorNew]. UninitializedObject = Info(C.GrB_UNINITIALIZED_OBJECT) // NullPointer indicates that a nil is passed for a pointer parameter. NullPointer = Info(C.GrB_NULL_POINTER) // InvalidValue indicates that an invalid value is passed as a parameter (for example, a value that is not // one of the predefined values of an enumeration type, or an index that is <= 0 or > [IndexMax]). InvalidValue = Info(C.GrB_INVALID_VALUE) // InvalidIndex indicates that one or more (single) index is passed to a function that is outside of // the dimensions of the corresponding vector or matrix. InvalidIndex = Info(C.GrB_INVALID_INDEX) // DomainMismatch indicates that the domains of the various input and/or output scalars, vectors and matrices // are incompatible with each other and/or with the provided accumulation or other operators; or that // the mask's domain is not compatible with bool (in the case where the [Structure] descriptor is not // set for the mask). DomainMismatch = Info(C.GrB_DOMAIN_MISMATCH) // DimensionMismatch indicates that the dimensions of input and/or output vectors, matrices or masks // are incompatible. DimensionMismatch = Info(C.GrB_DIMENSION_MISMATCH) // OutputNotEmpty indicates that the output vector or matrix already contains valid tuples (elements). // In other words, [Vector.Nvals] or [Matrix.Nvals] returns a positive value. OutputNotEmpty = Info(C.GrB_OUTPUT_NOT_EMPTY) // NotImplemented indicates that an attempt was made to call a GraphBLAS function for a combination of // input parameters that is not supported by a particular implementation. NotImplemented = Info(C.GrB_NOT_IMPLEMENTED) // SliceMismatch indicates that the lengths of different input slices that should be the same do not match. // SliceMismatch is a forGraphBLASGo extension. SliceMismatch = Info(-201) )
GraphBLAS API errors that may be returned by GraphBLAS operations.
var ( // Panic indicates an unknown internal error. Panic = Info(C.GrB_PANIC) // OutOfMemory indicates that not enough memory is available for an operation. OutOfMemory = Info(C.GrB_OUT_OF_MEMORY) // InsufficientSpace indicates that the slice provided is not large enough to hold output. InsufficientSpace = Info(C.GrB_INSUFFICIENT_SPACE) // InvalidObject indicates that one of the opaque GraphBLAS objects (input or output) is in an invalid state // caused by a previous execution error. Call the Err methods on these GraphBLAS objects to access any error // messages generated by the implementation. InvalidObject = Info(C.GrB_INVALID_OBJECT) // IndexOutOfBounds indicates that a value in one or more of the input index slices is less than 0 // or greater than the corresponding dimension of the output vector or matrix. In non-blocking mode, // this may be reported by call to a Wait method. IndexOutOfBounds = Info(C.GrB_INDEX_OUT_OF_BOUNDS) // EmptyObject indicates that the [Scalar] object used in the call is empty (nvals = 0) and therefore // a value cannot be passed to the provided operator. EmptyObject = Info(C.GrB_EMPTY_OBJECT) )
GraphBLAS execution errors that may cause a panic.
var ( // LorMonoidBool is logical or with identity false LorMonoidBool = Monoid[bool]{C.GrB_LOR_MONOID_BOOL} // LandMonoidBool is logical and with identity true LandMonoidBool = Monoid[bool]{C.GrB_LAND_MONOID_BOOL} // LxorMonoidBool is logical xor (not equal) with identity false LxorMonoidBool = Monoid[bool]{C.GrB_LXOR_MONOID_BOOL} // LxnorMonoidBool is logical xnor (equal) with identity true LxnorMonoidBool = Monoid[bool]{C.GrB_LXNOR_MONOID_BOOL} )
var ( LayoutDefault = Layout(C.GxB_FORMAT_DEFAULT) // The default is by row. HyperDefault = float64(C.GxB_HYPER_DEFAULT) )
SuiteSparse:GraphBLAS extensions
var ( AlwaysHyper = float64(C.GxB_ALWAYS_HYPER) NeverHyper = float64(C.GxB_NEVER_HYPER) )
Values for hyper switch settings.
SuiteSparse:GraphBLAS extensions
var ( // LorLandSemiringBool with additive [Monoid] [LorMonoidBool] and [BinaryOp] [LandBool]. LorLandSemiringBool = Semiring[bool, bool, bool]{C.GrB_LOR_LAND_SEMIRING_BOOL} // LandLorSemiringBool with additive [Monoid] [LandMonoidBool] and [BinaryOp] [LorBool]. LandLorSemiringBool = Semiring[bool, bool, bool]{C.GrB_LAND_LOR_SEMIRING_BOOL} // LxorLandSemiringBool with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [LandBool]. LxorLandSemiringBool = Semiring[bool, bool, bool]{C.GrB_LXOR_LAND_SEMIRING_BOOL} // LxnorLorSemiringBool with additive [Monoid] [LxnorMonoidBool] and [BinaryOp] [LorBool]. LxnorLorSemiringBool = Semiring[bool, bool, bool]{C.GrB_LXNOR_LOR_SEMIRING_BOOL} )
var ( // LorFirstBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [First]. // // LorFirstBool is a SuiteSparse:GraphBLAS extension. LorFirstBool = Semiring[bool, bool, bool]{C.GxB_LOR_FIRST_BOOL} // LandFirstBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [First]. // // LandFirstBool is a SuiteSparse:GraphBLAS extension. LandFirstBool = Semiring[bool, bool, bool]{C.GxB_LAND_FIRST_BOOL} // LxorFirstBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [First]. // // LxorFirstBool is a SuiteSparse:GraphBLAS extension. LxorFirstBool = Semiring[bool, bool, bool]{C.GxB_LXOR_FIRST_BOOL} // EqFirstBool semiring with additive [Monoid] [Eq] and [BinaryOp] [First]. // // EqFirstBool is a SuiteSparse:GraphBLAS extension. EqFirstBool = Semiring[bool, bool, bool]{C.GxB_EQ_FIRST_BOOL} // LorSecondBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Second]. // // LorSecondBool is a SuiteSparse:GraphBLAS extension. LorSecondBool = Semiring[bool, bool, bool]{C.GxB_LOR_SECOND_BOOL} // LandSecondBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Second]. // // LandSecondBool is a SuiteSparse:GraphBLAS extension. LandSecondBool = Semiring[bool, bool, bool]{C.GxB_LAND_SECOND_BOOL} // LxorSecondBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Second]. // // LxorSecondBool is a SuiteSparse:GraphBLAS extension. LxorSecondBool = Semiring[bool, bool, bool]{C.GxB_LXOR_SECOND_BOOL} // EqSecondBool semiring with additive [Monoid] [Eq] and [BinaryOp] [Second]. // // EqSecondBool is a SuiteSparse:GraphBLAS extension. EqSecondBool = Semiring[bool, bool, bool]{C.GxB_EQ_SECOND_BOOL} // LorOnebBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Oneb]. // // LorOnebBool is a SuiteSparse:GraphBLAS extension. LorOnebBool = Semiring[bool, bool, bool]{C.GxB_LOR_PAIR_BOOL} // LandOnebBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Oneb]. // // LandOnebBool is a SuiteSparse:GraphBLAS extension. LandOnebBool = Semiring[bool, bool, bool]{C.GxB_LAND_PAIR_BOOL} // LxorOnebBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Oneb]. // // LxorOnebBool is a SuiteSparse:GraphBLAS extension. LxorOnebBool = Semiring[bool, bool, bool]{C.GxB_LXOR_PAIR_BOOL} // EqOnebBool semiring with additive [Monoid] [EqMonoidBool] and [BinaryOp] [Oneb]. // // EqOnebBool is a SuiteSparse:GraphBLAS extension. EqOnebBool = Semiring[bool, bool, bool]{C.GxB_EQ_PAIR_BOOL} // LorLorBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [LorBool]. // // LorLorBool is a SuiteSparse:GraphBLAS extension. LorLorBool = Semiring[bool, bool, bool]{C.GxB_LOR_LOR_BOOL} // LandLorBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [LorBool]. // // LandLorBool is a SuiteSparse:GraphBLAS extension. LandLorBool = Semiring[bool, bool, bool]{C.GxB_LAND_LOR_BOOL} // LxorLorBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [LorBool]. // // LxorLorBool is a SuiteSparse:GraphBLAS extension. LxorLorBool = Semiring[bool, bool, bool]{C.GxB_LXOR_LOR_BOOL} // EqLorBool semiring with additive [Monoid] [Eq] and [BinaryOp] [LorBool]. // // EqLorBool is a SuiteSparse:GraphBLAS extension. EqLorBool = Semiring[bool, bool, bool]{C.GxB_EQ_LOR_BOOL} // LorLandBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [LandBool]. // // LorLandBool is a SuiteSparse:GraphBLAS extension. LorLandBool = Semiring[bool, bool, bool]{C.GxB_LOR_LAND_BOOL} // LandLandBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [LandBool]. // // LandLandBool is a SuiteSparse:GraphBLAS extension. LandLandBool = Semiring[bool, bool, bool]{C.GxB_LAND_LAND_BOOL} // LxorLandBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [LandBool]. // // LxorLandBool is a SuiteSparse:GraphBLAS extension. LxorLandBool = Semiring[bool, bool, bool]{C.GxB_LXOR_LAND_BOOL} // EqLandBool semiring with additive [Monoid] [Eq] and [BinaryOp] [LandBool]. // // EqLandBool is a SuiteSparse:GraphBLAS extension. EqLandBool = Semiring[bool, bool, bool]{C.GxB_EQ_LAND_BOOL} // LorLxorBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [LxorBool]. // // LorLxorBool is a SuiteSparse:GraphBLAS extension. LorLxorBool = Semiring[bool, bool, bool]{C.GxB_LOR_LXOR_BOOL} // LandLxorBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [LxorBool]. // // LandLxorBool is a SuiteSparse:GraphBLAS extension. LandLxorBool = Semiring[bool, bool, bool]{C.GxB_LAND_LXOR_BOOL} // LxorLxorBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [LxorBool]. // // LxorLxorBool is a SuiteSparse:GraphBLAS extension. LxorLxorBool = Semiring[bool, bool, bool]{C.GxB_LXOR_LXOR_BOOL} // EqLxorBool semiring with additive [Monoid] [Eq] and [BinaryOp] [LxorBool]. // // EqLxorBool is a SuiteSparse:GraphBLAS extension. EqLxorBool = Semiring[bool, bool, bool]{C.GxB_EQ_LXOR_BOOL} // LorEqBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Eq]. // // LorEqBool is a SuiteSparse:GraphBLAS extension. LorEqBool = Semiring[bool, bool, bool]{C.GxB_LOR_EQ_BOOL} // LandEqBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Eq]. // // LandEqBool is a SuiteSparse:GraphBLAS extension. LandEqBool = Semiring[bool, bool, bool]{C.GxB_LAND_EQ_BOOL} // LxorEqBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Eq]. // // LxorEqBool is a SuiteSparse:GraphBLAS extension. LxorEqBool = Semiring[bool, bool, bool]{C.GxB_LXOR_EQ_BOOL} // EqEqBool semiring with additive [Monoid] [Eq] and [BinaryOp] [Eq]. // // EqEqBool is a SuiteSparse:GraphBLAS extension. EqEqBool = Semiring[bool, bool, bool]{C.GxB_EQ_EQ_BOOL} // LorGtBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Gt]. // // LorGtBool is a SuiteSparse:GraphBLAS extension. LorGtBool = Semiring[bool, bool, bool]{C.GxB_LOR_GT_BOOL} // LandGtBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Gt]. // // LandGtBool is a SuiteSparse:GraphBLAS extension. LandGtBool = Semiring[bool, bool, bool]{C.GxB_LAND_GT_BOOL} // LxorGtBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Gt]. // // LxorGtBool is a SuiteSparse:GraphBLAS extension. LxorGtBool = Semiring[bool, bool, bool]{C.GxB_LXOR_GT_BOOL} // EqGtBool semiring with additive [Monoid] [EqMonoidBool] and [BinaryOp] [Gt]. // // EqGtBool is a SuiteSparse:GraphBLAS extension. EqGtBool = Semiring[bool, bool, bool]{C.GxB_EQ_GT_BOOL} // LorLtBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Lt]. // // LorLtBool is a SuiteSparse:GraphBLAS extension. LorLtBool = Semiring[bool, bool, bool]{C.GxB_LOR_LT_BOOL} // LandLtBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Lt]. // // LandLtBool is a SuiteSparse:GraphBLAS extension. LandLtBool = Semiring[bool, bool, bool]{C.GxB_LAND_LT_BOOL} // LxorLtBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Lt]. // // LxorLtBool is a SuiteSparse:GraphBLAS extension. LxorLtBool = Semiring[bool, bool, bool]{C.GxB_LXOR_LT_BOOL} // EqLtBool semiring with additive [Monoid] [Eq] and [BinaryOp] [Lt]. // // EqLtBool is a SuiteSparse:GraphBLAS extension. EqLtBool = Semiring[bool, bool, bool]{C.GxB_EQ_LT_BOOL} // LorGeBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Ge]. // // LorGeBool is a SuiteSparse:GraphBLAS extension. LorGeBool = Semiring[bool, bool, bool]{C.GxB_LOR_GE_BOOL} // LandGeBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Ge]. // // LandGeBool is a SuiteSparse:GraphBLAS extension. LandGeBool = Semiring[bool, bool, bool]{C.GxB_LAND_GE_BOOL} // LxorGeBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Ge]. // // LxorGeBool is a SuiteSparse:GraphBLAS extension. LxorGeBool = Semiring[bool, bool, bool]{C.GxB_LXOR_GE_BOOL} // EqGeBool semiring with additive [Monoid] [Eq] and [BinaryOp] [Ge]. // // EqGeBool is a SuiteSparse:GraphBLAS extension. EqGeBool = Semiring[bool, bool, bool]{C.GxB_EQ_GE_BOOL} // LorLeBool semiring with additive [Monoid] [LorMonoidBool] and [BinaryOp] [Le]. // // LorLeBool is a SuiteSparse:GraphBLAS extension. LorLeBool = Semiring[bool, bool, bool]{C.GxB_LOR_LE_BOOL} // LandLeBool semiring with additive [Monoid] [LandMonoidBool] and [BinaryOp] [Le]. // // LandLeBool is a SuiteSparse:GraphBLAS extension. LandLeBool = Semiring[bool, bool, bool]{C.GxB_LAND_LE_BOOL} // LxorLeBool semiring with additive [Monoid] [LxorMonoidBool] and [BinaryOp] [Le]. // // LxorLeBool is a SuiteSparse:GraphBLAS extension. LxorLeBool = Semiring[bool, bool, bool]{C.GxB_LXOR_LE_BOOL} // EqLeBool semiring with additive [Monoid] [Eq] and [BinaryOp] [Le]. // // EqLeBool is a SuiteSparse:GraphBLAS extension. EqLeBool = Semiring[bool, bool, bool]{C.GxB_EQ_LE_BOOL} )
var ( Bool = TypeOf(false) Int = TypeOf(int(0)) Int8 = TypeOf(int8(0)) Int16 = TypeOf(int16(0)) Int32 = TypeOf(int32(0)) Int64 = TypeOf(int64(0)) Uint = TypeOf(uint(0)) Uint8 = TypeOf(uint8(0)) Uint16 = TypeOf(uint16(0)) Uint32 = TypeOf(uint32(0)) Uint64 = TypeOf(uint64(0)) Float32 = TypeOf(float32(0)) Float64 = TypeOf(float64(0)) Complex64 = TypeOf(complex64(0)) // a SuiteSparse:GraphBLAS extension Complex128 = TypeOf(complex128(0)) // a SuiteSparse:GraphBLAS extension )
Predefined GraphBLAS types (domains).
var ContextWorld = Context{ C.GxB_CONTEXT_WORLD, }
ContextWorld is the default Context object. It can be modified with Context.SetNThreads and Context.SetChunk.
ContextWorld is a SuiteSparse:GraphBLAS extension.
LnotBool is f(x) = !x
Functions ¶
func All ¶
All is used in various GraphBLAS functions to indicate that all indices in the range 0 <= index < size are to be used. This representation uses significantly less memory than enumerating the corresponding indices explicitly, and is also handled more efficiently by the underlying GraphBLAS implementation in C.
func Backwards ¶
Backwards is like Stride, except that begin > end, and inc is used as a decrement. For example, Stride(10, 3, 2) corresponds to the slice []int{10, 8, 6, 4}. The resulting indices are in the range begin >= index > end. This representation uses significantly less memory than enumerating the corresponding indices explicitly, and is also handled more efficiently by the underlying SuiteSparse:GraphBLAS implementation.
Backwards is a SuiteSparse:GraphBLAS extension.
func CheckErrors ¶
func CheckErrors(err *error)
CheckErrors recovers a potential error handled by OK and assigns it to *err, unless *err != nil. Use CheckError with defer.
OK panics on errors != nil, but CheckError only recovers errors handled by OK. CheckError will panic again on any other panics.
Example:
func Example(...) (err error) { defer GrB.CheckError(&err) ... GrB.OK(GrB.SomeOperation(...)) ... }
CheckErrors is a forGraphBLASGo extension.
func ContextDisengage ¶
ContextDisengage disengages the given context from the current thread.
If context is nil, or if it points to ContextWorld, then any Context for the current thread is disengaged. If a valid non-nil Context is provided, and it matches the current Context for this user thread, it is disengaged. In all of these cases, nil is returned.
If a non-nil Context is provided on input that does not match the current Context for this thread, then InvalidValue is returned. In that case, the current Context for this user thread is unmodified.
Please also read the caution sections in Context.Engage carefully.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
ContextDisengage is a SuiteSparse:GraphBLAS extension.
func Finalize ¶
func Finalize() error
Finalize terminates and frees any internal resources created to support the GraphBLAS API context. Finalize may only be called after a context has been initialized by calling Init or InitWithMalloc, or else undefined behavior occurs. After Finalize has been called to finalize a GraphBLAS context, calls to any GraphBLAS functions, including Finalize, will result in undefined behavior.
GraphBLAS execution errors that may cause a panic:
func GetVersion ¶
func GetVersion() (version, subversion int)
GetVersion is used to query the major and minor version number of the GraphBLAS API specification that the library implements at runtime. The following two constants are also defined by the library:
- Version: 2
- Subversion: 0
Return Values:
- version: Major version number.
- subversion: subversion number.
func GlobalGetBitmapSwitch ¶
func GlobalGetBitmapSwitch() (bitmapSwitch [NBitmapSwitch]float64, err error)
GlobalGetBitmapSwitch retrieves the current global switch to bitmap. See GlobalSetBitmapSwitch.
GlobalGetBitmapSwitch is a SuiteSparse:GraphBLAS extension.
func GlobalGetBurble ¶
GlobalGetBurble retrieves whether the burble is currently enabled disabled. See GlobalSetBurble.
GlobalGetBurble is a SuiteSparse:GraphBLAS extension.
func GlobalGetChunk ¶
GlobalGetChunk retrieves the current global chunk value. See GlobalSetChunk.
GlobalGetChunk is a SuiteSparse:GraphBLAS extension.
func GlobalGetHyperSwitch ¶
GlobalGetHyperSwitch retrieves the current global switch to hypersparse. See GlobalSetHyperSwitch.
GlobalGetHyperSwitch is a SuiteSparse:GraphBLAS extension.
func GlobalGetJITCCompilerFlags ¶
GlobalGetJITCCompilerFlags retrieves the flags for the C compiler used for JIT kernels.
GlobalGetJITCCompilerFlags is a SuiteSparse:GraphBLAS extension.
func GlobalGetJITCCompilerName ¶
GlobalGetJITCCompilerName retrieves the name of the C compiler used for JIT kernels.
GlobalGetJITCCompilerName is a SuiteSparse:GraphBLAS extension.
func GlobalGetJITCLibraries ¶
GlobalGetJITCLibraries retrieves the libraries to link against for the C linker used for JIT kernels.
GlobalGetJITCLibraries is a SuiteSparse:GraphBLAS extension.
func GlobalGetJITCLinkerFlags ¶
GlobalGetJITCLinkerFlags retrieves the flags for the C linker used for JIT kernels.
GlobalGetJITCLinkerFlags is a SuiteSparse:GraphBLAS extension.
func GlobalGetJITCPreface ¶
GlobalGetJITCPreface retrieves the preface for JIT kernels.
GlobalGetJITCPreface is a SuiteSparse:GraphBLAS extension.
func GlobalGetJITCachePath ¶
GlobalGetJITCachePath retrieves the path of the folder where compiled kernels are written to.
GlobalGetJITCachePath is a SuiteSparse:GraphBLAS extension.
func GlobalGetNThreads ¶
GlobalGetNThreads retrieves the current number of OpenMP threads GraphBLAS operations use by default.
GlobalGetNThreads is a SuiteSparse:GraphBLAS extension.
func GlobalGetOpenMP ¶
GlobalGetOpenMP retrieves whether SuiteSparse:GraphBLAS was compiled with OpenMP or not.
GlobalGetOpenMP is a SuiteSparse:GraphBLAS extension.
func GlobalGetPrint1Based ¶
GlobalGetPrint1Based retrieves whether vector and matrix indices start with 1 or 0 when printed.
GlobalGetPrint1Based is a SuiteSparse:GraphBLAS extension.
func GlobalSetBitmapSwitch ¶
func GlobalSetBitmapSwitch(bitmapSwitch [NBitmapSwitch]float64) error
GlobalSetBitmapSwitch determines how future matrices are converted to the bitmap format by default.
Parameters:
- bitmapSwitch (IN): A value between 0 and 1.
GlobalSetBitmapSwitch is a SuiteSparse:GraphBLAS extension.
func GlobalSetBurble ¶
GlobalSetBurble enables or disables the burble.
If enabled, SuiteSparse:GraphBLAS reports which internal kernels it uses, and how much times is spent.
GlobalSetBurble is a SuiteSparse:GraphBLAS extension.
func GlobalSetChunk ¶
GlobalSetChunk sets a value that controls how many OpenMP threads GraphBLAS operations use for small problems. When chunk < 1, a default value is used. The default value is usually 65536.
GlobalSetChunk is a SuiteSparse:GraphBLAS extension.
func GlobalSetHyperSwitch ¶
GlobalSetHyperSwitch determines how future matrices are converted between the hypersparse and non-hypersparse formats by default.
Parameters:
- hyperSwitch (IN): A value between 0 and 1. To force matrices to always be non-hypersparse, use NeverHyper. To force a matrix to always stay hypersparse, use AlwaysHyper.
GlobalSetHyperSwitch is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCCompilerFlags ¶
GlobalSetJITCCompilerFlags sets the flags for the C compiler used for JIT kernels.
GlobalSetJITCCompilerFlags is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCCompilerName ¶
GlobalSetJITCCompilerName sets the name of the C compiler used for JIT kernels.
GlobalSetJITCCompilerName is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCControl ¶
func GlobalSetJITCControl(control JITControl) error
GlobalSetJITCControl enables or disables different functionalities of the just-in-time compiler. See JITControl.
GlobalSetJITCControl is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCLibraries ¶
GlobalSetJITCLibraries sets the libraries to link against for the C linker used for JIT kernels.
GlobalSetJITCLibraries is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCLinkerFlags ¶
GlobalSetJITCLinkerFlags sets the flags for the C linker used for JIT kernels.
GlobalSetJITCLinkerFlags is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCPreface ¶
GlobalSetJITCPreface sets the preface for JIT kernels.
GlobalSetJITCPreface is a SuiteSparse:GraphBLAS extension.
func GlobalSetJITCachePath ¶
GlobalSetJITCachePath sets the path of the folder where compiled kernels are written to.
GlobalSetJITCachePath is a SuiteSparse:GraphBLAS extension.
func GlobalSetLayout ¶
GlobalSetLayout sets the Layout (GxB_FORMAT) of future matrices.
GlobalSetLayout is a SuiteSparse:GraphBLAS extension.
func GlobalSetNThreads ¶
GlobalSetNThreads controls how many OpenMP threads GraphBLAS operations use by default. By default, if set to 0, all available threads are used. If the value is more than the available OpenMP threads, then all available threads are used.
GlobalSetNThreads is a SuiteSparse:GraphBLAS extension.
func GlobalSetPanicOnError ¶
GlobalSetPanicOnError changes how GraphBLAS API errors are returned:
- if onNotOff is true, then forGraphBLASGo functions panic for these errors when they occur, rather than return them.
- if onNotOff is false (the default), then forGraphBLASGo functions return these errors when they occur.
The setting does not influence how GraphBLAS execution errors are reported; forGraphBLASGo functions always panic when they occur.
GlobalSetPanicOnError is a forGraphBLASGo extension.
func GlobalSetPrint1Based ¶
GlobalSetPrint1Based sets whether vector and matrix indices start with 1 or 0 when printed.
GlobalSetPrint1Based is a SuiteSparse:GraphBLAS extension.
func Init ¶
Init creates and initializes a GraphBLAS API context. The argument to Init defines the mode for the context. The two available modes are:
Blocking: In this mode, each method in a sequence returns after its computations have completed and output arguments are available to subsequent statements in an application. When executing in Blocking mode, the methods execute in program order.
NonBlocking: In this mode, methods in a sequence may return after arguments in the method have been tested for dimension and domain compatibility within the method but potentially before their computations complete. Output arguments are available to subsequent GraphBLAS methods in an application. When executing in NonBlocking mode, the methods in a sequence may execute in any order that preserves the mathematical result defined by the sequence.
An application can only create one context per execution instance. An application may only call Init once. Calling Init more than once results in undefined behavior.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func InitWithMalloc ¶
func InitWithMalloc( mode Mode, malloc UserMallocFunction, calloc UserCallocFunction, realloc UserReallocFunction, free UserFreeFunction, ) error
InitWithMalloc is identical to Init, except that it also redefines the memory management functions that SuiteSparse:GraphBLAS will use. calloc and realloc are optional, and may be nil. The functions passed to InitWithMalloc must be thread-safe.
InitWithMalloc is a SuiteSparse:GraphBLAS extension.
func KroneckerBinaryOp ¶
func KroneckerBinaryOp[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor, ) error
KroneckerBinaryOp is like KroneckerSemiring, except that a BinaryOp is used instead of a Semiring to specify the binary operator op.
func KroneckerMonoid ¶
func KroneckerMonoid[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op Monoid[D], a Matrix[D], b Matrix[D], desc *Descriptor, ) error
KroneckerMonoid is like KroneckerSemiring, except that a Monoid is used instead of a Semiring to specify the binary operator op. The identity element of the monoid is ignored.
func KroneckerSemiring ¶
func KroneckerSemiring[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op Semiring[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor, ) error
KroneckerSemiring computes the Kronecker product of two matrices. The result is a matrix.
The multiplication operator is the Semiring.Multiply operation of the provided Semiring. To use a Monoid instead of a Semiring, use KroneckerMonoid. To use a BinaryOp instead of a Semiring, use KroneckerBinaryOp.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the element-wise operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the "product" operation. The additive monoid of the semiring is ignored.
a (IN): The GraphBLAS matrix holding the values for the left-hand matrix in the operation.
b (IN): The GraphBLAS matrix holding the values for the right-hand matrix in the operation.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixApply ¶
func MatrixApply[DC, DA any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op UnaryOp[DC, DA], a Matrix[DA], desc *Descriptor, ) error
MatrixApply computes the transformation of the values of the elements of a matrix using a unary function.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the apply operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): A unary operator applied to each element of input matrix a.
a (IN): The GraphBLAS matrix to which the unary function is applied.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixApplyBinaryOp1st ¶
func MatrixApplyBinaryOp1st[DC, D, DA any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, D, DA], val D, a Matrix[DA], desc *Descriptor, ) error
MatrixApplyBinaryOp1st computes the transformation of the values of the stored elements of a matrix using a binary operator and a scalar value. The specified scalar value is passed as the first argument to the binary operator and stored elements of the matrix are passed as the second argument. The scalar is passed as a non-opaque variable.
To pass a Scalar object instead of a non-opaque variable, use MatrixApplyBinaryOp1stScalar.
To pass the stored elements of the matrix as the first argument to the binary operator and the specified scalar value as the second argument, use MatrixApplyBinaryOp2nd or MatrixApplyBinaryOp2ndScalar.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the apply operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): A binary operator applied to the scalar value val and each element of input matrix a.
val (IN): Scalar value that is passed to the binary operator as the left-hand (first) argument.
a (IN): The GraphBLAS matrix whose elements are passed to the binary operator as the right-hand (second) argument.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixApplyBinaryOp1stScalar ¶
func MatrixApplyBinaryOp1stScalar[DC, D, DA any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, D, DA], val Scalar[D], a Matrix[DA], desc *Descriptor, ) error
MatrixApplyBinaryOp1stScalar is like MatrixApplyBinaryOp1st, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixApplyBinaryOp2nd ¶
func MatrixApplyBinaryOp2nd[DC, DA, D any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, DA, D], a Matrix[DA], val D, desc *Descriptor, ) error
MatrixApplyBinaryOp2nd is like MatrixApplyBinaryOp1st, except that the stored elements of the matrix are passed as the first argument to the binary operator and the specified scalar value is passed as the second argument.
func MatrixApplyBinaryOp2ndScalar ¶
func MatrixApplyBinaryOp2ndScalar[DC, DA, D any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, DA, D], a Matrix[DA], val Scalar[D], desc *Descriptor, ) error
MatrixApplyBinaryOp2ndScalar is like MatrixApplyBinaryOp2nd, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixApplyIndexOp ¶
func MatrixApplyIndexOp[DC, DA, D any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op IndexUnaryOp[DC, DA, D], a Matrix[DA], val D, desc *Descriptor, ) error
MatrixApplyIndexOp computes the transformation of the values of the stored elements of a matrix using an index unary operator that is a function of the stored value, its location indices, and an user provided scalar value. The scalar is passed as a non-opaque variable.
To pass a Scalar object instead of a non-opaque variable, use MatrixApplyIndexOpScalar.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the apply operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): An index unary operator applied to each element stored in the input matrix c. It is a function of the stored element's value, its row and column indices, and a user supplied scalar value val.
a (IN): The GraphBLAS matrix whose elements are passed to the index unary operator.
val (IN): An additional scalar value that is passed to the index unary operator.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixApplyIndexOpScalar ¶
func MatrixApplyIndexOpScalar[DC, DA, D any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op IndexUnaryOp[DC, DA, D], a Matrix[DA], val Scalar[D], desc *Descriptor, ) error
MatrixApplyIndexOpScalar is like MatrixApplyIndexOp, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixAssign ¶
func MatrixAssign[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixAssign assigns values from one GraphBLAS matrix to a subset of a matrix as specified by a set of indices. The dimensions of the input matrix are the same size as the row and column index slices provided.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the assign operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
a (IN): The GraphBLAS matrix whose contents are assigned to a subset of c.
rowIndices (IN): The ordered set (slice) of indices corresponding to the rows of c that are assigned. If all rows of c are to be assigned in order from 0 to nrows − 1, then All(nrows) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. If this slice contains duplicate values, it implies an assignment of more than one value to the same location which leads to undefined results. len(rowIndices) must be equal to nrows(a) if a is not transposed, or equal to ncols(a) if a is transposed.
colIndices (IN): The ordered set (slice) of indices corresponding to the columns of c that are assigned. If all columns of c are to be assigned in order from 0 to ncols − 1, then All(ncols) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. If this slice contains duplicate values, it implies an assignment of more than one value to the same location which leads to undefined results. len(colIndices) must be equal to ncols(a) if a is not transposed, or equal to nrows(a) if a is transposed.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixAssignConstant ¶
func MatrixAssignConstant[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val D, rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixAssignConstant assigns the same value to a subset of a matrix as specified by a set of indices. With the use of All, the entire destination matrix can be filled with the constant.
To pass a Scalar object instead of a non-opaque variable, use MatrixAssignScalar.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the assign operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
val (IN): Scalar value to assign to (a subset of) c.
rowIndices (IN): The ordered set (slice) of indices corresponding to the rows of c that are to be assigned. If all rows of c are to be assigned in order from 0 to nrows − 1, then All(nrows) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. In this function, the specific order of the values in the slice has no effect on the result. Unlike other assign functions, if there are duplicated values in this slice the result is still defined. len(rowIndices) must be in the range [0, nrows(c)]. If len(rowIndices) is zero, the operation becomes a NO-OP.
colIndices (IN): The ordered set (slice) of indices corresponding to the columns of c that are to be assigned. If all columns of c are to be assigned in order from 0 to ncols − 1, then All(ncols) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. In this function, the specific order of the values in the slice has no effect on the result. Unlike other assign functions, if there are duplicated values in this slice the result is still defined. len(colIndices) must be in the range [0, ncols(c)]. If len(colIndices) is zero, the operation becomes a NO-OP.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixAssignScalar ¶
func MatrixAssignScalar[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val Scalar[D], rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixAssignScalar is like MatrixAssignConstant, except that the scalar value is passed as a Scalar object. It may be empty.
func MatrixColAssign ¶
func MatrixColAssign[D any]( c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], rowIndices []int, colIndex int, desc *Descriptor, ) error
MatrixColAssign assigns the contents of a vector to a subset of elements in one column of a matrix. Note that since the output cannot be transposed, MatrixRowAssign is also provided to assign to a row of a matrix.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the assign operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
u (IN): The GraphBLAS vector whose contents are assigned to (a subset of) a column of c.
rowIndices (IN): The ordered set (slice) of indices corresponding to the rows of c that are assigned. If all rows of c are to be assigned in order from 0 to nrows − 1, then All(nrows) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. If this slice contains duplicate values, it implies an assignment of more than one value to the same location which leads to undefined results. len(rowIndices) must be equal to size(u).
colIndex (IN): The index of the column in C to assign. Must be in the range [0, ncols(c)).
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixColExtract ¶
func MatrixColExtract[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], a Matrix[D], rowIndices []int, colIndex int, desc *Descriptor, ) error
MatrixColExtract extracts elements from one column of a matrix into a vector. Note that with the transpose descriptor for the source matrix, elements of an arbitrary row of the matrix can be extracted with this function as well.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the extract operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
a (IN): The GraphBLAS matrix from which the column subset is extracted.
rowIndices (IN): The ordered set (slice) of indices corresponding to the locations within the specified column of a from which elements are extracted. If elements of all rows in a are to be extracted in order, then All(nrows) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. len(rowIndices) must be equal to size(w).
colIndex (IN): The index of the column of a from which to extract values. It must be in the range [0, ncols(a)).
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixColSubassign ¶
func MatrixColSubassign[D any]( c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], rowIndices []int, colIndex int, desc *Descriptor, ) error
MatrixColSubassign is the same as MatrixColAssign, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
MatrixColSubassign is a SuiteSparse:GraphBLAS extension.
func MatrixEWiseAddBinaryOp ¶
func MatrixEWiseAddBinaryOp[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor, ) error
MatrixEWiseAddBinaryOp is like MatrixEWiseAddSemiring, except that a BinaryOp is used instead of a Semiring to specify the binary operator op.
func MatrixEWiseAddMonoid ¶
func MatrixEWiseAddMonoid[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op Monoid[D], a Matrix[D], b Matrix[D], desc *Descriptor, ) error
MatrixEWiseAddMonoid is like MatrixEWiseAddSemiring, except that a Monoid is used instead of a Semiring to specify the binary operator op. The identity element of the monoid is ignored.
func MatrixEWiseAddSemiring ¶
func MatrixEWiseAddSemiring[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op Semiring[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor, ) error
MatrixEWiseAddSemiring performs element-wise (general) addition on the elements of two matrices, producing a third matrix as a result.
The addition operator is the Semiring.Add operation of the provided Semiring. To use a Monoid instead of a Semiring, use MatrixEWiseAddMonoid. To use a BinaryOp instead of a Semiring, use MatrixEWiseAddBinaryOp.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the element-wise operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the element-wise "sum" operation. The multiplicative binary operator and additive identity of the semiring are ignored.
a (IN): The GraphBLAS matrix holding the values for the left-hand matrix in the operation.
b (IN): The GraphBLAS matrix holding the values for the right-hand matrix in the operation.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixEWiseMultBinaryOp ¶
func MatrixEWiseMultBinaryOp[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor, ) error
MatrixEWiseMultBinaryOp is like MatrixEWiseMultSemiring, except that a BinaryOp is used instead of a Semiring to specify the binary operator op.
func MatrixEWiseMultMonoid ¶
func MatrixEWiseMultMonoid[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op Monoid[D], a Matrix[D], b Matrix[D], desc *Descriptor, ) error
MatrixEWiseMultMonoid is like MatrixEWiseMultSemiring, except that a Monoid is used instead of a Semiring to specify the binary operator op. The identity element of the monoid is ignored.
func MatrixEWiseMultSemiring ¶
func MatrixEWiseMultSemiring[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op Semiring[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor, ) error
MatrixEWiseMultSemiring performs element-wise (general) multiplication on the intersection of the elements of two matrices, producing a third matrix as a result.
The multiplication operator is the Semiring.Multiply operation of the provided Semiring. To use a Monoid instead of a Semiring, use MatrixEWiseMultMonoid. To use a BinaryOp instead of a Semiring, use MatrixEWiseMultBinaryOp.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the element-wise operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the element-wise "product" operation. The additive monoid of the semiring is ignored.
a (IN): The GraphBLAS matrix holding the values for the left-hand matrix in the operation.
b (IN): The GraphBLAS matrix holding the values for the right-hand matrix in the operation.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixEWiseUnion ¶
func MatrixEWiseUnion[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op BinaryOp[DC, DA, DB], a Matrix[DA], alpha Scalar[DA], b Matrix[DB], beta Scalar[DB], desc *Descriptor, ) error
MatrixEWiseUnion is like MatrixEWiseAddBinaryOp, except that two scalars are used to define how to compute the result when entries are present in one of the two input matrices (a and b), but no the other. Each of the two input scalars alpha and beta must contain an entry. When computing the result t = a + b, if a(i) is present but b(i) is not, then t(i) = a(i) + beta. Likewise, if b(i) is present but a(i) is not, then t(i) = alpha + b(i), where + denotes the the binary operator add.
MatrixEWiseUnion is a SuiteSparse:GraphBLAS extension.
func MatrixExtract ¶
func MatrixExtract[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixExtract extracts a sub-matrix from a larger matrix as specified by a set of row indices and a set of column indices. The result is a matrix whose size is equal to the size of the sets of indices.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the extract operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
a (IN): The GraphBLAS matrix from which the subset is extracted.
rowIndices (IN): The ordered set (slice) of indices corresponding to the rows of a from which elements are extracted. If elements of all rows are to be extracted in order, then All(nrows) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. len(rowIndices) must be equal to nrows(c).
colIndices (IN): The ordered set (slice) of indices corresponding to the columns of a from which elements are extracted. If elements of all columns are to be extracted in order, then All(ncols) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. len(colIndices) must be equal to ncols(c).
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixReduce ¶
func MatrixReduce[D any]( op Monoid[D], a Matrix[D], desc *Descriptor, ) (val D, err error)
MatrixReduce reduces all stored values into a single scalar.
As an exceptional case, the forGraphBLASGo version of this GraphBLAS function does not provide a way to accumulate the result with an already existing value.
To reduce the stored values into a Scalar object instead of a non-opaque variable, and/or provide an accumulation function, use MatrixReduceMonoidScalar.
Parameters:
op (IN): The monoid used in the reduction operation. The operator must be commutative and associative; otherwise, the outcome of the operation is undefined.
a (IN): The GraphBLAS matrix on which the reduction will be performed.
desc (IN): Currently unused.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixReduceBinaryOp ¶
func MatrixReduceBinaryOp[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op BinaryOp[D, D, D], a Matrix[D], desc *Descriptor, ) error
MatrixReduceBinaryOp is like MatrixReduceMonoid, except that a BinaryOp is used instead of a Monoid to specify the reduction operator.
SuiteSparse:GraphBLAS supports this function only, if op is a built-in binary operator, and corresponds to a built-in monoid. For other binary operators, including user-defined ones, NotImplemented is returned.
func MatrixReduceBinaryOpScalar ¶
func MatrixReduceBinaryOpScalar[D any]( s Scalar[D], accum *BinaryOp[D, D, D], op BinaryOp[D, D, D], a Matrix[D], desc *Descriptor, ) error
MatrixReduceBinaryOpScalar is like MatrixReduceMonoidScalar, except that a BinaryOp is used instead of a Monoid to specify the reduction operator.
SuiteSparse:GraphBLAS supports this function only, if op is a built-in binary operator, and corresponds to a built-in monoid. For other binary operators, including user-defined ones, NotImplemented is returned.
func MatrixReduceMonoid ¶
func MatrixReduceMonoid[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op Monoid[D], a Matrix[D], desc *Descriptor, ) error
MatrixReduceMonoid performs a reduction across rows of a matrix to produce a vector. If reduction down columns is desired, the input matrix should be transposed using the descriptor.
To use a BinaryOp instead of a Monoid, use MatrixReduceBinaryOp.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the scalar provides values that may be accumulated with the result of the reduction operation. On output, this vector holds the result of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The monoid used in the reduction operation. The operator must be commutative and associative; otherwise, the outcome of the operation is undefined.
a (IN): The GraphBLAS matrix on which the reduction will be performed.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixReduceMonoidScalar ¶
func MatrixReduceMonoidScalar[D any]( s Scalar[D], accum *BinaryOp[D, D, D], op Monoid[D], a Matrix[D], desc *Descriptor, ) error
MatrixReduceMonoidScalar reduces all stored values into a single scalar.
To reduce the stored values into a non-opaque variable, use MatrixReduce.
To use a BinaryOp instead of a Monoid, use MatrixReduceBinaryOpScalar.
Parameters:
s (INOUT): Scalar to store the final reduced value into. On input, the scalar provides a value that may be accumulated (optionally) with the result of the reduction operation. On output, this scalar holds the result of the operation.
accum (IN): An optional binary operator used for accumulating entries into an existing scalar value. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The monoid used in the reduction operation. The operator must be commutative and associative; otherwise, the outcome of the operation is undefined.
a (IN): The GraphBLAS matrix on which the reduction will be performed.
desc (IN): Currently unused.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixRowAssign ¶
func MatrixRowAssign[D any]( c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], rowIndex int, colIndices []int, desc *Descriptor, ) error
MatrixRowAssign assigns the contents of a vector to a subset of elements in one row of a matrix. Note that since the output cannot be transposed, MatrixColAssign is also provided to assign to a column of a matrix.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the assign operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
u (IN): The GraphBLAS vector whose contents are assigned to (a subset of) a row of c.
rowIndex (IN): The index of the row in C to assign. Must be in the range [0, nrows(c)).
colIndices (IN): The ordered set (slice) of indices corresponding to the columns of c that are assigned. If all columns of c are to be assigned in order from 0 to nrows − 1, then All(ncols) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. If this slice contains duplicate values, it implies an assignment of more than one value to the same location which leads to undefined results. len(colIndices) must be equal to size(u).
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixRowSubassign ¶
func MatrixRowSubassign[D any]( c Matrix[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], rowIndex int, colIndices []int, desc *Descriptor, ) error
MatrixRowSubassign is the same as MatrixRowAssign, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
MatrixRowSubassign is a SuiteSparse:GraphBLAS extension.
func MatrixSelect ¶
func MatrixSelect[D, T any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op IndexUnaryOp[bool, D, T], a Matrix[D], val T, desc *Descriptor, ) error
MatrixSelect applies a select operator (an index unary operator to the elements of a matrix to determine whether or not to keep them.
To pass a Scalar object instead of a non-opaque variable, use MatrixSelectScalar.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the select operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): An index unary operator applied to each element stored in the input vector u. It is a function of the stored element's value, its row and column indices, and a user supplied scalar value val.
a (IN): The GraphBLAS matrix whose elements are passed to the index unary operator.
val (IN): An additional scalar value that is passed to the index unary operator.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixSelectScalar ¶
func MatrixSelectScalar[D, T any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], op IndexUnaryOp[bool, D, T], a Matrix[D], val Scalar[T], desc *Descriptor, ) error
MatrixSelectScalar is like MatrixSelect, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixSubassign ¶
func MatrixSubassign[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixSubassign is the same as MatrixAssign, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
MatrixSubassign is a SuiteSparse:GraphBLAS extension.
func MatrixSubassignConstant ¶
func MatrixSubassignConstant[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val D, rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixSubassignConstant is the same as MatrixAssignConstant, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
MatrixSubassignConstant is a SuiteSparse:GraphBLAS extension.
func MatrixSubassignScalar ¶
func MatrixSubassignScalar[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], val Scalar[D], rowIndices, colIndices []int, desc *Descriptor, ) error
MatrixSubassignScalar is the same as MatrixSubassignScalar, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
MatrixSubassignScalar is a SuiteSparse:GraphBLAS extension.
func Maximum ¶
func Maximum[D Number]() (result D)
Maximum values for the predefined GraphBLAS Number types (domains).
This returns the largest positive value for integers, and positive infinity for floating point numbers.
Maximum is a forGraphBLAS Go extension.
func Minimum ¶
func Minimum[D Number]() (result D)
Minimum values for the predefined GraphBLAS Number types (domains).
This returns the smallest negative value for signed integers, 0 for unsigned integers, and negative infinity for floating point numbers.
Minimum is a forGraphBLAS Go extension.
func MxM ¶
func MxM[DC, DA, DB any]( c Matrix[DC], mask *Matrix[bool], accum *BinaryOp[DC, DC, DC], op Semiring[DC, DA, DB], a Matrix[DA], b Matrix[DB], desc *Descriptor) error
MxM multiplies a matrix with another matrix on a semiring.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the matrix product. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the matrix-matrix multiply.
a (IN): The GraphBLAS matrix holding the values for the left-hand matrix in the multiplication.
b (IN): The GraphBLAS matrix holding the values for the right-hand matrix in the multiplication.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MxV ¶
func MxV[Dw, DA, Du any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op Semiring[Dw, DA, Du], a Matrix[DA], u Vector[Du], desc *Descriptor) error
MxV multiplies a matrix by a vector on a semiring. The result is a vector.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the matrix-vector product. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the vector-matrix multiply.
a (IN): The GraphBLAS matrix holding the values for the left-hand matrix in the multiplication.
u (IN): The GraphBLAS vector holding the values for the right-hand vector in the multiplication.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified. Set the Tran descriptor for Inp0 to use the transpose of the input matrix a.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func OK ¶
func OK(err error)
OK transfers control to the closest deferred CheckErrors, if err != nil (by panicking using an internal marker type). If err == nil, OK just returns without doing anything else.
This mechanism works on any error types, not only Info.
OK is an optional mechanism. It is also always correct to check errors manually, even when deferred CheckErrors calls are active.
See CheckErrors for an example.
OK is a forGraphBLASGo extension.
func Range ¶
Range can be used everywhere All can be used as well. Range indicates that all indices in the range begin <= index < end are to be used. This representation uses significantly less memory than enumerating the corresponding indices explicitly, and is also handled more efficiently by the underlying SuiteSparse:GraphBLAS implementation.
Range is a SuiteSparse:GraphBLAS extension.
func Stride ¶
Stride can be used everywhere All can be used as well. Stride indicates that indices in the range begin <= index < end are to be used, starting at begin and incremented by inc. For example, Stride(3, 10, 2) corresponds to the slice []int{3, 5, 7, 9}. This representation uses significantly less memory than enumerating the corresponding indices explicitly, and is also handled more efficiently by the underlying SuiteSparse:GraphBLAS implementation.
Stride is a SuiteSparse:GraphBLAS extension.
func Transpose ¶
func Transpose[D any]( c Matrix[D], mask *Matrix[bool], accum *BinaryOp[D, D, D], a Matrix[D], desc *Descriptor, ) error
Transpose computes a new matrix that is the transpose of the source matrix.
Parameters:
c (INOUT): An existing GraphBLAS matrix. On input, the matrix provides values that may be accumulated with the result of the transpose operation. On output, this matrix holds the results of the operation.
mask (IN): An optional "write" MatrixMask.
accum (IN): An optional binary operator used for accumulating entries into existing c entries. If assignment rather than accumulation is desired, nil should be specified.
a (IN): The GraphBLAS matrix on which transposition will be performed.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorApply ¶
func VectorApply[Dw, Du any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op UnaryOp[Dw, Du], u Vector[Du], desc *Descriptor, ) error
VectorApply computes the transformation of the values of the elements of a vector using a unary function.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the apply operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): A unary operator applied to each element of input vector u.
u (IN): The GraphBLAS vector to which the unary function is applied.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorApplyBinaryOp1st ¶
func VectorApplyBinaryOp1st[Dw, D, Du any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, D, Du], val D, u Vector[Du], desc *Descriptor, ) error
VectorApplyBinaryOp1st computes the transformation of the values of the stored elements of a vector using a binary operator and a scalar value. The specified scalar value is passed as the first argument to the binary operator and stored elements of the vector are passed as the second argument. The scalar is passed as a non-opaque variable.
To pass a Scalar object instead of a non-opaque variable, use VectorApplyBinaryOp1stScalar.
To pass the stored elements of the vector as the first argument to the binary operator, and the specified scalar value as the second argument, use VectorApplyBinaryOp2nd or VectorApplyBinaryOp2ndScalar.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the apply operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): A binary operator applied to the scalar value val and each element of input vector u.
val (IN): Scalar value that is passed to the binary operator as the left-hand (first) argument.
u (IN): The GraphBLAS vector whose elements are passed to the binary operator as the right-hand (second) argument.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorApplyBinaryOp1stScalar ¶
func VectorApplyBinaryOp1stScalar[Dw, D, Du any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, D, Du], val Scalar[D], u Vector[Du], desc *Descriptor, ) error
VectorApplyBinaryOp1stScalar is like VectorApplyBinaryOp1st, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorApplyBinaryOp2nd ¶
func VectorApplyBinaryOp2nd[Dw, Du, D any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, Du, D], u Vector[Du], val D, desc *Descriptor, ) error
VectorApplyBinaryOp2nd is like VectorApplyBinaryOp1st, except that the stored elements of the vector are passed as the first argument to the binary operator and the specified scalar value is passed as the second argument.
func VectorApplyBinaryOp2ndScalar ¶
func VectorApplyBinaryOp2ndScalar[Dw, Du, D any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, Du, D], u Vector[Du], val Scalar[D], desc *Descriptor, ) error
VectorApplyBinaryOp2ndScalar is like VectorApplyBinaryOp2nd, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorApplyIndexOp ¶
func VectorApplyIndexOp[Dw, Du, D any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op IndexUnaryOp[Dw, Du, D], u Vector[Du], val D, desc *Descriptor, ) error
VectorApplyIndexOp computes the transformation of the values of the stored elements of a vector using an index unary operator that is a function of the stored value, its location indices, and an user provided scalar value. The scalar is passed as a non-opaque variable.
To pass a Scalar object instead of a non-opaque variable, use VectorApplyIndexOpScalar.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the apply operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): An index unary operator applied to each element stored in the input vector u. It is a function of the stored element's value, its location index, and a user supplied scalar value val.
u (IN): The GraphBLAS vector whose elements are passed to the index unary operator.
val (IN): An additional scalar value that is passed to the index unary operator.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorApplyIndexOpScalar ¶
func VectorApplyIndexOpScalar[Dw, Du, D any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op IndexUnaryOp[Dw, Du, D], u Vector[Du], val Scalar[D], desc *Descriptor, ) error
VectorApplyIndexOpScalar is like VectorApplyIndexOp, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorAssign ¶
func VectorAssign[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], indices []int, desc *Descriptor, ) error
VectorAssign assigns values from one GraphBLAS vector to a subset of a vector as specified by a set of indices. The size of the input vector is the same size as the index slice provided.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the assign operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
u (IN): The GraphBLAS vector whose contents are assigned to a subset of w.
indices (IN): The ordered set (slice) of indices corresponding to the locations in w that are to be assigned. If all elements of w are to be assigned in order from 0 to nindices − 1, then All(nindices) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. If this slice contains duplicate values, it implies an assignment of more than one value to the same location which leads to undefined results. len(indices) must be equal to size(u).
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorAssignConstant ¶
func VectorAssignConstant[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val D, indices []int, desc *Descriptor, ) error
VectorAssignConstant assigns the same value to a subset of a vector as specified by a set of indices. With the use of All, the entire destination vector can be filled with the constant.
To pass a Scalar object instead of a non-opaque variable, use VectorAssignScalar.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the assign operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
val (IN): Scalar value to assign to (a subset of) w.
indices (IN): The ordered set (slice) of indices corresponding to the locations in w that are to be assigned. If all elements of w are to be assigned in order from 0 to nindices − 1, then All(nindices) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation. In this function, the specific order of the values in the slice has no effect on the result. Unlike other assign functions, if there are duplicated values in this slice the result is still defined. len(indices) must be in the range [0, size(w)]. If len(indices) is zero, the operation becomes a NO-OP.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorAssignScalar ¶
func VectorAssignScalar[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val Scalar[D], indices []int, desc *Descriptor, ) error
VectorAssignScalar is like VectorAssignConstant, except that the scalar value is passed as a Scalar object. It may be empty.
func VectorEWiseAddBinaryOp ¶
func VectorEWiseAddBinaryOp[Dw, Du, Dv any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, Du, Dv], u Vector[Du], v Vector[Dv], desc *Descriptor, ) error
VectorEWiseAddBinaryOp is like VectorEWiseAddSemiring, except that a BinaryOp is used instead of a Semiring to specify the binary operator op.
func VectorEWiseAddMonoid ¶
func VectorEWiseAddMonoid[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op Monoid[D], u Vector[D], v Vector[D], desc *Descriptor, ) error
VectorEWiseAddMonoid is like VectorEWiseAddSemiring, except that a Monoid is used instead of a Semiring to specify the binary operator op. The identity element of the monoid is ignored.
func VectorEWiseAddSemiring ¶
func VectorEWiseAddSemiring[Dw, Du, Dv any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op Semiring[Dw, Du, Dv], u Vector[Du], v Vector[Dv], desc *Descriptor, ) error
VectorEWiseAddSemiring performs element-wise (general) addition on the elements of two vectors, producing a third vector as a result.
The addition operator is the Semiring.Add operation of the provided Semiring. To use a Monoid instead of a Semiring, use VectorEWiseAddMonoid. To use a BinaryOp instead of a Semiring, use VectorEWiseAddBinaryOp.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the element-wise operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the element-wise "sum" operation. The multiplicative binary operator and additive identity of the semiring are ignored.
u (IN): The GraphBLAS vector holding the values for the left-hand vector in the operation.
v (IN): The GraphBLAS vector holding the values for the right-hand vector in the operation.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorEWiseMultBinaryOp ¶
func VectorEWiseMultBinaryOp[Dw, Du, Dv any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, Du, Dv], u Vector[Du], v Vector[Dv], desc *Descriptor, ) error
VectorEWiseMultBinaryOp is like VectorEWiseMultSemiring, except that a BinaryOp is used instead of a Semiring to specify the binary operator op.
func VectorEWiseMultMonoid ¶
func VectorEWiseMultMonoid[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op Monoid[D], u Vector[D], v Vector[D], desc *Descriptor, ) error
VectorEWiseMultMonoid is like VectorEWiseMultSemiring, except that a Monoid is used instead of a Semiring to specify the binary operator op. The identity element of the monoid is ignored.
func VectorEWiseMultSemiring ¶
func VectorEWiseMultSemiring[Dw, Du, Dv any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op Semiring[Dw, Du, Dv], u Vector[Du], v Vector[Dv], desc *Descriptor, ) error
VectorEWiseMultSemiring performs element-wise (general) multiplication on the intersection of the elements of two vectors, producing a third vector as a result.
The multiplication operator is the Semiring.Multiply operation of the provided Semiring. To use a Monoid instead of a Semiring, use VectorEWiseMultMonoid. To use a BinaryOp instead of a Semiring, use VectorEWiseMultBinaryOp.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the element-wise operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the element-wise "product" operation. The additive monoid of the semiring is ignored.
u (IN): The GraphBLAS vector holding the values for the left-hand vector in the operation.
v (IN): The GraphBLAS vector holding the values for the right-hand vector in the operation.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorEWiseUnion ¶
func VectorEWiseUnion[Dw, Du, Dv any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op BinaryOp[Dw, Du, Dv], u Vector[Du], alpha Scalar[Du], v Vector[Dv], beta Scalar[Dv], desc *Descriptor, ) error
VectorEWiseUnion is like VectorEWiseAddBinaryOp, except that two scalars are used to define how to compute the result when entries are present in one of the two input vectors (u and v), but no the other. Each of the two input scalars alpha and beta must contain an entry. When computing the result t = u + v, if u(i) is present but v(i) is not, then t(i) = u(i) + beta. Likewise, if v(i) is present but u(i) is not, then t(i) = alpha + v(i), where + denotes the the binary operator add.
VectorEWiseUnion is a SuiteSparse:GraphBLAS extension.
func VectorExtract ¶
func VectorExtract[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], indices []int, desc *Descriptor, ) error
VectorExtract extracts a sub-vector from a larger vector as specified by a set of indices. The result is a vector whose size is equal to the number of indices.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the extract operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
u (IN): The GraphBLAS vector from which the subset is extracted.
indices (IN): The ordered set (slice) of indices corresponding to the locations of elements from u that are extracted. If all elements of u are to be extracted in order from 0 to nindices − 1, then All(nindices) should be specified. Regardless of execution mode and return value, this slice may be manipulated by the caller after this operation returns without affecting any deferred computations for this operation.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorReduce ¶
func VectorReduce[D any]( op Monoid[D], u Vector[D], desc *Descriptor, ) (val D, err error)
VectorReduce reduces all stored values into a single scalar.
As an exceptional case, the forGraphBLASGo version of this GraphBLAS function does not provide a way to accumulate the result with an already existing value.
To reduce the stored values into a Scalar object instead of a non-opaque variable, and/or provide an accumulation function, use VectorReduceMonoidScalar.
Parameters:
op (IN): The monoid used in the reduction operation. The operator must be commutative and associative; otherwise, the outcome of the operation is undefined.
u (IN): The GraphBLAS vector on which the reduction will be performed.
desc (IN): Currently unused.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorReduceBinaryOpScalar ¶
func VectorReduceBinaryOpScalar[D any]( s Scalar[D], accum *BinaryOp[D, D, D], op BinaryOp[D, D, D], u Vector[D], desc *Descriptor, ) error
VectorReduceBinaryOpScalar is like VectorReduceMonoidScalar, except that a BinaryOp is used instead of a Monoid to specify the reduction operator.
SuiteSparse:GraphBLAS supports this function only, if op is a built-in binary operator, and corresponds to a built-in monoid. For other binary operators, including user-defined ones, NotImplemented is returned.
func VectorReduceMonoidScalar ¶
func VectorReduceMonoidScalar[D any]( s Scalar[D], accum *BinaryOp[D, D, D], op Monoid[D], u Vector[D], desc *Descriptor, ) error
VectorReduceMonoidScalar reduces all stored values into a single scalar.
To reduce the stored values into a non-opaque variable, use VectorReduce.
To use a BinaryOp instead of a Monoid, use VectorReduceBinaryOpScalar.
Parameters:
s (INOUT): Scalar to store the final reduced value into. On input, the scalar provides a value that may be accumulated (optionally) with the result of the reduction operation. On output, this scalar holds the result of the operation.
accum (IN): An optional binary operator used for accumulating entries into an existing scalar value. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The monoid used in the reduction operation. The operator must be commutative and associative; otherwise, the outcome of the operation is undefined.
u (IN): The GraphBLAS vector on which the reduction will be performed.
desc (IN): Currently unused.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorSelect ¶
func VectorSelect[D, T any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op IndexUnaryOp[bool, D, T], u Vector[D], val T, desc *Descriptor, ) error
VectorSelect applies a select operator (an index unary operator) to the elements of a vector to determine whether or not to keep them.
To pass a Scalar object instead of a non-opaque variable, use VectorSelectScalar.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the select operation. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): An index unary operator applied to each element stored in the input vector u. It is a function of the stored element's value, its location index, and a user supplied scalar value val.
u (IN): The GraphBLAS vector whose elements are passed to the index unary operator.
val (IN): An additional scalar value that is passed to the index unary operator.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorSelectScalar ¶
func VectorSelectScalar[D, T any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], op IndexUnaryOp[bool, D, T], u Vector[D], val Scalar[T], desc *Descriptor, ) error
VectorSelectScalar is like VectorSelect, except that the scalar value is passed as a Scalar object. It must not be empty.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorSubassign ¶
func VectorSubassign[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], u Vector[D], indices []int, desc *Descriptor, ) error
VectorSubassign is the same as VectorAssign, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
VectorSubassign is a SuiteSparse:GraphBLAS extension.
func VectorSubassignConstant ¶
func VectorSubassignConstant[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val D, indices []int, desc *Descriptor, ) error
VectorSubassignConstant is the same as VectorAssignConstant, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
VectorSubassignConstant is a SuiteSparse:GraphBLAS extension.
func VectorSubassignScalar ¶
func VectorSubassignScalar[D any]( w Vector[D], mask *Vector[bool], accum *BinaryOp[D, D, D], val Scalar[D], indices []int, desc *Descriptor, ) error
VectorSubassignScalar is the same as VectorAssignScalar, except that the mask is restricted to the passed indices, and if the Replace descriptor is set for Outp, then entries outside of the passed indices are not affected.
VectorSubassignScalar is a SuiteSparse:GraphBLAS extension.
func VersionToInt ¶
VersionToInt returns a single integer for comparing spec and version levels.
VersionToInt is a SuiteSparse:GraphBLAS extension.
func VxM ¶
func VxM[Dw, Du, DA any]( w Vector[Dw], mask *Vector[bool], accum *BinaryOp[Dw, Dw, Dw], op Semiring[Dw, Du, DA], u Vector[Du], a Matrix[DA], desc *Descriptor) error
VxM multiplies a (row) vector with a matrix on a semiring. The result is a vector.
Parameters:
w (INOUT): An existing GraphBLAS vector. On input, the vector provides values that may be accumulated with the result of the vector-matrix product. On output, this vector holds the results of the operation.
mask (IN): An optional "write" VectorMask.
accum (IN): An optional binary operator used for accumulating entries into existing w entries. If assignment rather than accumulation is desired, nil should be specified.
op (IN): The semiring used in the vector-matrix multiply.
u (IN): The GraphBLAS vector holding the values for the left-hand vector in the multiplication.
a (IN): The GraphBLAS matrix holding the values for the right-hand matrix in the multiplication.
desc (IN): An optional operation Descriptor. If a default descriptor is desired, nil should be specified. Set the Tran descriptor for Inp1 to use the transpose of the input matrix a.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
Types ¶
type BinaryFunction ¶
type BinaryFunction C.GxB_binary_function
BinaryFunction is the C type for binary functions:
typedef void (*GxB_binary_function) (void *, const void *, const void *) ;
type BinaryOp ¶
type BinaryOp[Dout, Din1, Din2 any] struct { // contains filtered or unexported fields }
BinaryOp represents a GraphBLAS function that takes one argument of type Din1, one argument of type Din2, and returns an argument of type Dout.
func Any ¶
func Any[D Predefined | Complex]() (f BinaryOp[D, D, D])
Any is f(x, y) = x or y, picked arbitrarily
Any is a a SuiteSparse:GraphBLAS extension.
func BinaryOpNew ¶
func BinaryOpNew[Dout, Din1, Din2 any](binaryFunc BinaryFunction) (binaryOp BinaryOp[Dout, Din1, Din2], err error)
BinaryOpNew returns a new GraphBLAS binary operator with a specified user-defined function in C and its types (domains).
Parameters:
- binaryFunc (IN): A pointer to a user-defined function in C that takes two input parameters of types Din1 and Din2 and returns a value of type Dout, all passed as void pointers. Dout, Din1, and Din2 should be one of the Predefined GraphBLAS types, one of the Complex GraphBLAS types, or a user-defined GraphBLAS type.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func Cmplx ¶
Cmplx is f(x, y) = x + y * i
If C is complex64, F must be float32; if C is complex128, F must be float64.
GraphBLAS API errors that may be returned:
- DomainMismatch: C and F are not compatible with each other.
Cmplx is a SuiteSparse:GraphBLAS extension.
func First ¶
func First[D Predefined | Complex, Any any]() (f BinaryOp[D, D, Any])
First is f(x, y) = x
func Firsti ¶
Firsti is f(x, y) = row index of x (0-based)
Firsti is a SuiteSparse:GraphBLAS extension.
func Firsti1 ¶
Firsti1 is f(x, y) = row index of x (1-based)
Firsti1 is a SuiteSparse:GraphBLAS extension.
func Firstj ¶
Firstj is f(x, y) = column index of x (0-based)
Firstj is a SuiteSparse:GraphBLAS extension.
func Firstj1 ¶
Firstj1 is f(x, y) = column index of x (1-based)
Firstj1 is a SuiteSparse:GraphBLAS extension.
func IgnoreDup ¶
IgnoreDup is ignore duplicates during Vector.Build or Matrix.Build.
IgnoreDup is a SuiteSparse:GraphBLAS extension.
func Iseq ¶
func Iseq[D Predefined | Complex]() (f BinaryOp[D, D, D])
Iseq is f(x, y) = x == y
Iseq is a SuiteSparse:GraphBLAS extension.
func Isge ¶
func Isge[D Predefined]() (f BinaryOp[D, D, D])
Isge is f(x, y) = x >= y
Isge is a SuiteSparse:GraphBLAS extension.
func Isgt ¶
func Isgt[D Predefined]() (f BinaryOp[D, D, D])
Isgt is f(x, y) = x > y
Isgt is a SuiteSparse:GraphBLAS extension.
func Isle ¶
func Isle[D Predefined]() (f BinaryOp[D, D, D])
Isle is f(x, y) = x <= y
Isle is a SuiteSparse:GraphBLAS extension.
func Islt ¶
func Islt[D Predefined]() (f BinaryOp[D, D, D])
Islt is f(x, y) = x < y
Islt is a SuiteSparse:GraphBLAS extension.
func Isne ¶
func Isne[D Predefined | Complex]() (f BinaryOp[D, D, D])
Isne is f(x, y) = x != y
Isne is a SuiteSparse:GraphBLAS extension.
func Land ¶
func Land[D Predefined]() (f BinaryOp[D, D, D])
Land is f(x, y) = (x != 0) && (y != 0)
Land is a SuiteSparse:GraphBLAS extension.
func Lor ¶
func Lor[D Predefined]() (f BinaryOp[D, D, D])
Lor is f(x, y) = (x != 0) || (y != 0)
Lor is a SuiteSparse:GraphBLAS extension.
func Lxor ¶
func Lxor[D Predefined]() (f BinaryOp[D, D, D])
Lxor is f(x, y) = (x != 0) != (y != 0)
Lxor is a SuiteSparse:GraphBLAS extension.
func NamedBinaryOpNew ¶
func NamedBinaryOpNew[Dout, Din1, Din2 any](binaryFunc BinaryFunction, binopname string, binopdefn string) (binaryOp BinaryOp[Dout, Din1, Din2], err error)
NamedBinaryOpNew creates a named binary function. It is like BinaryOpNew, except:
- binopname is the name for the GraphBLAS binary operator. Only the first 127 characters are used.
- binopdefn is a string containing the entire function itself.
The two strings binopname and binopdefn are optional, but are required to enable the JIT compilation of kernels that use this operator.
If the JIT is enabled, or if the corresponding JIT kernel has been copied into the PreJIT folder, the function may be nil. In this case, a JIT kernel is compiled that contains just the user-defined function. If the JIT is disabled and the function is nil, this method returns a NullPointer error.
NamedBinaryOpNew is a SuiteSparse:GraphBLAS extension.
func Oneb ¶
func Oneb[D Predefined | Complex]() (f BinaryOp[D, D, D])
Oneb is f(x, y) = 1 when D is { Number | Complex }. f(x, y) = true when D is bool.
func Pow ¶
func Pow[D Predefined | Complex]() (f BinaryOp[D, D, D])
Pow is f(x, y) = x raised to the power of y
Pow is a SuiteSparse:GraphBLAS extension.
func Rdiv ¶
func Rdiv[D Predefined | Complex]() (f BinaryOp[D, D, D])
Rdiv is f(x, y) = y / x
Rdiv is a a SuiteSparse:GraphBLAS extension.
func Rminus ¶
func Rminus[D Predefined | Complex]() (f BinaryOp[D, D, D])
Rminus is f(x, y) = y - x
Rminus is a SuiteSparse:GraphBLAS extension.
func Second ¶
func Second[Any any, D Predefined | Complex]() (f BinaryOp[D, Any, D])
Second is f(x, y) = y
func Secondi ¶
Secondi is f(x, y) = row index of y (0-based)
Secondi is a SuiteSparse:GraphBLAS extension.
func Secondi1 ¶
Secondi1 is f(x, y) = row index of y (1-based)
Secondi1 is a SuiteSparse:GraphBLAS extension.
func Secondj ¶
Secondj is f(x, y) = column index of y (0-based)
Secondj is a SuiteSparse:GraphBLAS extension.
func Secondj1 ¶
Secondj1 is f(x, y) = column index of y (1-based)
Secondj1 is a SuiteSparse:GraphBLAS extension.
func (BinaryOp[Dout, Din1, Din2]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the binary operator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*BinaryOp[Dout, Din1, Din2]) Free ¶
Free destroys a previously created BinaryOp and releases any resources associated with it. Calling Free on an object that is not BinaryOp.Valid() is legal. The behavior of a program that calls Free on a pre-defined binary operator is undefined.
GraphBLAS execution errors that may cause a panic:
func (BinaryOp[Dout, Din1, Din2]) Print ¶
func (binaryOp BinaryOp[Dout, Din1, Din2]) Print(name string, pr PrintLevel) error
Print the contents of the binary operator to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: binaryOp is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (BinaryOp[Dout, Din1, Din2]) Valid ¶
Valid returns true if binaryOp has been created by a successful call to BinaryOpNew or NamedBinaryOpNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type ColIterator ¶
type ColIterator[D any] struct { // contains filtered or unexported fields }
A ColIterator iterates across the columns of a matrix, and then within each column to access the entries in a given row. Accessing all the entries of a matrix using a column iterator requires an outer loop (for the columns) and an inner loop (for the entries in each column). A matrix can be accessed via a column iterator only if its layout (determined by Matrix.GetLayout is ByCol.
ColIterator is a SuiteSparse:GraphBLAS extension.
func (ColIterator) Err ¶
Err returns an error message about any errors encountered during the processing associated with the iterator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*ColIterator) Free ¶
func (it *ColIterator) Free() error
Free destroys a previously created VectorIterator, RowIterator, ColIterator, or EntryIterator and releases any resources associated with it. Calling Free on an object that is not valid is legal.
GraphBLAS execution errors that may cause a panic:
func (ColIterator) Get ¶
func (it ColIterator) Get() D
Get returns the value of the current iterator entry.
Get is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) GetColIndex ¶
func (it ColIterator[D]) GetColIndex() int
GetColIndex returns ncols(a) if the iterator is exhausted, or the current column index otherwise.
GetColIndex is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) GetRowIndex ¶
func (it ColIterator[D]) GetRowIndex() int
GetRowIndex returns the current row index.
GetRowIndex is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) KSeek ¶
KSeek moves a column iterator to the specified explicit column. For sparse, bitmap, and full matrices, this is the same as ColIterator.SeekCol.
Return Values:
- true, false, nil: The iterator has been moved to a column that contains at least one entry.
- false, false, nil: The iterator has been moved to a column with no entries.
- false, true, nil: k is out of bounds (>= kount).
KSeek is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) Kount ¶
func (it ColIterator[D]) Kount() int
Kount returns Matrix.Ncols for sparse, bitmap, and full matrices, and the number of explicit columns for hypersparse matrices.
Kount is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) NextCol ¶
NextCol moves the iterator to the next column.
If the matrix is hypersparse, the next column is always an explicit column. Implicit column are skipped.
Return Values:
- true, false, nil: The iterator has been moved to a column that contains at least one entry.
- false, false, nil: The iterator has been moved to a column with no entries.
- false, true, nil: The iterator is exhausted.
NextCol is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) NextRow ¶
NextRow moves the iterator to the next entry in the current column.
Return Values:
- true, nil: The iterator has been moved to the next entry.
- false, nil: The end of the column is reached. The iterator does not move to the next column.
NextRow is a SuiteSparse:GraphBLAS extension.
func (ColIterator[D]) SeekCol ¶
SeekCol moves a column iterator to the specified column.
For hypersparse matrices, if the requested column is implicit, the iterator is moved to the first explicit column following it. If no such column exists, the iterator is exhausted.
Return Values:
- true, false, nil: The iterator has been moved to a column that contains at least one entry.
- false, false, nil: The iterator has been moved to a column with no entries.
- false, true, nil: col is out of bounds (>= ncols).
SeekCol is a SuiteSparse:GraphBLAS extension.
func (ColIterator) Valid ¶
func (it ColIterator) Valid() bool
Valid returns true if the iterator has been created by a successful call to Vector.IteratorNew, Matrix.IteratorNew, Matrix.RowIteratorNew, or Matrix.ColIteratorNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Complex ¶
type Complex interface { complex64 | complex128 }
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context objects control the number of threads used by OpenMP per application thread.
Context is a SuiteSparse:GraphBLAS extension.
func ContextNew ¶
ContextNew creates a new Context and initializes it with the current global settings for Context.GetNThreads and Context.GetChunk.
ContextNew is a SuiteSparse:GraphBLAS extension.
func (Context) Engage ¶
Engage sets the provided Context object as the Context object for this user thread. Multiple user threads can share a single Context. Any prior Context for this thread is superseded by the new Context. (The prior one is not [Free]d.) Future calls by this user thread will use the provided Context.
Caution: By default, the Go scheduler can freely move goroutines between threads. In order for Engage to be meaningful, the current goroutine has to be tied to the current thread with runtime.LockOSThread.
Please also consider that runtime.LockOSThread and runtime.UnlockOSThread nest: A goroutine is only unlocked from the current thread when there have been as many calls to runtime.UnlockOSThread as there have been to runtime.LockOSThread. On the other hand, Engage and [Context.Disengage] do not nest, but have immediate effects.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
Engage is a SuiteSparse:GraphBLAS extension.
func (*Context) Free ¶
Free destroys a previously created Context and releases any resources associated with it. Calling Free on an object that is not [Context.Valid]() is legal. The behavior of a program that calls Free on a pre-defined context is undefined.
GraphBLAS execution errors that may cause a panic:
func (Context) GetChunk ¶
GetChunk returns the chunk size for small problems.
GetChunk is a SuiteSparse:GraphBLAS extension.
func (Context) GetNThreads ¶
GetNThreads returns the maximum number of threads to use.
GetNThreads is a SuiteSparse:GraphBLAS extension.
func (Context) SetChunk ¶
SetChunk sets the chunk size for small problems. If chunk < 1, then the default is used.
SetChunk is a SuiteSparse:GraphBLAS extension.
func (Context) SetNThreads ¶
SetNThreads sets the maximum number of threads to use. If nthreads <= 0, then one thread is used.
SetNThreads is a SuiteSparse:GraphBLAS extension.
type DescField ¶
type DescField int
DescField is the descriptor field enumeration.
const ( Outp DescField = iota Mask Inp0 Inp1 // AxBMethod is a descriptor for selecting the C=A*B algorithm. // AxBMethod is a SuiteSparse:GraphBLAS extension. AxBMethod DescField = 1000 // SortHint controls sorting in [MxM], [MxV], [VxM], and reduction functions. // SortHint is a SuiteSparse:GraphBLAS extension. SortHint DescField = 35 // Compression selects the compression for [Matrix.Serialize]. // Compression is a SuiteSparse:GraphBLAS extension. Compression DescField = 36 // Import selects between secure and fast packing. // Import is a SuiteSparse:GraphBLAS extension. Import DescField = 37 // a SuiteSparse:GraphBLAS extension )
Descriptor field names.
type DescValue ¶
type DescValue int
DescValue is the descriptor value enumeration.
const ( Default DescValue = iota // a SuiteSparse:GraphBLAS extension Replace Comp Tran Structure // AxBGustavson selects an extended version of Gustavson's method for [AxBMethod]. // AxBGustavson is a SuiteSparse:GraphBLAS extension. AxBGustavson DescValue = 1001 // AxBDot selects a very specialized method for [AxBMethod] that works well only if the // mask is present, very sparse, and not complemented, when the output matrix is very // small, or when the output matrix is bitmap or full. // AxBDot is a SuiteSparse:GraphBLAS extension. AxBDot DescValue = 1003 // AxBHash selects a hash-based method for [AxBMethod]. // AxBHash is a SuiteSparse:GraphBLAS extension. AxBHash DescValue = 1004 // AxBSaxpy selects a saxpy-based method for [AxBMethod]. // AxBSaxpy is a SuiteSparse:GraphBLAS extension. AxBSaxpy DescValue = 1005 // SecureImport informs the pack functions that the data is being packed // from an untrusted source, so additional checks will be made. // SecureImport is a SuiteSparse:GraphBLAS extension. SecureImport DescValue = 502 // PreferSorted provides a hint to [MxM], [MxV], [VxM], and reduction functions // to sort the output result. (This can be any value other than 0.) // PreferSorted is a SuiteSparse:GraphBLAS extension. PreferSorted DescValue = 999 // CompressionNone selects no compression for [Matrix.Serialize]. // CompressionNone is a SuiteSparse:GraphBLAS extension. CompressionNone DescValue = -1 // CompressionLZ4 selects LZ4 compression for [Matrix.Serialize]. // CompressionLZ4 is a SuiteSparse:GraphBLAS extension. CompressionLZ4 DescValue = 1000 // CompressionLZ4HC selects LZ4HC with default level 9 for [Matrix.Serialize]. // CompressionLZ4HC is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC DescValue = 2000 // CompressionLZ4HC1 selects LZ4HC with level 1 for [Matrix.Serialize]. // CompressionLZ4HC1 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC1 DescValue = 2001 // CompressionLZ4HC2 selects LZ4HC with level 2 for [Matrix.Serialize]. // CompressionLZ4HC2 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC2 DescValue = 2002 // CompressionLZ4HC3 selects LZ4HC with level 3 for [Matrix.Serialize]. // CompressionLZ4HC3 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC3 DescValue = 2003 // CompressionLZ4HC4 selects LZ4HC with level 4 for [Matrix.Serialize]. // CompressionLZ4HC4 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC4 DescValue = 2004 // CompressionLZ4HC5 selects LZ4HC with level 5 for [Matrix.Serialize]. // CompressionLZ4HC5 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC5 DescValue = 2005 // CompressionLZ4HC6 selects LZ4HC with level 6 for [Matrix.Serialize]. // CompressionLZ4HC6 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC6 DescValue = 2006 // CompressionLZ4HC7 selects LZ4HC with level 7 for [Matrix.Serialize]. // CompressionLZ4HC7 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC7 DescValue = 2007 // CompressionLZ4HC8 selects LZ4HC with level 8 for [Matrix.Serialize]. // CompressionLZ4HC8 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC8 DescValue = 2008 // CompressionLZ4HC9 selects LZ4HC with level 9 for [Matrix.Serialize]. // CompressionLZ4HC9 is a SuiteSparse:GraphBLAS extension. CompressionLZ4HC9 DescValue = 2009 // CompressionZSTD selects ZSTD with default level 1 for [Matrix.Serialize]. // CompressionZSTD is a SuiteSparse:GraphBLAS extension. CompressionZSTD DescValue = 3000 // CompressionZSTD1 selects ZSTD with level 1 for [Matrix.Serialize]. // CompressionZSTD1 is a SuiteSparse:GraphBLAS extension. CompressionZSTD1 DescValue = 3001 // CompressionZSTD2 selects ZSTD with level 2 for [Matrix.Serialize]. // CompressionZSTD2 is a SuiteSparse:GraphBLAS extension. CompressionZSTD2 DescValue = 3002 // CompressionZSTD3 selects ZSTD with level 3 for [Matrix.Serialize]. // CompressionZSTD3 is a SuiteSparse:GraphBLAS extension. CompressionZSTD3 DescValue = 3003 // CompressionZSTD4 selects ZSTD with level 4 for [Matrix.Serialize]. // CompressionZSTD4 is a SuiteSparse:GraphBLAS extension. CompressionZSTD4 DescValue = 3004 // CompressionZSTD5 selects ZSTD with level 5 for [Matrix.Serialize]. // CompressionZSTD5 is a SuiteSparse:GraphBLAS extension. CompressionZSTD5 DescValue = 3005 // CompressionZSTD6 selects ZSTD with level 6 for [Matrix.Serialize]. // CompressionZSTD6 is a SuiteSparse:GraphBLAS extension. CompressionZSTD6 DescValue = 3006 // CompressionZSTD7 selects ZSTD with level 7 for [Matrix.Serialize]. // CompressionZSTD7 is a SuiteSparse:GraphBLAS extension. CompressionZSTD7 DescValue = 3007 // CompressionZSTD8 selects ZSTD with level 8 for [Matrix.Serialize]. // CompressionZSTD8 is a SuiteSparse:GraphBLAS extension. CompressionZSTD8 DescValue = 3008 // CompressionZSTD9 selects ZSTD with level 9 for [Matrix.Serialize]. // CompressionZSTD9 is a SuiteSparse:GraphBLAS extension. CompressionZSTD9 DescValue = 3009 // CompressionZSTD10 selects ZSTD with level 10 for [Matrix.Serialize]. // CompressionZSTD10 is a SuiteSparse:GraphBLAS extension. CompressionZSTD10 DescValue = 3010 // CompressionZSTD11 selects ZSTD with level 11 for [Matrix.Serialize]. // CompressionZSTD11 is a SuiteSparse:GraphBLAS extension. CompressionZSTD11 DescValue = 3011 // CompressionZSTD12 selects ZSTD with level 12 for [Matrix.Serialize]. // CompressionZSTD12 is a SuiteSparse:GraphBLAS extension. CompressionZSTD12 DescValue = 3012 // CompressionZSTD13 selects ZSTD with level 13 for [Matrix.Serialize]. // CompressionZSTD13 is a SuiteSparse:GraphBLAS extension. CompressionZSTD13 DescValue = 3013 // CompressionZSTD14 selects ZSTD with level 14 for [Matrix.Serialize]. // CompressionZSTD14 is a SuiteSparse:GraphBLAS extension. CompressionZSTD14 DescValue = 3014 // CompressionZSTD15 selects ZSTD with level 15 for [Matrix.Serialize]. // CompressionZSTD15 is a SuiteSparse:GraphBLAS extension. CompressionZSTD15 DescValue = 3015 // CompressionZSTD16 selects ZSTD with level 16 for [Matrix.Serialize]. // CompressionZSTD16 is a SuiteSparse:GraphBLAS extension. CompressionZSTD16 DescValue = 3016 // CompressionZSTD17 selects ZSTD with level 17 for [Matrix.Serialize]. // CompressionZSTD17 is a SuiteSparse:GraphBLAS extension. CompressionZSTD17 DescValue = 3017 // CompressionZSTD18 selects ZSTD with level 18 for [Matrix.Serialize]. // CompressionZSTD18 is a SuiteSparse:GraphBLAS extension. CompressionZSTD18 DescValue = 3018 // CompressionZSTD19 selects ZSTD with level 19 for [Matrix.Serialize]. // CompressionZSTD19 is a SuiteSparse:GraphBLAS extension. CompressionZSTD19 DescValue = 3019 )
Descriptor field values.
type Descriptor ¶
type Descriptor struct {
// contains filtered or unexported fields
}
A Descriptor is used to modify the behavior of a GraphBLAS method. When present in the signature of a method, they appear as the last argument in the method. Descriptors specify how the other input arguments corresponding to GraphBLAS collections – vectors, matrices, and masks – should be processed (modified) before the main operation of a method is performed.
If a default descriptor is desired, nil should be specified. Non-default field/value pairs are as follows: If the Replace descriptor is set for Outp, then the output vector or matrix is cleared (all elements removed) before the result is stored in it. If the Structure descriptor is set for Mask, then the write mask is constructed from the structure (pattern of stored values) of the input mask vector or matrix. The stored values are not examined. If the Comp descriptor is set for Mask, then the complement of mask is used. If the Tran descriptor is set for Inp0, then the transpose of the first non-mask input matrix is used for the operation. If the Tran descriptor is set for Inp1, then the transpose of the second non-mask input matrix is used for the operation.
The descriptor is a lightweight object. It is composed of (field, value) pairs where the field selects one of the GraphBLAS objects from the argument list of a method and the value defines the indicated modification associated with that object.
For the purpose of constructing descriptors, the arguments of a method that can be modified are identified by specific field names. The output parameter (typically the first parameter in a GraphBLAS method) is indicated by the field name, Outp. The mask is indicated by the Mask field name. The input parameters corresponding to the input vectors and matrices are indicated by Inp0 and Inp1 in the order they appear in the signature of the GraphBLAS method. The descriptor is an opaque object and hence we do not define how objects of this type should be implemented.
In the definitions of the GraphBLAS methods, we often refer to the default behavior of a method with respect to the action of a descriptor. If a descriptor is not provided or if the value associated with a particular field in a descriptor is not set, the default behavior of a GraphBLAS method is defined as follows:
- Input matrices are not transposed.
- The mask is used, as is, without complementing, and stored values are examined to determine whether they evaluate to true or false.
- Values of the output object that are not directly modified by the operation are preserved.
GraphBLAS specifies all of the valid combinations of (field, value) pairs as predefined descriptors.
func DescriptorNew ¶
func DescriptorNew() (descriptor Descriptor, err error)
DescriptorNew creates a new (empty or default) descriptor.
GraphBLAS execution errors that may cause a panic:
func (Descriptor) Err ¶
func (descriptor Descriptor) Err() (string, error)
Err returns an error message about any errors encountered during the processing associated with the descriptor.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Descriptor) Free ¶
func (descriptor *Descriptor) Free() error
Free destroys a previously created Descriptor and releases any resources associated with it. Calling Free on an object that is not Descriptor.Valid() is legal. The behavior of a program that calls Free on a pre-defined descriptor is undefined.
GraphBLAS execution errors that may cause a panic:
func (Descriptor) Get ¶
func (descriptor Descriptor) Get(field DescField) (DescValue, error)
Get the content for a field of an existing descriptor.
Get is a SuiteSparse:GraphBLAS extension.
func (Descriptor) Print ¶
func (descriptor Descriptor) Print(name string, pr PrintLevel) error
Print the contents of the descriptor to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: descriptor is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Descriptor) Set ¶
func (descriptor Descriptor) Set(field DescField, value DescValue) error
Set the content for a field for an existing descriptor.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Descriptor) Valid ¶
func (descriptor Descriptor) Valid() bool
Valid returns true if descriptor has been created by a successful call to DescriptorNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
func (Descriptor) Wait ¶
func (descriptor Descriptor) Wait(mode WaitMode) error
Wait until function calls in a sequence put the descriptor into a state of completion or materialization.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
type EntryIterator ¶
type EntryIterator[D any] struct { // contains filtered or unexported fields }
An EntryIterator iterates across the entries of a matrix. Accessing all of the entries of a matrix requires just a single loop. Any matrix can be accessed with an entry iterator.
EntryIterator is a SuiteSparse:GraphBLAS extension.
func (EntryIterator) Err ¶
Err returns an error message about any errors encountered during the processing associated with the iterator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*EntryIterator) Free ¶
func (it *EntryIterator) Free() error
Free destroys a previously created VectorIterator, RowIterator, ColIterator, or EntryIterator and releases any resources associated with it. Calling Free on an object that is not valid is legal.
GraphBLAS execution errors that may cause a panic:
func (EntryIterator) Get ¶
func (it EntryIterator) Get() D
Get returns the value of the current iterator entry.
Get is a SuiteSparse:GraphBLAS extension.
func (EntryIterator[D]) GetIndex ¶
GetIndex returns the current row and column index.
GetIndex is a SuiteSparse:GraphBLAS extension.
func (EntryIterator[D]) Getp ¶
func (it EntryIterator[D]) Getp() int
Getp returns the current position of the iterator.
Getp is a SuiteSparse:GraphBLAS extension.
func (EntryIterator[D]) Getpmax ¶
func (it EntryIterator[D]) Getpmax() int
Getpmax returns Matrix.Nvals() for sparse, hypersparse, and full matrices; or Matrix.Nrows() * Matrix.Ncols() for bitmap matrices.
Getpmax is a SuiteSparse:GraphBLAS extension.
func (EntryIterator[D]) Next ¶
Next moves the iterator to the next entry. It returns true, nil if the iterator is at an entry that exists in the matrix, or false, nil otherwise.
Next is a SuiteSparse:GraphBLAS extension.
func (EntryIterator[D]) Seek ¶
Seek moves the entry iterator to the given position p, which is in the range 0 to pmax - 1, with pmax = EntryIterator.Getpmax(). For sparse, hypersparse, and full matrices, pmax is the same as Matrix.Nvals(). For bitmap matrices, pmax is equal to Matrix.Nrows() * Matrix.Ncols().
If p >= pmax, the iterator is exhausted and false, nil is returned. Otherwise true, nil is returned.
All entries in the matrix are given an ordinal position p. Seeking to position p will either move the iterator to that particular position, or to the next higher position containing an entry if there is no entry at position p. The latter case only occurs for bitmap matrices. Use EntryIterator.Getp to determine the current position of the iterator.
Seek is a SuiteSparse:GraphBLAS extension.
func (EntryIterator) Valid ¶
func (it EntryIterator) Valid() bool
Valid returns true if the iterator has been created by a successful call to Vector.IteratorNew, Matrix.IteratorNew, Matrix.RowIteratorNew, or Matrix.ColIteratorNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Float ¶
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type Format ¶
type Format int
A Format specifies the external format for MatrixImport and Matrix.Export.
const ( CsrFormat Format = iota // compressed sparse row matrix format CscFormat // compressed sparse column matrix format CooFormat // sparse coordinate matrix format )
External formats for MatrixImport and Matrix.Export.
type Index ¶
type Index = int
Index is the index type used for accessing elements of vectors and matrices.
Unlike in the GraphBLAS C API, this is Go's default signed int type, not C's unsigned uint64_t type. This fits much better with the rest of Go due to int being the default type for integer constants in Go.
The forGraphBLASGo API does not use the Index type, but directly uses int instead.
The range of valid values for a variable of type Index is [0, IndexMax].
Sets of indices are represented as slices of int ([]int]). Likewise, sets of scalar values are represented as slices of the corresponding type, for example []float64. Some GraphBLAS operations (for example, MatrixAssign) include an input parameter with the type of an index slice. This input index slice selects a subset of elements from a GraphBLAS vector or matrix object to be used in the operation. In these cases, the function All can be used to indicate that all indices of the associated GraphBLAS vector or matrix object up to a certain index should be used.
User-defined index slices should not include negative indices. Functions All, Range, Stride and Backwards may create slices with negative indices to mark special cases that are properly understood by forGraphBLASGo functions. The meaning of these markers may silently change in future versions of the forGraphBLASGo API.
type IndexUnaryFunction ¶
type IndexUnaryFunction C.GxB_index_unary_function
IndexUnaryFunction is the C type for index unary function:
typedef void (*GxB_index_unary_function) (void *, const void *, GrB_Index, GrB_Index, const void *) ;
type IndexUnaryOp ¶
type IndexUnaryOp[Dout, Din1, Din2 any] struct { // contains filtered or unexported fields }
IndexUnaryOp represents a GraphBLAS function that takes arguments of type Din1, GrB_Index, GrB_Index, and Din2, and returns an argument of type Dout.
func ColIndex ¶
func ColIndex[D int32 | int64 | int, Any any]() (f IndexUnaryOp[D, Any, D])
ColIndex is f(a(i, j), i, j, s) = j + s
func Colgt ¶
func Colgt[Any any]() IndexUnaryOp[bool, Any, int64]
Colgt is f(a(i, j), i, j, s) = j > s
func Colle ¶
func Colle[Any any]() IndexUnaryOp[bool, Any, int64]
Colle is f(a(i, j), i, j, s) = j <= s
func Diag ¶
func Diag[Any any]() IndexUnaryOp[bool, Any, int64]
Diag is f(a(i, j), i, j, s) = j == i + s
func DiagIndex ¶
func DiagIndex[D int32 | int64 | int, Any any]() (f IndexUnaryOp[D, Any, D])
DiagIndex is f(a(i, j), i, j, s) = j - i + s
func IndexUnaryOpNew ¶
func IndexUnaryOpNew[Dout, Din1, Din2 any](indexUnaryFunc IndexUnaryFunction) (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2], err error)
IndexUnaryOpNew returns a new GraphBLAS index unary operator with a specified user-defined function in C and its types (domains).
Parameters:
- indexUnaryFunc (IN): A pointer to a user-defined function in C that takes an input parameters of type Din1, GrB_Index, GrB_Index and Din2, and returns a value of type Dout. Except for the GrB_Index parameters, all are passed as void pointers. Dout, Din1, and Din2 should be one of the Predefined GraphBLAS types, one of the Complex GraphBLAS types, or a user-defined GraphBLAS type.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func NamedIndexUnaryOpNew ¶
func NamedIndexUnaryOpNew[Dout, Din1, Din2 any](indexUnaryFunc IndexUnaryFunction, idxopname string, idxopdefn string) (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2], err error)
NamedIndexUnaryOpNew creates a named index unary function. It is like IndexUnaryOpNew, except:
- idxopname is the name for the GraphBLAS index unary operator. Only the first 127 characters are used.
- idxopdefn is a string containing the entire function itself.
The two strings idxopname and idxopdefn are optional, but are required to enable the JIT compilation of kernels that use this operator.
If the JIT is enabled, or if the corresponding JIT kernel has been copied into the PreJIT folder, the function may be nil. In this case, a JIT kernel is compiled that contains just the user-defined function. If the JIT is disabled and the function is nil, this method panics with a NullPointer error.
NamedIndexUnaryOpNew is a SuiteSparse:GraphBLAS extension.
func Offdiag ¶
func Offdiag[Any any]() IndexUnaryOp[bool, Any, int64]
Offdiag is f(a(i, j), i, j, s) = j != i + s
func RowIndex ¶
func RowIndex[D int32 | int64 | int, Any any]() (f IndexUnaryOp[D, Any, D])
RowIndex is
- for matrices: f(a(i, j), i, j, s) = i + s
- for vectors: f(u(i), i, 0, s) = i + s
func Rowgt ¶
func Rowgt[Any any]() IndexUnaryOp[bool, Any, int64]
Rowgt is
- for matrices: f(a(i, j), i, j, s) = i > s
- for vectors: f(u(i), i, 0, s) = i > s
func Rowle ¶
func Rowle[Any any]() IndexUnaryOp[bool, Any, int64]
Rowle is
- for matrices: f(a(i, j), i, j, s) = i <= s
- for vectors: f(u(i), i, 0, s) = i <= s
func Tril ¶
func Tril[Any any]() IndexUnaryOp[bool, Any, int64]
Tril is f(a(i, j), i, j, s) = j <= i + s
func Triu ¶
func Triu[Any any]() IndexUnaryOp[bool, Any, int64]
Triu is f(a(i, j), i, j, s) = j >= i + s
func Valueeq ¶
func Valueeq[D Predefined | Complex]() (f IndexUnaryOp[bool, D, D])
Valueeq is
- for matrices: f(a(i, j), i, j, s) = a(i, j) == s
- for vectors: f(u(i), i, 0, s) = u(i) == s
func Valuege ¶
func Valuege[D Predefined]() (f IndexUnaryOp[bool, D, D])
Valuege is
- for matrices: f(a(i, j), i, j, s) = a(i, j) >= s
- for vectors: f(u(i), i, 0, s) = u(i) >= s
func Valuegt ¶
func Valuegt[D Predefined]() (f IndexUnaryOp[bool, D, D])
Valuegt is
- for matrices: f(a(i, j), i, j, s) = a(i, j) > s
- for vectors: f(u(i), i, 0, s) = u(i) > s
func Valuele ¶
func Valuele[D Predefined]() (f IndexUnaryOp[bool, D, D])
Valuele is
- for matrices: f(a(i, j), i, j, s) = a(i, j) < s
- for vectors: f(u(i), i, 0, s) = u(i) < s
func Valuelt ¶
func Valuelt[D Predefined]() (f IndexUnaryOp[bool, D, D])
Valuelt is
- for matrices: f(a(i, j), i, j, s) = a(i, j) < s
- for vectors: f(u(i), i, 0, s) = u(i) < s
func Valuene ¶
func Valuene[D Predefined | Complex]() (f IndexUnaryOp[bool, D, D])
Valuene is
- for matrices: f(a(i, j), i, j, s) = a(i, j) != s
- for vectors: f(u(i), i, 0, s) = u(i) != s
func (IndexUnaryOp[Dout, Din1, Din2]) Err ¶
func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Err() (string, error)
Err returns an error message about any errors encountered during the processing associated with the index unary operator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*IndexUnaryOp[Dout, Din1, Din2]) Free ¶
func (indexUnaryOp *IndexUnaryOp[Dout, Din1, Din2]) Free() error
Free destroys a previously created IndexUnaryOp and releases any resources associated with it. Calling Free on an object that is not IndexUnaryOp.Valid() is legal. The behavior of a program that calls Free on a pre-defined index unary operator is undefined.
GraphBLAS execution errors that may cause a panic:
func (IndexUnaryOp[Dout, Din1, Din2]) Print ¶
func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Print(name string, pr PrintLevel) error
Print the contents of the index unary operator to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: binaryOp is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (IndexUnaryOp[Dout, Din1, Din2]) Valid ¶
func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Valid() bool
Valid returns true if indexUnaryOp has been created by a successful call to IndexUnaryOpNew or NamedIndexUnaryOpNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
func (IndexUnaryOp[Dout, Din1, Din2]) Wait ¶
func (indexUnaryOp IndexUnaryOp[Dout, Din1, Din2]) Wait(mode WaitMode) error
Wait until function calls in a sequence put the index unary operator into a state of completion or materialization.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
type Info ¶
type Info int
Info is the default error type that is returned by all GraphBLAS functions. There are two types of return codes: API error and execution error.
API errors are returned to the caller of the corresponding GraphBLAS function, and need to be handled like other Go errors.
Execution errors cause a panic, and can be handled by recover.
The GraphBLAS C API specification also specifies informational codes as a third type of return code (GrB_SUCCESS and GrB_NO_VALUE). forGraphBLASGo functions do not return these informational codes, but instead return the nil error value to indicate successful execution of the function. In cases where it is important to have further information about the successful outcome, forGraphBLASGo functions return additional return values. (See for example Matrix.ExtractElement.)
This also applies to GxB_EXHAUSTED, which is an additional informational return code added by SuiteSparse:GraphBLAS as an extension: It is never returned by forGraphBLASGo, but instead translated into additional return values, where necessary. (GxB_EXHAUSTED is returned by some of the iterator functions in the C implementation.)
In Blocking mode, when an operation returns nil, it completed successfully. In NonBlocking mode, when an operation returns nil, this indicates that basic checks for input arguments passed successfully, like the compatibility tests on dimensions and domains for scalars, vectors and matrices. Either way, result scalars, vectors, or matrices are ready to be used in subsequent function calls.
type Integer ¶
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type JITControl ¶
type JITControl int
JITControl can be used to control the just-in-time compiler of SuiteSparse:GraphBLAS.
JITControl is a SuiteSparse:GraphBLAS extension.
const ( // JITOff means: do not use the JIT and free all JIT kernels if loaded JITOff JITControl = iota // JITPause means: do not run JIT kernels but keep any loaded JITPause // JITRun means: run JIT kernels if already loaded; no load/compile JITRun // JITLoad means: able to load and run JIT kernels; may not compile JITLoad // JITOn means: full JIT: able to compile, load, and run JITOn )
SuiteSparse:GraphBLAS extensions
func GlobalGetJITCControl ¶
func GlobalGetJITCControl() (control JITControl, err error)
GlobalGetJITCControl retrieves which functionalities of the just-in-time compiler are enabled and disabled. See JITControl.
GlobalGetJITCControl is a SuiteSparse:GraphBLAS extension.
func (JITControl) String ¶
func (control JITControl) String() string
type Layout ¶
type Layout int
Layout indicates whether a matrix is laid out by row or by column. This corresponds to GxB_FORMAT in SuiteSparse:GraphBLAS.
Layout is a SuiteSparse:GraphBLAS extension.
func GlobalGetLayout ¶
GlobalGetLayout retrieves the current global Layout (GxB_FORMAT) of matrices.
GlobalGetLayout a SuiteSparse:GraphBLAS extension.
type Matrix ¶
type Matrix[D any] struct { // contains filtered or unexported fields }
A Matrix is defined by a domain D, its number of rows M > 0, its number of columnns N > 0, and a set up tuples (i, j, a(i, j)), where 0 <= i < M, 0 <= j < N, and a(i, j) ∈ D. A particular pair of values i, j can occur at most once in a.
func MatrixDeserialize ¶
MatrixDeserialize constructs a new GraphBLAS matrix from a serialized object.
Parameters:
- data (IN): A slice that holds a GraphBLAS matrix created with Matrix.Serialize.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixImport ¶
func MatrixImport[D any]( nrows, ncols int, indptr, indices []int, values []D, format Format, ) (a Matrix[D], err error)
MatrixImport imports a matrix into a GraphBLAS object.
Parameters:
indptr (IN): A slice of row or column offsets, or row indices, depending on the value of format.
indices (IN): A slice of row or column indices of the elements in values, depending on the value of format.
values (IN): A slice of values.
format (IN): A value indicating the Format of the matrix being imported.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixNew ¶
MatrixNew creates a new matrix with specified domain and dimensions.
Parameters:
D: The type corresponding to the domain of the matrix being created. Can be one of the Predefined or Complex types, or an existing user-defined GraphBLAS type.
nrows (IN): The number of rows of the matrix being created.
ncols (IN): The number of columns of the matrix being created.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MatrixView ¶
func MatrixView[To, From Predefined | Complex](matrix Matrix[From]) (view Matrix[To])
MatrixView returns a view on the given matrix (with domain From) using a different domain To.
In the GraphBLAS specification for the C programming language, collections (scalars, vectors and matrices) of Predefined domains can be arbitrarily intermixed. In SuiteSparse:GraphBLAS, this extends to collections of Complex domains. When entries of collections are accessed expecting a particular domain (type), then the entry values are typecast using the rules of the C programming language. (Collections of user-defined domains are not compatible with any other collections in this way.)
In Go, generally only identical types are compatible with each other, and conversions are not implicit. To get around this restriction, ScalarView, VectorView and MatrixView can be used to view a collection using a different domain. These functions do not perform any conversion themselves, but are essentially NO-OPs.
MatrixView is a forGraphBLASGo extension.
func (Matrix[D]) AsMask ¶
AsMask returns a view on the given matrix using the domain bool.
In GraphBLAS, whenever a mask is required as an input parameter for a GraphBLAS operation, a matrix of any domain can be passed, and depending on whether Structure is set or not in the Descriptor passed to that operation, the only requirement is that the domain is compatible with bool. In the C programming language, this holds for any of the Predefined domains. In SuiteSparse:GraphBLAS, this extends to any of the Complex domains.
In Go, generally only identical types are compatible with each other, and conversions are not implicit. To get around this restriction, AsMask can be used to view a matrix as a bool mask. AsMask does not perform any conversion itself, but is essentially a NO-OP.
AsMask is a forGraphBLASGo extension.
func (Matrix[D]) Build ¶
func (matrix Matrix[D]) Build(rowIndices, colIndices []int, values []D, dup *BinaryOp[D, D, D]) error
Build stores elements from tuples in a matrix.
Parameters:
rowIndices: A slice of row indices.
colIndices: A slice of column indices.
values: A slice of scalars of type D.
dup: An associative and commutative binary operator to apply when duplicate values for the same location are present in the input slices. All three domains of dup must be D. If dup is nil, then duplicate locations will result in an InvalidValue error.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) BuildDiag ¶
func (matrix Matrix[D]) BuildDiag(v Vector[D], k int, desc *Descriptor) error
BuildDiag is identical to Vector.Diag, except for the extra Descriptor parameter, and this function is not a constructor. The matrix must already exist on input, of the correct size.
BuildDiag is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) BuildScalar ¶
BuildScalar is like Matrix.Build, except that the scalar is the value of all the tuples.
Unlike Matrix.Build, there is no dup operator to handle duplicate entries. Instead, any duplicates are silently ignored.
BuildScalar is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Clear ¶
Clear removes all elements (tuples) from the matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) ColIteratorNew ¶
func (matrix Matrix[D]) ColIteratorNew(desc *Descriptor) (it ColIterator[D], err error)
ColIteratorNew creates a column iterator and attaches it to the matrix.
GraphBLAS API errors that may be returned:
- NotImplemented: The matrix cannot be iterated by column.
GraphBLAS execution errors that may cause a panic:
ColIteratorNew is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Concat ¶
func (matrix Matrix[D]) Concat(tiles []Matrix[D], m, n int, desc *Descriptor) error
Concat concatenates a slice of matrices (tiles) into a single matrix.
Concat is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Dup ¶
Dup creates a new matrix with the same domain, dimensions, and contents as another matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) Export ¶
Export exports a GraphBLAS matrix to a pre-defined format.
Parameters:
- format (IN): A value indicating the Format in which the matrix will be exported.
Return Values:
indptr: A slice that will hold row or column offsets, or row indices, depending on the value of format.
indices: A slice that will hold row or column indices of the elements in values, depending on the value of format.
values: A slice that will hold stored values.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) ExportHint ¶
ExportHint provides a hint as to which storage format might be most efficient for exporting the matrix with Matrix.Export.
If the implementation does not have a preferred format, it may return ok == false.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) ExtractElement ¶
ExtractElement extracts one element of a matrix.
When there is no stored value at the specified location, ExtractElement returns ok == false. Otherwise, it returns ok == true.
To store the element in a Scalar object instead of returning a non-opaque value, use Matrix.ExtractElementScalar.
Parameters:
rowIndex (IN): Row index of element to be assigned.
colIndex (IN): Column index of element to be assigned.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) ExtractElementScalar ¶
ExtractElementScalar is like Matrix.ExtractElement, except that the element is stored in a Scalar object.
When there is no stored value at the specified location, the result becomes empty.
func (Matrix[D]) ExtractTuples ¶
ExtractTuples extracts the contents of a GraphBLAS matrix into non-opaque slices, by appending the row indices, column indices, and values to the slices passed to this function (by using Go's built-in append function).
Parameters:
rowIndices (INOUT): Pointer to a slice of indices. If nil, ExtractTuples does not produces the row indices of the matrix.
colIndices (INOUT): Pointer to a slice of indices. If nil, ExtractTuples does not produces the column indices of the matrix.
values (INOUT): Pointer to a slice of indices. If nil, ExtractTuples does not produces the values of the matrix.
It is valid to pass pointers to nil slices, and ExtractTuples then produces the corresponding indices or values.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Matrix[D]) Free ¶
Free destroys a previously created Matrix and releases any resources associated with it. Calling Free on an object that is not Matrix.Valid() is legal.
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) GetBitmapSwitch ¶
GetBitmapSwitch retrieves the current switch to bitmap. See Matrix.SetBitmapSwitch.
GetBitmapSwitch is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) GetHyperSwitch ¶
GetHyperSwitch retrieves the current switch to hypersparse. See Matrix.SetHyperSwitch.
GetHyperSwitch is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) GetLayout ¶
GetLayout retrieves the Layout (GxB_FORMAT) of the matrix.
GetLayout a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) GetSparsityControl ¶
GetSparsityControl retrieves the valid Sparsity format(s) of the matrix.
GetSparsityControl is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) GetSparsityStatus ¶
GetSparsityStatus retrieves the current Sparsity format of the matrix.
GetSparsityStatus is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) IsStoredElement ¶
IsStoredElement determines whether there is a stored value at the specified location or not.
Parameters:
rowIndex (IN): Row index of element to be assigned.
colIndex (IN): Column index of element to be assigned.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
IsStoredElement is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Iso ¶
Iso returns true if the matrix is iso-valued, false otherwise.
Iso is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) IteratorNew ¶
func (matrix Matrix[D]) IteratorNew(desc *Descriptor) (it EntryIterator[D], err error)
IteratorNew creates a entry iterator and attaches it to the matrix.
GraphBLAS execution errors that may cause a panic:
IteratorNew is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) MemoryUsage ¶
MemoryUsage returns the memory space required for a matrix, in bytes.
MemoryUsage is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Ncols ¶
Ncols retrieves the number of columns in a matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) Nrows ¶
Nrows retrieves the number of rows in a matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) Nvals ¶
Nvals retrieves the number of stored elements (tuples) in a matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) PackBitmapC ¶
func (matrix Matrix[D]) PackBitmapC(ab *SystemSlice[bool], ax *SystemSlice[D], iso bool, nvals int, desc *Descriptor) error
PackBitmapC packs a matrix from two user slices in bitmap format.
The matrix must exist on input with the right type and dimensions. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ab (INOUT): A SystemSlice that indicates which indices are present: If ab is true at i + j*nrows, then the entry at a(i, j) is present with value given by ax at i + j*nrows. If ab is false at a given index, the entry at that index is not present, and the value given by ax at that index is ignored.
ax (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting matrix is iso.
nvals (IN): The number of entries in the resulting vector.
On successful return, ab and ax are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting matrix. If not successful, ab and ax are not modified.
PackBitmapC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackBitmapCBytes ¶
func (matrix Matrix[D]) PackBitmapCBytes(ab, ax *SystemSlice[byte], iso bool, nvals int, desc *Descriptor) error
PackBitmapCBytes is like Matrix.PackBitmapC, except that ab and ax are passed as byte slices.
PackBitmapCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackBitmapR ¶
func (matrix Matrix[D]) PackBitmapR(ab *SystemSlice[bool], ax *SystemSlice[D], iso bool, nvals int, desc *Descriptor) error
PackBitmapR packs a matrix from two user slices in bitmap format.
The matrix must exist on input with the right type and dimensions. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ab (INOUT): A SystemSlice that indicates which indices are present: If ab is true at i*ncols + j, then the entry at a(i, j) is present with value given by ax at i*ncols + j. If ab is false at a given index, the entry at that index is not present, and the value given by ax at that index is ignored.
ax (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting matrix is iso.
nvals (IN): The number of entries in the resulting vector.
On successful return, ab and ax are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting matrix. If not successful, ab and ax are not modified.
PackBitmapR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackBitmapRBytes ¶
func (matrix Matrix[D]) PackBitmapRBytes(ab, ax *SystemSlice[byte], iso bool, nvals int, desc *Descriptor) error
PackBitmapRBytes is like Matrix.PackBitmapR, except that ab and ax are passed as byte slices.
PackBitmapRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackCSC ¶
func (matrix Matrix[D]) PackCSC(ap, ai *SystemSlice[int], ax *SystemSlice[D], iso, jumbled bool, desc *Descriptor) error
PackCSC packs a matrix from three user slices in CSC format.
In the resulting matrix, the CSC format is a sparse matrix with ByCol Layout. The matrix must exist on input with the right type and dimensions. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ap (INOUT): A SystemSlice of integers that defines where the row indices and values appear in ai and ax, for each column. The number of entries in column i is given by the expression ap[i+1] - ap[i]. ap must therefore have a length of at least ncols + 1.
ai (INOUT): A SystemSlice of row indices of the corresponding values in ax in each column, without duplicates per column. This is not checked, so the result is undefined if this is not the case.
ax (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting matrix is iso.
nvals (IN): The number of entries in the resulting matrix.
jumbled (IN): If false, the indices in ai must appear in sorted order within each column. This is not checked, so the result is undefined if this is not the case.
On successful return, ap, ai and ax are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting matrix. If not successful, ap, ai and ax are not modified.
PackCSC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackCSCBytes ¶
func (matrix Matrix[D]) PackCSCBytes(ap, ai, ax *SystemSlice[byte], iso, jumbled bool, desc *Descriptor) error
PackCSCBytes is like Matrix.PackCSC, except that ap, ai and ax are passed as byte slices.
PackCSCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackCSR ¶
func (matrix Matrix[D]) PackCSR(ap, aj *SystemSlice[int], ax *SystemSlice[D], iso, jumbled bool, desc *Descriptor) error
PackCSR packs a matrix from three user slices in CSR format.
In the resulting matrix, the CSR format is a sparse matrix with ByRow Layout. The matrix must exist on input with the right type and dimensions. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ap (INOUT): A SystemSlice of integers that defines where the column indices and values appear in aj and ax, for each row. The number of entries in row i is given by the expression ap[i+1] - ap[i]. ap must therefore have a length of at least nrows + 1.
aj (INOUT): A SystemSlice of column indices of the corresponding values in ax in each row, without duplicates per row. This is not checked, so the result is undefined if this is not the case.
ax (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting matrix is iso.
nvals (IN): The number of entries in the resulting matrix.
jumbled (IN): If false, the indices in aj must appear in sorted order within each row. This is not checked, so the result is undefined if this is not the case.
On successful return, ap, aj and ax are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting matrix. If not successful, ap, aj and ax are not modified.
PackCSR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackCSRBytes ¶
func (matrix Matrix[D]) PackCSRBytes(ap, aj, ax *SystemSlice[byte], iso, jumbled bool, desc *Descriptor) error
PackCSRBytes is like Matrix.PackCSRBytes, except that ap, aj and ax are passed as byte slices.
PackCSRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackFullC ¶
func (matrix Matrix[D]) PackFullC(ax *SystemSlice[D], iso bool, desc *Descriptor) error
PackFullC packs a matrix from a user slice in full format.
The matrix must exist on input with the right type and size. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ax (INOUT): A SystemSlice of values. All entries with index < nrows*ncols are present. Values at index i + j*nrows correspond to matrix entries a(i, j).
iso (IN): If true, the resulting matrix is iso.
On successful return, ax is empty, to indicate that the user application no longer owns it. It has instead been moved to the resulting matrix. If not successful, ax is not modified.
PackFullC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackFullCBytes ¶
func (matrix Matrix[D]) PackFullCBytes(ax *SystemSlice[byte], iso bool, desc *Descriptor) error
PackFullCBytes is like Matrix.PackFullC, except that ax is passed as a byte slice.
PackFullCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackFullR ¶
func (matrix Matrix[D]) PackFullR(ax *SystemSlice[D], iso bool, desc *Descriptor) error
PackFullR packs a matrix from a user slice in full format.
The matrix must exist on input with the right type and size. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ax (INOUT): A SystemSlice of values. All entries with index < nrows*ncols are present. Values at index i*ncols + j correspond to matrix entries a(i, j).
iso (IN): If true, the resulting matrix is iso.
On successful return, ax is empty, to indicate that the user application no longer owns it. It has instead been moved to the resulting matrix. If not successful, ax is not modified.
PackFullR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackFullRBytes ¶
func (matrix Matrix[D]) PackFullRBytes(ax *SystemSlice[byte], iso bool, desc *Descriptor) error
PackFullRBytes is like Matrix.PackFullR, except that ax is passed as a byte slice.
PackFullRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackHyperCSC ¶
func (matrix Matrix[D]) PackHyperCSC(ap, ah, ai *SystemSlice[int], ax *SystemSlice[D], iso bool, nvec int, jumbled bool, desc *Descriptor) error
PackHyperCSC packs a matrix from four user slices in hypersparse CSC format.
In the resulting matrix, the hypersparse CSC format is a sparse matrix with ByCol Layout. The matrix must exist on input with the right type and dimensions. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ap (INOUT): A SystemSlice of integers that defines where the row indices and values appear in ai and ax, for each present column. The number of entries in column ah[i] is given by the expression ap[i+1] - ap[i].
ah (INOUT): A SystemSlice of integers that defines which columns (column indices) are present. Columns that are not present are considered completely empty.
ai (INOUT): A SystemSlice of row indices of the corresponding values in ax in present columns, without duplicates per columns. This is not checked, so the result is undefined if this is not the case.
ax (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting matrix is iso.
nvec (IN): The number of columns that appear in ah.
jumbled (IN): If false, the indices in aj must appear in sorted order within each column. This is not checked, so the result is undefined if this is not the case.
On successful return, ap, ah, ai and ax are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting matrix. If not successful, ap, ah, ai and ax are not modified.
PackHyperCSC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackHyperCSCBytes ¶
func (matrix Matrix[D]) PackHyperCSCBytes(ap, ah, ai, ax *SystemSlice[byte], iso bool, nvec int, jumbled bool, desc *Descriptor) error
PackHyperCSCBytes is like Matrix.PackHyperCSC, except that ap, ah, ai and ax are passed as byte slices.
PackHyperCSCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackHyperCSR ¶
func (matrix Matrix[D]) PackHyperCSR(ap, ah, aj *SystemSlice[int], ax *SystemSlice[D], iso bool, nvec int, jumbled bool, desc *Descriptor) error
PackHyperCSR packs a matrix from four user slices in hypersparse CSR format.
In the resulting matrix, the hypersparse CSR format is a sparse matrix with ByRow Layout. The matrix must exist on input with the right type and dimensions. No type casting is done, so the domain D must correctly reflect Matrix.Type().
Parameters:
ap (INOUT): A SystemSlice of integers that defines where the column indices and values appear in aj and ax, for each present row. The number of entries in row ah[i] is given by the expression ap[i+1] - ap[i].
ah (INOUT): A SystemSlice of integers that defines which rows (row indices) are present. Rows that are not present are considered completely empty.
aj (INOUT): A SystemSlice of column indices of the corresponding values in ax in present rows, without duplicates per row. This is not checked, so the result is undefined if this is not the case.
ax (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting matrix is iso.
nvec (IN): The number of rows that appear in ah.
jumbled (IN): If false, the indices in aj must appear in sorted order within each row. This is not checked, so the result is undefined if this is not the case.
On successful return, ap, ah, aj and ax are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting matrix. If not successful, ap, ah, aj and ax are not modified.
PackHyperCSR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackHyperCSRBytes ¶
func (matrix Matrix[D]) PackHyperCSRBytes(ap, ah, aj, ax *SystemSlice[byte], iso bool, nvec int, jumbled bool, desc *Descriptor) error
PackHyperCSRBytes is like Matrix.PackHyperCSR, except that ap, ah, aj and ax are passed as byte slices.
PackHyperCSRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) PackHyperHash ¶
func (matrix Matrix[D]) PackHyperHash(hash *Matrix[int], desc *Descriptor) error
PackHyperHash assigns the input matrix as the hyper-hash of the matrix. The hyper-hash of a hypersparse matrix provides quick access to the inverse of ah.
If the matrix is not hypersparse, or if it already has a hyper-hash, then nothing happens, and the input matrix hash is unchanged. This is not an error condition. The input matrix hash is still owned by the user application and freeing it is the responsibility of the user application.
If the input matrix hash is moved into the matrix as its hyper-hash, then hash becomes not Matrix.Valid to indicate that it has been moved into the matrix. It is no longer owned by the caller.
Results are undefined if the input matrix hash was not created by Matrix.UnpackHyperHash, or if the matrix was modified after it was unpacked by Matrix.UnpackHyperCSR or Matrix.UnpackHyperCSC.
PackHyperHash is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Print ¶
func (matrix Matrix[D]) Print(name string, pr PrintLevel) error
Print the contents of the matrix to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: matrix is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) RemoveElement ¶
RemoveElement removes (annihilates) one stored element from a matrix.
Parameters:
rowIndex (IN): Row index of element to be removed.
colIndex (IN): Column index of element to be removed.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) Reshape ¶
func (matrix Matrix[D]) Reshape(byCol bool, nrowsNew, ncolsNew int, desc *Descriptor) error
Reshape changes the size of a matrix, taking its entries either column-wise or row-wise. If the matrix on input is nrows-by-ncols, and the requested dimensions on output are nrowsNew-by-ncolsNew, then the condition nrows*ncols == nrowsNew*ncolsNew must hold. The matrix is modified in-place.
To create a new matrix, use Matrix.ReshapeDup instead.
Parameters:
byCol (IN): true if reshape by column, false if by row
nrowsNew (IN): new number of rows
ncolsNew (IN): new number of columns
Reshape is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) ReshapeDup ¶
func (matrix Matrix[D]) ReshapeDup(byCol bool, nrowsNew, ncolsNew int, desc *Descriptor) (dup Matrix[D], err error)
ReshapeDup is identical to Matrix.Reshape, except that it creates a new output matrix instead of modified the matrix in-place.
ReshapeDup is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Resize ¶
Resize changes the dimensions of an existing matrix.
Parameters:
nrows (IN): The new number of rows of the matrix. It can be smaller or larger than the current number of rows.
ncolums (IN): The new number of colunms of the matrix. It can be smaller or larger than the current number of columns.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) RowIteratorNew ¶
func (matrix Matrix[D]) RowIteratorNew(desc *Descriptor) (it RowIterator[D], err error)
RowIteratorNew creates a row iterator and attaches it to the matrix.
GraphBLAS API errors that may be returned:
- NotImplemented: The matrix cannot be iterated by row.
GraphBLAS execution errors that may cause a panic:
RowIteratorNew is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Serialize ¶
Serialize a GraphBLAS matrix object into an opaque slice of bytes. Serialize returns the number of bytes written to data.
Parameters:
- data (INOUT): A preallocated buffer where the serialized matrix will be written.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) SerializeSize ¶
SerializeSize computes the buffer size (in bytes) necessary to serialize the matrix using Matrix.Serialize.
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) SetBitmapSwitch ¶
SetBitmapSwitch determines how the matrix is converted to the bitmap format.
Parameters:
- bitmapSwitch (IN): A value between 0 and 1.
SetBitmapSwitch is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) SetElement ¶
SetElement sets one element of a matrix to a given value.
To pass a Scalar object instead of a non-opaque variable, use Matrix.SetElementScalar.
Parameters:
val (IN): Scalar to assign.
rowIndex (IN): Row index of element to be assigned.
colIndex (IN): Column index of element to be assigned.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Matrix[D]) SetElementScalar ¶
SetElementScalar is like Matrix.SetElement, except that the scalar value is passed as a Scalar object. It may be empty.
func (Matrix[D]) SetHyperSwitch ¶
SetHyperSwitch determines how the matrix is converted between the hypersparse and non-hypersparse formats.
Parameters:
- hyperSwitch (IN): A value between 0 and 1. To force a matrix to always be non-hypersparse, use NeverHyper. To force a matrix to always stay hypersparse, use AlwaysHyper.
SetHyperSwitch is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) SetLayout ¶
SetLayout sets the Layout (GxB_FORMAT) of the matrix.
SetLayout is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) SetSparsityControl ¶
SetSparsityControl determines the valid Sparsity format(s) for the matrix.
SetSparsityControl is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Size ¶
Size retrieves the number of rows and columns in a matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
Size is a forGraphBLASGo extension.
func (Matrix[D]) Sort ¶
func (matrix Matrix[D]) Sort( into *Matrix[D], p *Matrix[int], op BinaryOp[bool, D, D], desc *Descriptor, ) error
Sort all the rows or all the columns of a matrix. Each row or column is sorted separately.
Parameters:
into (OUT): Contains the matrix of sorted values. If nil, this output is not produced.
p (OUT): Contains the permutations of the sorted values. If nil, this output is not produced.
op (IN): The comparator operation.
desc (IN): If the Tran descriptor is set for Inp0, then the columns of the matrix are sorted instead of the rows.
Sort is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Split ¶
func (matrix Matrix[D]) Split(tileNrows, tileNcols []int, desc *Descriptor) (tiles []Matrix[D], err error)
Split a single input matrix into a 2D slice of tiles.
Split is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Type ¶
Type returns the actual Type object representing the domain of the given matrix. This is not necessarily the Type object corresponding to D, if Type is called on a MatrixView of a matrix of some other domain.
Type might return false as a second return value if the domain is not a Predefined or Complex domain, or if the type has not been registered with TypeNew or NamedTypeNew.
Type is a forGraphBLASGo extension. It can be used in place of GxB_Matrix_type_name and GxB_Type_from_name, which are SuiteSparse:GraphBLAS extensions.
func (Matrix[D]) UnpackBitmapC ¶
func (matrix Matrix[D]) UnpackBitmapC(desc *Descriptor) (ab SystemSlice[bool], ax SystemSlice[D], iso bool, nvals int, err error)
UnpackBitmapC unpacks a matrix to user slices in bitmap format.
No type casting is done, so the domain D must correctly reflect Matrix.Type().
Return Values:
ab: A SystemSlice that indicates which indices are present: If ab is true at i + j*nrows, then the entry at a(i, j) is present with value given by vx at i + j*nrows. If ab is false at a given index, the entry at that index is not present, and the value given by ax at that index is ignored.
ax: A SystemSlice of values.
iso: If true, the input vector was iso.
nvals: The number of entries in the resulting slices.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slices. If not successful, the input matrix is not modified.
UnpackBitmapC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackBitmapCBytes ¶
func (matrix Matrix[D]) UnpackBitmapCBytes(desc *Descriptor) (ab, ax SystemSlice[byte], iso bool, nvals int, err error)
UnpackBitmapCBytes is like Matrix.UnpackBitmapC, except that ab and ax are returned as bytes slices.
UnpackBitmapCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackBitmapR ¶
func (matrix Matrix[D]) UnpackBitmapR(desc *Descriptor) (ab SystemSlice[bool], ax SystemSlice[D], iso bool, nvals int, err error)
UnpackBitmapR unpacks a matrix to user slices in bitmap format.
No type casting is done, so the domain D must correctly reflect Matrix.Type().
Return Values:
ab: A SystemSlice that indicates which indices are present: If ab is true at i*ncols + j, then the entry at a(i, j) is present with value given by vx at i*ncols + j. If ab is false at a given index, the entry at that index is not present, and the value given by ax at that index is ignored.
ax: A SystemSlice of values.
iso: If true, the input vector was iso.
nvals: The number of entries in the resulting slices.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slices. If not successful, the input matrix is not modified.
UnpackBitmapR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackBitmapRBytes ¶
func (matrix Matrix[D]) UnpackBitmapRBytes(desc *Descriptor) (ab, ax SystemSlice[byte], iso bool, nvals int, err error)
UnpackBitmapRBytes is like Matrix.UnpackBitmapR, except that ab and ax are returned as byte slices.
UnpackBitmapRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackCSC ¶
func (matrix Matrix[D]) UnpackCSC(allowJumbled bool, desc *Descriptor) (ap, ai SystemSlice[int], ax SystemSlice[D], iso, jumbled bool, err error)
UnpackCSC unpacks a matrix to user slices in CSC format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
- allowJumbled (IN): If false, the indices in ai appear in ascending order within each column. If true, the indices may appear in any order within each column.
Return Values:
ap: A SystemSlice of integers that defines where the row indices and values appear in ai and ax, for each column. The number of entries in column i is given by the expression ap[i+1] - ap[i]. ap therefore has a length of at least ncols + 1.
ai: A SystemSlice of row indices of the corresponding values in ax in each column, without duplicates per column.
ax: A SystemSlice of values.
iso: If true, the input matrix was iso.
nvals: The number of entries in the resulting slices.
jumbled: If false, the indices in ai appear in sorted order within each column.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slices. If not successful, the input matrix is not modified.
UnpackCSC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackCSCBytes ¶
func (matrix Matrix[D]) UnpackCSCBytes(allowJumbled bool, desc *Descriptor) (ap, ai, ax SystemSlice[byte], iso, jumbled bool, err error)
UnpackCSCBytes is like Matrix.UnpackCSC, except that ap, ai and ax are returned as byte slices.
UnpackCSCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackCSR ¶
func (matrix Matrix[D]) UnpackCSR(allowJumbled bool, desc *Descriptor) (ap, aj SystemSlice[int], ax SystemSlice[D], iso, jumbled bool, err error)
UnpackCSR unpacks a matrix to user slices in CSR format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
- allowJumbled (IN): If false, the indices in aj appear in ascending order within each row. If true, the indices may appear in any order within each row.
Return Values:
ap: A SystemSlice of integers that defines where the column indices and values appear in aj and ax, for each row. The number of entries in row i is given by the expression ap[i+1] - ap[i]. ap therefore has a length of at least nrows + 1.
aj: A SystemSlice of column indices of the corresponding values in ax in each row, without duplicates per row.
ax: A SystemSlice of values.
iso: If true, the input matrix was iso.
nvals: The number of entries in the resulting slices.
jumbled: If false, the indices in aj appear in sorted order within each row.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slices. If not successful, the input matrix is not modified.
UnpackCSR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackCSRBytes ¶
func (matrix Matrix[D]) UnpackCSRBytes(allowJumbled bool, desc *Descriptor) (ap, aj, ax SystemSlice[byte], iso, jumbled bool, err error)
UnpackCSRBytes is like Matrix.UnpackCSR, except that ap, aj and ax are returned as byte slices.
UnpackCSRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackFullC ¶
func (matrix Matrix[D]) UnpackFullC(desc *Descriptor) (ax SystemSlice[D], iso bool, err error)
UnpackFullC unpacks a matrix to a user slice in full format.
No type casting is done, so the domain D must correctly reflect Matrix.Type().
Return Values:
ax: A SystemSlice of values. All entries with index < nrows*ncols are present. Values at index i + j*nrows correspond to matrix entries a(i, j).
iso: If true, the input matrix was iso.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slice. If not successful, the input matrix is not modified.
UnpackFullC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackFullCBytes ¶
func (matrix Matrix[D]) UnpackFullCBytes(desc *Descriptor) (ax SystemSlice[byte], iso bool, err error)
UnpackFullCBytes is like Matrix.UnpackFullC, except that ax is returned as a byte slice.
UnpackFullCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackFullR ¶
func (matrix Matrix[D]) UnpackFullR(desc *Descriptor) (ax SystemSlice[D], iso bool, err error)
UnpackFullR unpacks a matrix to a user slice in full format.
No type casting is done, so the domain D must correctly reflect Matrix.Type().
Return Values:
ax: A SystemSlice of values. All entries with index < nrows*ncols are present. Values at index i*ncols + j correspond to matrix entries a(i, j).
iso: If true, the input matrix was iso.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slice. If not successful, the input matrix is not modified.
UnpackFullR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackFullRBytes ¶
func (matrix Matrix[D]) UnpackFullRBytes(desc *Descriptor) (ax SystemSlice[byte], iso bool, err error)
UnpackFullRBytes is like Matrix.UnpackFullRBytes, except that ax is return as a byte slice.
UnpackFullRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackHyperCSC ¶
func (matrix Matrix[D]) UnpackHyperCSC(allowJumbled bool, desc *Descriptor) (ap, ah, ai SystemSlice[int], ax SystemSlice[D], iso bool, nvec int, jumbled bool, err error)
UnpackHyperCSC unpacks a matrix to user slices in hypersparse CSC format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
- allowJumbled (IN): If false, the indices in ai appear in ascending order within each column. If true, the indices may appear in any order within each column.
Return Values:
ap: A SystemSlice of integers that defines where the rows indices and values appear in ai and ax, for each present column. The number of entries in column ah[i] is given by the expression ap[i+1] - ap[i].
ah: A SystemSlice of integers that defines which columns (column indices) are present. Columns that are not present are considered completely empty.
ai: A SystemSlice of row indices of the corresponding values in ax in present columns, without duplicates per columns.
ax: A SystemSlice of values.
iso: If true, the input matrix was iso.
nvec: The number of columns that appear in ah.
jumbled: If false, the indices in aj appear in sorted order within each column.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slices. If not successful, the input matrix is not modified.
UnpackHyperCSC is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackHyperCSCBytes ¶
func (matrix Matrix[D]) UnpackHyperCSCBytes(allowJumbled bool, desc *Descriptor) (ap, ah, ai, ax SystemSlice[byte], iso bool, nvec int, jumbled bool, err error)
UnpackHyperCSCBytes is like Matrix.UnpackHyperCSC, except that ap, ah, ai and ax are returned as byte slices.
UnpackHyperCSCBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackHyperCSR ¶
func (matrix Matrix[D]) UnpackHyperCSR(allowJumbled bool, desc *Descriptor) (ap, ah, aj SystemSlice[int], ax SystemSlice[D], iso bool, nvec int, jumbled bool, err error)
UnpackHyperCSR unpacks a matrix to user slices in hypersparse CSR format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
- allowJumbled (IN): If false, the indices in aj appear in ascending order within each row. If true, the indices may appear in any order within each row.
Return Values:
ap: A SystemSlice of integers that defines where the column indices and values appear in aj and ax, for each present row. The number of entries in row ah[i] is given by the expression ap[i+1] - ap[i].
ah: A SystemSlice of integers that defines which rows (row indices) are present. Rows that are not present are considered completely empty.
aj: A SystemSlice of column indices of the corresponding values in ax in present rows, without duplicates per row.
ax: A SystemSlice of values.
iso: If true, the input matrix was iso.
nvec: The number of rows that appear in ah.
jumbled: If false, the indices in aj appear in sorted order within each row.
On successful return, the input matrix has no entries anymore, and the user application now owns the resulting slices. If not successful, the input matrix is not modified.
UnpackHyperCSR is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackHyperCSRBytes ¶
func (matrix Matrix[D]) UnpackHyperCSRBytes(allowJumbled bool, desc *Descriptor) (ap, ah, aj, ax SystemSlice[byte], iso bool, nvec int, jumbled bool, err error)
UnpackHyperCSRBytes is like Matrix.UnpackHyperCSR, except that ap, ah, aj and ax are returned as byte slices.
UnpackHyperCSRBytes is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) UnpackHyperHash ¶
func (matrix Matrix[D]) UnpackHyperHash(desc *Descriptor) (hash Matrix[int], err error)
UnpackHyperHash unpacks the hyper-hash from the hypersparse matrix. The hyper-hash of a hypersparse matrix provides quick access to the inverse of ah.
If the matrix is not hypersparse or does not yet have a hyper-hash, then the resulting hash is not [Valid]. This is not an error condition. To ensure that a hyper-hash is constructed, call Matrix.Wait with Materialize.
On successful return, the hyper-hash is removed from the matrix, and it is the responsibility of the user application to free it.
UnpackHyperHash is a SuiteSparse:GraphBLAS extension.
func (Matrix[D]) Valid ¶
Valid returns true if matrix has been created by a successful call to Matrix.Dup, MatrixDeserialize, MatrixImport, MatrixNew, or Vector.Diag.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type MatrixMask ¶
A MatrixMask can be used to optionally control which results from a GraphBLAS operation are stored into an output matrix. The mask dimensions must match those of the output. If the Structure descriptor is not set for the mask, the domain of the mask matrix must be of type bool, any of the Predefined "built-in" types, or any of the Complex "built-in" types. Use Matrix.AsMask to convert to the required parameter type. If the default mask is desired (i.e., a mask that is all true with the dimensions of the output matrix), nil should be specified.
The forGraphBLASGo API does not use the MatrixMask type, but directly uses *Matrix[bool] instead.
type Mode ¶
type Mode int
A Mode specifies the execution mode for the Init or InitWithMalloc functions.
Execution modes for the Init and InitWithMalloc functions.
func GlobalGetMode ¶
GlobalGetMode retrieves whether GraphBLAS currently operates in blocking or non-blocking mode.
GlobalGetMode is a SuiteSparse:GraphBLAS extension.
type Monoid ¶
type Monoid[D any] struct { // contains filtered or unexported fields }
A Monoid is defined by a single domain D, an associative operation and an identity element. A GraphBLAS monoid is equivalent to the conventional monoid algebraic structure.
func AnyMonoid ¶
AnyMonoid is any value with identity being any value
AnyMonoid is a SuiteSparse:GraphBLAS extension.
func BandMonoid ¶
BandMonoid is bitwise and with identity being all bits one
BandMonoid is a SuiteSparse:GraphBLAS extension.
func BorMonoid ¶
BorMonoid is bitwise or with identity being all bits zero
BorMonoid is a SuiteSparse:GraphBLAS extension.
func BxnorMonoid ¶
BxnorMonoid is bitwise xnor with identity being all bits one
BxnorMonoid is a SuiteSparse:GraphBLAS extension.
func BxorMonoid ¶
BxorMonoid is bitwise xor with identity being all bits zero
BxorMonoid is a SuiteSparse:GraphBLAS extension.
func MonoidNew ¶
MonoidNew creates a new monoid with specified binary operator and identity value.
Parameters:
binaryOp (IN): An existing GraphBLAS associative binary operator whose input and output types are the same.
identity (IN): The value of the identity element of the monoid.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func MonoidTerminalNew ¶
func MonoidTerminalNew[D any](binaryOp BinaryOp[D, D, D], identity, terminal D) (monoid Monoid[D], err error)
MonoidTerminalNew is identical to MonoidNew, except that it allows for the specification of a terminal value.
The terminal value of a monoid is the value z for which z = f(z, y) for any y, where f is the binary operator of the monoid. If the terminal value is encountered during computation, the rest of the computations are skipped. This can greatly improve the performance of reductions, and matrix multiply in specific cases.
MonoidTerminalNew is a SuiteSparse:GraphBLAS extension.
func PlusMonoid ¶
PlusMonoid is addition with identity 0
func TimesMonoid ¶
TimesMonoid is multiplication with identity 1
func (Monoid[D]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the monoid.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Monoid[D]) Free ¶
Free destroys a previously created Monoid and releases any resources associated with it. Calling Free on an object that is not Monoid.Valid() is legal. The behavior of a program that calls Free on a pre-defined monoid is undefined.
GraphBLAS execution errors that may cause a panic:
func (Monoid[D]) Identity ¶
Identity returns the identity value of the monoid.
Identity is a SuiteSparse:GraphBLAS extension.
func (Monoid[D]) Operator ¶
Operator returns the binary operator of the monoid.
Operator is a SuiteSparse:GraphBLAS extension.
func (Monoid[D]) Print ¶
func (monoid Monoid[D]) Print(name string, pr PrintLevel) error
Print the contents of the monoid to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: monoid is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Monoid[D]) Terminal ¶
Terminal returns the terminal value of the monoid, if any.
If the monoid has a terminal value, then ok == true. If it has no terminal value, then ok == false.
Terminal is a SuiteSparse:GraphBLAS extension.
func (Monoid[D]) Valid ¶
Valid returns true if monoid has been created by a successful call to MonoidNew or MonoidTerminalNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Number ¶
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type Predefined ¶
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type PrintLevel ¶
type PrintLevel int
PrintLevel is a SuiteSparse:GraphBLAS extension.
const ( // Silent means that nothing is printed, just check the object. Silent PrintLevel = iota // Summary means that a terse summary is printed. Summary // Short means that a short description is printed, with about 30 entries. Short // Completely means that the entire contents of the object is printed. Completely // ShortVerbose is like [Short], but with more precision for floating point numbers. ShortVerbose // CompletelyVerbose is like [Completely], but with more precision for floating point numbers. CompletelyVerbose )
SuiteSparse:GraphBLAS extensions
func (PrintLevel) String ¶
func (printLevel PrintLevel) String() string
type RowIterator ¶
type RowIterator[D any] struct { // contains filtered or unexported fields }
A RowIterator iterates across the rows of a matrix, and then within each row to access the entries in a given row. Accessing all the entries of a matrix using a row iterator requires an outer loop (for the rows) and an inner loop (for the entries in each row). A matrix can be accessed via a row iterator only if its layout (determined by Matrix.GetLayout is ByRow.
RowIterator is a SuiteSparse:GraphBLAS extension.
func (RowIterator) Err ¶
Err returns an error message about any errors encountered during the processing associated with the iterator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*RowIterator) Free ¶
func (it *RowIterator) Free() error
Free destroys a previously created VectorIterator, RowIterator, ColIterator, or EntryIterator and releases any resources associated with it. Calling Free on an object that is not valid is legal.
GraphBLAS execution errors that may cause a panic:
func (RowIterator) Get ¶
func (it RowIterator) Get() D
Get returns the value of the current iterator entry.
Get is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) GetColIndex ¶
func (it RowIterator[D]) GetColIndex() int
GetColIndex returns the current column index.
GetColIndex is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) GetRowIndex ¶
func (it RowIterator[D]) GetRowIndex() int
GetRowIndex returns nrows(a) if the iterator is exhausted, or the current row index otherwise.
GetRowIndex is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) KSeek ¶
func (it RowIterator[D]) KSeek(k int) (ok, exhausted bool, err error)
KSeek moves a row iterator to the specified explicit row. For sparse, bitmap, and full matrices, this is the same as RowIterator.SeekRow.
Return Values:
- true, false, nil: The iterator has been moved to a row that contains at least one entry.
- false, false, nil: The iterator has been moved to a row with no entries.
- false, true, nil: k is out of bounds (>= kount).
KSeek is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) Kount ¶
func (it RowIterator[D]) Kount() int
Kount returns Matrix.Nrows for sparse, bitmap, and full matrices, and the number of explicit rows for hypersparse matrices.
Kount is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) NextCol ¶
func (it RowIterator[D]) NextCol() (ok bool, err error)
NextCol moves the iterator to the next entry in the current row.
Return Values:
- true, nil: The iterator has been moved to the next entry.
- false, nil: The end of the row is reached. The iterator does not move to the next row.
NextCol is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) NextRow ¶
func (it RowIterator[D]) NextRow() (ok, exhausted bool, err error)
NextRow moves the iterator to the next row.
If the matrix is hypersparse, the next row is always an explicit row. Implicit rows are skipped.
Return Values:
- true, false, nil: The iterator has been moved to a row that contains at least one entry.
- false, false, nil: The iterator has been moved to a row with no entries.
- false, true, nil: The iterator is exhausted.
NextRow is a SuiteSparse:GraphBLAS extension.
func (RowIterator[D]) SeekRow ¶
func (it RowIterator[D]) SeekRow(row int) (ok, exhausted bool, err error)
SeekRow moves a row iterator to the specified row.
For hypersparse matrices, if the requested row is implicit, the iterator is moved to the first explicit row following it. If no such row exists, the iterator is exhausted.
Return Values:
- true, false, nil: The iterator has been moved to a row that contains at least one entry.
- false, false, nil: The iterator has been moved to a row with no entries.
- false, true, nil: row is out of bounds (>= nrows).
SeekRow is a SuiteSparse:GraphBLAS extension.
func (RowIterator) Valid ¶
func (it RowIterator) Valid() bool
Valid returns true if the iterator has been created by a successful call to Vector.IteratorNew, Matrix.IteratorNew, Matrix.RowIteratorNew, or Matrix.ColIteratorNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Scalar ¶
type Scalar[D any] struct { // contains filtered or unexported fields }
A Scalar is defined by a domain D, and a set of zero or one scalar value.
func ScalarNew ¶
ScalarNew creates a new matrix with specified domain.
Parameters:
- D: The type corresponding to the domain of the matrix being created. Can be one of the Predefined or Complex types, or an existing user-defined GraphBLAS type.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func ScalarView ¶
func ScalarView[To, From Predefined | Complex](scalar Scalar[From]) (view Scalar[To])
ScalarView returns a view on the given scalar (with domain From) using a different domain To.
In the GraphBLAS specification for the C programming language, collections (scalars, vectors and matrices) of Predefined domains can be arbitrarily intermixed. In SuiteSparse:GraphBLAS, this extends to collections of Complex domains. When entries of collections are accessed expecting a particular domain (type), then the entry values are typecast using the rules of the C programming language. (Collections of user-defined domains are not compatible with any other collections in this way.)
In Go, generally only identical types are compatible with each other, and conversions are not implicit. To get around this restriction, ScalarView, VectorView and MatrixView can be used to view a collection using a different domain. These functions do not perform any conversion themselves, but are essentially NO-OPs.
ScalarView is a forGraphBLASGo extension.
func (Scalar[D]) Clear ¶
Clear removes the stored element from a scalar.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Scalar[D]) Dup ¶
Dup creates a new scalar with the same domain and content as another scalar.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Scalar[D]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the scalar.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Scalar[D]) ExtractElement ¶
ExtractElement extracts the single element of a scalar.
When there is no stored value, ExtractElement returns ok == false. Otherwise, it returns ok == true.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Scalar[D]) Free ¶
Free destroys a previously created Scalar and releases any resources associated with it. Calling Free on an object that is not Scalar.Valid() is legal.
GraphBLAS execution errors that may cause a panic:
func (Scalar[D]) MemoryUsage ¶
MemoryUsage returns the memory space required for a scalar, in bytes.
MemoryUsage is a SuiteSparse:GraphBLAS extension.
func (Scalar[D]) Nvals ¶
Nvals retrieves the number of stored elements in a scalar (either zero or one).
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Scalar[D]) Print ¶
func (scalar Scalar[D]) Print(name string, pr PrintLevel) error
Print the contents of the scalar to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: scalar is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Scalar[D]) SetElement ¶
SetElement sets the single element of a scalar to a given value.
Parameters:
- val (IN): Scalar to assign.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Scalar[D]) Type ¶
Type returns the actual Type object representing the domain of the given scalar. This is not necessarily the Type object corresponding to D, if Type is called on a ScalarView of a matrix of some other domain.
Type might return false as a second return value if the domain is not a Predefined or Complex domain, or if the type has not been registered with TypeNew or NamedTypeNew.
Type is a forGraphBLASGo extension. It can be used in place of GxB_Scalar_type_name and GxB_Type_from_name, which are SuiteSparse:GraphBLAS extensions.
func (Scalar[D]) Valid ¶
Valid returns true if scalar has been created by a successful call to Scalar.Dup, or ScalarNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Semiring ¶
type Semiring[Dout, Din1, Din2 any] struct { // contains filtered or unexported fields }
A Semiring is defined by three domains Dout, Din1 and Din2; an associative and commutative operator additive operation; a multiplicative operation; and an identity element.
In a GraphBLAS semiring, the multiplicative operator does not have to distribute over the additive operator. This is unlike the conventional semiring algebraic structure.
func AnyDiv ¶
AnyDiv semiring with additive Monoid AnyMonoid and BinaryOp Div.
AnyDiv is a SuiteSparse:GraphBLAS extension.
func AnyEq ¶
func AnyEq[D Predefined]() (s Semiring[bool, D, D])
AnyEq semiring with additive Monoid AnyMonoid and BinaryOp Eq.
AnyEq is a SuiteSparse:GraphBLAS extension.
func AnyFirst ¶
func AnyFirst[D Predefined | Complex]() (s Semiring[D, D, D])
AnyFirst semiring with additive Monoid AnyMonoid and BinaryOp First.
AnyFirst is a SuiteSparse:GraphBLAS extension.
func AnyFirsti ¶
AnyFirsti semiring with additive Monoid AnyMonoid and BinaryOp Firsti.
AnyFirsti is a SuiteSparse:GraphBLAS extension.
func AnyFirsti1 ¶
AnyFirsti1 semiring with additive Monoid AnyMonoid and BinaryOp Firsti1.
AnyFirsti1 is a SuiteSparse:GraphBLAS extension.
func AnyFirstj ¶
AnyFirstj semiring with additive Monoid AnyMonoid and BinaryOp Firstj.
AnyFirstj is a SuiteSparse:GraphBLAS extension.
func AnyFirstj1 ¶
AnyFirstj1 semiring with additive Monoid AnyMonoid and BinaryOp Firstj1.
AnyFirstj1 is a SuiteSparse:GraphBLAS extension.
func AnyGe ¶
func AnyGe[D Predefined]() (s Semiring[bool, D, D])
AnyGe semiring with additive Monoid AnyMonoid and BinaryOp Ge.
AnyGe is a SuiteSparse:GraphBLAS extension.
func AnyGt ¶
func AnyGt[D Predefined]() (s Semiring[bool, D, D])
AnyGt semiring with additive Monoid AnyMonoid and BinaryOp Gt.
AnyGt is a SuiteSparse:GraphBLAS extension.
func AnyIseq ¶
AnyIseq semiring with additive Monoid AnyMonoid and BinaryOp Iseq.
AnyIseq is a SuiteSparse:GraphBLAS extension.
func AnyIsge ¶
AnyIsge semiring with additive Monoid AnyMonoid and BinaryOp Isge.
AnyIsge is a SuiteSparse:GraphBLAS extension.
func AnyIsgt ¶
AnyIsgt semiring with additive Monoid AnyMonoid and BinaryOp Isgt.
AnyIsgt is a SuiteSparse:GraphBLAS extension.
func AnyIsle ¶
AnyIsle semiring with additive Monoid AnyMonoid and BinaryOp Isle.
AnyIsle is a SuiteSparse:GraphBLAS extension.
func AnyIslt ¶
AnyIslt semiring with additive Monoid AnyMonoid and BinaryOp Islt.
AnyIslt is a SuiteSparse:GraphBLAS extension.
func AnyIsne ¶
AnyIsne semiring with additive Monoid AnyMonoid and BinaryOp Isne.
AnyIsne is a SuiteSparse:GraphBLAS extension.
func AnyLand ¶
func AnyLand[D Predefined]() (s Semiring[D, D, D])
AnyLand semiring with additive Monoid AnyMonoid and BinaryOp Land.
AnyLand is a SuiteSparse:GraphBLAS extension.
func AnyLe ¶
func AnyLe[D Predefined]() (s Semiring[bool, D, D])
AnyLe semiring with additive Monoid AnyMonoid and BinaryOp Le.
AnyLe is a SuiteSparse:GraphBLAS extension.
func AnyLor ¶
func AnyLor[D Predefined]() (s Semiring[D, D, D])
AnyLor semiring with additive Monoid AnyMonoid and BinaryOp Lor.
AnyLor is a SuiteSparse:GraphBLAS extension.
func AnyLt ¶
func AnyLt[D Predefined]() (s Semiring[bool, D, D])
AnyLt semiring with additive Monoid AnyMonoid and BinaryOp Lt.
AnyLt is a SuiteSparse:GraphBLAS extension.
func AnyLxor ¶
func AnyLxor[D Predefined]() (s Semiring[D, D, D])
AnyLxor semiring with additive Monoid AnyMonoid and BinaryOp Lxor.
AnyLxor is a SuiteSparse:GraphBLAS extension.
func AnyMax ¶
AnyMax semiring with additive Monoid AnyMonoid and BinaryOp Max.
AnyMax is a SuiteSparse:GraphBLAS extension.
func AnyMin ¶
AnyMin semiring with additive Monoid AnyMonoid and BinaryOp Min.
AnyMin is a SuiteSparse:GraphBLAS extension.
func AnyMinus ¶
AnyMinus semiring with additive Monoid AnyMonoid and BinaryOp Minus.
AnyMinus is a SuiteSparse:GraphBLAS extension.
func AnyNe ¶
AnyNe semiring with additive Monoid AnyMonoid and BinaryOp Ne.
AnyNe is a SuiteSparse:GraphBLAS extension.
func AnyOneb ¶
func AnyOneb[D Predefined | Complex]() (s Semiring[D, D, D])
AnyOneb semiring with additive Monoid AnyMonoid and BinaryOp Oneb.
AnyOneb is a SuiteSparse:GraphBLAS extension.
func AnyPlus ¶
AnyPlus semiring with additive Monoid AnyMonoid and BinaryOp Plus.
AnyPlus is a SuiteSparse:GraphBLAS extension.
func AnyRdiv ¶
AnyRdiv semiring with additive Monoid AnyMonoid and BinaryOp Rdiv.
AnyRdiv is a SuiteSparse:GraphBLAS extension.
func AnyRminus ¶
AnyRminus semiring with additive Monoid AnyMonoid and BinaryOp Rminus.
AnyRminus is a SuiteSparse:GraphBLAS extension.
func AnySecond ¶
func AnySecond[D Predefined | Complex]() (s Semiring[D, D, D])
AnySecond semiring with additive Monoid AnyMonoid and BinaryOp Second.
AnySecond is a SuiteSparse:GraphBLAS extension.
func AnySecondi ¶
AnySecondi semiring with additive Monoid AnyMonoid and BinaryOp Secondi.
AnySecondi is a SuiteSparse:GraphBLAS extension.
func AnySecondi1 ¶
AnySecondi1 semiring with additive Monoid AnyMonoid and BinaryOp Secondi1.
AnySecondi1 is a SuiteSparse:GraphBLAS extension.
func AnySecondj ¶
AnySecondj semiring with additive Monoid AnyMonoid and BinaryOp Secondj.
AnySecondj is a SuiteSparse:GraphBLAS extension.
func AnySecondj1 ¶
AnySecondj1 semiring with additive Monoid AnyMonoid and BinaryOp Secondj1.
AnySecondj1 is a SuiteSparse:GraphBLAS extension.
func AnyTimes ¶
AnyTimes semiring with additive Monoid AnyMonoid and BinaryOp Times.
AnyTimes is a SuiteSparse:GraphBLAS extension.
func BandBand ¶
BandBand semiring with additive Monoid BandMonoid and BinaryOp Band.
BandBand is a SuiteSparse:GraphBLAS extension.
func BandBor ¶
BandBor semiring with additive Monoid BandMonoid and BinaryOp Bor.
BandBor is a SuiteSparse:GraphBLAS extension.
func BandBxnor ¶
BandBxnor semiring with additive Monoid BandMonoid and BinaryOp Bxnor.
BandBxnor is a SuiteSparse:GraphBLAS extension.
func BandBxor ¶
BandBxor semiring with additive Monoid BandMonoid and BinaryOp Bxor.
BandBxor is a SuiteSparse:GraphBLAS extension.
func BorBand ¶
BorBand semiring with additive Monoid BorMonoid and BinaryOp Band.
BorBand is a SuiteSparse:GraphBLAS extension.
func BorBor ¶
BorBor semiring with additive Monoid BorMonoid and BinaryOp Bor.
BorBor is a SuiteSparse:GraphBLAS extension.
func BorBxnor ¶
BorBxnor semiring with additive Monoid BorMonoid and BinaryOp Bxnor.
BorBxnor is a SuiteSparse:GraphBLAS extension.
func BorBxor ¶
BorBxor semiring with additive Monoid BorMonoid and BinaryOp Bxor.
BorBxor is a SuiteSparse:GraphBLAS extension.
func BxnorBand ¶
BxnorBand semiring with additive Monoid BxnorMonoid and BinaryOp Band.
BxnorBand is a SuiteSparse:GraphBLAS extension.
func BxnorBor ¶
BxnorBor semiring with additive Monoid BxnorMonoid and BinaryOp Bor.
BxnorBor is a SuiteSparse:GraphBLAS extension.
func BxnorBxnor ¶
BxnorBxnor semiring with additive Monoid BxnorMonoid and BinaryOp Bxnor.
BxnorBxnor is a SuiteSparse:GraphBLAS extension.
func BxnorBxor ¶
BxnorBxor semiring with additive Monoid BxnorMonoid and BinaryOp Bxor.
BxnorBxor is a SuiteSparse:GraphBLAS extension.
func BxorBand ¶
BxorBand semiring with additive Monoid BxorMonoid and BinaryOp Band.
BxorBand is a SuiteSparse:GraphBLAS extension. is a SuiteSparse:GraphBLAS extension.
func BxorBor ¶
BxorBor semiring with additive Monoid BxorMonoid and BinaryOp Bor.
BxorBor is a SuiteSparse:GraphBLAS extension.
func BxorBxnor ¶
BxorBxnor semiring with additive Monoid BxorMonoid and BinaryOp Bxnor.
BxorBxnor is a SuiteSparse:GraphBLAS extension.
func BxorBxor ¶
BxorBxor semiring with additive Monoid BxorMonoid and BinaryOp Bxor.
BxorBxor is a SuiteSparse:GraphBLAS extension.
func EqEq ¶
EqEq semiring with additive Monoid Eq and BinaryOp Eq.
EqEq is a SuiteSparse:GraphBLAS extension.
func EqGe ¶
EqGe semiring with additive Monoid [EqMonoid] and BinaryOp Ge.
EqGe is a SuiteSparse:GraphBLAS extension.
func EqGt ¶
EqGt semiring with additive Monoid Eq and BinaryOp Gt.
EqGt is a SuiteSparse:GraphBLAS extension.
func EqLe ¶
EqLe semiring with additive Monoid Eq and BinaryOp Le.
EqLe is a SuiteSparse:GraphBLAS extension.
func EqLt ¶
EqLt semiring with additive Monoid Eq and BinaryOp Lt.
EqLt is a SuiteSparse:GraphBLAS extension.
func EqNe ¶
EqNe semiring with additive Monoid Eq and BinaryOp Ne.
EqNe is a SuiteSparse:GraphBLAS extension.
func LandEq ¶
LandEq semiring with additive Monoid [LandMonoid] and BinaryOp Eq.
LandEq is a SuiteSparse:GraphBLAS extension.
func LandGe ¶
LandGe semiring with additive Monoid [LandMonoid] and BinaryOp Ge.
LandGe is a SuiteSparse:GraphBLAS extension.
func LandGt ¶
LandGt semiring with additive Monoid [LandMonoid] and BinaryOp Gt.
LandGt is a SuiteSparse:GraphBLAS extension.
func LandLe ¶
LandLe semiring with additive Monoid [LandMonoid] and BinaryOp Le.
LandLe is a SuiteSparse:GraphBLAS extension.
func LandLt ¶
LandLt semiring with additive Monoid [LandMonoid] and BinaryOp Lt.
LandLt is a SuiteSparse:GraphBLAS extension.
func LandNe ¶
LandNe semiring with additive Monoid [LandMonoid] and BinaryOp Ne.
LandNe is a SuiteSparse:GraphBLAS extension.
func LorEq ¶
LorEq semiring with additive Monoid [LorMonoid] and BinaryOp Eq.
LorEq is a SuiteSparse:GraphBLAS extension.
func LorGe ¶
LorGe semiring with additive Monoid [LorMonoid] and BinaryOp Ge.
LorGe is a SuiteSparse:GraphBLAS extension.
func LorGt ¶
LorGt semiring with additive Monoid [LorMonoid] and BinaryOp Gt.
LorGt is a SuiteSparse:GraphBLAS extension.
func LorLe ¶
LorLe semiring with additive Monoid [LorMonoid] and BinaryOp Le.
LorLe is a SuiteSparse:GraphBLAS extension.
func LorLt ¶
LorLt semiring with additive Monoid [LorMonoid] and BinaryOp Lt.
LorLt is a SuiteSparse:GraphBLAS extension.
func LorNe ¶
LorNe semiring with additive Monoid [LorMonoid] and BinaryOp Ne.
LorNe is a SuiteSparse:GraphBLAS extension.
func LxorEq ¶
LxorEq semiring with additive Monoid [LxorMonoid] and BinaryOp Eq.
LxorEq is a SuiteSparse:GraphBLAS extension.
func LxorGe ¶
LxorGe semiring with additive Monoid [LxorMonoid] and BinaryOp Ge.
LxorGe is a SuiteSparse:GraphBLAS extension.
func LxorGt ¶
LxorGt semiring with additive Monoid [LxorMonoid] and BinaryOp Gt.
LxorGt is a SuiteSparse:GraphBLAS extension.
func LxorLe ¶
LxorLe semiring with additive Monoid [LxorMonoid] and BinaryOp Le.
LxorLe is a SuiteSparse:GraphBLAS extension.
func LxorLt ¶
LxorLt semiring with additive Monoid [LxorMonoid] and BinaryOp Lt.
LxorLt is a SuiteSparse:GraphBLAS extension.
func LxorNe ¶
LxorNe semiring with additive Monoid [LxorMonoid] and BinaryOp Ne.
LxorNe is a SuiteSparse:GraphBLAS extension.
func MaxDiv ¶
MaxDiv semiring with additive Monoid MaxMonoid and BinaryOp Div.
MaxDiv is a SuiteSparse:GraphBLAS extension.
func MaxFirsti ¶
MaxFirsti semiring with additive Monoid MaxMonoid and BinaryOp Firsti.
MaxFirsti is a SuiteSparse:GraphBLAS extension.
func MaxFirsti1 ¶
MaxFirsti1 semiring with additive Monoid MaxMonoid and BinaryOp Firsti1.
MaxFirsti1 is a SuiteSparse:GraphBLAS extension.
func MaxFirstj ¶
MaxFirstj semiring with additive Monoid MaxMonoid and BinaryOp Firstj.
MaxFirstj is a SuiteSparse:GraphBLAS extension.
func MaxFirstj1 ¶
MaxFirstj1 semiring with additive Monoid MaxMonoid and BinaryOp Firstj1.
MaxFirstj1 is a SuiteSparse:GraphBLAS extension.
func MaxIseq ¶
MaxIseq semiring with additive Monoid MaxMonoid and BinaryOp Iseq.
MaxIseq is a SuiteSparse:GraphBLAS extension.
func MaxIsge ¶
MaxIsge semiring with additive Monoid MaxMonoid and BinaryOp Isge.
MaxIsge is a SuiteSparse:GraphBLAS extension.
func MaxIsgt ¶
MaxIsgt semiring with additive Monoid MaxMonoid and BinaryOp Isgt.
MaxIsgt is a SuiteSparse:GraphBLAS extension.
func MaxIsle ¶
MaxIsle semiring with additive Monoid MaxMonoid and BinaryOp Isle.
MaxIsle is a SuiteSparse:GraphBLAS extension.
func MaxIslt ¶
MaxIslt semiring with additive Monoid MaxMonoid and BinaryOp Islt.
MaxIslt is a SuiteSparse:GraphBLAS extension.
func MaxIsne ¶
MaxIsne semiring with additive Monoid MaxMonoid and BinaryOp Isne.
MaxIsne is a SuiteSparse:GraphBLAS extension.
func MaxLand ¶
MaxLand semiring with additive Monoid MaxMonoid and BinaryOp Land.
MaxLand is a SuiteSparse:GraphBLAS extension.
func MaxLor ¶
MaxLor semiring with additive Monoid MaxMonoid and BinaryOp Lor.
MaxLor is a SuiteSparse:GraphBLAS extension.
func MaxLxor ¶
MaxLxor semiring with additive Monoid MaxMonoid and BinaryOp Lxor.
MaxLxor is a SuiteSparse:GraphBLAS extension.
func MaxMax ¶
MaxMax semiring with additive Monoid MaxMonoid and BinaryOp Max.
MaxMax is a SuiteSparse:GraphBLAS extension.
func MaxMin ¶
MaxMin semiring with additive Monoid MaxMonoid and BinaryOp Min.
MaxMin is a SuiteSparse:GraphBLAS extension.
func MaxMinus ¶
MaxMinus semiring with additive Monoid MaxMonoid and BinaryOp Minus.
MaxMinus is a SuiteSparse:GraphBLAS extension.
func MaxOneb ¶
MaxOneb semiring with additive Monoid MaxMonoid and BinaryOp Oneb.
MaxOneb is a SuiteSparse:GraphBLAS extension.
func MaxPlus ¶
MaxPlus semiring with additive Monoid MaxMonoid and BinaryOp Plus.
MaxPlus is a SuiteSparse:GraphBLAS extension.
func MaxRdiv ¶
MaxRdiv semiring with additive Monoid MaxMonoid and BinaryOp Rdiv.
MaxRdiv is a SuiteSparse:GraphBLAS extension.
func MaxRminus ¶
MaxRminus semiring with additive Monoid MaxMonoid and BinaryOp Rminus.
MaxRminus is a SuiteSparse:GraphBLAS extension.
func MaxSecondi ¶
MaxSecondi semiring with additive Monoid MaxMonoid and BinaryOp Secondi.
MaxSecondi is a SuiteSparse:GraphBLAS extension.
func MaxSecondi1 ¶
MaxSecondi1 semiring with additive Monoid MaxMonoid and BinaryOp Secondi1.
MaxSecondi1 is a SuiteSparse:GraphBLAS extension.
func MaxSecondj ¶
MaxSecondj semiring with additive Monoid MaxMonoid and BinaryOp Secondj.
MaxSecondj is a SuiteSparse:GraphBLAS extension.
func MaxSecondj1 ¶
MaxSecondj1 semiring with additive Monoid MaxMonoid and BinaryOp Secondj1.
MaxSecondj1 is a SuiteSparse:GraphBLAS extension.
func MaxTimes ¶
MaxTimes semiring with additive Monoid MaxMonoid and BinaryOp Times.
MaxTimes is a SuiteSparse:GraphBLAS extension.
func MaxTimesSemiring ¶
MaxTimesSemiring with additive Monoid MaxMonoid and BinaryOp [times].
func MinDiv ¶
MinDiv semiring with additive Monoid MinMonoid and BinaryOp Div.
MinDiv is a SuiteSparse:GraphBLAS extension.
func MinFirsti ¶
MinFirsti semiring with additive Monoid MinMonoid and BinaryOp Firsti.
MinFirsti is a SuiteSparse:GraphBLAS extension.
func MinFirsti1 ¶
MinFirsti1 semiring with additive Monoid MinMonoid and BinaryOp Firsti1.
MinFirsti1 is a SuiteSparse:GraphBLAS extension.
func MinFirstj ¶
MinFirstj semiring with additive Monoid MinMonoid and BinaryOp Firstj.
MinFirstj is a SuiteSparse:GraphBLAS extension.
func MinFirstj1 ¶
MinFirstj1 semiring with additive Monoid MinMonoid and BinaryOp Firstj1.
MinFirstj1 is a SuiteSparse:GraphBLAS extension.
func MinIseq ¶
MinIseq semiring with additive Monoid MinMonoid and BinaryOp Iseq.
MinIseq is a SuiteSparse:GraphBLAS extension.
func MinIsge ¶
MinIsge semiring with additive Monoid MinMonoid and BinaryOp Isge.
MinIsge is a SuiteSparse:GraphBLAS extension.
func MinIsgt ¶
MinIsgt semiring with additive Monoid MinMonoid and BinaryOp Isgt.
MinIsgt is a SuiteSparse:GraphBLAS extension.
func MinIsle ¶
MinIsle semiring with additive Monoid MinMonoid and BinaryOp Isle.
MinIsle is a SuiteSparse:GraphBLAS extension.
func MinIslt ¶
MinIslt semiring with additive Monoid MinMonoid and BinaryOp Islt.
MinIslt is a SuiteSparse:GraphBLAS extension.
func MinIsne ¶
MinIsne semiring with additive Monoid MinMonoid and BinaryOp Isne.
MinIsne is a SuiteSparse:GraphBLAS extension.
func MinLand ¶
MinLand semiring with additive Monoid MinMonoid and BinaryOp Land.
MinLand is a SuiteSparse:GraphBLAS extension.
func MinLor ¶
MinLor semiring with additive Monoid MinMonoid and BinaryOp Lor.
MinLor is a SuiteSparse:GraphBLAS extension.
func MinLxor ¶
MinLxor semiring with additive Monoid MinMonoid and BinaryOp Lxor.
MinLxor is a SuiteSparse:GraphBLAS extension.
func MinMax ¶
MinMax semiring with additive Monoid MinMonoid and BinaryOp Max.
MinMax is a SuiteSparse:GraphBLAS extension.
func MinMin ¶
MinMin semiring with additive Monoid MinMonoid and BinaryOp Min.
MinMin is a SuiteSparse:GraphBLAS extension.
func MinMinus ¶
MinMinus semiring with additive Monoid MinMonoid and BinaryOp Minus.
MinMinus is a SuiteSparse:GraphBLAS extension.
func MinOneb ¶
MinOneb semiring with additive Monoid MinMonoid and BinaryOp Oneb.
MinOneb is a SuiteSparse:GraphBLAS extension.
func MinPlus ¶
MinPlus semiring with additive Monoid MinMonoid and BinaryOp Plus.
MinPlus is a SuiteSparse:GraphBLAS extension.
func MinRdiv ¶
MinRdiv semiring with additive Monoid MinMonoid and BinaryOp Rdiv.
MinRdiv is a SuiteSparse:GraphBLAS extension.
func MinRminus ¶
MinRminus semiring with additive Monoid MinMonoid and BinaryOp Rminus.
MinRminus is a SuiteSparse:GraphBLAS extension.
func MinSecondi ¶
MinSecondi semiring with additive Monoid MinMonoid and BinaryOp Secondi.
MinSecondi is a SuiteSparse:GraphBLAS extension.
func MinSecondi1 ¶
MinSecondi1 semiring with additive Monoid MinMonoid and BinaryOp Secondi1.
MinSecondi1 is a SuiteSparse:GraphBLAS extension.
func MinSecondj ¶
MinSecondj semiring with additive Monoid MinMonoid and BinaryOp Secondj.
MinSecondj is a SuiteSparse:GraphBLAS extension.
func MinSecondj1 ¶
MinSecondj1 semiring with additive Monoid MinMonoid and BinaryOp Secondj1.
MinSecondj1 is a SuiteSparse:GraphBLAS extension.
func MinTimes ¶
MinTimes semiring with additive Monoid MinMonoid and BinaryOp Times.
MinTimes is a SuiteSparse:GraphBLAS extension.
func PlusDiv ¶
PlusDiv semiring with additive Monoid PlusMonoid and BinaryOp Div.
PlusDiv is a SuiteSparse:GraphBLAS extension.
func PlusFirst ¶
PlusFirst semiring with additive Monoid PlusMonoid and BinaryOp First.
PlusFirst is a SuiteSparse:GraphBLAS extension.
func PlusFirsti ¶
PlusFirsti semiring with additive Monoid PlusMonoid and BinaryOp Firsti.
PlusFirsti is a SuiteSparse:GraphBLAS extension.
func PlusFirsti1 ¶
PlusFirsti1 semiring with additive Monoid PlusMonoid and BinaryOp Firsti1.
PlusFirsti1 is a SuiteSparse:GraphBLAS extension.
func PlusFirstj ¶
PlusFirstj semiring with additive Monoid PlusMonoid and BinaryOp Firstj.
PlusFirstj is a SuiteSparse:GraphBLAS extension.
func PlusFirstj1 ¶
PlusFirstj1 semiring with additive Monoid PlusMonoid and BinaryOp Firstj1.
PlusFirstj1 is a SuiteSparse:GraphBLAS extension.
func PlusIseq ¶
PlusIseq semiring with additive Monoid PlusMonoid and BinaryOp Iseq.
PlusIseq is a SuiteSparse:GraphBLAS extension.
func PlusIsge ¶
PlusIsge semiring with additive Monoid PlusMonoid and BinaryOp Isge.
PlusIsge is a SuiteSparse:GraphBLAS extension.
func PlusIsgt ¶
PlusIsgt semiring with additive Monoid PlusMonoid and BinaryOp Isgt.
PlusIsgt is a SuiteSparse:GraphBLAS extension.
func PlusIsle ¶
PlusIsle semiring with additive Monoid PlusMonoid and BinaryOp Isle.
PlusIsle is a SuiteSparse:GraphBLAS extension.
func PlusIslt ¶
PlusIslt semiring with additive Monoid PlusMonoid and BinaryOp Islt.
PlusIslt is a SuiteSparse:GraphBLAS extension.
func PlusIsne ¶
PlusIsne semiring with additive Monoid PlusMonoid and BinaryOp Isne.
PlusIsne is a SuiteSparse:GraphBLAS extension.
func PlusLand ¶
PlusLand semiring with additive Monoid PlusMonoid and BinaryOp Land.
PlusLand is a SuiteSparse:GraphBLAS extension.
func PlusLor ¶
PlusLor semiring with additive Monoid PlusMonoid and BinaryOp Lor.
PlusLor is a SuiteSparse:GraphBLAS extension.
func PlusLxor ¶
PlusLxor semiring with additive Monoid PlusMonoid and BinaryOp Lxor.
PlusLxor is a SuiteSparse:GraphBLAS extension.
func PlusMax ¶
PlusMax semiring with additive Monoid PlusMonoid and BinaryOp Max.
PlusMax is a SuiteSparse:GraphBLAS extension.
func PlusMin ¶
PlusMin semiring with additive Monoid PlusMonoid and BinaryOp Min.
PlusMin is a SuiteSparse:GraphBLAS extension.
func PlusMinSemiring ¶
PlusMinSemiring with additive Monoid PlusMonoid and BinaryOp Min.
func PlusMinus ¶
PlusMinus semiring with additive Monoid PlusMonoid and BinaryOp Minus.
PlusMinus is a SuiteSparse:GraphBLAS extension.
func PlusOneb ¶
PlusOneb semiring with additive Monoid PlusMonoid and BinaryOp Oneb.
PlusOneb is a SuiteSparse:GraphBLAS extension.
func PlusPlus ¶
PlusPlus semiring with additive Monoid PlusMonoid and BinaryOp Plus.
PlusPlus is a SuiteSparse:GraphBLAS extension.
func PlusRdiv ¶
PlusRdiv semiring with additive Monoid PlusMonoid and BinaryOp Rdiv.
PlusRdiv is a SuiteSparse:GraphBLAS extension.
func PlusRminus ¶
PlusRminus semiring with additive Monoid PlusMonoid and BinaryOp Rminus.
PlusRminus is a SuiteSparse:GraphBLAS extension.
func PlusSecond ¶
PlusSecond semiring with additive Monoid PlusMonoid and BinaryOp Second.
PlusSecond is a SuiteSparse:GraphBLAS extension.
func PlusSecondi ¶
PlusSecondi semiring with additive Monoid PlusMonoid and BinaryOp Secondi.
PlusSecondi is a SuiteSparse:GraphBLAS extension.
func PlusSecondi1 ¶
PlusSecondi1 semiring with additive Monoid PlusMonoid and BinaryOp Secondi1.
PlusSecondi1 is a SuiteSparse:GraphBLAS extension.
func PlusSecondj ¶
PlusSecondj semiring with additive Monoid PlusMonoid and BinaryOp Secondj.
PlusSecondj is a SuiteSparse:GraphBLAS extension.
func PlusSecondj1 ¶
PlusSecondj1 semiring with additive Monoid PlusMonoid and BinaryOp Secondj1.
PlusSecondj1 is a SuiteSparse:GraphBLAS extension.
func PlusTimes ¶
PlusTimes semiring with additive Monoid PlusMonoid and BinaryOp Times.
PlusTimes is a SuiteSparse:GraphBLAS extension.
func PlusTimesSemiring ¶
PlusTimesSemiring with additive Monoid PlusMonoid and BinaryOp Times.
func SemiringNew ¶
func SemiringNew[Dout, Din1, Din2 any](addOp Monoid[Dout], mulOp BinaryOp[Dout, Din1, Din2]) (semiring Semiring[Dout, Din1, Din2], err error)
SemiringNew creates a new monoid with specified domains, operators, and elements.
Parameters:
addOp (IN): An existing GraphBLAS commutative monoid that specifies the addition operator and its identity.
mulOp (IN): An existing GraphBLAS binary operator that specifies the semiring's multiplicative operator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func TimesDiv ¶
TimesDiv semiring with additive Monoid TimesMonoid and BinaryOp Div.
TimesDiv is a SuiteSparse:GraphBLAS extension.
func TimesFirst ¶
TimesFirst semiring with additive Monoid TimesMonoid and BinaryOp First.
TimesFirst is a SuiteSparse:GraphBLAS extension.
func TimesFirsti ¶
TimesFirsti semiring with additive Monoid TimesMonoid and BinaryOp Firsti.
TimesFirsti is a SuiteSparse:GraphBLAS extension.
func TimesFirsti1 ¶
TimesFirsti1 semiring with additive Monoid TimesMonoid and BinaryOp Firsti1.
TimesFirsti1 is a SuiteSparse:GraphBLAS extension.
func TimesFirstj ¶
TimesFirstj semiring with additive Monoid TimesMonoid and BinaryOp Firstj.
TimesFirstj is a SuiteSparse:GraphBLAS extension.
func TimesFirstj1 ¶
TimesFirstj1 semiring with additive Monoid TimesMonoid and BinaryOp Firstj1.
TimesFirstj1 is a SuiteSparse:GraphBLAS extension.
func TimesIseq ¶
TimesIseq semiring with additive Monoid TimesMonoid and BinaryOp Iseq.
TimesIseq is a SuiteSparse:GraphBLAS extension.
func TimesIsge ¶
TimesIsge semiring with additive Monoid TimesMonoid and BinaryOp Isge.
TimesIsge is a SuiteSparse:GraphBLAS extension.
func TimesIsgt ¶
TimesIsgt semiring with additive Monoid TimesMonoid and BinaryOp Isgt.
TimesIsgt is a SuiteSparse:GraphBLAS extension.
func TimesIsle ¶
TimesIsle semiring with additive Monoid TimesMonoid and BinaryOp Isle.
TimesIsle is a SuiteSparse:GraphBLAS extension.
func TimesIslt ¶
TimesIslt semiring with additive Monoid TimesMonoid and BinaryOp Islt.
TimesIslt is a SuiteSparse:GraphBLAS extension.
func TimesIsne ¶
TimesIsne semiring with additive Monoid TimesMonoid and BinaryOp Isne.
TimesIsne is a SuiteSparse:GraphBLAS extension.
func TimesLand ¶
TimesLand semiring with additive Monoid TimesMonoid and BinaryOp Land.
TimesLand is a SuiteSparse:GraphBLAS extension.
func TimesLor ¶
TimesLor semiring with additive Monoid TimesMonoid and BinaryOp Lor.
TimesLor is a SuiteSparse:GraphBLAS extension.
func TimesLxor ¶
TimesLxor semiring with additive Monoid TimesMonoid and BinaryOp Lxor.
TimesLxor is a SuiteSparse:GraphBLAS extension.
func TimesMax ¶
TimesMax semiring with additive Monoid TimesMonoid and BinaryOp Max.
TimesMax is a SuiteSparse:GraphBLAS extension.
func TimesMin ¶
TimesMin semiring with additive Monoid TimesMonoid and BinaryOp Min.
TimesMin is a SuiteSparse:GraphBLAS extension.
func TimesMinus ¶
TimesMinus semiring with additive Monoid TimesMonoid and BinaryOp Minus.
TimesMinus is a SuiteSparse:GraphBLAS extension.
func TimesOneb ¶
TimesOneb semiring with additive Monoid TimesMonoid and BinaryOp Oneb.
TimesOneb is a SuiteSparse:GraphBLAS extension.
func TimesPlus ¶
TimesPlus semiring with additive Monoid TimesMonoid and BinaryOp Plus.
TimesPlus is a SuiteSparse:GraphBLAS extension.
func TimesRdiv ¶
TimesRdiv semiring with additive Monoid TimesMonoid and BinaryOp Rdiv.
TimesRdiv is a SuiteSparse:GraphBLAS extension.
func TimesRminus ¶
TimesRminus semiring with additive Monoid TimesMonoid and BinaryOp Rminus.
TimesRminus is a SuiteSparse:GraphBLAS extension.
func TimesSecond ¶
TimesSecond semiring with additive Monoid TimesMonoid and BinaryOp Second.
TimesSecond is a SuiteSparse:GraphBLAS extension.
func TimesSecondi ¶
TimesSecondi semiring with additive Monoid TimesMonoid and BinaryOp Secondi.
TimesSecondi is a SuiteSparse:GraphBLAS extension.
func TimesSecondi1 ¶
TimesSecondi1 semiring with additive Monoid TimesMonoid and BinaryOp Secondi1.
TimesSecondi1 is a SuiteSparse:GraphBLAS extension.
func TimesSecondj ¶
TimesSecondj semiring with additive Monoid TimesMonoid and BinaryOp Secondj.
TimesSecondj is a SuiteSparse:GraphBLAS extension.
func TimesSecondj1 ¶
TimesSecondj1 semiring with additive Monoid TimesMonoid and BinaryOp Secondj1.
TimesSecondj1 is a SuiteSparse:GraphBLAS extension.
func TimesTimes ¶
TimesTimes semiring with additive Monoid TimesMonoid and BinaryOp Times.
TimesTimes is a SuiteSparse:GraphBLAS extension.
func (Semiring[Dout, Din1, Din2]) Add ¶
Add returns the additive monoid of the semiring.
Add is a SuiteSparse:GraphBLAS extension.
func (Semiring[Dout, Din1, Din2]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the semiring.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Semiring[Dout, Din1, Din2]) Free ¶
Free destroys a previously created Semiring and releases any resources associated with it. Calling Free on an object that is not Semiring.Valid() is legal. The behavior of a program that calls Free on a pre-defined semiring is undefined.
GraphBLAS execution errors that may cause a panic:
func (Semiring[Dout, Din1, Din2]) Multiply ¶
func (semiring Semiring[Dout, Din1, Din2]) Multiply() (multiply BinaryOp[Dout, Din1, Din2], err error)
Multiply returns the binary operator of the semiring.
Multiply is a SuiteSparse:GraphBLAS extension.
func (Semiring[Dout, Din1, Din2]) Print ¶
func (semiring Semiring[Dout, Din1, Din2]) Print(name string, pr PrintLevel) error
Print the contents of the semiring to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: semiring is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Semiring[Dout, Din1, Din2]) Valid ¶
Valid returns true if semiring has been created by a successful call to SemiringNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Signed ¶
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type Sparsity ¶
type Sparsity int
Sparsity indicates the sparsity representation of a matrix.
Sparsity is a SuiteSparse:GraphBLAS extension.
type SystemSlice ¶
type SystemSlice[T any] struct { // contains filtered or unexported fields }
A SystemSlice is similar to a regular Go slice, except that the memory it occupies is allocated by the allocator registered with InitWithMalloc, and must be freed explicitly.
The type T must not directly or indirectly contain any Go pointers. This is not checked.
SystemSlice is a forGraphBLAS Go extension.
func AsSystemSlice ¶
func AsSystemSlice[T any](ptr unsafe.Pointer, size int) SystemSlice[T]
AsSystemSlice constructs a SystemSlice from a raw pointer and the given size in bytes. (size is not the number of T entries!)
AsSystemSlice is a forGraphBLASGo extension.
func MakeSystemSlice ¶
func MakeSystemSlice[T any](size int) SystemSlice[T]
MakeSystemSlice allocates a SystemSlice. All entries are initialized to the type's zero value.
MakeSystemSlice is a forGraphBLASGo extension.
func (*SystemSlice[T]) Free ¶
func (s *SystemSlice[T]) Free()
Free deallocates the memory pointed to by this slice, and initializes the content of s to an empty slice.
Note that this function is unsafe, because other instance of SystemSlice, or Go slices returned by SystemSlice.UnsafeSlice, that share memory with this slice are now dangling.
Free succeeds even if s is nil.
Free is a forGraphBLASGo extension.
func (SystemSlice[T]) UnsafeSlice ¶
func (s SystemSlice[T]) UnsafeSlice() []T
UnsafeSlice returns a go slice pointing to the same memory as the system slice. This allows for reading and writing the system slice, and performing other slice operations. Note, however, that the slice returned points to memory not handled by the Go memory manager, which implies that some slice operations are unsafe and might lead to undefined situations.
UnsafeSlice is a forGraphBLASGo extension.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
A Type represents a domain for elements that can be stored in collections and operated on through GraphBLAS functions.
func NamedTypeNew ¶
NamedTypeNew creates a type with a name and definition that are known to GraphBLAS, as strings.
The typename is any valid string (max length of 127 characters) that may appear as the name of a C type created by a C typedef statement. It must not contain any whitespace characters. For example, to create a type with a 4-by-4 dense float array and a 32-bit integer:
type myquaternion struct { x [4*4]float32 color int32 } typ, err := GrB.NamedTypeNew[myquaternion](0, "myquaternion", `typedef struct { float x [4][4] ; int color ; } myquaternion ;`)
The two strings are optional, but are required to enable the JIT compilation of kernels that use this type.
If the size parameter is zero, and the strings are valid, a JIT kernel is compiled just to determine the size of the type. The Go type D has to be compatible with the corresponding C type.
NamedTypeNew is a SuiteSparse:GraphBLAS extension.
func TypeNew ¶
TypeNew creates a new user-defined GraphBLAS type. This type can then be used to create new operators, monoids, semirings, vectors and matrices.
Variables of this type must be a struct or (fixed-size) array. In particular, given two variables, src and dst, of type D, the following operation must be a valid way to copy the contents of src to dst:
memcpy(&dst, &src, sizeof(D))
Parameters:
- D: A Go type. Values of this type will be copied by the functions of the SuiteSparse:GraphBLAS implementation in C and stored in C memory. Therefore, this type must adhere to the restrictions of cgo. Specifically, D must not contain any Go pointers.
- size: The size of a D value when stored in C memory.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func TypeOf ¶
TypeOf returns the Type for a given Go value. The return value is only safe to use if it corresponds to a predefined GraphBLAS type, or if it has been created by TypeNew or NamedTypeNew as a user-defined type.
TypeOf is a forGraphBLASGo extension.
func (Type) Err ¶
Err returns an error message about any errors encountered during the processing associated with the type.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Type) Free ¶
Free destroys a previously created Type and releases any resources associated with it. Calling Free on an object that is not Type.Valid() is legal. The behavior of a program that calls Free on a pre-defined type is undefined.
GraphBLAS execution errors that may cause a panic:
func (Type) Print ¶
func (typ Type) Print(name string, pr PrintLevel) error
Print the contents of the type to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: typ is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Type) Size ¶
Size returns the size of a type.
This functions acts just like sizeof(type) in the C language. For example, GrB.Int32.Size() returns 4, the same as sizeof(int32_t).
Size is a SuiteSparse:GraphBLAS extension.
func (Type) Valid ¶
Valid returns true if typ has been created by a successful call to TypeNew or NamedTypeNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type UnaryFunction ¶
type UnaryFunction C.GxB_unary_function
UnaryFunction is the C type for unary functions:
typedef void (*GxB_unary_function) (void *, const void *) ;
type UnaryOp ¶
type UnaryOp[Dout, Din any] struct { // contains filtered or unexported fields }
UnaryOp represents a GraphBLAS function that takes one argument of type Din, and returns an argument of type Dout.
func Acosh ¶
Acosh is f(x) = acosh(x) (inverse hyperbolic cosine)
Acosh is a SuiteSparse:GraphBLAS extension.
func Asinh ¶
Asinh is f(x) = asinh(x) (inverse hyperbolic sine)
Asinh is a SuiteSparse:GraphBLAS extension.
func Atanh ¶
Atanh is f(x) = atanh(x) (inverse hyperbolic tangent)
Atanh is a SuiteSparse:GraphBLAS extension.
func Expm1 ¶
Expm1 is f(x) = expm1(x) (natural exponent - 1)
Expm1 is a SuiteSparse:GraphBLAS extension.
func Lnot ¶
func Lnot[D Predefined]() (f UnaryOp[D, D])
Lnot is f(x) = !x (C semantics)
Lnot is a SuiteSparse:GraphBLAS extension.
func Log10 ¶
Log10 is f(x) = log10(x) (base-10 logarithm)
Log10 is a SuiteSparse:GraphBLAS extension.
func Log1p ¶
Log1p is f(x) = log1p(x) (natural logarithm + 1)
Log1p is a SuiteSparse:GraphBLAS extension.
func NamedUnaryOpNew ¶
func NamedUnaryOpNew[Dout, Din any](unaryFunc UnaryFunction, unopname string, unopdefn string) (unaryOp UnaryOp[Dout, Din], err error)
NamedUnaryOpNew creates a named unary function. It is like UnaryOpNew, except:
- unopname is the name for the GraphBLAS unary operator. Only the first 127 characters are used.
- unopdefn is a string containing the entire function itself.
The two strings unopname and unopdefn are optional, but are required to enable the JIT compilation of kernels that use this operator.
If the JIT is enabled, or if the corresponding JIT kernel has been copied into the PreJIT folder, the function may be nil. In this case, a JIT kernel is compiled that contains just the user-defined function. If the JIT is disabled and the function is nil, this method returns a NullPointer error.
NamedUnaryOpNew is a SuiteSparse:GraphBLAS extension.
func One ¶
func One[D Predefined | Complex]() (f UnaryOp[D, D])
One is f(x) = 1
One is a SuiteSparse:GraphBLAS extension.
func Positioni ¶
Positioni is f(x) = i (0-based row index)
Positioni is a SuiteSparse:GraphBLAS extension.
func Positioni1 ¶
Positioni1 is f(x) = i (1-based row index)
Positioni1 is a SuiteSparse:GraphBLAS extension.
func Positionj ¶
Positionj is f(x) = j (0-based column index)
Positionj is a SuiteSparse:GraphBLAS extension.
func Positionj1 ¶
Positionj1 is f(x) = j (1-based column index)
Positionj1 is a SuiteSparse:GraphBLAS extension.
func Round ¶
Round is f(x) = round(x) (round to nearest)
Round is a SuiteSparse:GraphBLAS extension.
func Signum ¶
Signum is f(x) = sgn(x) (sign, or signum)
Signum is a SuiteSparse:GraphBLAS extension.
func Trunc ¶
Trunc is f(x) = trunc(x) (round towards zero)
Trunc is a SuiteSparse:GraphBLAS extension.
func UnaryOpNew ¶
func UnaryOpNew[Dout, Din any](unaryFunc UnaryFunction) (unaryOp UnaryOp[Dout, Din], err error)
UnaryOpNew returns a new GraphBLAS unary operator with a specified user-defined function in C and its types (domains).
Parameters:
- unaryFunc (IN): A pointer to a user-defined function in C that takes an input parameter of type Din and returns a value of type Dout, all passed as void pointers. Dout and Din should be one of the Predefined GraphBLAS types, one of the Complex GraphBLAS types, or a user-defined GraphBLAS type.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (UnaryOp[Dout, Din]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the unary operator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*UnaryOp[Dout, Din]) Free ¶
Free destroys a previously created UnaryOp and releases any resources associated with it. Calling Free on an object that is not UnaryOp.Valid() is legal. The behavior of a program that calls Free on a pre-defined unary operator is undefined.
GraphBLAS execution errors that may cause a panic:
func (UnaryOp[Dout, Din]) Print ¶
func (unaryOp UnaryOp[Dout, Din]) Print(name string, pr PrintLevel) error
Print the contents of the binary operator to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: unaryOp is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (UnaryOp[Dout, Din]) Valid ¶
Valid returns true if unaryOp has been created by a successful call to UnaryOpNew or NamedUnaryOpNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type Unsigned ¶
Meaningful type constraints for the predefined GraphBLAS types (domains).
These are forGraphBLASGo extension.
type UserCallocFunction ¶
type UserCallocFunction C.user_calloc_function
C types for user-defined allocation functions (replacements for malloc).
type UserFreeFunction ¶
type UserFreeFunction C.user_free_function
C types for user-defined allocation functions (replacements for malloc).
type UserMallocFunction ¶
type UserMallocFunction C.user_malloc_function
C types for user-defined allocation functions (replacements for malloc).
type UserReallocFunction ¶
type UserReallocFunction C.user_realloc_function
C types for user-defined allocation functions (replacements for malloc).
type Vector ¶
type Vector[D any] struct { // contains filtered or unexported fields }
A Vector is defined by a domain D, a size N > 0, and a set up tuples (i, v(i)), where 0 <= i < N, and v(i) ∈ D. A particular value of i can occur at most once in v.
func VectorNew ¶
VectorNew creates a new vector with specified domain and size.
Parameters:
D: The type corresponding to the domain of the matrix being created. Can be one of the Predefined or Complex types, or an existing user-defined GraphBLAS type.
size (IN): The size of the vector being created.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func VectorView ¶
func VectorView[To, From Predefined | Complex](vector Vector[From]) (view Vector[To])
VectorView returns a view on the given vector (with domain From) using a different domain To.
In the GraphBLAS specification for the C programming language, collections (scalars, vectors and matrices) of Predefined domains can be arbitrarily intermixed. In SuiteSparse:GraphBLAS, this extends to collections of Complex domains. When entries of collections are accessed expecting a particular domain (type), then the entry values are typecast using the rules of the C programming language. (Collections of user-defined domains are not compatible with any other collections in this way.)
In Go, generally only identical types are compatible with each other, and conversions are not implicit. To get around this restriction, ScalarView, VectorView and MatrixView can be used to view a collection using a different domain. These functions do not perform any conversion themselves, but are essentially NO-OPs.
VectorView is a forGraphBLASGo extension.
func (Vector[D]) AsMask ¶
AsMask returns a view on the given vector using the domain bool.
In GraphBLAS, whenever a mask is required as an input parameter for a GraphBLAS operation, a vector of any domain can be passed, and depending on whether Structure is set or not in the Descriptor passed to that operation, the only requirement is that the domain is compatible with bool. In the C programming language, this holds for any of the Predefined domains. In SuiteSparse:GraphBLAS, this extends to any of the Complex domains.
In Go, generally only identical types are compatible with each other, and conversions are not implicit. To get around this restriction, AsMask can be used to view a vector as a bool mask. AsMask does not perform any conversion itself, but is essentially a NO-OP.
AsMask is a forGraphBLASGo extension.
func (Vector[D]) Build ¶
Build stores elements from tuples in a vector.
Parameters:
indices: A slice of indices.
values: A slice of scalars of type D.
dup: An associative and commutative binary operator to apply when duplicate values for the same index are present in the input slices. All three domains of dup must be D. If dup is nil, then duplicate indices will result in an InvalidValue error.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) BuildScalar ¶
BuildScalar is like Vector.Build, except that the scalar is the value of all the tuples.
Unlike Vector.Build, there is no dup operator to handle duplicate entries. Instead, any duplicates are silently ignored.
BuildScalar is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Clear ¶
Clear removes all elements (tuples) from the vector.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) Diag ¶
Diag constructs a diagonal GraphBLAS matrix.
Parameters:
vector (IN): The GraphBLAS vector whose contents will be copied to the diagonal of the matrix. The matrix is square with each dimension equal to size(vector) + |k|.
k (IN): The diagonal to which the vector is assigned. k == 0 represents the main diagonal, k > 0 is above the main dioganal, and k < 0 is below.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) Dup ¶
Dup creates a new vector with the same domain, size, and contents as another vector.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) Err ¶
Err returns an error message about any errors encountered during the processing associated with the matrix.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) ExtractDiag ¶
func (vector Vector[D]) ExtractDiag(a Matrix[D], k int, desc *Descriptor) error
ExtractDiag extracts a diagonal from a GraphBLAS matrix.
Parameters:
vector (OUT): The GraphBLAS vector whose contents will be a copy of the diagonal of the matrix.
k (IN): The diagonal from which the vector is assigned. k == 0 represents the main diagonal, k > 0 is above the main dioganal, and k < 0 is below.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) ExtractElement ¶
ExtractElement extracts one element of a vector.
When there is no stored value at the specified index, ExtractElement returns ok == false. Otherwise, it returns ok == true.
To store the element in a Scalar object instead of returning a non-opaque value, use Vector.ExtractElementScalar.
Parameters:
- index (IN): Index of element to be assigned.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) ExtractElementScalar ¶
ExtractElementScalar is like Vector.ExtractElement, except that the element is stored in a Scalar object.
When there is no stored value at the specified location, the result becomes empty.
func (Vector[D]) ExtractTuples ¶
ExtractTuples extracts the contents of a GraphBLAS vector into non-opaque slices, by appending the indices and values to the slices passed to this function (by using Go's built-in append function).
Parameters:
indices (INOUT): Pointer to a slice of indices. If nil, ExtractTuples does not produces the indices of the vector.
values (INOUT): Pointer to a slice of indices. If nil, ExtractTuples does not produces the values of the vector.
It is valid to pass pointers to nil slices, and ExtractTuples then produces the corresponding indices or values.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*Vector[D]) Free ¶
Free destroys a previously created Vector and releases any resources associated with it. Calling Free on an object that is not Vector.Valid() is legal.
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) GetBitmapSwitch ¶
GetBitmapSwitch retrieves the current switch to bitmap. See Vector.SetBitmapSwitch.
GetBitmapSwitch is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) GetSparsityControl ¶
GetSparsityControl retrieves the valid Sparsity format(s) of the vector.
GetSparsityControl is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) GetSparsityStatus ¶
GetSparsityStatus retrieves the current Sparsity format of the vector.
GetSparsityStatus is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) IsStoredElement ¶
IsStoredElement determines whether there is a stored value at the specified index or not.
Parameters:
- Index (IN): Index of element to be assigned.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
IsStoredElement is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Iso ¶
Iso returns true if the vector is iso-valued, false otherwise.
Iso is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) IteratorNew ¶
func (vector Vector[D]) IteratorNew(desc *Descriptor) (it VectorIterator[D], err error)
IteratorNew creates a vector iterator and attaches it to the vector.
GraphBLAS execution errors that may cause a panic:
IteratorNew is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) MemoryUsage ¶
MemoryUsage returns the memory space required for a vector, in bytes.
MemoryUsage is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Nvals ¶
Nvals retrieves the number of stored elements (tuples) in a vector.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) PackBitmap ¶
func (vector Vector[D]) PackBitmap(vb *SystemSlice[bool], vx *SystemSlice[D], iso bool, nvals int, desc *Descriptor) error
PackBitmap packs a vector from two user slices in bitmap format.
The vector must exist on input with the right type and size. No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
vb (INOUT): A SystemSlice that indicates which indices are present: If vb is true at a given index, then the entry at that index is present with value given by vx at the same index. If vb is false at a given index, the entry at that index is not present, and the value given by vx at that index is ignored.
vx (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting vector is iso.
nvals (IN): The number of entries in the resulting vector.
On successful return, vb and vx are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting vector. If not successful, vb and vx are not modified.
PackBitmap is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) PackBitmapBytes ¶
func (vector Vector[D]) PackBitmapBytes(vb, vx *SystemSlice[byte], iso bool, nvals int, desc *Descriptor) error
PackBitmapBytes is like Vector.PackBitmap, except that vb and vx are passed as byte slices.
PackBitmapBytes is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) PackCSC ¶
func (vector Vector[D]) PackCSC(vi *SystemSlice[int], vx *SystemSlice[D], iso bool, nvals int, jumbled bool, desc *Descriptor) error
PackCSC packs a vector from two user slices in CSC format.
In the resulting vector, the CSC format is a sparse vector with ByCol Layout. The vector must exist on input with the right type and size. No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
vi (INOUT): A SystemSlice of indices of the corresponding values in vx, without duplicates. This is not checked, so the result is undefined if this is not the case.
vx (INOUT): A SystemSlice of values.
iso (IN): If true, the resulting vector is iso.
nvals (IN): The number of entries in the resulting vector.
jumbled (IN): If false, the indices in vi must appear in sorted order. This is not checked, so the result is undefined if this is not the case.
On successful return, vi and vx are empty, to indicate that the user application no longer owns them. They have instead been moved to the resulting vector. If not successful, vi and vx are not modified.
PackCSC is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) PackCSCBytes ¶
func (vector Vector[D]) PackCSCBytes(vi, vx *SystemSlice[byte], iso bool, nvals int, jumbled bool, desc *Descriptor) error
PackCSCBytes is like Vector.PackCSC, except that vi and vx are passed as byte slices.
PackCSCBytes is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) PackFull ¶
func (vector Vector[D]) PackFull(vx *SystemSlice[D], iso bool, desc *Descriptor) error
PackFull packs a vector from a user slice in full format.
The vector must exist on input with the right type and size. No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
vx (INOUT): A SystemSlice of values. All entries with index < nvals are present.
iso (IN): If true, the resulting vector is iso.
nvals (IN): The number of entries in the resulting vector.
On successful return, vx is empty, to indicate that the user application no longer owns it. It has instead been moved to the resulting vector. If not successful, vx is not modified.
PackFull is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) PackFullBytes ¶
func (vector Vector[D]) PackFullBytes(vx *SystemSlice[byte], iso bool, desc *Descriptor) error
PackFullBytes is like Vector.PackFull, except that vx is passed as a byte slice.
PackFullBytes is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Print ¶
func (vector Vector[D]) Print(name string, pr PrintLevel) error
Print the contents of the vector to stdout.
GraphBLAS API errors that may be returned:
- InvalidValue: The underlying print routine returned an I/O error.
- NullPointer: vector is a nil pointer.
- UninitializedObject
GraphBLAS execution errors that may cause a panic:
Print is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) RemoveElement ¶
RemoveElement removes (annihilates) one stored element from a vector.
Parameters:
- index (IN): Index of element to be removed.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) Resize ¶
Resize changes the size of an existing vector.
Parameters:
- size (IN): The new size of the vector. It can be smaller or larger than the current size.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) SetBitmapSwitch ¶
SetBitmapSwitch determines how the vector is converted to the bitmap format.
Parameters:
- bitmapSwitch (IN): A value between 0 and 1.
SetBitmapSwitch is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) SetElement ¶
SetElement sets one element of a vector to a given value.
To pass a Scalar object instead of a non-opaque variable, use Vector.SetElementScalar.
Parameters:
val (IN): Scalar to assign.
index (IN): Index of element to be assigned.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) SetElementScalar ¶
SetElementScalar is like Vector.SetElement, except that the scalar value is passed as a Scalar object. It may be empty.
func (Vector[D]) SetSparsityControl ¶
SetSparsityControl determines the valid Sparsity format(s) for the vector.
SetSparsityControl is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Size ¶
Size retrieves the size of a vector.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (Vector[D]) Sort ¶
func (vector Vector[D]) Sort( into *Vector[D], p *Vector[int], op BinaryOp[bool, D, D], desc *Descriptor, ) error
Sort a vector.
Parameters:
into (OUT): Contains the vector of sorted values. If nil, this output is not produced.
p (OUT): Contains the permutations of the sorted values. If nil, this output is not produced.
op (IN): The comparator operation.
Sort is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Type ¶
Type returns the actual Type object representing the domain of the given vector. This is not necessarily the Type object corresponding to D, if Type is called on a VectorView of a vector of some other domain.
Type might return false as a second return value if the domain is not a Predefined or Complex domain, or if the type has not been registered with TypeNew or NamedTypeNew.
Type is a forGraphBLASGo extension. It can be used in place of GxB_Vector_type_name and GxB_Type_from_name, which are SuiteSparse:GraphBLAS extensions.
func (Vector[D]) UnpackBitmap ¶
func (vector Vector[D]) UnpackBitmap(desc *Descriptor) (vb SystemSlice[bool], vx SystemSlice[D], iso bool, nvals int, err error)
UnpackBitmap unpacks a vector to user slices in bitmap format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Return Values:
vb: A SystemSlice that indicates which indices are present: If vb is true at a given index, then the entry at that index is present with value given by vx at the same index. If vb is false at a given index, the entry at that index is not present, and the value given by vx at that index is ignored.
vx: A SystemSlice of values.
iso: If true, the input vector was iso.
nvals: The number of entries in the resulting slices.
On successful return, the input vector has no entries anymore, and the user application now owns the resulting slices. If not successful, the input vector is not modified.
UnpackBitmap is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) UnpackBitmapBytes ¶
func (vector Vector[D]) UnpackBitmapBytes(desc *Descriptor) (vb, vx SystemSlice[byte], iso bool, nvals int, err error)
UnpackBitmapBytes is like Vector.UnpackBitmap, except that vb and vx are returned as byte slices.
UnpackBitmapBytes is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) UnpackCSC ¶
func (vector Vector[D]) UnpackCSC(allowJumbled bool, desc *Descriptor) (vi SystemSlice[int], vx SystemSlice[D], iso bool, nvals int, jumbled bool, err error)
UnpackCSC unpacks a vector to user slices in CSC format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Parameters:
- allowJumbled (IN): If false, the indices in vi appear in ascending order. If true, the indices may appear in any order.
Return Values:
vi: A SystemSlice of indices of the corresponding values in vx.
vx: A SystemSlice of values.
iso: If true, the input vector was iso.
nvals: The number of entries in the resulting slices.
jumbled: If false, the indices in vi appear in sorted order.
On successful return, the input vector has no entries anymore, and the user application now owns the resulting slices. If not successful, the input vector is not modified.
UnpackCSC is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) UnpackCSCBytes ¶
func (vector Vector[D]) UnpackCSCBytes(allowJumbled bool, desc *Descriptor) (vi, vx SystemSlice[byte], iso bool, nvals int, jumbled bool, err error)
UnpackCSCBytes is like Vector.UnpackCSC, except that vi and vx are returned as byte slices.
UnpackCSCBytes is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) UnpackFull ¶
func (vector Vector[D]) UnpackFull(desc *Descriptor) (vx SystemSlice[D], iso bool, err error)
UnpackFull unpacks a vector to a user slice in full format.
No type casting is done, so the domain D must correctly reflect Vector.Type().
Return Values:
vx: A SystemSlice of values. All entries with index < size of vector are present.
iso: If true, the input vector was iso.
nvals: The number of entries in the resulting slices.
On successful return, the input vector has no entries anymore, and the user application now owns the resulting slice. If not successful, the input vector is not modified.
UnpackFull is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) UnpackFullBytes ¶
func (vector Vector[D]) UnpackFullBytes(desc *Descriptor) (vx SystemSlice[byte], iso bool, err error)
UnpackFullBytes is like Vector.UnpackFull, except that vx is returned as a byte slice.
UnpackFullBytes is a SuiteSparse:GraphBLAS extension.
func (Vector[D]) Valid ¶
Valid returns true if matrix has been created by a successful call to Vector.Dup or VectorNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type VectorIterator ¶
type VectorIterator[D any] struct { // contains filtered or unexported fields }
A VectorIterator iterates across the entries of a vector. Accessing all of the entries of a vector requires just a single loop. Any vector can be accessed with an entry iterator.
VectorIterator is a SuiteSparse:GraphBLAS extension.
func (VectorIterator) Err ¶
Err returns an error message about any errors encountered during the processing associated with the iterator.
GraphBLAS API errors that may be returned:
GraphBLAS execution errors that may cause a panic:
func (*VectorIterator) Free ¶
func (it *VectorIterator) Free() error
Free destroys a previously created VectorIterator, RowIterator, ColIterator, or EntryIterator and releases any resources associated with it. Calling Free on an object that is not valid is legal.
GraphBLAS execution errors that may cause a panic:
func (VectorIterator) Get ¶
func (it VectorIterator) Get() D
Get returns the value of the current iterator entry.
Get is a SuiteSparse:GraphBLAS extension.
func (VectorIterator[D]) GetIndex ¶
func (it VectorIterator[D]) GetIndex() int
GetIndex returns the current index.
GetIndex is a SuiteSparse:GraphBLAS extension.
func (VectorIterator[D]) Getp ¶
func (it VectorIterator[D]) Getp() int
Getp returns the current position of the iterator.
Getp is a SuiteSparse:GraphBLAS extension.
func (VectorIterator[D]) Getpmax ¶
func (it VectorIterator[D]) Getpmax() int
Getpmax returns Vector.Nvals(); or Vector.Size() for bitmap vectors.
Getpmax is a SuiteSparse:GraphBLAS extension.
func (VectorIterator[D]) Next ¶
Next moves the iterator to the next entry. It returns true, nil if the iterator is at an entry that exists in the vector, or false, nil otherwise.
Next is a SuiteSparse:GraphBLAS extension.
func (VectorIterator[D]) Seek ¶
Seek moves the vector iterator to the given position p, which is in the range 0 to pmax - 1, with pmax = VectorIterator.Getpmax().
If p >= pmax, the iterator is exhausted and false, nil is returned. Otherwise true, nil is returned.
All entries in the matrix are given an ordinal position p. Seeking to position p will either move the iterator to that particular position, or to the next higher position containing an entry if there is no entry at position p. The latter case only occurs for bitmap vectors. Use EntryIterator.Getp to determine the current position of the iterator.
Seek is a SuiteSparse:GraphBLAS extension.
func (VectorIterator) Valid ¶
func (it VectorIterator) Valid() bool
Valid returns true if the iterator has been created by a successful call to Vector.IteratorNew, Matrix.IteratorNew, Matrix.RowIteratorNew, or Matrix.ColIteratorNew.
Valid is a forGraphBLASGo extension. It is used in place of comparing against GrB_INVALID_HANDLE.
type VectorMask ¶
A VectorMask can be used to optionally control which results from a GraphBLAS operation are stored into an output vector. The vector size must match that of the output. If the Structure descriptor is not set for the mask, the domain of the mask vector must be of type bool, any of the Predefined "built-in" types, or any of the Complex "built-in" types. Use Vector.AsMask to convert to the required parameter type. If the default mask is desired (i.e., a mask that is all true with the size of the output vector), nil should be specified.
The forGraphBLASGo API does not use the VectorMask type, but directly uses *Vector[bool] instead.
Source Files ¶
- apply.go
- assign.go
- binaryop.go
- context.go
- descriptor.go
- errors.go
- ewiseadd.go
- ewisemult.go
- ewiseunion.go
- extract.go
- grb.go
- index.go
- indexunaryop.go
- init.go
- iterator.go
- kronecker.go
- matrix.go
- monoid.go
- multiply.go
- option.go
- pack.go
- packbytes.go
- print.go
- reduce.go
- scalar.go
- select.go
- semiring.go
- subassign.go
- system.go
- transpose.go
- type.go
- unaryop.go
- util.go
- vector.go