核主成分程序:结果中要具体组成主成分的系数,核函数是多项式核函数!

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 02:31:13
核主成分程序:结果中要具体组成主成分的系数,核函数是多项式核函数!

核主成分程序:结果中要具体组成主成分的系数,核函数是多项式核函数!
核主成分程序:结果中要具体组成主成分的系数,核函数是多项式核函数!

核主成分程序:结果中要具体组成主成分的系数,核函数是多项式核函数!
the *getlist(int n=0){/*产生链表*/
the *p;
the *p1;
int i=0;
int j=0;
printf("请输入多项式的系数");
scanf("%d",j);
p=malloc(sizeof(the));
p1=p;
for(i=2;i=n;i++){
*p.i=j;
scanf("%d",j);
if(n!=i){
*p.next=malloc(sizeof(the));
p=*p.next;
}else{
*p.next=null;
}
}
return p;
}
int thesize(the *p){
int i=1;
while(*p.next!=null){
i++;
p=*p.next;
}
return i;
}
the* addthe(*p1,*p2){/*做加法*/
int size
if(thesize(*p1)thesize(*p2));
size=thesize(*p1);
else
size=thesize(*p2);
the *p;
p=getlist(size);
the *q;
int m,n,k,x,y;
for(k=0;ksize;k++){
m=thesize(*p1)-k;
n=thesize(*p2)-k;
if(m=0)
x=0;
else
x=getthevalue(m,p1).i;
if(n=0)
y=0;
else
y=getthevalue(n,p2).i;
q=getthevalue(k,p);
q.i=x+y;
}
}
the* getthevalue(int i;the *p){
the *p1=p;
int j=1;
while(ji){
p=*p.next;
j++;
}
return *p;
}
struct the{
the *next;
int i;
}