| version 1.9, 2000/11/08 08:02:49 |
version 1.11, 2000/12/05 06:59:15 |
|
|
| * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
| * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
| * |
* |
| * $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.8 2000/09/21 09:19:25 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.10 2000/11/13 01:48:12 noro Exp $ |
| */ |
*/ |
| #include "ca.h" |
#include "ca.h" |
| #include "base.h" |
#include "base.h" |
|
|
| #define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d); |
#define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d); |
| #endif |
#endif |
| |
|
| extern int Print; /* XXX */ |
extern int DP_Print; /* XXX */ |
| |
|
| void inner_product_mat_int_mod(Q **,int **,int,int,int,Q *); |
void inner_product_mat_int_mod(Q **,int **,int,int,int,Q *); |
| void solve_by_lu_mod(int **,int,int,int **,int); |
void solve_by_lu_mod(int **,int,int,int **,int); |
|
|
| int len,i,r; |
int len,i,r; |
| BYTEARRAY array; |
BYTEARRAY array; |
| unsigned char *vb; |
unsigned char *vb; |
| |
char *str; |
| LIST list; |
LIST list; |
| NODE tn; |
NODE tn; |
| |
|
|
|
| error("newbytearray : invalid size"); |
error("newbytearray : invalid size"); |
| MKBYTEARRAY(array,len); |
MKBYTEARRAY(array,len); |
| if ( argc(arg) == 2 ) { |
if ( argc(arg) == 2 ) { |
| list = (LIST)ARG1(arg); |
if ( !ARG1(arg) ) |
| asir_assert(list,O_LIST,"newbytearray"); |
error("newbytearray : invalid initialization"); |
| for ( r = 0, tn = BDY(list); tn; r++, tn = NEXT(tn) ); |
switch ( OID((Obj)ARG1(arg)) ) { |
| if ( r > len ) { |
case O_LIST: |
| *rp = array; |
list = (LIST)ARG1(arg); |
| return; |
asir_assert(list,O_LIST,"newbytearray"); |
| |
for ( r = 0, tn = BDY(list); tn; r++, tn = NEXT(tn) ); |
| |
if ( r <= len ) { |
| |
for ( i = 0, tn = BDY(list), vb = BDY(array); tn; |
| |
i++, tn = NEXT(tn) ) |
| |
vb[i] = (unsigned char)QTOS((Q)BDY(tn)); |
| |
} |
| |
break; |
| |
case O_STR: |
| |
str = BDY((STRING)ARG1(arg)); |
| |
r = strlen(str); |
| |
if ( r <= len ) |
| |
bcopy(str,BDY(array),r); |
| |
break; |
| |
default: |
| |
if ( !ARG1(arg) ) |
| |
error("newbytearray : invalid initialization"); |
| } |
} |
| for ( i = 0, tn = BDY(list), vb = BDY(array); tn; i++, tn = NEXT(tn) ) |
|
| vb[i] = (unsigned char)QTOS((Q)BDY(tn)); |
|
| } |
} |
| *rp = array; |
*rp = array; |
| } |
} |
| Line 790 int **rindp,**cindp; |
|
| Line 805 int **rindp,**cindp; |
|
| colstat = (int *)MALLOC_ATOMIC(col*sizeof(int)); |
colstat = (int *)MALLOC_ATOMIC(col*sizeof(int)); |
| wcolstat = (int *)MALLOC_ATOMIC(col*sizeof(int)); |
wcolstat = (int *)MALLOC_ATOMIC(col*sizeof(int)); |
| for ( ind = 0; ; ind++ ) { |
for ( ind = 0; ; ind++ ) { |
| if ( Print ) { |
if ( DP_Print ) { |
| fprintf(asir_out,"."); fflush(asir_out); |
fprintf(asir_out,"."); fflush(asir_out); |
| } |
} |
| md = lprime[ind]; |
md = lprime[ind]; |
|
|
| } |
} |
| } else { |
} else { |
| if ( rank < rank0 ) { |
if ( rank < rank0 ) { |
| if ( Print ) { |
if ( DP_Print ) { |
| fprintf(asir_out,"lower rank matrix; continuing...\n"); |
fprintf(asir_out,"lower rank matrix; continuing...\n"); |
| fflush(asir_out); |
fflush(asir_out); |
| } |
} |
| continue; |
continue; |
| } else if ( rank > rank0 ) { |
} else if ( rank > rank0 ) { |
| if ( Print ) { |
if ( DP_Print ) { |
| fprintf(asir_out,"higher rank matrix; resetting...\n"); |
fprintf(asir_out,"higher rank matrix; resetting...\n"); |
| fflush(asir_out); |
fflush(asir_out); |
| } |
} |
|
|
| } else { |
} else { |
| for ( j = 0; (j<col) && (colstat[j]==wcolstat[j]); j++ ); |
for ( j = 0; (j<col) && (colstat[j]==wcolstat[j]); j++ ); |
| if ( j < col ) { |
if ( j < col ) { |
| if ( Print ) { |
if ( DP_Print ) { |
| fprintf(asir_out,"inconsitent colstat; resetting...\n"); |
fprintf(asir_out,"inconsitent colstat; resetting...\n"); |
| fflush(asir_out); |
fflush(asir_out); |
| } |
} |
|
|
| get_eg(&tmp1); |
get_eg(&tmp1); |
| add_eg(&eg_gschk,&tmp0,&tmp1); |
add_eg(&eg_gschk,&tmp0,&tmp1); |
| add_eg(&eg_gschk_split,&tmp0,&tmp1); |
add_eg(&eg_gschk_split,&tmp0,&tmp1); |
| if ( Print ) { |
if ( DP_Print ) { |
| print_eg("Mod",&eg_mod_split); |
print_eg("Mod",&eg_mod_split); |
| print_eg("Elim",&eg_elim_split); |
print_eg("Elim",&eg_elim_split); |
| print_eg("ChRem",&eg_chrem_split); |
print_eg("ChRem",&eg_chrem_split); |