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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? matrix.java

?? 一個(gè)一元曲線多項(xiàng)式數(shù)值演示例子
?? JAVA
字號(hào):
package numbercruncher.matrix;

import numbercruncher.mathutils.*;

/**
 * The matrix class.
 */
public class Matrix {
  /** number of rows */
  protected int nRows;
  /** number of columns */
  protected int nCols;
  /** 2-d array of  values */
  protected float values[][];

  //--------------//
  // Constructors //
  //--------------//

  /**
   * Default constructor.
   */
  protected Matrix() {}

  /**
   * Constructor.
   * @param rowCount the number of rows
   * @param colCount the number of columns
   */
  public Matrix(int rowCount, int colCount) {
    nRows = (rowCount > 0) ? rowCount : 1;
    nCols = (colCount > 0) ? colCount : 1;
    values = new float[nRows][nCols];
  }

  /**
   * Constructor.
   * @param values the 2-d array of values
   */
  public Matrix(float values[][]) {
    set(values);
  }

  //---------//
  // Getters //
  //---------//

  /**
   * Get the row count.
   * @return the row count
   */
  public int rowCount() {
    return nRows;
  }

  /**
   * Get the column count.
   * @return the column count
   */
  public int columnCount() {
    return nCols;
  }

  /**
   * Get the value of element [r,c] in the matrix.
   * @param r the row index
   * @param c the column index
   * @return the value
   * @throws numbercruncher.MatrixException for an invalid index
   */
  public float at(int r, int c) throws MatrixException {
    if ( (r < 0) || (r >= nRows) || (c < 0) || (c >= nCols)) {
      throw new MatrixException(MatrixException.INVALID_INDEX);
    }

    return values[r][c];
  }

  /**
   * Get a row of this matrix.
   * @param r the row index
   * @return the row as a row vector
   * @throws numbercruncher.MatrixException for an invalid index
   */
  public RowVector getRow(int r) throws MatrixException {
    if ( (r < 0) || (r >= nRows)) {
      throw new MatrixException(MatrixException.INVALID_INDEX);
    }

    RowVector rv = new RowVector(nCols);
    for (int c = 0; c < nCols; ++c) {
      rv.values[0][c] = this.values[r][c];
    }

    return rv;
  }

  /**
   * Get a column of this matrix.
   * @param c the column index
   * @return the column as a column vector
   * @throws numbercruncher.MatrixException for an invalid index
   */
  public ColumnVector getColumn(int c) throws MatrixException {
    if ( (c < 0) || (c >= nCols)) {
      throw new MatrixException(MatrixException.INVALID_INDEX);
    }

    ColumnVector cv = new ColumnVector(nRows);
    for (int r = 0; r < nRows; ++r) {
      cv.values[r][0] = this.values[r][c];
    }

    return cv;
  }

  /**
   * Copy the values of this matrix.
   * @return the values
   */
  public float[][] values() {
    return values;
  }

  /**
   * Copy the values of this matrix.
   * @return the copied values
   */
  public float[][] copyValues2D() {
    float v[][] = new float[nRows][nCols];

    for (int r = 0; r < nRows; ++r) {
      for (int c = 0; c < nCols; ++c) {
        v[r][c] = values[r][c];
      }
    }

    return v;
  }

  //---------//
  // Setters //
  //---------//

  /**
   * Set the value of element [r,c].
   * @param r the row index
   * @param c the column index
   * @param value the value
   * @throws numbercruncher.MatrixException for an invalid index
   */
  public void set(int r, int c, float value) throws MatrixException {
    if ( (r < 0) || (r >= nRows) || (c < 0) || (c >= nCols)) {
      throw new MatrixException(MatrixException.INVALID_INDEX);
    }

    values[r][c] = value;
  }

  /**
   * Set this matrix from a 2-d array of values.
   * If the rows do not have the same length, then the matrix
   * column count is the length of the shortest row.
   * @param values the 2-d array of values
   */
  protected void set(float values[][]) {
    this.nRows = values.length;
    this.nCols = values[0].length;
    this.values = values;

    for (int r = 1; r < nRows; ++r) {
      nCols = Math.min(nCols, values[r].length);
    }
  }

