doublematrix.java

来自「一个利用条件随机场(CRF)开发的词性标注工具包」· Java 代码 · 共 64 行

JAVA
64
字号
/*    Copyright (C) 2006, Xuan-Hieu Phan        Email:	hieuxuan@ecei.tohoku.ac.jp		pxhieu@gmail.com    URL:	http://www.hori.ecei.tohoku.ac.jp/~hieuxuan        Graduate School of Information Sciences,    Tohoku University*/package crf.tagger;public class DoubleMatrix {    public double[][] mtrx = null;    public int rows = 0;    public int cols = 0;        public DoubleMatrix() {    }        public DoubleMatrix(int rows, int cols) {	this.rows = rows;	this.cols = cols;	mtrx = new double[rows][cols];    }        public DoubleMatrix(int rows, int cols, double[][] mtrx) {	this.rows = rows;	this.cols = cols;		this.mtrx = new double[rows][cols];    }        public DoubleMatrix(DoubleMatrix dm) {	rows = dm.rows;	cols = dm.cols;		mtrx = new double[rows][cols];		for (int i = 0; i < rows; i++) {	    for (int j = 0; j < cols; j++) {		mtrx[i][j] = dm.mtrx[i][j];	    }	}    }        public void assign(double val) {	for (int i = 0; i < rows; i++) {	    for (int j = 0; j < cols; j++) {		mtrx[i][j] = val;	    }	}    }        public void assign(DoubleMatrix dm) {	for (int i = 0; i < rows; i++) {	    for (int j = 0; j < cols; j++) {		mtrx[i][j] = dm.mtrx[i][j];	    }	}    }        } // end of class DoubleMatrix

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?