MCPcopy Create free account
hub / github.com/Singular/Singular / vDistance

Method vDistance

kernel/numeric/mpr_base.cc:909–994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

907}
908
909mprfloat mayanPyramidAlg::vDistance( Coord_t * acoords_a, int dim )
910{
911 int i, ii, j, k, col, r;
912 int numverts, cols;
913
914 numverts = 0;
915 for( i=0; i<=n; i++)
916 {
917 numverts += Qi[i]->num;
918 }
919 cols = numverts + 2;
920
921 //if( dim < 1 || dim > n )
922 // WerrorS("mayanPyramidAlg::vDistance: Known coords dim off range");
923
924 pLP->LiPM[1][1] = 0.0;
925 pLP->LiPM[1][2] = 1.0; // maximize
926 for( j=3; j<=cols; j++) pLP->LiPM[1][j] = 0.0;
927
928 for( i=0; i <= n; i++ )
929 {
930 pLP->LiPM[i+2][1] = 1.0;
931 pLP->LiPM[i+2][2] = 0.0;
932 }
933 for( i=1; i<=dim; i++)
934 {
935 pLP->LiPM[n+2+i][1] = (mprfloat)(acoords_a[i-1]);
936 pLP->LiPM[n+2+i][2] = -shift[i];
937 }
938
939 ii = -1;
940 col = 2;
941 for ( i= 0; i <= n; i++ )
942 {
943 ii++;
944 for( k= 1; k <= Qi[ii]->num; k++ )
945 {
946 col++;
947 for ( r= 0; r <= n; r++ )
948 {
949 if ( r == i ) pLP->LiPM[r+2][col] = -1.0;
950 else pLP->LiPM[r+2][col] = 0.0;
951 }
952 for( r= 1; r <= dim; r++ )
953 pLP->LiPM[r+n+2][col] = -(mprfloat)((*Qi[ii])[k]->point[r]);
954 }
955 }
956
957 if( col != cols)
958 Werror("mayanPyramidAlg::vDistance:"
959 "setting up matrix for udist: col %d != cols %d",col,cols);
960
961 pLP->m = n+dim+1;
962 pLP->m3= pLP->m;
963 pLP->n=cols-1;
964
965#ifdef mprDEBUG_ALL
966 Print("vDistance LP, known koords dim=%d, constr %d, cols %d, acoords= ",

Callers

nothing calls this directly

Calls 8

WerrorFunction · 0.85
print_matFunction · 0.85
PrintSFunction · 0.85
print_bmatFunction · 0.85
WerrorSFunction · 0.85
computeMethod · 0.80
PrintFunction · 0.50
PrintLnFunction · 0.50

Tested by

no test coverage detected