arcadiaphy commented on a change in pull request #15007: Add matrix determinant
operator in linalg
URL: https://github.com/apache/incubator-mxnet/pull/15007#discussion_r287308363
##########
File path: src/operator/tensor/la_op-inl.h
##########
@@ -458,14 +458,90 @@ struct inverse {
template<typename xpu, typename DType>
static void op(const Tensor<xpu, 3, DType>& B, const Tensor<xpu, 3, DType>&
A,
const OpContext& ctx, const nnvm::NodeAttrs& attrs) {
- Stream<xpu> *s = ctx.get_stream<xpu>();
- // Reserve workspace (size determined by query)
- int lwork(linalg_getri_workspace_query(A, s));
- Tensor<xpu, 1, DType> work = ctx.requested[0]
- .get_space_typed<xpu, 1, DType>(Shape1(lwork), s);
// Since inverse(A) = trans(inverse(trans(A))), so we don't need to
transpose
// A even if we are using the col-major version of getrf and getri
routines.
- linalg_batch_inverse(A, B, work, s);
+ linalg_batch_inverse(A, B, ctx);
+ }
+};
+
+// partial pivoting LU decomposition: A = PLU, so det(A) = det(P)det(L)det(U)
Review comment:
I want to explain the computation method in det, I'll change the comment to
make it more clearly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services