Blog Archive

Friday, January 27, 2017

谷歌CEO皮查伊:语音搜索是最自然的交互 我们优势明显 - 未名空间(mitbbs.com)

谷歌CEO皮查伊:语音搜索是最自然的交互 我们优势明显 - 未名空间(mitbbs.com):



编者按:在人工智能和网络搜索领域,谷歌一直有自己强大的优势,只要能将这两项技术相结合,搜索巨人在语音搜索领域必然也能有所作为。不过,如果谷歌不能将Assistant交到用户手中,它们在语音搜索领域的优势也就成了空中楼阁



在Alphabet第四季财报电话会议上,一位分析师就表达了类似的担忧,他想知道谷歌是如何为自家的语音搜索产品开拓市场的。Mitbbs.com


在财报会议上,加拿大皇家银行分析师马克·马汉尼表示,鉴于硬件不是谷歌的核心业务,如果它们未来对该业务丧失信心,语音搜索业务将面临巨大挑战。“与亚马逊Alexa和苹果Siri相比,谷歌的硬件产品销量都较为一般,它们的语音搜索怎么扩大占有率呢?”Mitbbs.com


谷歌CEO皮查伊回应称:“语音搜索行业的竞争才刚刚开始,谷歌肯定不会掉队。”Mitbbs.com


“谷歌看好语音搜索的未来,我认为这是最自然的用户交互方式。”皮查伊说道。Mitbbs.com


其实皮查伊已经为语音搜索定下了新战略,未来Assistant语音助手将从安卓手机平台扩展至智能家居、电视和汽车等产品。“我们想让用户意识到,谷歌语音搜索能随叫随到。”Mitbbs.com


皮查伊强调称,Google Home音箱上市首季销售非常强劲(并未公布销量数字)。此外,尽管谷歌在自然语言处理上走在业界前列,但要想为用户提供更棒的体验,它们还有许多工作要做。Mitbbs.com


J.P.摩根公司分析师道格拉斯·安慕斯则更关心谷歌如何将语音搜索变现。不过,财大气粗的谷歌并不着急,语音搜索是否能在短期内盈利不重要。Mitbbs.com


皮查伊称,语音搜索是谷歌搜索生态系统的一部分,只要语音搜索有足够用户,这一生态系统就会不断壮大。Mitbbs.com


“在思考关于语音搜索的问题时,我发现该领域的机遇远大于挑战。”皮查伊说道M


'via Blog this'

Sunday, January 22, 2017

Count Inversions in an array | Set 1 (Using Merge Sort) - GeeksforGeeks

Count Inversions in an array | Set 1 (Using Merge Sort) - GeeksforGeeks: "include "





#include <stdio.h>

#include <stdlib.h>

#include <iostream>

#include <fstream>

#include<vector>

#include<string>

using namespace std;

//#include<iostream>



unsigned int _mergeSort(int arr[], int tmp[], int beg, int end);

unsigned int merge(int arr[], int tmp[], int beg, int mid, int end);





unsigned int mergeSort(int arr[], int n){

    int *tmp= (int *) malloc (sizeof(int)*n);

    return _mergeSort(arr, tmp, 0,  n - 1);

}



unsigned int _mergeSort(int arr[], int tmp[], int beg, int end){

    int mid;

    unsigned int invCnt = 0;

//    if (end - beg  < 2) return 0;

    if(beg < end){

        mid = beg + (end - beg)/2;

        invCnt += _mergeSort(arr, tmp, beg,     mid);

        invCnt += _mergeSort(arr, tmp, mid + 1, end);

        invCnt += merge(arr,tmp,beg,mid + 1,end);

    }

    return invCnt;

}



unsigned int merge(int arr[], int tmp[], int beg, int mid, int end){

    unsigned int invCnt = 0;

    int i = beg;

    int j = mid;

    int k = beg;

    while(i <= mid-1 && j <= end){

        if( arr[i] < arr[j])

            tmp[k++] = arr[i++];

        else{

            tmp[k++] = arr[j++];

            invCnt += (mid-1) - i + 1;

        }

    }

   

    while(i <= mid-1)

        tmp[k++] = arr[i++];

    while(j <= end)

        tmp[k++] = arr[j++];

    for(int i = beg; i <= end; ++i)

        arr[i] = tmp[i];

    return invCnt;

}





int main() {

//code

int arr[]={2, 4, 1, 3, 5};

int n = sizeof(arr)/sizeof(arr[0]);

unsigned int cnt = mergeSort(arr,n);

printf(" Number of inversions are %d \n", cnt);

ifstream inputFile("IntegerArray.txt");

//ifstream inputFile("IntegerArray0.txt");

string line;

vector<int> ivec;

if(inputFile.is_open()){

while(getline(inputFile, line))

ivec.push_back(stoi(line));

           inputFile.close();

}



cout<<"number of item="<<ivec.size()<<endl;

int *p = new int[ivec.size()];

        //int p[100000];

        for(int i =0; i < ivec.size(); ++i)

p[i]=ivec[i];

        cnt = mergeSort(p, ivec.size());

printf(" 2: Number of inversions are %d \n", cnt);

unsigned int key=2407905288;

cout<<"cnt="<<cnt << " key shoud be : 2407905288 ="<< key <<endl;

        delete [] p;

return 0;

}



'via Blog this'

Count Inversions in an array | Set 1 (Using Merge Sort) - GeeksforGeeks

Count Inversions in an array | Set 1 (Using Merge Sort) - GeeksforGeeks: "printf(" Number of inversions are %d \n", getInvCount(arr, n));"



'via Blog this'

Algs4-1.4.18 Find local minimum in n x n matrix in O(n) time - vmxplus的博客 - 博客频道 - CSDN.NET

Algs4-1.4.18 Find local minimum in n x n matrix in O(n) time - vmxplus的博客 - 博客频道 - CSDN.NET: "Algs4-1.4.18 Find local minimum in n x n matrix in O(n) time"



Question:
You are given an n by n grid of distinct numbers. A number is a local minimum if it is smaller than all of its neighbors. (A neighbor of a number is one immediately above, below, to the left, or the right. Most numbers have four neighbors; numbers on the side have three; the four corners have two.) Use the divide-and-conquer algorithm design paradigm to compute a local minimum with only O(n) comparisons between pairs of numbers. (Note: since there are n2 numbers in the input, you cannot afford to look at all of them. Hint: Think about what types of recurrences would give you the desired upper bound.)

Soultion:
We can adapt Words Like Jared's answer, by looking at how it can Go wrong.
The idea in that answer -- which is a good one -- is to "roll downhill". This just means, if you are on an element, check if it is a local minimum. If so, you are done; otherwise, step to the smallest of its nearest neighbors. Eventually this must terminate because every step is to a smaller element, and that cannot go on forever in a finite array.
The problem with this approach is that the "rolling" can meander all over the place:
20 100 12  11 10 100  2
19 100 13 100  9 100  3
18 100 14 100  8 100  4
17  16 15 100  7   6  5
If you start at the upper left and "roll downhill", you will visit around half of the elements in the array. That is too many, so we have to constrain it a bit.
Start by examining the middle column and middle row. Find the smallest element among all of those and start there.
Roll one step "downhill" from there to enter one of the four quadrants. You will enter one of the quadrants, because the adjacent elements in the middle column and/or row are larger, so only one of the two adjacent quadrants could be "downhill".
Now consider what would happen if you "rolled downhill" from there. Obviously, you would eventually reach a local minimum. (We will not actually do this because it would take too long.) But, in the course of rolling around, you would never leave that quadrant... Because to do so, you would have to cross either the middle column or middle row, and none of those elements are smaller than where you started. Therefore that quadrant contains a local minimum somewhere.
Thus, in linear time, we have identified a quadrant that must contain a local minimum, and we have cut n in half. Now just recurse.
This algorithm takes time 2n + 2n/2 + 2n/4 + ..., which equals 4n, which is O(n) so we are done.
Interestingly, we did not use "rolling downhill" very much at all, except for the critical part: Proving that the algorithm works.
[Update]
As Incassator points out, this answer is not entirely correct, because after you "just recurse" you might roll out of the quadrant again...
The simplest fix is to find the smallest element among the middle row, middle column, and boundarybefore you "roll downhill".

