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 scipy as sci | |
## Check Python Version | |
import sys | |
assert sys.version.find('3.6') > -1 | |
## Check numpy | |
import numpy as np | |
from math import sqrt |
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
/* | |
In this program we will review the queue data structre from the perspective | |
of C. | |
However, technically, the implementation here is for a *circular array* | |
which we can access from either end, as well as popping from either end. | |
The main feature of this implementation is the fact that the framework is | |
general to the type of variable to be stored within the circular array. | |
Obviously, one might attempt an implementation using linked lists, which |
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
function wmat = wcell2mat(wcell) | |
L = length(wcell); | |
bb = wcell{end}; | |
[rlo,clo] = size(bb); | |
wmat = bb; | |
for i=(L-1):-1:1 | |
wmat = [wmat, wcell{i}{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
clear; | |
%% File Paths | |
fname = 'AllCIFAR.h5'; | |
addpath(genpath('/Google Drive/Research/code/matlab/toolboxes/WaveletSoftware')); | |
%% Read in the HDF5 information | |
hi = hdf5info(fname); | |
X = hdf5read(hi.GroupHierarchy(1).Datasets(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
function X = generate_synthetic_tomo_data(N,p,seed) | |
% GENERATE_SYNTHETIC_TOMO_DATA Create an NxN circle-masked synthetic image based | |
% on E.G.'s BP for Tomography package: https://github.com/eddam/bp-for-tomo. | |
% def generate_synthetic_data(l_x=128, seed=None, crop=True, n_pts=25): | |
% """ | |
% Generate synthetic binary data looking like phase separation | |
% Parameters | |
% ---------- |
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Testing CuBLAS and CUDArt for Julia\n", | |
"After finally getting NVCC to work on OSX, we can start using the CUDA-themed BLAS packages written for Julia. In this notebook we will document how to utilize the necessary datatypes and show comparisons between the CPU and GPU implementations of common BLAS functions." | |
] | |
}, |
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
2015-09-21 13:23:35 +0200 | |
make | |
-C | |
contrib | |
-f | |
repackage_system_suitesparse4.make | |
prefix=/usr/local/Cellar/julia/HEAD | |
USE_BLAS64=0 | |
FC=/usr/local/bin/gfortran |
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
function x = eric_positive_armijo(x0,f,g,h) | |
% Calculate a Newton-Step type minimization using the given | |
% f function, its gradient g, and its hessian (second order) | |
% h. | |
scalar_mode = false; | |
if isscalar(x0) | |
scalar_mode = true; | |
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
classdef Prior | |
% This class contains all the prior-dependent functions including learnings | |
properties | |
av_mess; av_mess_old; var_mess; var_mess_old; R; S2; rho; learn; N; alpha; func; dump_learn; t; method; param_1; param_2; param_3; param_4; | |
% Gaussian sparse prior : p(x) ~ (1 - rho) * delta(x) + rho / sqrt(2 * pi * var_gauss) * exp(-(x - m_gauss)^2 / (2 * var_gauss) ) : param_1 = m_gauss; param_2 = var_gauss; | |
% Gaussian sparse prior enforcing value inside a symetric interval : p(x) ~ [(1 - rho) * delta(x) + rho / sqrt(2 * pi * var_gauss) * exp(-(x - m_gauss)^2 / (2 * var_gauss) )] * I(|x| < cut) : param_1 = m_gauss; param_2 = var_gauss; param_3 = cut; | |
% Positive Gaussian sparse prior : p(x) ~ (1 - rho) * delta(x) + rho / sqrt(2 * pi * var_gauss) * exp(-(x - m_gauss)^2 / (2 * var) ) * I(x > 0) : param_1 = m_gauss; param_2 = var_gauss; | |
% Mixture of two gaussians : p(x) ~ (1 - rho) * exp(-(x - m_1)^2 / (2 * var_1) ) / sqrt(2 * pi * var_1) + rho * exp(-(x - m_ |
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
% Specify image | |
im_size = [128,128]; | |
X = double(imread('peppers.png')); | |
X = imresize(X,im_size); | |
% Grab some kind of filter/PSF | |
PSF_dim = [4,4]; | |
PSF = ones(PSF_dim); | |
PSF = PSF ./ norm(PSF(:)); |
NewerOlder