// ----------------------------------------------------------------------------
// -                        Open3D: www.open3d.org                            -
// ----------------------------------------------------------------------------
// Copyright (c) 2018-2024 www.open3d.org
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------

#pragma once

#include "open3d/core/Tensor.h"

namespace open3d {
namespace core {

/// Computes A^{-1} with LU factorization, where A is a N x N square matrix.
void Inverse(const Tensor& A, Tensor& output);

void InverseCPU(void* A_data,
                void* ipiv_data,
                [[maybe_unused]] void* output_data,
                int64_t n,
                Dtype dtype,
                const Device& device);

#ifdef BUILD_SYCL_MODULE
void InverseSYCL(void* A_data,
                 void* ipiv_data,
                 [[maybe_unused]] void* output_data,
                 int64_t n,
                 Dtype dtype,
                 const Device& device);
#endif

#ifdef BUILD_CUDA_MODULE
void InverseCUDA(void* A_data,
                 void* ipiv_data,
                 void* output_data,
                 int64_t n,
                 Dtype dtype,
                 const Device& device);
#endif

}  // namespace core
}  // namespace open3d
