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

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

?? matrix.java~1~

?? 一個一元曲線多項式數值演示例子
?? JAVA~1~
字號:
package numbercruncher.matrix;

import numbercruncher.mathutils.AlignRight;

/**
 * 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();
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一级片在线播放| 欧美日韩日日骚| 午夜久久久久久久久久一区二区| 日韩欧美电影一二三| 91视视频在线直接观看在线看网页在线看| 丝袜美腿高跟呻吟高潮一区| 国产精品白丝在线| 日韩欧美亚洲另类制服综合在线| 97成人超碰视| 国产成人精品综合在线观看| 天天综合色天天综合色h| 亚洲少妇中出一区| 国产校园另类小说区| 日韩欧美电影一区| 欧美日韩国产高清一区二区| 99精品久久只有精品| 国产精品羞羞答答xxdd| 另类欧美日韩国产在线| 天天做天天摸天天爽国产一区 | 欧美日韩国产免费| 粉嫩在线一区二区三区视频| 久久国内精品视频| 三级亚洲高清视频| 五月婷婷另类国产| 亚洲一区二区三区国产| 最新国产精品久久精品| 日本一区二区三区在线不卡| 久久这里只有精品视频网| 日韩精品一区在线观看| 欧美电影精品一区二区| 欧美一级黄色片| 欧美一级黄色录像| 日韩欧美的一区二区| 日韩欧美国产麻豆| 日韩色视频在线观看| 日韩午夜激情免费电影| 日韩精品一区在线观看| 日韩一区二区不卡| 久久夜色精品国产噜噜av| 久久综合久久久久88| 久久色成人在线| 国产亚洲欧美中文| 国产精品无人区| 亚洲欧洲一区二区在线播放| 国产精品色在线观看| 亚洲欧洲一区二区三区| 亚洲精品你懂的| 一区二区国产盗摄色噜噜| 一区二区高清在线| 性久久久久久久久久久久| 午夜欧美2019年伦理| 丝袜诱惑制服诱惑色一区在线观看| 视频一区二区国产| 精品一二三四区| 成人涩涩免费视频| 国产在线一区二区综合免费视频| **性色生活片久久毛片| 一区二区三区不卡在线观看| 首页国产丝袜综合| 精品影院一区二区久久久| 国产成人高清在线| 91理论电影在线观看| 欧美日韩精品一区视频| 日韩欧美激情一区| 欧美国产精品中文字幕| 一区二区欧美在线观看| 日韩国产欧美在线播放| 国产成人午夜99999| 一本一道久久a久久精品 | 欧美日韩精品欧美日韩精品一| 欧美高清一级片在线| 精品福利视频一区二区三区| 国产精品久久久久久久久久免费看 | 成a人片国产精品| 在线亚洲一区观看| 日韩片之四级片| 国产精品国产三级国产有无不卡 | 午夜精品久久久久久久| 精品亚洲国内自在自线福利| 成人av午夜电影| 欧美卡1卡2卡| 欧美激情在线观看视频免费| 午夜亚洲国产au精品一区二区| 久久精品久久精品| 一本大道综合伊人精品热热| 欧美一二三四在线| 亚洲欧美日韩一区二区三区在线观看| 五月婷婷欧美视频| 成人深夜福利app| 欧美一区二区三区思思人| 国产精品久久三区| 久久99精品久久久久婷婷| 91久久精品国产91性色tv| 精品久久久网站| 亚洲国产精品一区二区久久恐怖片| 九一久久久久久| 欧美在线观看视频一区二区| 亚洲国产成人午夜在线一区| 麻豆精品一区二区综合av| 色婷婷亚洲综合| 国产区在线观看成人精品| 日日夜夜一区二区| 色综合天天天天做夜夜夜夜做| 日韩欧美在线1卡| 亚洲国产一区二区三区| 不卡区在线中文字幕| 精品国产凹凸成av人导航| 午夜精品久久久久久久久| 99久久国产免费看| 国产午夜亚洲精品不卡| 久久精品99久久久| 欧美日本免费一区二区三区| 一区二区三区资源| 福利一区福利二区| 久久婷婷色综合| 久88久久88久久久| 欧美一区二区三区电影| 香蕉成人啪国产精品视频综合网| 99久久精品免费观看| 国产色婷婷亚洲99精品小说| 中文一区在线播放| 亚洲成人av电影在线| 91性感美女视频| 亚洲人成网站精品片在线观看| 国产福利一区在线| 国产亚洲精品资源在线26u| 久久丁香综合五月国产三级网站| 欧美性videosxxxxx| 一区二区三区在线播放| 色婷婷综合久久久久中文| 中文字幕一区二区三区精华液| 福利一区二区在线观看| 国产精品无圣光一区二区| 成人黄色大片在线观看| 国产精品久久夜| 91片在线免费观看| 亚洲愉拍自拍另类高清精品| 欧美在线一区二区三区| 亚洲综合丝袜美腿| 91黄视频在线观看| 亚洲最新视频在线观看| 欧美影视一区在线| 午夜视频在线观看一区| 制服丝袜av成人在线看| 毛片av中文字幕一区二区| 精品少妇一区二区三区| 国产成人在线电影| 国产精品第四页| 91国产精品成人| 日本亚洲天堂网| 26uuu久久天堂性欧美| 福利91精品一区二区三区| **性色生活片久久毛片| 欧美三级中文字幕在线观看| 日韩av一区二| 欧美精品一区二区高清在线观看| 国产东北露脸精品视频| 亚洲欧洲99久久| 欧美欧美欧美欧美首页| 美女爽到高潮91| 国产精品欧美久久久久无广告| 99久久久精品免费观看国产蜜| 亚洲黄色av一区| 欧美v日韩v国产v| 成人av在线播放网址| 亚洲午夜激情av| 久久综合色8888| 色猫猫国产区一区二在线视频| 亚洲成人动漫精品| 久久精品视频网| 欧美色综合网站| 国产在线精品一区二区夜色| 国产精品国产三级国产a| 欧美精品 国产精品| 国产成人午夜精品5599| 亚洲成人午夜电影| 久久久蜜臀国产一区二区| 91成人看片片| 国产一区不卡在线| 亚洲va在线va天堂| 欧美国产精品v| 5858s免费视频成人| 成人免费看的视频| 麻豆91免费观看| 一区二区三区四区五区视频在线观看| 日韩欧美亚洲国产精品字幕久久久| caoporen国产精品视频| 欧美aⅴ一区二区三区视频| 国产精品久久久久四虎| 日韩三级.com| 欧美体内she精高潮| 高潮精品一区videoshd| 久久国产麻豆精品| 一区二区三区av电影| 国产亲近乱来精品视频| 欧美久久久久久久久| 一本大道久久精品懂色aⅴ| 国产一区二区女| 男女激情视频一区| 亚洲亚洲精品在线观看|