| 1 |
/* |
| 2 |
* Matpack Wigner3jm special function imported and modified for use in |
| 3 |
* OpenMD |
| 4 |
* |
| 5 |
* Matpack Library Release 1.9.0 |
| 6 |
* Copyright (C) 1991-2003 by Berndt M. Gammel. All rights reserved. |
| 7 |
* |
| 8 |
* Permission to use, copy, and distribute Matpack in its entirety |
| 9 |
* and its documentation for non-commercial purpose and without fee |
| 10 |
* is hereby granted, provided that this license information and |
| 11 |
* copyright notice appear unmodified in all copies. This software |
| 12 |
* is provided 'as is' without express or implied warranty. In no |
| 13 |
* event will the author be held liable for any damages arising from |
| 14 |
* the use of this software. |
| 15 |
* |
| 16 |
* Note that distributing Matpack 'bundled' in with any product is |
| 17 |
* considered to be a 'commercial purpose'. |
| 18 |
* |
| 19 |
* The software may be modified for your own purposes, but modified |
| 20 |
* versions may not be distributed without prior consent of the |
| 21 |
* author. |
| 22 |
* |
| 23 |
* Read the COPYRIGHT and README files in this distribution about |
| 24 |
* registration and installation of Matpack. |
| 25 |
*/ |
| 26 |
|
| 27 |
#ifndef MATH_WIGNER3JM_HPP |
| 28 |
#define MATH_WIGNER3JM_HPP |
| 29 |
|
| 30 |
#include "config.h" |
| 31 |
|
| 32 |
namespace MATPACK { |
| 33 |
|
| 34 |
/// return sign of number |
| 35 |
template <class T> inline int sign (T x) |
| 36 |
{ return (x > 0) ? 1 : (x < 0) ? -1 : 0; } |
| 37 |
|
| 38 |
/* |
| 39 |
* MpMin(), MpMin(): min and max templates for 2 arguments (all that |
| 40 |
* is required for Wigner3jm ) |
| 41 |
*/ |
| 42 |
template <class T> inline T MpMin (T x, T y) |
| 43 |
{ return (x<y)?x:y; } |
| 44 |
template <class T> inline T MpMax (T x, T y) |
| 45 |
{ return (x>y)?x:y; } |
| 46 |
|
| 47 |
// even and odd |
| 48 |
|
| 49 |
inline int even(int x){return!(x&1);} |
| 50 |
inline int odd(int x){return(x&1);} |
| 51 |
|
| 52 |
void Wigner3jm(RealType l1, RealType l2, RealType l3, RealType m1, |
| 53 |
RealType &m2min, RealType &m2max, RealType *thrcof, int ndim, |
| 54 |
int &errflag); |
| 55 |
} |
| 56 |
|
| 57 |
#endif |