MCPcopy Create free account
hub / github.com/creatale/node-dv / cvSVD

Function cvSVD

deps/opencv/modules/core/src/lapack.cpp:1738–1807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1736
1737
1738CV_IMPL void
1739cvSVD( CvArr* aarr, CvArr* warr, CvArr* uarr, CvArr* varr, int flags )
1740{
1741 cv::Mat a = cv::cvarrToMat(aarr), w = cv::cvarrToMat(warr), u, v;
1742 int m = a.rows, n = a.cols, type = a.type(), mn = std::max(m, n), nm = std::min(m, n);
1743
1744 CV_Assert( w.type() == type &&
1745 (w.size() == cv::Size(nm,1) || w.size() == cv::Size(1, nm) ||
1746 w.size() == cv::Size(nm, nm) || w.size() == cv::Size(n, m)) );
1747
1748 cv::SVD svd;
1749
1750 if( w.size() == cv::Size(nm, 1) )
1751 svd.w = cv::Mat(nm, 1, type, w.data );
1752 else if( w.isContinuous() )
1753 svd.w = w;
1754
1755 if( uarr )
1756 {
1757 u = cv::cvarrToMat(uarr);
1758 CV_Assert( u.type() == type );
1759 svd.u = u;
1760 }
1761
1762 if( varr )
1763 {
1764 v = cv::cvarrToMat(varr);
1765 CV_Assert( v.type() == type );
1766 svd.vt = v;
1767 }
1768
1769 svd(a, ((flags & CV_SVD_MODIFY_A) ? cv::SVD::MODIFY_A : 0) |
1770 ((!svd.u.data && !svd.vt.data) ? cv::SVD::NO_UV : 0) |
1771 ((m != n && (svd.u.size() == cv::Size(mn, mn) ||
1772 svd.vt.size() == cv::Size(mn, mn))) ? cv::SVD::FULL_UV : 0));
1773
1774 if( u.data )
1775 {
1776 if( flags & CV_SVD_U_T )
1777 cv::transpose( svd.u, u );
1778 else if( u.data != svd.u.data )
1779 {
1780 CV_Assert( u.size() == svd.u.size() );
1781 svd.u.copyTo(u);
1782 }
1783 }
1784
1785 if( v.data )
1786 {
1787 if( !(flags & CV_SVD_V_T) )
1788 cv::transpose( svd.vt, v );
1789 else if( v.data != svd.vt.data )
1790 {
1791 CV_Assert( v.size() == svd.vt.size() );
1792 svd.vt.copyTo(v);
1793 }
1794 }
1795

Callers 1

icvFitLine3D_wodsFunction · 0.85

Calls 10

cvarrToMatFunction · 0.85
SizeFunction · 0.85
MatClass · 0.85
maxFunction · 0.70
minFunction · 0.70
typeMethod · 0.45
sizeMethod · 0.45
isContinuousMethod · 0.45
copyToMethod · 0.45
diagMethod · 0.45

Tested by

no test coverage detected