Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:53

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4AnalyticalPolSolver
0027 //
0028 // Class description:
0029 //
0030 // G4AnalyticalPolSolver allows the user to solve analytically a polynomial
0031 // equation up to the 4th order. This is used by CSG solid tracking functions
0032 // like G4Torus.
0033 //
0034 // The algorithm has been adapted from the CACM Algorithm 326:
0035 //
0036 //   Roots of low order polynomials
0037 //   Author: Terence R.F.Nonweiler
0038 //   CACM  (Apr 1968) p269
0039 //   Translated into C and programmed by M.Dow
0040 //   ANUSF, Australian National University, Canberra, Australia
0041 //   m.dow@anu.edu.au
0042 //
0043 // Suite of procedures for finding the (complex) roots of the quadratic,
0044 // cubic or quartic polynomials by explicit algebraic methods.
0045 // Each Returns:
0046 //
0047 //   x=r[1][k] + i r[2][k]  k=1,...,n, where n={2,3,4}
0048 //
0049 // as roots of:
0050 // sum_{k=0:n} p[k] x^(n-k) = 0
0051 // Assumes p[0] != 0. (< or > 0) (overflows otherwise)
0052 
0053 // Author: V.Grichine, 13.05.2005
0054 // --------------------------------------------------------------------
0055 #ifndef G4AN_POL_SOLVER_HH
0056 #define G4AN_POL_SOLVER_HH 1
0057 
0058 #include "G4Types.hh"
0059 
0060 class G4AnalyticalPolSolver
0061 {
0062  public:
0063   G4AnalyticalPolSolver();
0064   ~G4AnalyticalPolSolver();
0065 
0066   G4int QuadRoots(G4double p[5], G4double r[3][5]);
0067   G4int CubicRoots(G4double p[5], G4double r[3][5]);
0068   G4int BiquadRoots(G4double p[5], G4double r[3][5]);
0069   G4int QuarticRoots(G4double p[5], G4double r[3][5]);
0070 };
0071 
0072 #endif