Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5ce19e5
remove the use of mocks
Baptouuuu Nov 20, 2025
3829fc6
replace phpunit by blackbox
Baptouuuu Nov 20, 2025
0cd8269
reuse CI workflow
Baptouuuu Nov 20, 2025
da9bc53
add workflow to create releases
Baptouuuu Nov 20, 2025
e9a5abf
require php 8.4
Baptouuuu Nov 20, 2025
3e6f7a1
update dependencies
Baptouuuu Nov 20, 2025
ed7ad65
make Set a final class
Baptouuuu Nov 20, 2025
098db7b
remove unreachable code
Baptouuuu Nov 20, 2025
3907181
remove duplicated code
Baptouuuu Nov 20, 2025
5aff574
transform monoids into enums
Baptouuuu Nov 20, 2025
7fd20a9
simplify checking row echelon form
Baptouuuu Nov 20, 2025
fb91cc1
let the operations control how they are formatted
Baptouuuu Nov 20, 2025
b695a97
remove parentheses when the precedence is explicit
Baptouuuu Nov 20, 2025
4cc3f13
remove Operation interface
Baptouuuu Nov 20, 2025
911da80
remove unused result methods
Baptouuuu Nov 20, 2025
37a42d6
avoid using operations named constructors
Baptouuuu Nov 20, 2025
b3a5da5
use unwrapped integers
Baptouuuu Nov 20, 2025
efa8c99
remove the possibility to specify multiple values to Number::add(), :…
Baptouuuu Nov 20, 2025
414e30f
use psalm to verify the round precision
Baptouuuu Nov 20, 2025
eb3eea0
make Number a final class
Baptouuuu Nov 22, 2025
bac13f1
add Number::apply(Func)
Baptouuuu Nov 23, 2025
3b3f92c
express (a)cos/sin/tan as Funcs
Baptouuuu Nov 23, 2025
e2a5ded
add Number::as() to allow to change the way a number is represented i…
Baptouuuu Nov 23, 2025
b0d6973
remove duplicated code
Baptouuuu Nov 23, 2025
18b911d
reuse the Value enum when the raw value is one the cases
Baptouuuu Nov 23, 2025
6520452
extract logarithms as Funcs
Baptouuuu Nov 23, 2025
80723f3
separate the optimization from memoization process
Baptouuuu Nov 23, 2025
a71caf7
simplify addition representation
Baptouuuu Nov 23, 2025
04e725d
simplify subtraction representation
Baptouuuu Nov 23, 2025
22eb4d1
simplify multiplication representation
Baptouuuu Nov 23, 2025
143d34b
recursively apply optimization to multiplications
Baptouuuu Nov 23, 2025
f30e1e6
prepare factorials to handle numbers higher than max int
Baptouuuu Nov 23, 2025
83eafdf
tag dependencies
Baptouuuu Feb 8, 2026
2be509a
use promoted properties
Baptouuuu Feb 8, 2026
01ed1d4
group algebra monoids inside a single enum
Baptouuuu Feb 8, 2026
10cc503
remove is prefix
Baptouuuu Feb 8, 2026
2b65ff0
remove duplicated code
Baptouuuu Feb 8, 2026
61f5623
remove todo
Baptouuuu Feb 8, 2026
c825474
make Set::accept() return an Attempt<SideEffect>
Baptouuuu Feb 8, 2026
44ac4b5
use attempt->unwrap() pattern for unreachable errors
Baptouuuu Feb 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
70 changes: 7 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,12 @@ name: CI
on: [push, pull_request]

jobs:
phpunit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.2', '8.3']
dependencies: ['lowest', 'highest']
name: 'PHPUnit'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage.clover
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
blackbox:
uses: innmind/github-workflows/.github/workflows/black-box-matrix.yml@main
coverage:
uses: innmind/github-workflows/.github/workflows/coverage-matrix.yml@main
secrets: inherit
psalm:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2', '8.3']
dependencies: ['lowest', 'highest']
name: 'Psalm'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Psalm
run: vendor/bin/psalm --shepherd
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
cs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2']
name: 'CS'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
- name: CS
run: vendor/bin/php-cs-fixer fix --diff --dry-run
uses: innmind/github-workflows/.github/workflows/cs.yml@main
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Create release

on:
push:
tags:
- '*'

