--------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00073 Date: 04/25/98 From: ALAN LO Time: 10:21pm \/To: THOMAS J. PEDERSEN (Read 3 times) Subj: Solving linear equations <<< I acknowledge your existence >>> TJP> I need a program to solve this set of equations: TJP> a11*x1 + a12*x2 + a13*x3 + - - - - - - -+ a1n*xn = b1 TJP> a21*x1 + a22*x2 + a23*x3 + - - - - - - -+ a3n*xn = b2 TJP> a31*x1 + a32*x2 + a33*x3 + - - - - - - -+ a3n*xn = b3 TJP> - - - - - - - - - TJP> - - - - - - - - - TJP> - - - - - - - - - TJP> am1*x1 + am2*x2 + am3*x3 + - - - - - - - -+ amn*xn = bn TJP> A(matrice) X x(vector) = b(vector) TJP> There are 3 possible solutions: TJP> 1) x = k (one solution) TJP> 2) x = k + t*a1 + s*a2 + r*a3 (many solutions) TJP> 3) x =  (no solution) From what I understand of your problem, all you have to do is: given: matrix A and result vector B find: vector X If that is the case, then do what the other guy says to do. => btw: here are some more difficult ways of doing it. 1- Find the inverse of matrix A and then multiply A^(-1) {that is the inverse of A} with B. ie: A^(-1) X B = x 2- Use Cramer's Rule to set up this equation: xn = det (A*) / det(A), where A* is the matrix A with row An replaced with the vector B as a row. I think this one will work. I'm just not sure if it should be a column or row, but I'm almost sure it is a row that is needed. ... Kent Conrad wants to nuke CND because CND won't buy diseased US wheat --- Blue Wave/DOS v2.30 * Origin: Juxtaposition BBS. Lasalle, Quebec, Canada (1:167/133) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00074 Date: 04/15/98 From: BERNHARD KUEMEL Time: 12:41am \/To: TIM HUTZLER (Read 3 times) Subj: Sort Algorithm Hi Tim! 20 Mar 98 18:14, Tim Hutzler (1:119/88) wrote to Kurt Kuzba: TH> OTOH, a heap is only slightly more complex, but its effiency is TH> O(log2N), Shouldn't that be at least O(N * log2 N)? How could a sort algorithm ever be faster than O(N), which would IMHO mean that it wouldn't even have to access every element. Ciao, Bernhard! request message receipt for PGP2.6.2 public key --- GoldED/2 2.50+ * Origin: New PGP fingerprint: 4877E196972329EA-F25B0D39E5EE6341 (2:313/37.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00075 Date: 04/16/98 From: MATHIEU BOUCHARD Time: 02:54am \/To: KURT KUZBA (Read 3 times) Subj: VESATEST.CPP 2/3 KK> void GraphicsScreen::PutPixel(int x, int y, int c) KK> { if(x < 0 || x > 319 || y < 0 || y > 199) return; KK> *((char*)0xA0000000L + x + (y << 8) + (y << 6)) = (char)c; KK> } try this: void GraphicsScreen::PutPixel(int x, int y, int c) { if((unsigned)x >= 320 || (unsigned)y > 199) return; *((char*)0xA0000000L + x + (((y << 2) + y) << 6) = (char)c; } The major improvement is the first one. The 2nd normally should only benefit on marginally old computers, but that is more probable when using TC++. GCC automatically converts y*320 to either your code or mine, or even better, i think it uses the LEA asm trick. GCC might also find the 1st optimization itself as well, i'm not too sure. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00076 Date: 04/16/98 From: MATHIEU BOUCHARD Time: 03:10am \/To: FLORIAN GAMPER (Read 3 times) Subj: Re: Sort Algorithm FG> I think we are talking about "Quicksort" and "Clever Quicksort" FG> The difference is the method how to find the pivot element. FG> Quicksort is "normaly" taking the last Element of the Array. FG> while Clever Quicksort takes the first, the last and an element in FG> the middle of the array and of these the middle one (sorry for my bad FG> english hope you get that). FG> Another improvement of "quicksort" is, to implement "insertion sort" for FG> small splits of the array and to make the algorythm iterative by using FG> Stacks. FG> In this case you can save about 30% of time to sort an array Okay, that's mostly what I knew... Another improvement (my favorite) is not exchanging elements, but rather, hold the pivot in an alternate location, and use this free spot to pass things around in 2n+2 copies instead of 3n (for n exchanges) any other tricks like that? matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00077 Date: 04/16/98 From: MATHIEU BOUCHARD Time: 03:14am \/To: JABO (Read 3 times) Subj: MUSIC J> does anyone have an idea of how to load and play either Mod or Midi iles? J> Or directions to someone/something that can tell me? J> I use Turbo C++ 3.0 Jason, see http://www.hornet.org/ -- a whole new realm awaits you. You'll find dozens of libraries for playing MOD, STM, S3M, IT, XM, 669, and other similar music formats. You'll find commented source code for such, and descriptions of the formats. That's about 1% of what you'll find there. or are you still on BBS'es exclusively? matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00078 Date: 04/16/98 From: MATHIEU BOUCHARD Time: 03:18am \/To: DAVID NOON (Read 3 times) Subj: Sort Algorithm DN> Hi Mathieu, DN> MB>Still, i think the canonical implementation of qsort() is made using DN> MB>the QuickerSort algorithm. DN> I suspect you are right. I, for one, would be too ashamed to release a DN> standard library that used bubble sort. DN> MB>BTW, would someone point out to me the difference between the DN> QuickSort and the QuickerSort ? DN> The usual Quickersort incorporates Hoare's suggestion of using insertion DN> sort for shorter subfiles within Quicksort. And here is the code. I expected more than this :-) the idea is old news for me. I didn't know quickersort was just that. That kind of improvement can be done on lots of sorts. I usually use bubblesort for that kind of thing. :-) DN> ===============================quicksrt.hpp================================= DN> // Templates for Hoare's algorithm for ascending & descending sort. DN> // Note that this is Hoare's original, recursive algorithm with an DN> // insertion sort for shorter subfiles. there are probably lots of more optimal versions of this now, i guess. i found a version that doesn't really "exchange"; i found it was faster on completely random arrays, but not that good elsewhere; there could be improvements on the top of it that could make it better in most useful cases than the classic quickersort. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00079 Date: 04/16/98 From: MATHIEU BOUCHARD Time: 03:24am \/To: DAVID NOON (Read 3 times) Subj: Sort Algorithm JdBP>> set of combs with progressively finer teeth. DN> [snip] DN> MB>Except that this is with sorts, monolithic sorts vs. DN> divide-and-conquer DN> MB>sorts. It brings some freshness into the monolithic sorts camp. DN> It isn't that fresh. The idea was originally published by Donald Shell DN> about DN> 35 years ago. The code for the Shellsort algorithm I posted uses the ame DN> idea as Combsort, but applied to insertion sort instead of bubble sort. DN> Shellsort should run a little faster than Combsort. The main problem behind all this is that my university is stupid and they don't teach us stuff like that. Our vision is that in a few years it will be called Microsoft University. We're really pessimistic. DN> I use Shellsort as my default sorting algorithm. Since it performs DN> respectably on any data stream, I call it the "Swiss army knife" of sort DN> algorithms. i'll remember that. :-) matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00080 Date: 04/16/98 From: MATHIEU BOUCHARD Time: 03:27am \/To: SEBASTIAN NOZZI (Read 3 times) Subj: y SN> int Hello("All"){ SN> Can I declare a function that returns an unknown type (known at SN> run-time) SN> by value and not by reference (the famous void*)? only in recent ANSI C++ will a subclass of an object be allowed as a return type. funny. Otherwise, stick to void *. matju --- Terminate 4.00/Pro * Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00081 Date: 04/16/98 From: BOB STOUT Time: 09:20am \/To: FERDINAND GRASSMANN (Read 3 times) Subj: copyright On , Ferdinand Grassmann (2:2411/607.14@fidonet) wrote: >> Also, international law does not recognise any character-set specific >> copyright-characters, such as 0xA9 in ECMA-Latin-1, etc. Use the (c) >> sequence. RS> FYI, from a legal perspective, the "(c)" is equally meaningless. > Not in all countries. AFAIK the "(c)" is the same as the copyright sign > for example in Germany. Fredinand... Which only means that if all you have is a "(c)", anyone outside of Germany is free to ignore your notice. OTOH, if you use the word, "Copyright", or the abbreviation, "Copr.", your notice is legal in any Berne Convention signatory county. --- QM v1.00 * Origin: MicroFirm : Down to the C in chips (1:106/2000.6) --------------- FIDO MESSAGE AREA==> TOPIC: 203 C++ Ref: F5G00082 Date: 04/17/98 From: HERMAN SCHONFELD Time: 08:58am \/To: MIKE DELEONARDIS (Read 3 times) Subj: Pixel MD>Does anyone know how to put a red pixel at location 10,30? MD>am i not being able to do it because graphics.h is screwed up? Are you using the bgi? If so, don't try custom code. Use the functions it provides. If, however, you want to do custom graphics. Here are some functions. I hope you have a 32bit compiler handy. #ifdef __DJGPP__ char *vga = NULL; #endif #ifdef __WATCOM__ char *vga = (char *) 0x0A0000; #endif void setmode(unsigned char mode) { #ifdef __WATCOM__ union REGS r; r.h.al = mode; r.h.ah = 0x0; int86(0x10, &r, &r); #endif #ifdef __DJGPP_ __dpmi_regs r; r.h.al = mode; r.h.ah = 0x0; __dpmi_int(0x10, &r); __djgpp_nearptr_enable() vga = (char *)(0xA0000 + djgpp_conventional_base); #endif }; void putpixel(int x, int y, int c) { vga[y*320+x]=c; }; int getpixel(int x, int y) { return vga[y*320+x]; }; ... Best file compressor around: DEL *.* (100% compression!) --- Ezycom V1.48g0 01fd016b * Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)