Skip to content

Библиотека со структурами данных и полезными методами расширения.

Notifications You must be signed in to change notification settings

Jeffeek/CyberMath

Repository files navigation

CyberMath

A little library with useful data structures and extension methods.

Some stats


Nuget Package

PM> Install-Package CyberMath -Version 1.0.3


  • Two-dimensional arrays

    • IsSquare -> bool (Represent a bool(true) value if the rows count equals elements count on each row; otherwise false)

    • [int row, int column] -> T (Indexer for matrix)

    • ProcessFunctionOverData -> void (Do action over every element in matrix)

    • ElementsInRow -> int (Returns count of elements in row)

    • GetColumnsEnumerable -> IEnumerable<IEnumerable<T>> (Returns enumerable, which is 'walks' on the column neither default)

    • RowsCount -> int (Count of rows in matrix)

    • Matrix

      • ColumnsCount -> int (Count of columns in matrix)
      • Transpose -> IMatrix<T> Creates a new transposed matrix

      • DynamicMatrix
        • AddColumn -> void (Inserting a new column to the end of matrix)
        • InsertColumn -> void (Inserting the column into matrix by index)
        • AddRow -> void (Inserting a new row to the end of matrix)
        • InsertRow -> void (Inserting the row into matrix by index)
        • RemoveColumn -> void (Removes a column in matrix at index)
        • RemoveRow -> void (Removes a row in matrix at index)

    • Jugged Matrix

      • SortRows -> IJuggedMatrix<T> (Sorts rows in matrix by count of elements)
      • SortRowsByDescending -> IJuggedMatrix<T> (Sorts rows by descending in matrix by count of elements)

      • Dynamic Jugged Matrix
        • AddColumn -> void (Inserting a new column to the end of matrix if it's possible)
        • InsertColumn -> void (Inserting the column into matrix by index)
        • AddRow -> void (Inserting a new row to the end of matrix)
        • InsertRow -> void (Inserting the row into matrix by index)
        • RemoveColumn -> void (Removes a column in matrix at index)
        • RemoveRow -> void (Removes a row in matrix at index)

  • Binary Trees

    • Root -> IBinaryTreeNode<T> (Reference to the main node, called Root)
    • IsEmpty -> bool (bool result which show the emptiness of IBinaryTree)
    • TraversalOrderType -> TraversalOrderType (Traversal strategy for foreach statement)
    • Depth -> int (Depth of BinaryTree)
    • Inorder -> IEnumerable<T> (Returns an inorder traversal IEnumerable collection)
    • Preorder -> IEnumerable<T> (Returns an preorder traversal IEnumerable collection)
    • Postorder -> IEnumerable<T> (Returns an postorder traversal IEnumerable collection)
    • Min -> T *(Returns minimal element in BinaryTree)
    • Max -> T *(Returns maximal element in BinaryTree)
    • AddRange -> void *(Adds IEnumerable collection into BinaryTree)
    • MergeWith -> void (Merges initial IBinaryTree with another IBinaryTree)

    • Vanilla Tree

    • AVL Tree

    • Red Black Tree

    • Common interface: IBinaryTree : ICollection, IDisposable where T : IComparable<T>, IComparable


  • Helpers
    • FixExpressionConverter (Class for converting xFix expression into yFix)
      • Infix -> Postfix => A+B*C/(E-F) -> ABC*EF-/+
      • Infix -> Prefix => A+B*C/(E-F) -> +A*B/C-EF
      • Postfix -> Infix => ABC*EF-/+ -> (A+((B*C)/(E-F)))
      • Postfix -> Prefix => ABC/-AK/L-* -> *-A/BC-/AKL
      • Prefix -> Infix => +A*B/C-EF -> (A+(B*(C/(E-F))))
      • Prefix -> Postfix => *-A/BC-/AKL -> ABC/-AK/L-*
    • GenericTypesExtensions (Just a class to make out life and programming faster and more productive)
      • SerializableDeepCopy -> T (Makes a deep copy of item. Type of item should be marked as [Serializable]; otherwise -> EXCEPTION)

  • Extension methods

    • Extension methods for collections
      • Swap -> void (Swaps items in indexed collections)
      • Shuffle -> void (Shuffles the items in an indexed collection)
      • RandomItem -> T (Gets a random item from collection)
      • Permutations -> IEnumerable<IEnumerable<T>> (Returns a new collections with all permutations of elements with repeating elements)
      • PermutationsWithRepeat -> IEnumerable<IEnumerable<T>&gt (Returns a new collections with all permutations of elements with repeating elements)

    • Extension methods for strings
      • Concat -> string
      • IsPalindrome -> bool (Checks string for palindromicity)
      • IsAnagramOf -> bool (Checks two string for anagramism)
      • WordsFrequency -> Dictionary<char,int> (Creates a Dictionary<TKey,TValue> where TKey is char and TValue is int (count of TKey in input string))
      • ToInt32 -> int (Returns string parsed to Int32)
      • ToInt64 -> long (Returns string parsed to Int64)
      • ToAlternatingCase -> (Converts input string to alternating case)

    • Extension methods for Random
      • NextDouble -> double (Generates a double number between min and max)
      • NextLong -> long (Generates a long number between min and max)

    • Extension methods for Int32 and Int64

      • IsPalindrome -> bool (Checks number for palindromicity)
      • IsOdd -> bool (Checks is number odd)
      • IsEven -> bool (Checks is number even)
      • GCD (greatest common divisor) -> int/long (Calculates greatest common divisor between two numbers)
      • LCM (lowest common multiple) -> int/long (Calculates lowest common multiple between two numbers)
      • Swap -> void (Swaps two integers in memory (by ref))
      • GetLength -> int (Calculates the length of number)
      • ToBinary -> string (Converts number to binary(2) format)
      • ToHex -> string (Converts number to HEX(16) format)
      • GetDigits -> IEnumerable<bytes> Return all digits in number as a collection

      • Extension methods for Prime Numbers
        • IsPrime -> bool (Checks number for primality)
        • GenerateRandomPrimeNumber -> Int32/Int64 (Generating one random prime number)
        • GeneratePrimeNumbers -> IEnumerable<Int32/Int64> (Generates IEnumerable collection of prime numbers which are less than max)

    • Extension methods for all matrices

      • IsMaxInColumn -> bool (Returns bool value if element at [i, j] is max in IMatrixBase<IComparable> matrix column at index j)
      • IsMinInRow -> bool (Returns bool value if element at [i, j] is min in IMatrixBase<IComparable> matrix row at index i)
      • DiagonalSum -> int/long/souble/decimal/short and Nullable (ONLY FOR SQUARE Calculates sum of all items on main diagonal)
      • SideDiagonalSum -> int/long/souble/decimal/short and Nullable (ONLY FOR SQUARE Calculates sum of all items on side diagonal)
      • SumSaddlePoints -> int/long/souble/decimal/short and Nullable (Calculates sum of all saddle points in matrix)
      • CreateMatrixWithoutRow -> IJuggedMatrix/IMatrix (Creates a new matrix without row at rowIndex)
      • CreateMatrixWithoutColumn -> IJuggedMatrix/IMatrix (Creates a new matrix without column at columnIndex)

      • For primitives
        • Add -> IMatrixBase<T> (Returns the add IMatrixBase first and IMatrixBase second)
        • Sub -> IMatrixBase<T> (Returns the sub IMatrixBase first and IMatrixBase second)
        • MulOnNumber -> IMatrixBase<T> (Returns the multiplication IMatrixBase matrix on number)
        • FillRandomly -> void (Fills matrix with randomly generated items)

    • Extension methods for JuggedMatrix<T>
      • CountOnEachRow -> IEnumerable<int> (Returns an IEnumerable with the count of elements on each row of matrix)
      • ToMatrix -> IMatrix<T> (Creates a new instance of IMatrix from IJuggedMatrix)
      • CreateVanilla -> T[][] (Creates a vanilla array of arrays on base of JuggedMatrix)

    • Extension methods for IMatrix<T>

      • ToJuggedMatrix -> IJuggedMatrix<T> (Creates a new instance of IJuggedMatrix from IMatrix)
      • CreateVanilla -> T[,] (Creates a vanilla matrix on base of Matrix)

      • For primitives
        • Multiplication -> IMatrix<T> (Returns the mul IMatrix first and IMatrix second)
        • CalculateDeterminant -> int/long/double/decimal and Nullable (Calculates determinant for IMatrix)
        • CreateInvertibleMatrix -> IMatrix<double> (Creates inverted matrix from IMatrix)
        • CalculateMinor -> int/long/souble/decimal and Nullable (Calculates minor for IMatrix)

  • Equations
    • Quadratic (Represents a class for building quadratic equation)

About

Библиотека со структурами данных и полезными методами расширения.

Topics

Resources

Stars

Watchers

Forks

Languages