Show / Hide Table of Contents

Class Algebra

Contains algebraic and general-purpose mathematical functions.

Inheritance
object
Algebra
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Math
Assembly: MCART.dll
Syntax
public static class Algebra

Methods

| Edit this page View Source

AreNegative<T>(IEnumerable<T>)

Returns true if all numbers are negative.

Declaration
public static bool AreNegative<T>(this IEnumerable<T> values) where T : struct, IComparable<T>
Parameters
Type Name Description
IEnumerable<T> values

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are negative, false otherwise.

Type Parameters
Name Description
T
| Edit this page View Source

AreNegative<T>(params T[])

Returns true if all numbers are negative.

Declaration
public static bool AreNegative<T>(params T[] values) where T : struct, IComparable<T>
Parameters
Type Name Description
T[] values

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are negative, false otherwise.

Type Parameters
Name Description
T
| Edit this page View Source

AreNotZero<T>(IEnumerable<T>)

Returns true if all numbers are not equal to zero.

Declaration
public static bool AreNotZero<T>(this IEnumerable<T> x) where T : struct, IComparable<T>
Parameters
Type Name Description
IEnumerable<T> x

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are not equal to zero, false otherwise.

Type Parameters
Name Description
T

Type of elements to check.

| Edit this page View Source

AreNotZero<T>(params T[])

Returns true if all numbers are not equal to zero.

Declaration
public static bool AreNotZero<T>(params T[] x) where T : struct, IComparable<T>
Parameters
Type Name Description
T[] x

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are not equal to zero, false otherwise.

Type Parameters
Name Description
T

Type of elements to check.

| Edit this page View Source

ArePositive<T>(IEnumerable<T>)

Returns true if all numbers are positive.

Declaration
public static bool ArePositive<T>(this IEnumerable<T> values) where T : struct, IComparable<T>
Parameters
Type Name Description
IEnumerable<T> values

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are positive, false otherwise.

Type Parameters
Name Description
T
| Edit this page View Source

ArePositive<T>(params T[])

Returns true if all numbers are positive.

Declaration
public static bool ArePositive<T>(params T[] values) where T : struct, IComparable<T>
Parameters
Type Name Description
T[] values

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are positive, false otherwise.

Type Parameters
Name Description
T
| Edit this page View Source

AreValid(IEnumerable<double>)

Determines if a collection of double are valid operable real numbers.

Declaration
public static bool AreValid(this IEnumerable<double> values)
Parameters
Type Name Description
IEnumerable<double> values

Collection of double to check.

Returns
Type Description
bool

true if all elements of values are operable numbers, in other words, if they are not NaN or Infinity; otherwise, returns false.

| Edit this page View Source

AreValid(IEnumerable<float>)

Determines if a collection of float are valid operable real numbers.

Declaration
public static bool AreValid(this IEnumerable<float> values)
Parameters
Type Name Description
IEnumerable<float> values

Collection of float to check.

Returns
Type Description
bool

true if all elements of values are operable numbers, in other words, if they are not NaN or Infinity; otherwise, returns false.

| Edit this page View Source

AreValid(params double[])

Determines if a collection of double are valid operable real numbers.

Declaration
public static bool AreValid(params double[] values)
Parameters
Type Name Description
double[] values

Collection of double to check.

Returns
Type Description
bool

true if all elements of values are operable numbers, in other words, if they are not NaN or Infinity; otherwise, returns false.

| Edit this page View Source

AreValid(params float[])

Determines if a collection of float are valid operable real numbers.

Declaration
public static bool AreValid(params float[] values)
Parameters
Type Name Description
float[] values

Collection of float to check.

Returns
Type Description
bool

true if all elements of values are operable numbers, in other words, if they are not NaN or Infinity; otherwise, returns false.

| Edit this page View Source

AreZero<T>(IEnumerable<T>)

Returns true if all numbers are equal to zero.

Declaration
public static bool AreZero<T>(this IEnumerable<T> values) where T : struct, IComparable<T>
Parameters
Type Name Description
IEnumerable<T> values

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are equal to zero, false otherwise.

Type Parameters
Name Description
T

Type of elements to check.

| Edit this page View Source

AreZero<T>(params T[])

Returns true if all numbers are equal to zero.

Declaration
public static bool AreZero<T>(params T[] values) where T : struct, IComparable<T>
Parameters
Type Name Description
T[] values

Numbers to check.

Returns
Type Description
bool

true if all numbers in the collection are equal to zero, false otherwise.

Type Parameters
Name Description
T

Type of elements to check.

| Edit this page View Source

IsPrime(in byte)

Checks if a number is prime.

Declaration
public static bool IsPrime(this in byte number)
Parameters
Type Name Description
byte number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrime(in short)

Checks if a number is prime.

Declaration
public static bool IsPrime(this in short number)
Parameters
Type Name Description
short number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrime(in int)

Checks if a number is prime.

Declaration
public static bool IsPrime(this in int number)
Parameters
Type Name Description
int number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrime(in long)

Checks if a number is prime using trial division.

