I am porting an existing code from MATLAB to C++ and have a linear system to solve $xA=b$ (rather than the more typical form $Ax=b$)The matrix $A$ is dense, and of general form, but is no larger than 1000x1000.So in MATLAB, the solution is found by the mrdivide(b,A) function or the forward-slash notation x = b/A;How should I solve this in my C++ code using BLAS and LAPACK routines?I'm familiar with the LAPACK routine DGESV which solves $Ax=b$ for $x$.So, one thought I had is to do some manipulations using matrix transpose identities:$(xA)^T=b^T$$A^T x^T = b^T$$x^T = (A^T)^{-1} b^T$Then solve the final form using DGESV operating on the transposed $A^T$. (so cost to transpose $A$ and cost to solve system)Is there an approach more efficient or otherwise better?I am working with matrix and vector classes as well as BLAS implementation from the BOOST uBLAS library as well as bindings to the LAPACK library routines.  I've been using this setup successfully for other operations and am hoping to find a solution limited to these libraries.Also, I should note I am only performing this type of operation a few times during code setup, so performance is not a critical concern.Maybe this MATLAB documentation on mrdivide is helpful for others.
solve $xA=b$ for $x$ using LAPACK and BLAS
linear solver;c++;lapack
Trivial answer for square $A$: use dgesvx which solves also for $A^T x = b$ when TRANS = 'T'. Please note that with BLAS or LAPACK you hardly have to transpose (swapping elements in memory) a matrix: most of the subroutines have a TRANS argument to accommodate for operation on the transpose matrix or on a matrix stored with a different memory layout. (Transposition is equivalent to changing Fortran-contiguous memory layout to a C-contiguos one and viceversa.)