1#ifndef ALGEBRA_INCLUDED
2#define ALGEBRA_INCLUDED
13 template<
class Element >
18 friend Element
operator - (
const Element &e ){
return e.additiveInverse(); }
21 friend Element
operator - (
const Element &e1 ,
const Element &e2 ){
return e1 + (-e2); }
24 friend Element&
operator += ( Element &e1 ,
const Element &e2 ){ e1 = e1 + e2 ;
return e1; }
27 friend Element&
operator -= ( Element &e1 ,
const Element &e2 ){ e1 = e1 - e2 ;
return e1; }
35 template<
class Element >
40 friend Element
operator / (
const Element &e1 ,
const Element &e2 ){
return e1 * e2.multiplicativeInverse(); }
43 friend Element&
operator *= ( Element &e1 ,
const Element &e2 ){ e1 = e1 * e2 ;
return e1; }
46 friend Element&
operator /= ( Element &e1 ,
const Element &e2 ){ e1 = e1 / e2 ;
return e1; }
56 template<
class Element >
64 template<
class Element >
69 friend Element
operator - (
const Element &e1 ,
const Element &e2 ){
return e1 + (-e2); }
72 friend Element
operator / (
const Element &e ,
double s ){
return e * (1./s); }
75 friend Element&
operator += ( Element & e1 ,
const Element &e2 ){ e1 = e1 + e2 ;
return e1; }
78 friend Element&
operator -= ( Element &e1 ,
const Element &e2 ){
return e1 += (-e2); }
81 friend Element&
operator *= ( Element &e ,
double s ){ e = e*s ;
return e; }
84 friend Element&
operator /= ( Element &e ,
double s ){
return e *= (1./s); }
87 friend Element
operator - (
const Element &e ){
return e * (-1.); }
90 friend Element
operator * (
double s ,
const Element &e ){
return e*s; }
97 template<
class Element >
102 static double Dot(
const Element &e1 ,
const Element &e2 ){
return e1.dot(e2); }
105 static double SquareNorm(
const Element &e ){
return e.dot(e); }
108 static double Length(
const Element &e ){
return sqrt( e.dot(e) ); }
132 template<
class Element >
141 template<
class Element >
146 friend Element&
operator *= ( Element &e1 ,
const Element &e2 ){ e1 = e1 * e2 ;
return e1; }
static double Distance(const Element &e1, const Element &e2)
Definition: algebra.h:114
double length(void) const
Definition: algebra.h:120
static double SquareNorm(const Element &e)
Definition: algebra.h:105
double squareNorm(void) const
Definition: algebra.h:117
static double Length(const Element &e)
Definition: algebra.h:108
static double SquareDistance(const Element &e1, const Element &e2)
Definition: algebra.h:111
Element unit(void) const
Definition: algebra.h:123
static double Dot(const Element &e1, const Element &e2)
Definition: algebra.h:102
friend Element operator-(const Element &e)
Definition: algebra.h:18
friend Element & operator+=(Element &e1, const Element &e2)
Definition: algebra.h:24
friend Element & operator-=(Element &e1, const Element &e2)
Definition: algebra.h:27
Definition: algebra.h:143
friend Element & operator*=(Element &e1, const Element &e2)
Definition: algebra.h:146
Definition: algebra.h:133
friend Element operator/(const Element &e1, const Element &e2)
Definition: algebra.h:40
friend Element & operator/=(Element &e1, const Element &e2)
Definition: algebra.h:46
friend Element & operator*=(Element &e1, const Element &e2)
Definition: algebra.h:43
friend Element & operator*=(Element &e, double s)
Definition: algebra.h:81
friend Element operator*(double s, const Element &e)
Definition: algebra.h:90
friend Element operator/(const Element &e, double s)
Definition: algebra.h:72
friend Element operator-(const Element &e1, const Element &e2)
Definition: algebra.h:69
friend Element & operator+=(Element &e1, const Element &e2)
Definition: algebra.h:75
friend Element & operator-=(Element &e1, const Element &e2)
Definition: algebra.h:78
friend Element & operator/=(Element &e, double s)
Definition: algebra.h:84