  /**
   * Set a row of this matrix from a row vector.
   * @param rv the row vector
   * @param r the row index
   * @throws numbercruncher.MatrixException for an invalid index or
   *                                        an invalid vector size
   */
  public void setRow(RowVector rv, int r) throws MatrixException {
    if ( (r < 0) || (r >= nRows)) {
      throw new MatrixException(MatrixException.INVALID_INDEX);
    }
    if (nCols != rv.nCols) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    for (int c = 0; c < nCols; ++c) {
      this.values[r][c] = rv.values[0][c];
    }
  }

  /**
   * Set a column of this matrix from a column vector.
   * @param cv the column vector
   * @param c the column index
   * @throws numbercruncher.MatrixException for an invalid index or
   *                                        an invalid vector size
   */
  public void setColumn(ColumnVector cv, int c) throws MatrixException {
    if ( (c < 0) || (c >= nCols)) {
      throw new MatrixException(MatrixException.INVALID_INDEX);
    }
    if (nRows != cv.nRows) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    for (int r = 0; r < nRows; ++r) {
      this.values[r][c] = cv.values[r][0];
    }
  }

  //-------------------//
  // Matrix operations //
  //-------------------//

  /**
   * Return the transpose of this matrix.
   * @return the transposed matrix
   */
  public Matrix transpose() {
    float tv[][] = new float[nCols][nRows]; // transposed values

    // Set the values of the transpose.
    for (int r = 0; r < nRows; ++r) {
      for (int c = 0; c < nCols; ++c) {
        tv[c][r] = values[r][c];
      }
    }

    return new Matrix(tv);
  }

  /**
   * Add another matrix to this matrix.
   * @param m the matrix addend
   * @return the sum matrix
   * @throws numbercruncher.MatrixException for invalid size
   */
  public Matrix add(Matrix m) throws MatrixException {
    // Validate m's size.
    if ( (nRows != m.nRows) && (nCols != m.nCols)) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    float sv[][] = new float[nRows][nCols]; // sum values

    // Compute values of the sum.
    for (int r = 0; r < nRows; ++r) {
      for (int c = 0; c < nCols; ++c) {
        sv[r][c] = values[r][c] + m.values[r][c];
      }
    }

    return new Matrix(sv);
  }

  /**
   * Subtract another matrix from this matrix.
   * @param m the matrix subrrahend
   * @return the difference matrix
   * @throws numbercruncher.MatrixException for invalid size
   */
  public Matrix subtract(Matrix m) throws MatrixException {
    // Validate m's size.
    if ( (nRows != m.nRows) && (nCols != m.nCols)) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    float dv[][] = new float[nRows][nCols]; // difference values

    // Compute values of the difference.
    for (int r = 0; r < nRows; ++r) {
      for (int c = 0; c < nCols; ++c) {
        dv[r][c] = values[r][c] - m.values[r][c];
      }
    }

    return new Matrix(dv);
  }

  /**
   * Multiply this matrix by a constant.
   * @param k the constant
   * @return the product matrix
   */
  public Matrix multiply(float k) {
    float pv[][] = new float[nRows][nCols]; // product values

    // Compute values of the product.
    for (int r = 0; r < nRows; ++r) {
      for (int c = 0; c < nCols; ++c) {
        pv[r][c] = k * values[r][c];
      }
    }

    return new Matrix(pv);
  }

  /**
   * Multiply this matrix by another matrix.
   * @param m the matrix multiplier
   * @return the product matrix
   * @throws numbercruncher.MatrixException for invalid size
   */
  public Matrix multiply(Matrix m) throws MatrixException {
    // Validate m's dimensions.
    if (nCols != m.nRows) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    float pv[][] = new float[nRows][m.nCols]; // product values

    // Compute values of the product.
    for (int r = 0; r < nRows; ++r) {
      for (int c = 0; c < m.nCols; ++c) {
        float dot = 0;
        for (int k = 0; k < nCols; ++k) {
          dot += values[r][k] * m.values[k][c];
        }
        pv[r][c] = dot;
      }
    }

    return new Matrix(pv);
  }

