Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Names 2d coordinates of Row/Col are misleading. X, Y instead of Y, X #314

Closed
walldiss opened this issue Apr 9, 2024 · 3 comments · Fixed by #317
Closed

Names 2d coordinates of Row/Col are misleading. X, Y instead of Y, X #314

walldiss opened this issue Apr 9, 2024 · 3 comments · Fixed by #317

Comments

@walldiss
Copy link
Member

walldiss commented Apr 9, 2024

n the GetCell/SetCell functions, the input coordinates are reversed. For example, in the code here, the row is accessed using the X coordinate and the column with the Y coordinate. Traditionally, the X axis refers to the horizontal axis and the Y axis to the vertical. Therefore, the row index should be identified by Y, and the column index by X. This inconsistency also appears in other functions like col, getColRoot, colSlice, etc.

Example:

func (ds *dataSquare) rowSlice(x uint, y uint, length uint) [][]byte {
	return ds.squareRow[x][y : y+length]
}

Perhaps we should swap the use of X and Y coordinates in these functions and in other similar functions.

@rootulp
Copy link
Collaborator

rootulp commented Apr 9, 2024

Alternatively we can replace all usages of x and y with the more explicit row and col.

@walldiss
Copy link
Member Author

walldiss commented Apr 9, 2024

The problem with row and col are usually used for variable pointing to axis slice itself. So it rather needs to be rowIdx and colIdx, which not so nice

@rootulp
Copy link
Collaborator

rootulp commented Apr 9, 2024

I'm fine with either: rowIdx/colIdx or fixing x/y

walldiss added a commit that referenced this issue Apr 18, 2024
This PR standardizes index naming for rows and columns across the
codebase to `rowIdx` and `colIdx`.

Resolves #314
0xchainlover pushed a commit to celestia-org/rsmt2d that referenced this issue Aug 1, 2024
This PR standardizes index naming for rows and columns across the
codebase to `rowIdx` and `colIdx`.

Resolves celestiaorg/rsmt2d#314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants