This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.linalg import solve_continuous_lyapunov as clyap | |
from scipy.linalg import svd | |
# --> Utility function. | |
vec2array = lambda x, ny, nz : x.reshape(ny, nz) | |
array2vec = lambda x : x.flatten() | |
# --> Differential operators. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StructuredOptimization | |
""" | |
Simple implementation of basis pursuit denoising using StructuredOptimization.jl | |
INPUT | |
----- | |
C : The measurement matrix. | |
Ψ : Basis in which x is assumed to be sparse. | |
y : Pixel measurements. | |
λ : (Optional) Sparsity knob. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StructuredOptimization | |
""" | |
Simple implementation of basis pursuit denoising using StructuredOptimization.jl | |
INPUT | |
----- | |
m, n : Size of the image in both direction. | |
idx : Linear indices of the measured pixels. | |
y : Pixel measurements. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra | |
using Convex, SCS | |
# --> Direct resolution of the measurement equation. | |
lstsq(Θ, y) = Θ \ y | |
# --> Constrained least-squares formulation. | |
function cstrnd_lstsq(Θ, y, Σ) | |
# --> Optimization variable. | |
a = Convex.Variable(length(Σ)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.linalg import qr | |
def sensor_placement(Psi): | |
# --> Perform QR w/ column pivoting. | |
_, _, p = qr(Psi.T, pivoting=True, mode="economic") | |
return p[:Psi.shape[1]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra | |
function sensor_placement(Ψ) | |
# --> Compute the QR w/ column pivoting decomposition of Ψ. | |
_, _, p = qr(transpose(Ψ), Val(true)) | |
return p[1:size(Ψ, 2)] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --> Import standard Python libraries. | |
import numpy as np | |
from scipy.special import softmax | |
from scipy.linalg import norm | |
from scipy.optimize import line_search, minimize_scalar | |
# --> Import sklearn utility functions. | |
from sklearn.base import BaseEstimator, ClassifierMixin | |
def SoftMax(x): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author : Jean-Christophe Loiseau <[email protected]> | |
# Date : July 2020 | |
# --> Standard python libraries. | |
import numpy as np | |
from scipy.linalg import pinv, eigh, eig | |
def dmd_analysis(x, y=None, rank=2): | |
# --> Partition data matrix into X and Y. |
NewerOlder