ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
LeastSquares.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
11 
12 namespace cloudViewer {
13 namespace core {
14 
16 void LeastSquares(const Tensor& A, const Tensor& B, Tensor& X);
17 
18 #ifdef BUILD_CUDA_MODULE
19 void LeastSquaresCUDA(void* A_data,
20  void* B_data,
21  int64_t m,
22  int64_t n,
23  int64_t k,
24  Dtype dtype,
25  const Device& device);
26 #endif
27 
28 #ifdef BUILD_SYCL_MODULE
29 void LeastSquaresSYCL(void* A_data,
30  void* B_data,
31  int64_t m,
32  int64_t n,
33  int64_t k,
34  Dtype dtype,
35  const Device& device);
36 #endif
37 
38 void LeastSquaresCPU(void* A_data,
39  void* B_data,
40  int64_t m,
41  int64_t n,
42  int64_t k,
43  Dtype dtype,
44  const Device& device);
45 
46 } // namespace core
47 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
cloudViewer::core::Tensor::Clone
Tensor Clone() const
Copy Tensor to the same device.
Definition: Tensor.h:502
CUDAUtils.h
Common CUDA utilities.
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
cloudViewer::core::LeastSquaresCUDA
void LeastSquaresCUDA(void *A_data, void *B_data, int64_t m, int64_t n, int64_t k, Dtype dtype, const Device &device)
Definition: LeastSquaresCUDA.cpp:24
AssertTensorDevice
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
cloudViewer::core::Tensor::Slice
Tensor Slice(int64_t dim, int64_t start, int64_t stop, int64_t step=1) const
Definition: Tensor.cpp:857
cloudViewer::core::LeastSquaresCPU
void LeastSquaresCPU(void *A_data, void *B_data, int64_t m, int64_t n, int64_t k, Dtype dtype, const Device &device)
Definition: LeastSquaresCPU.cpp:15
cloudViewer::core::Tensor
Definition: Tensor.h:32
cloudViewer::core::Dtype
Definition: Dtype.h:21
cloudViewer::core::Device::IsCUDA
bool IsCUDA() const
Returns true iff device type is CUDA.
Definition: Device.h:49
cloudViewer::core::Device::IsSYCL
bool IsSYCL() const
Returns true iff device type is SYCL GPU.
Definition: Device.h:52
cloudViewer::core::Tensor::T
Tensor T() const
Expects input to be <= 2-D Tensor by swapping dimension 0 and 1.
Definition: Tensor.cpp:1079
cloudViewer::core::Device
Definition: Device.h:18
core
cloudViewer::core::Float64
const Dtype Float64
Definition: Dtype.cpp:43
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::CUDAScopedDevice
When CUDA is not enabled, this is a dummy class.
Definition: CUDAUtils.h:214
cloudViewer::core::Float32
const Dtype Float32
Definition: Dtype.cpp:42
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
cloudViewer::core::LeastSquaresSYCL
void LeastSquaresSYCL(void *A_data, void *B_data, int64_t m, int64_t n, int64_t k, Dtype dtype, const Device &device)
Definition: LeastSquaresSYCL.cpp:19
LogError
#define LogError(...)
Definition: Logging.h:60
AssertTensorDtype
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
Tensor.h
LeastSquares.h
X
void * X
Definition: SmallVector.cpp:45
cloudViewer::core::LeastSquares
void LeastSquares(const Tensor &A, const Tensor &B, Tensor &X)
Solve AX = B with QR decomposition. A is a full-rank m x n matrix (m >= n).
Definition: LeastSquares.cpp:17
AssertTensorDtypes
#define AssertTensorDtypes(tensor,...)
Definition: TensorCheck.h:33
cloudViewer::core::Tensor::GetDataPtr
T * GetDataPtr()
Definition: Tensor.h:1144