jobs:
release:
uses: innmind/github-workflows/.github/workflows/release.yml@main
secrets: inherit
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
composer.lock
vendor
.phpunit.result.cache
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,54 @@

## [Unreleased]

### Added

- `Innmind\Math\Algebra\Number::apply()`
- `Innmind\Math\Algebra\Number::as()`
- `Innmind\Math\Algebra\Number::memoize()`
- `Innmind\Math\Algebra\Number::optimize()`
- `Innmind\Math\Algebra\Func`
- `Innmind\Math\Algebra\Logarithm`
- `Innmind\Math\Geometry\Trigonometry`
- `Innmind\Math\Geometry\Angle\Degree::cosine()`
- `Innmind\Math\Geometry\Angle\Degree::sine()`
- `Innmind\Math\Geometry\Angle\Degree::tangent()`
- `Innmind\Math\Geometry\Angle\Radian::cosine()`
- `Innmind\Math\Geometry\Angle\Radian::sine()`
- `Innmind\Math\Geometry\Angle\Radian::tangent()`

### Changed

- Requires PHP `8.4`
- `Innmind\Math\DefinitionSet\Set` is now a final class, all previous implementations are now flagged as internal
- `Innmind\Math\Monoid\*` are now enums
- `Addition` is now accessible via `Algebra::addition`
- `Multiplication` is now accessible via `Algebra::multiplication`
- `Innmind\Math\Probabilities\BinomialDistribution::__invoke()` arguments now expects `int`s
- `Innmind\Math\Algebra\Number` is now a final class, all previous implementations are now flagged as internal
- Requires `innmind/immutable:~6.0`
- `Innmind\Math\Geometry\*` methods are no longer prefixed with `is`
- `Innmind\Math\DefinitionSet\Set::accept()` now returns an `Innmind\Immutable\Attempt<SideEffect>`

### Fixed

- PHP `8.4` deprecations

### Removed

- `Innmind\Math\Algebra\Operation`
- The possibility to specify multiple values to `Innmind\Math\Algebra\Number::add()`, `::multiplyBy()` and `::subtract()`
- `Innmind\Math\Geometry\Trigonometry\ArcCosine`
- `Innmind\Math\Geometry\Trigonometry\ArcSine`
- `Innmind\Math\Geometry\Trigonometry\ArcTangent`
- `Innmind\Math\Geometry\Trigonometry\Cosine`
- `Innmind\Math\Geometry\Trigonometry\Sine`
- `Innmind\Math\Geometry\Trigonometry\Tangent`
- `Innmind\Math\Algebra\Number::binaryLogarithm()`, use `->apply(Logarithm::binary)` instead
- `Innmind\Math\Algebra\Number::commonLogarithm()`, use `->apply(Logarithm::common)` instead
- `Innmind\Math\Algebra\Number::naturalLogarithm()`, use `->apply(Logarithm::natural)` instead
- `Innmind\Math\Algebra\Number::collapse()`, use `->optimize()->memoize()` instead

## 6.1.0 - 2023-09-23

### Added
Expand Down
26 changes: 26 additions & 0 deletions blackbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
declare(strict_types = 1);

require 'vendor/autoload.php';

use Innmind\BlackBox\{
Application,
PHPUnit\Load,
Runner\CodeCoverage,
};

Application::new($argv)
->when(
\getenv('ENABLE_COVERAGE') !== false,
static fn(Application $app) => $app
->codeCoverage(
CodeCoverage::of(
__DIR__.'/src/',
__DIR__.'/tests/',
)
->dumpTo('coverage.clover')
->enableWhen(true),
),
)
->tryToProve(Load::directory(__DIR__.'/tests/'))
->exit();
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"issues": "http://github.com/Innmind/Math/issues"
},
"require": {
"php": "~8.2",
"innmind/immutable": "~4.15|~5.0"
"php": "~8.4",
"innmind/immutable": "~6.0"
},
"autoload": {
"psr-4": {
Expand All @@ -35,8 +35,8 @@
]
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"innmind/static-analysis": "^1.2.1",
"innmind/black-box": "~6.5",
"innmind/static-analysis": "~1.3",
"innmind/coding-standard": "~2.0"
}
}
17 changes: 0 additions & 17 deletions phpunit.xml.dist

This file was deleted.

Loading