🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1359

g++ 2.3.3 cc1plus illegal instruction

#1359
From: Andreas Stolcke
Date: Thu, 07 Jan 1993 21:43
3015 lines
51174 bytes
Platform:  sparcstation, sunos4.1.1 and 4.1.3

Invocation:
/usr/local/bin/g++ -I../../incl -g -v -c _matrix.c 
Reading specs from /usr/local/lib/gcc/sun4/2.3.3/specs
gcc version 2.3.3
 /usr/local/lib/gcc/sun4/2.3.3/cpp -lang-c++ -v -I../../incl -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -g _matrix.c /tmp/cca23702.i
GNU CPP version 2.3.3 (sparc)
 /usr/local/lib/gcc/sun4/2.3.3/cc1plus /tmp/cca23702.i -quiet -dumpbase _matrix.cc -g -version -o /tmp/cca23702.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
/usr/local/bin/gcc: Internal compiler error: program cc1plus got fatal signal 4

Cpp output for _matrix.c follows (sorry for the length).

-- 
Andreas Stolcke					stolcke@icsi.berkeley.edu
International Computer Science Institute	stolcke@ucbicsi.bitnet
1947 Center St., Suite 600, Berkeley, CA 94704	(510) 642-4274 ext. 126


# 1 "_matrix.c"
 















# 1 "../../incl/LEDA/matrix.h" 1
 
















 
 
 




# 1 "../../incl/LEDA/basic.h" 1
 


















# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdio.h" 1 3
 
 


















#pragma interface







 
 
 

# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/_G_config.h" 1 3
  






typedef long _G_clock_t;
typedef short _G_dev_t;
typedef long   _G_fpos_t;
typedef unsigned short _G_gid_t;
typedef unsigned long _G_ino_t;
typedef unsigned short _G_mode_t;
typedef short _G_nlink_t;
typedef long _G_off_t;
typedef int _G_pid_t;
typedef int _G_ptrdiff_t;
typedef int _G_sigset_t;
typedef int _G_size_t;
typedef long _G_time_t;
typedef unsigned short _G_uid_t;
typedef unsigned short _G_wchar_t;
typedef int   _G_ssize_t;
typedef char * _G_va_list;











 






 
 

# 33 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdio.h" 2 3


extern "C" {

































# 1 "/usr/local/lib/gcc/sun4/2.3.3/include/stdio.h" 1 3

# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdarg.h" 1 3
extern "C" {
# 1 "/usr/local/lib/gcc/sun4/2.3.3/include/stdarg.h" 1 3
 






























# 1 "/usr/local/lib/gcc/sun4/2.3.3/include/va-sparc.h" 1 3
 


 





 

typedef char * __gnuc_va_list;







 

# 81 "/usr/local/lib/gcc/sun4/2.3.3/include/va-sparc.h" 3


# 32 "/usr/local/lib/gcc/sun4/2.3.3/include/stdarg.h" 2 3

# 89 "/usr/local/lib/gcc/sun4/2.3.3/include/stdarg.h" 3






# 137 "/usr/local/lib/gcc/sun4/2.3.3/include/stdarg.h" 3





# 2 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdarg.h" 2 3

}
# 2 "/usr/local/lib/gcc/sun4/2.3.3/include/stdio.h" 2 3

 




extern	struct	_iobuf {
	int	_cnt;
	unsigned char *_ptr;
	unsigned char *_base;
	int	_bufsiz;
	short	_flag;
	char	_file;		 
} _iob[];








































extern struct _iobuf 	*__hide_fopen ();
extern struct _iobuf 	*__hide_fdopen ();
extern struct _iobuf 	*__hide_freopen ();
extern struct _iobuf 	*__hide_popen ();
extern struct _iobuf 	*tmpfile();
extern long	__hide_ftell ();
extern char	*fgets();
extern char	*gets();
extern char	*__hide_sprintf ();
extern char	*ctermid();
extern char	*cuserid();
extern char	*__hide_tempnam ();
extern char	*tmpnam();






# 69 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdio.h" 2 3







































}

extern "C" {

int    fclose(struct _iobuf *);
struct _iobuf *  fdopen(int, const char*);
int    fflush(struct _iobuf *);
int    fgetc(struct _iobuf *);
char*  fgets(char*, int, struct _iobuf  *);
struct _iobuf *  fopen(const char*, const char*);
int    fprintf(struct _iobuf *, const char* ...);
int    fputc(int, struct _iobuf *);
int    fputs(const char*, struct _iobuf *);
_G_size_t  fread(void*, _G_size_t , _G_size_t , struct _iobuf *);



struct _iobuf *  freopen(const char*, const char*, struct _iobuf *);

int    fscanf(struct _iobuf *, const char* ...);
int    fseek(struct _iobuf *, long, int);
long   ftell(struct _iobuf  *);
_G_size_t  fwrite(const void*, _G_size_t , _G_size_t , struct _iobuf *);
char*  gets(char*);
int    getw(struct _iobuf *);
int    pclose(struct _iobuf *);
void   perror(const char*);
struct _iobuf *  popen(const char*, const char*);
int    printf(const char* ...);
int    puts(const char*);
int    putw(int, struct _iobuf *);
int    rewind(struct _iobuf *);
int    scanf(const char* ...);
void   setbuf(struct _iobuf *, char*);
void   setbuffer(struct _iobuf *, char*, int);
int    setlinebuf(struct _iobuf *);
int    setvbuf(struct _iobuf *, char*, int, _G_size_t );
int    sscanf(char*, const char* ...);
struct _iobuf *  tmpfile();
int    ungetc(int, struct _iobuf *);
int    vfprintf (...) ;
int    vprintf (...) ;
char*  sprintf (...) ;
char*  vsprintf (...) ;

extern int _filbuf (...) ;
extern int _flsbuf (...) ;

}


















# 20 "../../incl/LEDA/basic.h" 2

# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdlib.h" 1 3





# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stddef.h" 1 3


extern "C" {



# 1 "/usr/local/lib/gcc/sun4/2.3.3/include/stddef.h" 1 3




 






 




 


 





 

# 43 "/usr/local/lib/gcc/sun4/2.3.3/include/stddef.h" 3


 





 

 



















typedef int ptrdiff_t;








 




 

 





















typedef int _G_size_t ;












 




 




















 

typedef __wchar_t wchar_t;














 



# 179 "/usr/local/lib/gcc/sun4/2.3.3/include/stddef.h" 3




 









 








# 7 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stddef.h" 2 3




}

