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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
void dispVec(const vector<int>& vec) | |
{ | |
cout << "===vecの中身===" << endl; | |
for(vector<int>::const_iterator it = vec.begin(); it != vec.end(); ++it) | |
{ |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
## ファイルからデータを読み込み | |
data = np.loadtxt("hist.dat") | |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
## 2x4の行列を作成 | |
A = np.arange(8).reshape(2,4) | |
# >>> A | |
# array([[0, 1, 2, 3], |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
A = np.array([1,2,3]) | |
# >>> A | |
# array([1, 2, 3]) |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# 単純に大きな数字が2つならんだデータ | |
data = [980000, 500000] |
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
plt.rcParams['ps.useafm'] = True | |
plt.rcParams['pdf.use14corefonts'] = True | |
plt.rcParams['text.usetex'] = True |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
# 列nが水準nのデータを表す | |
data = np.loadtxt("sample.dat") | |
#>>> data | |
#array([[ 5., 7., 12.], | |
# [ 6., 5., 10.], |
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
A 15 7 2 | |
B 20 5 1 | |
C 10 3 6 |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# 外部ファイルからデータを読み込み | |
data_file = np.loadtxt("stack.dat", dtype='str') | |
# ファイルの中身【例】 | |
# A 15 7 2 |
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
# -*- coding: utf-8 -*- | |
import networkx as nx | |
from networkx.readwrite import json_graph | |
import json | |
import pylab | |
import matplotlib.pyplot as plt | |
# グラフオブジェクトを作成. | |
G=nx.Graph() |