自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

carbon06的博客

About linux c++. Later will about routing algorithm, machine learning and deep learning

  • 博客(78)
  • 收藏
  • 关注

原创 CSDN博客停更

博客迁移至https://ce39906.github.io/

2019-06-13 11:35:46 345

原创 linux 下配置jupyter web server

背景开发机操作系统为centos 6.5, 在需要使用python 绘图功能时,需要生成图片再把图片download 到本地机器查看,使用jupyter 配置linux server 可以直接在本地通过浏览器运行python 任务,绘图的结果也可以通过浏览器直接查看。本博客介绍如何在linux环境下配置jupyter web server配置首先生成jupyter 配置jupyter no...

2018-11-26 18:01:13 715

原创 Tensorflow 解决路况状态分类问题

背景路况在地图渲染时候,会针对不同的拥堵情况选择不同颜色。一般来讲,道路拥堵情况分为三个状态,畅通,拥堵,缓行,分别用绿色,黄色,红色来渲染。 我们面临的问题是,已知道路属性以及通行速度,需要对路况状态进行分类。解决方案是依据第三方路况提供的路况状态以及抓取的高德路况状态来训练一个三分类模型。特征处理应用的特征如下 feature description ...

2018-11-23 17:45:55 947

原创 使用TensorFlow构建卷积神经网络

本文介绍使用TensorFlow 构建卷积神经网络解决kaggle上digit-recognizer。数据规格MNIST 数据集提供了60000条手写数字训练数据,每个图像使用28 * 28 的灰度图表示 。模型本文模型包括输入层,2个卷积层,2个池化层,一个全连接层,最后一个大小为10的输出层。卷积层使用Relu activation function引入非线性特性。池化层使用max-p...

2018-10-25 19:39:30 621

原创 Tensorflow 编译及应用C++静态库

背景目前对Tensorflow的主流应用模式是使用python训练模型,使用c++或者java应用训练好的模型。上篇博客介绍了如何在工程中应用Tensorflow 动态库,本博客介绍如何在工程中应用Tensorflow静态库编译静态链接库clone tensorflow git 仓库git clone https://github.com/tensorflow/tensor...

2018-09-11 21:07:48 4449 5

原创 Tensorflow 编译及应用C++动态库

背景Tensorflow 是google开源的目前最流行的深度学习框架。 TensorFlow 源码基于c++ 开发,提供了java, c, c++, python等主流编程语言支持。目前业界主流的应用方式是使用Tensorflow python构建以及训练模型,模型训练完成后使用c++ 或者java将模型应用到生产环境。 本文主要介绍如何将Tensorflow编译成动态库以便于其他工程使...

2018-09-10 12:56:31 2885 3

原创 g++ warn_unused_result

介绍在编程过程中,有的函数我们需要确保函数的返回值必须被使用。但是如果函数使用者直接调用函数且不使用函数的返回值的话,g++ 不会给出warning。这样可能会导致很难寻觅的bug。如调用realloc函数,函数调用者必须使用函数的返回值获得重新分配内存的指针。 利用g++ common function attributes 中提供的warn_unused_result 可以保证函数的返回...

2018-08-24 14:22:07 4464 1

原创 C++11 智能指针

智能指针的思想c++ 要求程序员自己管理内存,为程序员提供了更高自由度,但更高的自由度同时意味着更多责任。为了减少c++程序员在使用裸指针时可能带来的内存泄露,c++11 引入智能指针帮助程序员管理内存。智能指针背后的设计思想是RAIIunique_ptrunique_ptr 设计的目的是保证指针变量只指向一个实体,避免出现有其他指针变量指向相同实体,或者此指针变量指向同类型的其他...

2018-08-08 16:47:51 180

原创 Json library implemented by boost variant

Json library implemented by boost variantboost variant 介绍boost variant 是一个不同union的泛型类,用于存储和操作不同类型但在使用时存在相同抽象的对象。variant 在实现不同类型的泛型的同时,提供对其包括的具体类型的安全访问。 基于此性质,boost variant 可以应用于json 这种数据结构,我们把j...

