- 博客(12)
- 资源 (1)
- 收藏
- 关注
原创 Erlang-蒙特卡洛方法求Pi
-module(exe5_2).-export([start/2]).%Points 是投掷点的个数 Cores是核数,为2的幂start(Points,Cores) ->spawn(fun()->parent_proces(Points,Cores) end), io:format("").parent_proces(Points,Cores) -> Poin
2015-04-20 15:02:46 783
原创 Erlang-多核并发时的树形通信
这段代码不是我写的,谢谢实验室的的师妹,接下来要把树形通信应用到求Pi上去。-module(my).-export([main/1,temp/2,integer_to_atom/1,judge/3,ceil/1]).main(CoreNum) -> SumDie=temp(CoreNum,1), Time=erlang:now(),
2015-04-18 20:38:23 946
原创 Erlang-并行梯度积分法
这个代码写了两天,从没思路到有思路,还好最终搞定了~不过这个进程数必须为2^n个。 先贴一个运行截图: -module(exe4).-export([start/5]).start(F,X1,X2,Num,Cores) ->spawn(fun()->parent_proces(F,X1,X2,Num,Cores) end), io:format("").parent_proce
2015-04-13 23:38:37 981
原创 word2vec中 distence.c 文件源码分析
#include <stdio.h>#include <string.h>#include <math.h>//#include <malloc.h>#include <stdlib.h>const long long max_size = 2000; // max length of stringsconst long long N = 5;
2015-04-09 20:01:27 1443
原创 Alias Sampling Algorithm With GSL C代码实现
最近读论文《Large-scale Information Network Embedding》 看到里面对超大数量的边进行采样时采用了Alias Sampling Algotithm,他的优点是可以O(1)的时间采样。下面涉及了gsl,安装方法很简单。 下面是gsl的资料: http://www.gnu.org/software/gsl/manual/html_node/#include <
2015-04-07 19:56:24 1159
原创 Erlang-实现进程环
M是消息传递数目,N进程数量,Msg是传递的消息-module(exe3_2).-export([start/3,stop/0]).start(M,N,Msg) ->register(ring,spawn(fun()->ring_service(M,N,Msg) end)).stop() -> ring!stop.ring_service(M,N,Msg) -> Ring=ring_nod
2015-04-07 09:26:11 632
转载 shell入门
http://www.cnblogs.com/suyang/archive/2008/05/18/1201990.html 从程序员的角度来看, Shell本身是一种用C语言编写的程序,从用户的角度来看,Shell是用户与Linux操作系统沟通的桥梁。用户既可以输入命令执行,又可以利用 Shell脚本编程,完成更加复杂的操作。在Linux GUI日益完善的今天,在系统管理等领域,Shell编程仍然
2015-04-05 00:07:40 421
原创 CodeForces-233B-Non-square Equation
Description Let’s consider equation:x2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an
2015-04-04 15:04:58 676
原创 CodeForce-245B-Internet Address
主要涉及字符串操作#include <iostream>#include <string>using namespace std;int main(){ freopen("input.txt","r",stdin); string str; string str2("ru"); while(cin>>str) { int len=str.si
2015-04-04 15:00:20 666
转载 more
more命令,功能类似 cat ,cat命令是整个文件的内容从上到下显示在屏幕上。 more会以一页一页的显示方便使用者逐页阅读,而最基本的指令就是按空白键(space)就往下一页显示,按 b 键就会往回(back)一页显示,而且还有搜寻字串的功能 。more命令从前向后读取文件,因此在启动时就加载整个文件。1.命令格式:more [-dlfpcsu ] [-num ] [+/ p
2015-04-02 22:37:46 429
转载 rcp
rcp代表“remote file copy”(远程文件拷贝)。该命令用于在计算机之间拷贝文件。rcp命令有两种格式。第一种格式用于文件到文件的拷贝;第二种格式用于把文件或目录拷贝到另一个目录中。 1.命令格式: rcp [参数] [源文件] [目标文件] 2.命令功能: rcp命令用在远端复制文件或目录,如同时指定两个以上的文件或目录,且最后的目的地是一个已经存在的目录,则它会把前面指定的
2015-04-01 00:59:21 836
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人