# 6 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/stdlib.h" 2 3


extern "C" {

int       abs(int);


void volatile abort(void);




double    atof(const char*);
int       atoi(const char*);
long      atol(const char*);

int       atexit(auto void (*p) (void));
int       bsearch (const void *, const void *, _G_size_t , 
                   _G_size_t , auto int (*ptf)(const void*, const void*));
void*     calloc(_G_size_t , _G_size_t );
void      cfree(void*);


void volatile exit(int);




char*     fcvt(double, int, int*, int*);
void      free(void*);
char*     getenv(const char*);
int       getopt(int, char * const *, const char*);
int       getpw(int, char*);
char*     gcvt(double, int, char*);
char*     ecvt(double, int, int*, int*);
extern char**   environ;

long      labs(long);
void*     malloc(_G_size_t );
_G_size_t     malloc_usable_size(void*);
int       putenv(const char*);
extern char*    optarg;
extern int      opterr;
extern int      optind;
void      qsort(void*, _G_size_t , _G_size_t , auto int (*ptf)(void*,void*));
int       rand(void);
void*     realloc(void*, _G_size_t );
int       setkey(const char*);
int       srand(unsigned int);
double    strtod(const char*, char**);
long      strtol(const char*, char**, int);
unsigned long stroul(const char**, int);
int       system(const char*);

long      random(void);
void      srandom(int);
char*     setstate(char*);
char*     initstate(unsigned, char*, int);

double    drand48(void);
void      lcong48(short*);
long      jrand48(short*);
long      lrand48(void);
long      mrand48(void);
long      nrand48(short*);
short*    seed48(short*);
void      srand48(long);

char*     ctermid(char*);
char*     cuserid(char*);
char*     tempnam(const char*, const char*);
char*     tmpnam(char*);

}

# 21 "../../incl/LEDA/basic.h" 2


 
 
 


 






# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/iostream.h" 1 3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



#pragma interface



# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/streambuf.h" 1 3
 
 
 
 
 
 
 
 
 
 
 
 
 
 





#pragma interface


   
















class ostream; class streambuf; class backupbuf;

 







extern "C" int __underflow(streambuf*);
extern "C" int __overflow(streambuf*, int);

typedef _G_off_t streamoff;
typedef _G_off_t streampos;  

typedef unsigned long __fmtflags;
typedef unsigned char __iostate;

struct _ios_fields {  
    streambuf *_strbuf;
    ostream* _tie;
    int _width;
    __fmtflags _flags;
    _G_wchar_t _fill;
    __iostate _state;
    __iostate _exceptions;
    int _precision;
};















# 95 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/streambuf.h" 3


class ios : public _ios_fields {
  public:
    typedef __fmtflags fmtflags;
    typedef int iostate;
    typedef int openmode;
    enum io_state {
	goodbit = 0 ,
	eofbit = 1 ,
	failbit = 2 ,
	badbit = 4  };
    enum open_mode {
	in = 1 ,
	out = 2 ,
	ate = 4 ,
	app = 8 ,
	trunc = 16 ,
	nocreate = 32 ,
	noreplace = 64 ,
	bin = 128  };
    enum seek_dir { beg, cur, end};
     
    enum { skipws=01, left=02, right=04, internal=010,
	   dec=020, oct=040, hex=0100,
	   showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
	   scientific=04000, fixed=010000, unitbuf=020000, stdio=040000,
	   dont_close=0x80000000  
	   };
    enum {  
	basefield=dec+oct+hex,
	floatfield = scientific+fixed,
	adjustfield = left+right+internal
    };

# 138 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/streambuf.h" 3


    ostream* tie() const { return _tie; }
    ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }

     
    _G_wchar_t fill() const { return (_G_wchar_t)_fill; }
    _G_wchar_t fill(_G_wchar_t newf)
	{_G_wchar_t oldf = (_G_wchar_t)_fill; _fill = (char)newf; return oldf;}
    fmtflags flags() const { return _flags; }
    fmtflags flags(fmtflags new_val) {
	fmtflags old_val = _flags; _flags = new_val; return old_val; }
    int precision() const { return _precision; }
    int precision(int newp) {
	unsigned short oldp = _precision; _precision = (unsigned short)newp;
	return oldp; }
    fmtflags setf(fmtflags val) {
	fmtflags oldbits = _flags;
	_flags |= val; return oldbits; }
    fmtflags setf(fmtflags val, fmtflags mask) {
	fmtflags oldbits = _flags;
	_flags = (_flags & ~mask) | (val & mask); return oldbits; }
    fmtflags unsetf(fmtflags mask) {
	fmtflags oldbits = _flags & mask;
	_flags &= ~mask; return oldbits; }
    int width() const { return _width; }
    int width(int val) { int save = _width; _width = val; return save; }




    void _throw_failure() { }


    streambuf* rdbuf() const { return _strbuf; }
    void clear(iostate state = 0) {
	_state = _strbuf ? state : state|badbit;
	if (_state & _exceptions) _throw_failure(); }
    void set(iostate flag) { _state |= flag;
	if (_state & _exceptions) _throw_failure(); }
    int good() const { return _state == 0; }
    int eof() const { return _state & ios::eofbit; }
    int fail() const { return _state & (ios::badbit|ios::failbit); }
    int bad() const { return _state & ios::badbit; }
    iostate rdstate() const { return _state; }
    operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
    int operator!() const { return fail(); }
    iostate exception(iostate enable) {
	iostate old = _exceptions; _exceptions = enable;
	if (_state & _exceptions) _throw_failure();
	return old; }

    static int sync_with_stdio(int on);
    static void sync_with_stdio() { sync_with_stdio(1); }









  protected:
    ios(streambuf* sb = 0, ostream* tie = 0);
    virtual ~ios();
    void init(streambuf* sb) { _state=0; _strbuf=sb; }
};




typedef ios::seek_dir _seek_dir;


 
 
 
 
 




















 
 
class streammarker {
    friend class streambuf;



    friend int __underflow(streambuf*);

    struct streammarker *_next;   
    streambuf *_sbuf;  
    streampos _spos;  
    void set_streampos(streampos sp) { _spos = sp; }
    void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
     
     
    int _pos;
  public:
    streammarker(streambuf *sb);
    ~streammarker();
    int saving() { return  _spos == -2; }
    int delta(streammarker&);
    int delta();
};

struct __streambuf {
     
