by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 09 20:35

    larsrh on master

    Update sbt-buildinfo to 0.10.0 Merge pull request #928 from sc… (compare)

  • Aug 09 20:35
    larsrh closed #928
  • Aug 09 07:47
    scala-steward opened #928
  • Aug 08 15:51

    larsrh on master

    Update scalacheck-1-14 to 3.2.1… (compare)

  • Aug 08 15:51
    larsrh closed #926
  • Aug 08 12:07
    NthPortal synchronize #924
  • Aug 08 11:00
    scala-steward synchronize #926
  • Aug 08 10:43

    larsrh on master

    update Maven Central badge [ci… (compare)

  • Aug 08 10:41
    larsrh demilestoned #689
  • Aug 08 10:41
    larsrh demilestoned #688
  • Aug 08 10:41
    larsrh demilestoned #690
  • Aug 08 10:41
    larsrh demilestoned #687
  • Aug 08 09:36

    larsrh on master

    Update scalatest to 3.2.1 Merge pull request #925 from sc… (compare)

  • Aug 08 09:36
    larsrh closed #925
  • Aug 08 09:19
    larsrh synchronize #925
  • Aug 08 09:18

    larsrh on master

    Update discipline-scalatest to … Merge pull request #922 from sc… (compare)

  • Aug 08 09:18
    larsrh closed #922
  • Aug 08 09:04
    larsrh closed #520
  • Aug 08 09:04
    larsrh commented #520
  • Aug 08 09:04
    larsrh closed #554
Soren
@srnb_gitlab
Is there a typeclass that witnesses some type T can hold an imaginary value?
If not, I can make one, but
Something like
trait Complicate[T] {

  def i: T

}

object Complicate {

  implicit def complicateComplex[T](implicit t: CRing[T]): Complicate[Complex[T]] = new Complicate[Complex[T]] {
    override def i: Complex[T] = Complex.i
  }

}
Soren
@srnb_gitlab

I'm using it like so:

  def y[T](implicit c: Complicate[T], g: AdditiveGroup[T]): Matrix[2, 2, T] =
    Matrix(Vec(
      Vec(g.zero :: g.negate(c.i) :: HNil) ::
      Vec(c.i :: g.zero :: HNil) ::
      HNil
    ))

so I can just Pauli.y[T] and not something like Pauli.y[Complex[T]]

Soren
@srnb_gitlab
Sorry, Matrix[2, 2, T] instead of Matrix[2, 2, Complex[T]]
Denis Rosset
@denisrosset
@srnb_gitlab there is something slightly more general than a field, a division ring
A field is a division ring, with the condition on top that multiplication is commutative
For example, the quaternions form a division ring, but not a field
For your second question
For your Complicate trait, I can think of two possible structures
One of them, given a type T representing either a subfield of the reals, or an approximation of the reals, returns the corresponding complex type, and provides the imaginary unit
Denis Rosset
@denisrosset
The other one describes a complex structure on top of a real vector space: https://en.wikipedia.org/wiki/Linear_complex_structure
(it's basically a morphism that describes the multiplication by the imaginary unit)
Paul Snively
@paul-snively
@srnb_gitlab: Is Complex not what you want?
Soren
@srnb_gitlab
@paul-snively I want a typeclass. Complex has an instance of that typeclass
@denisrosset Thank you, I'll check division ring out and adjust my code accordingly
Paul Snively
@paul-snively
@srnb_gitlab: Ah, I see what you mean.
Denis Rosset
@denisrosset
@srnb_gitlab Careful if you widen your type to accept noncommutative typeclasses
If you don't test your code with things that actually are noncommutative, bad things happen
I cleaned up some stuff in Spire due to that
You can use Quaternion for tests though
Soren
@srnb_gitlab
@denisrosset Well, I don't know what operations "require" commutative multiplication, persay
I should probably email my past LinAlg prof, I know that he's a software dev (but I'm not sure if he does fp or theory or anything related to that)
Piotr Paradziński
@lemastero
Hello, looks like spire for scalajs is released for 0.6 but there is no artifacts for scalajs 1.0 and 1.1. Any chance to publish for latest scalajs?
Oliver Winks
@PaperPlaneSoftware
Hi guys
is there any support for vectors in Spire?
I'm making a multi-agent simulation and need something to do basic 3d maths stuff
Denis Rosset
@denisrosset
Not really; but you can define your own Vector3D[A] class, and make instances of VectorSpace[Vector3D[A], A] available where A is a field
Then you get the property tests of VectorSpace for free
@lemastero I'm waiting to get publish rights in the typelevel repo
Oliver Winks
@PaperPlaneSoftware
@denisrosset thanks :thumbsup:
@denisrosset I saw some discussion of a cross product implementation and came across Zainab's PR (looked promising) any idea what happened to that work?
Soren
@srnb_gitlab
Is there a good way to send Reals over the wire?
Soren
@srnb_gitlab
Spire Matrices are mutable?
Luka Jacobowitz
@LukaJCB
there’s circe-spire, but I think it might be missing instances for Real
Valeriy Avanesov
@akopich
Hi. Does spire define a type for positive integers? Looks like Naturals include zero.
Feels like it would be extremely useful in combination with non-empty collections.
Paul Snively
@paul-snively
Hi everyone! I'm looking at Erik Osheim's wonderful https://www.youtube.com/watch?v=O78hnJuzQwA and wondering whether that elist library is out there somewhere I should be aware of?
I'm asking here because I figure Erik is likely to see it, sooner or later, but if anyone knows a better way to contact him, I'd appreciate knowing about it.
Carlos Quiroz
@cquiroz
Hello, I’m thinking to use UInt but I noted there is no ConvertableFrom nor ConvertableTo Uint unlike, e.g. Natural
Is there a reason for that?
Denis Rosset
@denisrosset
@akopich Why not use BigInt with https://github.com/fthomas/refined ? Natural is kind of a weird type
@cquiroz The whole ConvertableFrom, ConvertableTo business is not necessarily very principled. That said, using UInt with those typeclasses is likely to lead to boxing if the JIT is not clever enough.
Carlos Quiroz
@cquiroz
Thanks @denisrosset I have an entity that only takes positive numbers, I’ll take a look at refined
Valeriy Avanesov
@akopich
@denisrosset that would be an option, but I want to have at least some basic arithmetics on that type. E.g. positive plus positive should be also positive. Refined types don't give that.
Denis Rosset
@denisrosset
Why not a wrapper that only defines the + operation? Also, are you planning to have collections whose size is bigger than 2^63? You could use a wrapper around a Long then
I'd be wary of introducing a dependency on Spire if you don't have further need for the library
Valeriy Avanesov
@akopich

Why not a wrapper...

that's how i've implemented it eventually.

In fact, I wrapped Int.
Thanks for your input.