  /**
   * Multiply this matrix by a column vector: this*cv
   * @param cv the column vector
   * @return the product column vector
   * @throws numbercruncher.MatrixException for invalid size
   */
  public ColumnVector multiply(ColumnVector cv) throws MatrixException {
    // Validate cv's size.
    if (nRows != cv.nRows) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    float pv[] = new float[nRows]; // product values

    // Compute the values of the product.
    for (int r = 0; r < nRows; ++r) {
      float dot = 0;
      for (int c = 0; c < nCols; ++c) {
        dot += values[r][c] * cv.values[c][0];
      }
      pv[r] = dot;
    }

    return new ColumnVector(pv);
  }

  /**
   * Multiply a row vector by this matrix: rv*this
   * @param rv the row vector
   * @return the product row vector
   * @throws numbercruncher.MatrixException for invalid size
   */
  public RowVector multiply(RowVector rv) throws MatrixException {
    // Validate rv's size.
    if (nCols != rv.nCols) {
      throw new MatrixException(
          MatrixException.INVALID_DIMENSIONS);
    }

    float pv[] = new float[nRows]; // product values

    // Compute the values of the product.
    for (int c = 0; c < nCols; ++c) {
      float dot = 0;
      for (int r = 0; r < nRows; ++r) {
        dot += rv.values[0][r] * values[r][c];
      }
      pv[c] = dot;
    }

    return new RowVector(pv);
  }

