Factorization for batched matrices


I noticed a function for lu factorization of batched matrices - cublasDgetrfBatched() which accepts the vector of matrices. Is there a possibility to pass one-dimensional array of matrices to this function or is there any alternative to this function for that purpose. From the function signature I understood that it expects something like vector[BatchId][NxN], where first major index is index of a matrix and second corresponds to matrix element. I already have a matrix but stored as a one-dim array, like this - vector[N1xN1, N2xN2, … NkxNk], where N1 = N2 = … = Nk Could you please give some clarifications, whether such layout could be passed into that function?

Thank you,

You can’t pass that layout “directly”, however it should be trivial to pass the correct input representation. You would simply pass a vector that looks like:

v = [ vector, vector + N*N, vector + N*N*2,  ...]

This can be done trivially with a for-loop in host code.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.