    int _flags;		 
    char* _gptr;	 
    char* _egptr;	 
    char* _eback;	 
    char* _pbase;	 
    char* _pptr;	 
    char* _epptr;	 
    char* _base;	 
    char* _ebuf;	 
    struct streambuf *_chain;

     
    friend class streammarker;
    char *_other_gbase;  
    char *_aux_limit;   
    char *_other_egptr;  
    streammarker *_markers;


     
    unsigned short _cur_column;
    char _unused;
    char _shortbuf[1];
};

extern unsigned __adjust_column(unsigned start, const char *line, int count);

struct streambuf : private __streambuf {
    friend class ios;
    friend class istream;
    friend class ostream;
    friend class streammarker;



    friend int __underflow(streambuf*);

  protected:
    static streambuf* _list_all;  
    streambuf*& xchain() { return _chain; }
    void _un_link();
    void _link_in();
    char* gptr() const { return _gptr; }
    char* pptr() const { return _pptr; }
    char* egptr() const { return _egptr; }
    char* epptr() const { return _epptr; }
    char* pbase() const { return _pbase; }
    char* eback() const { return _eback; }
    char* base() const { return _base; }
    char* ebuf() const { return _ebuf; }
    int blen() const { return _ebuf - _base; }
    void xput_char(char c) { *_pptr++ = c; }
    int xflags() { return _flags; }
    int xflags(int f) { int fl = _flags; _flags = f; return fl; }
    void xsetflags(int f) { _flags |= f; }
    void xsetflags(int f, int mask) { _flags = (_flags & ~mask) | (f & mask); }
    void gbump(int n) { _gptr += n; }
    void pbump(int n) { _pptr += n; }
    void setb(char* b, char* eb, int a=0);
    void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
    void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
    char *shortbuf() { return _shortbuf; }

    int in_backup() { return _flags & 0x100 ; }
     
    char *Gbase() { return in_backup() ? _other_gbase : _eback; }
     
    char *eGptr() { return in_backup() ? _other_egptr : _egptr; }
     
    char *Bbase() { return in_backup() ? _eback : _other_gbase; }
    char *Bptr() { return _aux_limit; }
     
    char *eBptr() { return in_backup() ? _egptr : _other_egptr; }
    char *Nbase() { return _other_gbase; }
    char *eNptr() { return _other_egptr; }
    int have_backup() { return _other_gbase != ((void *)0) ; }
    int have_markers() { return _markers != ((void *)0) ; }
    int _least_marker();
    void switch_to_main_get_area();
    void switch_to_backup_area();
    void free_backup_area();
    void unsave_markers();  
    int put_mode() { return _flags & 0x800 ; }
    int switch_to_get_mode();
    
    streambuf(int flags=0);
  public:
    static int flush_all();
    static void flush_all_linebuffered();  
    virtual int underflow() = 0;  
    virtual int overflow(int c = (-1) ) = 0;  
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
    int seekmark(streammarker& mark, int delta = 0);
    int sputbackc(char c);
    int sungetc();
    virtual ~streambuf();
    int unbuffered() { return _flags & 2  ? 1 : 0; }
    int linebuffered() { return _flags & 0x200  ? 1 : 0; }
    void unbuffered(int i)
	{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
    void linebuffered(int i)
	{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
    int allocate() {  
	if (base() || unbuffered()) return 0;
	else return doallocate(); }
     
    void allocbuf() { if (base() == ((void *)0) ) doallocbuf(); }
    void doallocbuf();
    virtual int sync();
    virtual int pbackfail(int c);
    virtual streambuf* setbuf(char* p, int len);
    int in_avail() { return _egptr - _gptr; }
    int out_waiting() { return _pptr - _pbase; }
    virtual int xsputn(const char* s, int n);
    int sputn(const char* s, int n) { return xsputn(s, n); }
    int padn(char pad, int n);  
    virtual int xsgetn(char* s, int n);
    int sgetn(char* s, int n) { return xsgetn(s, n); }
    int ignore(int);
    virtual int get_column();
    virtual int set_column(int);
    long sgetline(char* buf, _G_size_t n, char delim, int putback_delim);
    int sbumpc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr++; }
    int sgetc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr; }
    int snextc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	return _gptr++, sgetc(); }
    int sputc(int c) {
	if (_pptr >= _epptr) return __overflow(this, (unsigned char)c);
	else return *_pptr++ = c, (unsigned char)c; }
    void stossc() { if (_gptr < _egptr) _gptr++; }
    int vscan(char const *fmt0, _G_va_list ap, ios* stream = ((void *)0) );
    int scan(char const *fmt0 ...);
    int vform(char const *fmt0, _G_va_list ap);
    int form(char const *fmt0 ...);




};

 
 

 
 
 
 

class backupbuf : public streambuf {
    friend class streammarker;
  protected:
    backupbuf(int flags=0) : streambuf(flags|0x4000 ) { }
  public:
    virtual int pbackfail(int c);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
};

struct __file_fields {
    short _fileno;
    int _blksize;
    _G_fpos_t  _offset;
 
};

class filebuf : public backupbuf {
  protected:
    struct __file_fields _fb;
    void init();
  public:
    static const int openprot;  
    filebuf();
    filebuf(int fd);
    filebuf(int fd, char* p, int len);
    ~filebuf();
    filebuf* attach(int fd);
    filebuf* open(const char *filename, const char *mode);
    filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
    int is_open() const { return _fb._fileno >= 0; }
    int fd() const { return is_open() ? _fb._fileno : (-1) ; }
    filebuf* close();
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streambuf* setbuf(char* p, int len);
    int xsputn(const char* s, int n);
    int xsgetn(char* s, int n);
    virtual int sync();
  protected:  
 
    int is_reading() { return eback() != egptr(); }
    char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
     
    char* file_ptr() { return eGptr(); }
    int do_write(const char *data, int to_do);
    int do_flush() { return do_write(_pbase, _pptr-_pbase); }
     
    virtual _G_ssize_t sys_read(char* buf, _G_size_t size);
    virtual _G_fpos_t  sys_seek(_G_fpos_t , _seek_dir);
    virtual _G_ssize_t sys_write(const void*, long);
    virtual int sys_stat(void*);  
    virtual int sys_close();
};

inline ios::ios(streambuf* sb  , ostream* tie  ) {
		_state = sb ? ios::goodbit : ios::badbit; _exceptions=0;
		_strbuf=sb; _tie = tie; _width=0; _fill=' ';
		_flags=ios::skipws|ios::dec; _precision=6; }
