void next_stage() { if ( stage == 8 ) { tell_room( environment(), "The yellow spots on the toadstool begin to "+ "glow.\n" ); set_light( 5 ); set_long( query_long() +"The yellow spots are glowing.\n" ); } ::next_stage(); } /* next_stage() */
void matlib_main() { MATRIX *A, *B, *C; MATRIX *At, *Bt; long n, ni, i; double sum; random_1(-1); n = query_long("dimension of arrays", 3L); ni = query_long("number of iterations", 100L); #ifdef VAX_VMS init_stats(); #endif m_alloc(&A, n, n); m_alloc(&At, n, n); m_alloc(&B, n, n); m_alloc(&Bt, n, n); m_alloc(&C, n, n); for (i=sum=0; i<ni; i++) { m_rand(At, -1.0L, 1.0L); m_trans(A, At); m_invert(B, A); m_mult(C, A, B); sum += fabs(m_det(C)-1.0); } m_free(&A); m_free(&At); m_free(&B); m_free(&Bt); m_free(&C); printf("M.A.D.{DET{A.INV(A))}-1} = %e\n", sum/ni); #ifdef VAX_VMS report_stats(stdout, "stats: "); #endif }
string query_message(void) { return query_long(); }