This file contains hidden or 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
// OPTION 1 | |
class Object | |
{ | |
private: | |
int* data; | |
public: | |
Object(const int size) | |
{ | |
data = new int[size]; | |
} // Acquisition |
This file contains hidden or 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
#include <string> | |
#include <functional> | |
#include <iostream> | |
#include <optional> | |
std::optional<bool> boolcar(std::string value) | |
{ | |
if (value=="Toyota") | |
{ | |
return true; |
This file contains hidden or 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
#include <string> | |
#include <functional> | |
#include <iostream> | |
#include <optional> | |
std::optional<std::string> getcar(std::string value) | |
{ | |
if (value=="Toyota") | |
{ |
This file contains hidden or 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
#include <cstdint> | |
#include <iostream> | |
#include <limits> | |
#include <algorithm> | |
#include <vector> | |
#include <cassert> | |
#include <random> | |
using namespace std; |
This file contains hidden or 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 scanpy as sc | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# change location of data here | |
folder = 'fig2(data7_check_10plots)/data1/' | |
file = '1g.csv' | |
count_df = pd.read_csv(folder + file) | |
count_df.set_index('Unnamed: 0', inplace=True) |
This file contains hidden or 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 scanpy as sc | |
import pandas as pd | |
datafolder = "scRNAseqData/GSE146590" | |
adata = anndata.read_mtx(datafolder+'/GSM4396313_Ctrl_matrix.mtx.gz') | |
adata = adata1.T | |
adata.obs.index = pd.read_csv(datafolder+'/GSM4396313_Ctrl_barcodes.tsv.gz', header=None, index_col=0).index | |
genes = pd.read_csv(datafolder+'/GSM4396313_Ctrl_features.tsv.gz', header=None, index_col=0, sep='\t')[1].values |
This file contains hidden or 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
p = ot.unif(n_samples) | |
q = ot.unif(n_samples) | |
gw0, log0 = ot.gromov.gromov_wasserstein( | |
C1, C2, p, q, 'square_loss', verbose=True, log=True) | |
print('Gromov-Wasserstein distances: ' + str(log0['gw_dist'])) | |
pl.figure(1, (10, 5)) | |
pl.imshow(gw0, cmap='jet') | |
pl.title('Gromov Wasserstein') | |
pl.colorbar() |
This file contains hidden or 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
C1 = sp.spatial.distance.cdist(xs, xs) | |
C2 = sp.spatial.distance.cdist(xt, xt) | |
C1 /= C1.max() | |
C2 /= C2.max() | |
pl.figure() | |
pl.subplot(121) | |
pl.imshow(C1) | |
pl.subplot(122) |
This file contains hidden or 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 sp | |
import numpy as np | |
import matplotlib.pylab as pl | |
from mpl_toolkits.mplot3d import Axes3D # noqa | |
import ot | |
n_samples = 50 # nb samples | |
mu_s = np.array([0, 0]) |
This file contains hidden or 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
#include <Eigen/Dense> | |
#include <iostream> | |
#include <cmath> | |
#include <vector> | |
#include <Eigen/QR> | |
void polyfit( const std::vector<double> &t, | |
const std::vector<double> &v, | |
std::vector<double> &coeff, | |
int order |