haojin2 commented on a change in pull request #16913: [numpy] add op linalg solve URL: https://github.com/apache/incubator-mxnet/pull/16913#discussion_r354583933
########## File path: src/operator/numpy/linalg/np_solve-inl.h ########## @@ -0,0 +1,497 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/*! + * Copyright (c) 2019 by Contributors + * \file np_solve-inl.h + * \brief Placeholder for solve linear equation + */ +#ifndef MXNET_OPERATOR_NUMPY_LINALG_NP_SOLVE_INL_H_ +#define MXNET_OPERATOR_NUMPY_LINALG_NP_SOLVE_INL_H_ + +#include <mxnet/operator_util.h> +#include <vector> +#include "../../tensor/la_op.h" +#include "../../tensor/la_op-inl.h" +#include "../../linalg.h" +#include "../../operator_common.h" + +namespace mxnet { +namespace op { + +using namespace mshadow; + +template<typename xpu, typename DType> +void linalg_solve(const Tensor<xpu, 2, DType>& A, + const Tensor<xpu, 2, DType>& X, + const Tensor<xpu, 1, int>& ipiv, + Stream<xpu> *s); + +template<typename xpu, typename DType> +void linalg_batch_solve(const Tensor<xpu, 3, DType>& A, + const Tensor<xpu, 3, DType>& X, + const Tensor<xpu, 2, int>& ipiv, + const mxnet::OpContext& ctx); + +template<typename xpu, typename DType> inline +int linalg_dn_getrf_workspace_query(const Tensor<xpu, 2, DType>& A, + Stream<xpu> *s); + +template<typename xpu, typename DType> inline +void linalg_dn_getrf(const Tensor<xpu, 2, DType>& A, + const Tensor<xpu, 1, int>& ipiv, + Stream<xpu> *s); + +template<typename xpu, typename DType> inline +void linalg_dn_getrs(const Tensor<xpu, 2, DType>& A, + const Tensor<xpu, 2, DType>& X, + const Tensor<xpu, 1, int>& ipiv, + Stream<xpu> *s); + +// kernel for conversing type +struct SolveTypeHelper { Review comment: there's a kernel named `identity_with_cast` in src/operator/mshadow_op.h ---------------------------------------------------------------- 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
