Main Content

pagelsqminnorm

Page-wise minimum-norm least-squares solution to linear equation

Since R2024a

    Description

    X = pagelsqminnorm(A,B) computes the minimum-norm solution of the least-squares system AX = B for each page of the N-D arrays A and B. Each page of the output array X is given by X(:,:,i) = lsqminnorm(A(:,:,i),B(:,:,i)).

    If A and B have more than three dimensions, then pagelsqminnorm implicitly expands the additional dimensions to solve the least-squares systems of all page combinations, as in X(:,:,i,j,k) = lsqminnorm(A(:,:,i,j,k),B(:,:,i,j,k)).

    example

    X = pagelsqminnorm(A,B,tol) specifies one or more tolerances that pagelsqminnorm uses to determine the rank of each page of A.

    X = pagelsqminnorm(___,RegularizationFactor=alpha) specifies the Tikhonov regularization factors to apply to each page of the solution X. (since R2025a)

    Examples

    collapse all

    Create a 3-by-3-by-2 array A and a 3-by-1-by-2 array B.

    A = cat(3,magic(3),hilb(3))
    A = 
    A(:,:,1) =
    
         8     1     6
         3     5     7
         4     9     2
    
    
    A(:,:,2) =
    
        1.0000    0.5000    0.3333
        0.5000    0.3333    0.2500
        0.3333    0.2500    0.2000
    
    
    B = ones(3,1,2)
    B = 
    B(:,:,1) =
    
         1
         1
         1
    
    
    B(:,:,2) =
    
         1
         1
         1
    
    

    Solve the linear system A(:,:,i)*X(:,:,i) = B(:,:,i) for each corresponding set of pages in A and B using pagelsqminnorm.

    X = pagelsqminnorm(A,B)
    X = 
    X(:,:,1) =
    
        0.0667
        0.0667
        0.0667
    
    
    X(:,:,2) =
    
        3.0000
      -24.0000
       30.0000
    
    

    Input Arguments

    collapse all

    Coefficient array, specified as a matrix or multidimensional array.

    Data Types: single | double
    Complex Number Support: Yes

    Input array, specified as a matrix or multidimensional array.

    Data Types: single | double
    Complex Number Support: Yes

    Rank tolerance, specified as a nonnegative scalar or multidimensional array of size [1 1 size(A,3:ndims(A))]. Specifying the tolerance can help the solutions be resilient against random noise in the coefficient matrix. Specify a scalar tolerance to use the same tolerance for all array pages. Specify an array of tolerances to use a different tolerance for each page.

    By default, pagelsqminnorm computes the tolerance based on the QR decomposition of each page of A.

    Example: X = pagelsqminnorm(A,B,1e-2)

    Data Types: double

    Since R2025a

    Tikhonov regularization factors for the least-squares solution, specified as a real number or multidimensional array of size [1 1 size(X,3:ndims(X))]. Specifying the regularization factors as alpha returns a solution X that minimizes pagenorm(A.*X-B).^2 + alpha.^2.*pagenorm(X).^2 for each column of each page of X. Specify a real number to use the same regularization factor for all pages. Specify an array to use a different regularization factor for each page.

    For ill-conditioned problems, specifying the regularization factors gives preference to solutions with smaller norms.

    Data Types: double | single

    More About

    collapse all

    Tips

    • pagelsqminnorm(A,B,tol) is typically more efficient than pagemtimes(pagepinv(A,tol),B) for computing minimum-norm least-squares solutions to linear systems. pagelsqminnorm uses the complete orthogonal decomposition (COD) to find a low-rank approximation of each page of A, while pagepinv uses the singular value decomposition (SVD). Therefore, the results of pagepinv and pagelsqminnorm do not match exactly.

    • Results obtained using pagelsqminnorm are numerically equivalent to using lsqminnorm to compute the minimum-norm solution of each of the same least-squares systems in a for-loop. However, the two results might differ slightly due to floating-point round-off error.

    Extended Capabilities

    expand all

    Version History

    Introduced in R2024a

    expand all