From 1bb5466b6a0632b571c676d7d91617942edff4cd Mon Sep 17 00:00:00 2001 From: Seth Axen Date: Mon, 19 Sep 2022 18:51:33 +0200 Subject: [PATCH] Update to make complete package (#1) * Rename files * Update code * Add derivative work line to license * Add missing repo files * Add and use missing imports/deps * Update authors --- .gitignore | 5 +++++ LICENSE.md | 1 + Project.toml | 18 ++++++++++++++++++ README.md | 7 +++++++ docs/Project.toml | 3 +++ docs/make.jl | 25 +++++++++++++++++++++++++ docs/src/index.md | 14 ++++++++++++++ src/Octonions.jl | 18 ++++++++++++++++++ src/{Octonion.jl => octonion.jl} | 0 test/{Octonion.jl => octonion.jl} | 7 ++++--- test/runtests.jl | 10 +++++----- 11 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100644 Project.toml create mode 100644 README.md create mode 100644 docs/Project.toml create mode 100644 docs/make.jl create mode 100644 docs/src/index.md create mode 100644 src/Octonions.jl rename src/{Octonion.jl => octonion.jl} (100%) rename test/{Octonion.jl => octonion.jl} (98%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20fe29d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.jl.*.cov +*.jl.cov +*.jl.mem +/Manifest.toml +/docs/build/ diff --git a/LICENSE.md b/LICENSE.md index 0611b57..c9ff9b1 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,7 @@ MIT License Copyright (c) 2013 Forio and [Quaternions.jl contributors](https://github.com/JuliaGeometry/Quaternions.jl/graphs/contributors) +Copyright (c) 2022 Seth Axen and Yuto Horikawa and [Octonions.jl contributors](https://github.com/JuliaGeometry/Octonions.jl/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..6b9fe39 --- /dev/null +++ b/Project.toml @@ -0,0 +1,18 @@ +name = "Octonions" +uuid = "d00ba074-1e29-4f5e-9fd4-d67071d6a14d" +version = "0.1.0" + +[deps] +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Quaternions = "94ee1d12-ae83-5a48-8b1c-48b8ff168ae0" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[compat] +Quaternions = "0.5.6" +julia = "1" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..7259b74 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Octonions + +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaGeometry.github.io/Octonions.jl/stable/) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaGeometry.github.io/Octonions.jl/dev/) +[![Build Status](https://github.com/JuliaGeometry/Octonions.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaGeometry/Octonions.jl/actions/workflows/CI.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/JuliaGeometry/Octonions.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaGeometry/Octonions.jl) +[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..76f320a --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,3 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Octonions = "d00ba074-1e29-4f5e-9fd4-d67071d6a14d" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..bda9fc8 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,25 @@ +using Octonions +using Documenter + +DocMeta.setdocmeta!(Octonions, :DocTestSetup, :(using Octonions); recursive=true) + +makedocs(; + modules=[Octonions], + authors="Seth Axen and Yuto Horikawa and contributors", + repo="https://github.com/JuliaGeometry/Octonions.jl/blob/{commit}{path}#{line}", + sitename="Octonions.jl", + format=Documenter.HTML(; + prettyurls=get(ENV, "CI", "false") == "true", + canonical="https://JuliaGeometry.github.io/Octonions.jl", + edit_link="main", + assets=String[], + ), + pages=[ + "Home" => "index.md", + ], +) + +deploydocs(; + repo="github.com/JuliaGeometry/Octonions.jl", + devbranch="main", +) diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..3c69488 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,14 @@ +```@meta +CurrentModule = Octonions +``` + +# Octonions + +Documentation for [Octonions](https://github.com/JuliaGeometry/Octonions.jl). + +```@index +``` + +```@autodocs +Modules = [Octonions] +``` diff --git a/src/Octonions.jl b/src/Octonions.jl new file mode 100644 index 0000000..2e144c4 --- /dev/null +++ b/src/Octonions.jl @@ -0,0 +1,18 @@ +module Octonions + +import Base: +, -, *, /, ^, == +import Base: abs, abs2, conj, exp, inv, isreal, isfinite, isinf, iszero, isnan, log, real, sqrt +import Base: promote_rule, float +import Base: rand, randn +import LinearAlgebra: normalize +using Quaternions: Quaternion +using Random + +Base.@irrational INV_SQRT_EIGHT 0.3535533905932737622004 sqrt(big(0.125)) + +include("octonion.jl") + +export Octonion, OctonionF16, OctonionF32, OctonionF64 +export imag_part, normalize, normalizea, octo, octorand + +end # module diff --git a/src/Octonion.jl b/src/octonion.jl similarity index 100% rename from src/Octonion.jl rename to src/octonion.jl diff --git a/test/Octonion.jl b/test/octonion.jl similarity index 98% rename from test/Octonion.jl rename to test/octonion.jl index 31a4f2f..b29e925 100644 --- a/test/Octonion.jl +++ b/test/octonion.jl @@ -1,5 +1,6 @@ -using Quaternions using LinearAlgebra +using Octonions +using Quaternions: Quaternion, QuaternionF64 using Random using Test @@ -168,7 +169,7 @@ using Test qnorm = normalize(q) @test real(q) === q.s @test_throws MethodError imag(q) - @test @test_deprecated(Quaternions.imag(q)) == [q.v1, q.v2, q.v3, q.v4, q.v5, q.v6, q.v7] + @test @test_deprecated(Octonions.imag(q)) == [q.v1, q.v2, q.v3, q.v4, q.v5, q.v6, q.v7] @test imag_part(q) === (q.v1, q.v2, q.v3, q.v4, q.v5, q.v6, q.v7) @test conj(q) === Octonion(q.s, -q.v1, -q.v2, -q.v3, -q.v4, -q.v5, -q.v6, -q.v7, q.norm) @@ -186,7 +187,7 @@ using Test @test conj(conj(q)) === q @test conj(conj(qnorm)) === qnorm @test float(Octonion(1:8...)) === Octonion(1.0:8.0...) - @test Quaternions.abs_imag(q) == + @test Octonions.abs_imag(q) == abs(Octonion(0, q.v1, q.v2, q.v3, q.v4, q.v5, q.v6, q.v7)) end diff --git a/test/runtests.jl b/test/runtests.jl index d1c2ecd..299b681 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,7 @@ using Test -using Quaternions +using Octonions -include("helpers.jl") -include("Quaternion.jl") -include("Octonion.jl") -include("DualQuaternion.jl") +@testset "Octonions.jl" begin + include("helpers.jl") + include("octonion.jl") +end