diff --git a/arithmetic/src/division/srt/SRTTable.scala b/arithmetic/src/division/srt/SRTTable.scala index ff1ab28..6a408cf 100644 --- a/arithmetic/src/division/srt/SRTTable.scala +++ b/arithmetic/src/division/srt/SRTTable.scala @@ -1,10 +1,5 @@ package division.srt -import com.cibo.evilplot.colors.HTMLNamedColors -import com.cibo.evilplot.numeric.Bounds -import com.cibo.evilplot.plot._ -import com.cibo.evilplot.plot.aesthetics.DefaultTheme._ -import com.cibo.evilplot.plot.renderers.PointRenderer import os.Path import spire.implicits._ import spire.math._ @@ -31,34 +26,6 @@ case class SRTTable( lazy val xMin: Algebraic = -rho * dMax * radix lazy val xMax: Algebraic = rho * dMax * radix - /** P-D Diagram - * - * @note Graph 5.17(b) - */ - lazy val pd: Plot = Overlay((aMin.toBigInt to aMax.toBigInt).flatMap { k: BigInt => - Seq( - FunctionPlot.series( - _ * uRate(k.toInt).toDouble, - s"U($k)", - HTMLNamedColors.blue, - Some(Bounds(dMin.toDouble, dMax.toDouble)), - strokeWidth = Some(1) - ), - FunctionPlot.series( - _ * lRate(k.toInt).toDouble, - s"L($k)", - HTMLNamedColors.red, - Some(Bounds(dMin.toDouble, dMax.toDouble)), - strokeWidth = Some(1) - ) - ) ++ qdsPoints :+ mesh - }: _*) - .title(s"P-D Graph of $this") - .xLabel("d") - .yLabel(s"${radix.toInt}ω[j]") - .rightLegend() - .standard() - lazy val aMax: Algebraic = a lazy val aMin: Algebraic = -a lazy val deltaD: Algebraic = pow(2, -dTruncateWidth.toDouble) @@ -78,18 +45,6 @@ case class SRTTable( } } } - lazy val qdsPoints: Seq[Plot] = { - tables.map { - case (i, ps) => - ScatterPlot( - ps.flatMap { case (d, xs) => xs.map(x => com.cibo.evilplot.numeric.Point(d.toDouble, x.toDouble)) }, - Some( - PointRenderer - .default[com.cibo.evilplot.numeric.Point](pointSize = Some(1), color = Some(HTMLNamedColors.gold)) - ) - ) - } - } // TODO: select a Constant from each m, then offer the table to QDS. // todo: ? select rule: symmetry and draw a line parallel to the X-axis, how define the rule @@ -119,53 +74,9 @@ case class SRTTable( assert((rho > 1 / 2) && (rho <= 1)) private val dSet = Seq.tabulate((dStep + 1).toInt) { n => dMin + deltaD * n } - private val mesh = - ScatterPlot( - xSet.flatMap { y => - dSet.map { x => - com.cibo.evilplot.numeric.Point(x.toDouble, y.toDouble) - } - }, - Some( - PointRenderer - .default[com.cibo.evilplot.numeric.Point](pointSize = Some(0.5), color = Some(HTMLNamedColors.gray)) - ) - ) - override def toString: String = s"SRT${radix.toInt} with quotient set: from ${aMin.toInt} to ${aMax.toInt}" - /** Robertson Diagram - * - * @note Graph 5.17(a) - */ - def robertson(d: Algebraic): Plot = { - require(d > dMin && d < dMax) - Overlay((aMin.toBigInt to aMax.toBigInt).map { k: BigInt => - FunctionPlot.series( - _ - (Algebraic(k) * d).toDouble, - s"$k", - HTMLNamedColors.black, - xbounds = Some(Bounds(((Algebraic(k) - rho) * d).toDouble, ((Algebraic(k) + rho) * d).toDouble)) - ) - }: _*) - .title(s"Robertson Graph of $this divisor: $d") - .xLabel("rω[j]") - .yLabel("ω[j+1]") - .xbounds((-radix * rho * dMax).toDouble, (radix * rho * dMax).toDouble) - .ybounds((-rho * d).toDouble, (rho * d).toDouble) - .rightLegend() - .standard() - } - - def dumpGraph(plot: Plot, path: Path) = { - javax.imageio.ImageIO.write( - plot.render().asBufferedImage, - "png", - path.wrapped.toFile - ) - } - // select four points, then drop the first and the last one. /** for range `dLeft` to `dRight`, return the `rOmegaCeil` and `rOmegaFloor` * this is used for constructing the rectangle where m_k(i) is located. diff --git a/build.mill b/build.mill index 785d310..23687b9 100644 --- a/build.mill +++ b/build.mill @@ -8,7 +8,6 @@ import os._ object v { val scala = "2.13.15" val spire = ivy"org.typelevel::spire:0.18.0" - val evilplot = ivy"io.github.cibotech::evilplot:0.9.0" val oslib = ivy"com.lihaoyi::os-lib:0.9.1" val mainargs = ivy"com.lihaoyi::mainargs:0.5.0" val chiselCrossVersions = Map( @@ -40,8 +39,6 @@ trait Arithmetic def spireIvy = v.spire - def evilplotIvy = v.evilplot - def chiselModule = None def chiselPluginJar = None diff --git a/common.mill b/common.mill index eba8c97..46f9a82 100644 --- a/common.mill +++ b/common.mill @@ -33,7 +33,5 @@ trait ArithmeticModule with HasChisel { def spireIvy: T[Dep] - def evilplotIvy: T[Dep] - - override def ivyDeps = T(super.ivyDeps() ++ Seq(spireIvy(), evilplotIvy())) + override def ivyDeps = T(super.ivyDeps() ++ Seq(spireIvy())) } diff --git a/nix/arithmetic.nix b/nix/arithmetic.nix index 0c2e2a2..1e06020 100644 --- a/nix/arithmetic.nix +++ b/nix/arithmetic.nix @@ -16,7 +16,7 @@ let name = "arithmetic"; src = arithmeticSrc; buildInputs = [ chisel.setupHook ]; - millDepsHash = "sha256-NYB4g7uCaQZH7MqA7fdQzB2vXUdXfo37MC6hAMaMIZU="; + millDepsHash = "sha256-lv1d+NSXsV42Xb1NuVZjlz07T6W4Xqkx/3MQvaVqRTA="; }; in publishMillJar {