NumCpp  2.16.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
svd.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <utility>
31
35#include "NumCpp/NdArray.hpp"
36
37namespace nc::linalg
38{
39 //============================================================================
40 // Method Description:
50 template<typename dtype>
52 {
54
55 const auto svd = SVD{ inArray };
56
57 outU = svd.u();
58 outS = std::move(svd.s()[Slice(std::min(inArray.numRows(), inArray.numCols()))]);
59 outVT = std::move(svd.v().transpose());
60 }
61} // namespace nc::linalg
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
A Class for slicing into NdArrays.
Definition Slice.hpp:45
Performs the singular value decomposition of a general matrix.
Definition svd/svd.hpp:50
const NdArray< double > & u() const noexcept
Definition svd/svd.hpp:76
Definition cholesky.hpp:41
void svd(const NdArray< dtype > &inArray, NdArray< double > &outU, NdArray< double > &outS, NdArray< double > &outVT)
Definition svd.hpp:51
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59