(B3, Y_res, C3, R, n3, m3, lambdax)
return (Y_ijk, C3)
Compute third order sensitivities.
Compute third order sensitivities.
Compute third order sensitivities .
def _third_order(B3, Y_res, C3, R, n3, m3, lambdax):
    """Compute third order sensitivities."""
    Y_ijk = np.zeros((R, n3))      # Initialize 1st order contributions
    T3 = np.zeros((m3, R, n3))     # Initialize T(emporary) matrix - 1st

    # First order individual estimation
    for j in range(n3):
        # Regularized least squares inversion ( minimize || C1 ||_2 )
        B33 = np.matmul(np.transpose(B3[:, :, j]), B3[:, :, j])

        # if it is ill-conditioned matrix, the default value is zero
        if np.all(np.linalg.svd(B33)[1]): # sigma, diagonal matrix, from svd
            T3[:, :, j] = np.linalg.solve(np.add(B33, np.multiply(
                lambdax, np.identity(m3))), np.transpose(B3[:, :, j]))

        C3[:, j] = np.matmul(T3[:, :, j], Y_res).reshape(m3,)
        Y_ijk[:, j] = np.matmul(B3[:, :, j], C3[:, j])

    return (Y_ijk, C3)
def _third_order ( B3 , Y_res , C3 , R , n3 , m3 , lambdax ) : Y_ijk = np . zeros ( ( R , n3 ) ) # Initialize 1st order contributions T3 = np . zeros ( ( m3 , R , n3 ) ) # Initialize T(emporary) matrix - 1st # First order individual estimation for j in range ( n3 ) : # Regularized least squares inversion ( minimize || C1 ||_2 ) B33 = np . matmul ( np . transpose ( B3 [ : , : , j ] ) , B3 [ : , : , j ] ) # if it is ill-conditioned matrix, the default value is zero if np . all ( np . linalg . svd ( B33 ) [ 1 ] ) : # sigma, diagonal matrix, from svd T3 [ : , : , j ] = np . linalg . solve ( np . add ( B33 , np . multiply ( lambdax , np . identity ( m3 ) ) ) , np . transpose ( B3 [ : , : , j ] ) ) C3 [ : , j ] = np . matmul ( T3 [ : , : , j ] , Y_res ) . reshape ( m3 , ) Y_ijk [ : , j ] = np . matmul ( B3 [ : , : , j ] , C3 [ : , j ] ) return ( Y_ijk , C3 )