Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 21:02
    LukaJCB commented #758
  • Jan 31 2019 20:29

    tixxit on master

    Fix Polynomial Gen Merge pull request #758 from Lu… (compare)

  • Jan 31 2019 20:29
    tixxit closed #758
  • Jan 31 2019 18:55
    LukaJCB commented #758
  • Jan 31 2019 12:07
    lmazzon starred non/spire
  • Jan 31 2019 03:06
    SethTisue commented #742
  • Jan 30 2019 23:41
    niebloomj starred non/spire
  • Jan 30 2019 21:11
    GusevTimofey starred non/spire
  • Jan 30 2019 15:12
    qsctr starred non/spire
  • Jan 30 2019 14:00
    tusharbihani starred non/spire
  • Jan 28 2019 15:07
    roman0x58 starred non/spire
  • Jan 25 2019 14:56
    invkrh starred non/spire
  • Jan 23 2019 18:00
  • Jan 23 2019 12:20
    cwheikki starred non/spire
  • Jan 23 2019 02:18
  • Jan 22 2019 15:44
    paulhirschi starred non/spire
  • Jan 22 2019 09:46
    shreyanshp starred non/spire
  • Jan 20 2019 12:39
    midnio starred non/spire
  • Jan 20 2019 12:37
    midnio starred non/spire
  • Jan 20 2019 12:34
    midnio starred non/spire
Srepfler Srdan
@schrepfler
meaning it should cover multiplication like operation? wouldn’t that cause issue with inverse/division by zero?
Luka Jacobowitz
@LukaJCB
What do you mean? I’m just saying that my preference would be to have a single blessed Monoid instance as default instead of having two and not getting to use either with foldMap and company
I don’t really understand why if you have two possible instances, instead of choosing one, you just don’t choose either and get nothing :smile:
Luka Jacobowitz
@LukaJCB
I think ideally I’d like to see
trait Semiring[A] extends CommutativeMonoid[A] {
  def combine[A](x: A, y: A): A

  def plus[A](x: A, y: A): A = combine(x, y)
  def zero[A] = empty[A]
}
And then if you want to use the multiplicative monoid instance just use something like this:
case class Multiplicative[A](a: A) extends AnyVal // or opaque type
implicit def multiplicativeMonoidSemiring[A: Semiring]: Monoid[Multiplicative[A]] = …
Denis Rosset
@denisrosset
Please no! SemiRing can be noncommutative
and actually, if something should be a default monoid, it should be the multiplicative one due to the representation of groups as matrices (that's the standard use in algebra, see "Group ring")
Denis Rosset
@denisrosset
(note: I am not saying Spire is universally right, or that your idea is universally wrong. In the context of numerics/mathematics, I think the choices made in algebra/Spire are sane and consistent, and should only be changed with care and domain knowledge)
Indeed, it is painful to not be able to use the wonderful cats derivations to combine Map (for example, when a Map represents a polynomial)
But then, an additive monoid -> monoid conversion is the way to go
Luka Jacobowitz
@LukaJCB
Yeah, I’m not doubting what you came up with :smile: It’s just a bit unfortunate I can’t reuse a bunch of my Monoid code :P
A Semiring can be non commutative?
I thought it was always commutative in its addition :o
Oh I realized I had an error in my code above, what I meant was this:
trait Semiring[A] extends CommutativeMonoid[A] {
  def times[A](x: A, y: A): A

  def plus[A](x: A, y: A): A = combine(x, y)
  def zero[A] = empty[A]
}

trait Rig[A] extends Semiring[A] {
  def one[A]: A
}
Luka Jacobowitz
@LukaJCB
Would it be very wrong to add a cats.kernel.Monoid[Rational] that’s consistent with the Monoids for Int, Long,BigInt, etc.?
Denis Rosset
@denisrosset
My bad, indeed it is commutative in addition!
Spire does not extend the cats instances yet, and we haven't taken a position on whether our instances/laws/... should be inherited through the chain cats-kernel/algebra/spire
You're very welcome to add an optional Monoid[Rational] in spire.optional; however, I'm not clear about the default instances in spire, and reluctant to pile more stuff on top of it
Spire is currently in "clean up" mode as it accumulated a lot of things, and we lack the bandwidth to do that clean up
(we are currently at ~ 50% code coverage, which is a shame)
Luka Jacobowitz
@LukaJCB
Yeah it’s a pretty big project, but it has a lot of awesome stuff
Denis Rosset
@denisrosset
Thanks! Actually, can you open a spire issue with the problem of the default Monoids? We will likely not make a lot of progress in the next weeks, but it's something we have to address during the cleanup
Luka Jacobowitz
@LukaJCB
I can try to help out where I can as well :)
Denis Rosset
@denisrosset
Thanks a lot!
Luka Jacobowitz
@LukaJCB
I really love Algebra and Spire and they deserve more attention than they get :D
Denis Rosset
@denisrosset
@peterewills How is it going? Need help digging through Spire's code?
Me too! Love that we actually have a better type tower than Haskell in some places (TruncatedDivision notably!)
:p
Luka Jacobowitz
@LukaJCB
Indeed!
Should I open the issue in Typelevel/algebra? Technically Semiring is defined there
Denis Rosset
@denisrosset
Would say both.
Another underlying theme is whether we should share default instances as well.
Luka Jacobowitz
@LukaJCB
What do you mean by “share”? :)
Luka Jacobowitz
@LukaJCB
Srepfler Srdan
@schrepfler
is a Rational(1, 0) valid?
Luka Jacobowitz
@LukaJCB
If we end up merging algebra into cats it would be great to have you on the team @denisrosset :)
Denis Rosset
@denisrosset
@schrepfler No it's not. Should throw an Exception during construction.
Colt Frederickson
@coltfred
Where are the notes for 0.15 and 0.16? Latest I see here is 0.14.1 https://github.com/non/spire/blob/master/CHANGES.md
Also, I assume they're not compatible? My tests freak out with cNoSuchMethodError...
Denis Rosset
@denisrosset
@coltfred, we are breaking compatibility all the time, and indeed, the latest releases do not have accompanying notes.
The biggest pain with Spire now is that some parts are production ready (and simply need more test coverage), while others are shaky.
@LukaJCB That would be cool!
Cory Parent
@goedelsoup
has anyone explored or knows of an exploration in applying spire to geodesics?
Denis Rosset
@denisrosset
@goedelsoup Haven't heard of it, but I would be curious of seeing which algebraic structure underlie geodesics
Cory Parent
@goedelsoup
i'm an expert at neither, but am planning on using spire to work through a text on the topic. my initial uneducated view is that it's a pile of polynomial rings.
i'll definitely report back if i find it worthy of note. most of the existing code in this space is quite nightmarish.
Luciano
@lJoublanc
Excuse my ignorance, but I'm looking to implement a toy crypto system, which requires a finite field under mod N, and wondered whether there was already an instance in spire (or friends)?
Am I also right in that there is no integral Field because integral multiplication inverse isn't well defined? Or something to do with complexity of implementing gcd etc.?
Denis Rosset
@denisrosset
What is an integral field?
Finite fields can be implemented in Spire for sure; fields have trivial euclidean division (as all non zero elements have an inverse), and the GCD is more or less arbitrary.