Skip to content

Commit

Permalink
chore: rename src to packages (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdelabro committed Jun 3, 2024
1 parent 7bd1d4e commit 3041887
Show file tree
Hide file tree
Showing 181 changed files with 75 additions and 75 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ Current version can be found in the [toml file](./Scarb.toml)

This repository is composed of multiple crates:

- [ASCII](./src/ascii/README.md)
- [Data Structures](./src/data_structures/README.md)
- [Encoding](./src/encoding/README.md)
- [Linalg](./src/linalg/README.md)
- [Math](./src/math/README.md)
- [Numeric](./src/numeric/README.md)
- [Searching](./src/searching/README.md)
- [Sorting](./src/sorting/README.md)
- [Storage](./src/storage/README.md)
- [Bytes](./src/bytes/README.md)
- [ASCII](./packages/ascii/README.md)
- [Data Structures](./packages/data_structures/README.md)
- [Encoding](./packages/encoding/README.md)
- [Linalg](./packages/linalg/README.md)
- [Math](./packages/math/README.md)
- [Numeric](./packages/numeric/README.md)
- [Searching](./packages/searching/README.md)
- [Sorting](./packages/sorting/README.md)
- [Storage](./packages/storage/README.md)
- [Bytes](./packages/bytes/README.md)

## Getting Started

Expand Down
24 changes: 12 additions & 12 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[workspace]
members = [
"src/data_structures",
"src/encoding",
"src/linalg",
"src/math",
"src/merkle_tree",
"src/numeric",
"src/searching",
"src/sorting",
"src/storage",
"src/ascii",
"src/bytes",
"src/utils",
"packages/data_structures",
"packages/encoding",
"packages/linalg",
"packages/math",
"packages/merkle_tree",
"packages/numeric",
"packages/searching",
"packages/sorting",
"packages/storage",
"packages/ascii",
"packages/bytes",
"packages/utils",
]
name = "alexandria"
version = "0.1.0"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ascii/Scarb.toml → packages/ascii/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_ascii"
version = "0.1.0"
description = "utilities for working with ascii values"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/ascii"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/ascii"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/bytes/Scarb.toml → packages/bytes/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_bytes"
version = "0.1.0"
description = "An implementation similar to Solidity bytes written in Cairo 1"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/bytes"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/bytes"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Data structures

## [Array extension](./src/array_ext.cairo)
## [Array extension](./packages/array_ext.cairo)
A collection of handy functions to help with array manipulation.

## [Span extension](./src/span_ext.cairo)
## [Span extension](./packages/span_ext.cairo)
A collection of handy functions to help with span manipulation.

## [Queue](./src/queue.cairo)
## [Queue](./packages/queue.cairo)

The queue is used to store and manipulate a collection of elements where the elements are processed in a **first-in, first-out** (FIFO) order, the oldest element being processed first.

## [Stack](./src/stack.cairo)
## [Stack](./packages/stack.cairo)

The stack is used to store and manipulate a collection of elements where the elements are processed in a **last-in, first-out** (LIFO) order, the most recently added element being processed first.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_data_structures"
version = "0.2.0"
description = "A set of Cairo data structure libraries and algorithms"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/data_structures"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/data_structures"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/encoding/README.md → packages/encoding/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Encoding

## [Base64](./src/base64.cairo)
## [Base64](./packages/base64.cairo)

Base64 is a binary-to-text encoding scheme used for transferring binary data safely over media designed for text. It divides input data into 3-byte blocks, each converted into 4 ASCII characters using a specific index table. If input bytes aren't divisible by three, it's padded with '=' characters. The process is reversed for decoding.

## [Solidity ABI](./src/sol_abi.cairo)
## [Solidity ABI](./packages/sol_abi.cairo)

**sol_abi** is a wrapper around `alexandria_bytes::Bytes` providing easy to use interfaces to mimic Solidity's `abi` functions.

Expand Down
2 changes: 1 addition & 1 deletion src/encoding/Scarb.toml → packages/encoding/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_encoding"
version = "0.1.0"
description = "Encoding utilities"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/encoding"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/encoding"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/linalg/README.md → packages/linalg/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Linear Algebra

## [Norm](./src/norm.cairo)
## [Norm](./packages/norm.cairo)

Calculate the norm of an u128 array ([see also](https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html)).

## [Dot product](./src/dot.cairo)
## [Dot product](./packages/dot.cairo)

The dot product or scalar product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors), and returns a single number. Algebraically, the dot product is the sum of the products of the corresponding entries of the two sequences of numbers ([see also](https://en.wikipedia.org/wiki/Dot_product)).

## [Kronecker product](./src/kron.cairo)
## [Kronecker product](./packages/kron.cairo)

The Kronecker product is an an algebraic operation that takes two equal-length sequences of numbers and returns an array of numbers([see also](https://numpy.org/doc/stable/reference/generated/numpy.kron.html)).
2 changes: 1 addition & 1 deletion src/linalg/Scarb.toml → packages/linalg/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_linalg"
version = "0.1.0"
description = "A set of linear algebra libraries and algorithms"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/linalg"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/linalg"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 17 additions & 17 deletions src/math/README.md → packages/math/README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
# Math

## [Fast Root](./src/fast_root.cairo)
## [Fast Root](./packages/fast_root.cairo)

The fast root algorithm uses Newton-Raphson method to calculate a arbitrary root of a given number (e.g., square root, cubic root, etc.). The algorithm is used to find the roots of a polynomial equation, which has applications in various areas of mathematics, including algebra, calculus, and number theory. The fast root algorithm is also used in computer science, as it can be used to solve problems involving the roots of a polynomial equation.

## [Is Power Of Two](./src/is_power_of_two.cairo)
## [Is Power Of Two](./packages/is_power_of_two.cairo)

The `is_power_of_two` algorithm is used to determine whether a given positive integer is a power of two or not.

## [Fast trigonometric functions (sin, cos, tan)](./src/trigonometry.cairo)
## [Fast trigonometric functions (sin, cos, tan)](./packages/trigonometry.cairo)

The trigonometric functions are a set of mathematical functions that relate the angles of a triangle to the lengths of its sides. The most common trigonometric functions are sine, cosine, and tangent. These functions are used in many areas of mathematics, including geometry, calculus, and statistics. They are also used in physics, engineering, and other sciences.

Fast trigonometric functions are computational and spatial efficient, with minor errors compared to the standard trigonometric functions. Refer to http://hevi.info/tag/fast-sine-function/ for detailed information.

## [Is Prime](./src/is_prime.cairo)
## [Is Prime](./packages/is_prime.cairo)

The `is_prime` algorithm is used to determine whether a given positive integer is a prime number or not.

## [Aliquot sum](./src/aliquot_sum.cairo)
## [Aliquot sum](./packages/aliquot_sum.cairo)

The aliquot sum algorithm calculates the sum of proper divisors of a given positive integer, providing insight into factors and divisors of a number, and classifying it as perfect, abundant, or deficient.
These classifications have applications in areas of math, including geometry, cryptography, and number theory. The algorithm is used for problem-solving and generating puzzles and games.

## [Armstrong number](./src/armstrong_number.cairo)
## [Armstrong number](./packages/armstrong_number.cairo)

The Armstrong number algorithm is used to determine if a number is an Armstrong number, where the sum of its digits raised to the power of the number of digits equals the original number.
The algorithm is used for problem-solving and mathematical puzzles, and has applications in number theory, discrete mathematics, and computer science, as well as in generating strong encryption keys.
By identifying Armstrong numbers, the algorithm provides insight into the properties of numbers and can be used in various applications in mathematics and computer science.

## [Bitmap](./src/bitmap.cairo)
## [Bitmap](./packages/bitmap.cairo)

Bitmap function to manage, search and manipulate bits efficiently.

## [Collatz sequence](./src/collatz_sequence.cairo)
## [Collatz sequence](./packages/collatz_sequence.cairo)
The Collatz sequence number algorithm is a mathematical algorithm used to generate the Collatz sequence of a given positive integer.
The purpose of the Collatz sequence number algorithm is to explore the behavior of the Collatz conjecture, which is a famous unsolved problem in mathematics. The conjecture states that for any positive integer, the Collatz sequence will eventually reach the number 1. The Collatz sequence number algorithm is used to generate and study these sequences, which have applications in various areas of mathematics and computer science.
Additionally, the algorithm is used in generating mathematical puzzles and in teaching concepts such as iteration, recursion, and complexity theory.

## [Extended euclidean](./src/extended_euclidean_algorithm.cairo)
## [Extended euclidean](./packages/extended_euclidean_algorithm.cairo)
The extended Euclidean algorithm is a mathematical algorithm used to calculate the greatest common divisor (GCD) of two numbers and to find the coefficients that satisfy the Bézout's identity, which is a relationship between the GCD and the two numbers.
The purpose of the extended Euclidean algorithm is to provide a way to solve linear Diophantine equations, which are equations in which the variables must be integers.
The algorithm has applications in various areas of mathematics, including number theory, cryptography, and computer science. Additionally, the algorithm is used in generating encryption keys and in solving problems related to modular arithmetic.

## [Fast power](./src/fast_power.cairo)
## [Fast power](./packages/fast_power.cairo)
The fast power algorithm is a mathematical algorithm used to efficiently calculate the power of a given number.
The purpose of the fast power algorithm is to reduce the number of operations required to calculate a power, making it more efficient than traditional methods. The algorithm has applications in various areas of mathematics and computer science, including cryptography, where it is used to perform exponentiation in encryption and decryption operations. The fast power algorithm is also used in programming and software development, as it can improve the efficiency of algorithms that require the calculation of powers.
By reducing the number of operations required to calculate a power, the fast power algorithm provides a more efficient way to perform calculations involving powers.

## [Fibonacci](./src/fibonacci.cairo)
## [Fibonacci](./packages/fibonacci.cairo)
The Fibonacci algorithm is a mathematical algorithm used to generate the Fibonacci sequence, which is a sequence of numbers where each number is the sum of the previous two.
The purpose of the Fibonacci algorithm is to explore the properties and patterns of the Fibonacci sequence, which has applications in various areas of mathematics, including number theory, combinatorics, and geometry. The algorithm is also used in problem-solving and generating mathematical puzzles and games. Additionally, the Fibonacci sequence has applications in computer science and data structures, as it can be used to model recursive algorithms and to generate random numbers.

## [GCD of N numbers](./src/gcd_of_n_numbers.cairo)
## [GCD of N numbers](./packages/gcd_of_n_numbers.cairo)
The GCD (Greatest Common Divisor) of n numbers algorithm is used to find the largest positive integer that divides each of the given n numbers without a remainder.
The purpose of this algorithm is to determine the highest common factor of the given set of numbers. It has applications in various areas of mathematics, including number theory, algebra, and cryptography. The GCD of n numbers algorithm is used in many real-world applications, such as finding the optimal solution to a problem that requires dividing resources among multiple agents. It is also used in computer science for designing efficient algorithms that require determining common factors or multiples of numbers.

## [LCM of N numbers](./src/lcm_of_n_numbers.cairo)
## [LCM of N numbers](./packages/lcm_of_n_numbers.cairo)
The LCM (Lowest Common Multiple) of n numbers algorithm is used to find the smallest positive integer that is a multiple of each of the given n numbers ([see also](https://numpy.org/doc/stable/reference/generated/numpy.lcm.html)).

## [Perfect Number Algorithm](./src/perfect_number.cairo)
## [Perfect Number Algorithm](./packages/perfect_number.cairo)
The perfect number algorithm is used to determine whether a given positive integer is a perfect number or not.
A perfect number is a positive integer that is equal to the sum of its proper divisors (excluding itself).
The purpose of the algorithm is to identify these special numbers and to study their properties. Perfect numbers have applications in various areas of mathematics, including number theory and algebraic geometry. They are also used in cryptography and coding theory. The perfect number algorithm is important for understanding the structure of numbers and their relationships to each other, and it has been studied for centuries by mathematicians.

## [Zeller's congruence](./src/zellers_congruence.cairo)
## [Zeller's congruence](./packages/zellers_congruence.cairo)
Zeller's congruence algorithm is used to determine the day of the week for a given date.
The purpose of the algorithm is to provide a simple and efficient way to calculate the day of the week based on the date.
It is widely used in various applications, including calendar systems, scheduling, and time management.
The algorithm takes into account the year, month, and day of the given date and performs a series of mathematical calculations to determine the day of the week. By providing an easy-to-use method for calculating the day of the week, Zeller's congruence algorithm is an important tool for many industries and organizations that rely on accurate and efficient time management systems.

## [ed25519](./src/ed25519.cairo)
## [ed25519](./packages/ed25519.cairo)
In public-key cryptography, Edwards-curve Digital Signature Algorithm (EdDSA) is a digital signature scheme using a variant of Schnorr signature based on twisted Edwards curves. It is designed to be faster than existing digital signature schemes without sacrificing security.

## [sha512](./src/sha512.cairo)
## [sha512](./packages/sha512.cairo)
SHA-512 is from the SHA-2 family (Secure Hash Algorithm 2) which is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) and first published in 2001. They are built using the Merkle–Damgård construction, from a one-way compression function itself built using the Davies–Meyer structure from a specialized block cipher.
2 changes: 1 addition & 1 deletion src/math/Scarb.toml → packages/math/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_math"
version = "0.2.0"
description = "A set of math libraries and algorithms"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/math"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/packages/math"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/merkle_tree/README.md → packages/merkle_tree/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Merkle Tree related stuff

## [Merkle Tree](./src/merkle_tree.cairo)
## [Merkle Tree](./packages/merkle_tree.cairo)

The Merkle tree algorithm is a cryptographic hashing algorithm used to create a hash tree, which is a tree data structure where each leaf node represents a data block and each non-leaf node represents a hash of its child nodes.
The purpose of the Merkle tree algorithm is to provide a way to verify the integrity and authenticity of large amounts of data without needing to store the entire data set. The algorithm has applications in various areas of computer science, including cryptocurrency, file sharing, and database management.
The Merkle tree algorithm is also used in creating digital signatures and verifying the authenticity of transactions.
By providing a secure and efficient way to verify data integrity, the Merkle tree algorithm is an important tool in cryptography and information security.
A generic implementation is available to manage both pedersen (legacy) and poseidon hash methods.

## [Starknet Storage Proof Verifier](./src/storage_proof.cairo)
## [Starknet Storage Proof Verifier](./packages/storage_proof.cairo)
Implementation of Starknet ([storage proofs](https://docs.starknet.io/documentation/architecture_and_concepts/State/starknet-state/)) returned by `pathfinder_getproof` API endpoint ([see](https://github.com/eqlabs/pathfinder/blob/main/doc/rpc/pathfinder_rpc_api.json)).
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "alexandria_merkle_tree"
version = "0.1.0"
description = "Merkle tree related stuff"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/src/merkle_tree"
homepage = "https://github.com/keep-starknet-strange/alexandria/tree/main/src/merkle_tree"
edition = "2023_11"

[tool]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub impl ContractStateProofImpl of ContractStateProofTrait {
/// Verify Starknet storage proof. For reference see:
/// - ([state](https://docs.starknet.io/documentation/architecture_and_concepts/State/starknet-state/))
/// - ([pathfinder_getproof API endpoint](https://github.com/eqlabs/pathfinder/blob/main/doc/rpc/pathfinder_rpc_api.json))
/// - ([pathfinder storage implementation](https://github.com/eqlabs/pathfinder/blob/main/crates/merkle-tree/src/tree.rs))
/// - ([pathfinder storage implementation](https://github.com/eqlabs/pathfinder/blob/main/crates/merkle-tree/main/src/tree.rs))
/// # Arguments
/// * `expected_state_commitment` - state root `proof` is going to be verified against
/// * `contract_address` - `contract_address` of the value to be verified
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/numeric/README.md → packages/numeric/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Numerical analysis

## [Trapezoidal rule](./src/trapezoidal_rule.cairo)
## [Trapezoidal rule](./packages/trapezoidal_rule.cairo)

In numerical analysis and scientific computing, the trapezoidal rule is a numerical method to solve ordinary differential equations derived from the trapezoidal rule for computing integrals ([see also](https://en.wikipedia.org/wiki/Trapezoidal_rule_(differential_equations))).

## [Interpolation](./src/interpolate.cairo)
## [Interpolation](./packages/interpolate.cairo)

Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xs, ys), evaluated at x ([see also](https://numpy.org/doc/stable/reference/generated/numpy.interp.html)).
Several interpolation methods are supported as follow:
Expand All @@ -13,14 +13,14 @@ Several interpolation methods are supported as follow:
- Constant left interpolation: ys behaves as an integer part function where each y data point extends to the left up to the next index
- Constant right interpolation: ys behaves as an integer part function where each y data point extends to the right up to the next index

## [Cumsum](./src/cumsum.cairo)
## [Cumsum](./packages/cumsum.cairo)

Return the cumulative sum of the elements ([see also](https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html#numpy-cumsum)).

## [Cumprod](./src/cumprod.cairo)
## [Cumprod](./packages/cumprod.cairo)

Return the cumulative product of the elements ([see also](https://numpy.org/doc/stable/reference/generated/numpy.cumprod.html#numpy-cumprod)).

## [Diff](./src/diff.cairo)
## [Diff](./packages/diff.cairo)

Return the discrete difference of the elements ([see also](https://numpy.org/doc/stable/reference/generated/numpy.diff.html#numpy.diff)).
Loading

0 comments on commit 3041887

Please sign in to comment.