Author:  Nemo
Supplement:
The accepted answer by Nemo is nice but not fully correct:
Thus, in linear time, we have identified a quadrant that must contain a local minimum, and we have cut n in half. Now just recurse.
I am referring to "just recurse" bit. The problem is we cannot do that directly because on next iteration we might find a local minimum which is not a local minimum for original grid (x below means some arbitrary large numbers):
 x  x 39  x  x 50  x  x  x  x  x
 x  x 38  x  x 49  x  x  x  x  x
37 36 33 34 35 48  x  x  x  x  x
 x  x 32  x  1 10  x  x  x  x  x
 x  x 31  x  x 47  x  x  x  x  x
46 45 30 44 43 60 51 52 53 54 55
 x  x  2  x  x 56  x  x  x  x  x
 x  x  x  x  x 57  x  x  x  x  x
 x  x  x  x  x 58  x  x  x  x  x
 x  x  x  x  x 59  x  x  x  x  x
At first iteration we find 10 to be a minimum of middle row and middle column. We go to the left (as 1 is less than 10). So our next iteration is on upper-left quadrant. But now minimum of middle row and column is going to be 31 (or 30 if quadrant's borders are considered to be part of it). You will then conclude that it is a local minimum. But it is not for the full grid.
We can rectify this unfortunate defect in variety of ways. I solved it like this:
At each iteration in addition to the grid itself we keep track of current minimum candidate (that is the 1 in the example above after first iteration; in the initial state we can say minimum candidate is plus infinity). We calculate minimum of middle row and column and compare it to minimum candidate. If the latter is smaller we recurse into the quadrant containing minimum candidate. Otherwise we forget previous candidate and only then check whether new middle row/column minimum is actually a local minimum. And if not then recurse as usual to whatever quadrant we slope down from it (and track new minimum candidate).
Alternatively, you can modify the procedure as described in this presumably MIT lecture: at each iteration instead of looking at middle row/column you can look at middle row/column and grid boundary. Then the algorithm once again is correct.
You choose which way you like.
Author: Incassator



Ref:  http://stackoverflow.com/questions/18525179/find-local-minimum-in-n-x-n-matrix-in-on-time

理财不理财,差距究竟有多大? - 未名空间(mitbbs.com)

理财不理财,差距究竟有多大? - 未名空间(mitbbs.com): "www.fengjr.u"



'via Blog this'

Thursday, January 19, 2017

Quick Sort

  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. void print(int *a, int n)
  5. {
  6. int i = 0;
  7. while(i < n){
  8. std::cout << a[i] << ",";
  9. i++;
  10. }
  11. std::cout << "\n";
  12. }
  13.  
  14. int partition(int *arr, const int left, const int right) {
  15. const int mid = left + (right - left) / 2;
  16. const int pivot = arr[mid];
  17. // move the mid point value to the front.
  18. std::swap(arr[mid],arr[left]);
  19. int i = left + 1;
  20. int j = right;
  21. while (i <= j) {
  22. while(i <= j && arr[i] <= pivot) {
  23. i++;
  24. }
  25.  
  26. while(i <= j && arr[j] > pivot) {
  27. j--;
  28. }
  29.  
  30. if (i < j) {
  31. std::swap(arr[i], arr[j]);
  32. }
  33. }
  34. std::swap(arr[i - 1],arr[left]);
  35. return i - 1;
  36. }
  37.  
  38. void quicksort(int *arr, const int left, const int right, const int sz){
  39.  
  40. if (left >= right) {
  41. return;
  42. }
  43.  
  44.  
  45. int part = partition(arr, left, right);
  46. std::cout << "QSC:" << left << "," << right << " part=" << part << "\n";
  47. print (arr, sz);
  48.  
  49. quicksort(arr, left, part - 1, sz);
  50. quicksort(arr, part + 1, right, sz);
  51. }
  52.  
  53. int main() {
  54. int arr[8] = {110, 5, 10,3 ,22, 100, 1, 23};
  55. int sz = sizeof(arr)/sizeof(arr[0]);
  56. print(arr, sz);
  57. quicksort(arr, 0, sz - 1, sz);
  58. print(arr, sz);
  59. return 0;
  60. }

Wednesday, January 18, 2017

What are the top 10 algorithms of the 20th century? - Quora

(1) What are the top 10 algorithms of the 20th century? - Quora:

  1. 1946: The Metropolis Algorithm for Monte Carlo. Through the use of random processes, this algorithm offers an efficient way to stumble toward answers to problems that are too complicated to solve exactly.
  2. 1947: Simplex Method for Linear Programming. An elegant solution to a common problem in planning and decision-making.
  3. 1950: Krylov Subspace Iteration Method. A technique for rapidly solving the linear equations that abound in scientific computation.
  4. 1951: The Decompositional Approach to Matrix Computations. A suite of techniques for numerical linear algebra.
  5. 1957: The Fortran Optimizing Compiler. Turns high-level code into efficient computer-readable code.
  6. 1959: QR Algorithm for Computing Eigenvalues. Another crucial matrix operation made swift and practical.
  7. 1962: Quicksort Algorithms for Sorting. For the efficient handling of large databases.
  8. 1965: Fast Fourier Transform. Perhaps the most ubiquitous algorithm in use today, it breaks down waveforms (like sound) into periodic components.
  9. 1977: Integer Relation Detection. A fast method for spotting simple equations satisfied by collections of seemingly unrelated numbers.
  10. 1987: Fast Multipole Method. A breakthrough in dealing with the complexity of n-body calculations, applied in problems ranging from celestial mechanics to protein folding.

Virgin Founder Reposts Fake Final Words of Steve Jobs | Digital Trends

Virgin Founder Reposts Fake Final Words of Steve Jobs | Digital Trends: "



http://www.digitaltrends.com/social-media/richard-fake-final-words-steve-jobs/



“I have come to the pinnacle of success in business.
In the eyes of others, my life has been the symbol of success.
However, apart from work, I have little joy. Finally, my wealth is simply a fact to which I am accustomed.
At this time, lying on the hospital bed and remembering all my life, I realize that all the accolades and riches of which I was once so proud, have become insignificant with my imminent death.
In the dark, when I look at green lights, of the equipment for artificial respiration and feel the buzz of their mechanical sounds, I can feel the breath of my approaching death looming over me.
Only now do I understand that once you accumulate enough money for the rest of your life, you have to pursue objectives that are not related to wealth.
It should be something more important:
For example, stories of love, art, dreams of my childhood.
No, stop pursuing wealth, it can only make a person into a twisted being, just like me.”

Read more: http://www.digitaltrends.com/social-media/richard-fake-final-words-steve-jobs/#ixzz4WA5Bc5ea
Follow us: @digitaltrends on Twitter | DigitalTrends on Facebook


'via Blog this'

How to install matlab on ubuntu

MATLAB - Community Help Wiki:



https://help.ubuntu.com/community/MATLAB



'via Blog this'

Sunday, January 15, 2017

How did Strassen come up with his famous Strassen algorithm for matrix multiplication? - ResearchGate

How did Strassen come up with his famous Strassen algorithm for matrix multiplication? - ResearchGate:



Q:

How did Strassen come up with his famous Strassen algorithm for matrix multiplication?

In Prof. Tim Roughgarden's course on the design and analysis of algorithms on Coursera, a question regarding how can we derive this formula is posed. It is clear how to prove it, however what thinking methodology can you follow to reason such non-trivial results?

How did Strassen come up with his famous Strassen algorithm for matrix multiplication? - ResearchGate. Available from: https://www.researchgate.net/post/How_did_Strassen_come_up_with_his_famous_Strassen_algorithm_for_matrix_multiplication [accessed Jan 15, 2017].





A:

The answer to the question is in the article of Robinson and Sara (SIAM News 38(9), 2005) suggested by Ke Zang. The idea can be seen as an extension of the Gauss complex multiplication algorithm to matrices. Gauss algorithm multiplies two complex numbers using 3 real multiplications instead of 4. Probably Strassen took the idea from there to arrange the elements of the matrices in order to eliminate one multiplication, as Gauss did for the elements of the two complex numbers.

How did Strassen come up with his famous Strassen algorithm for matrix multiplication? - ResearchGate. Available from: https://www.researchgate.net/post/How_did_Strassen_come_up_with_his_famous_Strassen_algorithm_for_matrix_multiplication [accessed Jan 15, 2017].

'via Blog this'

Saturday, January 14, 2017

Yu's Coding Garden : leetcode Questions: Number of Islands

Yu's Coding Garden : leetcode Questions: Number of Islands: "leetcode Questions: Number of Islands
Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
11110
11010
11000
00000
Answer: 1
Example 2:
11000
11000
00100
00011
Answer: 3

Analysis:

This is a typical recursive problem which can be solved by either Depth First Search(DFS) or Breath First Search (BFS).

Briefly speaking, DFS is to search every possible directions(solutions) whenever meet the new one, BFS is to search and store every possible directions(solutions) using a queue usually, then search from the head of the queue each time.

In this problem, possible directions are left, right, top, bottom, with constrains that the new location is '1' and has not been visited before. Therefore, we can define a bool matrix (of same size) to store the status of each element in the grid, set it to false when it is not available(been visited).

Details can be found in the code below, which is pretty straightforward."



'via Blog this'

Sunday, January 1, 2017

怎样在北美成为中医师,针灸师?

[来源]
http://bbs.wenxuecity.com/cytd/67735.html


NCCAOM常见问题问答



1.什么是NCCAOM ?



NCCAOM为“美国国家针灸与东方医学认证委员会”的英文缩写。



2.什么是NCCAOM考试?,通过NCCAOM考试能在全美行医么?



NCCAOM资格考试为“美国执业中医师资格考试”,通过该考试的人员即有资格申请获得美国执业中医师资格,可以合法行医。同时,加拿大等北美国家也接受NCCAOM资格考试认证,是当地行医的首要条件。



美国现存两类中医师资格考试:(1)NCCAOM考试:基本上全美认可。(2) CA考试:加州针灸局管理的考试,只能在加州使用。



NCCAOM证书是大多数州对针灸和中医学从业者要求的必备文件。美国的中医业雇主会要求受聘者提供该证书, NCCAOM证书也向您的病人表明您是符合行医标准的从业者。



3,美国中医师,针灸师,推拿师的收入怎样 ?



美国用针灸治疗一个病人的收费在各个地区有差异,一般一次治疗的收费是60-120 美元范围,美国中医师,针灸师的年收入一般在5-10万美金不等,部份有经验的中医,针灸师可以拿到10-20万美金的收入。



美国推拿按摩也是有地区差异,一般情况的价格是60-90美元/小时。





4. 我可以直接参加考试吗? NCCAOM 考试报名有哪些要求 ? 申请过程

是怎样的?



NCCAOM 要求您要达到报名要求并成功申请到考试资格之后才能报考。 NCCAOM 考试的类别分为针灸师,中医师,中药师,亚洲推拿师。 不同的类别对参加考试的资格要求是不一样的。在取得考试资格的途径方面有A:正规教育途径。 B:学徒途径。 C:正规教育+学徒途径。因为每个考生的情况不一样,有些途径的要求比较复杂,如果你想了解你适合哪种途径报名?请联系成都中医药大学培训中心邓老师或NCCAOM 专业会员--美国慧康医疗服务有限公司钟先生,微信naturalhealth999 QQ:875567200 



参加NCCAOM的申请过程如下:国外教育评估或是学徒资格评估---通过评估--报名NCCCAOM考试--收到准予考试确认函--自行安排考试(全年任何时间)---考试通过并收到NCCAOM寄发的资格证明。



5.NCCAOM考试内容?



NCCAOM考试内容根据申请者所报考类别有差别,目前NCCAOM管理四类证书:

1)美国针灸师证书(中医学基础、生物医学、针灸及腧穴定位及洁针考试);

