摘要: C++ ECO 是一种对于空类型的内存布局优化策略. 在 C++ 中不允许存在大小为零的类型, 即便是空类也会占有一个字节的大小, 像 void 和没有定义的类型称为「非完备类型」(Incomplete Type). ​ 这带来一个问题, 如果将空类作为成员变量的类型, 则每个成员都会占用至少一个字 阅读全文
posted @ 2024-04-13 15:33 kaleidopink 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 在C++中, 当new 操作符接受一个指针作为参数时, 表示在该指针所对应的地址上进行构建. new (ptr) Type(args...); 利用这一点, 我们可以在类的成员函数或者构造函数里对类进行重构: class Base { public: Base() { printf("default 阅读全文
posted @ 2024-01-31 13:27 kaleidopink 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 本文中内容来自: Rust's Type System is Turing-Complete Smallfuck 语言 Smallfuck 是一门最小的图灵完备的编程语言, 其可以看成最基本的图灵机的一种变体, 其将计算机看成一条无限长的纸带, 纸带每一格存储 0 或 1, 存在一个指针指向纸带的某 阅读全文
posted @ 2024-01-08 13:53 kaleidopink 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1. Definitions ​ Definition 1. We say the process \(\{X(t),t\ge0\}\) is a continuous-time Markov chain if for all \(s,t\ge0\) and nonnegative integers 阅读全文
posted @ 2023-12-10 11:45 kaleidopink 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1. Introduction ​ Let \(\{X_n,n=0,1,2,...\}\) be a stochastic process that takes on a finite number of possible values. If \(X_n=i\), then the process 阅读全文
posted @ 2023-11-19 16:32 kaleidopink 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1. Basic properties and examples 1.1 Definitions ​ A function \(f:\R^n\rarr\R\) is convex if \(\mathrm{\textbf{dom}}\ f\) is a convex set and if for a 阅读全文
posted @ 2023-11-15 15:40 kaleidopink 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1. Counting process ​ We say that \(\{N(t),t\ge0\}\) is a counting process if \(N(t)\) represents the total number of "events" occur by time \(t\) and 阅读全文
posted @ 2023-11-14 17:22 kaleidopink 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1. Affine and convex sets 1.1 Affine sets ​ A set \(C\in\R^n\) is affine if the line through any two distinct points in \(C\) lies in \(C\), which mea 阅读全文
posted @ 2023-11-12 17:33 kaleidopink 阅读(37) 评论(0) 推荐(0) 编辑
摘要: Shell 实现终端 rm 回收站效果 本次实现的 rm 脚本的功能有: 1. 回收站收容删除的文件 2. 脚本记录删除的文件绝对路径和时间戳 3. 可根据脚本恢复删除的文件,并且可以只根据文件名匹配回收站所有的文件进行选择 4. 可直接删除文件 5. 可同时接收多个参数 6. 清空回收站 后续会更新定时清空回收站的功能。 ```shel 阅读全文
posted @ 2023-08-15 20:46 kaleidopink 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 异步编程在 Rust 中的地位非常高,很多 crate 尤其是多IO操作的都使用了 async/await. 首先弄清楚异步编程的几个基本概念: Future Future 代表一个可在未来某个时候获取返回值的 task,为了获取这个 task 的执行状况,Future 提供了一个函数用于判断该 t 阅读全文
posted @ 2022-09-05 20:24 kaleidopink 阅读(1861) 评论(0) 推荐(0) 编辑