inline ios::~ios() {
    if (!(_flags & (unsigned int)ios::dont_close)) delete _strbuf; }


# 24 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/iostream.h" 2 3


class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);

extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);

class ostream : virtual public ios
{
     
    void do_osfx();
  public:
    ostream() { }
    ostream(streambuf* sb, ostream* tied=((void *)0) );
    int opfx() {
	if (!good()) return 0; else { if (_tie) _tie->flush(); return 1;} }
    void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
		      do_osfx(); }
    streambuf* ostreambuf() const { return _strbuf; }
    ostream& flush();
    ostream& put(char c) { _strbuf->sputc(c); return *this; }
    ostream& put(unsigned char c) { return put((char)c); }

    ostream& write(const char *s, int n);
    ostream& write(const unsigned char *s, int n) { return write((const char*)s, n);}

    ostream& put(signed char c) { return put((char)c); }
    ostream& write(const signed char *s, int n) { return write((const char*)s, n);}

    ostream& write(const void *s, int n) { return write((const char*)s, n);}
    ostream& seekp(streampos);
    ostream& seekp(streamoff, _seek_dir);
    streampos tellp();
    ostream& form(const char *format ...);
    ostream& vform(const char *format, _G_va_list args);

    ostream& operator<<(char c);
    ostream& operator<<(unsigned char c) { return (*this) << (char)c; }

    ostream& operator<<(signed char c) { return (*this) << (char)c; }

    ostream& operator<<(const char *s);
    ostream& operator<<(const unsigned char *s)
	{ return (*this) << (const char*)s; }

    ostream& operator<<(const signed char *s)
	{ return (*this) << (const char*)s; }

    ostream& operator<<(void *p);
    ostream& operator<<(int n);
    ostream& operator<<(unsigned int n);
    ostream& operator<<(long n);
    ostream& operator<<(unsigned long n);

    ostream& operator<<(long long n);
    ostream& operator<<(unsigned long long n);

    ostream& operator<<(short n) {return operator<<((int)n);}
    ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);}
    ostream& operator<<(double n);
    ostream& operator<<(float n) { return operator<<((double)n); }
    ostream& operator<<(__omanip func) { return (*func)(*this); }
    ostream& operator<<(__manip func) {(*func)(*this); return *this;}
    ostream& operator<<(streambuf*);
};

class istream : virtual public ios
{
     
    _G_ssize_t _gcount;

    int _skip_ws();
  public:
    istream() { _gcount = 0; }
    istream(streambuf* sb, ostream*tied=((void *)0) );
    streambuf* istreambuf() const { return _strbuf; }
    istream& get(char* ptr, int len, char delim = '\n');
    istream& get(unsigned char* ptr, int len, char delim = '\n')
	{ return get((char*)ptr, len, delim); }
    istream& get(char& c);
    istream& get(unsigned char& c) { return get((char&)c); }
    istream& getline(char* ptr, int len, char delim = '\n');
    istream& getline(unsigned char* ptr, int len, char delim = '\n')
	{ return getline((char*)ptr, len, delim); }

    istream& get(signed char& c)  { return get((char&)c); }
    istream& get(signed char* ptr, int len, char delim = '\n')
	{ return get((char*)ptr, len, delim); }
    istream& getline(signed char* ptr, int len, char delim = '\n')
	{ return getline((char*)ptr, len, delim); }

    istream& read(char *ptr, int n);
    istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }

    istream& read(signed char *ptr, int n) { return read((char*)ptr, n); }

    istream& read(void *ptr, int n) { return read((char*)ptr, n); }
     
    istream& get(streambuf& sb, char delim = '\n');
    istream& gets(char **s, char delim = '\n');
    int ipfx(int need) {
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
	if (!need && (flags() & ios::skipws)) return _skip_ws();
	return 1;
    }
    int ipfx0() {  
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie) _tie->flush();
	if (flags() & ios::skipws) return _skip_ws();
	return 1;
    }
    int ipfx1() {  
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
	return 1;
    }
    int get() { if (!ipfx1()) return (-1) ;
		int ch = _strbuf->sbumpc();
		if (ch == (-1) ) set(ios::eofbit);
		return ch; }
    int peek() { if (!ipfx1()) return (-1) ;
		int ch = _strbuf->sgetc();
		if (ch == (-1) ) set(ios::eofbit);
		return ch; }
    _G_ssize_t gcount() { return _gcount; }
    istream& ignore(int n=1, int delim = (-1) );
    istream& seekg(streampos);
    istream& seekg(streamoff, _seek_dir);
    streampos tellg();
    istream& putback(char ch) {
	if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
	return *this;}
    istream& unget() {
	if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
	return *this;}
    istream& scan(const char *format ...);
    istream& vscan(const char *format, _G_va_list args);





    istream& operator>>(char*);
    istream& operator>>(unsigned char* p) { return operator>>((char*)p); }

    istream& operator>>(signed char*p) { return operator>>((char*)p); }

    istream& operator>>(char& c);
    istream& operator>>(unsigned char& c) {return operator>>((char&)c);}

    istream& operator>>(signed char& c) {return operator>>((char&)c);}

    istream& operator>>(int&);
    istream& operator>>(long&);

    istream& operator>>(long long&);

    istream& operator>>(short&);
    istream& operator>>(unsigned int&);
    istream& operator>>(unsigned long&);

    istream& operator>>(unsigned long long&);

    istream& operator>>(unsigned short&);
    istream& operator>>(float&);
    istream& operator>>(double&);
    istream& operator>>( __manip func) {(*func)(*this); return *this;}
    istream& operator>>(__imanip func) { return (*func)(*this); }
    istream& operator>>(streambuf*);
};


class iostream : public istream, public ostream
{
    _G_ssize_t _gcount;
  public:
    iostream() { _gcount = 0; }
    iostream(streambuf* sb, ostream*tied=((void *)0) );
};

extern istream cin;
extern ostream cout, cerr, clog;  

struct Iostream_init { } ;   

inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }


# 35 "../../incl/LEDA/basic.h" 2






# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/values.h" 1 3
 
 











































# 57 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/values.h" 3















# 166 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/values.h" 3









# 41 "../../incl/LEDA/basic.h" 2










# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/generic.h" 1 3
 
 



















 





















 
typedef int (*GPT)(int,char*);









# 51 "../../incl/LEDA/basic.h" 2

# 63 "../../incl/LEDA/basic.h"









 
 
 


