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

📄 eye.java

📁 JAVA 数学程序库 提供常规的数值计算程序包
💻 JAVA
字号:
package jmathlib.toolbox.jmathlib.matrix._private.Jampack;

/**
   Eye generates a matrix whose diagonal elements are one
   and whose off diagonal elements are zero.
*/

public class Eye{
   
/**
   Generates an identity matrix of order <tt>n</tt>.
   @param <tt>n</tt>  The order of the matrx
*/
   public static Zmat o(int n){
      return o(n, n);
   }

/**
   Generates an <tt>mxn</tt> matrix whose diagonal elements are
   one and whose off diagonal elements are zero.
   @param <tt>m</tt>   The number of rows in the matrix
   @param <tt>n</tt>   The number of columns in the matrix
*/
   public static Zmat o(int m, int n){

      Zmat I = new Zmat(m, n);

      for (int i=0; i<Math.min(m, n); i++){
         I.re[i][i] = 1;
         I.im[i][i] = 0;
      }

      return I;
   }

}

⌨️ 快捷键说明

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