Skip to content

Instantly share code, notes, and snippets.

View zhpmatrix's full-sized avatar
🎯
Focusing

张大千 zhpmatrix

🎯
Focusing
View GitHub Profile
#include <iostream>
using namespace std;
int main(){
int x = 10;
while(x --> 0){
cout << x << endl;
}
return 0;
}
@zhpmatrix
zhpmatrix / rvalue.cpp
Created December 28, 2016 14:41
关于C++中各种返回值的形式和右值引用结合
#include <iostream>
using namespace std;
void swap(int* a,int& b){
int t = *a;
*a = b;
b = t;
}
void swap(int& a,int& b){
int t = move(a);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def add(x):
return x + 100
data = [11,22,33]
dict = {}
dict = map(add,data)
print dict
@zhpmatrix
zhpmatrix / labout_u_about.md
Last active April 10, 2016 08:26
label u for chinese encoding about the python

在学习Scipy的leastsq扩展的时候,发现在中文前会用到'u'标签,这是干什么用的?

例如下述两行代码:


print u'真实参数',[A,k,theta]

pl.plot(x,y1,label = u'噪声数据')

为什么要加入u标签呢?否则中文报错!

import numpy as np
from matplotlib import pylab as plt
#from mpltools import style # uncomment for prettier plots
#style.use(['ggplot'])
'''
function definitions
'''
# generate all bernoulli rewards ahead of time
def generate_bernoulli_bandit_data(num_samples,K):