typedef void* GenPtr;     

typedef int     (*CMP_PTR)    (GenPtr&,GenPtr&);
typedef GenPtr  (*PTR_TO_PTR) (GenPtr&);
typedef int     (*PTR_TO_INT) (GenPtr&);
typedef void    (*PTR_TO_VOID)(GenPtr&);


 
 
 

struct LEDA_SIMPLE { 

GenPtr PTR;

friend int  compare(const LEDA_SIMPLE& x, const LEDA_SIMPLE& y) 
                                      { return int(x.PTR) - int(y.PTR);}

friend void Print(const LEDA_SIMPLE& x, ostream& out = cout) 
                                      { out << "L" << int(x.PTR); }

friend void Read(LEDA_SIMPLE&, istream& = cin) {}
friend void Clear(LEDA_SIMPLE&)             {}
friend void Init(LEDA_SIMPLE&)              {}
friend GenPtr Copy(const LEDA_SIMPLE& y)    { return y.PTR; }
friend GenPtr Convert(const LEDA_SIMPLE& y) { return y.PTR; }

};


 
 
 

















































 









 
 
 

struct  memory_elem_type { memory_elem_type* next; };
typedef memory_elem_type* memory_elem_ptr;

extern memory_elem_ptr memory_free_list[];

extern memory_elem_ptr memory_allocate_block(int);
extern memory_elem_ptr allocate_bytes(int);
extern memory_elem_ptr allocate_words(int);
extern void            deallocate_bytes(void*,int);
extern void            deallocate_words(void*,int);
extern void            deallocate_list(void*,void*,int);
extern void            memory_clear();
extern void            memory_kill();
extern void            print_statistics();

























 
 
 
 


 

inline int compare(GenPtr x, GenPtr y) { return int(x)-int(y); }
inline int compare(char x, char y)     { return x-y; }
inline int compare(int  x, int  y)     { return x-y; }
inline int compare(long x, long y)     { return x-y; }


inline int compare(double x, double y) 
{ if (x < y)  return -1;  
  else if (x > y)  return  1;  
  else return 0; 
}


inline int compare(float x, float y) 
{ if (x < y)  return -1;  
  else if (x > y)  return  1;  
  else return 0; 
}


 

inline void Print(const GenPtr x, ostream& out = cout) { out << int(x); }
inline void Print(char x, ostream& out = cout)         { out << x; }
inline void Print(int  x, ostream& out = cout)         { out << x; }
inline void Print(long x, ostream& out = cout)         { out << x; }
inline void Print(float x, ostream& out = cout)        { out << x; }
inline void Print(double x, ostream& out = cout)       { out << x; }



 

inline void Read(GenPtr,   istream&)          {}
inline void Read(char& x,  istream& in = cin) { in >> x; }
inline void Read(int&  x,  istream& in = cin) { in >> x; }
inline void Read(long& x,  istream& in = cin) { in >> x; }
inline void Read(float& x, istream& in = cin) { in >> x;}
inline void Read(double& x,istream& in = cin) { in >> x;}



 

inline void Init(GenPtr)    {}
inline void Init(char&   x) { x=0; }
inline void Init(int&    x) { x=0; }
inline void Init(long&   x) { x=0; }
inline void Init(float&  x) { x=0; }
inline void Init(double& x) { x=0; }


 

inline void Clear(GenPtr)   {}
inline void Clear(char  )   {}
inline void Clear(int   )   {}
inline void Clear(long  )   {}
inline void Clear(float )   {}
inline void Clear(double& x) { deallocate_bytes(&x,sizeof(double)); }


 
 

inline GenPtr Copy(GenPtr x)  { return x; }
inline GenPtr Copy(char x)    { return GenPtr(x); }
inline GenPtr Copy(int  x)    { return GenPtr(x); }
inline GenPtr Copy(long x)    { return GenPtr(x); }
inline GenPtr Copy(float x)   { return *(GenPtr*)&x; }
inline GenPtr Copy(const double& x) 
                         { double* p = (double*)allocate_bytes(sizeof(double)); 
                           *p = x; return p; }


 

inline GenPtr Convert(GenPtr x)        { return x; }
inline GenPtr Convert(int  x)          { return GenPtr(x); }
inline GenPtr Convert(long x)          { return GenPtr(x); }
inline GenPtr Convert(float x)         { return *(GenPtr*)&x; }
inline GenPtr Convert(const double& x) { return GenPtr(&x); }


 

inline GenPtr&  Access(GenPtr, const GenPtr& p) { return *(GenPtr*)&p; }
inline int&     Access(int,    const GenPtr& p) { return *(int*)&p;  }
inline long&    Access(long,   const GenPtr& p) { return *(long*)&p; }
inline float&   Access(float,  const GenPtr& p) { return *(float*)&p;}
inline double&  Access(double, const GenPtr& p) { return *(double*)p;} 


 




























 
 
 

enum rel_pos { before = 1, after = 0 };

enum direction { forward = 0, backward = 1 };


 
 
 

typedef int bool;        








extern const bool true;
extern const bool false;




 
 
 


class srep { 

public:

      char*   s;       
      int count;       

 srep(const char*);

~srep() { delete s; }

  void* operator new(_G_size_t ){ memory_elem_ptr* q = &(memory_free_list[sizeof(srep)]); if (*q==0) *q = memory_allocate_block(sizeof(srep)); memory_elem_ptr p = *q; *q = p->next; return p; } void  operator delete(void* p){ memory_elem_ptr* q = &(memory_free_list[sizeof(srep)]); memory_elem_ptr(p)->next = *q; *q = memory_elem_ptr(p); } 

# 388 "../../incl/LEDA/basic.h"

};


class format_string
{ friend class string;
  const char* str;
  public:
  format_string(const char* s) { str = s; }
 };


class string  : public LEDA_SIMPLE 
{

friend class srep;

static char* str_dup(const char*);
static char* str_cat(const char*,const char*);
static char* str_cat(int, char**);

srep*  ptr() const { return (srep*)PTR; }

public:

 string()                { PTR = new srep(""); }
 string(const string& x) { PTR = x.ptr();  ptr()->count++; }
 string(int argc, char** argv) 
                         { PTR = new srep(str_cat(argc,argv)); }

 




 string(const char*, ...);    



