Comments (5)
OK ... the fix passes this simple test. I've pushed the fix, and I'll try my exhaustive tests now. If you do a git pull on the master branch, for the draft v5.1.7, it should work now.
from graphblas.
Can you check it in the C API? There might be a bug in the Rust or Java interface. It works fine in C. Which version of GraphBLAS did you use? Note that in version 5.1.x, the matrix B becomes iso-valued. Does mat2.get(...) use GrB_Matrix_extractElement or does it try to get the value itself?
#include "GraphBLAS.h"
// to compile and run:
// gcc bug.c /usr/local/lib/libgraphblas.so -lm -Wl,--verbose
// ldd a.out
// ./a.out
#if java_example
fn test_matrix_apply_transpose_on_self_fail_java() {
let mut mat1 = SparseMatrix::<i32>::empty((1, 3));
mat1.insert((0, 0), -3); // GrB_Matrix_setElement
mat1.insert((0, 2), -4);
mat1.insert((0, 1), 10);
mat1.wait();
// GrB_Marix_apply
let mut mat2 = mat1.apply_mut::<i32, bool>(
UnaryOp::<i32, i32>::one(), //GxB_ONE_INT32
None,
None,
&Descriptor::default(),
);
mat2.wait();
assert_eq!(mat2.shape(), (1, 3));
assert_eq!(mat2.get((0, 0)), Some(1)); //this fails
assert_eq!(mat2.get((0, 2)), Some(1)); //this fails
assert_eq!(mat2.get((0, 1)), Some(1)); //this fails
}
#endif
int main (void)
{
GrB_init (GrB_NONBLOCKING) ;
int ver [3] ;
GxB_get (GxB_LIBRARY_VERSION, ver) ;
printf ("SuiteSparse:GraphBLAS v%d.%d.%d\n", ver [0], ver [1], ver [2]) ;
GrB_Matrix A, B ;
GrB_Matrix_new (&A, GrB_INT32, 1, 3) ;
GxB_print (A, 3) ;
GrB_Matrix_setElement_INT32 (A, -3, 0, 0) ;
GrB_Matrix_setElement_INT32 (A, -4, 0, 2) ;
GrB_Matrix_setElement_INT32 (A, 10, 0, 1) ;
GxB_print (A, 3) ;
GrB_Matrix_wait (&A) ;
GrB_Matrix_new (&B, GrB_INT32, 1, 3) ;
GrB_apply (B, NULL, NULL, GxB_ONE_INT32, A, NULL) ;
GxB_print (B, 3) ;
int32_t result = 42 ;
GrB_Matrix_extractElement_INT32 (&result, B, 0, 0) ;
printf ("B(0,0) = %d\n", result) ;
printf ("test: %s\n", (result == 1) ? "PASS" : "FAIL") ;
result = 99 ;
GrB_Matrix_extractElement_INT32 (&result, B, 0, 2) ;
printf ("B(0,2) = %d\n", result) ;
printf ("test: %s\n", (result == 1) ? "PASS" : "FAIL") ;
result = 101 ;
GrB_Matrix_extractElement_INT32 (&result, B, 0, 1) ;
printf ("B(0,1) = %d\n", result) ;
printf ("test: %s\n", (result == 1) ? "PASS" : "FAIL") ;
GrB_free (&A) ;
GrB_free (&B) ;
GrB_finalize ( ) ;
}
WIth the above code, I get this output, which is the correct result:
SuiteSparse:GraphBLAS v5.1.6
1x3 GraphBLAS int32_t matrix, sparse by row
A, no entries, memory: 272 bytes
1x3 GraphBLAS int32_t matrix, bitmap by row
A, 3 entries, memory: 280 bytes
(0,0) -3
(0,1) 10
(0,2) -4
1x3 GraphBLAS int32_t matrix, bitmap by row
B, 3 entries, memory: 272 bytes
iso value: 1
(0,0) 1
(0,1) 1
(0,2) 1
B(0,0) = 1
test: PASS
B(0,2) = 1
test: PASS
B(0,1) = 1
test: PASS
from graphblas.
I narrowed down to apply with one
on the matrix itself, when I call GrB_Apply
on a different matrix it works.
// along these lines
GrB_apply (A, NULL, NULL, GxB_ONE_INT32, A, NULL) ;
from graphblas.
Oops. That's a bug. I replicated it, and when I turn on debug in the Source/GB_dev.h, one of my assertions fails in GB_apply.c in the "in-place-op" part, line 236:
Line 236 in 9d36ba4
from graphblas.
Awesome
from graphblas.
Related Issues (20)
- Consider adding COLEQ and ROWEQ IndexUnaryOp operators HOT 9
- New unary operators to calculate principal cube root of real (floating point) values HOT 5
- Matrix_extractElement_Structural HOT 6
- Pass a print function for UDTs HOT 4
- GrB_Descriptor_set is unable to set expected descriptor fields (does not match GxB_Desc_set) HOT 4
- Set name of UDT when serializing HOT 12
- Build broken with spaces in folder names HOT 8
- build fails on windows 11 using CMake with MinGW HOT 5
- ISEQ monoids HOT 7
- Fix bitwise operator monoid names HOT 4
- Remove va_arg HOT 5
- GrB_Vector_(de)serialize HOT 6
- Sparse Index Space HOT 2
- Removed symbols without soname bump HOT 12
- atomic*: Undefined symbol on armel and mipsel architectures HOT 33
- "ZEROB" Binary Operator HOT 3
- GxB sort with smaller (or larger) output objects
- cpu_features: Build error for MinGW HOT 13
- Size of Static Library HOT 16
- Link error with Intel igx and Ninja generator on Windows HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphblas.