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

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

?? matrix.java

?? java程序包
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package com.biolab.node.nexTest.Jama;

import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.text.FieldPosition;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.StreamTokenizer;

/**
   Jama = Java Matrix class.
<P>
   The Java Matrix Class provides the fundamental operations of numerical
   linear algebra.  Various constructors create Matrices from two dimensional
   arrays of double precision floating point numbers.  Various "gets" and
   "sets" provide access to submatrices and matrix elements.  Several methods
   implement basic matrix arithmetic, including matrix addition and
   multiplication, matrix norms, and element-by-element array operations.
   Methods for reading and printing matrices are also included.  All the
   operations in this version of the Matrix Class involve real matrices.
   Complex matrices may be handled in a future version.
<P>
   Five fundamental matrix decompositions, which consist of pairs or triples
   of matrices, permutation vectors, and the like, produce results in five
   decomposition classes.  These decompositions are accessed by the Matrix
   class to compute solutions of simultaneous linear equations, determinants,
   inverses and other matrix functions.  The five decompositions are:
<P><UL>
   <LI>Cholesky Decomposition of symmetric, positive definite matrices.
   <LI>LU Decomposition of rectangular matrices.
   <LI>QR Decomposition of rectangular matrices.
   <LI>Singular Value Decomposition of rectangular matrices.
   <LI>Eigenvalue Decomposition of both symmetric and nonsymmetric square matrices.
</UL>
<DL>
<DT><B>Example of use:</B></DT>
<P>
<DD>Solve a linear system A x = b and compute the residual norm, ||b - A x||.
<P><PRE>
      double[][] vals = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}};
      Matrix A = new Matrix(vals);
      Matrix b = Matrix.random(3,1);
      Matrix x = A.solve(b);
      Matrix r = A.times(x).minus(b);
      double rnorm = r.normInf();
</PRE></DD>
</DL>

@author The MathWorks, Inc. and the National Institute of Standards and Technology.
@version 5 August 1998
*/

public class Matrix implements Cloneable, java.io.Serializable {

/* ------------------------
   Class variables
 * ------------------------ */

   /** Array for internal storage of elements.
   @serial internal array storage.
   */
   private double[][] A;

   /** Row and column dimensions.
   @serial row dimension.
   @serial column dimension.
   */
   private int m, n;

/* ------------------------
   Constructors
 * ------------------------ */

   /** Construct an m-by-n matrix of zeros.
   @param m    Number of rows.
   @param n    Number of colums.
   */

   public Matrix (int m, int n) {
      this.m = m;
      this.n = n;
      A = new double[m][n];
   }

   /** Construct an m-by-n constant matrix.
   @param m    Number of rows.
   @param n    Number of colums.
   @param s    Fill the matrix with this scalar value.
   */

   public Matrix (int m, int n, double s) {
      this.m = m;
      this.n = n;
      A = new double[m][n];
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            A[i][j] = s;
         }
      }
   }

   /** Construct a matrix from a 2-D array.
   @param A    Two-dimensional array of doubles.
   @exception  IllegalArgumentException All rows must have the same length
   @see        #constructWithCopy
   */

   public Matrix (double[][] A) {
      m = A.length;
      n = A[0].length;
      for (int i = 0; i < m; i++) {
         if (A[i].length != n) {
            throw new IllegalArgumentException("All rows must have the same length.");
         }
      }
      this.A = A;
   }

   /** Construct a matrix quickly without checking arguments.
   @param A    Two-dimensional array of doubles.
   @param m    Number of rows.
   @param n    Number of colums.
   */

   public Matrix (double[][] A, int m, int n) {
      this.A = A;
      this.m = m;
      this.n = n;
   }

   /** Construct a matrix from a one-dimensional packed array
   @param vals One-dimensional array of doubles, packed by columns (ala Fortran).
   @param m    Number of rows.
   @exception  IllegalArgumentException Array length must be a multiple of m.
   */

   public Matrix (double vals[], int m) {
      this.m = m;
      n = (m != 0 ? vals.length/m : 0);
      if (m*n != vals.length) {
         throw new IllegalArgumentException("Array length must be a multiple of m.");
      }
      A = new double[m][n];
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            A[i][j] = vals[i+j*m];
         }
      }
   }

/* ------------------------
   Public Methods
 * ------------------------ */

   /** Construct a matrix from a copy of a 2-D array.
   @param A    Two-dimensional array of doubles.
   @exception  IllegalArgumentException All rows must have the same length
   */

   public static Matrix constructWithCopy(double[][] A) {
      int m = A.length;
      int n = A[0].length;
      Matrix X = new Matrix(m,n);
      double[][] C = X.getArray();
      for (int i = 0; i < m; i++) {
         if (A[i].length != n) {
            throw new IllegalArgumentException
               ("All rows must have the same length.");
         }
         for (int j = 0; j < n; j++) {
            C[i][j] = A[i][j];
         }
      }
      return X;
   }

   /** Make a deep copy of a matrix
   */

   public Matrix copy () {
      Matrix X = new Matrix(m,n);
      double[][] C = X.getArray();
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            C[i][j] = A[i][j];
         }
      }
      return X;
   }

   /** Clone the Matrix object.
   */

   public Object clone () {
      return this.copy();
   }

   /** Access the internal two-dimensional array.
   @return     Pointer to the two-dimensional array of matrix elements.
   */

   public double[][] getArray () {
      return A;
   }

   /** Copy the internal two-dimensional array.
   @return     Two-dimensional array copy of matrix elements.
   */

   public double[][] getArrayCopy () {
      double[][] C = new double[m][n];
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            C[i][j] = A[i][j];
         }
      }
      return C;
   }

   /** Make a one-dimensional column packed copy of the internal array.
   @return     Matrix elements packed in a one-dimensional array by columns.
   */

   public double[] getColumnPackedCopy () {
      double[] vals = new double[m*n];
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            vals[i+j*m] = A[i][j];
         }
      }
      return vals;
   }

   /** Make a one-dimensional row packed copy of the internal array.
   @return     Matrix elements packed in a one-dimensional array by rows.
   */

   public double[] getRowPackedCopy () {
      double[] vals = new double[m*n];
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            vals[i*n+j] = A[i][j];
         }
      }
      return vals;
   }

   /** Get row dimension.
   @return     m, the number of rows.
   */

   public int getRowDimension () {
      return m;
   }

   /** Get column dimension.
   @return     n, the number of columns.
   */

   public int getColumnDimension () {
      return n;
   }

   /** Get a single element.
   @param i    Row index.
   @param j    Column index.
   @return     A(i,j)
   @exception  ArrayIndexOutOfBoundsException
   */

   public double get (int i, int j) {
      return A[i][j];
   }

   /** Get a submatrix.
   @param i0   Initial row index
   @param i1   Final row index
   @param j0   Initial column index
   @param j1   Final column index
   @return     A(i0:i1,j0:j1)
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public Matrix getMatrix (int i0, int i1, int j0, int j1) {
      Matrix X = new Matrix(i1-i0+1,j1-j0+1);
      double[][] B = X.getArray();
      try {
         for (int i = i0; i <= i1; i++) {
            for (int j = j0; j <= j1; j++) {
               B[i-i0][j-j0] = A[i][j];
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
      return X;
   }

   /** Get a submatrix.
   @param r    Array of row indices.
   @param c    Array of column indices.
   @return     A(r(:),c(:))
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public Matrix getMatrix (int[] r, int[] c) {
      Matrix X = new Matrix(r.length,c.length);
      double[][] B = X.getArray();
      try {
         for (int i = 0; i < r.length; i++) {
            for (int j = 0; j < c.length; j++) {
               B[i][j] = A[r[i]][c[j]];
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
      return X;
   }

   /** Get a submatrix.
   @param i0   Initial row index
   @param i1   Final row index
   @param c    Array of column indices.
   @return     A(i0:i1,c(:))
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public Matrix getMatrix (int i0, int i1, int[] c) {
      Matrix X = new Matrix(i1-i0+1,c.length);
      double[][] B = X.getArray();
      try {
         for (int i = i0; i <= i1; i++) {
            for (int j = 0; j < c.length; j++) {
               B[i-i0][j] = A[i][c[j]];
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
      return X;
   }

   /** Get a submatrix.
   @param r    Array of row indices.
   @param i0   Initial column index
   @param i1   Final column index
   @return     A(r(:),j0:j1)
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public Matrix getMatrix (int[] r, int j0, int j1) {
      Matrix X = new Matrix(r.length,j1-j0+1);
      double[][] B = X.getArray();
      try {
         for (int i = 0; i < r.length; i++) {
            for (int j = j0; j <= j1; j++) {
               B[i][j-j0] = A[r[i]][j];
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
      return X;
   }

   /** Set a single element.
   @param i    Row index.
   @param j    Column index.
   @param s    A(i,j).
   @exception  ArrayIndexOutOfBoundsException
   */

   public void set (int i, int j, double s) {
      A[i][j] = s;
   }

   /** Set a submatrix.
   @param i0   Initial row index
   @param i1   Final row index
   @param j0   Initial column index
   @param j1   Final column index
   @param X    A(i0:i1,j0:j1)
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public void setMatrix (int i0, int i1, int j0, int j1, Matrix X) {
      try {
         for (int i = i0; i <= i1; i++) {
            for (int j = j0; j <= j1; j++) {
               A[i][j] = X.get(i-i0,j-j0);
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
   }

   /** Set a submatrix.
   @param r    Array of row indices.
   @param c    Array of column indices.
   @param X    A(r(:),c(:))
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public void setMatrix (int[] r, int[] c, Matrix X) {
      try {
         for (int i = 0; i < r.length; i++) {
            for (int j = 0; j < c.length; j++) {
               A[r[i]][c[j]] = X.get(i,j);
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
   }

   /** Set a submatrix.
   @param r    Array of row indices.
   @param j0   Initial column index
   @param j1   Final column index
   @param X    A(r(:),j0:j1)
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public void setMatrix (int[] r, int j0, int j1, Matrix X) {
      try {
         for (int i = 0; i < r.length; i++) {
            for (int j = j0; j <= j1; j++) {
               A[r[i]][j] = X.get(i,j-j0);
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
   }

   /** Set a submatrix.
   @param i0   Initial row index
   @param i1   Final row index
   @param c    Array of column indices.
   @param X    A(i0:i1,c(:))
   @exception  ArrayIndexOutOfBoundsException Submatrix indices
   */

   public void setMatrix (int i0, int i1, int[] c, Matrix X) {
      try {
         for (int i = i0; i <= i1; i++) {
            for (int j = 0; j < c.length; j++) {
               A[i][c[j]] = X.get(i-i0,j);
            }
         }
      } catch(ArrayIndexOutOfBoundsException e) {
         throw new ArrayIndexOutOfBoundsException("Submatrix indices");
      }
   }

   /** Matrix transpose.
   @return    A'
   */

   public Matrix transpose () {
      Matrix X = new Matrix(n,m);
      double[][] C = X.getArray();
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            C[j][i] = A[i][j];
         }
      }
      return X;
   }

   /** One norm
   @return    maximum column sum.
   */

   public double norm1 () {
      double f = 0;
      for (int j = 0; j < n; j++) {
         double s = 0;
         for (int i = 0; i < m; i++) {
            s += Math.abs(A[i][j]);
         }
         f = Math.max(f,s);
      }
      return f;
   }

   /** Two norm
   @return    maximum singular value.
   */

   public double norm2 () {
      return (new SingularValueDecomposition(this).norm2());
   }

   /** Infinity norm
   @return    maximum row sum.
   */

   public double normInf () {
      double f = 0;
      for (int i = 0; i < m; i++) {
         double s = 0;
         for (int j = 0; j < n; j++) {
            s += Math.abs(A[i][j]);
         }
         f = Math.max(f,s);
      }
      return f;
   }

   /** Frobenius norm
   @return    sqrt of sum of squares of all elements.
   */

   public double normF () {
      double f = 0;
      for (int i = 0; i < m; i++) {
         for (int j = 0; j < n; j++) {
            f = Maths.hypot(f,A[i][j]);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美人妖巨大在线| 蜜桃一区二区三区在线| 成人免费视频免费观看| 欧美激情一区不卡| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 国产精品女同互慰在线看| 风流少妇一区二区| 久久先锋影音av鲁色资源 | 久久成人综合网| 久久久久久久综合狠狠综合| 成人一区二区三区| 一区二区高清视频在线观看| 欧美妇女性影城| 国产一区二区三区四区五区美女| 亚洲国产精品精华液ab| 欧美在线不卡一区| 久久精品免费看| 亚洲欧洲日产国码二区| 欧美日韩免费不卡视频一区二区三区| 蜜臀久久99精品久久久久久9| 国产日韩欧美精品电影三级在线| jlzzjlzz欧美大全| 三级不卡在线观看| 国产精品黄色在线观看| 欧美高清www午色夜在线视频| 国产一区不卡视频| 一区二区欧美国产| 久久这里只有精品首页| 欧美亚洲日本一区| 国产.精品.日韩.另类.中文.在线.播放| 国产精品国产三级国产有无不卡 | 国产不卡视频一区| 亚洲大片在线观看| 中文字幕av一区二区三区免费看 | 欧美一区二区三区日韩视频| 国产成人免费xxxxxxxx| 日韩不卡一区二区| 国产精品美女久久久久高潮| 欧美一二三区精品| 日本高清成人免费播放| 国产91精品一区二区麻豆网站| 亚洲精品国产成人久久av盗摄| 亚洲美女偷拍久久| 精品国产亚洲一区二区三区在线观看| 成人午夜视频网站| 亚洲精品久久久蜜桃| 久久精品一区二区| 欧美一区二区三区电影| 在线观看日韩毛片| 宅男噜噜噜66一区二区66| 日日摸夜夜添夜夜添精品视频| 日韩一区二区在线播放| 一本一道久久a久久精品| 韩国女主播一区二区三区| 亚洲va韩国va欧美va| 成人免费一区二区三区视频| 精品国产第一区二区三区观看体验| 在线欧美日韩精品| 99久久精品免费精品国产| 国产成人免费av在线| 美女脱光内衣内裤视频久久网站 | 国产片一区二区| 日本韩国一区二区| 国产精品性做久久久久久| 日本大胆欧美人术艺术动态| 亚洲欧美另类综合偷拍| 国产午夜精品久久久久久久| 精品福利视频一区二区三区| 欧美久久久久久蜜桃| 在线看不卡av| 91官网在线观看| 日本电影欧美片| 色综合视频一区二区三区高清| 成人在线视频首页| 成人短视频下载| 国产中文字幕一区| 国产一区二区三区四区五区美女 | 日韩欧美二区三区| 欧美mv和日韩mv国产网站| 精品国产一区二区精华| 91精品久久久久久久久99蜜臂| 日韩欧美的一区| 5566中文字幕一区二区电影| 欧美在线小视频| 欧美亚洲日本国产| 69精品人人人人| 欧美一级欧美一级在线播放| 欧美一区二区免费视频| 美女国产一区二区三区| 成人的网站免费观看| 亚洲精品日韩一| 免费欧美在线视频| 国产福利不卡视频| 国产福利视频一区二区三区| 国产成人免费视频一区| 国产1区2区3区精品美女| a级精品国产片在线观看| 在线日韩一区二区| 日韩三级视频中文字幕| 久久久亚洲欧洲日产国码αv| 欧美国产成人在线| 亚洲电影在线播放| 美国十次综合导航| 国产黄人亚洲片| 在线看国产日韩| 久久综合色鬼综合色| 国产精品成人免费| 日韩精品五月天| 国产成人免费视频网站| 欧美三级日韩三级| 久久久久国产精品麻豆| 一区二区三区四区蜜桃| 免费观看一级欧美片| 成人国产亚洲欧美成人综合网| 欧美综合天天夜夜久久| 精品国产欧美一区二区| 中文字幕一区在线| 免费看黄色91| 99re6这里只有精品视频在线观看| 91麻豆精品国产自产在线| 国产精品视频麻豆| 日韩黄色免费网站| www.欧美亚洲| 日韩一二三区不卡| 一区二区在线观看不卡| 久久综合综合久久综合| 欧洲一区二区av| 欧美激情一区不卡| 美日韩黄色大片| 欧美综合在线视频| 国产精品你懂的在线| 人人超碰91尤物精品国产| 91片在线免费观看| 久久女同精品一区二区| 五月天激情综合| 97精品久久久久中文字幕| 精品国产污网站| 视频一区中文字幕| 欧美日韩在线精品一区二区三区激情| 国产色产综合产在线视频| 人禽交欧美网站| 精品视频在线视频| 亚洲视频一二三| 成人精品鲁一区一区二区| 欧美变态tickle挠乳网站| 性做久久久久久免费观看欧美| 91蝌蚪porny| 欧美激情一区在线观看| 国产一区二区三区不卡在线观看 | 欧美高清性hdvideosex| 亚洲欧美经典视频| 成人免费毛片片v| 久久久蜜臀国产一区二区| 日本成人在线不卡视频| 欧美色图片你懂的| 亚洲成人tv网| 欧美日韩国产小视频在线观看| 一卡二卡三卡日韩欧美| 91影院在线观看| 亚洲三级电影网站| 色综合咪咪久久| 亚洲人成网站色在线观看| 91丨porny丨蝌蚪视频| 中文字幕av一区二区三区| 国产精品一级二级三级| 欧美激情综合网| 国产激情视频一区二区三区欧美| 精品国产乱码久久久久久久久| 久久精品国产精品青草| 精品久久免费看| 国产美女在线精品| 国产女主播在线一区二区| 在线不卡免费av| 日产精品久久久久久久性色| 91精品国产入口| 国产一区二区影院| 国产精品午夜电影| www..com久久爱| 亚洲一区成人在线| 欧美在线|欧美| 日本在线不卡一区| 日韩精品在线看片z| 国产传媒日韩欧美成人| 国产精品毛片大码女人| 99国产精品视频免费观看| 一区二区久久久久| 日韩视频一区在线观看| 欧美午夜理伦三级在线观看| 亚洲国产成人porn| 日韩欧美国产精品一区| 国产一区二区三区精品欧美日韩一区二区三区| 精品粉嫩aⅴ一区二区三区四区| 粉嫩av亚洲一区二区图片| 自拍av一区二区三区| 一本色道久久加勒比精品| 日本欧美加勒比视频| 久久精品网站免费观看| 91麻豆swag| 蜜桃av一区二区| 国产精品免费视频观看|