The names TRIL and TRIU for the biult-in GrB_IndexUnaryOps derive from the MATLAB functions of the same name, but they are off by one from MATLAB.
In MATLAB,
TRIL (A, 0) returns entries on or below the main diagonal (k = 0).
TRIU (A, 0) returns entries on or above the main diagonal. The 2nd parameter is the "thunk" scalar.
These tests correspond to (j-i) <= thunk for TRIL, and (j-i) >= thunk for TRIU.
But in the GrB_IndexUnaryOps, TRIL is defined as j < (i+thunk), which is the same as (j-i) < thunk. As a result, TRIL(A,0) in MATLAB is TRIL(A,1) in GraphBLAS. This will cause confusion, since it's off by just one.
I suggest that the TRIL operator be defined as (j-i) <= thunk, or (j-i) <= s using the notation in the spec.
TRIU should be (j-i) >= s.
The names TRIL and TRIU for the biult-in GrB_IndexUnaryOps derive from the MATLAB functions of the same name, but they are off by one from MATLAB.
In MATLAB, TRIL (A, 0) returns entries on or below the main diagonal (k = 0). TRIU (A, 0) returns entries on or above the main diagonal. The 2nd parameter is the "thunk" scalar. These tests correspond to (j-i) <= thunk for TRIL, and (j-i) >= thunk for TRIU.
But in the GrB_IndexUnaryOps, TRIL is defined as j < (i+thunk), which is the same as (j-i) < thunk. As a result, TRIL(A,0) in MATLAB is TRIL(A,1) in GraphBLAS. This will cause confusion, since it's off by just one.
I suggest that the TRIL operator be defined as (j-i) <= thunk, or (j-i) <= s using the notation in the spec. TRIU should be (j-i) >= s.