本文整理了Java中Jama.Matrix.set()
方法的一些代码示例,展示了Matrix.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.set()
方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:set
暂无
代码示例来源:origin: marytts/marytts
public double[] multipleLinearRegression(double[] datay, double[][] datax, boolean interceptTerm) {
if (datay == null || datax == null)
throw new NullPointerException("Null data");
b0Term = interceptTerm;
int rows = datay.length;
int cols = datax[0].length;
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols + 1);
coeffs = new double[cols + 1];
} else {
dataX = new Matrix(datax);
coeffs = new double[cols];
}
// If intercept, we need to add a ones column to dataX
if (interceptTerm) {
for (int i = 0; i < rows; i++) {
dataX.set(i, 0, 1.0);
for (int j = 1; j < cols + 1; j++)
dataX.set(i, j, datax[i][j - 1]);
}
}
multipleLinearRegression(datay, dataX);
return coeffs;
}
代码示例来源:origin: marytts/marytts
public void multipleLinearRegression(Matrix datay, Matrix dataX, boolean interceptTerm) {
b0Term = interceptTerm;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
int row = dataX.getRowDimension();
int col = dataX.getColumnDimension();
Matrix B = new Matrix(row, col + 1);
Matrix ones = new Matrix(row, 1);
for (int i = 0; i < row; i++)
ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, dataX);
multipleLinearRegression(datay, B);
} else {
multipleLinearRegression(datay, dataX);
}
}
代码示例来源:origin: stackoverflow.com
savedMatrix.set(matrix);
start.set(event.getX(), event.getY());
Log.d(TAG, "mode=DRAG");
Log.d(TAG, "oldDist=" + oldDist);
if (oldDist > 10f) {
savedMatrix.set(matrix);
midPoint(mid, event);
mode = ZOOM;
matrix.set(savedMatrix);
matrix.postTranslate(event.getX() - start.x, event.getY() - start.y);
} else if (mode == ZOOM) {
Log.d(TAG, "newDist=" + newDist);
if (newDist > 10f) {
matrix.set(savedMatrix);
float scale = newDist / oldDist;
matrix.postScale(scale, scale, mid.x, mid.y);
savedMatrix.set(matrix);
matrix.set(savedMatrix);
matrix.postScale(scale, scale, mid.x, mid.y);
setImageMatrix(matrix);
savedMatrix.set(matrix);
matrix.set(savedMatrix);
matrix.postTranslate(redundantXSpace, redundantYSpace);
setImageMatrix(matrix);
代码示例来源:origin: marytts/marytts
public double[] multipleLinearRegression(double[] datay, double[][] datax, boolean interceptTerm) {
if (datay == null || datax == null)
throw new NullPointerException("Null data");
b0Term = interceptTerm;
int rows = datay.length;
int cols = datax[0].length;
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols + 1);
coeffs = new double[cols + 1];
} else {
dataX = new Matrix(datax);
coeffs = new double[cols];
}
// If intercept, we need to add a ones column to dataX
if (interceptTerm) {
for (int i = 0; i < rows; i++) {
dataX.set(i, 0, 1.0);
for (int j = 1; j < cols + 1; j++)
dataX.set(i, j, datax[i][j - 1]);
}
}
multipleLinearRegression(datay, dataX);
return coeffs;
}
代码示例来源:origin: marytts/marytts
public void multipleLinearRegression(Matrix datay, Matrix dataX, boolean interceptTerm) {
b0Term = interceptTerm;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
int row = dataX.getRowDimension();
int col = dataX.getColumnDimension();
Matrix B = new Matrix(row, col + 1);
Matrix ones = new Matrix(row, 1);
for (int i = 0; i < row; i++)
ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, dataX);
multipleLinearRegression(datay, B);
} else {
multipleLinearRegression(datay, dataX);
}
}
代码示例来源:origin: marytts/marytts
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols + 1);
coeffs = new double[cols + 1];
} else {
dataX = new Matrix(rows, cols);
coeffs = new double[cols];
if (interceptTerm) {
dataX.set(i, 0, 1.0);
for (int j = 1; j < cols + 1; j++) {
dataX.set(i, j, vectorx.elementAt(n++));
dataX.set(i, j, vectorx.elementAt(n++));
代码示例来源:origin: marytts/marytts
{ 4.15, 7.60, 9.2 }, { 10.15, 4.83, 9.4 }, { 1.72, 3.12, 7.6 }, { 1.70, 5.30, 8.2 } };
Matrix A = new Matrix(xvals);
int row = A.getRowDimension();
int col = A.getColumnDimension();
A.print(row, 3);
Matrix B = new Matrix(row, col + 1);
Matrix ones = new Matrix(row, 1);
for (int i = 0; i < row; i++)
ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, A);
代码示例来源:origin: marytts/marytts
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols + 1);
coeffs = new double[cols + 1];
} else {
dataX = new Matrix(rows, cols);
coeffs = new double[cols];
if (interceptTerm) {
dataX.set(i, 0, 1.0);
for (int j = 1; j < cols + 1; j++) {
dataX.set(i, j, vectorx.elementAt(n++));
dataX.set(i, j, vectorx.elementAt(n++));
代码示例来源:origin: marytts/marytts
{ 4.15, 7.60, 9.2 }, { 10.15, 4.83, 9.4 }, { 1.72, 3.12, 7.6 }, { 1.70, 5.30, 8.2 } };
Matrix A = new Matrix(xvals);
int row = A.getRowDimension();
int col = A.getColumnDimension();
A.print(row, 3);
Matrix B = new Matrix(row, col + 1);
Matrix ones = new Matrix(row, 1);
for (int i = 0; i < row; i++)
ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, A);
代码示例来源:origin: marytts/marytts
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols);
coeffs = new double[cols];
} else {
dataX = new Matrix(rows, cols - 1);
coeffs = new double[cols - 1];
for (int i = 0; i < rows; i++) {
if (interceptTerm) {
dataX.set(i, 0, 1.0);
dataX.set(i, j, data[n++]);
} else { // No interceptTerm so no need to fill the first column with 1s
dataX.set(i, j, data[n++]);
代码示例来源:origin: marytts/marytts
int col = data.getColumnDimension();
Matrix B = new Matrix(row, col + 1);
Matrix ones = new Matrix(row, 1);
for (int i = 0; i < row; i++)
ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, data);
代码示例来源:origin: marytts/marytts
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols);
coeffs = new double[cols];
} else {
dataX = new Matrix(rows, cols - 1);
coeffs = new double[cols - 1];
for (int i = 0; i < rows; i++) {
if (interceptTerm) {
dataX.set(i, 0, 1.0);
dataX.set(i, j, data[n++]);
} else { // No interceptTerm so no need to fill the first column with 1s
dataX.set(i, j, data[n++]);
代码示例来源:origin: marytts/marytts
int col = data.getColumnDimension();
Matrix B = new Matrix(row, col + 1);
Matrix ones = new Matrix(row, 1);
for (int i = 0; i < row; i++)
ones.set(i, 0, 1.0);
B.setMatrix(0, row - 1, 0, 0, ones);
B.setMatrix(0, row - 1, 1, col, data);
代码示例来源:origin: marytts/marytts
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols);
coeffs = new double[cols];
} else {
dataX = new Matrix(rows, cols - 1);
coeffs = new double[cols - 1];
for (int i = 0; i < rows; i++) {
if (interceptTerm) {
dataX.set(i, 0, 1.0);
dataX.set(i, j, data.elementAt(n++));
} else { // No interceptTerm so no need to fill the first column with 1s
dataX.set(i, j, data.elementAt(n++));
代码示例来源:origin: openimaj/openimaj
@Override
public Matrix getTransform(){
Matrix m = new Matrix(3,3);
m.setMatrix(0, 1, 0,1,this.transform);
m.set(0, 2, 0);
m.set(1, 2, 0);
m.set(2, 2, 1);
return m;
}
代码示例来源:origin: marytts/marytts
Matrix dataX;
if (interceptTerm) { // first column of X is filled with 1s if b_0 != 0
dataX = new Matrix(rows, cols);
coeffs = new double[cols];
} else {
dataX = new Matrix(rows, cols - 1);
coeffs = new double[cols - 1];
for (int i = 0; i < rows; i++) {
if (interceptTerm) {
dataX.set(i, 0, 1.0);
dataX.set(i, j, data.elementAt(n++));
} else { // No interceptTerm so no need to fill the first column with 1s
dataX.set(i, j, data.elementAt(n++));
代码示例来源:origin: org.openimaj/image-local-features
@Override
public Matrix getTransform(){
Matrix m = new Matrix(3,3);
m.setMatrix(0, 1, 0,1,this.transform);
m.set(0, 2, 0);
m.set(1, 2, 0);
m.set(2, 2, 1);
return m;
}
代码示例来源:origin: marytts/marytts
throw new IllegalArgumentException("Number of rows and cols must be greater than 0");
Matrix dataX = new Matrix(rows, cols);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++)
dataX.set(i, j, data.elementAt(n++));
代码示例来源:origin: marytts/marytts
throw new IllegalArgumentException("Number of rows and cols must be greater than 0");
Matrix dataX = new Matrix(rows, cols);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++)
dataX.set(i, j, data.elementAt(n++));
代码示例来源:origin: stackoverflow.com
Matrix matrix = new Matrix();
Matrix savedMatrix = new Matrix();
savedMatrix.set(matrix);
start.set(event.getX(), event.getY());
Log.d(TAG, "mode=DRAG"); // write to LogCat
Log.d(TAG, "oldDist=" + oldDist);
if (oldDist > 5f) {
savedMatrix.set(matrix);
midPoint(mid, event);
mode = ZOOM;
matrix.set(savedMatrix);
if (newDist > 5f)
matrix.set(savedMatrix);
内容来源于网络,如有侵权,请联系作者删除!