2)美国中药师证书(中医学基础、生物医学、中药学);

3)美国中医学医师证书(中医学基础、生物医学、针灸及腧穴定位、中药学考试)。

4)亚洲推拿治疗师(内容包括生理解刨,中医理论,推拿技术等。因为报名要求只要求受过500小时的正规训练,所以考试难度也不大,具体请咨询成都中医药大学培训中心邓老师或NCCAOM 专业会员--美国慧康医疗服务有限公司钟先生,微信naturalhealth999 QQ:875567200 





6.我是在中国接受的中医药教育/训练,报考之前,我的学习文件需要得

到评估吗?



对于美国申请人来说,您可以在任何时候递交申请表。对于在美国境外学习的人来说,您需要在完成AACRAO或 WES外国教育评估之后申请,具体的材料要求和流程,请联系成都中医药大学培训中心邓老师或NCCAOM 专业会员--美国慧康医疗服务有限公司钟先生,微信naturalhealth999 QQ:875567200 

申请有效期是4年,所以最好是在学习将要结束或刚结束后就递交申请表。



7.考NCCAOM需要多长时间?



考执照是全年任何时候都可以考,如果考四门的话,您甚至可以安排在几天内考完,当然这是在充分复习好的情况下,如果没有复习好,每一门,您可以自行安排间隔时间.



8.通过考试之后获得美国中医师或针灸师执照需要多长时间?



通过NCCAOM或加州的独立考试后,申请执照各个州的情况不一样,时间也不同,基本上1至4个月不等。





9. NCCAOM考试可以用中文考吗?



NCCAOM考试可以用英文、中文或韩语考。但建议最好用英文参加考试,如果你是参加的中文考试,在申请执照时会被要求提供雅思或托福成绩。一些州则只承认用英文考试通过的NCCAOM证书。



10.NCCAOM考试可以国内考吗?



NCCAOM考试于2011年进入中国,中国考生可在中国大陆申请NCCAOM考试,参加考试并申请美国各州执照中医师资格。



成都中医药大学培训部和美康医疗咨询服务公司为考生提供考试申请,课程培训,证书申请。详情请联系成都中医药大学培训中心邓老师或NCCAOM 专业会员--美国慧康医疗服务有限公司钟先生,微信:naturalhealth999 QQ:875567200 

 



11. 我对成为北美的从业者很感兴趣, 该怎样开始这条路?



取得NCCAOM考试的证书,您就迈出了在美行医很重要的第一步,慧康公司在美国有超过10年的开办中医诊所的经验,可以为您提供珍贵的开业经验,为您在北美开办诊所,或是在北美找中医类的工作提供帮助。 详情请联系:

成都中医药大学培训中心邓老师或NCCAOM 专业会员--美国慧康医疗服务有限公司钟先生,微信:naturalhealth999 QQ:875567200 



12, 我想拿到美国的推拿按摩执照,怎样办理呢?



美国各州的要求略有区别。普遍接受的考试证书是NCBTMB(全国按摩考试) 和NCCAOM(亚州推拿治疗师考试),其中NCBTMB绝大部州都认可,NCCAOM有8个州认可。通过考试之后,可以凭通过证书和其它材料申请你想去工作州的执业执照。 



因为报名要求只要求受过500小时的正规训练,所以考试难度也不大,具体请咨询成都中医药大学培训中心邓老师或NCCAOM 专业会员--美国慧康医疗服务有限公司钟先生,微信naturalhealth999 QQ:875567200

其他参考:
http://weibo.com/p/2304189d84b26c0102wqgw?from=page_100606_profile&wvr=6&mod=wenzhangmod