12 2019 档案

摘要:fread size_t fread ( void * ptr, size_t size, size_t count, FILE * stream ); 这里需要弄清楚的是size和count,size是要读入的数据块的长度,count是有多少个这样的... 阅读全文
posted @ 2019-12-31 05:04 2021年的顺遂平安君 编辑
摘要:这里需要弄清楚的是 和`count size count size count`。 和`fread`一样,一个读,一个写。 例子 可以利用 把一整个多维数组保存为二进制文件,之后可以使用 读取。 阅读全文
posted @ 2019-12-31 05:04 2021年的顺遂平安君 编辑
摘要:如果安装的是特定版本的 Ubuntu,需要使用 阅读全文
posted @ 2019-12-31 02:56 2021年的顺遂平安君 编辑
摘要:ubuntu config --default-user 如果安装的是特定版本的 Ubuntu,需要使用 ubuntu1804 config --default-user 阅读全文
posted @ 2019-12-31 02:56 2021年的顺遂平安君 编辑
摘要:import osif not os.path.exists(directory): os.mkdir(directory) 阅读全文
posted @ 2019-12-30 23:44 2021年的顺遂平安君 编辑
摘要:``` import os if not os.path.exists(directory): os.mkdir(directory) ``` 阅读全文
posted @ 2019-12-30 23:44 2021年的顺遂平安君 编辑
摘要:用于递归文件下的所有子文件夹 阅读全文
posted @ 2019-12-30 23:43 2021年的顺遂平安君 编辑
摘要:zip -r zip_file.zip file1.txt folder1 -r用于递归文件下的所有子文件夹 阅读全文
posted @ 2019-12-30 23:43 2021年的顺遂平安君 编辑
摘要:https://eigen.tuxfamily.org/dox/TopicUsingBlasLapack.html Eigen 3.3之后的版本可以调用BLAS和LAPACK作为backend, 使用方法也很简单: 在引用Eigen库之前, 先加入以下... 阅读全文
posted @ 2019-12-30 23:42 2021年的顺遂平安君 编辑
摘要:https://eigen.tuxfamily.org/dox/TopicUsingBlasLapack.html Eigen 3.3之后的版本可以调用BLAS和LAPACK作为backend, 使用方法也很简单: 在引用Eigen库之前, 先加入以下宏定义: 之后在编译的时候, 链接上相应的库即可 阅读全文
posted @ 2019-12-30 23:42 2021年的顺遂平安君 编辑
摘要:API规范: 和`LAPACK` 和`LAPACK BLAS LAPACK BLAS`中第三个Level的函数. 规范实现 基于 规范的矩阵库包括开源的ATLAS, OpenBLAS等, 商业的Intel MKL, Nvidia cuBLAS等. Netlib用Fotran语言实现了BLAS和LAP 阅读全文
posted @ 2019-12-30 23:38 2021年的顺遂平安君 编辑
摘要:API规范: BLAS和LAPACK BLAS和LAPACK是两种接口规范, 用于矩阵基本运算. BLAS的功能分三个Level, LAPACK的功能更丰富, 主要用于扩展BLAS中第三个Level的函数. 规范实现 基于BLAS规范的矩阵库包括开源... 阅读全文
posted @ 2019-12-30 23:38 2021年的顺遂平安君 编辑
摘要:这篇文章讲得很好: https://www.cnblogs.com/tracylee/archive/2012/10/15/2723816.html 这是总结一下, 静态链接库直接被包含在最终生成的可执行文件中, 动态链接库(DLL)文件夹与可执行文件... 阅读全文
posted @ 2019-12-30 23:30 2021年的顺遂平安君 编辑
摘要:这篇文章讲得很好: https://www.cnblogs.com/tracylee/archive/2012/10/15/2723816.html 这是总结一下, 1. 静态链接库直接被包含在最终生成的可执行文件中, 动态链接库(DLL)文件夹与可执行文件独立, 可执行文件可以动态地使用与卸载DL 阅读全文
posted @ 2019-12-30 23:30 2021年的顺遂平安君 编辑
摘要:安装 使用 阅读全文
posted @ 2019-12-30 23:25 2021年的顺遂平安君 编辑
摘要:安装 git clone https://github.com/xianyi/OpenBLAS.gitcd OpenBLASmakemake install PREFIX=your_installation_directory 使用 gcc -o t... 阅读全文
posted @ 2019-12-30 23:25 2021年的顺遂平安君 编辑
摘要:编译的时候加上-O3利用.noalis()进行矩阵乘法m_res.noalias() = m1 * m2;, 只有当右值是乘积的时候才有意义;编译的时候加上-mavx和-mfma 参考: https://stackoverflow.com/questio... 阅读全文
posted @ 2019-12-30 23:20 2021年的顺遂平安君 编辑
摘要:1. 编译的时候加上 2. 利用 进行矩阵乘法 , 只有当右值是乘积的时候才有意义; 3. 编译的时候加上 和` mfma` 参考: https://stackoverflow.com/questions/28284986/eigen vs matlab parallelized matrix mu 阅读全文
posted @ 2019-12-30 23:20 2021年的顺遂平安君 编辑
摘要:首先需要确定C++和Python中变量对应的精度类型, https://docs.scipy.org/doc/numpy/user/basics.types.html array types and conversions between types 常用的, C++ 对应Python C++ 对应 阅读全文
posted @ 2019-12-26 23:25 2021年的顺遂平安君 编辑
摘要:首先需要确定C++和Python中变量对应的精度类型, https://docs.scipy.org/doc/numpy/user/basics.types.html#array-types-and-conversions-between-types 常... 阅读全文
posted @ 2019-12-26 23:25 2021年的顺遂平安君 编辑
摘要:{ "cmd": ["C:\\Users\\User_Name\\.conda\\envs\\Env_Name\\python.exe", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\"... 阅读全文
posted @ 2019-12-26 23:12 2021年的顺遂平安君 编辑
摘要:Windows下使用 可以获得python的路径。 阅读全文
posted @ 2019-12-26 23:12 2021年的顺遂平安君 编辑
摘要:include typedef class APrinterClass { public: void printer() { std::cout 阅读全文
posted @ 2019-12-26 00:07 2021年的顺遂平安君 编辑
摘要:typedef unsigned char BYTE;BYTE b1; #includetypedef class APrinterClass {public: void printer() { std::cout << "Print this... 阅读全文
posted @ 2019-12-26 00:07 2021年的顺遂平安君 编辑
摘要:#include using namespace std;class Box { public: double getVolume(void) { return length * breadth * height; ... 阅读全文
posted @ 2019-12-26 00:00 2021年的顺遂平安君 编辑
摘要:重载后可以返回不同类型的数据,例子中 和`+ &`重载符的返回类型是 。 阅读全文
posted @ 2019-12-26 00:00 2021年的顺遂平安君 编辑
摘要:1. 如果对象不是针对,它们没有区别 2. 如果对象是指针,它们有区别 : 指针p不能够指向其他地址 : 指针p只读 ,不能够对其进行修改 举例, include using namespace std; int main() { int arr[3]={1,2,3}; int varr[3]={1 阅读全文
posted @ 2019-12-25 22:50 2021年的顺遂平安君 编辑
摘要:如果对象不是针对,它们没有区别 int const x = 3;const int x = 3; 如果对象是指针,它们有区别 int* const p = &array: 指针p不能够指向其他地址 const int* p = &array: 指针p只... 阅读全文
posted @ 2019-12-25 22:50 2021年的顺遂平安君 编辑
摘要:两者基本相似,语法也相同。两者不同点在于,类中成员默认是private的,而结构体中成员默认是public的。 阅读全文
posted @ 2019-12-25 22:01 2021年的顺遂平安君 编辑
摘要:两者基本相似,语法也相同。两者不同点在于,类中成员默认是 的,而结构体中成员默认是 的。 阅读全文
posted @ 2019-12-25 22:01 2021年的顺遂平安君 编辑
摘要:网上看了很多说明,还是处于半知半解的状态,看了下面这个例子才算是明白了 指针 include using namespace std; class Box { public: // Constructor definition Box(double l = 2.0, double b = 2.0, 阅读全文
posted @ 2019-12-25 21:56 2021年的顺遂平安君 编辑
摘要:网上看了很多说明,还是处于半知半解的状态,看了下面这个例子才算是明白了this指针 #include using namespace std;class Box { public: // Constructor definition ... 阅读全文
posted @ 2019-12-25 21:56 2021年的顺遂平安君 编辑
摘要:const放在最前面用于修改函数返回值时,并没有实际效果,因为函数返回值以复制的形式被赋给变量。const放在形参列表后面时,表明该函只能够”只读“其所在的类,不能够访问所在类的其他非只读成员函数。 阅读全文
posted @ 2019-12-25 06:05 2021年的顺遂平安君 编辑
摘要:1. 放在最前面用于修改函数返回值时,并没有实际效果,因为函数返回值以复制的形式被赋给变量。 2. 放在形参列表后面时,表明该函只能够”只读“其所在的类,不能够访问所在类的其他非只读成员函数。 阅读全文
posted @ 2019-12-25 06:05 2021年的顺遂平安君 编辑
摘要:``` include using namespace std; int main() { int arr[2][2][2] = {0}; for(auto&& i:arr) for(auto&& j:i) for(auto&& k:j) cout 阅读全文
posted @ 2019-12-25 04:12 2021年的顺遂平安君 编辑
摘要:#include using namespace std;int main(){ int arr[2][2][2] = {0}; for(auto&& i:arr) for(auto&& j:i) for(auto&& k:j) cout <<... 阅读全文
posted @ 2019-12-25 04:12 2021年的顺遂平安君 编辑
摘要:begin(a)指向数组a的第一个元素,end(a)指向数组a最后一个元素之后的一个元素 #include using namespace std;int main(){ int ia[] = {0,1,2,3}; int *beg = begin(ia... 阅读全文
posted @ 2019-12-25 04:02 2021年的顺遂平安君 编辑
摘要:`begin(a) a`的第一个元素, 指向数组 最后一个元素 之后的一个元素 include using namespace std; int main() { int ia[] = {0,1,2,3}; int beg = begin(ia); int last = end(ia); cout 阅读全文
posted @ 2019-12-25 04:02 2021年的顺遂平安君 编辑
摘要:``` include using namespace std; int main() { int ia{3}; decltype(ia) varr[3]={1,2,3}; for(auto&& x:varr) cout 阅读全文
posted @ 2019-12-25 03:53 2021年的顺遂平安君 编辑
摘要:#include using namespace std;int main(){ int ia{3}; decltype(ia) varr[3]={1,2,3}; for(auto&& x:varr) cout << x << endl; return ... 阅读全文
posted @ 2019-12-25 03:53 2021年的顺遂平安君 编辑
摘要:#include using namespace std;void printReference (int& value){ cout << "lvalue: value = " << value << endl;} void printRe... 阅读全文
posted @ 2019-12-25 03:49 2021年的顺遂平安君 编辑
摘要:``` include using namespace std; void printReference (int& value) { cout 阅读全文
posted @ 2019-12-25 03:49 2021年的顺遂平安君 编辑
摘要:1. 创建拷贝,无法修改range中的元素 2. 可以修改range中的元素,但一般用以下这种 3. 只读range中的元素 阅读全文
posted @ 2019-12-24 23:47 2021年的顺遂平安君 编辑
摘要:for(auto x : range) 创建拷贝,无法修改range中的元素 for(auto& x : range) 可以修改range中的元素,但一般用以下这种 for(auto&& x : range) for(const auto & x... 阅读全文
posted @ 2019-12-24 23:47 2021年的顺遂平安君 编辑
摘要:Initialization #include#includeusing namespace std;int main(){ vector ivec(10, -1); vector ivec2(ivec); for (auto x : ivec2) {c... 阅读全文
posted @ 2019-12-24 23:19 2021年的顺遂平安君 编辑
摘要:Initialization include include using namespace std; int main() { vector ivec(10, 1); vector ivec2(ivec); for (auto x : ivec2) {cout jvec(10); //initia 阅读全文
posted @ 2019-12-24 23:19 2021年的顺遂平安君 编辑
摘要:``` int main() { using namespace std; int p = new int[3]; // new运算符返回第一个元素的地址。 p[0] = 10; p[1] = 9; p[2] = 8; for (int i = 0; i 阅读全文
posted @ 2019-12-23 23:33 2021年的顺遂平安君 编辑
摘要:int main() { using namespace std; int* p = new int[3]; // new运算符返回第一个元素的地址。 p[0] = 10; p[1] = 9; ... 阅读全文
posted @ 2019-12-23 23:33 2021年的顺遂平安君 编辑
摘要:这个符号特别容易混淆, 因为在C++中, &有两种不同用法: 获得变量地址引用传递 第一个例子, int main(){ std::string s = "Hello"; std::string*p = &s; std::cout << p << s... 阅读全文
posted @ 2019-12-23 22:51 2021年的顺遂平安君 编辑
摘要:这个符号特别容易混淆, 因为在C++中, 有两种不同用法: 1. 获得变量地址 2. 引用传递 第一个例子, int main() { std::string s = "Hello"; std::string p = &s; std::cout 阅读全文
posted @ 2019-12-23 22:51 2021年的顺遂平安君 编辑
摘要:原文来自: https://shendrick.net/Coding%20Tips/2015/03/15/cpparrayvsvector.html @Seth Hendrick Original article: https://shendrick.net/Coding%20Tips/2015/0 阅读全文
posted @ 2019-12-23 22:37 2021年的顺遂平安君 编辑
摘要:原文来自: https://shendrick.net/Coding Tips/2015/03/15/cpparrayvsvector.html @Seth Hendrick Original article: https://shendrick.net/... 阅读全文
posted @ 2019-12-23 22:37 2021年的顺遂平安君 编辑
摘要:今天好奇一个问题, int a[3] = {1,2,3];int b[3];b=a; 编译器报错, 网上找了一圈, 大概明白: C++就是如此设定的, 数组不能直接赋值, 可以使用std::copy(), 或手工循环赋值, 但是就是不可以直接把一个数组... 阅读全文
posted @ 2019-12-23 21:46 2021年的顺遂平安君 编辑
摘要:今天好奇一个问题, 编译器报错, 网上找了一圈, 大概明白: C++就是如此设定的 , 数组不能直接赋值, 可以使用 , 或手工循环赋值, 但是就是不可以直接把一个数组赋值给另外一个数组. 但是 和`std::vector`是可以的. include include int main() { std 阅读全文
posted @ 2019-12-23 21:46 2021年的顺遂平安君 编辑
摘要:MatrixXd M = MatrixXd::Zero(5, 5); ofstream fout("test.txt"); fout int main() { int a[4] = {0,1,2,3}; int b[4]; std::copy(a, a+4, b); b[3] = 5; std::c 阅读全文
posted @ 2019-12-23 21:43 2021年的顺遂平安君 编辑
摘要:int main(){ int arr[2][5] = { {1,8,12,20,25}, {5,9,13,24,26} };} void f(double p[][10]) {} #include #in... 阅读全文
posted @ 2019-12-23 21:43 2021年的顺遂平安君 编辑
摘要:最近为了在C++中使用矩阵运算,简单学习了一下Eigen矩阵库。Eigen比Armadillo相对底层一点,但是只需要添加头文库即可使用,不使用额外的编译和安装过程。 基本定义 Matrix3f是3*3矩阵,MatrixXf表示矩阵维数不确定,Matr... 阅读全文
posted @ 2019-12-22 23:13 2021年的顺遂平安君 编辑
摘要:最近为了在C++中使用矩阵运算,简单学习了一下Eigen矩阵库。Eigen比Armadillo相对底层一点,但是只需要添加头文库即可使用,不使用额外的编译和安装过程。 基本定义 是`3 3 MatrixXf MatrixXf m(3,4) 3 4`矩阵。 'MatrixXd double Matri 阅读全文
posted @ 2019-12-22 23:13 2021年的顺遂平安君 编辑
摘要:搬运: https://stackoverflow.com/questions/57610804/when is the timing to use sample weights in keras : output 变量的权重 : data sample 的权重 阅读全文
posted @ 2019-12-19 18:52 2021年的顺遂平安君 编辑
摘要:搬运: https://stackoverflow.com/questions/57610804/when-is-the-timing-to-use-sample-weights-in-keras import tensorflow as tfimpor... 阅读全文
posted @ 2019-12-19 18:52 2021年的顺遂平安君 编辑
摘要:#include #include main(){ int a,b,c,d; std::ifstream infile ("test.txt", std::ifstream::in); while (!infile.eof()) { infile >> ... 阅读全文
posted @ 2019-12-12 22:00 2021年的顺遂平安君 编辑
摘要:``` include include main() { int a,b,c,d; std::ifstream infile ("test.txt", std::ifstream::in); while (!infile.eof()) { infile a; infile b; infile c; 阅读全文
posted @ 2019-12-12 22:00 2021年的顺遂平安君 编辑
摘要:``` :%y+ ``` 阅读全文
posted @ 2019-12-02 21:41 2021年的顺遂平安君 编辑

点击右上角即可分享
微信分享提示