AiLibrary  v1.3.0
A single-header C++ Library from Ailurus Studio
ai Namespace Reference

Main namespace. More...

Functions

INLINE std::string getVersion ()
 Get version of the library. More...
 
template<typename T >
INLINE std::string string (const T value)
 Converts input into a string. More...
 
INLINE bool hasPrefix (const std::string &text, const std::string &prefix)
 Checks if a string begins with a substring. More...
 
INLINE bool hasSuffix (const std::string &text, const std::string &suffix)
 Checks if a string ends with a substring. More...
 
INLINE bool contains (const std::string &text, const std::string &substring)
 Checks if a string contains a substring. More...
 
INLINE std::string replace (std::string text, const std::string &substring, const std::string &replacement)
 Replaces all occurrences of a substring in a copy of the initial string with your text. More...
 
INLINE void applyReplace (std::string &text, const std::string &substring, const std::string &replacement)
 Modifies your string by replacing all occurrences of a substring string with your text. More...
 
INLINE bool equal (const char *charString, const std::string string1)
 Checks if a char string is equal to a std::string. More...
 
INLINE std::string toUpperCase (std::string input)
 Convert a string to upper case. More...
 
INLINE std::string toLowerCase (std::string input)
 Convert a string to lower case. More...
 
template<typename T >
INLINE std::string prependNumber (const T value, const std::size_t symbolsBeforePoint, const char symbolToPrepend='0')
 
INLINE std::size_t counter (const std::size_t value=0)
 Returns ID starting from zero or the specified value. More...
 
INLINE std::string marker (const std::size_t value=0)
 Returns a string containing the word "Marker" and its ID. More...
 
INLINE void printMarker (const std::size_t value=0)
 Calls marker() and prints result to stdout. More...
 
template<typename T >
INLINEsign (const T value)
 Returns signum of the value. More...
 
template<typename T >
INLINEmin (const T a, const T b)
 Returns minimum of two values. More...
 
template<typename T >
INLINEmax (const T a, const T b)
 Returns maximum of two values. More...
 
template<typename T >
INLINEmin (const std::vector< T > &input)
 Returns minimum of vector values. More...
 
template<typename T >
INLINEmax (const std::vector< T > &input)
 Returns maximum of vector values. More...
 
template<typename T >
INLINEmin (const std::vector< std::vector< T > > &input)
 Returns minimum of matrix values. More...
 
template<typename T >
INLINEmax (const std::vector< std::vector< T > > &input)
 Returns maximum of matrix values. More...
 
template<typename T >
INLINE bool isSquare (const T value)
 Checks if number is square. More...
 
template<typename T >
INLINE bool isSquare (const std::vector< std::vector< T > > &matrix)
 Checks if matrix is square. More...
 
template<typename T >
INLINE void generateRandomVector (std::vector< T > &vector, const std::size_t length, const T min=std::numeric_limits< T >::min(), const T max=std::numeric_limits< T >::max())
 
template<typename T >
INLINE void generateRandomMatrix (std::vector< std::vector< T > > &matrix, const std::size_t xSize, const std::size_t ySize, const T min=std::numeric_limits< T >::min(), const T max=std::numeric_limits< T >::max())
 Fill matrix with random values. More...
 
template<typename T >
INLINE void generateRandomMatrix (std::vector< std::vector< T > > &matrix, const std::size_t size, const T min=std::numeric_limits< T >::min(), const T max=std::numeric_limits< T >::max())
 Fill matrix with random values. More...
 
template<typename T >
void rotateMatrix (std::vector< std::vector< T > > &matrix, const bool rotateClockwise=false)
 Rotate square matrix. More...
 
template<typename T >
INLINE void inverseMatrix (std::vector< std::vector< T > > matrix, std::vector< std::vector< T > > &inverse)
 
template<typename T >
INLINE void inverseMatrix (std::vector< std::vector< T > > &matrix)
 
template<typename T >
INLINE void translateMatrixIntoVector (std::vector< std::vector< T > > &matrix, std::vector< T > &vector)
 Elongates matrix into a vector. More...
 
template<typename T >
INLINE void translateVectorIntoSquareMatrix (std::vector< T > &vector, std::vector< std::vector< T > > &matrix)
 Transform vector into a square matrix (if possible) More...
 
template<typename T >
INLINE void generateCirculantMatrix (std::vector< std::vector< T > > &matrix, std::vector< T > &source, const bool moveToTheRight=true)
 
template<typename T >
INLINE void multiply (const std::vector< std::vector< T > > &left, const std::vector< std::vector< T > > &right, std::vector< std::vector< T > > &result)
 