Declaration
public static bool IsPrime(this in long number)
Parameters
Type Name Description
long number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrime(in sbyte)

Checks if a number is prime.

Declaration
[CLSCompliant(false)]
public static bool IsPrime(this in sbyte number)
Parameters
Type Name Description
sbyte number

Number to check.

Returns
Type Description
bool

trueif the number is prime, false otherwise.

| Edit this page View Source

IsPrime(in ushort)

Checks if a number is prime.

Declaration
[CLSCompliant(false)]
public static bool IsPrime(this in ushort number)
Parameters
Type Name Description
ushort number

Number to check.

Returns
Type Description
bool

trueif the number is prime, false otherwise.

| Edit this page View Source

IsPrime(in uint)

Checks if a number is prime.

Declaration
[CLSCompliant(false)]
public static bool IsPrime(this in uint number)
Parameters
Type Name Description
uint number

Number to check.

Returns
Type Description
bool

trueif the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(in byte)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
public static bool IsPrimeMp(this in byte number)
Parameters
Type Name Description
byte number

Number to check.

Returns
Type Description
bool

trueif the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(in short)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
public static bool IsPrimeMp(this in short number)
Parameters
Type Name Description
short number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(in int)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
public static bool IsPrimeMp(this in int number)
Parameters
Type Name Description
int number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(long)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
public static bool IsPrimeMp(this long number)
Parameters
Type Name Description
long number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(in sbyte)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
[CLSCompliant(false)]
public static bool IsPrimeMp(this in sbyte number)
Parameters
Type Name Description
sbyte number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(in ushort)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
[CLSCompliant(false)]
public static bool IsPrimeMp(this in ushort number)
Parameters
Type Name Description
ushort number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsPrimeMp(in uint)

Checks if a number is prime using trial division, executing the operation on all processors in the system.

Declaration
[CLSCompliant(false)]
public static bool IsPrimeMp(this in uint number)
Parameters
Type Name Description
uint number

Number to check.

Returns
Type Description
bool

true if the number is prime, false otherwise.

| Edit this page View Source

IsTwoPow(in byte)

Determines if the value is a power of 2.

Declaration
public static bool IsTwoPow(in byte value)
Parameters
Type Name Description
byte value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in short)

Determines if the value is a power of 2.

Declaration
public static bool IsTwoPow(in short value)
Parameters
Type Name Description
short value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in int)

Determines if the value is a power of 2.

Declaration
public static bool IsTwoPow(in int value)
Parameters
Type Name Description
int value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in long)

Determines if the value is a power of 2.

Declaration
public static bool IsTwoPow(in long value)
Parameters
Type Name Description
long value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in sbyte)

Determines if the value is a power of 2.

Declaration
[CLSCompliant(false)]
public static bool IsTwoPow(in sbyte value)
Parameters
Type Name Description
sbyte value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in ushort)

Determines if the value is a power of 2.

Declaration
[CLSCompliant(false)]
public static bool IsTwoPow(in ushort value)
Parameters
Type Name Description
ushort value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in uint)

Determines if the value is a power of 2.

Declaration
[CLSCompliant(false)]
public static bool IsTwoPow(in uint value)
Parameters
Type Name Description
uint value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsTwoPow(in ulong)

Determines if the value is a power of 2.

Declaration
[CLSCompliant(false)]
public static bool IsTwoPow(in ulong value)
Parameters
Type Name Description
ulong value

Value to check.

Returns
Type Description
bool

true if the value is a power of 2, false otherwise.

| Edit this page View Source

IsValid(in double)

Determines if a double is a valid operable real number.

Declaration
public static bool IsValid(this in double value)
Parameters
Type Name Description
double value

double to check.

Returns
Type Description
bool

true if value is a valid real double, in other words, if it is not equal to NaN, PositiveInfinity or NegativeInfinity; otherwise, returns false.

| Edit this page View Source

IsValid(in float)

Determines if a float is a valid operable real number.

Declaration
public static bool IsValid(this in float value)
Parameters
Type Name Description
float value

float to check.

Returns
Type Description
bool

true if value is a valid real float, in other words, if it is not equal to NaN, PositiveInfinity or NegativeInfinity; otherwise, returns false.

| Edit this page View Source

IsWhole(in double)

Determines if a double is a whole number.

Declaration
public static bool IsWhole(this in double value)
Parameters
Type Name Description
double value

Value to check.

Returns
Type Description
bool

true if the value is an integer; otherwise, false

| Edit this page View Source

Nearest2Pow(in int)

Calculates the nearest power of two greater than or equal to the value.

Declaration
public static long Nearest2Pow(in int value)
Parameters
Type Name Description
int value

Input value. A power of two greater than or equal to this value will be searched for.

Returns
Type Description
long

A long value that is the result of the operation.

| Edit this page View Source

NearestPowerUp(in double, in double)

Returns the first power of powerBase that is greater than value.

Declaration
public static double NearestPowerUp(in double value, in double powerBase)
Parameters
Type Name Description
double value

Target number.

double powerBase

Power base.

Returns
Type Description
double

A double that is the first power of powerBase that is greater than value.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX