锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久久曰本AV免费免费,久久99精品久久久久久9蜜桃 ,久久久久亚洲Av无码专http://www.shnenglu.com/luyulaile/I canzh-cnThu, 08 May 2025 15:39:55 GMTThu, 08 May 2025 15:39:55 GMT60TSP Java 瀹炵幇http://www.shnenglu.com/luyulaile/archive/2013/03/31/198982.htmlluisluisSun, 31 Mar 2013 06:39:00 GMThttp://www.shnenglu.com/luyulaile/archive/2013/03/31/198982.htmlhttp://www.shnenglu.com/luyulaile/comments/198982.htmlhttp://www.shnenglu.com/luyulaile/archive/2013/03/31/198982.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/198982.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/198982.htmlpackage BotClean;

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution2 {

    static class Status{
        int id;//current city
        String action;
        int distance;
        Vector<Integer> unvisited;
        HashSet<Integer> visited;
        public Status(int id)
        {
            this.id=id;
        }
    }


    static class DirtyDot{
        int id;//current city
        int x;
        int y;
        
        public DirtyDot(int id, int x, int y)
        {
            this.id=id;
            this.x=x;
            this.y=y;
        }
    }
/* Head ends here */
    static void next_move(int x, int y, String[] board){
        TSP(board,x,y);
                               
    }

/* Tail starts here */
    public static void main(String[] args) {
        //TSP(null,0,0);
        
        Scanner in = new Scanner(System.in);
        int [] pos = new int[2];
        String board[] = new String[5];
        for(int i=0;i<2;i++) pos[i] = in.nextInt();
        for(int i=0;i<5;i++) board[i] = in.next();
        System.out.println("begin now!");
        next_move(pos[0], pos[1], board);
    }
    

    
    public static void TSP(String[] board, int x, int y) {
        
        String dirty="d";
        HashMap<Integer, DirtyDot> dirtyList=new HashMap<Integer,DirtyDot>();
        int id=1;
        DirtyDot tempDirtyDot2;
        DirtyDot tempDirtyDot=new DirtyDot(id-1,x,y);
        dirtyList.put(id,tempDirtyDot);
        
        for(int i=0;i<board.length;i++)
        {
            if(board[i].contains(dirty))
            {
                int position;
                position=board[i].indexOf(dirty, 0);
                while(position!=-1)
                {
                    tempDirtyDot=new DirtyDot(id,i,position);
                    dirtyList.put(id,tempDirtyDot);                   
                    id++;
                    position=board[i].indexOf(dirty,position+1);
                    System.out.println("position"+position);
                }
            }
        }
        
//        int MAX=id;
//        int dist[][]=new int[MAX][MAX];
//        
//        for(int i=0;i<MAX;i++)
//            for(int j=0;j<MAX;j++)
//               {
//                tempDirtyDot=dirtyList.get(i);
//                tempDirtyDot2=dirtyList.get(j);
//                 dist[i][j]=Math.abs(tempDirtyDot.x-tempDirtyDot2.x)+Math.abs(tempDirtyDot.y-tempDirtyDot2.y);
//               }
        
          int MAX=4;
        
          int dist[][]={{-1,3,6,7},{2,-1,8,6},{7,3,-1,5,},{7,3,7,-1}}; 
        
        Vector<Status> currentStatus=new Vector<Status>();
        Vector<Status> previousStatus;
        /*Initialize current Status Vector*/
        for(int i=1;i<MAX;i++)
        {
            Status status=new Status(i);
            status.distance=dist[i][0];
            status.unvisited=new Vector<Integer>();
            status.visited=new HashSet<Integer>();
            currentStatus.add(status);
        }
        System.out.println("Initialized current Status Vector");
        //System.out.println(currentStatus.size());
        
        for(int j=0;j<MAX-2;j++)
        {
            previousStatus=currentStatus;
            currentStatus=new  Vector<Status>();
            //System.out.println(previousStatus.size());
            for(int i=1;i<MAX;i++)// enumerate each node
            {
                for(int k=0;k<previousStatus.size();k++)
                {
                    Status tempStatus=previousStatus.elementAt(k);
                    if(isContain(tempStatus,i)==false)//gurantee node i is not in tempStatus
                    {
                        Status newStatus=new Status(i);
                        newStatus.distance=tempStatus.distance+dist[i][tempStatus.id];
                        System.out.println("id"+tempStatus.id);
                        newStatus.visited=new HashSet<Integer>(tempStatus.visited);
                        newStatus.unvisited=new Vector<Integer>(tempStatus.unvisited);
                        newStatus.unvisited.add(0,(Integer)(tempStatus.id));
                        newStatus.visited.add(tempStatus.id);
                        currentStatus.add(newStatus);
                        System.out.println(newStatus.unvisited.size());
                        System.out.println(newStatus.distance);
                        
                    }
                }
            }
            //System.out.println(currentStatus.size());
            currentStatus=optimize(currentStatus);//dp process  
            
//System.out.println(currentStatus.size());
        }//end for
        
        Iterator<Status> iterator = currentStatus.iterator();  
   
        Status tempStatus=iterator.next();
        Status shortest=tempStatus;
        int minDistance=dist[0][tempStatus.id]+tempStatus.distance;
        System.out.println("1:"+tempStatus.distance);
        System.out.println("2:"+dist[0][tempStatus.id]);
        
        while (iterator.hasNext()) {  
             tempStatus=iterator.next();  
             int tempDistant=dist[0][tempStatus.id]+tempStatus.distance;
             System.out.println("11:"+tempStatus.distance);
             System.out.println("22:"+dist[0][tempStatus.id]);
             System.out.println("33:"+tempStatus.id);
             
             if(tempDistant<minDistance)
             {
                 minDistance=tempDistant;
                 System.out.println("in loop"+minDistance);
                 //System.out.println(tempStatus.distance);
                 shortest=tempStatus;
             }
          }
        
        System.out.println("distance: "+minDistance);
        System.out.println("size:"+shortest.unvisited.size());
        System.out.print(" 1");
        System.out.print(" "+shortest.id);
        for(int i=0;i<shortest.unvisited.size();i++)
            {
                 int tmp=shortest.unvisited.get(i)+1;
               System.out.print(" "+tmp);
            }
        System.out.println(" 1");
    }
    
    private static Vector<Status> optimize(Vector<Status> cs) {
        Status tempStatus,anotherStatus;
        int j;

        Iterator<Status> iterator = cs.iterator();    
         while (iterator.hasNext()) {  
             tempStatus=iterator.next();  
              for(j=0;j<cs.size();j++)
                {
                      anotherStatus=cs.get(j);
                      if(tempStatus.id==anotherStatus.id&&tempStatus.visited.equals(anotherStatus.visited))
                      {
                          if(tempStatus.distance>anotherStatus.distance)
                          {
                              iterator.remove();
                             break;
                          }
                      }
                }
             
         }    
          return cs;
    
    }

    static boolean isContain(Status sta, int i)
    {
        if(i==sta.id)
            return true;
        else
          return sta.unvisited.contains(i);
     }
    

}



luis 2013-03-31 14:39 鍙戣〃璇勮
]]>
鍔ㄦ佽鍒?瑙SP 鏃呰鍟嗛棶棰?緇忓吀瀹炵幇 http://www.shnenglu.com/luyulaile/archive/2013/03/31/198974.htmlluisluisSat, 30 Mar 2013 21:26:00 GMThttp://www.shnenglu.com/luyulaile/archive/2013/03/31/198974.htmlhttp://www.shnenglu.com/luyulaile/comments/198974.htmlhttp://www.shnenglu.com/luyulaile/archive/2013/03/31/198974.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/198974.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/198974.html鍘熸枃鍦板潃: http://blog.csdn.net/gfaiswl/article/details/4749713

1.闂瀹氫箟

      TSP闂錛堟梾琛屽晢闂錛夋槸鎸囨梾琛屽瑕佹梾琛宯涓煄甯傦紝瑕佹眰鍚勪釜鍩庡競緇忓巻涓斾粎緇忓巻涓嬈$劧鍚庡洖鍒板嚭鍙戝煄甯傦紝騫惰姹傛墍璧扮殑璺▼鏈鐭?/p>

      鍋囪鐜板湪鏈夊洓涓煄甯傦紝0,1,2,3錛屼粬浠箣闂寸殑浠d環濡傚浘涓錛屽彲浠ュ瓨鎴愪簩緇磋〃鐨勫艦寮?br />

              image        image

                      鍥句竴                                                                                               

        鐜板湪瑕佷粠鍩庡競0鍑哄彂錛屾渶鍚庡張鍥炲埌0錛屾湡闂?錛?錛?閮藉繀欏誨茍涓斿彧鑳界粡榪囦竴嬈★紝浣夸唬浠鋒渶灝忋?/p>

2.鍔ㄦ佽鍒掑彲琛屾?/h1>

        璁緎, s1, s2, …, sp, s鏄粠s鍑哄彂鐨勪竴鏉¤礬寰勯暱搴︽渶鐭殑綆鍗曞洖璺紝鍋囪浠巗鍒頒笅涓涓煄甯俿1宸茬粡姹傚嚭錛屽垯闂杞寲涓烘眰浠巗1鍒皊鐨勬渶鐭礬寰勶紝鏄劇劧s1, s2, …, sp, s涓瀹氭瀯鎴愪竴鏉′粠s1鍒皊鐨勬渶鐭礬寰勶紝鎵浠SP闂鏄瀯鎴愭渶浼樺瓙緇撴瀯鎬ц川鐨勶紝鐢ㄥ姩鎬佽鍒掓潵姹傝В涔熸槸鍚堢悊鐨勩?/p>

3.鎺ㄥ鍔ㄦ佽鍒掓柟紼?/h1>

        鍋囪浠庨《鐐箂鍑哄彂錛屼護d(i, V’)琛ㄧず浠庨《鐐筰鍑哄彂緇忚繃V’(鏄竴涓偣鐨勯泦鍚?涓悇涓《鐐逛竴嬈′笖浠呬竴嬈★紝鏈鍚庡洖鍒板嚭鍙戠偣s鐨勬渶鐭礬寰勯暱搴︺?/p>

        鎺ㄥ錛?鍒嗘儏鍐墊潵璁ㄨ)

        ①褰揤’涓虹┖闆嗭紝閭d箞d(i, V’)錛岃〃紺轟粠i涓嶇粡榪囦換浣曠偣灝卞洖鍒皊浜嗭紝濡備笂鍥劇殑 鍩庡競3->鍩庡競0(0涓鴻搗鐐瑰煄甯?銆傛鏃禿(i, V’)=Cis(灝辨槸 鍩庡競i 鍒?鍩庡競s 鐨勮窛紱?銆?/p>

        ②濡傛灉V’涓嶄負絀猴紝閭d箞灝辨槸瀵瑰瓙闂鐨勬渶浼樻眰瑙c備綘蹇呴』鍦╒’榪欎釜鍩庡競闆嗗悎涓紝灝濊瘯姣忎竴涓紝騫舵眰鍑烘渶浼樿В銆?/p>

           d(i, V’)=min{Cik +  d(k, V’-{k})}

           娉細Cik琛ㄧず浣犻夋嫨鐨勫煄甯傚拰鍩庡競i鐨勮窛紱伙紝d(k, V’-{k})鏄竴涓瓙闂銆?/p>

        緇間笂鎵榪幫紝TSP闂鐨勫姩鎬佽鍒掓柟紼嬪氨鍑烘潵浜嗭細

         image

4.瀹炰緥鍒嗘瀽

     鐜板湪瀵歸棶棰樺畾涔変腑鐨勪緥瀛愭潵璇存槑TSP鐨勬眰瑙h繃紼嬨?鍋囪鍑哄彂鍩庡競鏄?0鍩庡競)

     image

    ①鎴戜滑瑕佹眰鐨勬渶緇堢粨鏋滄槸d(0,{1,2,3}),瀹冭〃紺猴紝浠庡煄甯?寮濮嬶紝緇忚繃{1,2,3}涔嬩腑鐨勫煄甯傚茍涓斿彧鏈変竴嬈★紝姹傚嚭鏈鐭礬寰?

    ②d(0,{1,2,3})鏄笉鑳戒竴涓嬪瓙姹傚嚭鏉ョ殑錛岄偅涔堜粬鐨勫兼槸鎬庝箞寰楀嚭鐨勫憿錛熺湅涓婂浘鐨勭浜屽眰錛岀浜屽眰琛ㄦ槑浜哾(0,{1,2,3})鎵闇渚濊禆鐨勫箋傞偅涔堝緱鍑猴細

       d(0,{1,2,3})=min  {

                                    C01+d(1,{2,3})

                                    C02+d{2,{1,3}}

                                    C03+d{3,{1,2}}

                                  }

     ③d(1,{2,3})錛宒(2,{1,3})錛宒(3,{1,2})鍚屾牱涔熶笉鏄竴姝ュ氨鑳芥眰鍑烘潵鐨勶紝瀹冧滑鐨勮В涓鏍烽渶瑕佹湁渚濊禆錛屽氨姣斿璇磀(1,{2,3})

       d(1,{2,3})=min{

                              C12+d(2,{3})                             

                              C13+d(3,{2})

                              }

       d(2,{1,3})錛宒(3,{1,2})鍚屾牱闇瑕佽繖涔堟眰銆?/p>

    ④鎸夌収涓婇潰鐨勬濊礬錛屽彧鏈夋渶鍚庝竴灞傜殑錛屽綋褰揤’涓虹┖闆嗘椂錛孋is鐨勫兼墠鍙互姹傦紝瀹冪殑鍊兼槸鐩存帴浠?/p>

image

榪欏紶琛ㄩ噷姹傚緱鐨勩?/p>

     5.緙栫▼鎬濊礬

        灝哾(i, V’)杞崲鎴愪簩緇磋〃錛宒[i][j]

image

        鍦ㄧ▼搴忎腑妯℃嫙濉〃鐨勮繃紼嬶紝涓昏瑕佽冭檻鍒癹榪欎釜鍙傛暟鐨勮〃紺猴紝瀹冭浠h〃涓涓泦鍚堬紝鍙互鐢ㄤ簩緇存暟緇勬潵琛ㄧず銆?/p>

   6.婧愪唬鐮?/h1>

娉細鐢變簬鏈漢姘村鉤鏈夐檺錛屽茍涓斾富瑕佸湪榪欓噷鏄綋鐜版濊礬錛屾墍浠ョ▼搴忓茍涓嶆槸寰堝畬鍠勶紝浠g爜璐ㄩ噺涔熶笉楂橈紝寰堝湴鏂瑰彲浠ュ啓寰楅氱敤涓浜涳紝鎵浠ヨ繖閲屽彧鏄彁渚涗竴涓弬鑰冿紝紼嬪簭鐨勮繘涓姝ュ畬鍠勶紝鐢辮鑰呰嚜鐢卞彂鎸ャ?/p>

#include 
#include

int IsIncluded(int x,int array[3])//x鏄惁鍖呭惈鍦ㄦ暟緇勪腑 

    if((array[0] != x) && (array[1] != x) && (array[2] != x)) 
        return 0; 
    return 1; 

int Left(int k,int array[3],int V[8][3])//瀹炵幇V'-{k} 鐨勪笅鏍囨绱?nbsp;

    int i = 0,index = 0,array_0_count = 0,array_1_count = 0,array_2_count = 0,array_3_count = 0; 
    int V_0_count = 0,V_1_count = 0,V_2_count = 0,V_3_count = 0; 
    int temp[3]; 
    for(i = 0; i < 3; i++) 
        temp[i] = array[i]; 
    for(i = 0; i < 3; i++) 
        if(temp[i] == k) 
            temp[i] = 0;  //鐩稿綋浜庡幓鎺塳榪欎釜鍩庡競 
    for(i = 0; i < 3; i++) 
    { 
        if(temp[i] == 0) 
            array_0_count++; 
        else if(temp[i] == 1) 
            array_1_count++; 
        else if(temp[i] == 2) 
            array_2_count++; 
        else 
            array_3_count++; 
    } 
    for(index = 0; index < 8; index++) 
    { 
        for(i=0; i < 3; i++) 
        { 
            if(V[index][i] == 0) 
                V_0_count++; 
            else if(V[index][i] == 1) 
                V_1_count++; 
            else if(V[index][i] == 2) 
                V_2_count++; 
            else 
                V_3_count++; 
        } 
        if((array_0_count == V_0_count) && (array_1_count == V_1_count) 
            && (array_2_count == V_2_count) && (array_3_count == V_3_count)) 
            return index; 
        V_0_count = 0; 
        V_1_count = 0; 
        V_2_count = 0; 
        V_3_count = 0; 
    } 
    return 0; 
}

void TSP(int d[4][8],int c[4][4],int V[8][3],int n) 

    int i = 0,j = 0,k = 0;

    for(i = 1; i < n; i++)//V'涓虹┖鏃訛紝緇欒祴鍊鹼紝 
        d[i][0] = c[i][0];

    for(j = 1; j < 7; j++)//鎸夊垪閬嶅巻涓嶅悓闆嗗悎錛寋1},{2},{3},{1,2},{1,3}..... 
    { 
        for(i = 1; i < n; i++)//閬嶅巻鍩庡競1錛?錛? 
        { 
            if( !IsIncluded(i,V[j]) )//i蹇呴』涓嶅湪闆嗗悎涓紝鍚﹀垯灝卞睘浜庣粡榪囦袱嬈★紝涓嶇鍚堥鎰?nbsp;
            { 
                for(k = 0; k < 3; k++)//鍒嗗埆璇曟帰闆嗗悎涓殑姣忎竴鐐癸紝鍙栨渶灝忓?nbsp;
                { 
                    if((V[j][k] != 0) && ((c[i][V[j][k]] + d[V[j][k]][Left(V[j][k],V[j],V)]) < d[i][j])) 
                        d[i][j] = c[i][V[j][k]] + d[V[j][k]][Left(V[j][k],V[j],V)]; 
                } 
            } 
        }//end of     for(i = 1; i < n; i++)//閬嶅巻鍩庡競1錛?錛? 
    }//end of for(j = 1; j < ((int)pow(2,n)-1); j++) 
    for(k = 0; k < 3; k++)//鍒嗗埆璇曟帰涓嬩竴姝ヤ負闆嗗悎涓殑浠諱綍涓鐐癸紝鍙栨渶灝忓?nbsp;
    { 
        if((V[7][k] != 0) && (c[0][V[7][k]] + d[V[7][k]][Left(V[7][k],V[7],V)]) < d[0][7]) 
            d[0][7] = c[0][V[7][k]] + d[V[7][k]][Left(V[7][k],V[7],V)]; 
    } 

void main() 

    int V[8][3]= 
    { 
        0,0,0, 
        0,0,1, 
        0,0,2, 
        0,0,3, 
        0,1,2, 
        0,1,3, 
        0,2,3, 
        1,2,3 
    }; 
    int c[4][4]= 
    { 
        0,3,6,7, 
        5,0,2,3, 
        6,4,0,2, 
        3,7,5,0 
    }; 
    int d[4][8]={0},i=0,j=0;

    for(i=0; i<4; i++) 
        for(j=0; j<8; j++) 
            d[i][j]=1000;   //鍋囪1000涓烘棤絀峰ぇ 
    TSP(d,c,V,4); 
    printf("The least road is:%d/n",d[0][7]); 
}



luis 2013-03-31 05:26 鍙戣〃璇勮
]]>鐭╅樀涔樻硶鐨勬剰涔?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/12/05/196013.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Wed, 05 Dec 2012 10:44:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/12/05/196013.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/196013.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/12/05/196013.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/196013.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/196013.html</trackback:ping><description><![CDATA[<div> <img src="file:///C:\users\yilu\AppData\Tencent\Users\349826924\QQ\WinTemp\RichOle\{NB9CE}[L5OABB`L$N7RJK3.jpg" alt="" /><img src="file:///C:\users\yilu\AppData\Tencent\Users\349826924\QQ\WinTemp\RichOle\{NB9CE}[L5OABB`L$N7RJK3.jpg" alt="" /><img src="http://www.shnenglu.com/images/cppblog_com/luyulaile/鏈懡鍚?2.5.jpg" border="0" alt="" width="893" height="563" /><br />鐩稿綋浜嶢(B <strong>x</strong>) <br /></div><img src ="http://www.shnenglu.com/luyulaile/aggbug/196013.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-12-05 18:44 <a href="http://www.shnenglu.com/luyulaile/archive/2012/12/05/196013.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Python extract all comments:鎻愬彇鎵鏈塩omments,鎻愬彇c/c++涓敞閲奝ython鑴氭湰http://www.shnenglu.com/luyulaile/archive/2012/12/03/195907.htmlluisluisMon, 03 Dec 2012 00:35:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/12/03/195907.htmlhttp://www.shnenglu.com/luyulaile/comments/195907.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/12/03/195907.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/195907.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/195907.html濡傛灉 紼嬪簭涓嚭鐜頒簡“/*”,浼氭湁bug

#!/usr/bin/env python

import sys
import re

def comment_finder(text):
    pattern = re.compile( r'//.*?$|/\*.*?\*/', re.DOTALL | re.MULTILINE)
    result = pattern.findall(text)
    return result

def print_command(filename):

    codefile = open(filename,'r')
    commentfile = open(filename+".txt",'w')
    lines=codefile.read()
    codefile.close()
    #the list of comments
    list_of_comments = comment_finder(lines)
    for comment in list_of_comments:
        #print comment[0:2]
        if comment[0:2] == "//":
                comment_to_write = comment[2:]
        else:
            comment_to_write = comment[2:-2]
        if len(comment_to_write)!=0:
            commentfile.write(comment_to_write)
        commentfile.write('\n')
    commentfile.close()

if __name__ == "__main__":
    for filename in sys.argv[1:]:
        print_command(filename)
浣跨敤錛?br />
鍦╨inux涓嬮潰 杞埌褰撳墠鐩綍 ./get_comment.py *
鎴栬?鎸囧畾鏂囦歡綾誨瀷
./get_comment.py *.c


luis 2012-12-03 08:35 鍙戣〃璇勮
]]>
Latex 琛ㄦ牸http://www.shnenglu.com/luyulaile/archive/2012/11/22/195518.htmlluisluisWed, 21 Nov 2012 17:07:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/11/22/195518.htmlhttp://www.shnenglu.com/luyulaile/comments/195518.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/11/22/195518.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/195518.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/195518.html\begin{tabular}{|c|c|c|c|c|c|}
\hline 
Accuracy & General & test 1 & test 2 & test 3 & test 4\tabularnewline
\hline 

Linear  & 0.8950695  & 0.8817864 & 0.8884132  & 0.8884036  & 0.9217801
\tabularnewline
\hline 

Polynomial Degree=2 & 0.927821  & 0.9118337 & 0.934325 & 0.913003 &
0.9335226\tabularnewline
\hline 
Polynomial Degree=2 & 0.8350725  & 0.8317865 & 0.8285052  & 0.8278306  &
0.852091
\tabularnewline
\hline 
Polynomial Degree=3 & 0.770894 & 0.7539803  & 0.7510282 &  0.7762011 &
0.7821553\tabularnewline
\hline 
Polynomial Degree=4 & 0.7172013 & 0.685079 & 0.6988003 & 0.7329987 &
0.7520278\tabularnewline

\hline 
\end{tabular}


=========================


  • Type one:

%%%%%%%%%%綆鍗曡〃鏍?%%%%%%%%%

\begin{tabular}{|c|c|}

\hline

a & b \\\hline

c & d\\

\hline

\end{tabular}

 

  • Type two:

%%%%%%%%%%綆鍗曡〃鏍?灞呬腑(涓)%%%%%%%%%%

\begin{center}

\begin{tabular}{|c|c|}

\hline

a & b \\\hline

c & d\\

\hline

\end{tabular}

\end{center}

 

  • Type three:

%%%%%%%%%%綆鍗曡〃鏍?灞呬腑錛堜簩錛?%%%%%%%%%

\centering

\begin{tabular}{|c|c|}

\hline

a & b \\\hline

c & d\\

\hline

\end{tabular}

This a Table~??

 

  • Type four:

%%%%%%%%%%綆鍗曡〃鏍?灞呬腑,鏍囬錛岀紪鍙?鍥哄畾浣嶇疆%%%%%%%%%%

\begin{table}[h]

\centering

\caption{table}\label{tab:table}

\begin{tabular}{|c|c|}

\hline

a & b \\\hline

c & d\\

\hline

\end{tabular}

\end{table}

  • Type five:

%%%%%%%%%%涓涓畬鏁寸殑渚嬪瓙%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%Beginning of Table example%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{table}[ht]

\caption{Review paper} % title of Table

\centering % used for centering table

\begin{tabular}{|c|c|} % centered columns (2 columns)

\hline\hline %inserts double horizontal lines

Item 1 & Item 2 \\ [0.5ex] % inserts table heading

\hline % inserts single horizontal line

a & b \\ % inserting body of the table

c & d \\

e & f \\[1.5ex] % [1.5ex] adds vertical space

\hline %inserts single line

\end{tabular}

\label{table:nonlin} % is used to refer this table in the text

\end{table}

%%%%%%%%%%%%%%%%%% end of the example%%%%%%%%%%%%%%%%%%%%%%%%%



luis 2012-11-22 01:07 鍙戣〃璇勮
]]>
Java 瀛楃涓叉瘮杈?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/11/22/195517.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Wed, 21 Nov 2012 16:44:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/11/22/195517.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/195517.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/11/22/195517.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/195517.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/195517.html</trackback:ping><description><![CDATA[鍘熸枃錛?a >http://www.cnblogs.com/tonyqus/archive/2004/12/07/73710.html</a> <span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; "></span><br /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; "><br /><br />鐔熸倝C++鐨勪漢瀵逛簬涓や釜瀛楃涓叉瘮杈冪殑浠g爜涓瀹氬緢浜嗚В錛?nbsp;</span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">(string1==string2) </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">浣嗗湪java涓紝榪欎釜浠g爜鍗充嬌鍦ㄤ袱涓瓧絎︿覆瀹屽叏鐩稿悓鐨勬儏鍐典笅涔熶細榪斿洖false </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">Java涓繀欏諱嬌鐢╯tring1.equals(string2)鏉ヨ繘琛屽垽鏂?nbsp;</span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><strong style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">琛ュ厖</strong> <br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">濡傛灉錛?nbsp;</span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">string s1=new String("Hello"); </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">string s2=new String("Hello"); </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">鍒?s1==s2)=false </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">濡傛灉錛?nbsp;</span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">string s1="Hello"; </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">string s2="Hello"; </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">鍒?s1==s2)=true; </span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">鍥犱負浠栦滑鎸囧悜鐨勫悓涓涓璞°?nbsp;</span><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><br style="margin: 0px; padding: 0px; color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; " /><span style="color: #393939; font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; background-color: #faf7ef; ">濡傛灉鎶婂叾浠栧彉閲忕殑鍊艱祴緇檚1鍜宻2錛屽嵆浣垮唴瀹圭浉鍚岋紝鐢變簬涓嶆槸鎸囧悜鍚屼竴涓璞★紝涔熶細榪斿洖false銆傛墍浠ュ緩璁嬌鐢╡quals()錛屽洜涓篹quals姣旇緝鐨勬墠鏄湡姝g殑鍐呭 </span><img src ="http://www.shnenglu.com/luyulaile/aggbug/195517.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-11-22 00:44 <a href="http://www.shnenglu.com/luyulaile/archive/2012/11/22/195517.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Latex 澶氫釜鍥劇墖http://www.shnenglu.com/luyulaile/archive/2012/11/16/195250.htmlluisluisThu, 15 Nov 2012 19:43:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/11/16/195250.htmlhttp://www.shnenglu.com/luyulaile/comments/195250.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/11/16/195250.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/195250.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/195250.html
\usepackage{subfigure}
娉ㄦ剰涓嶇敤鐢?{subfig}
\begin{figure}[ht]
\centering
\subfigure[$\alpha$=0.5,$\gamma$=0.9,$\epsilon$=0.01]{
   \includegraphics[width=4.4in] {2.png}
 }
 \subfigure[$\alpha$=0.7,$\gamma$=0.9,$\epsilon$=0.01]{
   \includegraphics[width=4.4in] {3.png}
 }
 \subfigure[$\alpha$=0.9,$\gamma$=0.9,$\epsilon$=0.01]{
   \includegraphics[width=4.4in] {4.png}
 }
 \subfigure[$\alpha$=0.7,$\gamma$=0.9,$\epsilon$=0.1]{
   \includegraphics[width=4.4in] {5.png}
 }
 \subfigure[$\alpha$=0.7,$\gamma$=0.9,$\epsilon$=0.2]{
   \includegraphics[width=4.4in] {6.png}
 }
 \subfigure[$\alpha$=0.7,$\gamma$=0.6,$\epsilon$=0.01]{
   \includegraphics[width=4.4in] {1.png}
 }
\end{figure}


luis 2012-11-16 03:43 鍙戣〃璇勮
]]>
Python 絎旇 pi tan 絳夊叕寮?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/11/08/194861.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Thu, 08 Nov 2012 00:21:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/11/08/194861.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/194861.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/11/08/194861.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/194861.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/194861.html</trackback:ping><description><![CDATA[<div style="text-align: justify;"><div>import math<br />def mianji(n,s):</div><div>    temp=1/4*n*(s**2)/math.tan(math.pi/n)</div><div>    return temp</div><div>print mianji(5,7)<br />============<br />浣跨敤鏃秏ath.pi math.tan</div></div><img src ="http://www.shnenglu.com/luyulaile/aggbug/194861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-11-08 08:21 <a href="http://www.shnenglu.com/luyulaile/archive/2012/11/08/194861.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Python 鐢熸垚闅忔満鏁?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/11/08/194859.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Wed, 07 Nov 2012 22:56:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/11/08/194859.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/194859.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/11/08/194859.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/194859.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/194859.html</trackback:ping><description><![CDATA[<blockquote style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 10px; padding-bottom: 1px; border: 0px; vertical-align: baseline; background-color: #eeeeee; quotes: none; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; "><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; clear: both; word-wrap: break-word; "><code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; "><table cellspacing="0" cellpadding="0" style="word-wrap: break-word; empty-cells: show; border-collapse: collapse; table-layout: fixed; width: 1119px; color: #000000; font-family: song, Verdana; font-size: 12px; text-align: start; background-color: #ffffff; "><tbody style="word-wrap: break-word; "><tr style="word-wrap: break-word; "><td id="postmessage_8263409" style="word-wrap: break-word; font-size: 14px; line-height: 1.6em; ">import random<br style="word-wrap: break-word; " /><br style="word-wrap: break-word; " />a=random.randint(0,1001)#榪欎釜鐢熸垚鐨勫尯闂存槸 [0,1001]<br />a=random.randrange(0,10001)#鐢熸垚鐨勬槸鍖洪棿鏄痆0,1001)<br style="word-wrap: break-word; " /><br style="word-wrap: break-word; " />print a</td></tr></tbody></table><br /><br /><br />random.randrange([start], stop[, step])</code></p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; clear: both; word-wrap: break-word; ">Return a randomly selected element from <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">range(start, stop, step)</code>. <strong style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; ">This is equivalent to<code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">choice(range(start, stop, step))</code></strong>, but doesn’t actually build a range object.</p></blockquote><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; ">And range(start, stop) returns <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">[start, start+step, ..., stop-1]</code>, not <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">[start, start+step, ..., stop]</code>. As for why... zero-based counting rules and <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">range(n)</code> should return n elements, I suppose. Most useful for getting a random index, I suppose.</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; ">While randint is documented as:</p><blockquote style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 10px; padding-bottom: 1px; border: 0px; vertical-align: baseline; background-color: #eeeeee; quotes: none; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; "><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; clear: both; word-wrap: break-word; "><code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">random.randint(a, b)</code></p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; clear: both; word-wrap: break-word; ">Return a random integer N such that <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">a <= N <= b</code>. <strong style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; ">Alias for <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">randrange(a, b+1)</code></strong></p></blockquote><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; ">So randint is for when you have the maximum and minimum value for the random number you want.</p><img src ="http://www.shnenglu.com/luyulaile/aggbug/194859.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-11-08 06:56 <a href="http://www.shnenglu.com/luyulaile/archive/2012/11/08/194859.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Python 絎旇2 //http://www.shnenglu.com/luyulaile/archive/2012/11/08/194858.htmlluisluisWed, 07 Nov 2012 22:43:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/11/08/194858.htmlhttp://www.shnenglu.com/luyulaile/comments/194858.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/11/08/194858.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/194858.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/194858.html
s1 = "hello,world" 
濡傛灉瑕佸啓鎴愬琛岋紝閭d箞灝辮浣跨敤/ (“榪炶絎?#8221;)鍚э紝濡?nbsp;
s2 = "hello,/ 
world" 
s2涓巗1鏄竴鏍風殑銆傚鏋滀綘鐢?涓弻寮曞彿鐨勮瘽錛屽氨鍙互鐩存帴鍐欎簡錛屽涓嬶細 
s3 = """hello, 
world, 
hahaha."""錛岄偅涔坰3瀹為檯涓婂氨鏄?hello,/nworld,/nhahaha.", 娉ㄦ剰“/n”

s5 = "Let's go"  
s4 = 'Let/'s go' 

鎴戜滑涔熷彲浠ユ妸'''  ''' 浣滀負澶氳娉ㄩ噴

str(object) 鍙互灝嗘墍鏈夎漿鍖栦負瀛楃涓層?br />

pythonjava鎻忚堪
or||閫昏緫鎴?/td>
and&&閫昏緫涓?/td>
not錛?/td>閫昏緫闈?/td>
<錛?gt;錛?lt;=錛?gt;=錛?=錛?=鎴?lt;><錛?gt;錛?lt;=錛?gt;=錛?=錛?=姣旇緝鎿嶄綔
is錛宨s notinstanceof韜喚璁よ瘉
||浣嶆垨
&&浣嶄笌
^^浣嶅紓鎴?/td>
<<錛?gt;><<錛?gt;>縐諱綅
+錛?錛?錛?+錛?錛?錛?鍔犲噺涔橀櫎
%%浣欐暟
~~浣嶅彇琛?/td>


//榪愮畻絎? 
10/3==3
120//10==12
121//10==12
122//10==12
130//10==13
10//3.0==3.0

A new operator, //, is the floor division operator. (Yes, we know it 
looks like C++'s comment symbol.) // always performs floor division no 
matter what the types of its operands are, so 1 // 2 is 0 and 1.0 // 
2.0 is also 0.0. 

not ()


luis 2012-11-08 06:43 鍙戣〃璇勮
]]>
Latex 澶氳鍏紡http://www.shnenglu.com/luyulaile/archive/2012/11/06/194700.htmlluisluisMon, 05 Nov 2012 22:29:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/11/06/194700.htmlhttp://www.shnenglu.com/luyulaile/comments/194700.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/11/06/194700.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/194700.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/194700.html\newcommand{\parenthnewln}[1]{\right.\\#1&\left.{}}
\begin{equation}
\begin{split}
f(x)=1+&g(x)\\
=1+&\left(x+x^2+\dots
\parenthnewln{+}x^n+\ldots\right)
\end{split}
\end{equation}
寰楀埌錛?br />


luis 2012-11-06 06:29 鍙戣〃璇勮
]]>
Latex 涓彃鍏ヤ唬鐮?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/10/31/194135.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Wed, 31 Oct 2012 13:30:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/10/31/194135.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/194135.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/10/31/194135.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/194135.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/194135.html</trackback:ping><description><![CDATA[<h2><span id="Typesetting_using_the_algorithm2e_package"><a >http://en.wikibooks.org/wiki/LaTeX/Algorithms_and_Pseudocode</a> <br />Typesetting using the <tt style="font-family: monospace, Courier; ">algorithm2e</tt> package</span></h2><p style="margin: 0.4em 0px 0.5em; line-height: 19.200000762939453px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">The <tt style="font-family: monospace, Courier; ">algorithm2e</tt> package (first released 1995, latest updated December 2009 according to the <a rel="nofollow" text"="" target="_blank" style="text-decoration: none; color: #663366; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAATklEQVR4XmXKQQqAMAwF0X/7XsSz9CSKiyIIFRFcjMmihmiGbB5fqDCaQJ4j46pzYLUWe+cXZ6OVBhTS0srY2Njp/+XxXXZOLu6EUWAOPX1vnwTBe6qQAAAAAElFTkSuQmCC); padding-right: 13px; background-position: 100% 50%; background-repeat: no-repeat no-repeat; ">v4.01 manual</a>) allows typesetting algorithms with a lot of customization. The package is loaded like</p><div dir="ltr" mw-code="" mw-content-ltr"="" style="font-family: monospace, Courier; direction: ltr; padding: 1em; border: 1px dashed #2f6fab; background-color: #f9f9f9; line-height: 1.1em; font-size: 13px; "><div source-latex"="" style="line-height: normal; font-family: monospace; "><pre style="padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top; "><span style="color: #e02020; ">\</span><span style="color: #800000; ">usepackage</span><span style="color: #e02020; ">[</span><span style="color: #c08020; ">options</span><span style="color: #e02020; ">]{</span><span style="color: #2020c0; ">algorithm2e</span><span style="color: #e02020; ">}</span> </pre></div></div><p style="margin: 0.4em 0px 0.5em; line-height: 19.200000762939453px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">and a simple example, taken from the v4.01 manual, is</p><div dir="ltr" mw-code="" mw-content-ltr"="" style="font-family: monospace, Courier; direction: ltr; padding: 1em; border: 1px dashed #2f6fab; background-color: #f9f9f9; line-height: 1.1em; font-size: 13px; "><div source-latex"="" style="line-height: normal; font-family: monospace; "><pre style="padding: 0px; border: 0px none white; line-height: 1.2em; font-size: 1em; margin-top: 0px; margin-bottom: 0px; background-image: none; vertical-align: top; "><div style="background-color: #eeeeee; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->\begin{algorithm}[H]<br /> \SetAlgoLined<br /> \KwData{this text}<br /> \KwResult{how to write algorithm with \LaTeX2e }<br /> initialization\;<br /> \While{<span style="color: #0000FF; ">not</span> at end of this document}{<br />  read current\;<br />  \eIf{understand}{<br />   go to next section\;<br />   current section becomes this one\;<br />   }{<br />   go back to the beginning of current section\;<br />  }<br /> }<br /> \caption{How to write algorithms}<br />\end{algorithm}</div></pre></div></div><p style="margin: 0.4em 0px 0.5em; line-height: 19.200000762939453px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">which produces <a style="text-decoration: none; color: #0b0080; background-image: none; background-position: initial initial; background-repeat: initial initial; "><img alt="Latex-algorithm2e-if-else.png" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Latex-algorithm2e-if-else.png/300px-Latex-algorithm2e-if-else.png" width="300" height="181" srcset="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Latex-algorithm2e-if-else.png/450px-Latex-algorithm2e-if-else.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Latex-algorithm2e-if-else.png/600px-Latex-algorithm2e-if-else.png 2x" style="border: none; vertical-align: middle; margin: 0px; " /></a></p><img src ="http://www.shnenglu.com/luyulaile/aggbug/194135.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-10-31 21:30 <a href="http://www.shnenglu.com/luyulaile/archive/2012/10/31/194135.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Latex 涓彃鍏ヤ唬鐮?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/10/31/194134.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Wed, 31 Oct 2012 13:25:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/10/31/194134.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/194134.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/10/31/194134.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/194134.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/194134.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 1em; padding: 0px; border: 0px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; "><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->\usepackage{listings}<br />\usepackage{color}<br /><br />\definecolor{dkgreen}{rgb}{0,0.6,0}<br />\definecolor{gray}{rgb}{0.5,0.5,0.5}<br />\definecolor{mauve}{rgb}{0.58,0,0.82}<br /><br />\lstset{frame=tb,<br />  language=Java,<br />  aboveskip=3mm,<br />  belowskip=3mm,<br />  showstringspaces=false,<br />  columns=flexible,<br />  basicstyle={\small\ttfamily},<br />  numbers=none,<br />  numberstyle=\tiny\color{gray},<br />  keywordstyle=\color{blue},<br />  commentstyle=\color{dkgreen},<br />  stringstyle=\color{mauve},<br />  breaklines=true,<br />  breakatwhitespace=true<br />  tabsize=3<br />}<br />================<br /><br /><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; ">You can change default language in the middle of document with <code style="margin: 0px; padding: 1px 5px; border: 0px; vertical-align: baseline; background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">\lstset{language=Java}</code>.</p><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; ">Example of usage in the document:</p><div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->\begin{lstlisting}<br />// Hello.java<br /><span style="color: #0000FF; ">import</span> javax.swing.JApplet;<br /><span style="color: #0000FF; ">import</span> java.awt.Graphics;<br /><br />public <span style="color: #0000FF; ">class</span> Hello extends JApplet {<br />    public void paintComponent(Graphics g) {<br />        g.drawString(<span style="color: #800000; ">"</span><span style="color: #800000; ">Hello, world!</span><span style="color: #800000; ">"</span>, 65, 95);<br />    }    <br />}</div><pre style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; font-size: 14px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow: auto; width: auto; max-height: 600px; "><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; "><span style="font-size: 13px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; ">\end{lstlisting}</span> </code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; background-color: #ffffff; clear: both; word-wrap: break-word; ">Here's the result:</p></div></p><img src ="http://www.shnenglu.com/luyulaile/aggbug/194134.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-10-31 21:25 <a href="http://www.shnenglu.com/luyulaile/archive/2012/10/31/194134.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>label switchinghttp://www.shnenglu.com/luyulaile/archive/2012/10/31/194109.htmlluisluisTue, 30 Oct 2012 19:36:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/31/194109.htmlhttp://www.shnenglu.com/luyulaile/comments/194109.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/31/194109.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/194109.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/194109.html姣斿鏈変袱綆辮嫻鏋滐細 絎竴涓瀛愬唴鏈変袱涓嫻鏋滐紝label 涓篴 鐨勬鐜囦負30%,涓篵鐨勬鐜?0%錛岀浜屼釜綆卞瓙鍐呮湁鍥涗釜鑻規灉錛宭abel涓篵鐨勬鐜?0%,label 涓篴鐨勬鐜?0%.
濡傛灉鎴戜滑姹傛墍鏈夌殑鑻規灉鐨勯噸閲忥紝鍙渶瑕佸皢鎵鏈夌殑綆卞瓙鍐呯殑鑻規灉鍙栧嚭鏉ユ眰閲嶉噺鍗沖埢銆?br />浣嗘槸鎴戜滑鍏堟眰label a鐨勭瀛愯嫻鏋滅殑閲嶉噺錛屽姞涓妉abel b鐨勭瀛愯嫻鏋滅殑閲嶉噺錛屽彲鑳藉嚭鐜頒袱嬈″彇鐨勬槸鍚屼竴涓瀛愶紝榪欏氨鏄痩abel switching闂銆?img src ="http://www.shnenglu.com/luyulaile/aggbug/194109.html" width = "1" height = "1" />

luis 2012-10-31 03:36 鍙戣〃璇勮
]]>
Python generate corpus using Dirichlet distributionhttp://www.shnenglu.com/luyulaile/archive/2012/10/28/193960.htmlluisluisSun, 28 Oct 2012 02:13:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/28/193960.htmlhttp://www.shnenglu.com/luyulaile/comments/193960.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/28/193960.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/193960.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/193960.htmlAt first, let's define the sample function:

def sample(dist, num_samples=1):
    """
    Uses the inverse CDF method to return samples drawn from an
    (unnormalized) discrete distribution.

    Arguments:

    dist -- (unnormalized) distribution

    Keyword arguments:

    num_samples -- number of samples to draw
    
"""

    cdf = cumsum(dist)
    r = uniform(size=num_samples) * cdf[-1]

    return cdf.searchsorted(r)
As we can see, the sample function input two parameters, one is dist, which can be an un-normalized distribution, another is the sample we want to draw.

Let's see how to generate corpus for Dirichlet--multinomial unigram language model
def generate_corpus(beta, mean, N):
    """
    Returns a corpus of tokens drawn from a Dirichlet--multinomial
    unigram language model. Each token is an instance of one of V
    unique word types, represented by indices 0, , V - 1.

    Arguments:

    beta -- concentration parameter for the Dirichlet prior
    mean -- V-dimensional mean of the Dirichlet prior
    N -- number of tokens to generate
    
"""

    pass # YOUR CODE GOES HERE
    #print mean
    #print beta 
    #print dot(mean,beta)
    #print dirichlet(mean*beta,size=1)
    temp=sample(dirichlet(beta*array(mean),size=1),N)
    #print temp
    return temp
please keep in mind the dirichlet function is  “from numpy.random.mtrand import dirichlet"
and the parameters it receives are corresponding to beta*array(mean). beta is the concentration factor, and mean is the vector which sum to 1.



another way is to generate corpus is using the property:
P(D'|D,H)= Nv+beta_nv/N+beta
def generate_corpus_collapsed(beta, mean, N):
    """
    Returns a corpus of tokens drawn from a Dirichlet--multinomial
    unigram language model using the 'collapsed' generative process
    (i.e., phi is not explicitly represented). Each token is an
    instance of one of V unique word types.

    Arguments:

    beta -- concentration parameter for the Dirichlet prior
    mean -- V-dimensional mean of the Dirichlet prior
    N -- number of tokens to generate
    
"""

    V = len(mean) # vocabulary size

    corpus = zeros(N, dtype=int) # corpus

    Nv = zeros(V, dtype=int) # counts for each word type

    pass # YOUR CODE GOES HERE
    for n in xrange(N):
        corpus[n]=sample((Nv+beta*array(mean))/(n+beta),1)
        Nv[corpus[n]]+=1;    
    return corpus

Let's see how to generate corpus for Mixture of Dirichlet-multinomial unigram language model 

def generate_corpus(alpha, m, beta, n, D, Nd):
    """
    Returns a grouped corpus drawn from a mixture of
    Dirichlet--multinomial unigram language models.

    Arguments:

    alpha -- concentration parameter for the Dirichlet prior over theta
    m -- T-dimensional mean of the Dirichlet prior over theta
    beta -- concentration parameter for the Dirichlet prior over phis
    n -- V-dimensional mean of the Dirichlet prior over phis
    D -- number of documents to generate
    Nd -- number of tokens to generate per document
    
"""
    corpus = GroupedCorpus()

    pass # YOUR CODE GOES HERE
    #determine the topic the distribution for topic dirichlet(dot(m,alpha),size=1)
    #given the topic, the distribtuion for word dirichlet(dot(n,beta),size=1)
    theta=dirichlet(alpha*array(m),1)
    phis=dirichlet(beta*array(n),len(m))
    for d in range(0,D):
        [t]=sample(theta,1)
        #print groupVcab
        corpus.add(str(d),str(t),[str(x) for x in sample(phis[t,:],Nd)])           
    return corpus
娉ㄦ剰鏄疶涓猼opic (group)錛?span style="font-size: 13px; background-color: #eeeeee; ">  phis=dirichlet(beta*array(n),len(m))  浜х敓浜員涓?dirichlet distribution,鐩稿悓鐨則opic t搴旇鍙栧悓涓涓?dirichlet distribution phis[t,:]

luis 2012-10-28 10:13 鍙戣〃璇勮
]]>
澶氱淮鐭╅樀 姹傚拰http://www.shnenglu.com/luyulaile/archive/2012/10/27/193940.htmlluisluisSat, 27 Oct 2012 05:11:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/27/193940.htmlhttp://www.shnenglu.com/luyulaile/comments/193940.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/27/193940.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/193940.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/193940.html>> test3=cat(3,test1,test2)
test3(:,:,1) =
     1     2
     3     4
test3(:,:,2) =
     5     6
     7     8

=======================================
>> sum(test3,1)   %瀵圭涓涓淮搴︽眰鍜?/div>
ans(:,:,1) =
     4     6
ans(:,:,2) =
    12    14
>> sum(test3,2)  %瀵圭浜屼釜緇村害姹傚拰
ans(:,:,1) =
     3
     7
ans(:,:,2) =
    11
    15

>> sum(test3,3)%鐩稿綋浜庡絎笁涓淮搴︿笂姹傚拰
ans =
     6     8
    10    12
>> sum(test3(:))
ans =
    36


luis 2012-10-27 13:11 鍙戣〃璇勮
]]>matlab 鐭╅樀鍚堝茍http://www.shnenglu.com/luyulaile/archive/2012/10/27/193939.htmlluisluisSat, 27 Oct 2012 04:31:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/27/193939.htmlhttp://www.shnenglu.com/luyulaile/comments/193939.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/27/193939.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/193939.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/193939.html>> test1=[1,2;3,4]
test1 =
     1     2
     3     4
>> test2=[5,6;7,8]
test2 =
     5     6
     7     8
>> test3=[test1,test2]
test3 =
     1     2     5     6
     3     4     7     8
>> test4=[test1;test2]
test4 =
     1     2
     3     4
     5     6
     7     8
===
瀵逛簬緇存暟鐩稿悓鐨勭煩闃?/div>
cat(1,A,B錛夌浉褰撲簬[A;B]
cat (2, A, B) 鐩稿綋浜嶽A,B]
cat (3, A, B) 鐩稿綋浜庡鍔犵淮搴?/div>
褰揂錛孊鍒嗗埆涓轟簩緇寸煩闃墊椂錛屽悎騫朵箣鍚庝負涓夌淮鐭╅樀錛汚,B涓轟笁緇寸煩闃碉紝鍒欏湪絎笁緇存柟鍚戜笂鍚堝茍A,B銆?/span>

>> cat(1,test1,test2)

ans =

     1     2
     3     4
     5     6
     7     8

>> cat(2,test1,test2)

ans =

     1     2     5     6
     3     4     7     8

>> cat(3,test1,test2)

ans(:,:,1) =

     1     2
     3     4


ans(:,:,2) =

     5     6
     7     8


luis 2012-10-27 12:31 鍙戣〃璇勮
]]>寮哄埗latex 鍥劇墖鐨勬彃鍏ヤ綅緗?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/10/12/193197.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Fri, 12 Oct 2012 01:25:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/10/12/193197.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/193197.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/10/12/193197.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/193197.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/193197.html</trackback:ping><description><![CDATA[latex 鍥劇墖緇忓父澶氬嚭璺?br /><br /><br />1縐嶆柟娉? 蹇界暐緹庡<br />[!hb]<br /><br />2鍙︿竴縐嶆柟娉?br />H 鎻掑叆褰撳墠浣嶇疆<br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><br />\usepackage{float}<br /><br />\begin{figure}[H]<br />foo<br />\end{figure}</div><br />鐪嬪浘錛?img src ="http://www.shnenglu.com/luyulaile/aggbug/193197.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-10-12 09:25 <a href="http://www.shnenglu.com/luyulaile/archive/2012/10/12/193197.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Latex 甯哥敤鍛戒護http://www.shnenglu.com/luyulaile/archive/2012/10/12/193195.htmlluisluisThu, 11 Oct 2012 21:02:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/12/193195.htmlhttp://www.shnenglu.com/luyulaile/comments/193195.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/12/193195.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/193195.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/193195.html
\overline

^ _

\dfrac{}{}

\frac{}{}

\textbf

\sqrt 寮鏍瑰彿

\tilde 鏂滅嚎
\alpha \Alpha

\hat

\leq <=
\rightarrow ->
\geq >= greater equal
\begin{itemize}
\end{itemize}
\xi
\parell
姹傚鏄?\delta 

鍏充簬title
\documentclass{book}
\title{TITLE}
\author{AUTHOR}
\begin{document}
\maketitle
\end{document}


鍏充簬琛ㄦ牸

artice鐨勬枃绔犵粨鏋?br />title
 section
subsection
subsubsection

棣栬緙╄繘
\usepackage{indentfirst} 

===itemlize description enumerata鐨勫尯鍒?==

\begin{itemize}
    \item First level, itemize, first item
    \begin{itemize}
        \item Second level, itemize, first item
        \item Second level, itemize, second item
        \begin{enumerate}
            \item Third level, enumerate, first item
            \item Third level, enumerate, second item
        \end{enumerate}
    \end{itemize}
    \item First level, itemize, second item
\end{itemize}
==

 

涓昏鏄細


鐢誨浘錛?br />
   \begin{figure}[ht]
\centering
\includegraphics[width=0.8\textwidth,clip]{image/fig2.png}
\caption{}
\label{fig:11}
 \end{figure}

澶氫釜鍥撅細
\begin{figure}
  \centering
  \subfigure[Small Box with a Long Caption]{
    \label{fig:subfig:a} %% label for first subfigure
    \includegraphics[width=1.0in]{graphic.eps}}
  \hspace{1in}
  \subfigure[Big Box]{
    \label{fig:subfig:b} %% label for second subfigure
    \includegraphics[width=1.5in]{graphic.eps}}
  \caption{Two Subfigures}
  \label{fig:subfig} %% label for entire figure
\end{figure}


luis 2012-10-12 05:02 鍙戣〃璇勮
]]>
Matlab 甯哥敤鐢誨浘鍏紡http://www.shnenglu.com/luyulaile/archive/2012/10/12/193194.htmlluisluisThu, 11 Oct 2012 20:31:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/12/193194.htmlhttp://www.shnenglu.com/luyulaile/comments/193194.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/12/193194.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/193194.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/193194.html

http://www.mathworks.com/help/matlab/ref/plot.html 

渚嬪瓙錛?br />
榪樻槸涓劇畝鍗曠殑渚嬪瓙涓ぇ瀹訛細鍦?≤x≤2p鍖洪棿鍐咃紝緇樺埗鏇茬嚎y1=2e-0.5x鍜寉2=cos(4πx)錛屽茍緇欏浘褰㈡坊鍔犲浘褰㈡爣娉ㄣ?nbsp;
x=0:pi/100:2*pi;
y1=2*exp(-0.5*x);
y2=cos(4*pi*x);
plot(x,y1,x,y2)
title('x from 0 to 2{\pi}');                %鍔犲浘褰㈡爣棰?nbsp;   
xlabel('Variable X');                       %鍔燲杞磋鏄?nbsp;         
ylabel('Variable Y');                       %鍔燳杞磋鏄?nbsp;
text(0.8,1.5,'鏇茬嚎y1=2e^{-0.5x}');          %鍦ㄦ寚瀹氫綅緗坊鍔犲浘褰㈣鏄?nbsp;
text(2.5,1.1,'鏇茬嚎y2=cos(4{\pi}x)'); 
legend('y1','y2')                           %鍔犲浘渚?nbsp;
澶嶅埗浠g爜
 

plot

2-D line plot

Syntax

plot(Y)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec,...,Xn,Yn,LineSpec)
plot(...,'PropertyName',PropertyValue,...)
plot(axes_handle,...)
h = plot(...)


   1銆佽緗浘綰垮搴?/strong>   set( haxis, 'LineWidth', 1.0 ); ----榪欐槸 set鍑芥暟錛?'LineWidth'灝辨槸axis鐨勭嚎瀹藉害灞炴э紝鍏跺奸粯璁や負0.5錛岃繖閲屽彲浠ユ敼鎴?.0浜嗐?/span>

2銆佽皟鏁村潗鏍囪醬涓婁笅闄?br />set( haxis, 'XLim', [ 2 20 ] );  set( haxis, 'YLim', [ 2 20 ] );---璋冩暣鍧愭爣杞翠笂涓嬮檺鐨勩俍杞達紝閭e悓鐞唖et( haxis, 'ZLim', [ Zmin, %% Zmax ] )
     3銆佽皟鏁村潗鏍囪醬涓婄殑鏍囨敞鏁板瓧
set( haxis, 'XTick', 2:1:20 );  set( haxis, 'YTick', 2:1:20 );----鏄皟鏁村潗鏍囪醬涓婇偅浜涙爣娉ㄥ嚭鏉ョ殑鏁板瓧浜嗭紝2:1:20鎰忔濇槸浠?寮濮嬶紝姣忛殧1鏍囨敞涓嬈★紝鐩村埌20涓烘銆傛敞鎰忚繖閲岀殑2, 20鏈濂藉拰涓婇潰鐩稿簲鐨刋Lim, YLim鏈澶ф渶灝忓間竴鑷淬?/tt>

4銆丮ATLAB涓彁渚涚殑綰垮瀷鍙婇鑹插睘鎬э細

濡傦細plot(x1,y1,'r-'),琛ㄧず錛岀敤綰㈣壊瀹炵嚎鐢誨嚭鍥懼艦

 

 

綰垮瀷

璇存槑

鏍囪絎?/p>

璇存槑

棰滆壊

璇存槑

-

瀹炵嚎(榛樿)

+

鍔犲彿絎?/p>

r

綰㈣壊

--

鍙屽垝綰?/p>

o

絀哄績鍦?/p>

g

緇胯壊

:

铏氱嚎

*

鏄熷彿

b

钃濊壊

:.

鐐瑰垝綰?/p>

.

瀹炲績鍦?/p>

c

闈掔豢鑹?/p>

 

 

x

鍙夊彿絎?/p>

m

媧嬬孩鑹?/p>

 

 

s

姝f柟褰?/p>

y

榛勮壊

 

 

d

鑿卞艦

k

榛戣壊

 

 

^

涓婁笁瑙掑艦

w

鐧借壊

 

 

v

涓嬩笁瑙掑艦

 

 

 

 

鍙充笁瑙掑艦

 

 

 

 

宸︿笁瑙掑艦

 

 

 

 

p

浜旇鏄?/p>

 

 

 

 

h

鍏竟褰?/p>

 

 

5銆佸浘褰㈡爣棰樸佽醬鏍囨敞銆佸浘褰㈣鏄庣殑璁劇疆

鍥懼悕鏍囨敞鍙敤錛歵itle('xx鍏崇郴鍥?)
axis([0,22,0,3]);---鏄劇ず鑼冨洿涓猴細X杞翠粠0-22錛?Y杞翠粠0-3鏄劇ず銆?br />xlabel('鐢靛帇錛圴錛?)錛寉label('鐢墊祦錛圓錛?) 鍒嗗埆琛ㄧず鍦╔杞翠笅鏍囩ず 鐢靛帇錛圴錛夛紝Y杞存梺鏍囩ず“鐢墊祦錛圓錛?#8221;

legend('A鏇茬嚎 ','B鏇茬嚎','C鏇茬嚎')  鐢ㄤ簬璇存槑鍥句腑鐨勬洸綰跨殑璇存槑錛岄『搴忓拰plot(x1,y1,x2,y2,x3,y3)鐨勬洸綰?銆?銆?鐩稿悓鍗沖彲銆?/tt>

 

set(h,'LineWidth',1.5)%璁劇疆鍥劇嚎綺楃粏

%set(gca,'XTickLabel',{'-4/T','-3/T','-2/T','-1/T','0','1/T','2/T','3/T','4/T',})




scatter

Scatter plot

Syntax

scatter(X,Y,S,C)
scatter(X,Y)
scatter(X,Y,S)
scatter(...,markertype)
scatter(...,'filled')
scatter(...,'PropertyName',propertyvalue)
scatter(axes_handle,...)
h = scatter(...)

 

 



luis 2012-10-12 04:31 鍙戣〃璇勮
]]>Matlab 甯哥敤function 絎旇http://www.shnenglu.com/luyulaile/archive/2012/10/11/193145.htmlluisluisThu, 11 Oct 2012 00:28:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/10/11/193145.htmlhttp://www.shnenglu.com/luyulaile/comments/193145.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/10/11/193145.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/193145.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/193145.htmleye(1) [1]  eye(2) 2*2鐨勫崟浣嶇煩闃?br />ones(n),  n*n鐨勭煩闃?br />ones(n,m) 鎴栬?ones([n,m]) n*m鍏ㄦ槸1鐨勭煩闃?br />zeros(n) zeros([n,m])  鍏ㄦ槸0鐨勭煩闃?br />
reshape() 灝嗘暟鎹竴鍒椾竴鍒楅噸鏂板垎閰?br />渚嬪錛?br />
 

Reshape a 3-by-4 matrix into a 2-by-6 matrix.

A =     1    4    7    10
2 5 8 11
3 6 9 12

B = reshape(A,2,6)
B = 1 3 5 7 9 11
2 4 6 8 10 12
B = reshape(A,2,[])
B =     1    3    5    7    9   11     
2 4 6 8 10 12


A=rand(3,3);
B=A';%杞疆
C=inv(B);%姹傞?/span>
D=rank(A);%姹傜煩闃電殑緗?/span>
[V E]=eig(A);%姹傜煩闃電殑鐗瑰緛鍚戦噺V鍜岀壒寰佸糄 
濡傛灉涓嶆槸鏂歸樀錛屽彲浠ョ敤pinv姹備吉閫?/span> 

鍦嗘嫭鍙風殑浣滅敤錛氱敤浜庡彇鍊鹼紙寮曠敤鏁扮粍涓殑鍏冪礌錛?br />
>> A =[1    4    7    10
    2    5    8    11
    3    6    9    12]
A =
     1     4     7    10
     2     5     8    11
     3     6     9    12
A(3)=3
A(10)=10
A(2,3)=5
娉ㄦ剰涓嶆槸錛涜屾槸閫楀彿,
A(2,:)=鍘繪墍鏈夌殑絎簩琛?2 5 8 11



鏂規嫭鍙風殑浣滅敤錛?br />
Matlab 鏂規嫭鍙?#8220;[ ]”鐨勪綔鐢?br /> 1瀹氫箟鐭╅樀錛堝悜閲忥紝鏁扮粍錛夈?br />                渚嬪 a=[1 2 3;4 5 6] 
2.瀹氫箟鍑芥暟鐨勮繑鍥炲弬鏁板垪琛紙杈撳嚭鍙橀噺瀹楅噺錛夈?br /> 渚嬪 [m,n]=size(a) 濡傛灉鍑芥暟鐨勮繑鍥炲弬鏁板彧鏈変竴涓紝涓嫭鍙蜂竴鑸渷鐣ャ傚嵆 [n]=rand(1,2); 鍙啓浣? n=rand(1,2);


澶ф嫭鍙風殑浣滅敤{ }
澶ф嫭鍙鳳紝鐢ㄤ簬cell鍨嬬殑鏁扮粍鐨勫垎閰嶆垨寮曠敤銆?br />姣斿
 A(2,1) = {[1 2 3; 4 5 6]}, or A{2,2} = ('str') 

鍒嗗彿錛涚殑浣滅敤錛?br />

cell鍨?鏁版嵁綾誨瀷

濡傛灉p涓轟竴涓暟錛岄偅涔坔(1)=p,鏄病鏈夐棶棰樼殑銆?/p>

濡傛灉p涓轟竴涓悜閲忥紝閭d箞h(1,:)=p鏄病鏈夐棶棰樼殑銆?/p>

