其他
稀疏编码的一般最优化公式为:
其中的零范数为非凸优化。那么如何解这么一个非凸优化问题呢?其中一个常用的解法就是MP算法。
MP算法是一种贪心算法(greedy),每次迭代选取与当前样本残差最接近的原子,直至残差满足一定条件。
首先解决两个问题,怎么定义“最接近原子”,怎么计算残差?
选择最接近残差的原子:MP里定义用向量内积原子与残差的距离,我们用R表示残差,di表示原子,则:
Ma...
The Domino Effect
A standard set of Double Six dominoes contains 28 pieces (called bones) each displaying two numbers from 0 (blank) to 6 using dice-like pips. The 28 bones, which are un...
http://acm.hdu.edu.cn/showproblem.php?pid=1082
分析:
虽然矩阵连乘是动态规划的经典题型,但是这道题却只是对字符串的处理——括号运算的处理。所以利用栈来处理。
当遇到矩阵时入栈,遇到“)” 弹出连个矩阵进行运算,并将运算结果压栈。另者在矩阵相乘时注意两个矩阵是否满足相乘条件。
代码:
#include
#include
#...
1、直接插入排序
比较次数最好n-1,最坏n(n-1)/2,平均时间复杂度为O(n^2),稳定的排序方法
void insert_sort(int a[], int len)
{
int i, j, temp;
for(i = 1; i < len; i++)
{
temp = a[i];
for( j = i...
这段时间换了新的pair,在和pair做story的过程中。我们提出了“Story Review”这样一个事情。我们两个人都从中收获颇多,就简单写篇博客记录一下,以后说不定还会有更新。
所谓的Story Review其实就是在做完一个Story以后,对做Story的收获和不足的梳理总结,应该包括但也不限于如下:
1. 完成Story的过程是否能够改进?
解决有...
///
/// 为图片生成缩略图
///
/// 原图片的路径
/// 缩略图宽
/// 缩略图高
///
public System.Drawing.Image GetThumbnail(System.Drawing.Image image, int width, int height)
{
Bitmap bmp = new...
首先看看MS对Visual Styles的解释:
Windows XP and later operating systems support a feature called visual
styles that enables the appearance of common controls to change based on the theme chosen by the user...
linux内核链表是一个双向循环链表,其实现与具体硬件平台无关,理解了linux内核链表的实现机制,我们能够把其移植到引用层程序设计当中。
linux内核链表相关的一些函数声明在include/linux/list.h中。
首先是链表数据结构的定义
struct list_head {
struct list_head *next, *prev;
...