Skip to content

Instantly share code, notes, and snippets.

@mizunototori
mizunototori / result.jpg
Created February 12, 2019 09:18
Bicubic, DWT and DSWT resolution enhancement comparison
,
@mizunototori
mizunototori / file0.txt
Last active November 9, 2018 07:01
円周率の中から連続する10桁の最初の素数を見つける ref: https://qiita.com/mizunototori/items/e536f9abbeadd299705a
def is_prime(n):
# nが素数かどうか判定するプログラム
for p in range(2, int(math.sqrt(n)) + 1):
if n % p == 0:
return False # 素数でないならFalseを返す
return True # 素数ならTrueを返す
def get_prime(str_num, N):
# 文字列として受け取ったstr_numからN桁の最初の素数を見つけるプログラム
for i in range(0, len(str_num) - N):
@mizunototori
mizunototori / custom.css
Created February 27, 2018 06:08
.jupyter/custom/custom.css
.CodeMirror pre {
font-family: Consolas;
font-size: 12pt;
}
.output_subarea.output_text.output_stream.output_stdout,
.output_subarea.output_text pre {
font-family: Consolas;
font-size: 12pt;
}
def _make_nn_sparse_coded_signal(n_samples, n_components, n_features,
n_nonzero_coefs, random_state=None):
"""Generate a signal as a sparse combination of dictionary elements.
Returns a matrix Y = DX, such as D is (n_features, n_components),
X is (n_components, n_samples) and each column of X has exactly
n_nonzero_coefs non-zero elements.
Read more in the :ref:`User Guide <sample_generators>`.
Parameters
----------
function [Dictionary, data, coefs] = gererateSyntheticDictionaryAndData(N, L, dim, K, SNRdB)
%% Returns dictionary, a data matrix and a coefficient matrix
% Data = Dictionary x Coefficient matrix
% _____ ... _____ _________________ _____ ... ______
% | | | | | |
% | | | | | |
% | | = | | x | |
% | | | | | |
% | | | | | |
def _make_nn_sparse_coded_signal(n_samples, n_components, n_features,
n_nonzero_coefs, random_state=None):
"""Generate a signal as a sparse combination of dictionary elements.
Returns a matrix Y = DX, such as D is (n_features, n_components),
X is (n_components, n_samples) and each column of X has exactly
n_nonzero_coefs non-zero elements.
Read more in the :ref:`User Guide <sample_generators>`.
Parameters
----------
n_samples : int
function [Dictionary, data, coefs] = gererateSyntheticDictionaryAndData(N, L, dim, K, SNRdB)
%% Returns dictionary, a data matrix and a coefficient matrix
% Data = Dictionary x Coefficient matrix
% _____ ... _____ _________________ _____ ... ______
% | | | | | |
% | | | | | |
% | | = | | x | |
% | | | | | |
% | | | | | |
@mizunototori
mizunototori / file0.mat
Last active January 31, 2018 02:55
MatlabとPython(Numpy)のSVD(特異値分解)の違いについて ref: https://qiita.com/mizunototori/items/880d2d6e91b7f291e11e
>> file_name = 'ファイルのある場所/random_mat.mat';
>> file_data = load(file_name);
>> data = file_data.data;
[U S V flag] = svds((data), 1); % SVDのサブセット, 最大特異値の出力を得る
>> U'
1 列から 12 列
0.2245 0.2040 0.2040 0.2177 0.2319 0.2341 0.2295 0.2020 0.1833 0.2041 0.2266 0.2597
13 列から 20 列