码迷,mamicode.com
首页 >  
搜索关键字:matrix factorization    ( 4370个结果
221 Maximum Square
这道题有两个思路, 一是沿用085的maximum rectangle的思路, 稍作改进即可, 代码如下, 这个方法运行192msclass Solution: # @param {character[][]} matrix # @return {integer} def maxi...
分类:其他好文   时间:2015-07-06 08:51:45    阅读次数:136
Matrix (hdu 2686 最大费用最大流)
题意:给出一个n*n的矩阵,每个点上都有一个值,现在从左上角沿着一条路径走到右下脚(只能向右或者向下),然后再从右下角回到左上角(只能向左或者向上),在这个过程中每个点只允许走一次,问路径上的权值之和最大为多少? 思路:这里用到费用流求解,首先添加一个超级源点s=0和超级汇点t=n*n+1,然后对每个点拆点, i 向 i` 连边,容量为1,花费为该点的权值mp[i][j],然后s与 1` 连边,容量为2,花费为0,n*n向t连边,容量为2,花费为0,最后矩阵中的点之间连边,容量为1,花费为0。最后答案为co...
分类:其他好文   时间:2015-07-05 16:54:22    阅读次数:140
Deep Learning for Nature Language Processing --- 第四讲(下)
A note on matrix implementations将J对softmax的权重W和每个word vector进行求导:尽量使用矩阵运算(向量化),不要使用for loop。模型训练中有两个开销比较大的运算:矩阵乘法f=Wx和指数函数expSoftmax(=logistic regression) is not very powerfulsoftmax只是在原来的向量空间中给出了一些lin...
分类:其他好文   时间:2015-07-04 22:20:10    阅读次数:283
Leetcode 221 Maximal Square
class Solution: # @param {character[][]} matrix # @return {integer} def maximalSquare(self, matrix): if matrix == []: return 0 m, n = len(matrix), len(matrix[0]) ...
分类:其他好文   时间:2015-07-04 18:29:27    阅读次数:191
矩阵相乘
有一个x*y的矩阵和一个y*z矩阵相乘,元素均为整数,求两个矩阵相乘得到的矩阵。这是一道华为OJ题,具体描述忘记了,大致内容如此。并且要求实现的函数参数为指针。 例如矩阵1为 int m1[1][3]={2,-6,3}; 矩阵2为 int m2[3][1]={4,-2,-4}; 乘积矩阵初始化为 int r[1][1]=0; 要求实现的函数为 void matrix_mult...
分类:其他好文   时间:2015-07-02 22:38:12    阅读次数:175
leetCode(27):Maximal Square
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 ...
分类:其他好文   时间:2015-07-02 10:07:01    阅读次数:115
Google interview question: disjoint-set questions
Question:Given a n,m which means the row and column of the 2D matrix and an array of pair A( size k). Originally, the 2D matrix is all 0 which means t...
分类:其他好文   时间:2015-07-02 06:36:01    阅读次数:162
【BZOJ 4128】 matrix
题目其实很简单,BSGS可以一眼看出来,但这就需要矩阵求逆,然而我并不会。。。 于是发现了一种BSGS的非求逆方法,借此介绍一下。 aix?y=b(modP)a^{ix-y}=b (mod P) 推出 aix=b?ay(modP)a^{ix}=b*a^y(mod P) 因此我们只需要对每个b?ayb*a^yhash一下就好了,然后穷举ii,验证是否存在即可。code:#include<cst...
分类:其他好文   时间:2015-07-01 23:47:10    阅读次数:560
leetcode Spiral Matrix
代码: 1 #include 2 #include 3 4 using namespace std; 5 6 vector spiralOrder(vector>& matrix) 7 { 8 if (matrix.size() == 0) 9 return vector...
分类:其他好文   时间:2015-07-01 17:23:19    阅读次数:135
bzoj2432
被虐的体无完肤,直接给题解地址吧:http://vfleaking.blog.163.com/blog/static/174807634201341721051604/ 1 const maxk=1000010; 2 type matrix=array[1..3,1..3] of int64; .....
分类:其他好文   时间:2015-06-30 16:16:08    阅读次数:125
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!