
/*******************************************************************************
*
* File linalg.h
*
* Copyright (C) 2005 Martin Luescher
*
* This software is distributed under the terms of the GNU General Public
* License (GPL)
*
*******************************************************************************/

#ifndef LINALG_H
#define LINALG_H

#ifndef SU3_H
#include "su3.h"
#endif

#ifndef LINALG_C
extern complex spinor_prod(int vol,int icom,spinor *pk,spinor *pl);
extern float spinor_prod_re(int vol,int icom,spinor *pk,spinor *pl);
extern float norm_square(int vol,int icom,spinor *pk);
extern void mulc_spinor_add(int vol,spinor *pk,spinor *pl,complex z);
//pl = pk + z*pl
void mulc_spinor_add2(int vol,spinor *pk,spinor *pl,complex z);
extern void project(int vol,int icom,spinor *pk,spinor *pl);
extern float normalize(int vol,int icom,spinor *pk);
extern void rotate(int vol,int n,spinor **ppk,complex v[]);
extern void mulg5(int vol,spinor *pk);
extern void mulmg5(int vol,spinor *pk);
extern void mulg5_spinor_sub(int vol,spinor *pk,spinor *pl);
#endif

#ifndef LINALG_DBLE_C
extern complex_dble spinor_prod_dble(int vol,int icom,spinor_dble *pk,
                                     spinor_dble *pl);
extern double spinor_prod_re_dble(int vol,int icom,spinor_dble *pk,
                                  spinor_dble *pl);
extern double norm_square_dble(int vol,int icom,spinor_dble *pk);
extern void mulc_spinor_add_dble(int vol,spinor_dble *pk,spinor_dble *pl,
                                 complex_dble z);
extern void project_dble(int vol,int icom,spinor_dble *pk,spinor_dble *pl);
extern double normalize_dble(int vol,int icom,spinor_dble *pk);
extern void rotate_dble(int vol,int n,spinor_dble **ppk,complex_dble v[]);
extern void mulg5_dble(int vol,spinor_dble *pk);
extern void mulmg5_dble(int vol,spinor_dble *pk);
extern void mulg5_spinor_sub_dble(int vol,spinor_dble *pk,spinor_dble *pl);
#endif

#ifndef VALG_C
extern complex vprod(int n,int icom,complex *v,complex *w);
extern float vnorm_square(int n,int icom,complex *v);
extern void mulc_vadd(int n,complex *v,complex *w,complex z);
extern void vproject(int n,int icom,complex *v,complex *w);
extern float vnormalize(int n,int icom,complex *v);
extern void vrotate(int n,int nv,complex **pv,complex *a);
#endif

#ifndef VALG_DBLE_C
extern complex_dble vprod_dble(int n,int icom,complex_dble *v,complex_dble *w);
extern double vnorm_square_dble(int n,int icom,complex_dble *v);
extern void mulc_vadd_dble(int n,complex_dble *v,complex_dble *w,
                           complex_dble z);
extern void vproject_dble(int n,int icom,complex_dble *v,complex_dble *w);
extern double vnormalize_dble(int n,int icom,complex_dble *v);
extern void vrotate_dble(int n,int nv,complex_dble **pv,complex_dble *a);
#endif

#endif
