亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? matrix.java

?? CroftSoft Code Library是一個開源的可移植的純Java游戲庫
?? JAVA
字號:
     package com.croftsoft.core.math;

     /*********************************************************************
     *
     * A mathematical matrix class.
     *
     * @version
     *   1998-12-27
     * @author
     *   <A HREF="http://www.alumni.caltech.edu/~croft/">David W. Croft</A>
     *********************************************************************/

     public class  Matrix
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     public int             rows;
     public int             cols;
     public double [ ] [ ]  data;

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * Test/demo method.
     *********************************************************************/
     public static void  main ( )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  left  = new Matrix ( 2, 3 );
       Matrix  right = new Matrix ( 3, 4 );

       for ( int index_row = 0; index_row < left.rows; index_row++ )
       for ( int index_col = 0; index_col < left.cols; index_col++ )
       {
         left.data [ index_row ] [ index_col ] = index_row + index_col;
       }

       for ( int index_row = 0; index_row < right.rows; index_row++ )
       for ( int index_col = 0; index_col < right.cols; index_col++ )
       {
         right.data [ index_row ] [ index_col ] = index_row + index_col;
       }

       left.display ( );
       System.out.println ( "" );
       right.display ( );
       System.out.println ( "" );
       Matrix  product = multiply ( left, right );
       product.display ( );
       System.out.println ( "" );
       Matrix  transposed = product.transpose ( );
       transposed.display ( );
       System.out.println ( "" );
       Matrix  sigmoided = transposed.sigmoid ( );
       sigmoided.display ( );
     }

     //////////////////////////////////////////////////////////////////////
     // Static methods
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * Returns a square matrix with the diagonal values set to 1.0 and
     * all others set to 0.0.
     *
     * @param rows_cols
     *   The number of rows and columns on a side.
     *********************************************************************/
     public static Matrix  identity ( int  rows_cols )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  m = new Matrix ( rows_cols, rows_cols );

       for ( int  i = 0; i < rows_cols; i++ )
       {
         m.data [ i ] [ i ] = 1.0;
       }

       return m;
     }

     public static Matrix  multiply ( Matrix  left, Matrix  right )
     //////////////////////////////////////////////////////////////////////
     {
       if ( left.cols != right.rows )
       {
         throw new ArrayIndexOutOfBoundsException (
           "Matrix.multiply:  left.cols != right.rows" );
       }

       Matrix  product = new Matrix ( left.rows, right.cols );

       for ( int index_row = 0; index_row < product.rows; index_row++ )
       for ( int index_col = 0; index_col < product.cols; index_col++ )
       {
         product.data [ index_row ] [ index_col ] = 0.0;
         for ( int index = 0; index < left.cols; index++ )
         {
           product.data [ index_row ] [ index_col ]
             += left.data [ index_row ] [ index ]
             * right.data [ index ] [ index_col ];
         }
       }

       return product;
     }

     public static Matrix  multiplyPairwise ( Matrix  a, Matrix  b )
     //////////////////////////////////////////////////////////////////////
     {
       if ( ( a.rows != b.rows ) || ( a.cols != b.cols ) )
       {
         throw new ArrayIndexOutOfBoundsException (
           "Matrix.multiply_pairwise:  rows or columns not equal" );
       }

       Matrix  product = new Matrix ( a.rows, a.cols );

       for ( int index_row = 0; index_row < a.rows; index_row++ )
       for ( int index_col = 0; index_col < a.cols; index_col++ )
       {
         product.data [ index_row ] [ index_col ]
           = a.data [ index_row ] [ index_col ]
           * b.data [ index_row ] [ index_col ];
       }

       return product;
     }

     //////////////////////////////////////////////////////////////////////
     // Constructor methods
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * Constructs a Matrix with all of the element values set to zero.
     *********************************************************************/
     public  Matrix ( int  rows, int  cols )
     //////////////////////////////////////////////////////////////////////
     {
       this.rows = rows;
       this.cols = cols;
       this.data = new double [ rows ] [ cols ];
     }

     /*********************************************************************
     * Constructs a Matrix with all of the element values set to a
     * specified constant.
     *
     * @param value
     *   All of the element values will be set to this constant.
     *********************************************************************/
     public  Matrix ( int  rows, int  cols, double  value )
     //////////////////////////////////////////////////////////////////////
     {
       this ( rows, cols );

       for ( int  row = 0; row < rows; row++ )
       for ( int  col = 0; col < cols; col++ )
       {
         data [ row ] [ col ] = value;
       }
     }

     public Matrix ( Matrix  old )
     //////////////////////////////////////////////////////////////////////
     {
       this ( old.rows, old.cols );
       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         this.data [ index_row ] [ index_col ]
           = old.data [ index_row ] [ index_col ];
       }
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     public Matrix  add ( double  addend )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  new_Matrix = new Matrix ( this );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ] += addend;
       }
       return new_Matrix;
     }

     public Matrix  add ( Matrix  addend )
     //////////////////////////////////////////////////////////////////////
     {
       if ( ( this.rows!= addend.rows    )
         || ( this.cols != addend.cols ) )
       {
         throw new ArrayIndexOutOfBoundsException (
           "Matrix.add ( Matrix ):  columns and rows not equal" );
       }

       Matrix  new_Matrix = new Matrix ( this );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ]
           += addend.data [ index_row ] [ index_col ];
       }
       return new_Matrix;
     }

     public Matrix  clip ( double  min, double  max )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  new_Matrix = new Matrix ( this );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         if ( this.data [ index_row ] [ index_col ] < min )
           new_Matrix.data [ index_row ] [ index_col ] = min;
         else if ( this.data [ index_row ] [ index_col ] > max )
           new_Matrix.data [ index_row ] [ index_col ] = max;
       }
       return new_Matrix;
     }

     public void  display ( )
     //////////////////////////////////////////////////////////////////////
     {
       for ( int index_row = 0; index_row < this.rows; index_row++ )
       {
         String  line_String = "";
         for ( int index_col = 0; index_col < this.cols; index_col++ )
         {
           line_String += this.data [ index_row ] [ index_col ] + " ";
         }
         System.out.println ( line_String );
       }
     }

     public Matrix  multiply ( double  factor )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  new_Matrix = new Matrix ( this );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ] *= factor;
       }

       return new_Matrix;
     }

     public Matrix  multiply ( Matrix  right )
     //////////////////////////////////////////////////////////////////////
     {
       return multiply ( this, right );
     }

     public Matrix  randomizeUniform ( double  min, double  max )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  new_Matrix = new Matrix ( this.rows, this.cols );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ]
           = RandomLib.uniform ( min, max );
       }

       return new_Matrix;
     }

     public Matrix  sigmoid ( )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  new_Matrix = new Matrix ( this.rows, this.cols );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ]
           = MathLib.sigmoid ( this.data [ index_row ] [ index_col ] );
       }

       return new_Matrix;
     }

     public Matrix  sigmoidDerivative ( )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  new_Matrix = new Matrix ( this.rows, this.cols );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ]
           = MathLib.sigmoidDerivative
           ( this.data [ index_row ] [ index_col ] );
       }

       return new_Matrix;
     }

     public Matrix  submatrix (
       int  row_start, int  row_end,
       int  col_start, int  col_end )
     //////////////////////////////////////////////////////////////////////
     //  Note that the first row is row 0.
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  sub
         = new Matrix ( row_end - row_start + 1, col_end - col_start + 1 );
       for ( int index_row = 0; index_row < sub.rows; index_row++ )
       for ( int index_col = 0; index_col < sub.cols; index_col++ )
       {
         sub.data [ index_row ] [ index_col ]
           = this.data [ index_row + row_start ] [ index_col + col_start ];
       }

       return sub;
     }

     public Matrix  subtract ( Matrix  subtractor )
     //////////////////////////////////////////////////////////////////////
     {
       if ( ( this.rows    != subtractor.rows    )
         || ( this.cols != subtractor.cols ) )
       {
         throw new ArrayIndexOutOfBoundsException (
           "Matrix.subtract ( Matrix ):  columns and rows not equal" );
       }

       Matrix  new_Matrix = new Matrix ( this );

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         new_Matrix.data [ index_row ] [ index_col ]
           -= subtractor.data [ index_row ] [ index_col ];
       }

       return new_Matrix;
     }

     public double  sum ( )
     //////////////////////////////////////////////////////////////////////
     {
       double  temp = 0.0;

       for ( int index_row = 0; index_row < this.rows; index_row++ )
       for ( int index_col = 0; index_col < this.cols; index_col++ )
       {
         temp += this.data [ index_row ] [ index_col ];
       }

       return temp;
     }

     public Matrix  transpose ( )
     //////////////////////////////////////////////////////////////////////
     {
       Matrix  transposed = new Matrix ( this.cols, this.rows );

       for ( int index_row = 0;
                 index_row < transposed.rows;
                 index_row++ )
       for ( int index_col = 0;
                 index_col < transposed.cols;
                 index_col++ )
       {
         transposed.data [ index_row ] [ index_col ]
           = this.data [ index_col ] [ index_row ];
       }

       return transposed;
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久男人中文字幕资源站| 欧美在线视频不卡| 亚洲精品在线观| 久久99国产精品尤物| 日韩欧美中文一区二区| 久久精品国产999大香线蕉| 日韩区在线观看| 黑人巨大精品欧美一区| 国产女同性恋一区二区| 成人黄色免费短视频| 18欧美乱大交hd1984| 一本色道a无线码一区v| 亚洲va国产va欧美va观看| 日韩一区二区三区在线视频| 韩国午夜理伦三级不卡影院| 中文字幕va一区二区三区| 色一情一乱一乱一91av| 日韩av在线播放中文字幕| 久久久久久久久久美女| 94-欧美-setu| 日韩精品国产欧美| 久久久99精品久久| 91丨porny丨国产| 丝袜美腿亚洲一区| 欧美激情在线观看视频免费| 99精品国产99久久久久久白柏| 亚洲午夜私人影院| 精品va天堂亚洲国产| 色婷婷综合久久久中文字幕| 蜜臀av国产精品久久久久| 国产精品视频九色porn| 欧美日韩视频在线观看一区二区三区| 久久精品国产99国产| 亚洲欧美激情一区二区| 欧美成人欧美edvon| 91视频观看视频| 精品一区二区在线视频| 亚洲美女视频一区| 精品91自产拍在线观看一区| 色婷婷久久99综合精品jk白丝| 精品写真视频在线观看| 一区二区久久久| 国产午夜亚洲精品理论片色戒| 欧美日韩成人综合天天影院 | 国产欧美精品区一区二区三区 | 亚洲婷婷综合久久一本伊一区| 欧美精品久久久久久久多人混战| 东方aⅴ免费观看久久av| 亚洲成人777| 最新欧美精品一区二区三区| 精品日产卡一卡二卡麻豆| 欧美制服丝袜第一页| 岛国精品一区二区| 久久国产欧美日韩精品| 亚洲国产精品一区二区久久恐怖片| 国产亚洲婷婷免费| 欧美一区永久视频免费观看| 欧美性生活久久| 成人精品一区二区三区四区 | 亚洲国产综合91精品麻豆| 久久久久久麻豆| 欧美电影免费观看高清完整版在线| 色综合久久66| 99久久久精品| 成人午夜在线免费| 丰满岳乱妇一区二区三区| 九一九一国产精品| 喷白浆一区二区| 日韩黄色免费电影| 午夜成人在线视频| 亚洲一区在线视频观看| 亚洲黄色免费电影| 久久不见久久见中文字幕免费| 亚洲福利电影网| 亚洲丶国产丶欧美一区二区三区| 亚洲人成网站影音先锋播放| 中文字幕日韩av资源站| 亚洲婷婷在线视频| 亚洲欧美色一区| 亚洲激情五月婷婷| 亚洲夂夂婷婷色拍ww47| 一区二区三区日韩在线观看| 亚洲综合在线免费观看| 一区二区三区免费看视频| 亚洲欧美视频一区| 亚洲在线视频一区| 亚洲电影激情视频网站| 视频在线在亚洲| 蜜臀av亚洲一区中文字幕| 九色porny丨国产精品| 韩国精品主播一区二区在线观看 | 成人黄色在线视频| 99re在线视频这里只有精品| 日本乱码高清不卡字幕| 欧美视频一区二区三区在线观看| 欧美日韩国产综合草草| 欧美一级久久久| 久久久三级国产网站| 国产精品毛片大码女人 | 亚洲精品免费视频| 一区二区三区精品视频| 三级欧美韩日大片在线看| 麻豆视频一区二区| 国产精品资源网站| 91亚洲男人天堂| 91精品国产91久久综合桃花| 国产日韩欧美高清在线| 一区二区在线看| 蜜桃av噜噜一区| caoporen国产精品视频| 欧美日韩免费在线视频| 精品国产凹凸成av人导航| 国产精品成人在线观看| 视频一区欧美精品| 国产91在线看| 欧美日韩dvd在线观看| 久久久精品免费免费| 亚洲欧美激情小说另类| 久久国产生活片100| 色综合天天在线| 2020日本不卡一区二区视频| 亚洲黄色尤物视频| 国产成人综合视频| 欧美亚洲日本国产| 久久久精品中文字幕麻豆发布| 亚洲综合成人在线视频| 韩国视频一区二区| 欧美日韩国产成人在线免费| 国产精品欧美久久久久无广告| 日韩av在线免费观看不卡| 91麻豆视频网站| 国产午夜精品久久| 日韩和的一区二区| 91香蕉视频在线| 久久久久久一级片| 日本欧美加勒比视频| 日本高清不卡一区| 国产欧美视频在线观看| 日本大胆欧美人术艺术动态| 色哦色哦哦色天天综合| 欧美国产综合一区二区| 捆绑调教一区二区三区| 欧美三区免费完整视频在线观看| 国产精品色呦呦| 国产精品一区二区三区四区| 欧美一区欧美二区| 亚洲一区二区三区国产| caoporn国产精品| 欧美激情一区二区三区不卡| 激情综合网最新| 欧美一卡二卡三卡| 亚洲动漫第一页| 日本久久电影网| 一色屋精品亚洲香蕉网站| 国产制服丝袜一区| 精品日韩在线观看| 精品中文av资源站在线观看| 欧美一区二区三区在线| 性感美女久久精品| 欧美亚洲一区三区| 亚洲国产日日夜夜| 欧美性一区二区| 亚洲一区二区美女| 欧美性受极品xxxx喷水| 亚洲一区在线播放| 欧美无砖专区一中文字| 亚洲影视在线观看| 欧美日韩一区二区欧美激情 | 蜜桃免费网站一区二区三区| 91精品综合久久久久久| 日韩精品乱码免费| 日韩欧美国产三级电影视频| 美国三级日本三级久久99| 日韩午夜激情视频| 黄网站免费久久| 欧美激情一区三区| 99re视频精品| 一区二区不卡在线视频 午夜欧美不卡在| 91农村精品一区二区在线| 亚洲另类中文字| 色婷婷久久一区二区三区麻豆| 亚洲国产视频网站| 欧美一区二区精品在线| 国产一区日韩二区欧美三区| 欧美韩国一区二区| 在线观看一区二区精品视频| 日韩精品电影一区亚洲| 亚洲精品在线一区二区| 成人黄页毛片网站| 亚洲一二三区在线观看| 91精品国产综合久久久蜜臀粉嫩 | 91麻豆高清视频| 亚洲一区在线观看免费 | 91看片淫黄大片一级在线观看| 亚洲精品老司机| 宅男在线国产精品| 国产一区二区不卡在线| 亚洲人被黑人高潮完整版| 欧美日韩aaa| 福利电影一区二区三区|