 string(const char* s)   { PTR = new srep(s);}




void clear()  { if (--ptr()->count==0) delete ptr(); }

~string()     { clear(); }


char*  operator~()  const   { return str_dup(ptr()->s); }
char*  cstring()    const   { return ptr()->s; }

int    length()          const;
string sub(int,int)      const;
int    pos(string,int=0) const;

string operator()(int i, int j)  const { return sub(i,j); }
string head(int i)               const { return sub(0,i-1); }
string tail(int i)               const { return sub(length()-i,length()-1); }

string insert(string, int=0)     const;
string insert(int, string)       const;

string replace(string, string, int=1) const; 
string replace(int, int, string) const; 

string del(string, int=1)    const; 
string del(int, int)         const; 

void   read(istream&, char=' ');
void   read(char delim=' ')     { read(cin,delim); }

string replace_all(string s1, string s2) const  { return replace(s1,s2,0); } 
string replace(int i, string s)          const  { return replace(i,i,s);  } 

string del_all(string s)                 const  { return del(s,0); }
string del(int i)                        const  { return del(i,i); }  

void   read_line(istream& I = cin)              { read(I,'\n'); }

string format(string) const;

int    refs() const { return ptr()->count; }

string& operator=(const char*);
string& operator=(const string&);

char  operator[](int) const;
char& operator[](int);

string operator+(const string& x)  const;
string operator+(const char* s1)   const;
string& operator+=(const char* s1);
string& operator+=(const string& x);


friend int operator==(const string& x, const char* s);
friend int operator==(const string& x, const string& y);
friend int operator!=(const string& x, const char* s);
friend int operator!=(const string& x, const string& y);
friend int operator< (const string& x, const string& y);
friend int operator> (const string& x, const string& y);
friend int operator<=(const string& x, const string& y);
friend int operator>=(const string& x, const string& y);


friend istream& operator>>(istream&, string&); 
friend ostream& operator<<(ostream&, const string&) ;

friend void Print(const string& x, ostream& out = cout) { out << x; }
friend void Read(string&  x, istream& in = cin)   { in  >> x; }


friend GenPtr  Copy(const string& x) { x.ptr()->count++;  return x.PTR; }
friend void    Clear(string& x)      { x.clear(); }
friend string& Access(const string&, const GenPtr& p){ return *(string*)&p; }

friend int  compare(const string& x, const string& y);


};

 
 
 




# 525 "../../incl/LEDA/basic.h"


 
 
 




# 551 "../../incl/LEDA/basic.h"




 
 
 

typedef int (*SIG_PF) (...);

extern SIG_PF signal(int, SIG_PF);

extern int interrupt_handler(...);

inline SIG_PF catch_interrupts(SIG_PF handler = interrupt_handler)
{ return signal(2,handler); }



extern void     init_random(int=0);
extern double   rrandom();                    
extern int      random(int a, int b);         
extern unsigned random(unsigned, unsigned);

extern float used_time();
extern float used_time(float&);
extern void  print_time(string s);

inline void print_time() { print_time(""); }

extern void wait(unsigned int seconds);


 
 
 

 
















extern int     Yes(string s);
extern int     Yes();

extern int     read_int(string s);
extern int     read_int();

extern char    read_char(string s);
extern char    read_char();

extern double  read_real(string s);
extern double  read_real();

extern char*  read_string(string s);
extern char*  read_string();

extern char*  read_line(istream& s);
extern char*  read_line();


 
 
 

typedef void (*PEH)(int,char*);    

extern PEH p_error_handler;
extern PEH set_error_handler(PEH);
extern void default_error_handler(int,char*);


inline void error_handler(int i, char* s)  { p_error_handler(i,s); }
inline void error_handler(int i, string s) { p_error_handler(i,~s); }


 
 
 

extern const char* leda_version_string;

class LEDA_INIT {

char* init_list;

public:

 LEDA_INIT();
~LEDA_INIT();

};

extern LEDA_INIT L_E_D_A;


# 25 "../../incl/LEDA/matrix.h" 2

# 1 "../../incl/LEDA/vector.h" 1
 
















 
 
 







class vector
{
  friend class matrix;

  double* v;
  int d;

  void check_dimensions(const vector&) const;
 
public:

  vector(int=0); 
  vector(double, double);
  vector(double, double, double);
  vector(const vector&);
 ~vector() { if (v) delete v; }
 

  double length() const;
  
  int    dim()    const { return d; }
  vector norm()   const { return *this/length(); }
  
  double angle(const vector&) const; 
  
  vector& operator=(const vector&);
  
  double& operator[](int);
  
  double  operator[](int) const;
  
  vector  operator+(const vector&) const;
  vector  operator-(const vector&) const;
  vector  operator*(double)        const;
  vector  operator/(double)        const;
  double  operator*(const vector&) const;
  
  int     operator==(const vector&) const;
  int     operator!=(const vector& w)  const { return !(*this == w); }
  
   



  
  
  friend ostream& operator<<(ostream& o, const vector& v);
  friend istream& operator>>(istream& i, vector& v);
  
  friend void Print(const vector& v, ostream& out=cout) { out << v; } 
  friend void Read(vector& v, istream& in=cin)  { in >> v; }
  
  friend void   Init(vector& x)          { x = vector(0); }
  friend void   Clear(vector& x)         { delete (vector*)&x; }
  friend GenPtr Copy(vector& x)          { return new vector(x); }
  friend GenPtr Convert(vector& x)       { return &x; }
  friend vector& Access(const vector&, const GenPtr& p) { return *(vector*)p; }
  friend int compare(const vector&, const vector&) { return 0; }
  
  void* operator new(_G_size_t ){ memory_elem_ptr* q = &(memory_free_list[sizeof(vector)]); if (*q==0) *q = memory_allocate_block(sizeof(vector)); memory_elem_ptr p = *q; *q = p->next; return p; } void  operator delete(void* p){ memory_elem_ptr* q = &(memory_free_list[sizeof(vector)]); memory_elem_ptr(p)->next = *q; *q = memory_elem_ptr(p); } 

# 88 "../../incl/LEDA/vector.h"

};


 
 
 




# 108 "../../incl/LEDA/vector.h"


# 26 "../../incl/LEDA/matrix.h" 2



class matrix
{
  vector** v;
  int  d1;
  int  d2;
    
public:

  matrix(int=0, int=0);
  matrix(const matrix&);
  matrix(int,int,double**);

 ~matrix();

