edge.c
Go to the documentation of this file.
00001 /* Oct.12, 1990.  Bug fix. when r==1, skip ssvdc() because r-1 becomes 0 */
00002 
00003 #include "arith.h"
00004 
00005 edge(f,n,planetab,planework,r,linetab,m)
00006 MATRIX f;
00007 int n;  /* n = the row number of C */
00008 unsigned int planetab;
00009 unsigned int planework;
00010 int r;  /* r = rankC */
00011 LINE linetab[MAXEDGE];
00012 int m;
00013 {
00014     MATRIX fwork,s,e,u,v,work;
00015     VECTOR fugo;
00016     register int positive,negative;
00017     register int i,ii,j,job,info;
00018 
00019     if(r == 1){
00020       v[0][0]= f[0][0]/fabs(f[0][0]);
00021     }
00022     else{
00023       ii=0;
00024       for(i=0; ii<r-1; i++)
00025           if((planework & (1<<i)) != 0){
00026             for(j=0; j<r; j++)
00027                 fwork[ii][j]= f[i][j];
00028             ii += 1;
00029           }
00030       job=11;
00031       info=ssvdc(fwork,r-1,r-1,r,s,e,u,r-1,v,r,work,job);
00032     }
00033 
00034 /*
00035     if(s[r-2][r-2] < EPS)
00036         return(FALSE);
00037 */
00038 
00039     /* check the new edge is not outside the cone                        */
00040     /* however it may has no meaning, only sign for the edge is required */
00041 
00042     positive=0;
00043     negative=0;
00044     for(i=0; i<n; i++){
00045         if((planetab & (1<<i)) != 0){
00046             fugo[i]=0.0e0;
00047             for(j=0; j<r; j++)
00048                 fugo[i] += f[i][j] * v[j][r-1];
00049             if(fugo[i]>EPS){
00050                 positive =  1;
00051             }
00052             if(fugo[i]<-EPS){
00053                 negative = -1;
00054             }
00055             if((positive * negative) != 0)
00056                 return(FALSE);
00057         }
00058     }
00059 
00060     if(negative == -1){
00061         for(j=0; j<r; j++){
00062             v[j][r-1]= -v[j][r-1];
00063         }
00064     }
00065 
00066     linetab[m].index=TRUE;
00067     linetab[m].next=m+1;
00068     linetab[m].last=m-1;
00069     linetab[m].plane=planework;
00070     for(j=0; j<r; j++)
00071         linetab[m].s[j]= v[j][r-1];
00072     return(TRUE);
00073 }


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Mar 9 2017 04:57:49