⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vbas.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

 /**
  * Title: XELOPES Data Mining Library
  * Description: The XELOPES library is an open platform-independent and data-source-independent library for Embedded Data Mining.
  * Copyright: Copyright (c) 1988 - 2004 Technical University Chemnitz
  * Copyright: Copyright (c) 2004 prudsys AG
  * Company: prudsys AG
  * @author Arnd Meyer
  * @author Matthias Pester
  * @author Gundolf Haase
  * @author Thomas Hommel
  * @author Michael Thess
  * @version 1.2
  */

package com.prudsys.pdm.Utils.Math;

import java.lang.Math;

/**
 * Collection of useful BLAS-like vector routines. Based on the long-standing
 * vector library 'vbasmod' of the Technical University of Chemnitz: <p>
 *
 * G. Haase, Th. Hommel, A. Meyer, and M. Pester. Bibliotheken zur Entwicklung
 * paralleler Algorithmen. Preprint SPC95_20, TU Chemnitz Zwickau, 1995. <p>
 *
 * All method signatures (method names and arguments) of VBAS are equivalent
 * to 'vbasmod' which exists for FORTRAN and C. If possible, we recommended
 * to use BLAS routines to re-implement the methods of this class since
 * they are strongly optimized. <p>
 *
 * VBAS contains four types of vector operations.
 */
public class VBAS
{
  // -----------------------------------------------------------------------
  //  Type 1: V[x][oper](N,X,ix,Y,iy,Z,iz)
  //
  //           [x] = I   int
  //               = R   float
  //               = D   double
  //
  //         [oper]= "max"   maximum
  //               = "bmax"  value of maximum absolut value
  //               = "maxb"  maximum of absolute values
  //               = "min"   minimum
  //               = "plus"  addition
  //               = "minus" subtraction
  //               = "mult"  multiplication
  //               = "div"   division
  //               = "mod"   modulo (only for integer)
  //               = "0mul"  X:=Y; X[i]=0 if Z[i]=0
  //               = "div0"  division; X[i]=0 if |Y[i]/Z[i]|<1E-35
  //
  //   Type :   X := Y "oper" Z (with step widths ix, iy, iz)
  // -----------------------------------------------------------------------
  public static void VImax(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Math.max(Y[jy], Z[jz]);
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRmax(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Math.max(Y[jy], Z[jz]);
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDmax(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Math.max(Y[jy], Z[jz]);
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VIbmax(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy];
       if ( Math.abs(Z[jz]) > Math.abs(Y[jy]) ) X[jx] = Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRbmax(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy];
       if ( Math.abs(Z[jz]) > Math.abs(Y[jy]) ) X[jx] = Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDbmax(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy];
       if ( Math.abs(Z[jz]) > Math.abs(Y[jy]) ) X[jx] = Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VImaxb(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       int S = Math.abs(Y[jy]);
       int T = Math.abs(Z[jz]);
       if ( T > S ) S = T;
       X[jx] = S;
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRmaxb(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       float S = Math.abs(Y[jy]);
       float T = Math.abs(Z[jz]);
       if ( T > S ) S = T;
       X[jx] = S;
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDmaxb(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       double S = Math.abs(Y[jy]);
       double T = Math.abs(Z[jz]);
       if ( T > S ) S = T;
       X[jx] = S;
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VImin(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Math.min(Y[jy], Z[jz]);
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRmin(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Math.min(Y[jy], Z[jz]);
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDmin(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Math.min(Y[jy], Z[jz]);
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VIplus(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] + Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRplus(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] + Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDplus(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] + Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VIminus(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] - Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRminus(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] - Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDminus(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] - Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VImult(int N, int[] X, int ix, int[] Y, int iy, int[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] * Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VRmult(int N, float[] X, int ix, float[] Y, int iy, float[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] * Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }
  }

  public static void VDmult(int N, double[] X, int ix, double[] Y, int iy, double[] Z, int iz) {

     int jx = 0;
     int jy = 0;
     int jz = 0;
     for (int i = 0; i < N; i++) {
       X[jx] = Y[jy] * Z[jz];
       jx += ix;
       jy += iy;
       jz += iz;
     }

⌨️ 快捷键说明

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