  /**
   * Print the matrix values.
   * @param width the column width
   */
  public void print(int width) {
    AlignRight ar = new AlignRight();

    for (int r = 0; r < nRows; ++r) {
      ar.print("Row ", 0);
      ar.print(r + 1, 2);
      ar.print(":", 0);

      for (int c = 0; c < nCols; ++c) {
        ar.print(values[r][c], width);
      }
      ar.println();
    }
  }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费在线视频| 日本一道高清亚洲日美韩| 亚洲男帅同性gay1069| 视频一区二区三区在线| gogo大胆日本视频一区| 日韩一区二区三区在线视频| 国产精品国产三级国产专播品爱网| 夜夜亚洲天天久久| 免费久久精品视频| 91在线视频官网| 国产视频一区在线观看 | 不卡的av中国片| 日韩精品一区二区三区四区视频 | 亚洲最大成人网4388xx| 青青草国产精品亚洲专区无| 色综合一区二区三区| 日韩欧美一级精品久久| 视频一区在线播放| 欧洲av在线精品| 亚洲人成网站色在线观看| 国产福利精品一区| 久久夜色精品国产噜噜av| 蜜臀av亚洲一区中文字幕| 欧美午夜在线一二页| 亚洲精品国产a久久久久久| 国产盗摄一区二区三区| 欧美日韩一区小说| 亚洲一区二区三区四区五区中文| 成人精品视频网站| 中文字幕精品综合| 青青草国产成人av片免费| 欧美亚洲动漫另类| 亚洲五码中文字幕| 91免费在线播放| 亚洲区小说区图片区qvod| 91网站最新网址| 亚洲综合视频在线| 色诱视频网站一区| 亚洲精品国产第一综合99久久| 99精品久久只有精品| 亚洲乱码国产乱码精品精小说 | 亚洲国产成人午夜在线一区| 黑人巨大精品欧美一区| 2020国产精品自拍| 丰满少妇在线播放bd日韩电影| 久久久777精品电影网影网| 国产精品一区二区在线看| 国产偷国产偷精品高清尤物| 成人免费看视频| 亚洲精品视频观看| 91精品国产91久久久久久一区二区| 日本最新不卡在线| 2欧美一区二区三区在线观看视频| 国产精品影视天天线| 国产精品久久久久久久久图文区| 91免费版在线| 日本在线播放一区二区三区| 久久综合九色综合久久久精品综合| 精品一区二区免费| 国产精品久久久久影院| 欧美亚洲精品一区| 国产麻豆精品95视频| 亚洲免费在线视频一区 二区| 717成人午夜免费福利电影| 国产一区美女在线| 亚洲自拍偷拍欧美| 精品国产一区二区在线观看| 国产精品中文字幕日韩精品| 久久久久9999亚洲精品| av电影在线观看一区| 日韩成人精品视频| 国产精品久久夜| 日韩女优av电影| 欧美a级一区二区| 国产精品久久久久久久蜜臀| 欧美一级艳片视频免费观看| 成人免费观看视频| 蜜桃精品视频在线观看| 久久美女高清视频| 在线电影欧美成精品| 成人精品高清在线| 麻豆91精品91久久久的内涵| 亚洲日本在线看| 精品国精品国产| 欧美日韩一二三区| 国产成人免费视频| 美女一区二区视频| 亚洲一区二区在线视频| 中文字幕av一区 二区| 91精品国产综合久久香蕉麻豆| 成人午夜视频在线观看| 免费成人在线影院| 亚洲一区在线观看网站| 国产精品福利影院| 精品国产髙清在线看国产毛片 | 欧美成人高清电影在线| 色噜噜狠狠色综合欧洲selulu| 国产成人免费在线观看| 美女高潮久久久| 日欧美一区二区| 一区二区三区四区在线免费观看| 中文字幕av在线一区二区三区| 精品对白一区国产伦| 制服丝袜日韩国产| 欧美日韩精品一区二区三区蜜桃| 一本久久综合亚洲鲁鲁五月天 | 欧美大片一区二区| 91高清视频免费看| av电影在线观看完整版一区二区| 国产精品亚洲综合一区在线观看| 久久草av在线| 久久精品久久久精品美女| 爽好久久久欧美精品| 亚洲成人免费观看| 亚洲一区二区三区视频在线播放 | 91蜜桃在线免费视频| 国产精品一级在线| 国精产品一区一区三区mba桃花| 秋霞午夜鲁丝一区二区老狼| 美女爽到高潮91| 美女看a上一区| 国产精品66部| 国产99久久精品| 成人av在线网站| 成人aaaa免费全部观看| 97精品久久久久中文字幕| 99久久国产综合色|国产精品| 97国产精品videossex| 91福利国产成人精品照片| 欧洲一区二区三区在线| 欧美男人的天堂一二区| 欧美一级午夜免费电影| 国产欧美日韩精品在线| 国产日韩视频一区二区三区| 欧美日韩三级一区二区| 日韩欧美高清在线| 国产色产综合产在线视频| 中文字幕一区av| 五月天欧美精品| 激情深爱一区二区| 不卡一区二区在线| 欧美视频一区二区三区四区| 日韩欧美一二三区| 中文字幕日韩一区| 午夜在线成人av| 国产jizzjizz一区二区| 在线观看91视频| xfplay精品久久| 亚洲码国产岛国毛片在线| 日韩成人一区二区三区在线观看| 久草中文综合在线| 91精品福利视频| 精品成a人在线观看| 日韩理论片中文av| 久久97超碰国产精品超碰| 97精品国产露脸对白| 精品嫩草影院久久| 亚洲精品乱码久久久久久黑人| 久久激情综合网| 在线观看不卡视频| 久久久.com| 日韩高清一级片| 一本色道久久综合狠狠躁的推荐| 日韩一卡二卡三卡四卡| 亚洲欧美电影一区二区| 久久精品国产99国产精品| 色素色在线综合| 久久精品人人做人人爽人人| 天天综合色天天| 色婷婷一区二区| 国产亚洲成av人在线观看导航| 亚洲成人动漫在线观看| 成人av在线播放网址| 久久久久久久久一| 蜜桃精品视频在线| 欧洲精品一区二区| 国产精品电影一区二区| 激情欧美一区二区三区在线观看| 欧美巨大另类极品videosbest| 国产精品的网站| 国产99久久久国产精品潘金| 日韩精品专区在线影院重磅| 午夜精品一区二区三区免费视频 | 精彩视频一区二区| 欧美日韩中文字幕一区| ...中文天堂在线一区| 国产v综合v亚洲欧| 精品久久久久久无| 麻豆精品视频在线观看免费| 欧美日韩一区二区欧美激情| 亚洲三级久久久| 94-欧美-setu| 亚洲视频电影在线| 91美女视频网站| 亚洲欧美激情插| 欧洲精品一区二区三区在线观看| 亚洲欧美日韩综合aⅴ视频| 91免费国产在线观看| 国产精品久久久99| 91丨九色丨尤物|