ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Kernel.cpp
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 
9 
10 #include <Logging.h>
11 
12 #include <cmath>
13 #include <vector>
14 
16 
17 namespace cloudViewer {
18 namespace core {
19 namespace kernel {
20 
22  // Blas
23  std::vector<double> A{1.0, 2.0, 1.0, -3.0, 4.0, -1.0};
24  std::vector<double> B{1.0, 2.0, 1.0, -3.0, 4.0, -1.0};
25  std::vector<double> C{0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5};
26  cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans, 3, 3, 2, 1, A.data(),
27  3, B.data(), 3, 2, C.data(), 3);
28  utility::LogInfo("TestBlas Done.");
29 
30  // Lapack
31  int64_t m = 6;
32  int64_t n = 5;
33  int64_t lda = m;
34  int64_t ldu = m;
35  int64_t ldvt = n;
36  std::vector<float> superb(std::min(m, n) - 1);
37  std::vector<float> s(n);
38  std::vector<float> u(ldu * m);
39  std::vector<float> vt(ldvt * n);
40  std::vector<float> a{8.79f, 6.11f, -9.15f, 9.57f, -3.49f, 9.84f,
41  9.93f, 6.91f, -7.93f, 1.64f, 4.02f, 0.15f,
42  9.83f, 5.04f, 4.86f, 8.83f, 9.80f, -8.99f,
43  5.45f, -0.27f, 4.85f, 0.74f, 10.00f, -6.02f,
44  3.16f, 7.98f, 3.01f, 5.80f, 4.27f, -5.31f};
45  LAPACKE_sgesvd(LAPACK_COL_MAJOR, 'A', 'A', m, n, a.data(), lda, s.data(),
46  u.data(), ldu, vt.data(), ldvt, superb.data());
47  utility::LogInfo("TestLapack Done.");
48 }
49 
50 } // namespace kernel
51 } // namespace core
52 } // namespace cloudViewer
#define LogInfo(...)
Definition: Logging.h:81
int min(int a, int b)
Definition: cutil_math.h:53
Generic file read and write utility for python interface.