[{"content":"解决devc++中文乱码问题 详细图解 也许你需要试一试ansi、gbk或者unicode\ntips:我后来又经历过主页面是乱码的情况，然后是通过取消勾选，重启一下就好了（就是进去dev的主页面，到处都是棍斤拷）\n点取消，然后重启\n然后，就又乱码了\n然后我就把utf-8改成了gbk，然后现在又好了，只是字体没以前那么纤细了\n也许会会弹出这个，但是无论你选哪个，最后输出仍然会是中文\nover~\n","permalink":"https://wellorbetter.github.io/post/2022-11-28-devc-%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E9%97%AE%E9%A2%98/","summary":"\u003ch2 id=\"解决devc中文乱码问题\"\u003e解决devc++中文乱码问题\u003c/h2\u003e\n\u003ch4 id=\"详细图解\"\u003e详细图解\u003c/h4\u003e\n\u003cp\u003e\u003cimg alt=\"step1\" loading=\"lazy\" src=\"/2022-11-29%5Cstep1.png\"\u003e\u003cbr\u003e\n\u003cimg alt=\"step2\" loading=\"lazy\" src=\"/2022-11-29%5Cstep2.png\"\u003e\u003c/p\u003e\n\u003cp\u003e也许你需要试一试ansi、gbk或者unicode\u003cbr\u003e\n\u003ccode\u003etips:\u003c/code\u003e我后来又经历过主页面是乱码的情况，然后是通过取消勾选，重启一下就好了（就是进去dev的主页面，到处都是棍斤拷）\u003cbr\u003e\n\u003cimg alt=\"step3\" loading=\"lazy\" src=\"/2022-11-29%5Cstep5.png\"\u003e\u003cbr\u003e\n\u003cimg alt=\"step3\" loading=\"lazy\" src=\"/2022-11-29%5Cstep6.png\"\u003e\u003cbr\u003e\n点取消，然后重启\u003cbr\u003e\n\u003cimg alt=\"step3\" loading=\"lazy\" src=\"/2022-11-29%5Cstep7.png\"\u003e\u003cbr\u003e\n\u003cimg alt=\"step3\" loading=\"lazy\" src=\"/2022-11-29%5Cstep8.png\"\u003e\u003c/p\u003e","title":"devc++中文乱码问题"},{"content":"一些散的知识点但是比较容易忘的 不同进制数之间的转化 涉及小数 整数部分 除基取余，上右下左\n小数部分 乘基取整，上左下右\n$$\n(835.63)_{10} = (1503.50243)_8\n$$\n简单来说，就是整数部分用短除号一直除到结果为0，所有的余数从下往上，拿到的就是对应的值，也就是下面的在右边，上边的在左边。而小数部分，每一次都需要取出小数部分，乘以基，得到的数列在右边，然后接着取小数乘，往后循环，最后拿出列在右边的数的整数部分，使用与整数相反的排列顺序。\n浮点数表示 IEEE753标准 小数点 尾数 基 阶码 1位符号位，8位阶码(移码表示：bias=2的n次方-1)，23位尾数（前面有一个默认的1），意思是尾数算出的小数要加上1再进行运算\n非规格化数 阶码全是0 尾数不为0\n无穷 阶码全1 尾数全0\n非数 阶码全1 尾数不为0\n一个数有多种表示形式 $$\n规格化形式：1.0 \\times 10^{-9}（唯一）\n$$\n$$\n非规格化形式：0.1 \\times 10^{-8}, 10.0 \\times 10^{-10}\n$$\n当计算机无法表示计算得到的数时，会转化成最近可表示数 数据宽度 字长 数据通路的宽度，等于CPU内部总线的宽度、运算器的位数、通用寄存器的宽度(这些部件宽度一样)\n字 表示被处理信息的单位，用来度量数据类型的宽度。\n大端 小端 大端：MSB(最高有效字节)所在的地址是数的地址\n小端：LSB(最低有效字节)所在的地址是数的地址\n","permalink":"https://wellorbetter.github.io/post/2022-11-06-20221162/","summary":"\u003ch1 id=\"一些散的知识点但是比较容易忘的\"\u003e一些散的知识点但是比较容易忘的\u003c/h1\u003e\n\u003ch2 id=\"不同进制数之间的转化-涉及小数\"\u003e不同进制数之间的转化 涉及小数\u003c/h2\u003e\n\u003cp\u003e整数部分 除基取余，上右下左\u003cbr\u003e\n小数部分 乘基取整，上左下右\u003cbr\u003e\n$$\u003cbr\u003e\n(835.63)_{10} = (1503.50243)_8\u003cbr\u003e\n$$\u003cbr\u003e\n简单来说，就是整数部分用短除号一直除到结果为0，所有的余数从下往上，拿到的就是对应的值，也就是下面的在右边，上边的在左边。而小数部分，每一次都需要取出小数部分，乘以基，得到的数列在右边，然后接着取小数乘，往后循环，最后拿出列在右边的数的整数部分，使用与整数相反的排列顺序。\u003c/p\u003e","title":"20221162"},{"content":"#matplotlib入门\n##x轴和y轴\nmatplotlib比较难写，我们一般缩写成plt。用plot()方法进行绘制图像，第一个参数表示x轴，第二个参数表示y轴\nxpoints = np.array([1, 8]) ypoints = np.array([3, 10]) plt.plot(xpoints, ypoints) plt.show() 画多个点(有连线)\nxpoints = np.array([1, 2, 6, 8]) ypoints = np.array([3, 8, 1, 10]) plt.plot(xpoints, ypoints) plt.show() tips:这里的x轴是有默认值的，如果你没有传入x轴的参数，默认是从0开始增长，到传入y轴的参数个数-1\nypoints = np.array([3, 8, 1, 10, 5, 7]) plt.plot(ypoints) plt.show() 参数marker marker用指定的标记来强调每个点\nmarker=’o’，对应的坐标会变成实心小圆点\nypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, marker = \u0026#39;o\u0026#39;) plt.show() marker 图像 ‘o’ 实心原点 ‘*’ * ‘.’ .(小点) ‘,’ 像素(我看不到) ‘x’ X ‘X’ X (粗的) ‘+’ + ‘P’ +(粗的) ‘s’ 实心正方形 ‘D’ 斜方棱形 ‘d’ 斜棱形(窄一点) ‘p’ 五边形 ‘H’ 六边形(平的) ‘h’ 六边形(竖着的，尖朝上) ‘v’ 倒三角 ‘^’ 正三角 \u0026lt;’ 三角(尖朝左) ‘\u0026gt;’ 三角(尖朝右) ‘1’ ‘2’ ‘3’ ‘4’ ‘ ’ ‘_’ _ 格式字符串fmt 也可以使用快捷字符串符号参数来指定标记。\n该参数也被称为fmt，并使用以下语法编写:\n*marker*|*line*|*color*\n线 形状 ‘-‘ 实线 ‘:’ 点虚线 ‘–’ 线虚线 ‘-.’ 点线交错虚线 如果不指定颜色，默认是蓝色\n如果不指定线的形状，就没有线\n如果不指明点的形状，就没有点\n颜色对应字符 颜色 ‘r’ 红色 ‘g’ 绿色 ‘b’ 蓝色 ‘c’ 青色(Cyan) ‘m’ 洋红色(Magenta) ‘y’ 黄色 ‘k’ 黑色 ‘w’ 白色 marksize 指定点的大小，参数为marksize，或者缩写成ms\nypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, marker = \u0026#39;o\u0026#39;, ms = 20) plt.show() markeredgecolor markeredgecolor设置点的边缘的颜色，可以缩写成mec\nypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, marker = \u0026#39;o\u0026#39;, ms = 20, mec = \u0026#39;r\u0026#39;) plt.show() markerfacecolor markerfacecolor设置点的里面的颜色，可以缩写成mfc\nypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, marker = \u0026#39;o\u0026#39;, ms = 20, mfc = \u0026#39;r\u0026#39;) plt.show() ypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, marker = \u0026#39;o\u0026#39;, ms = 20, mec = \u0026#39;r\u0026#39;, mfc = \u0026#39;r\u0026#39;) plt.show() 这个mec和mfc可以用十六进制表示颜色，也可以用一些颜色的名字指定\nplt.plot(ypoints, marker = \u0026#39;o\u0026#39;, ms = 20, mec = \u0026#39;#4CAF50\u0026#39;, mfc = \u0026#39;#4CAF50\u0026#39;) plt.plot(ypoints, marker = \u0026#39;o\u0026#39;, ms = 20, mec = \u0026#39;hotpink\u0026#39;, mfc = \u0026#39;hotpink\u0026#39;) linestyle linestyle指定线的格式，实际上用的最多的还是上面的fmt(方便)，缩写成ls\n形状 参数 ‘solid’ (default) ‘-‘ ‘dotted’ ‘:’ ‘dashed’ ‘–’ ‘dashdot’ ‘-.’ ‘None’ ‘’ or ‘ ‘ 实际上和上边的fmt提到的一样\ncolor color设置线的颜色，和fmt里面的c一样\nplt.plot(ypoints, c = \u0026#39;hotpink\u0026#39;) linewidth 设置线的宽度，fmt里面好像没有这个\n缩写成lw\nypoints = np.array([3, 8, 1, 10]) plt.plot(ypoints, linewidth = \u0026#39;20.5\u0026#39;) plt.show() 绘制多条线 你可以通过简单地添加更多的plot .plot()函数来绘制任意多的线\ny1 = np.array([3, 8, 1, 10]) y2 = np.array([6, 2, 7, 11]) plt.plot(y1) plt.plot(y2) plt.show() 还可以通过在相同的plt.plot()函数中为每条直线添加x轴和y轴的点来绘制多条直线\ny1 = np.array([3, 8, 1, 10]) y2 = np.array([6, 2, 7, 11]) plt.plot(y1) plt.plot(y2) plt.show() # 我们只指定y轴上的点，这意味着x轴上的点得到默认值(0,1,2,3) x和y值成对出现\nx1 = np.array([0, 1, 2, 3]) y1 = np.array([3, 8, 1, 10]) x2 = np.array([0, 1, 2, 3]) y2 = np.array([6, 2, 7, 11]) plt.plot(x1, y1, x2, y2) plt.show() 标签和标题 xlabel()和ylabel() x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.plot(x, y) plt.xlabel(\u0026#34;Average Pulse\u0026#34;) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;) plt.show() title() 标题，写在最上面\nx = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.plot(x, y) plt.title(\u0026#34;Sports Watch Data\u0026#34;) plt.xlabel(\u0026#34;Average Pulse\u0026#34;) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;) plt.show() 参数fontdict 给标题和标签设置样式 这个fontdict拿到的实参格式，就是css格式\nx = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) font1 = {\u0026#39;family\u0026#39;:\u0026#39;serif\u0026#39;,\u0026#39;color\u0026#39;:\u0026#39;blue\u0026#39;,\u0026#39;size\u0026#39;:20} font2 = {\u0026#39;family\u0026#39;:\u0026#39;serif\u0026#39;,\u0026#39;color\u0026#39;:\u0026#39;darkred\u0026#39;,\u0026#39;size\u0026#39;:15} plt.title(\u0026#34;Sports Watch Data\u0026#34;, fontdict = font1) plt.xlabel(\u0026#34;Average Pulse\u0026#34;, fontdict = font2) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;, fontdict = font2) plt.plot(x, y) plt.show() loc参数确定title的位置 可选：left、right、center(默认)\nx = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.title(\u0026#34;Sports Watch Data\u0026#34;, loc = \u0026#39;left\u0026#39;) plt.xlabel(\u0026#34;Average Pulse\u0026#34;) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;) plt.plot(x, y) plt.show() 网格线 plt.grid()方法添加网格线 x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.title(\u0026#34;Sports Watch Data\u0026#34;) plt.xlabel(\u0026#34;Average Pulse\u0026#34;) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;) plt.plot(x, y) plt.grid() plt.show() 指定要显示的网格线的轴向 grid()里面的参数axis表示显示的是x轴还是y轴还是都显示 x、y、both\nx = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.title(\u0026#34;Sports Watch Data\u0026#34;) plt.xlabel(\u0026#34;Average Pulse\u0026#34;) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;) plt.plot(x, y) plt.grid(axis = \u0026#39;x\u0026#39;) plt.show() plt.grid(axis = \u0026#39;y\u0026#39;) 给网格线设置样式 你也可以设置网格的线条属性，像这样:grid(color = ‘color’， linestyle = ‘linestyle’， linewidth = number)\nx = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125]) y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330]) plt.title(\u0026#34;Sports Watch Data\u0026#34;) plt.xlabel(\u0026#34;Average Pulse\u0026#34;) plt.ylabel(\u0026#34;Calorie Burnage\u0026#34;) plt.plot(x, y) plt.grid(color = \u0026#39;green\u0026#39;, linestyle = \u0026#39;--\u0026#39;, linewidth = 0.5) plt.show() 子图 subplot()放多张图 plt.subplot(a, b, c) 这个视图被分成了a行b列，均匀切割，并且切换当前这个图到第c个图(一共a*b个)\n#plot 1: x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) plt.subplot(2, 1, 1) plt.plot(x,y) #plot 2: x = np.array([0, 1, 2, 3]) y = np.array([10, 20, 30, 40]) plt.subplot(2, 1, 2) plt.plot(x,y) plt.show() x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) plt.subplot(2, 3, 1) plt.plot(x,y) x = np.array([0, 1, 2, 3]) y = np.array([10, 20, 30, 40]) plt.subplot(2, 3, 2) plt.plot(x,y) x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) plt.subplot(2, 3, 3) plt.plot(x,y) x = np.array([0, 1, 2, 3]) y = np.array([10, 20, 30, 40]) plt.subplot(2, 3, 4) plt.plot(x,y) x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) plt.subplot(2, 3, 5) plt.plot(x,y) x = np.array([0, 1, 2, 3]) y = np.array([10, 20, 30, 40]) plt.subplot(2, 3, 6) plt.plot(x,y) plt.show() 标题 tips:每个子图都可以加标题\n#plot 1: x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) plt.subplot(1, 2, 1) plt.plot(x,y) plt.title(\u0026#34;SALES\u0026#34;) #plot 2: x = np.array([0, 1, 2, 3]) y = np.array([10, 20, 30, 40]) plt.subplot(1, 2, 2) plt.plot(x,y) plt.title(\u0026#34;INCOME\u0026#34;) plt.show() 如果用了subplot的话，总的图还可以用suptitle()来添加一个大标题\n#plot 1: x = np.array([0, 1, 2, 3]) y = np.array([3, 8, 1, 10]) plt.subplot(1, 2, 1) plt.plot(x,y) plt.title(\u0026#34;SALES\u0026#34;) #plot 2: x = np.array([0, 1, 2, 3]) y = np.array([10, 20, 30, 40]) plt.subplot(1, 2, 2) plt.plot(x,y) plt.title(\u0026#34;INCOME\u0026#34;) plt.show() 散点图 用scatter()创造一个散点图 #day one, the age and speed of 13 cars: x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6]) y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86]) plt.scatter(x, y) #day two, the age and speed of 15 cars: x = np.array([2,2,8,1,15,8,12,9,7,3,11,4,7,14,12]) y = np.array([100,105,84,105,90,99,90,95,94,100,79,112,91,80,85]) plt.scatter(x, y) plt.show() 操作基本上和plot是一样的，实际上我感觉plot把那个线的参数设置成空，然后把点的参数设置成o，就等于这个散点图了\ncolor参数(缩写c) 基本上类似\nplt.scatter(x, y, color = \u0026#39;hotpink\u0026#39;) plt.scatter(x, y, color = \u0026#39;#88c999\u0026#39;) 你甚至可以通过使用一个颜色数组作为c参数的值来为每个点设置特定的颜色\nx = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6]) y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86]) colors = np.array([\u0026#34;red\u0026#34;,\u0026#34;green\u0026#34;,\u0026#34;blue\u0026#34;,\u0026#34;yellow\u0026#34;,\u0026#34;pink\u0026#34;,\u0026#34;black\u0026#34;,\u0026#34;orange\u0026#34;,\u0026#34;purple\u0026#34;,\u0026#34;beige\u0026#34;,\u0026#34;brown\u0026#34;,\u0026#34;gray\u0026#34;,\u0026#34;cyan\u0026#34;,\u0026#34;magenta\u0026#34;]) plt.scatter(x, y, c=colors) plt.show() colirmap Matplotlib模块有许多可用的色彩图。\ncolormap就像一个颜色列表，其中每个颜色都有一个从0到100的值。\n下面是一个色彩图的例子:\n这个配色图被称为“viridis”，如你所见，它的范围从0(紫色)到100(黄色)\n你可以用关键字参数cmap和colormap的值来指定色彩图，在本例中是’viridis’，它是Matplotlib中可用的内置色彩图之一。\n另外，你必须创建一个包含值的数组(从0到100)，每个点对应一个散点图中的值\nx = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6]) y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86]) colors = np.array([0, 10, 20, 30, 40, 45, 50, 55, 60, 70, 80, 90, 100]) plt.scatter(x, y, c=colors, cmap=\u0026#39;viridis\u0026#39;) plt.show() 你可以在绘图中使用plt.colorbar()语句\nplt.colorbar() 我感觉使用色彩图应该就是要和这个colorbar一起用才有意义，不然我也可以通过给每个点指定颜色来实现colormap(复杂一点点)(内置的色彩图有点多，这里不放了，自己查看看吧)\n大小 参数s来修改大小\nsizes = np.array([20,50,100,200,500,1000,60,90,10,300,600,800,75]) plt.scatter(x, y, s=sizes) 和c一样，都可以整花活，给每一个点都整个不同的大小\n透明度 参数alpha指定透明度 0~1\nplt.scatter(x, y, s=sizes, alpha=0.5) 整个花活儿\nx = np.random.randint(100, size=(100)) y = np.random.randint(100, size=(100)) colors = np.random.randint(100, size=(100)) sizes = 10 * np.random.randint(100, size=(100)) plt.scatter(x, y, c=colors, s=sizes, alpha=0.5, cmap=\u0026#39;nipy_spectral\u0026#39;) plt.colorbar() plt.show() ","permalink":"https://wellorbetter.github.io/post/2022-11-04-matplotlib%E5%85%A5%E9%97%A8%E4%B8%80/","summary":"\u003cp\u003e#matplotlib入门\u003c/p\u003e\n\u003cp\u003e##x轴和y轴\u003c/p\u003e\n\u003cp\u003ematplotlib比较难写，我们一般缩写成plt。用plot()方法进行绘制图像，第一个参数表示x轴，第二个参数表示y轴\u003c/p\u003e","title":"matplotlib入门\u003c一\u003e"},{"content":"汇编语言 环境 VMWare Workstation Ubuntu14.04 32位操作系统\n输入whereis nasm查看是否下载有nasm，如果没有则会显示nasm:，有则会显示路径\n如果没有下载，可以通过sudo apt install nasm下载，此时再输入whereis nasm就会显示路径了。不知道是原来自带还是这样就好了，输入nasm -version有具体的版本信息，安装ok。\n指示符 指示符普遍的应用有：\n1、定义常量\n2、定义用来储存数据的内存\n3、将内存组合成段\n4、有条件地包含源代码\n5、包含其它文件\nNASM代码像C一样要通过一个预处理程序。它拥有许多和C一样的预处理程序。但是，NASM 的预处理的指示符以%开头而不是像C一样以#开头\nequ 指示符 equ指示符可以用来定义一个符号。符号被命名为可以在汇编程序里使用的常量。\nsymbol equ value 符号的值以后不可以再定义。\n%define 指示符 这个指示符和C中的#define非常相似。它通常用来定义一个宏常量，像在C里面一样。\n%define SIZE 100 mov eax, SIZE 宏可以被再次定义而且可以定义比简单的常量数值更大的值\n数据指示符 第一种方法仅仅为数据定义空间 第一种方法使用RESX指示符中的一个。X可由字母替代，字母由需要储存的对象的大小来决定。\n字节 B\n字 W\n双字 D\n四字 Q\n十字 T\nresb 1 ;一个未初始化的字节 第二种方法(同时定义一个初始值)使用DX指示符中的一个 X可以由字母替代，字母的值与RESX里的值一样。使用变量来标记内存位置是非常普遍的。变量使得在代码中指向内存位置变得容易\nexample1 db 0 ;字节变量，初始值为0 example2 dw 1000 ;字变量，初始值为1000 example3 dw 10h/10b ;可以跟其他进制的数字 单引号和双引号等效\n连续定义的数据存储再连续的内存中\ndb \u0026#39;h\u0026#39;, \u0026#39;i\u0026#39;, 0 ;定义了一个字符串\u0026#34;hi\u0026#34; db \u0026#39;hi\u0026#39;, 0 ;和上面等效 指示符DD可以用来定义整形和单精度的浮点数常量\nDQ指示符仅仅可以用来定义双精度的数常量\nnasm的times会重复操作数一个指定的次数，对于大的序列而言比较有用\ntimes 100 db 0 ;100个值为0的字节 变量 变量可以用来表示代码中的数据，使用方法有两种\n方法一 如果一个变量被调用(不加其他什么东西)，它被解释为数据的地址(或偏移)\nmov al, L1 ;此时的L1是L1所在的地址 方法二 如果变量被放置在方括号([])中，它就被解释为在这个地址中的数据\nmov al, [L1] ;此时表示L1对应地址的数据 汇编程序并不保持跟踪变量的数据类型\n","permalink":"https://wellorbetter.github.io/post/2022-11-04-%E6%B1%87%E7%BC%96%E5%85%A5%E9%97%A8%E4%B8%80/","summary":"\u003ch1 id=\"汇编语言\"\u003e汇编语言\u003c/h1\u003e\n\u003ch2 id=\"环境\"\u003e环境\u003c/h2\u003e\n\u003cp\u003e\u003cstrong\u003eVMWare Workstation Ubuntu14.04 32位操作系统\u003c/strong\u003e\u003cbr\u003e\n输入\u003ccode\u003ewhereis nasm\u003c/code\u003e查看是否下载有nasm，如果没有则会显示\u003ccode\u003enasm:\u003c/code\u003e，有则会显示路径\u003cbr\u003e\n如果没有下载，可以通过\u003ccode\u003esudo apt install nasm\u003c/code\u003e下载，此时再输入\u003ccode\u003ewhereis nasm\u003c/code\u003e就会显示路径了。不知道是原来自带还是这样就好了，输入\u003ccode\u003enasm -version\u003c/code\u003e有具体的版本信息，安装ok。\u003c/p\u003e","title":"汇编入门\u003c一\u003e"},{"content":"##链接数组\n###1、concatenate((arr1, arr2…), axis)\n前面跟数组组成的元组，后面跟想要链接的维度(即保持其他维度不变，在axis维度上进行合并),默认是0\narr1 = np.array([1, 2, 3]) arr2 = np.array([4, 5, 6]) arr = np.concatenate((arr1, arr2)) print(arr) res: [1 2 3 4 5 6] arr1 = np.array([[1, 2], [3, 4]]) arr2 = np.array([[5, 6], [7, 8]]) arr = np.concatenate((arr1, arr2), axis=1) print(arr) res: [[1 2 5 6] [3 4 7 8]] ###2、stack((arr1, arr2…), axis)\n前面也是跟链接的数组，后面链接的维度，在axis维度上进行链接，axis默认为0，stack堆叠，顾名思义是要在axis维度上进行堆叠，保持其他维度不变，在axis维度上的元素进行堆叠形成一个新的维度，这个堆叠是竖直上的堆叠，也就是待链接的数组竖直放在一起，将元素同一列的整合成一个数组，可能有点抽象，结合一个例子可能好理解一点\narr1 = np.array([1, 2, 3]) arr2 = np.array([4, 5, 6]) arr = np.stack((arr1, arr2), axis=1) print(arr) res: [[1 4] [2 5] [3 6]] ###3、hstack((arr1, arr2…), axis)\n基本上和上面的一样，但是这个堆叠是水平的(即按照第二个维度进行堆叠，axis=1)，而且不会形成新的维度，即将axis=1上的数组求并得到一个新数组放到原来数组的位置上，维度不发生变化\narr1 = np.array([[1, 2, 3], [1, 2, 3]]) arr2 = np.array([[4, 5, 6], [4, 5, 6]]) arr = np.hstack((arr1, arr2)) print(arr) res: [[1 2 3 4 5 6] [1 2 3 4 5 6]] arr1 = np.array([[[1, 2, 3], [1, 2, 3]]]) arr2 = np.array([[[4, 5, 6], [4, 5, 6]]]) arr = np.hstack((arr1, arr2)) print(arr) res: [[[1 2 3] [1 2 3] [4 5 6] [4 5 6]]] ###4、vstack()\n也是类似的，在axis=0上进行堆叠，即在axis=0上取并，实际上这种可以通过np.concatenate来实现\narr1 = np.array([[[1, 2, 3], [1, 2, 3]]]) arr2 = np.array([[[4, 5, 6], [4, 5, 6]]]) arr = np.vstack((arr1, arr2)) print(arr) print(arr1.shape) print(arr.shape) res: [[[1 2 3] [1 2 3]] [[4 5 6] [4 5 6]]] (1, 2, 3) (2, 2, 3) ###5、dstack()\n也是类似，在第三维上进行堆叠，即在axis=2上取并，如果是一维，就相当于reshape成(1，n，1)再在axis=2上堆叠，如果是二维则是reshape成(n，m，1)再开始堆叠，通过reshape和np.concatenate也可以完成一样的工作，这几种特殊的stack只有dstack有可能会形成新的维度(即传入的数组都是一维或者二维)\n##数组拆分\n###1、array_split(arr，num，axis)\n将一个数组在axis维度上分成num份，默认axis=0(这个如果你在axis上的元素的数量不能平分成num份，会根据元素数量进行微调)\narr = np.array([1, 2, 3, 4, 5, 6]) newarr = np.array_split(arr, 4) print(newarr) res: [array([1, 2]), array([3, 4]), array([5]), array([6])] # 返回的是套数组的数组 arr = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]]) newarr = np.array_split(arr, 3, axis=1) print(newarr) res: [array([[ 1], [ 4], [ 7], [10], [13], [16]]), array([[ 2], [ 5], [ 8], [11], [14], [17]]), array([[ 3], [ 6], [ 9], [12], [15], [18]])] ###2、hsplit()、vsplit()、dsplit()\n同样的，有hsplit()对应hstack()(axis=1),vsplit()对应vstack()(axis=0)，dsplit()对应dstack()(axis=2)\n##搜索数组元素\n###1、np.where(condition)\n返回值是一个元组，里面只有一个元素，即满足条件的数组的下标所组成的数组，后面会跟它的类型\narr = np.array([1, 2, 3, 4, 5, 4, 4]) x = np.where(arr == 4) print(x) res: (array([3, 5, 6], dtype=int64),) arr = np.array([1, 2, 3, 4, 5, 6, 7, 8]) x = np.where(arr%2 == 0) print(x) res: (array([1, 3, 5, 7], dtype=int64),) 2、searchsorted()\n它在数组中执行二分查找，并返回指定值插入位置的索引，以保持搜索顺序。似乎对排好序的数组用处比较大\narr = np.array([6, 7, 8, 9]) x = np.searchsorted(arr, 7) print(x) res: #应该将数字7插入索引1以保持排序顺序。该方法从左开始搜索，返回第一个索引，即数字7不再大于下一个值的位置。 默认情况下返回最左边的索引，但我们可以指定side=’right’来返回最右边的索引。\narr = np.array([6, 7, 8, 9]) x = np.searchsorted(arr, 7, side=\u0026#39;right\u0026#39;) print(x) res: 2 # 数字7应该插入索引2以保持排序顺序。该方法从右边开始搜索，返回第一个索引，即数字7不再小于下一个值。 而且，这个方法还可以同时搜索多个值应当插入的位置\narr = np.array([1, 3, 5, 7]) x = np.searchsorted(arr, [2, 4, 6]) print(x) res: # 返回值是一个数组:[1 2 3]，包含3个索引，其中2、4、6将被插入到原始数组中以保持顺序。 [1 2 3] ##数组排序\n###1、np.sort(arr)\n这个方法返回的是数组的拷贝，改变不会影响原数组\narr = np.array([3, 2, 0, 1]) print(np.sort(arr)) res: [0 1 2 3] 同样可以对字符串等其他数据类型排序\narr = np.array([\u0026#39;banana\u0026#39;, \u0026#39;cherry\u0026#39;, \u0026#39;apple\u0026#39;]) print(np.sort(arr)) res: [\u0026#39;apple\u0026#39; \u0026#39;banana\u0026#39; \u0026#39;cherry\u0026#39;] arr = np.array([True, False, True]) print(np.sort(arr)) res: [False True True] 如果是高维的数组，会将最里面的所有’一维数组‘进行排序\narr = np.array([[3, 2, 4], [5, 0, 1]]) print(np.sort(arr)) res: [[2 3 4] [0 1 5]] ##过滤数组\n从现有数组中获取一些元素并从中创建一个新数组，这称为过滤。在NumPy中，使用布尔索引列表来过滤数组。\n如果某个索引的值为True，则该元素包含在过滤后的数组中;如果该索引的值为False，则该元素不包含在过滤后的数组中。\narr = np.array([41, 42, 43, 44]) x = [True, False, True, False] newarr = arr[x] print(newarr) res: [41 43] arr = np.array([41, 42, 43, 44]) filter_arr = arr \u0026gt; 42 # 直接创建过滤数组 newarr = arr[filter_arr] print(filter_arr) print(newarr) res: [False False True True] [43 44] ","permalink":"https://wellorbetter.github.io/post/2022-11-03-numpy%E5%85%A5%E9%97%A8%E4%BA%8C/","summary":"\u003cp\u003e##链接数组\u003cbr\u003e\n###1、concatenate((arr1, arr2…), axis)\u003cbr\u003e\n前面跟数组组成的元组，后面跟想要链接的维度(即保持其他维度不变，在axis维度上进行合并),默认是0\u003c/p\u003e","title":"numpy入门\u003c二\u003e"},{"content":"##评价类问题\n评价类问题可以用打分解决\n","permalink":"https://wellorbetter.github.io/post/2022-11-03-%E5%B1%82%E6%AC%A1%E5%88%86%E6%9E%90%E6%B3%95/","summary":"\u003cp\u003e##评价类问题\u003cbr\u003e\n评价类问题可以用打分解决\u003c/p\u003e","title":"层次分析法"},{"content":"深入理解计算机系统题目： arc_t *sp; // 使用typedef声明的数据类型 dest_t *dp; 我们想使用适当的数据传送指令来实现下面的操作 *dp = (dest_t) *sp; 假设 sp 和 dp 的值分别存储在寄存器 %rdi 和 %rsi 中。对于表中的每个表项，给出实现指定数据传送的两条指令。其中第一条指令应该从内存中读数，做适当的转换，并设置寄存器 %rax 的适当部分。然后，第二条指令要把 %rax 的适当部分写到内存。在这两种情况中，寄存器的部分可以是 %rax、%eax、%ax 或 %al，两者可以互不相同。\n记住，当执行强制类型转换既涉及大小变化又涉及 C 语言中符号变化时，操作应该先改变大小。\nsrc_t dest_t 指令 解释 long long movq (%rdi), %rax movq %rax, (%rsi) long是八个字节，也就是四个双字，所以用q char int movsbl (%rdi), %eax movl %eax, (%rsi) char转化成int需要进行字节长度拓展，而且char是有符号的，有符号拓展成有符号类型时，需要进行符号拓展 char unsigned movsbl (%rdi), %eax movl %eax, (%rsi) char有符号数拓展成无符号型类型的数据时，需要注意，先进行符号拓展，然后转化成无符号数时，只是解释发生改变，机器数并不变 unsigned char long movzbl (%rdi), %eax movq %rax, (%rsi) 无符号数进行零拓展 int char movl (%rdi), %edx movb %al, (%rsi) 有符号数截断 unsigned unsigned char movl (%rdi), %al movb %al, (%rsi) 截断是直接截断，机器数都是一样的，有无符号只是解释不同 char short movsbw (%rdi), %ax movw %ax, (%rsi) 符号拓展 ","permalink":"https://wellorbetter.github.io/post/2022-11-02-2022_11_2_%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E5%9F%BA%E7%A1%80%E6%95%A3%E9%A2%98/","summary":"\u003ch4 id=\"深入理解计算机系统题目\"\u003e深入理解计算机系统题目：\u003c/h4\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003earc_t *sp; // 使用typedef声明的数据类型  \ndest_t *dp;  \n我们想使用适当的数据传送指令来实现下面的操作  \n*dp = (dest_t) *sp;  \n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e假设 sp 和 dp 的值分别存储在寄存器 %rdi 和 %rsi 中。对于表中的每个表项，给出实现指定数据传送的两条指令。其中第一条指令应该从内存中读数，做适当的转换，并设置寄存器 %rax 的适当部分。然后，第二条指令要把 %rax 的适当部分写到内存。在这两种情况中，寄存器的部分可以是 %rax、%eax、%ax 或 %al，两者可以互不相同。\u003c/p\u003e","title":"2022_11_2_计算机系统基础散题"},{"content":"numpy入门 参考w3cschool numpy tutorial(基本上就是照着翻译，然后加入自己的理解，顺便把代码结果附上，over) 数组 可以将list tuple直接通过array()转化成ndarray\nimport numpy as np arr = np.array([1, 2, 3, 4, 5]) // arr = np.array((1, 2, 3, 4, 5)) printf(arr) printf(type(arr)) numpy的数组存在维度，当然python可以通过list嵌套实现，但是并不是真正意义上的数组，肯定没有这个快，而且没有现成的方法\n可以通过x.ndim方法来检查数组的维度\n前面提到可以通过np.array()来转化一个数组，后面可以跟一个参数ndim来显示的指定维度(不显示地指定ndim的参数的话，会根据传入的list..的维度来决定数组的维度)\narr = np.array([1, 2, 3, 4], ndmin=5) print(arr) res: [[[[[1 2 3 4]]]]] 既然都是数组了，那肯定支持下标索引，但是这里的索引有所差异，一般我们的索引都是这样的arr[3][2][1]这样的，但是在numpy里面，需要arr[3,2,1]这样访问。\narr = np.array([[1, 2, 3], [4, 5, 6]]) print(arr[1, 2]) res: 6 同样支持负数索引\narr = np.array([[1, 2, 3], [4, 5, 6]]) print(arr[1, -1]) res: 6 同样支持索引，这里表示得到arr下标为1的位置的元素，并拿其从0到1(左闭右开)的元素，形成一个数组\narr = np.array([[1, 2, 3], [4, 5, 6]]) print(arr[1, 0:1]) res: [4] 后面同样可以跟步长\narr = np.array([1, 2, 3, 4, 5, 6, 7]) print(arr[::2]) res: [1 3 5 7] arr = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) print(arr[1, 1:4]) res: [7, 8, 9] ####数据类型\n#####python的数据类型：字符串，整数，浮点数，布尔数，复数\n#####numpy的数据类型：\ni - integer b - boolean u - unsigned integer 无符号整型 f - float c - complex float 复数浮点数 m - timedelta M - datetime 日期时间 O - object 对象 S - string U - unicode string 采用unicode编码的字符串 V - fixed chunk of memory for other type ( void ) void 可以在np.array()里面显示的调用类型声明，如果声明有误，比如是字符串，后面跟了一个dtype=’i’，就会报错\ni,u,f,S 可以定义大小\narr = np.array([1, 2, 3, 4], dtype=\u0026#39;i4\u0026#39;) #四个字节 一个字节八位 print(arr) print(arr.dtype) res: [1 2 3 4] int32 #####数组类型转化\n通过数组的astype(‘类型’)方法来进行copy\narr = np.array([1.1, 2.1, 3.1]) newarr = arr.astype(\u0026#39;i\u0026#39;) newarr[0] = 10 print(newarr) print(arr) res: [10 2 3] [1.1 2.1 3.1] 里面的参数可以写完整一点：int、bool 这样都是可识别的\n#####视图和拷贝的区别\n类似浅拷贝和深拷贝的关系\nview：视图，也就是浅拷贝，修改这个值，会连带修改它的原主人，同样，修改原主人也会影响view，连坐\narr = np.array([1, 2, 3, 4, 5]) x = arr.view() arr[0] = 42 print(arr) print(x) res: [42 2 3 4 5] [42 2 3 4 5] arr = np.array([1, 2, 3, 4, 5]) x = arr.view() x[0] = 31 print(arr) print(x) res: [31 2 3 4 5] [31 2 3 4 5] copy: 拷贝，深拷贝，独立的一份\ntips：view有一个属性base：原数组，copy没有，修改base就是修改原数组，同样会引起view的改变\narr = np.array([1, 2, 3, 4, 5]) x = arr.copy() y = arr.view() y[0] = 2 print(x.base) print(y.base) print(type(y.base)) print(y) y.base[0] = 0 print(arr) print(y) ####shape方法\n前面提到 ndim方法(和ndim一样，后面没有括号，应该是属性，习惯说成方法)，可以拿到数组的维度，这里的shape方法则会返回更加具体，会返回每个维度的在当前维度元素的个数(返回的是元组)\narr = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]) print(type(arr.shape)) print(arr.shape) res: \u0026lt;class \u0026#39;tuple\u0026#39;\u0026gt; (2, 4) arr = np.array([1, 2, 3, 4], ndmin=5) print(arr) print(\u0026#39;shape of array :\u0026#39;, arr.shape) res: [[[[[1 2 3 4]]]]] shape of array : (1, 1, 1, 1, 4) ####reshape方法\n顾名思义就是改变维度，但是reshape需要维度对应，不能随意改变维度，比如一维有十二个元素，满足二维的3 * 4，那么就可以改变，但是不满足就不能改变，比如2 * 5\narr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) newarr = arr.reshape(4, 3) print(newarr) res: [[ 1 2 3] [ 4 5 6] [ 7 8 9] [10 11 12]] 而且reshape返回的是原数组的view，里面有base属性，修改会造成连坐\ntips:可以使用unknown dimension，如果你有某一个维度不知道里面具体有多少元素，那么你可以在reshape里面写一个-1，numpy为为你自动计算(前提是可以算出来)\n如果reshape里面的参数是-1，则会将数组展成一维数组\narr = np.array([[1, 2, 3], [4, 5, 6]]) newarr = arr.reshape(-1) print(newarr) res:[1 2 3 4 5 6 7 8] ####数组迭代\n1、经典for循环，拿到的是最外层数组里面的元素(里面的n-1维数组)，可以接着套娃，处理高维数据比较复杂\narr = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]) for x in arr: print(x) res: [[1 2 3] [4 5 6]] [[ 7 8 9] [10 11 12]] 2、np.nditer(arr)迭代每一个元素\narr = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) for x in np.nditer(arr): print(x) res: 在这个迭代中，我们可以传一个op_dtypes的参数来修改数组中元素的值的类型，op-\u0026gt;操作,dtypes-\u0026gt;类型,但是呢，并不能直接在数组中操作，规定要再传一个参数，flags=[‘buffered’]表示在一个额外的空间buffer里进行操作，龟腚。\narr = np.array([1, 2, 3]) for x in np.nditer(arr, flags=[\u0026#39;buffered\u0026#39;], op_dtypes=[\u0026#39;S\u0026#39;]): print(x) print(type(x)) res: b\u0026#39;1\u0026#39; \u0026lt;class \u0026#39;numpy.ndarray\u0026#39;\u0026gt; b\u0026#39;2\u0026#39; \u0026lt;class \u0026#39;numpy.ndarray\u0026#39;\u0026gt; b\u0026#39;3\u0026#39; \u0026lt;class \u0026#39;numpy.ndarray\u0026#39;\u0026gt; tips:自python更新到3.0后，dtype类型中’S’被修改为 (byte-)string类型，所以输出含b指的是此字符串类型为byteString类，有点搞\n然后，这个参数arr同样支持切片(包括步长)\narr = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]) for x in np.nditer(arr[:, ::2]): print(x) res: 3、enumerate，python原来自带有一个enumerate，可以返回list、tuple和string的下标和对应元素，同样的，numpy里也有一个ndenumerate，使用方法类似enumerate\narr = np.array([1, 2, 3]) for idx, x in np.ndenumerate(arr): print(idx, x) res: (0,) 1 #这个如果不是idx，x，直接是x的话，拿到的是一个tuple (1,) 2 #这里的idx同样是一个tuple (2,) 3 arr = np.array([[1, 2, 3, 4], [5, 6, 7, 8]]) for idx, x in np.ndenumerate(arr): print(idx, x) res: #如果是高维的，同样是挨个遍历 (0, 0) 1 (0, 1) 2 (0, 2) 3 (0, 3) 4 (1, 0) 5 (1, 1) 6 (1, 2) 7 (1, 3) 8 感觉别人有点盛气凌人，是我的错觉吗，一定要学会控制自己的情绪，一定要抱持冷静客观，喷人是解决不了问题的(可能会爽)QAQ 也许是最近压力太大造成的，好好休息吧\n","permalink":"https://wellorbetter.github.io/post/2022-11-02-numpy%E5%85%A5%E9%97%A8%E4%B8%80/","summary":"\u003ch1 id=\"numpy入门\"\u003enumpy入门\u003c/h1\u003e\n\u003ch4 id=\"参考w3cschool-numpy-tutorial基本上就是照着翻译然后加入自己的理解顺便把代码结果附上over\"\u003e参考w3cschool numpy tutorial(基本上就是照着翻译，然后加入自己的理解，顺便把代码结果附上，over)\u003c/h4\u003e\n\u003ch4 id=\"数组\"\u003e数组\u003c/h4\u003e\n\u003cp\u003e可以将list tuple直接通过array()转化成ndarray\u003c/p\u003e","title":"numpy入门\u003c一\u003e"},{"content":"第一篇博客 ","permalink":"https://wellorbetter.github.io/post/2022-10-30-%E7%AC%AC%E4%B8%80%E7%AF%87%E5%8D%9A%E5%AE%A2/","summary":"\u003ch2 id=\"第一篇博客\"\u003e第一篇博客\u003c/h2\u003e","title":"第一篇博客"},{"content":"wellorbetter\u0026rsquo;s blog 随手记录。\n","permalink":"https://wellorbetter.github.io/about/","summary":"\u003ch2 id=\"wellorbetters-blog\"\u003ewellorbetter\u0026rsquo;s blog\u003c/h2\u003e\n\u003cp\u003e随手记录。\u003c/p\u003e","title":"关于"}]