AngouriMath

Navigation

← Back to list of members

ScalarProduct​(AngouriMath.​Entity.​Matrix,​AngouriMath.​Entity.​Matrix)

 Method (no overloads)

Summary

Returns the scalar product of two Matrixs that are vectors with the same length.

Parameter "a"

First vector (order does not matter)

Parameter "b"

Second vector

Returns

The resulting scalar which is an Entity and not a Matrix

Example

using System;
using static AngouriMath.MathS;
using static AngouriMath.Entity;

Matrix A = @"
[[a, b],
 [c, d]]
";
Matrix B = @"
[[f, g],
 [k, l]]
";
Console.WriteLine((A * B).ToString(multilineFormat: true));
Console.WriteLine(Matrices.PointwiseMultiplication(A, B).ToString(multilineFormat: true));
Console.WriteLine("-------------------");
var v1 = Vector(1, 2, 3);
var v2 = Vector(10, 20, 30);
Console.WriteLine(v1);
Console.WriteLine(v2);
Console.WriteLine((v1.T * v2).AsScalar());

Prints
Matrix[2 x 2]
a * f + b * k   a * g + b * l   
c * f + d * k   c * g + d * l   
Matrix[2 x 2]
a * f   b * g   
c * k   d * l   
-------------------
[1, 2, 3]
[10, 20, 30]
140

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online