-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functional vector module #1945
base: master
Are you sure you want to change the base?
Functional vector module #1945
Changes from 12 commits
a295308
3037439
468bb69
700b114
623d474
a5f6a10
514ef92
ce75303
7d62c1c
3ed6e0b
81548b0
1b684fc
6604b6e
bc7d02d
51a8adc
841be8c
62b0af2
651c316
1c520d1
2f9e635
9fc2632
e39e20e
59e693e
967be03
4dccb0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Some Vector-related module Definitions | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
open import Function using (_$_) | ||
open import Data.Product hiding (map) | ||
open import Data.Nat using (ℕ) | ||
open import Data.Fin using (Fin) | ||
open import Data.Vec.Functional | ||
open import Algebra.Core | ||
open import Algebra.Bundles | ||
open import Algebra.Module | ||
open import Relation.Binary | ||
import Data.Vec.Functional.Relation.Binary.Equality.Setoid as VecSetoid | ||
import Algebra.Definitions as AD | ||
import Algebra.Structures as AS | ||
|
||
module Data.Vec.Functional.Algebra.Base | ||
{c ℓ} (cring : CommutativeRing c ℓ) where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not happy about this whole module being parameterized on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't (yet) looked at this too closely, but it seems as though we might more generally want |
||
|
||
private variable | ||
n : ℕ | ||
|
||
open CommutativeRing cring | ||
open VecSetoid setoid | ||
|
||
_≈ᴹ_ : Rel (Vector Carrier n) ℓ | ||
_≈ᴹ_ = _≋_ | ||
|
||
_+ᴹ_ : Op₂ $ Vector Carrier n | ||
_+ᴹ_ = zipWith _+_ | ||
|
||
_*ᴹ_ : Op₂ $ Vector Carrier n | ||
_*ᴹ_ = zipWith _*_ | ||
|
||
0ᴹ : Vector Carrier n | ||
0ᴹ = replicate 0# | ||
|
||
1ᴹ : Vector Carrier n | ||
1ᴹ = replicate 1# | ||
|
||
-ᴹ_ : Op₁ $ Vector Carrier n | ||
-ᴹ_ = map $ -_ | ||
|
||
_*ₗ_ : Opₗ Carrier (Vector Carrier n) | ||
_*ₗ_ r = map (r *_) | ||
|
||
_*ᵣ_ : Opᵣ Carrier (Vector Carrier n) | ||
xs *ᵣ r = map (_* r) xs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases we typically only mention we have added entirely new modules rather than listing their content.
Cf. https://github.com/agda/agda-stdlib/blob/master/CHANGELOG.md#new-modules