template<typename T >
INLINE void multiply (const std::vector< std::vector< T > > &left, const std::vector< T > &right, std::vector< T > &result)
 
template<typename T >
INLINE void multiply (const std::vector< T > &left, const std::vector< T > &right, T &result)
 Calculate vector-vector multiplication. More...
 
template<typename T >
INLINE void multiplyElementWise (const std::vector< std::vector< T > > &left, const std::vector< std::vector< T > > &right, std::vector< std::vector< T > > &result)
 
template<typename T >
INLINE void multiplyElementWise (const std::vector< T > &left, const std::vector< T > &right, std::vector< T > &result)
 
template<typename T >
INLINE void multiplyComplexElementWise (const std::vector< std::vector< T > > &left, const std::vector< std::vector< T > > &right, std::vector< std::vector< T > > &result)
 
template<typename T >
INLINE std::string complexIntoString (const std::vector< T > complexValue)
 
template<typename T >
INLINE void conjugate (std::vector< std::vector< T > > &complexVector)
 
template<typename T >
INLINE void fft (std::vector< std::vector< T > > &complexVector)
 
template<typename T >
INLINE void ifft (std::vector< std::vector< T > > &complexVector)
 
INLINE std::chrono::high_resolution_clock::time_point time ()
 Returns current time point. More...
 
INLINE std::chrono::system_clock::time_point systemTime ()
 Returns current time point. More...
 
INLINE double duration (const std::chrono::high_resolution_clock::time_point start, const std::chrono::high_resolution_clock::time_point finish, const std::string scale=std::string("ms"))
 
INLINE double duration (const std::chrono::high_resolution_clock::time_point start, const std::string scale=std::string("ms"))
 
INLINE void printDuration (const std::chrono::high_resolution_clock::time_point start, const std::chrono::high_resolution_clock::time_point finish, const std::string scale=std::string("ms"), const std::size_t count=0)
 
INLINE void printDuration (const std::chrono::high_resolution_clock::time_point start, const std::string scale=std::string("ms"), const std::size_t count=0)
 
INLINE std::string getDateAndTime (std::chrono::system_clock::time_point timePoint=std::chrono::system_clock::now())
 Get date and time. More...
 
INLINE std::string getDate (std::chrono::system_clock::time_point timePoint=std::chrono::system_clock::now())
 Get date. More...
 
INLINE std::string getTime (std::chrono::system_clock::time_point timePoint=std::chrono::system_clock::now())
 Get time. More...
 
INLINE std::string parseParameter (const char *input, const std::string name)
 
template<typename T >
INLINE void assignFromVectorByIntervalCondition (T &value, const T parameter, const std::vector< std::vector< T > > intervals)
 
template<typename T >
INLINE void assignFromVectorByIntervalCondition (T &firstValue, T &secondValue, const T parameter, const std::vector< std::vector< T > > intervals)
 
INLINE bool assignBooleanParameter (const char *input, const std::string name, bool &value)
 
INLINE bool assignCharParameter (const char *input, const std::string name, char &value)
 
INLINE bool assignStringParameter (const char *input, const std::string name, std::string &value)
 
template<typename T >
INLINE bool assignParameter (const char *input, const std::string name, T &value)
 
INLINE bool assignAbsDoubleParameter (const char *input, const std::string name, double &value)
 
template<typename T >
INLINE bool assignByCheckingParameter (const char *input, const std::string parameter, T &value, const T supposed)
 
INLINE void clearScreen ()
 
INLINE void setLocale (const std::string locale)
 
INLINE void showProgressBar (double progress, const int screenWidth=80)
 
INLINE void printLine (const std::string line, const int screenWidth=80)
 
template<typename T >
INLINE void parseFileInMatrix (const std::string filename, const char separator, std::vector< std::vector< T > > &matrix)
 
template<typename T >
INLINE void parseFileInVector (const std::string filename, const char separator, std::vector< T > &vector)
 
INLINE void parseFileIntoString (const std::string filename, std::string &content)
 
template<typename T >
INLINE void accumulateFileInMatrix (const std::string filename, const char separator, std::vector< std::vector< T > > &matrix)
 
template<typename T >
INLINE void accumulateFileInVector (const std::string filename, const char separator, std::vector< T > &vector, const bool checkForNaN=false)
 
template<typename T >
INLINE void printMatrix (const std::vector< std::vector< T > > &matrix, const bool transpose=false, const int precision=5)
 
