When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
34 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
so where does it fail atm?
there is no error, however i cant iterate the columns. Basically i need another loop or some other logic i suppose to iterate columns
ill print result
The statements with (comma) indicate diagonal and x
basically the rows are ok but columns are most often than not incorrect 6x7 matrix
can't you just calculate the start column? and then go one row and column up until you hit the end?
or down, whichever direction you wanna do it in
ye thats the problem, i dont know how to get the start column of submatrices
well, the submatrices are 2×2 if i understand correctly?
well, are they all the same size at least?
yes
well
the last submatrices probably not
the ones closest to cols or rows, they are limited by the number of cols and rows thus min(x + block, row or col)
well then you can just think of it as a matrix of submatrices. and forget they are submatrices at first. just calcumate the start row/col in the matrix of submatrices. and then multiply by the submatrix size to get the actual index in the full matrix.
hmmmmm
I dont get it
i pass in a function row + block, col + block until it reaches row + block > rows and col + block > cols?
and even if i did that, how would they be differentiated between each other? If i just multiply them by size of block it wont give me much.
lets say submatrix 0 has 200 rows, i multiply any index by 200.
submatrix 1 has 200 rows again, i multiply any index by 200 i wont get anything in the big matrix.
i'm not following
you take the index of the submatrix and multiply it by 200. and you get the index where that submatrix begins in the big matrix?
but u cant differentiate between rows like that no?
or im confused
ah hmm index of submatrix, which would mean we index all the submatrices
you mean smth like this
lets say we have 6x7 blocks of size 2. First i find how many submatrices i have so in this case 12? 4 per row.
for (int d = 0; d < submatriceSize(12); d++)
function(matrixS, blockSize, id)
function(matrixS, blockSize, id)
{
//iterate rows
//iterate cols
}
only question i have is how do i get the id so i know which matrix goes first or rather how many submatrices to do at the same time
if you want to parallelize, ideally, you'd have each thread process the same number of blocks, no?
you could do this
i.e., have the shorter diagonals wrap around to process the other half of the corresponding diagonal on the other side of the matrix
that way, all diagonals have the same number of elements on them
@red garden
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
!solved