📄 ang_cos.java
字号:
package fuzzy_project;class ang_cos //夹角余弦法{ private double temp1,temp2,temp3,temp4; ang_cos() { temp1=0; temp2=0; temp3=0; temp4=0; } private double cal(double x,double y) { temp1=x*y; //获得参数的乘积 return temp1; } public double[][] exe(double array[][],int m,int n) //exe()方法用来生成相似矩阵 { double temp[][]=new double[m][m]; //定义存储相似矩阵的二维数组 int i,j,k; for(i=0;i<m;i++) for(j=0;j<m;j++) { for(k=0;k<n;k++) { temp2=temp2+cal(array[i][k],array[j][k]); temp3=temp3+array[i][k]*array[i][k]; temp4=temp4+array[j][k]*array[j][k]; } temp[i][j]=Math.abs(temp2)/(Math.sqrt(temp3)*Math.sqrt(temp4)); temp2=temp3=temp4=0; } return temp; //返回相似矩阵的二维数组 }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -