jagomart
digital resources
picture1_Python Pdf 186079 | Programm


 132x       Filetype PDF       File size 0.24 MB       Source: www.physics.rutgers.edu


File: Python Pdf 186079 | Programm
kh computational physics 2012 programming short test of c knowledge whatisaclass whatisvirtual function whatistemplate whatisimplicit type conversion whatmeansexplicit class a int a public explicit a int a whatisreturn value optimization ...

icon picture PDF Filetype PDF | Posted on 01 Feb 2023 | 2 years ago
Partial capture of text on file.
      KH       Computational Physics- 2012                   Programming
      Short test of C++ knowledge
       • Whatisaclass?
       • Whatisvirtual function?
       • Whatistemplate?
       • Whatisimplicit type conversion?
       • Whatmeansexplicit?
         class A{
            int a;
          public:
            explicit A(int a);
         };
       • Whatisreturn value optimization?
       • Whatisthedifference between ”new” ”new[]” and ”operator new”?
       • Whatisplacement new?
           class A;
           void memory = operator new(size);
              *
           a = new(memory) A;
       • Whatismap?
       • Whatisdeque?
                                 Kristjan Haule, 2012                   –1–
      KH         Computational Physics- 2012                         Programming
                              Programminginhigh-level
                                      languages
       There is no ”perfect” computer language. The best choice depends on the problem.
       For numerics, if speed is of upmost importance:
        • fastest: Fortran77 (no aliasing)
        • similarly fast: Fortran90, C, C++
        • not so fast: Java, any interpreter (Perl, Python)
       (aliasing: concurrent acces to a single entity causes synchonization problems and resuls in performace loss).
       Humantimenecessarytowrite andmantain large scale projects:
        • Python
        • C++, Java
        • C, Fortran 90
        • Fortran77
                                      Kristjan Haule, 2012                        –2–
     KH       Computational Physics- 2012               Programming
     For some purposes like manipulating files, writting small scripts or working with strings of
     text (parsing) the best choice are interpreters: Phython, Perl...
     Historical overview on computer language development can be found at
     http://en.wikipedia.org/wiki/Timeline_of_programming_languages
     There are thousands of programming languages and new ones are created every year.
                                Compilers: Fortran, C, C++, Pascal, (Java), ...
                              Interpreters: Perl, Phython, Mathematica, (Java), ...
     Compilers: Code needsto be compiled and translated from the original language into
     machine-code(assembler). Machine code in form of an executable can be run. When you
     run the program, the computer executes the machine-code instructions in sequence.
      • advantage: The machine-codecan be very optimized and execution is fast.
      • dissadvantage:
         – Theoriginal program is no longer connected to the machine-code, and mapping the
          machine-codebackto the original program can be very difficult (hard job for
                               Kristjan Haule, 2012                –3–
      KH        Computational Physics- 2012                        Programming
            debugger, hard to connect run-time errors with the bugs in the original code)
          – Eachprocessortype has a different machine code and thus requires a completely
            different compiler.
          – Thecodecan-notbechangedonfly,muchlessflexibleandusuallyharderto code.
      Interpreters: Converts each line of a program into machine language as the statement is
      encountered. If a statement is encountered multiple times (as occurs in a loop) the machine
      mustconvert it to machine language each time.
        • advantage:
          – Easyto detect bugs because original program is still closely related to execution.
          – Noseparateexecutablefile need be stored and the same code usually runs on
            manyplatforms
          – Usually offer more flexibility and provide more powerful statements (regular
            expressions in Perl or Phython, Simplify,Solve,... in Mathematica,...)
          – Codeoftheoriginal program can be changed on the fly (can be very powerful)
        • dissadvantage: speed - Translating the same line of code into machine-code and then
          executing the machine-code has quite a high overhead.
                                     Kristjan Haule, 2012                       –4–
The words contained in this file might help you see if this file matches what you are looking for:

...Kh computational physics programming short test of c knowledge whatisaclass whatisvirtual function whatistemplate whatisimplicit type conversion whatmeansexplicit class a int public explicit whatisreturn value optimization whatisthedifference between new and operator whatisplacement void memory size whatismap whatisdeque kristjan haule programminginhigh level languages there is no perfect computer language the best choice depends on problem for numerics if speed upmost importance fastest fortran aliasing similarly fast not so java any interpreter perl python concurrent acces to single entity causes synchonization problems resuls in performace loss humantimenecessarytowrite andmantain large scale projects some purposes like manipulating les writting small scripts or working with strings text parsing are interpreters phython historical overview development can be found at http en wikipedia org wiki timeline thousands ones created every year compilers pascal mathematica code needsto compi...

no reviews yet
Please Login to review.