計量地理 PrincipalCA主成分析

2021-08-20 12:09:47 字數 2713 閱讀 1364

輸入如下:

91-0.8140-0.21680.3355-0.1860.54170.42370.0378-0.6547

-0.814010.4602-0.6613-0.0874-0.7306-0.3136-0.06340.8749

-0.2168

0.460210.6603-0.2394-0.5314-0.20720.02690.6853

0.3355

-0.6613-0.660310.38290.61970.18860.0821-0.7013

-0.1860

-0.0874-0.23940.382910.0998-0.15220.0471-0.1322

0.5417

-0.7306-0.53140.61970.099810.279-0.1118-0.7764

0.4237

-0.3136-0.20720.1886-0.15220.27910.1408-0.3658

0.0378

-0.06340.02690.08210.0471-0.1118-0.14081-0.0126

-0.6547

0.874900.6853-0.7013-0.1322-0.7764-0.3658-0.01261

第一行為維度

//#include "stdafx.h"

#include #include #include using namespace std;

float judgemin(float a,float b1,float b2)

int i = 0,j = 0;

while(!feof(fp))

} fclose(fp);

//選擇最短路徑的起點和終點

printf("please input start point(>=1), istart = ");

scanf("%d",&istart);

printf("\nplease input end point(<=7), iend = ");

scanf("%d",&iend);

listh->icurpt = istart;

listh->pparent = null;

listh->pchild = null;

listh->fm[istart - 1] = 0.0;

bltransverse[istart - 1] = true;

ptcur = istart;

list* listcur = listh;

list* listchild;

while(!blexit)

} if(blexit) continue;

ino++;

// 對於每乙個頂點進行迴圈,計算以當前標記點到其它點之間的距離

for(int i = 0;i < irow;i++)

} // 尋找最小值所對應的點號

bool blexist = false; // 下次迴圈是否存在點

float temp = 99999999999;

for(int i = 0;i < irow;i++)

}

} // 若存在點,則分配空間;否則,退出迴圈

if(blexist)

else

if(listchild)

} // 確定鍊錶的長度

list* pbake = listh;

int ilength = 0;

while(listh->pchild != null)

listh = pbake;

liste = listcur;

if(listh->pchild == null) ilength = 1;

printf("迴圈次數是:%d;鍊錶長度是:%d\n",ino,ilength);

// 開始從後向前確定最短路徑

float** m_dist = new float*[ilength];

for(int i = 0;i < ilength;i++)

m_dist[i] = new float[irow];

int* ptcurlist = new int[ilength];

int m = 0;

while(listh->pchild != null)

ptcurlist[m] = listh->icurpt;

listh = listh->pchild;

m++;

} listh = pbake;

vector ptvect;

ptvect.push_back(iend);

ptcur = iend;

blexit = false;

// 首先判斷終點是否有值,如果沒有則表示無法到達

if(m_dist[ilength - 1][ptcur - 1] < 0)

for(int i = ilength - 1;i >= 0;i--)

if(m_dist[j][ptcur - 1] < 0)

} }ptvect.push_back(istart);

// 輸出路徑

printf("最短路徑是:\n");

for(int i = ptvect.size() - 1;i >= 0;i--)

// 釋放鍊錶

while(liste->pparent != null)

system("pause");

}

計量地理 聚類

按照計量地理思想,對距離矩陣進行聚類,資料如 60.00.3750.4831.7491.5161.972 0.3750.00.7761.5961.3361.743 0.4830.7760.01.9261.6622.154 1.7491.5961.9260.00.5010.693 1.5161.336...