1 #pragma once
2 
3 #include <tuple>
4 
5 #include <absl/types/optional.h>
6 
7 #include "chainerx/array.h"
8 #include "chainerx/dtype.h"
9 
10 namespace chainerx {
11 
12 Array Dot(const Array& a, const Array& b, absl::optional<Dtype> out_dtype = absl::nullopt);
13 
14 Array Solve(const Array& a, const Array& b);
15 
16 Array Inverse(const Array& a);
17 
18 std::tuple<Array, Array, Array> Svd(const Array& a, bool full_matrices, bool compute_uv);
19 
20 Array PseudoInverse(const Array& a, float rcond);
21 
22 enum class QrMode {
23     // if K = min(M, N), where `a` of shape (M, N)
24     kReduced,  // returns q, r with dimensions (M, K), (K, N) (default)
25     kComplete,  // returns q, r with dimensions (M, M), (M, N)
26     kR,  // returns empty q and r with dimensions (0, 0), (K, N)
27     kRaw  // returns h, tau with dimensions (N, M), (K, 1)
28 };
29 
30 std::tuple<Array, Array> Qr(const Array& a, QrMode mode);
31 
32 Array Cholesky(const Array& a);
33 
34 // TODO(hvy): Define and use an enum for `uplo` to avoid invalid values.
35 std::tuple<Array, Array> Eigh(const Array& a, char uplo);
36 
37 // TODO(hvy): Define and use an enum for `uplo` to avoid invalid values.
38 Array Eigvalsh(const Array& a, char uplo);
39 
40 }  // namespace chainerx
41