template<typename T >
INLINE void printVector (const std::vector< T > &vector, const int precision=5)
 
template<typename T >
INLINE void print (const std::vector< std::vector< T > > &matrix, const bool transpose=false, const int precision=5)
 
template<typename T >
INLINE void print (const std::vector< T > &vector, const int precision=5)
 
template<typename T >
INLINE void print (const T value, const std::string name=std::string("Value"))
 
static std::string black ("\3[30m")
 Terminal color code for black. More...
 
static std::string red ("\3[31m")
 Terminal color code for red. More...
 
static std::string green ("\3[32m")
 Terminal color code for green. More...
 
static std::string yellow ("\3[33m")
 Terminal color code for yellow. More...
 
static std::string blue ("\3[34m")
 Terminal color code for blue. More...
 
static std::string magenta ("\3[35m")
 Terminal color code for magenta. More...
 
static std::string cyan ("\3[36m")
 Terminal color code for cyan. More...
 
static std::string white ("\3[37m")
 Terminal color code for white. More...
 
static std::string bold ("\3[1m")
 Terminal style code for bold. More...
 
static std::string underline ("\3[4m")
 Terminal style code for underline. More...
 
static std::string reset ("\3[0m")
 Terminal code to reset special formatting. More...
 
template<typename T >
INLINE void printStyle (const T income, const std::string style)
 
template<typename T >
INLINE void printBlack (const T income)
 
template<typename T >
INLINE void printRed (const T income)
 
template<typename T >
INLINE void printGreen (const T income)
 
template<typename T >
INLINE void printYellow (const T income)
 
template<typename T >
INLINE void printBlue (const T income)
 
template<typename T >
INLINE void printMagenta (const T income)
 
template<typename T >
INLINE void printCyan (const T income)
 
template<typename T >
INLINE void printWhite (const T income)
 
template<typename T >
INLINE void printBold (const T income)
 
template<typename T >
INLINE void printUnderline (const T income)
 
INLINE void printAllStyles ()
 
INLINE void clearStyles ()
 
template<typename T >
INLINE void saveMatrix (const std::string filename, const std::vector< std::vector< T > > &matrix, std::string comment=std::string(), const bool transpose=false, std::string type=std::string("text"), std::string delimiter=std::string(" "), const std::size_t tokenWidth=14)
 
template<typename T >
INLINE void saveVector (const std::string filename, const std::vector< T > &vector, std::string comment=std::string(), std::string type=std::string("text"), std::string delimiter=std::string("\))
 
INLINE void saveLine (const std::string filename, const std::string line, std::string comment=std::string())
 
template<typename T >
INLINE void save (const std::string filename, const std::vector< std::vector< T > > &matrix, std::string comment=std::string())
 
template<typename T >
INLINE void save (const std::string filename, const std::vector< T > &vector, std::string comment=std::string())
 
template<typename T >
INLINE void save (const std::string filename, const std::string line, std::string comment=std::string())
 
INLINE void saveLog (const std::string filename, std::string log, const bool timestamp=false, const std::string stampSeparator=std::string(" "))
 
INLINE void saveLog (const std::string filename, std::vector< std::string > &logs, const bool timestamp=false, const std::string stampSeparator=std::string(" "))
 
template<typename T >
INLINE bool loadA3R (const std::string filename, std::vector< std::vector< T > > &positions, double &radius)
 
template<typename T >
INLINE bool saveA3R (const std::string filename, const std::vector< std::vector< T > > &positions, const double radius=1)
 
template<typename T >
INLINE void loadXYZ (const std::string filename, std::vector< std::vector< T > > &matrix)
 
template<typename T >
INLINE void saveXYZ (const std::string filename, const std::vector< std::vector< T > > &matrix, const std::vector< T > &tones, std::string elementName="C")
 
template<typename T >
INLINE void saveXYZ (const std::string filename, const std::vector< std::vector< T > > &matrix, std::string elementName="C")
 
INLINE bool folderExists (const std::string name)
 Check if folder exists. More...
 
INLINE std::size_t countLinesInFile (const std::string filename, const std::string token=std::string())
 
INLINE std::vector< std::string > listFilesWithExtension (std::string path, const std::string extension, const std::string prefix=std::string(), const bool addPathToFileNames=false)
 
INLINE std::string execute (const std::string command)
 

Variables

static const double e = 2.71828182845904523536
 Mathematical constant 'e'. More...
 
static const double pi = 3.14159265358979323846
 Mathematical constant 'pi'. More...
 

Detailed Description

Main namespace containing all the functions of AiLibrary