{ $values { "u" { $sequence real } } { "v" { $sequence real } } { "x" real } }
{ $description "Computes the dot product of two vectors." } ;
-HELP: h.
+HELP: hdot
{ $values { "u" { $sequence real } } { "v" { $sequence real } } { "x" real } }
{ $description "Computes the Hermitian inner product of two vectors." } ;
{ 32 } [ { 1 2 3 } { 4 5 6 } vdot ] unit-test
{ -1 } [ { C{ 0 1 } } dup vdot ] unit-test
-{ 1 } [ { C{ 0 1 } } dup h. ] unit-test
+{ 1 } [ { C{ 0 1 } } dup hdot ] unit-test
{ { 1 2 3 } } [
{ t t t } [ { 1 2 3 } ] [ { 4 5 6 } ] vif
GENERIC: vdot ( u v -- x )
M: object vdot [ * ] [ + ] 2map-reduce ; inline
-GENERIC: h. ( u v -- x )
-M: object h. [ conjugate * ] [ + ] 2map-reduce ; inline
+GENERIC: hdot ( u v -- x )
+M: object hdot [ conjugate * ] [ + ] 2map-reduce ; inline
GENERIC: norm-sq ( v -- x )
M: object norm-sq [ absq ] [ + ] map-reduce ; inline
dupd proj v- ;
: angle-between ( v u -- a )
- [ normalize ] bi@ h. acos ;
+ [ normalize ] bi@ hdot acos ;