上一页 1 2 3 4 5 6 7 ··· 18 下一页
摘要: static inline float sigmoid(float x) { return static_cast<float>(1.f / (1.f + exp(-x))); } 阅读全文
posted @ 2022-06-16 14:18 Truman001 阅读(904) 评论(0) 推荐(0)
摘要: 1 不需要加载图片 // C++ program for the above approach #include <iostream> #include <opencv2/core/core.hpp> // Library to include for // drawing shapes #incl 阅读全文
posted @ 2022-06-16 11:47 Truman001 阅读(1671) 评论(0) 推荐(0)
摘要: using namespace cv; // Capture the Image from the webcam VideoCapture cap(0); // Get the frame Mat save_img; cap >> save_img; if(save_img.empty()) { s 阅读全文
posted @ 2022-06-16 10:40 Truman001 阅读(222) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> template<typename T> std::vector<double> linspace(T start_in, T end_in, int num_in) { std::vector<double> linspa 阅读全文
posted @ 2022-06-16 10:39 Truman001 阅读(1362) 评论(0) 推荐(0)
摘要: #include<iostream> #include<assert.h> #include<vector> #include<chrono> int main() { int iter = 10000; std::vector<double> coeffs = { 4, 2, -2, 5, 0, 阅读全文
posted @ 2022-06-16 10:29 Truman001 阅读(169) 评论(0) 推荐(0)
摘要: #include<iostream> #include<vector> #include<math.h> std::vector<double> Polyval(std::vector<double> coeffs, std::vector<double> values) { std::vector 阅读全文
posted @ 2022-06-16 10:27 Truman001 阅读(560) 评论(0) 推荐(0)
摘要: C++类型转换 static_cast 任何具有明确定义的类型转换,只要不包含底层const,都可以使用static_cast example: int j=10; double value=static_cast<double>(j)/2; void *p =&d; //必须确保d是double类 阅读全文
posted @ 2021-07-24 22:15 Truman001 阅读(51) 评论(0) 推荐(0)
摘要: /* 优化string 复制的时候 仅复制引用,只有在修改内容时,才复制内容 即实现写时拷贝 */ class COWMyString { public: //默认参数 COWMyString(const char *str = "") :m_str(strcpy(new char[strlen(s 阅读全文
posted @ 2021-03-17 17:01 Truman001 阅读(215) 评论(0) 推荐(0)
摘要: class A { public: //静态函数,返回引用 static A &GetInstance() {//静态局部变量 static A s_instance; return s_instance; } private: //默认构造函数 A() = default; /* 拷贝构造函数 用 阅读全文
posted @ 2021-03-17 16:13 Truman001 阅读(65) 评论(0) 推荐(0)
摘要: /* 实现一个string满足基本用法 */ class MyString { public: //默认参数 MyString(const char *str=""):m_str(strcpy(new char[strlen(str)+1], str)) { } ~MyString(void) { 阅读全文
posted @ 2021-03-17 16:12 Truman001 阅读(98) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 18 下一页