# Revision history [back]

### linear least-squares for large-scale dense matrix

I use the function "cv::solve(src1, src2, dst, DECOMP_SVD)" to solve a least-squares problem (i.e., src1 * dst = src2). The size of src1 is 29030 * 7809 and the size of src2 is 29030 * 122. Both types of src1 and src2 are CV_32FC1. OpenCV crashes at the 1370 line of "lapack.cpp" and the code of this line is "buffer.allocate(bufsize)". "buffer" is a cv::Mat and "bufsize" is 1151016404. Is this problem caused by out-of-memory? My physical memory is 8G and operating system is 64bit Win7.

Mat A(29030,7809,CV_32FC1);
Mat b(29030,122,CV_32FC1);
for(i=0;i<29030;i++)
{
for(j=0;j<7809;j++)
A.at<float>(i,j)=float(i*7809+j);

for(j=0;j<122;j++)
b.at<float>(i,j)=float(i*122+j);
}

Mat x;
solve(A,b,x,DECOMP_SVD);


### linear least-squares for large-scale dense matrix

I use the function "cv::solve(src1, src2, dst, DECOMP_SVD)" to solve a least-squares problem (i.e., src1 * dst = src2). The size of src1 is 29030 * 7809 and the size of src2 is 29030 * 122. Both types of src1 and src2 are CV_32FC1. OpenCV crashes at the 1370 line of "lapack.cpp" and the code of this line is "buffer.allocate(bufsize)". "buffer" is a cv::Mat "AutoBuffer< uchar >" and "bufsize" is 1151016404. Is this problem caused by out-of-memory? My physical memory is 8G and operating system is 64bit Win7.

Mat A(29030,7809,CV_32FC1);
Mat b(29030,122,CV_32FC1);
for(i=0;i<29030;i++)
{
for(j=0;j<7809;j++)
A.at<float>(i,j)=float(i*7809+j);

for(j=0;j<122;j++)
b.at<float>(i,j)=float(i*122+j);
}

Mat x;
solve(A,b,x,DECOMP_SVD);