• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

251 Neutral

About Mantear

  • Rank
    Advanced Member
  1. Matrix inversion

    @ Brother Bob;  I'm sure that's good advice.  The problem is I don't understand enough for it to help me.  I wouldn't know how to properly condition the matrix.  I also do not know how Matlab is coming up with its answer.   @ unbird: I'm looking at your linked article.  My current solution claims to use row-pivoting; I'm going to attempt to better understand pivoting to see if: A) i'm already pivoting and B) if I'm not, if doing so will help.   Thanks.
  2. Matrix inversion

    I'm a linear algebra weakling and am looking for help anywhere I can find it.   I'm attempting to calculate the inverse of a 14x14 square matrix using Gauss-Jordan elimination.  This seems to work for some matrix input, but not all.  I end up with an almost zero value on the diagonal, which really blows up the scaling of the values in the matrix.   I'm comparing my results to those calculated by Matlab.  For my initial set of matricies, the results match (within rounding differences).  But for the following matrix, they do not.  (sorry for the large data set: if there's a better way to show this please let me know).         -10.685512    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     63.545570    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     -213.193800    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     493.092433    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     -831.846712    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     1055.702065    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     -1024.015861    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000     762.935063    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000    0.000000     -434.501577    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000    0.000000     186.205620    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000    0.000000     -58.228421    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000    0.000000     12.560150    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000    0.000000     -1.672796    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000    -1.000000     0.103779    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    0.000000    1.000000   Element (14,14) becomes nearly zero [~4.354*10^-12] when eliminating element (14,13) by scaling and subtracting row 13 from row 14.  So when I go to scale row 14 to get the diagonal value to equal 1.0, the scaling just gets huge.  [Note: I'm using long double data types to operate on.] The Matlab result is also a matrix with very large values, but they are quite different than mine.  I'm guess the very small/very large numbers are throwing things off, but I can't tell where.  Is there a different technique I need to employ to get the same answer as Matlab?
  3. why is C++ not commonly used in low level code?

    [quote name='Serapth' timestamp='1310864333' post='4836210'] 1- C is used in embedded systems because it is ( as a system ) small and easier to implement, and has a lesser footprint, especially when you are talking megabytes of available RAM. [/quote] There's no reason to use C over C++, even in embedded systems, except for legacy support. All compilers that target embedded systems allow you to turn off exceptions and RTTI, etc. If you don't use a feature, you don't pay for it. But there's no reason to use C and paint yourself in a corner if you end up needing a feature found in C++ that C doesn't have. This perspective is coming from someone who does embedded development for a living. I've worked with DSPs (TI C64x+), microprocessors (MSP430), and FPGA softcores (Xilinx MicroBlaze) all within the past 3 months. Guess what? All of the applications were written in C++. Even on the MSP430 that ran at 16MHz and had 4kBytes of RAM.
  4. [quote name='SteveDeFacto' timestamp='1309917993' post='4831594'] [code] std::vector<int> mono(buffer->data.size() / 2); for (UINT i = 0; i < mono.size(); i++) { float gain = pow(10.0f,(-6.0f / 20.0f)); mono[i] = (buffer->data[2*i] + buffer->data[2*i+1])*gain; }[/code] When I do this all I hear is hash. [/quote] What is the data type of 'data'? Where did it come from? Are stereo audio streams actually interleaved in that buffer? Is OpenAL expecting your mono buffer to be 16-bit or 32-bit?
  5. Qt Creator build settings

    I mostly develop code on embedded systems. In the past when I've done PC development I've usually used Visual Studio. Recently, I decided to use Qt Creator to create a GUI application. Qt has worked great for what I need, but now I'm trying to generate release/optimized builds of the GUI that is now nearly feature complete. The GUI does some fairly heavy data analysis, so I could really use the optimization speed boosts. However, I'm not sure how Qt Creator goes about generating its builds. I currently have a Debug configuration. It uses the debug DLLs (QtCored4.dll, QtGuid4.dll, etc) and I'm asusming gcc optimizations are default/disabled as walking through the debugger is always straight forward. However, I can't figure out how to create a Release configuration that uses the non-debug DLLs or how to pass the optimization level to gcc (ie, -O2). I feel this should be a simple task, but for the life of me I can't figure it out. Searching the Qt forums hasn't been much help. I'm using Qt Creator 2.0.0 (based on Qt 4.7.0). I've tried adding -O2 to the "Additional arguments:" under Build Steps for qmake, but it doesn't like that.
  6. I recently had a not-so-fun situation with Toyota, or rather TMCC, a company that does car loans for Toyota. We used our tax refund to pay off my wife's car. Had to send a check in the mail. Since we had no idea how long it would take to get there and for them to process it, we didn't cancel the monthly automatic payment. About a week and a half later, the check clears. The next day I try to access the credit account via the TMCC website to make sure everything was alright and to cancel the auto payment. I can't access the account as it says it is now closed. Fine by me. I figure everything is closed out. Until 2 days later when they still withdraw the next monthly payment. What the hell. The loan was paid off, the account was closed, and I can't access the account to cancel the payment, and it still goes through. We call TMCC three times over the next 5 days, getting different answers each time. Eventually get the answer that TMCC will start the process of cutting a check 10 days after the monthy payment has been fully processed. Ends up being over a month since the loan pay-off amount cleared my bank account before we get the money back. My bank said in order to reverse the charge we'd have to fill out a ton of forms and it would take just as long to get the money back. I'm not in a position where I need the money, but it's the principle of the whole thing. They took a nice month-long loan from me without my permission and without paying me interest. Bastards. I filed a complain with the BBB against them for it.
  7. Qt Serial Port library

    I'm trying to find a serial port library that is designed to work under Qt. I've tried both qextserialport and qserialdevice, but they both have serious issues. qextserialport is just flat out broken, not returning all the data it should. qserialdevice might work, but it has no non-blocking mechanisms built in. I'd have to wrap the whole thing in threads and queues myself. Is there anything out there that let's you configure the port, open the port, and then start read()ing and write()ing without having to worry about anything else? Thanks.
  8. Academia stretched thin (rant)

    [quote name='frob' timestamp='1297456576' post='4773023'] Students are expected to learn ON THEIR OWN. The primary job of the professors is to help guide the students down a path, and to answer questions whey they get stuck. It is not their job to spoon-feed the information to students. [/quote] I couldn't disagree with you more on this. The job of a professor isn't to tell people "you're wrong, any questions?". Their job is to teach. That's what they're paid to do. That's what I paid my college professors to do and for the most part they did it. If I had wanted to learn on my own, I would have gone to a library and saved myself some money. I could have learned everything I did in college from some books, but it would have taken me a hell of a lot longer. It's not the job of the students to learn everything on their own (while paying good money!) and spoon-feed the professors an easy job.
  9. C++: Qt + Boost

    Focusing on Qt Creator for now, ignoring MSVC. When I try to include <boost/asio.hpp> in my Qt Creator project I now get the following errors: undefined reference to `__gxx_personality_sj0' undefined reference to `_Unwind_SjLj_Register' undefined reference to `_Unwind_SjLj_Resume' undefined reference to `_Unwind_SjLj_Unregister' [color="#000000"]etc. Did I do something wrong when I built the libraries? Also, I don't understand what all the object files and libraries under the -binary output folder is for. Don't I just need the *.a libraries built and placed into the /lib/ folder so I can link against them? Great information so far guys. Thanks![/color]
  10. C++: Qt + Boost

    [quote name='brx' timestamp='1297154808' post='4771257'] I am a bit confused. In your original post you talked about the Visual Studio and now about Qt Creator. Both of them are IDEs (IMHO very good IDEs) that you can use to develop programs in C++ with. Qt is a class library which can be used regardless of the IDE you use. As Sneftel pointed out, you can configure the Creator to use the msvc toolchain if you desire. [/quote] Back when 1.36 was the current version of Boost, I got Boost working with Visual Studio. Compiled the static libraries to use boost::threads, etc. Since then, I've had a HDD failure, clean re-install, and haven't had to use Boost since. Now I'm using Qt Creator to make a GUI. I need a serial port interface and thought ASIO would be a good choice. So I went and got the latest Boost version 1.45. I'm trying to set up Boost so it can work both under Qt Creator (which is configured to use mingw) and under Visual Studio (2008 Pro). I don't remember how I got it to build under Visual Studio before, so I'm pretty much starting from scratch again. I didn't think I'd need to compile any of the libraries just to use ASIO, but I get about 40 warnings and 10 errors just from #include <boost/asio.hpp>. The errors are all undefined reference to `boost::system::generic_category()' So, I compiled the libraries, thinking it was missing something there, I tried including the LIBS += %BOOST_ROOT%/boost_1_45_0/boost_gcc_debug/lib/libboost_system-mgw44-mt-d-1_45.a thinking that might work, but no luck so far. It shouldn't be this hard to use ASIO, should it?
  11. C++: Qt + Boost

    [quote name='Sneftel' timestamp='1297105905' post='4770989'] [quote name='Mantear' timestamp='1297105367' post='4770985'] What I mean by "building Boost for Qt" is, doesn't Qt use mingw?[/quote] Qt is a framework. It doesn't "use" any compiler, and it can be built with either msvc or mingw. Perhaps you're talking about Qt Creator? [/quote] Yes, I am referring to Qt Creator. I'm very new to Qt and I didn't know there was a difference between Qt and Qt Creator. I do know it is definately configured to use mingw.
  12. C++: Qt + Boost

    brx: That's exactly what I need. Thanks! What I mean by "building Boost for Qt" is, doesn't Qt use mingw? Therefore it uses gcc, therefore it needs a different 'toolset' selected (gcc) to build the libraries for? What I want is for both Visual Studio and Qt to have access to the same Boost libraries. Therefore, do I not need to do the steps you called out for running bjam, but do it four times? MSVC toolset, debug and release; GCC toolset, debug and release.
  13. C++: Qt + Boost

    A while back I was able to get Boost working with a Visual Studio project. That was back using Boost version 1.36. Now I want to use it with a Qt project and figured it was a good time to update my Boost install to 1.45. The problem is, I can't figure out how to build the Boost libraries for Qt and/or Visual Studio. Most of what I've Googled for says "read the documentation" or "just type this: xxxxx". I'm pretty Windows-centric, so I easily get lost in much of the documentation and most of the command line suggestions just don't work. Does anyone have a "How to Install Boost for Dummies" link? I'd like to get it working under both Visual Studio and Qt. All I really need at this point is the ASIO library for some serial port communication. When I include <boost/asio.hpp> under Qt, I get undefined references, which I'm assuming (incorrectly?) that I need to have the libraries built for ASIO.
  14. which is fastest way to inverse a number in c++?

    Keep it simple. x = -x; Let the compiler perform any tricks required to make it fast. Worry about making your program run correctly before worrying about making it run fast. If you think this operation is too slow, profile it. Only then worry about it if it's truly a bottleneck (it shouldn't be).
  15. How are your eyes?

    I used to be horribly nearsighted. Would probably have been considered legally blind. I couldn't make out who someone was unless they were no more than a few feet away. No way could I drive without glasses or contact lenses. Lasik FTW! I now have at least 20/25 vision in each eye. No more being blind when waking up! Best part is my company paid for every penny of the surgery. It was covered under our out-of-pocket benefit. They figured it's cheaper in the long run than having to cover out-of-pocket costs for glasses/contacts year after year.
  • Advertisement