濡傛灉p鏄竴涓煩闃電殑璇濓紝涓婇潰鐨勪袱縐嶈祴鍊兼柟娉曢兘鏄細鏈夐敊璇殑銆?/p>

閭d箞瑕佸浣曞鐞嗗憿錛?/p>

榪欐椂灝辯敤鍒頒簡cell鏁版嵁綾誨瀷浜嗐俢ell鐨勬瘡涓崟鍏冮兘鍙互瀛樺偍浠諱綍鏁版嵁錛屾瘮濡備紶閫掑嚱鏁扮瓑銆傚綋鐒訛紝瀛樺偍鐭╅樀鏇存槸娌℃湁闂鐨勪簡銆備絾鏄敤cell鏁版嵁綾誨瀷涔嬪墠錛岃鍏堝垵濮嬪寲銆?/p>

a=cell(n,m)

閭d箞灝辨妸a鍒濆鍖栦負涓涓猲琛宮鍒楃殑絀篶ell綾誨瀷鏁版嵁銆?/p>

濡備綍璧嬪煎憿錛?/p>

a{1,1}=rand(5)

閭d箞a鐨?琛?鍒楃殑鍗曞厓涓瓨鍌ㄧ殑灝辨槸涓涓殢鏈虹殑5×5鐨勬柟闃典簡銆?/p>

閭d箞瑕佺敤絎竴涓崟鍏冧腑鐨勬柟闃典腑鐨勬煇涓煎憿錛?/p>

鍙互濡備笅寮曠敤錛歛{1,1}(2,3)

灝卞彲浠ヤ簡錛屽紩鐢╟ell鍗曞厓鏃惰鐢▄},鍐嶅紩鐢ㄧ煩闃電殑鏌愪釜鏁版嵁灝辮鐢?)浜嗐?/p>

cell鍗曞厓涓殑姣忎釜鍗曞厓閮芥槸鐙珛鐨勶紝鍙互鍒嗗埆瀛樺偍涓嶅悓澶у皬鐨勭煩闃墊垨涓嶅悓綾誨瀷鐨勬暟鎹?/p>



luis 2012-10-11 08:28 鍙戣〃璇勮
]]>
Python 絀烘暟緇?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/09/19/191202.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Wed, 19 Sep 2012 01:47:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/09/19/191202.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/191202.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/09/19/191202.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/191202.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/191202.html</trackback:ping><description><![CDATA[<div>Python array 鐢ㄦ硶   <br />鐩存帴 result=[]</div><div>    for x in range(0,N):</div><div>        temp=beta(b,n)</div><div>        print temp</div><div>        if temp >= n:</div><div>            result.append("Yes")  #鐩存帴append</div><div>        else:</div><div>            result.append("No") #鐩存帴append</div><div>    return result</div><img src ="http://www.shnenglu.com/luyulaile/aggbug/191202.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-09-19 09:47 <a href="http://www.shnenglu.com/luyulaile/archive/2012/09/19/191202.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Python絎旇http://www.shnenglu.com/luyulaile/archive/2012/09/09/190021.htmlluisluisSun, 09 Sep 2012 06:47:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/09/09/190021.htmlhttp://www.shnenglu.com/luyulaile/comments/190021.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/09/09/190021.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/190021.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/190021.htmlTutorial 錛?/span> http://www.tutorialspoint.com/python/python_files_io.htm 

Python IO
杈撳嚭 print
str = raw_input("Enter your input: "); print "Received input is : ", str


Python鍙湁涓夌鍙橀噺綾誨瀷 int, string, float? 
typeof(1.5)
璨屼技涓嶆敮鎸侀殣寮忕被鍨嬭漿鎹?br />print str(2.5)  瀵?br />print 2.5 閿?br />print '2.5' 瀵?br />
python 瀹氫箟鏂規硶鏄?br />def MethodName(para,para2): #娉ㄦ剰榪欓噷鐨勫啋鍙?br />      if 

python娉ㄩ噴
#鍗曡娉ㄩ噴
"""  涓変釜鍙屽紩鍙鋒槸澶氳娉ㄩ噴 """

python 寮曠敤
include math


Python鐨剆tr
str(var)綾誨瀷杞崲
len(var)
var.upper()
var.lower()
var[2] 絎笁涓紙娉ㄦ剰涓嬫爣浠?寮濮嬶級鍏冪礌錛岀被浼間簬list
var[:3] 鍓嶄笁涓厓绱狅紝瀹為檯涓婃寚鐨勬槸0鎴鍒?-1鐨勫厓绱?br />var[2:4]涓嬫爣鏄?鍒?-1鐨勬墍鏈夊厓绱?br />
Python鐨刲ist
exampe=[a,b,c,d,e,f];
len(exampe)
鑷甫sort鏂規硶

Python鐨刣ictionary
key -value瀵瑰簲
value鍙互鏄竴涓猯ist
娉ㄦ剰鏂規嫭鍙穂]閲岄潰鍙兘浣跨敤key
鍖哄垎 del dict['Name']


del dict['Name']; # remove entry with key 'Name' dict.clear();     # remove all entries in dict del dict ;        # delete entire dictionary
鑷甫鐨勬柟娉曪細

1cmp(dict1, dict2)
Compares elements of both dict.
2len(dict)
Gives the total length of the dictionary. This would be equal to the number of items in the dictionary.
3str(dict)
Produces a printable string representation of a dictionary
4type(variable)
Returns the type of the passed variable. If passed variable is dictionary then it would return a dictionary type.




Python綾葷殑瀹氫箟鍜岀被鏂規硶鐨勫畾涔?br />瀹氫箟綾諱笉闇瑕佺敤def class,鐩存帴

class ClassName(object):
姣忎釜綾婚兘鏈?__init__(self,arg):
鏂規硶錛屾敞鎰忔槸 宸﹀彸鍚勪袱涓笅鍒掔嚎錛屾誨叡4鏍逛笅鍒掔嚎
 
綾繪柟娉曢兘闇瑕佸寘鍚玸elf榪欎釜鍙傛暟錛屼絾鏄嬌鐢ㄧ殑鏃跺欎笉闇瑕乻elf,瑙佷笅渚?br />                  
渚嬪
class Adder(object):
def __init__(self):
self.baseNum = 2
def prnt_num(self):
print self.baseNum
def add_to_base(self, arg):
# Your code here
self.baseNum+=arg
print self.baseNum
objectVar = Adder()
objectVar.prnt_num()
# Your code here
objectVar.add_to_base(3)

Python涓殑綾誨彉閲忎笉鑳?self.xxx鏉ュ紩鐢紝浣嗘槸鎴愬憳鍙橀噺鍙互
Class variables are special because they belong to the 
class; the objects created do not get their own copies of the class variable. Class variables are accessed using the class name and dot notation.
ClassName.classVar
Class variables are created outside of__init__ 
渚嬪錛?br />
class Widget(object):
objID = 0
def __init__(self):
Widget.objID += 1
# Your code here
self.myID=Widget.objID

甯哥姱閿欒錛歩ndentation is very important  
python indentation error expected an indented block
榪樻湁涓涓敊璇氨鏄?綾繪柟娉曪紝蹇呴』浣跨敤 self鍙傛暟錛屽嵆浣挎病鏈夊弬鏁幫紒錛?/span>
鍙﹀涓涓父閿欑殑鍦版柟灝辨槸 __init__(self,arg) 涓瀹氭槸鍥涙牴涓嬪垝綰?/span>



涓嶄粎瑕佽寰楃暀dent 榪樿璁板緱 緙╄繘








luis 2012-09-09 14:47 鍙戣〃璇勮
]]>
Latex 澶ф嫭鍙風敤娉?/title><link>http://www.shnenglu.com/luyulaile/archive/2012/08/28/188512.html</link><dc:creator>luis</dc:creator><author>luis</author><pubDate>Tue, 28 Aug 2012 03:35:00 GMT</pubDate><guid>http://www.shnenglu.com/luyulaile/archive/2012/08/28/188512.html</guid><wfw:comment>http://www.shnenglu.com/luyulaile/comments/188512.html</wfw:comment><comments>http://www.shnenglu.com/luyulaile/archive/2012/08/28/188512.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/luyulaile/comments/commentRss/188512.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/luyulaile/services/trackbacks/188512.html</trackback:ping><description><![CDATA[鍘熷湴鍧錛?a >http://blog.sina.com.cn/s/blog_5e16f1770100gzud.html</a> <br /><img src="http://www.shnenglu.com/images/cppblog_com/luyulaile/690.jpg" width="299" height="332" alt="" /><br /><br /><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">婕旂ず浠g爜錛?/p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">\documentclass{article}<br />\setlength\textwidth{245.0pt}<br />\usepackage{CJK}<br />\usepackage{indentfirst}<br />\usepackage{amsmath}</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">\begin{CJK*}{GBK}{song}<br />\begin{document}<br />鏂規硶涓錛?/p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">$$ f(x)=\left\{<br />\begin{aligned}<br />x & = & \cos(t) \\<br />y & = & \sin(t) \\<br />z & = & \frac xy<br />\end{aligned}<br />\right.<br />$$</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; "><br />鏂規硶浜岋細</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">$$ F^{HLLC}=\left\{<br />\begin{array}{rcl}<br />F_L <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> & <wbr> <wbr> <wbr> <wbr> <wbr> & {0 <wbr> <wbr> <wbr> <wbr> <wbr> < <wbr> <wbr> <wbr> <wbr> <wbr> S_L}\\<br />F^*_L <wbr> <wbr> <wbr> <wbr> & <wbr> <wbr> <wbr> <wbr> <wbr> & {S_L \leq 0 < S_M}\\<br />F^*_R <wbr> <wbr> <wbr> <wbr> & <wbr> <wbr> <wbr> <wbr> <wbr> & {S_M \leq 0 < S_R}\\<br />F_R <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> & <wbr> <wbr> <wbr> <wbr> <wbr> & {S_R \leq 0}<br />\end{array} \right. $$</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">鏂規硶涓?</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">$$f(x)=<br />\begin{cases}<br />0& \text{x=0}\\<br />1& \text{x!=0}<br />\end{cases}$$</p><p style="margin-top: 0px; margin-right: 0px; margin-left: 0px; padding: 0px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; color: #323e32; font-family: simsun; background-color: #9caec1; ">\end{CJK*}<br />\end{document}</p><br />鍙互鐢╘text{} 娉ㄩ噴鏂囧瓧<img src ="http://www.shnenglu.com/luyulaile/aggbug/188512.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/luyulaile/" target="_blank">luis</a> 2012-08-28 11:35 <a href="http://www.shnenglu.com/luyulaile/archive/2012/08/28/188512.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Dijkstra(榪澃鏂壒鎷?綆楁硶http://www.shnenglu.com/luyulaile/archive/2012/06/16/179006.htmlluisluisFri, 15 Jun 2012 19:53:00 GMThttp://www.shnenglu.com/luyulaile/archive/2012/06/16/179006.htmlhttp://www.shnenglu.com/luyulaile/comments/179006.htmlhttp://www.shnenglu.com/luyulaile/archive/2012/06/16/179006.html#Feedback0http://www.shnenglu.com/luyulaile/comments/commentRss/179006.htmlhttp://www.shnenglu.com/luyulaile/services/trackbacks/179006.html銆Dijkstra(榪澃鏂壒鎷?綆楁硶鏄吀鍨嬬殑鍗曟簮鏈鐭礬寰勭畻娉曪紝鐢ㄤ簬璁$畻涓涓妭鐐瑰埌鍏朵粬鎵鏈夎妭鐐圭殑鏈鐭礬寰勩備富瑕佺壒鐐規槸浠ヨ搗濮嬬偣涓轟腑蹇冨悜澶栧眰灞傛墿灞曪紝鐩村埌鎵╁睍鍒扮粓鐐逛負姝€侱ijkstra綆楁硶鏄緢鏈変唬琛ㄦх殑鏈鐭礬寰勭畻娉曪紝鍦ㄥ緢澶氫笓涓氳紼嬩腑閮戒綔涓哄熀鏈唴瀹規湁璇︾粏鐨勪粙緇嶏紝濡傛暟鎹粨鏋勶紝鍥捐錛岃繍絳瑰絳夌瓑銆侱ijkstra涓鑸殑琛ㄨ堪閫氬父鏈変袱縐嶆柟寮忥紝涓縐嶇敤姘鎬箙鍜屼復鏃舵爣鍙鋒柟寮忥紝涓縐嶆槸鐢∣PEN, CLOSE琛ㄧ殑鏂瑰紡錛岃繖閲屽潎閲囩敤姘鎬箙鍜屼復鏃舵爣鍙風殑鏂瑰紡銆傛敞鎰忚綆楁硶瑕佹眰鍥句腑涓嶅瓨鍦ㄨ礋鏉冭竟銆?/span>