2018-08-01 19:18:51 247

原创 c++11 右值引用,移动构造函数,emplace_back 解析

右值引用C++11 引入了右值引用的概念,使用&&表示。 首先简单介绍右值的概念,简单的将,所有赋值语句右侧的都是右值,或者说所有没有名字的变量都是右值。例如int a = 2;a 中就是一个左值,相对的,2 就是一个右值。关于右值更详细严谨的介绍见https://en.cppreference.com/w/cpp/language/value_category...

2018-07-26 16:34:32 5843 6

原创 Trie C++ 实现与解析

Trie tree 介绍trie 源自 retrieval ,中文称为前缀树或字典树。具体介绍见wiki trieC++ 实现以下trie实现支持任何语言(Chinese,English,Janpanse…)。主要包括以下三个接口// 使用一组词初始化trie.void Init(const std::vector<std::string>& dict...

2018-07-20 16:42:57 1070

原创 [LeetCode] 648. Replace Words

题目描述In English, we have a concept called root, which can be followed by some other words to form another longer word - let’s call this word successor. For example, the root an, followed by other, wh...

2018-07-19 19:31:57 192

原创 [LeetCode] 470. Implement Rand10() Using Rand7()

题目描述Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer in the range 1 to 10.Do NOT use system’s M...

2018-07-18 17:44:55 1000

原创 [LeetCode] 869. Reordered Power of 2

题目描述Starting with a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is not zero.Return true if and only if we can do this in a way...

2018-07-17 19:22:15 341

原创 [LeetCode] 725. Split Linked List in Parts

题目描述Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list “parts”.The length of each part should be as equal as possible: no tw...

2018-07-16 11:45:19 174

原创 [LeetCode] 756. Pyramid Transition Matrix

题目描述We are stacking blocks to form a pyramid. Each block has a color which is a one letter string, like 'Z'.For every block of color C we place not in the bottom row, we are placing it on top of a...

2018-07-13 18:12:19 442

原创 [LeetCode] 874. Design Circular Deque

题目描述Design your implementation of the circular double-ended queue (deque). Your implementation should support following operations:MyCircularDeque(k): Constructor, set the size of the deque to be...

2018-07-12 15:41:43 469

原创 [LeetCode] 709. To Lower Case

题目描述Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. 题目的要求非常简单,即将一个字符串中的大写字母全部转化为小写。 解决思路是利用ascii码进行转化,A-Z 的ascii 码是65-90 ,a-z 的ascii 码是9...

2018-07-12 15:06:34 1094

原创 c++ 将git提交信息编译到可执行文件

在生产环境中经常需要查看在线上运行的程序对应git的哪次提交。 我们可以在编译时获取git 最后一次提交信息GIT_SHA1 宏,C++ 程序通过访问GIT_SHA1宏可以输出和git仓库的提交信息。 使用Makefile时,在Makefile 添加以下CPPFLAGS+=-DGIT_SHA1="$(shell git log --format='[sha1]:%h [author]:...

2018-07-12 11:45:04 1468

原创 [LeetCode] 378. Kth Smallest Element in a Sorted Matrix

题目描述Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order,...

2018-07-12 10:55:13 190

原创 rundeck CentOS 部署以及配置

简介rundeck 是一个在多机器环境下实现自动化执行以及调度任务的开源工具。rundeck 提供了web 界面,用户可以通过web 界面定制任务,调度,观察节点的执行情况。安装与配置安装rundeck 的官网位置rundeck rundeck 运行依赖于java,因此需要首先安装并配置javayum install java-1.8.0-openjdk java-1....

2018-07-11 13:25:12 2139

原创 [LeetCode] 866. Smallest Subtree with all the Deepest Nodes

题目描述Given a binary tree rooted at root, the depth of each node is the shortest distance to the root.A node is deepest if it has the largest depth possible among any node in the entire tree.The s...