  void* operator new(_G_size_t ){ memory_elem_ptr* q = &(memory_free_list[sizeof(matrix)]); if (*q==0) *q = memory_allocate_block(sizeof(matrix)); memory_elem_ptr p = *q; *q = p->next; return p; } void  operator delete(void* p){ memory_elem_ptr* q = &(memory_free_list[sizeof(matrix)]); memory_elem_ptr(p)->next = *q; *q = memory_elem_ptr(p); } 

# 44 "../../incl/LEDA/matrix.h"

void check_dimensions(const matrix&) const; 

void flip_rows(int,int);

double& elem(int i, int j) const { return v[i]->v[j]; }

double** triang(const matrix&, int&) const;

public:


matrix(const vector&);

int     dim1()  const  {  return d1; }
int     dim2()  const  {  return d2; }

vector& row(int) const;
vector  col(int i) const;
matrix  trans() const;

matrix  inv()   const;
double  det()   const;

matrix solve(const matrix&) const;
vector solve(const vector& b) const { return solve(matrix(b)); }

operator vector() const; 

matrix& operator=(const matrix&);

int     operator==(const matrix&)    const;
int     operator!=(const matrix& x)  const { return !(*this == x); }

vector& operator[](int i)    const { return row(i); }
double& operator()(int, int);

 

matrix operator+(const matrix&);
matrix operator-(const matrix&);

matrix operator*(double);
matrix operator*(const matrix&);
vector operator*(const vector& v) { return vector(*this * matrix(v)); }

friend ostream& operator<<(ostream&, const matrix&);
friend istream& operator>>(istream&, matrix&);

friend void Print(const matrix& M, ostream& out=cout) { out << M; } 
friend void Read(matrix& M, istream& in=cin)  { in >> M; }

friend void   Init(matrix& M)  { M = matrix(0,0); }
friend void   Clear(matrix& M) { delete (matrix*)&M; }
friend GenPtr Copy(matrix& M)  { return new matrix(M); }
friend GenPtr Convert(matrix& x) { return &x; }
friend matrix& Access(const matrix&, GenPtr p) { return *(matrix*)p; }
friend int compare(const matrix&, const matrix&) { return 0; }

};


 
 
 




# 122 "../../incl/LEDA/matrix.h"


# 17 "_matrix.c" 2


# 1 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/math.h" 1 3
 
 



















#pragma interface











# 64 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/math.h" 3

extern "C" {

double  acos(double);
double  acosh(double);
double  asin(double);
double  asinh(double);
double  atan(double);
double  atan2(double, double);
double  atanh(double);
double  cbrt(double);
double  ceil(double);
double  copysign(double,double);
double  cos(double);
double  cosh(double);
double  drem(double,double);
double  erf(double);
double  erfc(double);
double  exp(double);
double  expm1(double);
double  fabs(double);
double  finite(double);
double  floor(double);
double	fmod(double, double);
double  frexp(double, int*);
double  gamma(double);
double  hypot(double,double);
double  infnan(int);

 
int     isinf(double);
int     isnan(double);

double  j0(double);
double  j1(double);
double  jn(int, double);
double  ldexp(double, int);
double  lgamma(double);
double  log(double);
double  log10(double);
double  log1p(double);
double  logb(double);
double  modf(double, double*);
double  pow(double, double);
double  rint(double);
double  scalb(double, int);
double  sin(double);
double  sinh(double);
double  sqrt(double);
double  tan(double);
double  tanh(double);
double  y0(double);
double  y1(double);
double  yn(int, double);

double aint(double);
double anint(double);
int irint(double);
int nint(double);
}



 

 


struct libm_exception
{
  int type;
  char* name;
  double arg1, arg2, retval;
};








extern "C" int matherr(libm_exception*);



# 1 "/usr/local/lib/gcc/sun4/2.3.3/include/float.h" 1 3
 


 

    


    


    


    


    


    


    


    


    


    


    



    


    


    


    


    


    


    


    


    



    


    


    



union __convert_long_double {
  int __convert_long_double_i[4];
  long double __convert_long_double_d;
};


    


    


    


    


    


    




# 150 "/usr/local/lib/gcc/sun4/2.3.3/g++-include/math.h" 2 3


 









 







 

















































# 19 "_matrix.c" 2




 
 
 


void matrix::flip_rows(int i,int j)
{ vector* p = v[i];
  v[i] = v[j];
  v[j] = p;
 }


matrix::matrix(int dim1, int dim2)  
{
  if (dim1<0 || dim2<0) 
  error_handler(1,"matrix: negative dimension."); 

  d1=dim1; 
  d2=dim2; 

  if (d1 > 0) 
  { v = new vector*[d1];
    for (int i=0;i<d1;i++) v[i] = new vector(d2); 
   }
  else v =      ((void *)0)  ;
}


matrix::matrix(const matrix& p)  
{ 
  d1 = p.d1;
  d2 = p.d2;
    
  if (d1 > 0) 
  { v = new vector*[d1];
    for (int i=0;i<d1;i++) v[i] = new vector(*p.v[i]); 
   }
  else v =      ((void *)0)  ;
}

matrix::matrix(int dim1, int dim2, double** p)  
{ d1=dim1; 
  d2=dim2; 
  v = new vector*[d1];
  for(int i=0;i<d1;i++) 
  { v[i] = new vector(d2); 
    for(int j=0;j<d2;j++) elem(i,j) = p[i][j];
   }

 }

matrix::~matrix()  
{ if (v) 
  { while(d1--) delete v[d1]; 
    delete v;
   }
}


void matrix::check_dimensions(const matrix& mat) const
{ if (d1 != mat.d1 || d2 != mat.d2)
   error_handler(1,"incompatible matrix types.");
 }

matrix::matrix(const vector& vec)
{ d1 = vec.d;
  d2 = 1;
  v = new vector*[d1];
  for(int i=0; i<d1; i++)
  { v[i] = new vector(1);
    elem(i,0) = vec[i];
   }
    
}

matrix& matrix::operator=(const matrix& mat)
{ register int i,j;

  if (d1 != mat.d1 || d2 != mat.d2)
  { for(i=0;i<d1;i++) delete v[i];
    delete v;
    d1 = mat.d1;
    d2 = mat.d2;
    v = new vector*[d1];
    for(i=0;i<d1;i++) v[i] = new vector(d2);
   }

  for(i=0;i<d1;i++)
    for(j=0;j<d2;j++) elem(i,j) = mat.elem(i,j);

  return *this;
}

int matrix::operator==(const matrix& x) const
{ register int i,j;
  if (d1 != x.d1 || d2 != x.d2) return false;

  for(i=0;i<d1;i++)
    for(j=0;j<d2;j++)
      if (elem(i,j) != x.elem(i,j)) return false;

  return true;
 }


