-
Notifications
You must be signed in to change notification settings - Fork 9
MGroup.LinearAlgebra
Dimitris Tsapetis edited this page Apr 17, 2019
·
1 revision
Allows the user to set global settings, such as whether to use managed C# linear algebra libraries or optimized native ones. Methods exposed here are not thread-safe yet. Authors: Serafeim Bakalakos
public static class MGroup.LinearAlgebra.LibrarySettings
Static Properties
Type | Name | Summary |
---|---|---|
IBlasProvider |
Blas | |
IBlasExtensionsProvider |
BlasExtensions | |
LapackLeastSquaresFacadeDouble |
LapackLeastSquares | |
LapackLinearEquationsFacade |
LapackLinearEquations | |
LinearAlgebraProviderChoice |
LinearAlgebraProviders | Linear algebra providers are classes that wrap calls to custom or 3rd party libraries for linear algebra operations. This property allows the user to choose which library will be used. E.g. For good performance MKL providers (native dlls) should be chosen, but if the user hasn't installed Intel MKL, then they can always fall back into the managed C# providers. The default behaviour is to use managed providers, which are comparatively inefficient. It is strongly recommended to use other providers, if the required libraries are indeed installed. |
ISparseBlasProvider |
SparseBlas |
Represents a linear algebra library and its corresponding set of providers. Authors: Serafeim Bakalakos
public enum MGroup.LinearAlgebra.LinearAlgebraProviderChoice
: Enum, IComparable, IFormattable, IConvertible
Enum
Value | Name | Summary |
---|---|---|
0 |
Managed | Providers that call one or more linear algebra libraries written in managed C# code. Those libraries could be 3rd party, custom ones or any combination thereof. They should be used if the libraries required by the other providers are not installed on the user's system. |
1 |
MKL | Providers that call the highly optimized Intel Math Kernel Library (native dlls). Note that Intel MKL relies heavily on OpenMP (and sometimes TBB), which might not be desirable if the user also wants to fully utilize the available CPU cores in their own multi-threaded code. |
public static class MGroup.LinearAlgebra.RawArrayVectorExtensions
Static Methods
Type | Name | Summary |
---|---|---|
Double[] |
Add(this Double[] thisVector, Double[] otherVector) |
Performs the following operation for all i: result[i] = this[i] + ``[i]. |
void |
AddIntoThis(this Double[] thisVector, Double[] otherVector) |
Performs the following operation for all i: this[i] = this[i] + ``[i]. The resulting vector overwrites the entries of this. |
Double[] |
Axpy(this Double[] thisVector, Double[] otherVector, Double otherCoefficient) |
Performs the following operation for all i: result[i] = * [i] + this[i]. |
void |
AxpyIntoThis(this Double[] thisVector, Double[] otherVector, Double otherCoefficient) |
Performs the following operation for all i: this[i] = * [i] + this[i]. The resulting vector overwrites the entries of this. |
void |
Clear(this Double[] thisVector) |
Sets all entries of this vector to 0. |
Double[] |
Copy(this Double[] thisVector) |
Copies the entries of this instance to a new double[] array and returns it. |
void |
CopyFrom(this Double[] thisVector, Double[] sourceVector) |
Copies all entries from `` to this MGroup.LinearAlgebra.Vectors.IVector . |
Double[] |
CrossProduct(this Double[] thisVector, Double[] otherVector) |
Performs the operation: a x b = { a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]}, where a = , b = and both have exactly 3 entries. The result is a vector. Also note that: other.Cross(this) = - this.Cross(other). |
Double |
DotProduct(this Double[] thisVector, Double[] otherVector) |
Calculates the dot (or inner/scalar) product of this vector with : result = sum over all i of this[i] * [i]). |
Double[] |
Multiply(this IMatrixView matrix, Double[] vector, Boolean transposeThis = False) |
Performs the matrix-vector multiplication: oper(this) * . To multiply this * columnVector, set to false. To multiply rowVector * this, set `` to true. The resulting vector will be written in a new vector and returned. |
void |
MultiplyIntoResult(this IMatrixView matrix, Double[] lhsVector, Double[] rhsVector, Boolean transposeThis = False) |
Performs the matrix-vector multiplication: = oper(this) * . To multiply this * columnVector, set to false. To multiply rowVector * this, set to true. The resulting vector will overwrite the entries of ``. |
Double |
Norm2(this Double[] thisVector) |
Calculates the Euclidian norm or 2-norm of this vector. For more see https://en.wikipedia.org/wiki/Norm_(mathematics)#Euclidean_norm. |
Double[] |
Scale(this Double[] thisVector, Double scalar) |
Performs the following operation for all i: result[i] = `` * this[i]. The resulting vector is written in a new object and then returned. |
void |
ScaleIntoThis(this Double[] thisVector, Double scalar) |
Performs the following operation for all i: this[i] = `` * this[i]. The resulting vector overwrites the entries of this. |
Double[] |
Subtract(this Double[] thisVector, Double[] otherVector) |
Performs the following operation for all i: result[i] = this[i] - ``[i]. |
void |
SubtractIntoThis(this Double[] thisVector, Double[] otherVector) |
Performs the following operation for all i: this[i] = this[i] - ``[i]. The resulting vector overwrites the entries of this. |
Matrix |
TensorProduct(this Double[] thisVector, Double[] otherVector) |
Calculates the tensor product of this vector with ``: result[i, j] = this[i] * vector[j], for all valid i, j. |