2018-07-09 19:16:57 548

原创 [LeetCode] 676. Implement Magic Dictionary

题目描述Implement a magic directory with buildDict, and search methods.For the method buildDict, you’ll be given a list of non-repetitive words to build a dictionary.For the method search, you’ll be...

2018-07-06 12:49:06 191

原创 [LeetCode] 337. House Robber III

题目描述The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. After ...

2018-07-05 19:39:25 128

原创 [LeetCode] Print Binary Tree

题目描述Print a binary tree in an m*n 2D string array following these rules:The row number m should be equal to the height of the given binary tree. The column number n should always be an odd number...

2018-07-04 12:31:33 141

原创 [LeetCode] 860. Lemonade Change

题目描述At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bills).Each customer will only buy one lemo...

2018-07-02 13:03:03 573

原创 c++ cout 不能正常打印uint8_t

问题现象编译运行以下代码/************************************************************************* > File Name: cout_uint8.cpp > Author: liuce03 > Mail: [email protected] > Creat...

2018-06-29 14:36:38 9348

原创 批量替换tab为空格

利用find 找出需要替换的文件,然后使用sed命令执行替换。 如将src 路径下的所有cpp 文件的tab 替换为空格的命令如下sed -i -e "s/\t/ /g" `find src -name "*.cpp"`...

2018-06-13 18:08:51 5808 1

原创 [LeetCode] 539. Minimum Time Difference

题目描述Given a list of 24-hour clock time points in “Hour:Minutes” format, find the minimum minutes difference between any two time points in the list. Example 1:Input: ["23:59","00:00"]Output: 1...

2018-06-12 18:08:36 188

原创 [LeetCode] 844. Backspace String Compare

题目描述Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character.Example 1:Input: S = "ab#c", T = "ad#c"Output: trueExplanat...

2018-06-05 19:49:25 962

原创 C++利用宏实现统计运行时间工具

背景OSRM backend 代码中有一个timing_util.hpp的头文件,利用宏以及c++11 chrono 实现了统计代码运行时间的工具。 在工程中统计代码运行时间非常常用,本文介绍OSRM timing_util的实现原理,并用示例来说明。实现解析#ifndef TIMING_UTIL_HPP#define TIMING_UTIL_HPP#include &lt...

2018-06-05 18:04:19 1919

原创 Linux cmake 静态链接boost库

背景使用动态链接编译的二进制程序在执行时要求开发环境与生产环境严格一致,因此我们更倾向于使用静态链接的方式链接第三方库。本文介绍如何在Linux 环境下使用cmake 静态链接Boost 库。示例我们将编译好boost静态库.a 文件和头文件放入third_party 目录,在CMakeLists.txt 中使用find_package 方法查找boost静态库。 我自己在Cen...

2018-06-05 16:59:54 6903

原创 [LeetCode] 817. Linked List Components

题目描述We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the values in the linked list.Return the number of connected comp...

2018-05-31 14:44:58 309

原创 [LeetCode] 807. Max Increase to Keep City Skyline

题目描述In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amoun...

2018-05-30 17:35:24 353

原创 [LeetCode] 841. Keys and Rooms

题目描述There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, …, N-1, and each room may have some keys to access the next room. Formally, each room i has a list of ke...

2018-05-30 12:54:28 915

原创 [LeetCode] 565. Array Nesting

题目描述A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], … } subjected to the rule below.Su...

2018-05-29 20:07:35 136

原创 [LeetCode] 721. Accounts Merge

题目描述Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account...

2018-05-29 15:55:43 440

原创 [LeetCode] 623. Add One Row to Tree

题目描述Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.The adding rule is: given a positive in...

2018-05-28 12:12:34 167

原创 [LeetCode] 454. 4Sum II

题目描述Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same...

2018-05-25 19:43:19 182

原创 [LeetCode] 542. 01 Matrix

题目描述Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1. Example 1: Input:0 0 00 1 00 0 0Output:0 0 00...

2018-05-24 12:33:44 350

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除