vector& matrix::row(int i) const
{ if ( i<0 || i>=d1 )  error_handler(1,"matrix: row index out of range");
   return *v[i];
}


double& matrix::operator()(int i, int j)
{ if ( i<0 || i>=d1 )  error_handler(1,"matrix: row index out of range");
  if ( j<0 || j>=d2 )  error_handler(1,"matrix: col index out of range");
  return elem(i,j);
}

vector matrix::col(int i)  const
{ if ( i<0 || i>=d2 )  error_handler(1,"matrix: col index out of range");
  vector result(d1);
  int j = d1;
  while (j--) result.v[j] = elem(j,i);
  return result;
}

matrix::operator vector() const
{ if (d2!=1) 
   error_handler(1,"error: cannot make vector from matrix\n");
  return col(0);
}

matrix matrix::operator+(const matrix& mat)
{ register int i,j;

  check_dimensions(mat);

  matrix result(d1,d2);
  for(i=0;i<d1;i++)
   for(j=0;j<d2;j++)
      result.elem(i,j) = elem(i,j) + mat.elem(i,j);
  return result;
}

matrix matrix::operator-(const matrix& mat)
{ register int i,j;
  check_dimensions(mat);
  matrix result(d1,d2);
  for(i=0;i<d1;i++)
   for(j=0;j<d2;j++)
      result.elem(i,j) = elem(i,j) - mat.elem(i,j);
  return result;
}

matrix matrix::operator*(double f)
{ register int i,j;
  matrix result(d1,d2);
  for(i=0;i<d1;i++)
   for(j=0;j<d2;j++)
      result.elem(i,j) = elem(i,j) *f;
  return result;
}

matrix matrix::operator*(const matrix& mat)
{ if (d2!=mat.d1)
     error_handler(1,"matrix multiplication: incompatible matrix types\n");
  
  matrix result(d1, mat.d2);
  register int i,j;

  for (i=0;i<mat.d2;i++)
  for (j=0;j<d1;j++) result.elem(j,i) = *v[j] * mat.col(i);

 return result;

}

double matrix::det() const
{
 if (d1!=d2)  
   error_handler(1,"matrix::det: matrix not quadratic.\n");

 int n = d1;

 matrix M(n,1);

 int flips;

 double** A = triang(M,flips);

 double Det = 1;

 for(int i=0;i<n;i++) Det *= A[i][i];

 for(i=0;i<n;i++) delete A[i];
 delete A;

 return (flips % 2) ? -Det : Det;

}


double** matrix::triang(const matrix& M, int& flips)  const
{
 register double **p, **q;
 register double *l, *r, *s;

 register double pivot_el,tmp;

 register int i,j, col, row;

 int n = d1;
 int d = M.d2;
 int m = n+d;

 double** A = new double*[n];

 p = A;

 for(i=0;i<n;i++) 
 { *p = new double[m];
   l = *p++;
   for(j=0;j<n;j++) *l++ = elem(i,j);
   for(j=0;j<d;j++) *l++ = M.elem(i,j);
  }

 flips = 0;

 for (col=0, row=0; row<n; row++, col++)
 { 
    
   j = row;
   for (i=row+1; i<n; i++)
     if (fabs(A[j][col]) < fabs(A[i][col])) j = i;

   if ( n > j && j > row) 
   {       if (A[j]!=A[row]) { *(int*)&A[j] ^= int(A[row]); *(int*)&A[row] ^= int(A[j]); *(int*)&A[j] ^= int(A[row]); } ;
     flips++;
    }

   tmp = A[row][col];
   q  = &A[row];

   if (fabs(tmp) < 1e-12 ) error_handler(1,"matrix has not full rank.");

   for (p = &A[n-1]; p != q; p--)
   { 
     l = *p+col;
     s = *p+m;	
     r = *q+col;

     if (*l != 0.0)
     { pivot_el = *l/tmp;
        while(l < s) *l++ -= *r++ * pivot_el;
      }

    }

  }

 return A;
}

matrix matrix::inv() const
{
 if (d1!=d2)  
     error_handler(1,"matrix::inv: matrix not quadratic.\n");
 int n = d1;
 matrix I(n,n);
 for(int i=0; i<n; i++) I(i,i) = 1;
 return solve(I);
}



matrix matrix::solve(const matrix& M) const
{

if (d1 != d2 || d1 != M.d1)
     error_handler(1, "Solve: wrong dimensions\n");

 register double **p, ** q;
 register double *l, *r, *s;

 int      n = d1;
 int      d = M.d2;
 int      m = n+d;
 int      row, col,i;


 double** A = triang(M,i);

 for (col = n-1, p = &A[n-1]; col>=0; p--, col--)
 { 
   s = *p+m;

   double tmp = (*p)[col];

   for(l=*p+n; l < s; l++) *l /=tmp;

   for(q = A; q != p; q++ )
   { tmp = (*q)[col];
     l = *q+n;
     r = *p+n;
     while(r < s)  *l++ -= *r++ * tmp;
    }
                 
  } 

  matrix result(n,d);

  for(row=0; row<n; row++)
  { l = A[row]+n;
    for(col=0; col<d; col++) result.elem(row,col) = *l++;
    delete A[row];
   }

  delete A;

  return result;
}




matrix matrix::trans() const
{ matrix result(d2,d1);
  for(int i = 0; i < d2; i++)
    for(int j = 0; j < d1; j++)
      result.elem(i,j) = elem(j,i);
  return result;
}
     

ostream& operator<<(ostream& s, const matrix& M)
{ int i;
  s <<"\n";
  for (i=0;i<M.d1;i++) s << M[i] << "\n"; 
  return s;
}

istream& operator>>(istream& s, matrix& M)
{ int i=0;
  while (i<M.d1 && s >> M[i++]);
  return s;
}
Technical Details
Message-ID: <1ii85jINN8hb@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!icsi.berkeley.edu!stolcke

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!icsi.berkeley.edu!stolcke
From: stolcke@icsi.berkeley.edu (Andreas Stolcke)
Subject: g++ 2.3.3 cc1plus illegal instruction
Message-ID: <1ii85jINN8hb@agate.berkeley.edu>
Sender: gnulists@ai.mit.edu
Organization: International Computer Science Institute, Berkeley, CA, U.S.A.
Distribution: gnu
Date: Thu, 7 Jan 1993 21:43:15 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 3018