闂鎻忚堪

銆銆鍦ㄦ棤鍚戝浘 G=(V,E) 涓紝鍋囪姣忔潯杈?E[i] 鐨勯暱搴︿負 w[i]錛屾壘鍒扮敱欏剁偣 V0 鍒板叾浣欏悇鐐圭殑鏈鐭礬寰勩傦紙鍗曟簮鏈鐭礬寰?/a>錛?/span> 


榪澃鏂壒鎷?/a>(Dijkstra)綆楁硶鎬濇兂
銆銆
鎸夎礬寰勯暱搴﹂掑嬈″簭浜х敓鏈鐭礬寰勭畻娉曪細
銆銆鎶奦鍒嗘垚涓ょ粍錛?/span>
銆銆錛?錛塖錛氬凡姹傚嚭鏈鐭礬寰勭殑欏剁偣鐨勯泦鍚?/span>
銆銆錛?錛塚-S=T錛氬皻鏈‘瀹氭渶鐭礬寰勭殑欏剁偣闆嗗悎
銆銆灝員涓《鐐規寜鏈鐭礬寰勯掑鐨勬搴忓姞鍏ュ埌S涓紝
銆銆淇濊瘉錛氾紙1錛変粠婧愮偣V0鍒癝涓悇欏剁偣鐨勬渶鐭礬寰勯暱搴﹂兘涓嶅ぇ浜?/span>
銆銆浠嶸0鍒癟涓換浣曢《鐐圭殑鏈鐭礬寰勯暱搴?/span>
銆銆錛?錛夋瘡涓《鐐瑰搴斾竴涓窛紱誨?/span>
銆銆S涓《鐐癸細浠嶸0鍒版欏剁偣鐨勬渶鐭礬寰勯暱搴?/span>
銆銆T涓《鐐癸細浠嶸0鍒版欏剁偣鐨勫彧鍖呮嫭S涓《鐐逛綔涓棿
銆銆欏剁偣鐨勬渶鐭礬寰勯暱搴?/span>
銆銆渚濇嵁錛氬彲浠ヨ瘉鏄嶸0鍒癟涓《鐐筕k鐨勬渶鐭礬寰勶紝鎴栨槸浠嶸0鍒癡k鐨?/span>
銆銆鐩存帴璺緞鐨勬潈鍊鹼紱鎴栨槸浠嶸0緇廠涓《鐐瑰埌Vk鐨勮礬寰勬潈鍊間箣鍜?/span>
銆銆錛堝弽璇佹硶鍙瘉錛?/span>
銆銆姹傛渶鐭礬寰勬楠?/em>
銆銆綆楁硶姝ラ濡備笅錛?/span>
銆銆1. 鍒濅嬌鏃朵護 S={V0},T={鍏朵綑欏剁偣}錛孴涓《鐐瑰搴旂殑璺濈鍊?/span>
銆銆鑻ュ瓨鍦?lt;V0,Vi>錛宒(V0,Vi)涓?lt;V0,Vi>寮т笂鐨勬潈鍊?/span>
銆銆鑻ヤ笉瀛樺湪<V0,Vi>錛宒(V0,Vi)涓?#8733;
銆銆2. 浠嶵涓夊彇涓涓叾璺濈鍊間負鏈灝忕殑欏剁偣W涓斾笉鍦⊿涓紝鍔犲叆S
銆銆3. 瀵筎涓《鐐圭殑璺濈鍊艱繘琛屼慨鏀癸細鑻ュ姞榪沇浣滀腑闂撮《鐐癸紝浠嶸0鍒癡i鐨?/span>
銆銆璺濈鍊兼瘮涓嶅姞W鐨勮礬寰勮鐭紝鍒欎慨鏀規璺濈鍊?/span>
銆銆閲嶅涓婅堪姝ラ2銆?錛岀洿鍒癝涓寘鍚墍鏈夐《鐐癸紝鍗砈=T涓烘 

浠g爜錛?婧愬湴鍧錛?span style="color: #008000; font-size: 13px; background-color: #eeeeee; ">www.cnblogs.com/newwy
 

/*********************************
*   鏈鐭礬寰?--Dijkstra綆楁硶瀹炵幇 
*   銆銆銆HDU錛?544 
*   BLOG:www.cnblogs.com/newwy
*   AUTHOR:Wang Yong
*********************************
*/
#include <iostream>
#define MAX 100
#define INF 1000000000
using namespace std;
 int dijkstra (int mat[][MAX],int n, int s,int f)
 {
     int dis[MAX];
     int mark[MAX];//璁板綍琚変腑鐨勭粨鐐?nbsp;
     int i,j,k = 0;
     for(i = 0 ; i < n ; i++)//鍒濆鍖栨墍鏈夌粨鐐癸紝姣忎釜緇撶偣閮芥病鏈夎閫変腑 
         mark[i] = 0;
    for(i = 0 ; i < n ; i++)//灝嗘瘡涓粨鐐瑰埌start緇撶偣weight璁板綍涓哄綋鍓峝istance 
    {
        dis[i] = mat[s][i];
        //path[i] = s;
    }
    mark[s] = 1;//start緇撶偣琚変腑 
    
//path[s] = 0;
    dis[s] = 0;//灝唖tart緇撶偣鐨勭殑璺濈璁劇疆涓? 
    int min ;//璁劇疆鏈鐭殑璺濈銆?nbsp;
    for(i = 1 ; i < n; i++)
    {
        min = INF;
        for(j = 0 ; j < n;j++)
        {
            if(mark[j] == 0  && dis[j] < min)//鏈閫変腑鐨勭粨鐐逛腑錛岃窛紱繪渶鐭殑琚変腑 
            {
                min = dis[j] ;
                k = j;
            }
        }
        mark[k] = 1;//鏍囪涓鴻閫変腑 
        for(j = 0 ; j < n ; j++)
        {
            if( mark[j] == 0  && (dis[j] > (dis[k] + mat[k][j])))//淇敼鍓╀綑緇撶偣鐨勬渶鐭窛紱?nbsp;
            {
                dis[j] = dis[k] + mat[k][j];
            }
        }
    }
    return dis[f];    
 } 
 int mat[MAX][MAX];
int main()
{
    int n,m;
    while(scanf("%d %d",&n,&m))
    {
        int a,b,dis;
        if(n == 0 || m == 0)
            break;
        int i,j;
        for(i = 0 ; i < n;i++)
            for(j = 0 ; j < n; j++)
                mat[i][j] = INF;
        for(i = 0 ; i < m ;i++)
        {
            scanf("%d %d %d",&a,&b,&dis);
            --a,--b;
            if(dis < mat[a][b] || dis < mat[b][a])
            mat[a][b] = mat[b][a] = dis;
        }
        int ans = dijkstra(mat,n,0,n-1);
        printf("%d\n",ans);
    }
 
}

鍙敤 浼樺厛闃熷垪浼樺寲


鍏朵粬瑙i噴錛?br />
http://blog.csdn.net/jiahui524/article/details/6636913 

luis 2012-06-16 03:53 鍙戣〃璇勮
]]>
国产成人精品白浆久久69| 久久精品亚洲一区二区三区浴池| 欧美精品一区二区久久| 国产亚洲精久久久久久无码| 国产精品久久网| 国产一区二区久久久| 欧美精品九九99久久在观看| 91精品国产91久久久久福利| 久久精品国产亚洲77777| 亚洲狠狠婷婷综合久久蜜芽| 亚洲欧美成人综合久久久| 亚洲伊人久久精品影院| 久久久亚洲欧洲日产国码是AV| 亚洲欧美日韩精品久久亚洲区 | 久久成人小视频| 性做久久久久久久久| 国产欧美久久久精品影院| 国产美女亚洲精品久久久综合| 日韩人妻无码精品久久免费一 | 国产亚洲成人久久| 久久亚洲精品无码观看不卡| 久久久久99这里有精品10 | 国产亚洲综合久久系列| 国产精品久久久久久久久| 亚洲成色999久久网站| 久久无码AV中文出轨人妻| 久久无码中文字幕东京热| 亚洲人成伊人成综合网久久久| 99久久婷婷国产综合亚洲| 久久免费视频网站| 久久最新免费视频| 少妇内射兰兰久久| 9999国产精品欧美久久久久久| 性做久久久久久久久浪潮| 久久久国产精品亚洲一区| 国产成人久久久精品二区三区| 亚洲欧美一级久久精品| 97精品伊人久久大香线蕉app| 久久精品夜色噜噜亚洲A∨| 欧洲精品久久久av无码电影 | 国产午夜电影久久|