[scalation] r30 committed - Fixed the scaladoc comments in all the source files. Removed the post-...

0 views
Skip to first unread message

scal...@googlecode.com

unread,
Feb 9, 2011, 4:43:48 PM2/9/11
to scalati...@googlegroups.com
Revision: 30
Author: mepcot...@gmail.com
Date: Wed Feb 9 13:41:57 2011
Log: Fixed the scaladoc comments in all the source files. Removed the
post-processing that was performed by the build script.
http://code.google.com/p/scalation/source/detail?r=30

Modified:
/branches/devel/Build.scala
/branches/devel/src/scalation/activity/PetriNet.scala
/branches/devel/src/scalation/activity/PetriNetRules.scala
/branches/devel/src/scalation/advmath/Combinatorics.scala
/branches/devel/src/scalation/advmath/Complex.scala
/branches/devel/src/scalation/advmath/Eigen.scala
/branches/devel/src/scalation/advmath/Matrix.scala
/branches/devel/src/scalation/advmath/MatrixN.scala
/branches/devel/src/scalation/advmath/Random.scala
/branches/devel/src/scalation/advmath/SparseMatrixN.scala
/branches/devel/src/scalation/advmath/SymmetricTridMatrixN.scala
/branches/devel/src/scalation/advmath/VectorN.scala
/branches/devel/src/scalation/animation/AnimateCommand.scala
/branches/devel/src/scalation/animation/Animator.scala
/branches/devel/src/scalation/animation/DgAnimator.scala
/branches/devel/src/scalation/animation/Dgraph.scala
/branches/devel/src/scalation/dynamics/DormandPrince.scala
/branches/devel/src/scalation/dynamics/Integrator.scala
/branches/devel/src/scalation/dynamics/LinearDiffEq.scala
/branches/devel/src/scalation/dynamics/RungeKutta.scala
/branches/devel/src/scalation/event/CausalLink.scala
/branches/devel/src/scalation/event/Entity.scala
/branches/devel/src/scalation/event/Event.scala
/branches/devel/src/scalation/event/Model.scala
/branches/devel/src/scalation/optimization/RevisedSimplex.scala
/branches/devel/src/scalation/optimization/Simplex.scala
/branches/devel/src/scalation/process/Component.scala
/branches/devel/src/scalation/process/Junction.scala
/branches/devel/src/scalation/process/Model.scala
/branches/devel/src/scalation/process/Resource.scala
/branches/devel/src/scalation/process/SimActor.scala
/branches/devel/src/scalation/process/Sink.scala
/branches/devel/src/scalation/process/Source.scala
/branches/devel/src/scalation/process/Transport.scala
/branches/devel/src/scalation/process/WaitQueue.scala
/branches/devel/src/scalation/scala2d/Arrow.scala
/branches/devel/src/scalation/scala2d/Colors.scala
/branches/devel/src/scalation/scala2d/CurvilinearShape.scala
/branches/devel/src/scalation/scala2d/Line.scala
/branches/devel/src/scalation/scala2d/Polygon.scala
/branches/devel/src/scalation/scala2d/QArrow.scala
/branches/devel/src/scalation/scala2d/QCurve.scala
/branches/devel/src/scalation/scala2d/Shapes.scala
/branches/devel/src/scalation/scala2d/Transform.scala
/branches/devel/src/scalation/stat/Histogram.scala
/branches/devel/src/scalation/stat/Plot.scala
/branches/devel/src/scalation/stat/Quantile.scala
/branches/devel/src/scalation/stat/Regression.scala
/branches/devel/src/scalation/stat/StatVector.scala
/branches/devel/src/scalation/stat/Statistic.scala
/branches/devel/src/scalation/stat/Variate.scala
/branches/devel/src/scalation/state/Markov.scala
/branches/devel/src/scalation/state/MarkovC.scala
/branches/devel/src/scalation/util/Error.scala
/branches/devel/src/scalation/util/GenIndexHtml.scala
/branches/devel/src/scalation/util/Identity.scala
/branches/devel/src/scalation/util/Monitor.scala
/branches/devel/src/scalation/util/PQueue.scala
/branches/devel/src/scalation/util/Replace.scala

=======================================
--- /branches/devel/Build.scala Mon Feb 7 17:38:45 2011
+++ /branches/devel/Build.scala Wed Feb 9 13:41:57 2011
@@ -1,6 +1,7 @@
/** $Id$ */

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller, Michael Cotterell
* @version 1.0
* @date Mon Sep 14 14:15:51 EDT 2009
@@ -11,7 +12,8 @@
import java.{ io => jio }
import java.{ util => jutil }

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to build the scalation Scala-based Simulation
System.
* Comment out lines using // for customized builds. To build the complete
* scalation system, type the following two commands:
@@ -56,7 +58,8 @@
}


-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Returns the path to the scalac executable
*/
private def scalac(): String = {
@@ -65,7 +68,8 @@
scalac_bin
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Returns the path to the scaladoc executable
*/
private def scaladoc(): String = {
@@ -74,7 +78,8 @@
scaladoc_bin
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* A utility function to that returns an array that is arr2 appended to
arr1
*/
private def appendArray[T: ClassManifest](arr1: Array[T], arr2:
Array[T]): Array[T] = {
@@ -84,7 +89,8 @@
result
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Executes the specified command
*/
private def exec(cmd: Array[String]) {
@@ -128,22 +134,24 @@
}
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* A utility function that lists all the files with a given extension in p
*/
private def listFiles(p: jio.File, ext: String = ""): List[jio.File] = {
var list = List[jio.File]()
- if (p.isDirectory()) {
- p.listFiles().foreach(f => list = (list ::: listFiles(f, ext)))
- } else {
- if (p.getPath().endsWith(ext)) {
- return List(p)
+ if (p.exists()) {
+ if (p.isDirectory()) {
+ for (file <- p.listFiles()) list = (list ::: listFiles(file, ext))
+ } else if (p.getPath().endsWith(ext)) {
+ list = List(p)
}
}
return list
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Delete a file or directory. If a predicate function is provided then
only
* files in the path that satisfy that predicate will be deleted.
*/
@@ -166,8 +174,8 @@
if (!p.exists() || !p.isDirectory()) p.mkdir()
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- * Performs pre-build checks
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /** Performs pre-build checks
*/
def pre() {
println("[pre]")
@@ -183,7 +191,8 @@
}
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Cleans up the build environment
*/
def clean() {
@@ -202,7 +211,8 @@
mkdir(new jio.File(class_dir))
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Generates the scaladoc documentation
*/
def doc() {
@@ -219,7 +229,8 @@
exec(cmd)
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compiles all the packages
*/
def compile() {
@@ -233,7 +244,8 @@
exec(cmd)
}

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Generate index.html for browsing the source code.
*/
def genIndexHtml() {
@@ -241,37 +253,13 @@
// @todo generate the index html for source code using GenIndexHtml
} // genIndexHtml

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Perform any post-processing
*/
def post() {
println("[post]")
-
- // remove colons from generated scaladoc
- println("Removing long colon strings from scaladoc output...")
- for ((file) <- listFiles(new jio.File(doc_dir), ".html")) {
-
- var filename = file.getPath()
- var tempname = filename + ".temp"
- var tempfile = new jio.File(tempname)
-
- file.renameTo(tempfile)
-
- var dest = Destination.toFile(filename)
- var source = Source.fromFile(tempname)
-
- // match the ":::+" regex and replace it with ""
- for (line <- source.getLines()) {
- dest.println(line.replaceAll(":::+", ""))
- }
-
- dest.close()
- source.close()
-
- delete(tempfile)
-
- }
-
+ // place post-processing code here
}

// select build functions by moving the comment delimiters (/***, ***/)
=======================================
--- /branches/devel/src/scalation/activity/PetriNet.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/activity/PetriNet.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Fri Oct 16 15:05:06 EDT 2009
@@ -21,7 +22,8 @@
import scalation.scala2d.Colors._
import scalation.util.{Error, Identity, PQueue, PQItem}

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class represents a discrete place (can hold tokens).
* @param x the place's x-coordinate
* @param y the place's y-coordinate
@@ -31,19 +33,22 @@
class PlaceI (val x: Double, val y: Double, var tokens: VectorI, stays:
Boolean = false)
extends Identity
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add tokens to this discrete place.
* @param _token the token vector to add
*/
def add (_tokens: VectorI) { tokens += _tokens }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Take tokens from this discrete place.
* @param _token the token vector to take away
*/
def take (_tokens: VectorI) { tokens -= _tokens }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Determine whether this place holds at least the token vector (i.e.,
* the requisite number of tokens of each color). Alternative: use
* threshold predicate in PetriNetRules.
@@ -53,7 +58,8 @@

} // PlaceI class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class represents a continuous place (can hold fluids).
* @param x the place's x-coordinate
* @param y the place's y-coordinate
@@ -63,19 +69,22 @@
class PlaceD (val x: Double, val y: Double, var fluids: VectorD, stays:
Boolean = false)
extends Identity
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add fluids to this continuous place.
* @param _fluids the fluid vector to add
*/
def add (_fluids: VectorD) { fluids += _fluids }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Take fluids from this continuous place.
* @param _fluids the fluid vector to take away
*/
def take (_fluids: VectorD) { fluids -= _fluids }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Determine whether this place holds at least the fluid vector (i.e.,
* the requisite amount of fluid of each color). Alternative: use
* threshold predicate in PetriNetRules.
@@ -85,7 +94,8 @@

} // PlaceD class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class represents a timed transition.
* @param x the x-coordinate for this transition
* @param y the y-coordinate for this transition
@@ -135,7 +145,8 @@
*/
var locked: Boolean = false

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Connect this transition to all the incoming and outgoing discrete
arcs
* as well as the containing Petri net.
* @param _pnet the containing Petri net
@@ -152,7 +163,8 @@
outD = Array [ArcD] ()
} // connect

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Connect this transition to all the incoming and outgoing continuous
arcs
* as well as the containing Petri net.
* @param _pnet the containing Petri net
@@ -169,7 +181,8 @@
outD = _out
} // connect

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Connect this transition to all the incoming and outgoing arcs as
well as
* the containing Petri net.
* @param _pnet the containing Petri net
@@ -188,31 +201,36 @@
outD = _outD
} // connect

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add tokens to this transition.
* @param _token the token vector to add
*/
def addTokens (_tokens: VectorI) { tokens += _tokens }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Take tokens from this transition.
* @param _token the token vector to take away
*/
def takeTokens (_tokens: VectorI) { tokens -= _tokens }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add fluids to this transition.
* @param _fluids the fluid vector to add
*/
def addFluids (_fluids: VectorD) { fluids += _fluids }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Take fluids from this transition.
* @param _fluids the fluid vector to take away
*/
def takeFluids (_fluids: VectorD) { fluids -= _fluids }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check the incoming arcs from discrete place for enough tokens of the
* right colors and the incoming arcs from continuous places for enough
* fluid of the right colors.
@@ -225,7 +243,8 @@
true
} // checkGuard

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Enable this transition by computing the firing delay. Should
immediately
* place it on the time ordered firing list. Also, move tokens/fluids
from
* input places to this transition.
@@ -287,7 +306,8 @@
firingDelay
} // enable

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Fire this transition by moving the requisite number and color of
tokens
* from this transition to each outgoing discrete place and the
requisite
* amount and color of fluid to each outgoing continuous place.
@@ -342,7 +362,8 @@
locked = false // this transition is now in complete, so it's
unlocked
} // fire

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compare this transition to tr2 based on firing time.
* @param tr2 the other transition
*/
@@ -350,7 +371,8 @@

} // Transition class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class represents a arc connecting discrete place with a
* transition. If incoming is true the arc is from the place to transition,
* otherwise it is from the transition to the place (outgoing).
@@ -372,7 +394,8 @@
if ( ! incoming && testArc) flaw ("constructor", "test arcs must
be incoming")
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the number of tokens of each color to flow over this arc.
* @param tokens the number of tokens available
* @param time the current time
@@ -385,7 +408,8 @@

} // ArcI class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class represents a arc connecting continuous place with a
* transition. If incoming is true the arc is from the place to transition,
* otherwise it is from the transition to the place (outgoing).
@@ -410,7 +434,8 @@
if ( ! incoming && derv != null) flaw ("constructor", "only
incoming arcs may have ODE's")
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the amount of fluid of each color to flow over this arc.
* @param fluids the amount of fluid available
* @param time the current time
@@ -427,7 +452,8 @@

} // ArcD class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class provides a simulation engine for Hybrid Colored Petri Nets.
* Reference: "Discrete-event simulation of fluid stochastic Petri Nets"
* @param colors array of colors for tokens/fluids
@@ -439,7 +465,8 @@
transition: Array [Transition])
extends PetriNetRules with Error
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a discrete Petri net (tokens, but no fluids).
* @param colors array of colors for tokens
* @param placeI array of discrete places
@@ -450,7 +477,8 @@
this (colors, placeI, Array [PlaceD] (), transition)
} // contructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a continuous Petri net (fluids, but no tokens).
* @param colors array of colors for fluids
* @param placeD array of continuous places
@@ -489,17 +517,20 @@
*/
private val ntransitions = transition.length

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the current time.
*/
def clock = _clock

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the animation command queue.
*/
def getCommandQueue = cqueue

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the Petri net to the string representation.
*/
override def toString =
@@ -520,7 +551,8 @@
s
} // toString

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Initialize the animation by drawing the Petri net components onto
the
* animation drawing panel using animation commands.
* @param timeDilationFactor time dilation is used to speed up/slow
down animation
@@ -596,7 +628,8 @@
println ("PetriNet.initAnimation: end drawing the Petri net graph")
} // initAnimation

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Simulate the execution of the Petri Net.
* @param tStart the starting time for the simulation
* @param tStop the stopping time for the simulation
@@ -647,7 +680,8 @@

} // PetriNet class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to provide unique identifiers for tokens/fluids.
*/
object Counter
@@ -659,7 +693,8 @@

} // Counter object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the PetriNet class.
*/
object PetriNetTest extends Application
=======================================
--- /branches/devel/src/scalation/activity/PetriNetRules.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/activity/PetriNetRules.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Oct 12 18:41:26 EDT 2009
@@ -13,7 +14,8 @@
import scalation.advmath.Vectors._
import scalation.stat._

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to define firing rules for the PetriNet class.
* It supports both constant flow and linear flow models of token
* (integer valued) and fluid (real valued) flow.
@@ -30,7 +32,8 @@
*/
trait PetriNetRules
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return whether the matrix inequality is true: t >= b.
* The firing threshold should be checked for every incoming arc.
* If all return true, the transition should fire.
@@ -39,7 +42,8 @@
*/
def thresholdI (t: VectorI, b: VectorI): Boolean = t >= b

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return whether the matrix inequality is true: f >= b.
* The firing threshold should be checked for every incoming arc.
* If all return true, the transition should fire.
@@ -48,7 +52,8 @@
*/
def thresholdD (f: VectorD, b: VectorD): Boolean = f >= b

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Function to compute the delay in firing a transition.
* The base time is given by a random variate.
* This is adjusted by weight vectors multiplying the number of
@@ -68,7 +73,8 @@
delay
} // calcFiringTime

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the number of tokens to flow over an arc according to the
* vector expression: b + r * (t-b) * d. If d is 0, returns b.
* Supports linear (w.r.t. time delay) and constant (d == 0) flow
models.
@@ -82,7 +88,8 @@
t min (if (d == 0 || r == null) b else b + ((r * (t - b)).toDouble
* d).toInt)
} // tokenFlow

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the amount of fluid to flow over an arc according to the
* matrix expression: b + r * (f-b) * d. If r is 0, returns b.
* Supports linear (w.r.t. time delay) and constant (d == 0) flow
models.
@@ -96,7 +103,8 @@
f min (if (d == 0 || r == null) b else b + r * (f - b) * d)
} // fluidFlow

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the amount of fluid to flow over an arc according to the
* system of first-order Ordinary Differential Equation (ODE's):
* "integral derv from t0 to t". Supports ODE base flow models.
@@ -115,7 +123,8 @@

} // PetriNetRules trait

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the PetriNetRules trait.
*/
object PetriNetRulesTest extends Application with PetriNetRules
=======================================
--- /branches/devel/src/scalation/advmath/Combinatorics.scala Wed Feb 9
11:33:25 2011
+++ /branches/devel/src/scalation/advmath/Combinatorics.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Sep 30 18:41:26 EDT 2009
@@ -11,7 +12,8 @@
import scala.math._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This trait provides several common combinatorics functions.
*/
trait Combinatorics extends Error
@@ -24,7 +26,8 @@
*/
val EPSILON = 1E-9

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return true if x == y approximately.
* @param x the first value to compare
* @param y the second value to compare
@@ -34,7 +37,8 @@
abs (x - y) < EPSILON
} // approx

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute k! (k factorial).
* @param k the argument to the factorial function
*/
@@ -45,7 +49,8 @@
prod
} // fac

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute permuations of k items selected from n total items.
* @param n the total number of items
* @param k the of items selected
@@ -57,7 +62,8 @@
prod
} // perm

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute n choose k (combinations).
* @param n the total number of items
* @param k the of items to choose
@@ -68,7 +74,8 @@
//perm (n, k) / fac (k)
} // choose

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the gamma function for the following two cases:
* (1) when k is an integer and (2) when k is an integer + 1/2.
* @param k the argument to the gamma function
@@ -90,7 +97,8 @@
prod
} // gammaF

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the beta function for the following two cases:
* (1) when k1, k2 are integers and (2) when k1, k2 are integers + 1/2.
* @param k1 the first argument to the beta function
@@ -103,7 +111,8 @@

} // Combinatorics trait

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This objects test the methods in the Combinatorics trait.
*/
object CombinatoricsTest extends Application with Combinatorics
=======================================
--- /branches/devel/src/scalation/advmath/Complex.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/advmath/Complex.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Feb 22 12:11:17 EST 2010
@@ -8,7 +9,8 @@

package scalation.advmath

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to represent complex numbers (a + bi) as (a, b),
e.g.,
* (2.1, 3.2i). Note: i * i = -1.
* @param re the real part
@@ -17,14 +19,16 @@
case class Complex (re: Double, im: Double = 0.)
extends Fractional [Complex] with Ordered [Complex]
{
-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the unary minus (-).
*/
def unary_- () = Complex (-re, -im)

def negate (c: Complex) = -c

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add two complex numbers.
* @param c add c to this
*/
@@ -32,7 +36,8 @@

def plus (c: Complex, d: Complex) = c + d

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Substract two complex numbers.
* @param c subtract c from this
*/
@@ -40,7 +45,8 @@

def minus (c: Complex, d: Complex) = c - d

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply two complex numbers.
* @param c multiply this times c
*/
@@ -48,7 +54,8 @@

def times (c: Complex, d: Complex) = c * d

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Divide two complex numbers.
* @param c divide this by c
*/
@@ -57,17 +64,20 @@

def div (c: Complex, d: Complex) = c / d

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the complex conjugate: if z = (a + bi) then z.bar = (a -
bi).
*/
def bar = Complex (re, -im)

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Determine whether the complex number is real (no imaginary part).
*/
def isReal = im == 0

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compare two complex numbers (negative for <, zero for ==, positive
for >).
* @param c the first complex number to compare
* @param d the second complex number to compare
@@ -77,7 +87,8 @@
if (c.re == d.re) c.im compare d.im else c.re compare d.re
} // compare

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compare this complex number with that complex number d.
* @param d that complex number
*/
@@ -86,44 +97,51 @@
if (re == d.re) im compare d.im else re compare d.re
} // compare

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the complex number to a Double.
* @param c the complex number to convert
*/
def toDouble (c: Complex) = re

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the complex number to a Float.
* @param c the complex number to convert
*/
def toFloat (c: Complex) = re.asInstanceOf [Float]

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the complex number to a Long.
* @param c the complex number to convert
*/
def toLong (c: Complex) = re.asInstanceOf [Long]

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the complex number to an Int.
* @param c the complex number to convert
*/
def toInt (c: Complex) = re.asInstanceOf [Int]

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a complex number from an Int.
* @param n the integer used to create the complex number.
*/
def fromInt (n: Int) = Complex (n, 0.)

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this complex number to a String.
*/
override def toString = "Complex ( " + re + " , " + im + "i )"

} // Complex class

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Complex class.
*/
object ComplexTest extends Application
=======================================
--- /branches/devel/src/scalation/advmath/Eigen.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/advmath/Eigen.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller, Robert Davis
* @version 1.0
* @date Thu Jan 28 13:29:27 EST 2010
@@ -17,7 +18,8 @@
import scalation.advmath.Vectors._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to reduce, via similarity transformations, an n by n
matrix
* 'a' to Hessenburg form 'h', where all elements two below the main
diagonal are
* zero (or close to zero). Note, similarity transformations do not
changes the
@@ -47,14 +49,16 @@
} // for
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the Hessenburg h matrix.
*/
def getH: MatrixD = h

} // Hessenburg class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to decompose an m by n matrix 'a' into an orthogonal
m by n
* matrix 'q' and an n by n right upper triangular matrix 'r' such that a
= q * r.
* It uses Gram-Schmidt orthogonalization.
@@ -95,19 +99,22 @@
} // for
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the orthogonal q matrix.
*/
def getQ: MatrixD = q

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the right upper triangular r matrix.
*/
def getR: MatrixD = r

} // QRdecomposition class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to find the eigenvalues of an n by n matrix 'a'
using an
* iterative technique that applies similarity transformations to
convert 'a' into
* an upper triangular matrix, so that the eigenvalues appear along the
diagonal.
@@ -167,13 +174,15 @@
} // for
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the eigenvalue e vector.
*/
def getE: VectorD = e
} // Eigenvalue class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author Robert Davis
*
* This class performs a Householder Tridiagonalization on a symmetric
matrix.
@@ -208,7 +217,8 @@
t(n, n) = a(n, n)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the Householder vector v and its corresponding scalar b,
* where I - b * v * v.t is an orthogonal matrix.
* @see Algorithm 5.1.1 in Matrix Computations.
@@ -231,14 +241,16 @@
Tuple2 (v, b)
} // house

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the Householder Tridiagonal matrix.
*/
def getT: SymmetricTridMatrixN [Double] = t

} // Householder class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class performs a symmetric QR step with a Wilkinson shift.
* @see Algorithm 8.3.2 in Matrix Computations.
* @param t the unreduced symmetric tridiagonal matrix
@@ -286,7 +298,8 @@
ev(n - 1) = g
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create the values for a Givens 2-by-2 rotation matrix. Given
scalars
* a and b, efficiently compute c = cos(theta) and s = sin(theta) that
can
* be used to form the rotation matrix.
@@ -309,7 +322,8 @@
Tuple2 (c, s)
} // givens

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the tridiagonal matrix after reduction by Givens rotations.
*/
def getT: MatrixD = t
@@ -321,7 +335,8 @@
{
private val EPSILON = 1e-9

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
*
*/
def qRStep (t: SymmetricTridMatrixN [Double], p: Int, q: Int) =
@@ -351,7 +366,8 @@
t.sd(n - 1) = g
} // qRStep

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
*
*/
def givens (a: Double, b: Double): Tuple2 [Double, Double] =
@@ -370,7 +386,8 @@
} // givens
} // SymmetricQRstep object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to find the eigenvalues of an n by n symmetric
matrix 'a'
* using an iterative technique, the Symmetric QR Algorithm.
* @see Algorithm 8.3.3 in Matrix Computations.
@@ -417,7 +434,8 @@
} // while
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a EigenvalueSym finder (non-sparse matrix case).
* @param m the non-sparse matrix
*/
@@ -426,14 +444,16 @@
this (new SparseMatrixN [Double] (m, 0.))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the eigenvalue e vector.
*/
def getE: VectorD = d.dg // the diagonal of the tridiagonal matrix

} // EigenvalueSym

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to find the eigenvectors of an n by n matrix 'a' by
solving
* equations of the form (a - eI)v = 0 where e is the eigenvalue and v is
the
* eigenvector. Place the eigenvectors in a matrix column-wise.
@@ -459,14 +479,16 @@
} // for
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the eigenvector v matrix.
*/
def getV: MatrixD = v

} // Eigenvector class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the all the classes used in computing
Eigenvalues
* and Eigenvectors for the non-symmetric/general case.
* @see http://en.wikipedia.org/wiki/QR_decomposition
@@ -508,7 +530,8 @@

} // EigenTest object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the all the classes used in computing
Eigenvalues
* and Eigenvectors for the symmetric/special case.
*/
=======================================
--- /branches/devel/src/scalation/advmath/Matrix.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/advmath/Matrix.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sat May 22 12:57:45 EDT 2010
@@ -10,7 +11,8 @@

import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Matrix class is abstract and defines the operations to be defined
by two
* concrete subclasses: MatrixN and SparseMatrixN.
* @param dim1 the first/row dimension
@@ -28,20 +30,23 @@
*/
protected val range2 = 0 until dim2

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's element at the i,j-th index position.
* @param i the row index
* @param j the column index
*/
def apply (i: Int, j: Int): T

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's vector at the i-th index position (i-th row).
* @param i the row index
*/
def apply (i: Int): VectorN [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's element at the i,j-th index position to the
scalar x.
* @param i the row index
* @param j the column index
@@ -49,14 +54,16 @@
*/
def update (i: Int, j: Int, x: T)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's row at the i-th index position to the vector u.
* @param i the row index
* @param u the vector value to assign
*/
def update (i: Int, u: VectorN [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set all the elements in this matrix to the scalar x.
* @param x the scalar value to assign
*/
@@ -65,7 +72,8 @@
for (i <- range1; j <- range2) this(i, j) = x
} // set

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the values in this matrix as copies of the values in 2D array u.
* @param u the 2D array of values to assign
*/
@@ -74,7 +82,8 @@
for (i <- range1; j <- range2) this(i, j) = u(i)(j)
} // set

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Iterate over the matrix row by row.
* @param f the function to apply
*/
@@ -84,7 +93,8 @@
while (i < dim1) { f (this(i)()); i += 1 }
} // foreach

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get row '_row' from the matrix, returning it as a vector.
* @param _row the row to extract from the matrix
* @param from the position to start extracting from
@@ -96,7 +106,8 @@
c
} // row

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set row 'row' of the matrix to a vector.
* @param row the column to set
* @param u the vector to assign to the column
@@ -106,7 +117,8 @@
for (j <- range2) this(row, j) = u(j)
} // setRow

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get column '_col' from the matrix, returning it as a vector.
* @param _col the column to extract from the matrix
* @param from the position to start extracting from
@@ -118,7 +130,8 @@
c
} // col

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set column 'col' of the matrix to a vector.
* @param col the column to set
* @param u the vector to assign to the column
@@ -128,14 +141,16 @@
for (i <- range1) this(i, col) = u(i)
} // setColumn

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix row-wise from to end.
* @param from the start of the slice
* @param end the end of the slice
*/
def slice (from: Int, end: Int): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix row-wise r_from to r_end and column-wise c_from
to c_end.
* @param r_from the start of the row slice
* @param r_end the end of the row slice
@@ -144,14 +159,16 @@
*/
def slice (r_from: Int, r_end: Int, c_from: Int, c_end: Int): Matrix
[T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix excluding the given row and column.
* @param row the row to exclude
* @param col the column to exclude
*/
def sliceExclude (row: Int, col: Int): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return 1 if the condition is true else 0
* @param cond the condition to evaluate
*/
@@ -160,116 +177,135 @@
if (cond) 1 else 0
} // oneIf

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Transpose this matrix (rows => columns).
*/
def t: Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
def + (b: Matrix [T]) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
def += (b: Matrix [T]) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and scalar s.
* @param s the scalar to add
*/
def + (s: T) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and scalar s.
* @param s the scalar to add
*/
def += (s: T) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
def - (b: Matrix [T]) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract inplace matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
def -= (b: Matrix [T]) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract scalar s.
* @param s the scalar to subtract
*/
def - (s: T) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract inplace scalar s.
* @param s the scalar to subtract
*/
def -= (s: T) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by matrix b.
* @param b the matrix to multiply by (requires sameCrossDimensions)
*/
def * (b: Matrix [T]) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by matrix b.
* @param b the matrix to multiply by (requires sameCrossDimensions)
*/
def *= (b: Matrix [T]) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b.
* @param b the vector to multiply by
*/
def * (b: VectorN [T]) (implicit nu: Numeric [T]): VectorN [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by scalar s.
* @param s the scalar to multiply by
*/
def * (s: T) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by scalar s.
* @param s the scalar to multiply by
*/
def *= (s: T) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b to produce another matrix (a_ij *
b_j)
* @param b the vector to multiply by
*/
def ** (b: VectorN [T]) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by vector b to produce another matrix
(a_ij * b_j)
* @param b the vector to multiply by
*/
def **= (b: VectorN [T]) (implicit nu: Numeric [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose this matrix into the product of lower and upper triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* partial pivoting.
*/
def lud (implicit nu: Fractional [T]): Tuple2 [Matrix [T], Matrix [T]]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose inplace this matrix into the product of lower and upper
triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* partial pivoting.
*/
def lud_ip (implicit nu: Fractional [T]): Tuple2 [Matrix [T], Matrix
[T]]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation l*u*x = b (see lud above).
* @param l the lower triangular matrix
* @param u the upper triangular matrix
@@ -278,7 +314,8 @@
def solve (l: Matrix [T], u: Matrix [T], b: VectorN [T])
(implicit nu: Fractional [T]): VectorN [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation l*u*x = b (see lud above).
* @param lu the lower and upper triangular matrices
* @param b the constant vector
@@ -286,14 +323,16 @@
def solve (lu: Tuple2 [Matrix [T], Matrix [T]], b: VectorN [T])
(implicit nu: Fractional [T]): VectorN [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation a*x = b where a is this matrix (see lud
above).
* @param b the constant vector.
*/
def solve (b: VectorN [T])
(implicit nu: Fractional [T]): VectorN [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Determine the rank of this m by n matrix by taking the upper
triangular
* matrix from the LU Decomposition and counting the number of non-zero
* diagonal elements.
@@ -307,14 +346,16 @@
count
} // rank

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Combine this matrix with matrix b, placing them along the diagonal
and
* filling in the bottom left and top right regions with zeroes;
[this, b].
* @param b the matrix to combine with this matrix
*/
def diag (b: Matrix [T]) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Form a matrix [Ip, this, Iq] where Ir is a r by r identity matrix,
by
* positioning the three matrices Ip, this and Iq along the diagonal.
* @param p the size of identity matrix Ip
@@ -322,31 +363,36 @@
*/
def diag (p: Int, q: Int) (implicit nu: Numeric [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invert this matrix (requires a squareMatrix). This version uses
partial
* pivoting.
*/
def inverse (implicit nu: Fractional [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invert inplace this matrix (requires a squareMatrix). This version
uses
* partial pivoting.
*/
def inverse_ip (implicit nu: Fractional [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use Guass-Jordan reduction on this matrix to make the left part
embed an
* identity matrix. A constraint on this m by n matrix is that n >= m.
*/
def reduce (implicit nu: Fractional [T]): Matrix [T]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use Guass-Jordan reduction inplace on this matrix to make the left
part
* embed an identity matrix. A constraint on this m by n matrix is
that n >= m.
*/
def reduce_ip (implicit nu: Fractional [T])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the (right) nullspace of this m by n matrix (requires n = m
+ 1)
* by performing Guass-Jordan reduction and extracting the negation of
the
* last column augmented by 1. The nullspace of matrix a is "this
vector v
@@ -360,7 +406,8 @@
reduce.col(dim2 - 1) * nu.negate (_1) ++ new VectorN (_1)
} // nullspace

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the (right) nullspace inplace of this m by n matrix
(requires n = m + 1)
* by performing Guass-Jordan reduction and extracting the negation of
the
* last column augmented by 1. The nullspace of matrix a is "this
vector v
@@ -375,7 +422,8 @@
col(dim2 - 1) * nu.negate (_1) ++ new VectorN (_1)
} // nullspace_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the trace of this matrix, i.e., the sum of the elements on
the
* main diagonal. Should also equal the sum of the eigenvalues.
* @see Eigen.scala
@@ -389,12 +437,14 @@
sum
} // trace

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the determinant of this matrix.
*/
def det (implicit nu: Numeric [T]): T

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix and the other Matrix have the same
dimensions.
* @param b the other matrix
*/
@@ -403,7 +453,8 @@
dim1 == b.dim1 && dim2 == b.dim2
} // sameDimensions

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix and the other matrix have the same cross
dimensions.
* @param b the other matrix
*/
@@ -412,13 +463,15 @@
dim2 == b.dim1
} // sameCrossDimensions

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is rectangular (all rows have the same
number
* of columns).
*/
def isRectangular: Boolean

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is square (same row and column
dimensions).
*/
def isSquare: Boolean =
@@ -426,7 +479,8 @@
dim1 == dim2 && isRectangular
} // isSquare

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is nonnegative (has no negative elements).
*/
def isNonnegative (implicit nu: Numeric [T]): Boolean =
@@ -436,7 +490,8 @@
true
} // isNonegative

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is symmetric.
*/
def isSymmetric: Boolean =
=======================================
--- /branches/devel/src/scalation/advmath/MatrixN.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/advmath/MatrixN.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Aug 26 18:41:26 EDT 2009
@@ -11,7 +12,8 @@
import scala.math.abs
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience definitions for commonly used types of matrices.
*/
object Matrices
@@ -29,7 +31,8 @@

} // Matrices object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The MatrixN class stores and operates on Numeric Matrices of various
sizes
* and types. The element type may be any subtype of Numeric.
* @param dim1 the first/row dimension
@@ -49,7 +52,8 @@
} // if
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a dim1 by dim1 square matrix.
* @param dim1 the row and column dimension
*/
@@ -58,7 +62,8 @@
this (dim1, dim1)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a dim1 by dim2 matrix and assign each element the value x.
* @param dim1 the row dimension
* @param dim2 the column dimesion
@@ -70,7 +75,8 @@
for (i <- range1; j <- range2) v(i)(j) = x
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a dim1 by dim1 square matrix with x assigned on the
diagonal
* and y assigned off the diagonal. To obtain an identity matrix, let
x = 1
* and y = 0.
@@ -84,7 +90,8 @@
for (i <- range1; j <- range1) v(i)(j) = if (i == j) x else y
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix and assign values from array of arrays u.
* @param u the 2D array of values to assign
*/
@@ -93,7 +100,8 @@
this (u.length, u(0).length, u) // invoke primary
constructor
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix from repeated values.
* @param dim1 the row dimension
* @param u the repeated values
@@ -104,7 +112,8 @@
for (i <- range1; j <- range2) v(i)(j) = u(i * dim2 + j)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix and assign values from array of vectors u.
* @param u the 2D array of values to assign
*/
@@ -114,7 +123,8 @@
for (i <- range1; j <- range2) v(i)(j) = u(i)(j)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix and assign values from matrix u.
* @param u the matrix of values to assign
*/
@@ -124,7 +134,8 @@
for (i <- range1; j <- range2) v(i)(j) = u.v(i)(j)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's element at the i,j-th index position.
* @param i the row index
* @param j the column index
@@ -134,7 +145,8 @@
v(i)(j)
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's vector at the i-th index position (i-th row).
* @param i the row index
*/
@@ -143,7 +155,8 @@
new VectorN [T] (v(i))
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's element at the i,j-th index position to the
scalar x.
* @param i the row index
* @param j the column index
@@ -154,7 +167,8 @@
v(i)(j) = x
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's row at the i-th index position to the vector u.
* @param i the row index
* @param u the vector value to assign
@@ -164,7 +178,8 @@
v(i) = u()
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix row-wise from to end.
* @param from the start row of the slice (inclusive)
* @param end the end row of the slice (exclusive)
@@ -174,7 +189,8 @@
MatrixN [T] (end - from, dim2, v.slice (from, end))
} // slice

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix row-wise r_from to r_end and column-wise c_from
to c_end.
* @param r_from the start of the row slice
* @param r_end the end of the row slice
@@ -188,7 +204,8 @@
c
} // slice

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix excluding the given row and column.
* @param row the row to exclude
* @param col the column to exclude
@@ -202,7 +219,8 @@
c
} // sliceExclude

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Transpose this matrix (rows => columns).
*/
def t: MatrixN [T] =
@@ -212,7 +230,8 @@
b
} // t

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
@@ -223,7 +242,8 @@
c
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
@@ -232,7 +252,8 @@
for (i <- range1; j <- range2) v(i)(j) = nu.plus (v(i)(j), b(i, j))
} // +=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and scalar s.
* @param s the scalar to add
*/
@@ -243,7 +264,8 @@
c
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and scalar s.
* @param s the scalar to add
*/
@@ -252,7 +274,8 @@
for (i <- range1; j <- range2) v(i)(j) = nu.plus (v(i)(j), s)
} // +=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
@@ -263,7 +286,8 @@
c
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract inplace matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
@@ -272,7 +296,8 @@
for (i <- range1; j <- range2) v(i)(j) = nu.minus (v(i)(j), b(i,
j))
} // -=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract scalar s.
* @param s the scalar to subtract
*/
@@ -283,7 +308,8 @@
c
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract inplace scalar s.
* @param s the scalar to subtract
*/
@@ -292,7 +318,8 @@
for (i <- range1; j <- range2) v(i)(j) = nu.minus (v(i)(j), s)
} // -=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by matrix b.
* @param b the matrix to multiply by (requires sameCrossDimensions)
*/
@@ -303,7 +330,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by matrix b.
* @param b the matrix to multiply by (requires sameCrossDimensions)
*/
@@ -312,7 +340,8 @@
for (i <- range1; j <- range2) v(i)(j) = row(i) dot b.col(j)
} // *=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b.
* @param b the vector to multiply by
*/
@@ -323,7 +352,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by scalar s.
* @param s the scalar to multiply by
*/
@@ -334,7 +364,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by scalar s.
* @param s the scalar to multiply by
*/
@@ -343,7 +374,8 @@
for (i <- range1; j <- range2) v(i)(j) = nu.times (v(i)(j), s)
} // *=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b to produce another matrix (a_ij *
b_j)
* @param b the vector to multiply by
*/
@@ -354,7 +386,8 @@
c
} // **

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by vector b to produce another matrix
(a_ij * b_j)
* @param b the vector to multiply by
*/
@@ -363,7 +396,8 @@
for (i <- range1; j <- range2) v(i)(j) = nu.times (v(i)(j), b(j))
} // **=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose this matrix into the product of upper and lower triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* no partial pivoting.
@@ -388,7 +422,8 @@
Tuple2 (l, u)
} // lud_npp

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose this matrix into the product of lower and upper triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* partial pivoting.
@@ -417,7 +452,8 @@
Tuple2 (l, u)
} // lud

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose inplace this matrix into the product of lower and upper
triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* partial pivoting.
@@ -446,7 +482,8 @@
Tuple2 (l, u)
} // lud_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use partial pivoting to find a maximal non-zero pivot and return
its row
* index, i.e., find the maximum element (k, i) below the pivot (i, i).
* @param a the matrix to perform partial pivoting on
@@ -465,7 +502,8 @@
kMax
} // partialPivoting

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Swap the elements in rows i and k starting from column col.
* @param a the matrix containing the rows to swap
* @param i the higher row (e.g., contains a zero pivot)
@@ -479,7 +517,8 @@
} // for
} // swap

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation l*u*x = b (see lud above).
* @param l the lower triangular matrix
* @param u the upper triangular matrix
@@ -505,7 +544,8 @@
x
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation l*u*x = b (see lud above).
* @param lu the lower and upper triangular matrices
* @param b the constant vector
@@ -516,7 +556,8 @@
solve (lu._1, lu._2, b)
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation a*x = b where a is this matrix (see lud
above).
* @param b the constant vector.
*/
@@ -526,7 +567,8 @@
solve (lud, b)
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Combine this matrix with matrix b, placing them along the diagonal
and
* filling in the bottom left and top right regions with zeroes;
[this, b].
* @param b the matrix to combine with this matrix
@@ -546,7 +588,8 @@
c
} // diag

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Form a matrix [Ip, this, Iq] where Ir is a r by r identity matrix,
by
* positioning the three matrices Ip, this and Iq along the diagonal.
* @param p the size of identity matrix Ip
@@ -566,7 +609,8 @@
c
} // diag

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invert this matrix (requires a squareMatrix). This version does
not use
* partial pivoting.
*/
@@ -594,7 +638,8 @@
c
} // inverse_npp

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invert this matrix (requires a squareMatrix). This version uses
partial
* pivoting.
*/
@@ -627,7 +672,8 @@
c
} // inverse

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invert inplace this matrix (requires a squareMatrix). This version
uses
* partial pivoting.
*/
@@ -660,7 +706,8 @@
c
} // inverse_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use Guass-Jordan reduction on this matrix to make the left part
embed an
* identity matrix. A constraint on this m by n matrix is that n >= m.
*/
@@ -689,7 +736,8 @@
b
} // reduce

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use Guass-Jordan reduction inplace on this matrix to make the left
part
* embed an identity matrix. A constraint on this m by n matrix is
that n >= m.
*/
@@ -717,7 +765,8 @@
} // for
} // reduce_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the determinant of this matrix.
*/
def det (implicit nu: Numeric [T]): T =
@@ -737,7 +786,8 @@
sum
} // det

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is rectangular (all rows have the same
number
* of columns).
*/
@@ -747,7 +797,8 @@
true
} // isRectangular

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this matrix to a string.
*/
override def toString: String =
@@ -762,7 +813,8 @@

} // MatrixN class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The MatrixN object tests the operations provided by MatrixN.
*/
object MatrixNTest extends Application
=======================================
--- /branches/devel/src/scalation/advmath/Random.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/advmath/Random.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Sep 30 18:41:26 EDT 2009
@@ -11,7 +12,8 @@
import scala.math._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class generates random real numbers in the range (0, 1).
* It is a Multiplicative Linear Congruential Generator (MLCG) shown to
have
* statictical properties adequate for simple simulations (x = ax & m).
@@ -78,22 +80,26 @@
*/
private val one_by_m: Double = 1. / m.asInstanceOf [Double]

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the mean for the random number generator's gen method.
*/
def mean: Double = 0.5

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the next random number as a Double in the interval (0, 1).
*/
def gen: Double = { x = a * x % m; x * one_by_m }

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the next stream value as a Long in the set {1, 2, ... , m-1}.
*/
def lgen: Long = { x = a * x % m; x }

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find and print out 100 (nStreams) seed values as a val declaration
that
* can be copied into a class to intialize the seeds (as done above).
*/
@@ -117,7 +123,8 @@

} // Random class

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class generates random real numbers in the range (0, 1).
* It uses scala's built-in random number generator.
* @param stream the random number stream index
@@ -130,7 +137,8 @@
} // Random class
*/

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Random Number Generator (RNG) object provides multiple pre-built
* random number streams.
*/
@@ -162,7 +170,8 @@

} // RNG object

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The SeedFinder object find seeds for all the random number streams.
*/
object SeedFinder extends Application
=======================================
--- /branches/devel/src/scalation/advmath/SparseMatrixN.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/advmath/SparseMatrixN.scala Wed Feb 9
13:41:57 2011
@@ -1,4 +1,5 @@
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sat May 22 15:24:17 EDT 2010
@@ -11,7 +12,8 @@
import scala.math.abs
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience definitions for commonly used types of matrices.
*/
object SparseMatrices
@@ -24,7 +26,8 @@

} // SparseMatrices object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The SparseMatrixN class stores and operates on Numeric Matrices of
various
* sizes and types. The element type may be any subtype of Numeric.
Rather
* than storing the matrix as a 2 dimensional array, it is stored as an
array
@@ -45,7 +48,8 @@
for (i <- range1) v(i) = new ListMap [Int, T] ()
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a dim1 by dim1 square matrix.
* @param dim1 the row and column dimension
* @param _0 the value zero for type T
@@ -55,7 +59,8 @@
this (dim1, dim1, _0) // invoke primary
constructor
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a dim1 by dim2 matrix and assign each element the value x.
* @param dim1 the row dimension
* @param dim2 the column dimesion
@@ -70,7 +75,8 @@
} // if
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a dim1 by dim1 square matrix with x assigned on the
diagonal
* and 0 assigned off the diagonal. To obtain an identity matrix, let
x = 1.
* @param dim1 the row and column dimension
@@ -85,7 +91,8 @@
} // if
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix and assign values from matrix u.
* @param u the matrix of values to assign
* @param _0 the value zero for type T
@@ -96,7 +103,8 @@
for (i <- range1; j <- range2) this(i, j) = u(i, j)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix and assign values from (MatrixN) matrix u.
* @param u the matrix of values to assign
* @param _0 the value zero for type T
@@ -107,7 +115,8 @@
for (i <- range1; j <- range2) this(i, j) = u(i, j)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a matrix and assign values from (SymmetricTridMatrixN)
matrix u.
* @param u the matrix of values to assign
* @param _0 the value zero for type T
@@ -126,7 +135,8 @@
this(dim1 - 1, dim1 - 1) = u.dg(dim1 - 1)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's element at the i,j-th index position.
* @param i the row index
* @param j the column index
@@ -142,7 +152,8 @@
v_ij
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's vector at the i-th index position (i-th row).
* @param i the row index
*/
@@ -159,7 +170,8 @@
new VectorN [T] (a)
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's element at the i,j-th index position to the
scalar x.
* Only store x if it is non-zero.
* @param i the row index
@@ -171,7 +183,8 @@
if (x != _0) v(i)(j) = x else v(i) -= j
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's row at the i-th index position to the vector u.
* @param i the row index
* @param u the vector value to assign
@@ -184,7 +197,8 @@
} // for
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix row-wise from to end.
* @param from the start row of the slice
* @param end the end row of the slice
@@ -196,7 +210,8 @@
c
} // slice

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix row-wise r_from to r_end and column-wise c_from
to c_end.
* @param r_from the start of the row slice
* @param r_end the end of the row slice
@@ -210,7 +225,8 @@
c
} // slice

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this matrix excluding the given row and column.
* @param row the row to exclude
* @param col the column to exclude
@@ -224,7 +240,8 @@
c
} // sliceExclude

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Transpose this matrix (rows => columns).
*/
def t: SparseMatrixN [T] =
@@ -234,7 +251,8 @@
b
} // t

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
@@ -245,7 +263,8 @@
c
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
@@ -254,7 +273,8 @@
for (i <- range1; j <- range2) this(i, j) = nu.plus (this(i, j),
b(i, j))
} // +=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and scalar s.
* @param s the scalar to add
*/
@@ -265,7 +285,8 @@
c
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and scalar s.
* @param s the scalar to add
*/
@@ -274,7 +295,8 @@
for (i <- range1; j <- range2) this(i, j) = nu.plus (this(i, j), s)
} // +=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
@@ -285,7 +307,8 @@
c
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract inplace matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
@@ -294,7 +317,8 @@
for (i <- range1; j <- range2) this(i, j) = nu.minus (this(i, j),
b(i, j))
} // -=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract scalar s.
* @param s the scalar to subtract
*/
@@ -305,7 +329,8 @@
c
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract inplace scalar s.
* @param s the scalar to subtract
*/
@@ -314,7 +339,8 @@
for (i <- range1; j <- range2) this(i, j) = nu.minus (this(i, j),
s)
} // -=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by matrix b.
* @param b the matrix to multiply by (requires sameCrossDimensions)
*/
@@ -325,7 +351,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by matrix b.
* @param b the matrix to multiply by (requires sameCrossDimensions)
*/
@@ -334,7 +361,8 @@
for (i <- range1; j <- range2) this(i, j) = row(i) dot b.col(j)
} // *=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b.
* @param b the vector to multiply by
*/
@@ -345,7 +373,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by scalar s.
* @param s the scalar to multiply by
*/
@@ -356,7 +385,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by scalar s.
* @param s the scalar to multiply by
*/
@@ -365,7 +395,8 @@
for (i <- range1; j <- range2) this(i, j) = nu.times (this(i, j),
s)
} // *=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b to produce another matrix (a_ij *
b_j)
* @param b the vector to multiply by
*/
@@ -376,7 +407,8 @@
c
} // **

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by vector b to produce another matrix
(a_ij * b_j)
* @param b the vector to multiply by
*/
@@ -385,7 +417,8 @@
for (i <- range1; j <- range2) this(i, j) = nu.times (this(i, j),
b(j))
} // **=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose this matrix into the product of lower and upper triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* partial pivoting.
@@ -414,7 +447,8 @@
Tuple2 (l, u)
} // lud

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Decompose inplace this matrix into the product of lower and upper
triangular
* matrices (l, u) using the LU Decomposition algorithm. This version
uses
* partial pivoting.
@@ -443,7 +477,8 @@
Tuple2 (l, u)
} // lud_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use partial pivoting to find a maximal non-zero pivot and return
its row
* index, i.e., find the maximum element (k, i) below the pivot (i, i).
* @param a the matrix to perform partial pivoting on
@@ -462,7 +497,8 @@
kMax
} // partialPivoting

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Swap the elements in rows i and k starting from column col.
* @param a the matrix containing the rows to swap
* @param i the higher row (e.g., contains a zero pivot)
@@ -476,7 +512,8 @@
} // for
} // swap

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation l*u*x = b (see lud above).
* @param l the lower triangular matrix
* @param u the upper triangular matrix
@@ -501,7 +538,8 @@
x
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation l*u*x = b (see lud above).
* @param lu the lower and upper triangular matrices
* @param b the constant vector
@@ -512,7 +550,8 @@
solve (lu._1, lu._2, b)
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation a*x = b where a is this matrix (see lud
above).
* @param b the constant vector.
*/
@@ -522,7 +561,8 @@
solve (lud, b)
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Combine this matrix with matrix b, placing them along the diagonal
and
* filling in the bottom left and top right regions with zeroes;
[this, b].
* @param b the matrix to combine with this matrix
@@ -541,7 +581,8 @@
c
} // diag

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Form a matrix [Ip, this, Iq] where Ir is a r by r identity matrix,
by
* positioning the three matrices Ip, this and Iq along the diagonal.
* @param p the size of identity matrix Ip
@@ -561,7 +602,8 @@
c
} // diag

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Inverse this matrix (requires a squareMatrix). This version uses
partial
* pivoting.
*/
@@ -594,7 +636,8 @@
c
} // inverse

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invert inplace this matrix (requires a squareMatrix). This version
uses
* partial pivoting.
*/
@@ -627,7 +670,8 @@
c
} // inverse_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use Guass-Jordan reduction on this matrix to make the left part
embed an
* identity matrix. A constraint on this m by n matrix is that n >= m.
*/
@@ -656,7 +700,8 @@
b
} // reduce

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use Guass-Jordan reduction inplace on this matrix to make the left
part
* embed an identity matrix. A constraint on this m by n matrix is
that n >= m.
*/
@@ -684,7 +729,8 @@
} // for
} // reduce_ip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the determinant of this matrix.
*/
def det (implicit nu: Numeric [T]): T =
@@ -705,13 +751,15 @@
sum
} // det

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is rectangular (all rows have the same
number
* of columns).
*/
def isRectangular: Boolean = true

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Show the non-zero elements in this sparse matrix.
*/
override def toString: String =
@@ -724,7 +772,8 @@
s.toString
} // toString

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Show all elements in this sparse matrix.
*/
def showAll
@@ -740,7 +789,8 @@

} // SparseMatrixN class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the SparseMatrixN class.
*/
object SparseMatrixNTest extends Application
=======================================
--- /branches/devel/src/scalation/advmath/SymmetricTridMatrixN.scala Fri
Feb 4 05:56:27 2011
+++ /branches/devel/src/scalation/advmath/SymmetricTridMatrixN.scala Wed
Feb 9 13:41:57 2011
@@ -1,4 +1,5 @@
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author Robert Davis, John Miller
* @version 1.0
* @date Thu Sep 16 22:17:43 EDT 2010
@@ -12,7 +13,8 @@
import scalation.advmath.Vectors._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The SymmetricTridiagonalMatrixN class stores and operates on symmetric
* tridiagonal matrices. The element may be of any subtype of Numeric.
* It is stored as two vectors, the diagonal and the sub-diagonal.
@@ -41,7 +43,8 @@
*/
private var _sd: VectorN [T] = new VectorN [T] (d1_1)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a symmetric tridiagonal matrix with the given diagonal
and sub-diagonal.
* @param v1 the diagonal vector
* @param v2 the sub-diagonal vector
@@ -53,7 +56,8 @@
for (i <- range_s) _sd(i) = v2(i)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a symmetric tridiagonal matrix from the given matrix.
* @param a the matrix of values to assign
*/
@@ -64,29 +68,34 @@
for (i <- range_s) _sd(i) = a(i, i + 1)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the diagonal of the matrix.
*/
def dg: VectorN [T] = _dg

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the diagonal of the matrix.
* @param v the vector to assign to the diagonal
*/
def dg_ (v: VectorN [T]) { _dg = v }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the sub-diagonal of the matrix.
*/
def sd: VectorN [T] = _sd

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the sub-diagonal of the matrix.
* @param v the vector to assign to the sub-diagonal
*/
def sd_ (v: VectorN [T]) { _sd = v }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's element at the i,j-th index position.
* @param i the row index
* @param j the column index
@@ -99,7 +108,8 @@
else throw new Exception ("apply: element not on tridiagonal")
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this matrix's vector at the i-th index position (i-th row).
* @param i the row index
*/
@@ -112,7 +122,8 @@
v
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's element at the i,j-th index position to the
scalar x.
* Only store x if it is non-zero.
* @param i the row index
@@ -127,7 +138,8 @@
else flaw ("update", "element not on tridiagonal")
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this matrix's row at the i-th index position to the vector u.
* @param i the row index
* @param u the vector value to assign
@@ -139,13 +151,15 @@
if (i < d1_1) _sd(i) = u(i + 1)
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Transpose this matrix (rows => columns). Note, since the matrix is
* symmetric, it returns itself.
*/
def t: SymmetricTridMatrixN [T] = this

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
@@ -160,7 +174,8 @@
} // if
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and matrix b.
* @param b the matrix to add (requires sameCrossDimensions)
*/
@@ -175,7 +190,8 @@
} // if
} // +=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this matrix and scalar s.
* @param s the scalar to add
*/
@@ -184,7 +200,8 @@
new SymmetricTridMatrixN [T] (_dg + s, _sd + s)
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add inplace this matrix and scalar s.
* @param s the scalar to add
*/
@@ -193,7 +210,8 @@
_dg += s; _sd += s
} // +=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
@@ -208,7 +226,8 @@
null
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix substract inplace matrix b.
* @param b the matrix to subtract (requires sameCrossDimensions)
*/
@@ -223,7 +242,8 @@
} // if
} // -=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract scalar s.
* @param s the scalar to subtract
*/
@@ -232,7 +252,8 @@
new SymmetricTridMatrixN [T] (_dg - s, _sd - s)
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this matrix subtract inplace scalar s.
* @param s the scalar to subtract
*/
@@ -241,7 +262,8 @@
_dg -= s; _sd-=s
} // -=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by vector b.
* @param b the vector to multiply by
*/
@@ -259,7 +281,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this matrix by scalar s.
* @param s the scalar to multiply by
*/
@@ -268,7 +291,8 @@
new SymmetricTridMatrixN [T] (_dg * s, _sd * s)
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply inplace this matrix by scalar s.
* @param s the scalar to multiply by
*/
@@ -277,13 +301,15 @@
_dg *= s; _sd *= s
} // *=

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this matrix is rectangular (all rows have the same
number
* of columns).
*/
def isRectangular: Boolean = true

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the determinant of this matrix.
*/
def det (implicit nu: Numeric [T]): T =
@@ -291,7 +317,8 @@
detHelper (d1 - 1)
} // det

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve for x in the equation a*x = d where a is this matrix
* @param d the constant vector.
*/
@@ -316,7 +343,8 @@
x
} // solve

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this symmetric tridiagonal matrix to a string.
*/
override def toString: String =
@@ -324,7 +352,8 @@
"\nSymmetricTridMatrixN(\t" + _dg + ", \n\t\t\t" + _sd + ")"
} // toString

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Helper method for computing the determinant of this matrix.
* @param n the current dimension
*/
@@ -428,7 +457,8 @@

} // SymmetricTridMatrixN class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the SymmetricTridMatrixN class.
*/
object SymmetricTridMatrixNTest extends Application
=======================================
--- /branches/devel/src/scalation/advmath/VectorN.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/advmath/VectorN.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Aug 26 18:41:26 EDT 2009
@@ -12,7 +13,8 @@
import scala.Numeric._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience definitions for commonly used types of vectors.
*/
object Vectors
@@ -28,7 +30,8 @@
type ArrayD = Array [Double]
type ArrayC = Array [Complex]

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Indicator function, returning 1 if i == j, 0 otherwise.
* @param i the first integer value (e.g., index)
* @param j the second integer value (e.g., index)
@@ -40,7 +43,8 @@

} // Vectors object

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The VectorN class stores and operates on Numeric Vectors of various
sizes
* and types. The element type may be any subtype of Numeric.
* @param dim the dimension/size of the vector
@@ -62,7 +66,8 @@
*/
private val range = 0 until dim

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a vector from an array of values.
* @param u the array of values
*/
@@ -71,7 +76,8 @@
this (u.length, u) // invoke primary
constructor
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a vector from repeated values.
* @param u the repeated values
*/
@@ -81,7 +87,8 @@
for (i <- range) v(i) = u(i)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a vector and assign values from vector u.
* @param u the other vector
*/
@@ -91,7 +98,8 @@
for (i <- range) v(i) = u(i)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a vector of the form (0, ... 1, ... 0) where the 1 is at
position j.
* @param j the position to place the 1
* @param size the size of the vector (upper bound = size - 1)
@@ -104,7 +112,8 @@
u
} // one

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a vector consisting of values 0, 1, 2, ..., size - 1.
* @param size the size of the vector (upper bound = size - 1)
*/
@@ -116,7 +125,8 @@
u
} // increasing

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert a VectorN [T] into a VectorN [Int].
* @param u the vector to convert an integer vector
*/
@@ -127,7 +137,8 @@
u
} // toDouble

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert a VectorN [T] into a VectorN [Double].
* @param u the vector to convert a double vector
*/
@@ -138,7 +149,8 @@
u
} // toDouble

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this vector's element at the i-th index position.
* @param i the index
*/
@@ -147,7 +159,8 @@
v(i)
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get this vector's entire array.
*/
def apply (): Array [T] =
@@ -155,7 +168,8 @@
v
} // apply

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set this vector's element at the i-th index position.
* @param i the index
* @param x the value to assign
@@ -165,7 +179,8 @@
v(i) = x
} // update

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set each value in this vector to x.
* @param x the value to be assigned
*/
@@ -174,7 +189,8 @@
for (i <- range) v(i) = x
} // set

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the values in this vector to the values in array u.
* @param u the array of values to be assigned
*/
@@ -183,7 +199,8 @@
for (i <- range) v(i) = u(i)
} // setAll

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Iterate over the vector element by element.
* @param f the function to apply
*/
@@ -196,7 +213,8 @@
} // while
} // foreach

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Slice this vector from to end.
* @param from the start of the slice
* @param end the end of the slice
@@ -206,7 +224,8 @@
VectorN [T] (end - from, v.slice (from, end))
} // slice

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Concatenate this vector and vector b.
* @param b the vector to concatenated
*/
@@ -217,7 +236,8 @@
c
} // ++

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this vector and vector b.
* @param b the vector to add
*/
@@ -228,7 +248,8 @@
c
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add this vector and scalar s.
* @param s the scalar to add
*/
@@ -239,7 +260,8 @@
c
} // +

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this vector substract vector b.
* @param b the vector to subtract
*/
@@ -250,7 +272,8 @@
c
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* From this vector subtract scalar s.
* @param s the scalar to subtract
*/
@@ -261,7 +284,8 @@
c
} // -

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this vector by scalar s.
* @param s the scalar to multiply by
*/
@@ -272,7 +296,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this vector by vector b.
* @param b the vector to multiply by
*/
@@ -283,7 +308,8 @@
c
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Multiply this 'row' vector by matrix m.
* @param m the matrix to multiply by
*/
@@ -292,7 +318,8 @@
m.t * this
} // *

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Divide this vector by vector b (element-by-element).
* @param b the vector to divide by
*/
@@ -303,7 +330,8 @@
c
} // /

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Divide this vector by scalar s.
* @param s the scalar to divide by
*/
@@ -314,7 +342,8 @@
c
} // /

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Sum the elements of this vector.
*/
def sum (implicit nu: Numeric [T]): T =
@@ -323,7 +352,8 @@
v.foldLeft (_0) (nu.plus (_, _))
} // sum

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Sum the elements of this vector skipping the ith element.
* @param i the index of the element to skip
*/
@@ -335,7 +365,8 @@
s
} // sum_ne

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Cummulate the values of this vector from left to right (e.g.,
create a
* cdf from a pmf).
*/
@@ -347,7 +378,8 @@
b
} // cummulate

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Normalize this vector so that it sums to one (e.g., for a
probability
* vector).
*/
@@ -357,7 +389,8 @@
this * (nu.div (_1, sum))
} // normalize

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the dot product (or inner product) of this vector with
vector b.
* @param b the other vector
*/
@@ -369,7 +402,8 @@
x
} // dot

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the outer product of this vector with vector b.
* @param b the other vector
*/
@@ -380,7 +414,8 @@
c
} // outer

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the Euclidean norm (2-norm) squared of this vector. If of
the
* appropriate type (see below), the sqrt may be used to compute the
actual
* norm.
@@ -390,7 +425,8 @@
this dot this
} // norm2

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the Euclidean norm (2-norm) of this vector.
*/
def norm (implicit nu: Fractional [T]): Double =
@@ -398,7 +434,8 @@
sqrt ((norm2 (nu)).asInstanceOf [Double])
} // norm

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Take the minimum of this vector with vector b (element-by element).
* @param b the other vector
*/
@@ -409,7 +446,8 @@
c
} // min

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Take the maximum of this vector with vector b (element-by element).
* @param b the other vector
*/
@@ -420,7 +458,8 @@
c
} // max

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the minimum in this vector.
*/
def min: T =
@@ -430,7 +469,8 @@
x
} // min

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the minimum in this vector starting from element k.
* @param k the starting point for finding the min
*/
@@ -441,7 +481,8 @@
x
} // min

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the minimum in this vector starting from element k.
*/
def max: T =
@@ -451,7 +492,8 @@
x
} // max

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the maximum in this vector starting from element k.
* @param k the starting point for finding the max
*/
@@ -462,7 +504,8 @@
x
} // max

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the argument minimum in this vector starting from element k.
* @param k the starting point for finding the min
* @param l skip this element
@@ -474,7 +517,8 @@
j
} // argmin

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the argument minimum in this vector starting from element k and
* return it if it is negative, otherwise return -1.
* @param k the starting point for finding the max
@@ -487,7 +531,8 @@
if (v(j) < _0) j else -1
} // argmaxPos

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the argument maximum in this vector starting from element k.
* @param k the starting point for finding the max
* @param l skip this element
@@ -499,7 +544,8 @@
j
} // argmax

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the argument maximum in this vector starting from element k and
* return it if it is positive, otherwise return -1.
* @param k the starting point for finding the max
@@ -512,7 +558,8 @@
if (v(j) > _0) j else -1
} // argmaxPos

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the index of the first negative element in this vector
starting from
* element k.
* @param k the starting point for finding first negative element
@@ -524,7 +571,8 @@
-1
} // firstNeg

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the index of the first positive element in this vector
starting from
* element k.
* @param k the starting point for finding first positive element
@@ -536,7 +584,8 @@
-1
} // firstPos

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether the other vector is at least as long as this vector.
* @param b the other vector
*/
@@ -545,7 +594,8 @@
dim <= b.dim
} // sameDimensions

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check whether this vector is nonnegative (has no negative elements).
*/
def isNonnegative (implicit nu: Numeric [T]): Boolean =
@@ -555,7 +605,8 @@
true
} // isNonnegative

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compare this vector with vector b.
* @param b the other vector
*/
@@ -572,7 +623,8 @@
if (ge && le) Some (0) else if (le) Some (-1) else if (ge) Some
(1) else None
} // tryCompareTo

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert type B to type VectorN [T].
*/
implicit def BtoVectorN [B >: VectorN [T]] (b: B): VectorN [T] =
@@ -580,7 +632,8 @@
b.asInstanceOf [VectorN [T]]
} // BtoVectorN

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this vector to a string.
*/
override def toString: String =
@@ -590,7 +643,8 @@

} // VectorN class

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The VectorNTest object tests the operations provided by VectorN.
*/
object VectorNTest extends Application
=======================================
--- /branches/devel/src/scalation/animation/AnimateCommand.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/animation/AnimateCommand.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 21 15:05:06 EDT 2009
@@ -11,7 +12,8 @@
import scalation.scala2d.Colors._
import scalation.scala2d.Shapes._

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class implements a message which is passed from a simulation
engine to
* the animation engine. A message specifies one of the commands defined
in
* the Animator interface.
@@ -38,7 +40,8 @@
val TimeDilation = Value ("TimeDilation")
} // CommandType object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class provides a template for animation commands.
* @param action the animation action to perform
* @param eid the external id for the component acted upon
@@ -55,14 +58,16 @@
primary: Boolean, color: Color, pts: Array
[Double], time: Double,
from_eid: Int = -1, to_eid: Int = -1)
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* This method compares two AnimateCommand objects to see which one has
* the most recent timestamp.
* @param command2 the AnimateCommand to compare this to
*/
def compare (command2: AnimateCommand) = time compare command2.time

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Show the elements of the array and handle the null case.
* @param array the array to be shown
*/
@@ -71,7 +76,8 @@
if (array == null) "Array ( null )" else array.deep
} // show

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the command to a string representation useful to
printing/debugging.
* @return String the string representation for this AnimateCommand
*/
=======================================
--- /branches/devel/src/scalation/animation/Animator.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/animation/Animator.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 14 14:15:51 EDT 2009
@@ -17,7 +18,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class implements the commands to create, destroy, move and scale
* components (nodes, edges or tokens) in an animated graph.
* @param graph the directed graph to be animated
@@ -44,12 +46,14 @@
*/
private var numLost = 0

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the time dilation factor.
*/
def timeDilationFactor = _timeDilationFactor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a node at the given location.
* @param eid the external id for the node
* @param shape the shape of the node
@@ -75,7 +79,8 @@
nodeMap.put (eid, node)
} // createNode

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create an edge at the given location.
* @param eid the external id for the edge
* @param shape the shape (curve) of the edge
@@ -126,7 +131,8 @@
edgeMap.put (eid, edge) // keep track of the edge in the edge map
} // createEdge

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a token at the given location.
* @param eid the external id for the token
* @param shape the shape of the token
@@ -185,7 +191,8 @@
tokenMap.put (eid, token)
} // createToken

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Destroy the node with the given id.
* @param eid the node's external id
*/
@@ -202,7 +209,8 @@
nodeMap.remove (eid)
} // destroyNode

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Destroy the edge with the given id.
* @param eid the edges's external id
*/
@@ -219,7 +227,8 @@
edgeMap.remove (eid)
} // destroyEdge

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Destroy the token with the given id.
* @param eid the token's external id
*/
@@ -247,7 +256,8 @@
tokenMap.remove (eid)
} // destroyToken

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the node to a new (x, y) location.
* Edges cannot be moved directly, but must adjust to node movements.
* @param eid the external id of the node to move
@@ -265,7 +275,8 @@
} // if
} // moveNode

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the token to a new (x, y) location.
* @param eid the external id of the token to move
* @param pts the new x, y -coordinates
@@ -283,7 +294,8 @@
} // if
} // moveToken

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the token onto the new node.
* @param eid the external id of the token to move
* @param node_eid the external id of the node to move onto
@@ -294,7 +306,8 @@
moveGivenToken2Node (token, node_eid)
} // moveToken2Node

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the given token onto the new node.
* @param token the token to move
* @param node_eid the external id of the node to move onto
@@ -334,7 +347,8 @@
} // if
} // moveGivenToken2Node

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move 'number' tokens of color 'color' from node 'from_eid' to
node 'to_eid'.
* @param color the color of the tokens to move
* @param from_eid the external id of the node tokens are to be taken
from
@@ -372,7 +386,8 @@
} // if
} // moveTokens2Node

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Adjust the locations of all tokens on a node.
* @param tokens the tokens to adjust
* @param xcN the x-center of containing node
@@ -396,7 +411,8 @@
} // for
} // adjustTokenLocations

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the token along the curve for an edge and return false if at
end of
* curve.
* @param eid the external id for the token to move
@@ -424,7 +440,8 @@
return false // exhausted the curve
} // moveToken2Edge

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Scale the node, i.e., make it larger or smaller.
* Edges cannot be scaled directly, but must adjust to node scalings.
* @param eid the external id of the node to scale
@@ -442,7 +459,8 @@
} // if
} // scaleNode

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Scale the token, i.e., make it larger or smaller.
* @param eid the external id of the token to scale
* @param pts the new width, height dimensions
@@ -458,7 +476,8 @@
} // if
} // scaleToken

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move 'amount' tokens/fluids of color 'color' from node 'from_eid'
to node
* 'to_eid' by increasing the size of tokens at 'to_eid' while
decreasing
* the size at 'from_eid'.
@@ -485,7 +504,8 @@
} // if
} // scaleTokensAt

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* For a given node, look for tokens/fluids by color to
increase/decrease
* the fluids by the change amount.
* @param tokens the list of tokens/fluids to search
@@ -519,7 +539,8 @@
} // if
} // scaleGivenToken

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the paint color for the node.
* @param eid the external id for node to paint
* @param color the new color for the node
@@ -535,7 +556,8 @@
} // if
} // setPaintNode

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the paint color for the edge.
* @param eid the external id for node to paint
* @param color the new color for the node
@@ -551,7 +573,8 @@
} // if
} // setPaintEdge

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the paint color for the token.
* @param eid the external id for node to paint
* @param color the new color for the node
@@ -567,7 +590,8 @@
} // if
} // setPaintToken

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Adjust the time dilation: >1 slows down animation, <1 speeds up
animation.
* @param pts one dimesional array containing the new time dilation
factor
*/
@@ -582,7 +606,8 @@

} // Animator class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to provide unique identifiers for internally created
* tokens/fluids.
*/
=======================================
--- /branches/devel/src/scalation/animation/DgAnimator.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/animation/DgAnimator.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 14 14:15:51 EDT 2009
@@ -19,7 +20,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is an animation engine for animating graphs.
* For example, it can animate bipartite graphs to animate Petri Nets.
* @param title the title for the display frame
@@ -52,7 +54,8 @@
*/
private val cmdQ = new SynchronizedQueue [AnimateCommand] ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* The canvas Panel is used to place shapes in the drawing region.
*/
val canvas = new Panel
@@ -60,7 +63,8 @@
background = bgColor
preferredSize = frameSize

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Paint the display panel component.
* @param g2d the high-resolution Graphics context
*/
@@ -120,7 +124,8 @@
visible = true
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Invoke the animation command.
* @param c the animation command to invoke
*/
@@ -171,7 +176,8 @@
} // match
} // invokeCommand

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Repeatedly execute animation commands, sleep and repaint.
*/
def act ()
@@ -210,7 +216,8 @@
println ("DgAnimator.act: end animation at time " + clock)
} // act

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Start the animation by staring the animation actor.
* @param tStart the animation start time
* @param tStop the animation stop time
@@ -222,19 +229,22 @@
start ()
} // startAnimation

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the animation command queue.
*/
def getCommandQueue = cmdQ

} // DgAnimator class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The DgAnimatorTest object is used to test the DgAnimator class.
*/
object DgAnimatorTest extends Application
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Sample method for loading the shared command queue.
* Ordinarily these commands would come from some simulation engine.
* @param cq the animation command queue
=======================================
--- /branches/devel/src/scalation/animation/Dgraph.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/animation/Dgraph.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 21 15:05:06 EDT 2009
@@ -17,7 +18,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is for defining graph structures suitable for animation.
Graphs
* consist of nodes, edges and tokens. Tokens can be positioned within
nodes or
* on edges. A graph animation class that uses this class would typically
move
@@ -34,7 +36,8 @@
class Dgraph (name: String = "Dgraph", bipartite: Boolean = false)
extends Error
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* This class is used to represent nodes in the graph.
* @param shape the shape of the node
* @param label the label for the created node
@@ -64,13 +67,15 @@
*/
val tokens = ListBuffer [Token] ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the color.
* @param color the new color
*/
def setColor (color2: Color) { color = color2 }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add an outgoing edge to this node.
* @param edge the edge to add
*/
@@ -84,32 +89,37 @@
true
} // addEdge

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Remove an outgoing edge from this node.
* @param edge the edge to remove
*/
def removeEdge (edge: Edge) { outEdges -= edge }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add a token from this node.
* @param token the token to add
*/
def addToken (token: Token) { tokens += token }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Remove a token from this node.
* @param token the token to remove
*/
def removeToken (token: Token) { tokens -= token }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this node to a string.
*/
override def toString = "Node " + label + " [ " + id + " ]"

} // Node class

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* This class is used to represent edges in the graph. If bend = 0, a
* straight line is created, otherwise a quadratic curve is created.
* @param shape the shape (line/curve) of the edge
@@ -163,7 +173,8 @@
this (shape, label, primary, color, from, to, 0.)
} // Edge constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct an edge as a line with explicit coordinates.
* @param shape the shape (line) of the edge
* @param label the label for the created edge
@@ -184,7 +195,8 @@
shape.setLine (R2 (x1, y1), R2 (x2, y2))
} // Edge constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct an edge as a curve with explicit coordinates.
* @param shape the shape (curve) of the edge
* @param label the label for the created edge
@@ -207,26 +219,30 @@
shape.setLine (R2 (x1, y1), R2 (xc, yc), R2 (x2, y2))
} // Edge constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the color.
* @param color the new color
*/
def setColor (color2: Color) { color = color2 }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add a token from this node.
* @param token the token to add
*/
def addToken (token: Token) { tokens += token }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this edge to a string.
*/
override def toString = "Edge " + label + " [ " + id + " ]"

} // Edge class

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* This class is used to represent tokens in the graph.
* @param shape the shape of the token
* @param label the label for the created token
@@ -252,7 +268,8 @@
*/
private val id = nextT ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a primary/free token with explicit coordinates.
* Such tokens are free to move anywhere in the drawing panel.
* @param shape the shape of the token
@@ -270,13 +287,15 @@
shape.setFrame (x, y, w, h)
} // Token constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the color.
* @param color the new color
*/
def setColor (color2: Color) { color = color2 }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the node the token is on.
* @param onNode2 the node the token is on
*/
@@ -300,43 +319,50 @@
*/
private val visited = new HashSet [Node] ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add a node to the graph.
* @param n the node to add
*/
def addNode (n: Node) { nodes += n }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Remove a node from the graph.
* @param n the node to remove
*/
def removeNode (n: Node) { nodes -= n }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add an edge to the graph.
* @param e the edge to add
*/
def addEdge (e: Edge) { edges += e }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Remove an edge from the graph.
* @param e the edge to remove
*/
def removeEdge (e: Edge) { edges -= e }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add a free token to the graph.
* @param t the free token to add
*/
def addFreeToken (t: Token) { freeTokens += t }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Remove a free token from the graph.
* @param t the free token to remove
*/
def removeFreeToken (t: Token) { freeTokens -= t }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get all the root nodes (those with no incoming edges).
*/
def getRoots =
@@ -352,12 +378,14 @@
roots
} // getRoots

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Mark all nodes as unvisited by clearing them from the hash set.
*/
private def clearVisited () { visited.clear () }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Recursively visit all nodes in the graph.
* @param n the current node
* @param level the recursion level
@@ -377,7 +405,8 @@
} // if
} // traverse

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Traverse the graph printing out its nodes and showing connectivity
by indentation.
*/
def traverseNodes ()
@@ -389,7 +418,8 @@

} // Dgraph class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Object to maintain counters.
*/
object Counter
@@ -404,12 +434,14 @@

} // Counter object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Object to test the Dgraph class.
*/
object DgraphTest extends Application
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Build and test a directed graph.
*/
private def testDirectedGraph (g: Dgraph)
@@ -444,7 +476,8 @@
g.traverseNodes ()
} // testDirectedGraph

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Build and test a bipartite graph.
*/
private def testBipartiteGraph (g: Dgraph)
=======================================
--- /branches/devel/src/scalation/dynamics/DormandPrince.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/dynamics/DormandPrince.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Mar 29 14:59:50 EDT 2010
@@ -14,7 +15,8 @@
import scalation.advmath.Vectors._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Given an unknown, time-dependent function y(t) governed by an Ordinary
* Differential Equation (ODE) of the form y(t)' = f(t, y) where ' is d/dt,
* compute y(t) using a (4,5)-order Dormand-Prince integrator. Note: the
@@ -62,7 +64,8 @@
def integrate (f: Derivative, y0: Double, t: Double,
t0: Double = 0., _step: Double = defaultStepSize):
Double = 0.

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute y(t) governed by a differential equation using numerical
integration
* of the derivative function f(t, y) using a 5th-order Dormand-Prince
method to
* return the value of y(t) at time t.
@@ -125,7 +128,8 @@

} // DormandPrince object

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the DormandPrince object.
*/
object DormandPrinceTest extends Application
=======================================
--- /branches/devel/src/scalation/dynamics/Integrator.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/dynamics/Integrator.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sat Jan 30 13:19:22 EST 2010
@@ -13,7 +14,8 @@
import scalation.advmath.Vectors._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This trait provides a template for writing numerical integrators (e.g.,
Runge
* Kutta) to produce trajectories for first-order Ordinary Differential
Equations
* (ODE's). The ODE is of the form y(t)' = f(t, y) where ' is d/dt. Its
initial
@@ -41,7 +43,8 @@
*/
protected var error = 0.

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Use numerical integration to compute the trajectory of an unknown,
time-
* dependent function y(t) governed by a first-order ODE of the form
y(t)' = f(t, y),
* i.e., the time derivative of y(t) equals f(t, y). The derivative
function
@@ -56,7 +59,8 @@
def integrate (f: Derivative, y0: Double, t: Double,
t0: Double = 0., _step: Double = defaultStepSize):
Double

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Apply the integrate method to each derivative to compute the
trajectory of
* a time-dependent vector function y(t) governed by a system of
Ordinary
* Differential Equations (ODE's) where f(t, y) is an array of
derivative functions.
@@ -80,7 +84,8 @@
} // if
} // integrateV

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the error estimate.
*/
def getError: Double = error
=======================================
--- /branches/devel/src/scalation/dynamics/LinearDiffEq.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/dynamics/LinearDiffEq.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Fri Jan 29 18:36:48 EST 2010
@@ -14,7 +15,8 @@
import scalation.advmath.Vectors._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class may be used for solving a system of linear differential
equations
* that are ordinary and first-order with constant coefficients of the form
* y(t)' = a * y(t) where ' is d/dt, y(t) is the vector function of time
and a is
@@ -50,7 +52,8 @@
*/
private val k = v ** c

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Apply the exponential 'exp' function to each element of a vector.
* @param v the vector to apply the exp function to
*/
@@ -61,13 +64,15 @@
z
} // expV

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Evaluate the solution for y(t) at time t.
* @param t the time point
*/
def eval (t: Double): VectorD = k * expV (e * t)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Print the solution to the differential equation.
*/
def print
@@ -87,7 +92,8 @@
} // LinearDiffEq class


-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Object to test the LinearDiffEq class using example at
* @see biomed.tamu.edu/faculty/wu/BMEN_452/Eigenvalue%20Problems.doc
* The eigenvalues should be (-3, -1)
=======================================
--- /branches/devel/src/scalation/dynamics/RungeKutta.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/dynamics/RungeKutta.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Oct 25 18:41:26 EDT 2009
@@ -13,7 +14,8 @@
import scalation.advmath.Vectors._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Given an unknown, time-dependent function y(t) governed by an Ordinary
* Differential Equation (ODE) of the form y(t)' = f(t, y) where ' is d/dt,
* compute y(t) using a 4th-order Runge-Kutta integrator. Note: the
integrateV
@@ -22,7 +24,8 @@
object RungeKutta
extends Integrator
{
-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute y(t) governed by a differential equation using numerical
integration
* of the derivative function f(t, y) using a 4th-order Runge-Kutta
method to
* return the value of y(t) at time t.
@@ -66,7 +69,8 @@

} // RungeKutta object

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the RungeKutta object.
*/
object RungeKuttaTest extends Application
=======================================
--- /branches/devel/src/scalation/event/CausalLink.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/event/CausalLink.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Dec 6 15:05:06 EDT 2009
@@ -16,7 +17,8 @@
import scalation.scala2d.Colors._
import scalation.util.Identity

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class provides casual links between events. After an event has
updated
* the state, it checks its causal links to schedule/cancel other events.
* @param _name the name of the causal link
@@ -45,7 +47,8 @@
setName (name)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this CausalLink.
* @param from the starting event prototype
* @param to the ending event prototype
@@ -59,30 +62,35 @@
} // if
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tally the duration (e.g., service time) of a delay on a causal link.
* @param duration the time duration
*/
def tally (duration: Double) { _durationStat.tally (duration) }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Accumulate the a value (e.g., number in queue) weighted by its
time duration.
* @param value the value to accumulate
* @param time the current time of the observation
*/
def accumulate (value: Double, time: Double) {
_persistentStat.accumulate (value, time) }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Sample statistics for durations for the component.
*/
def durationStat = _durationStat

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Persistent statistics for value for the component.
*/
def persistentStat = _persistentStat

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the causal link to a string.
*/
override def toString = "CausalLink ( " + getClass.getSimpleName ()
+ ", " + name + ", " + cancel + " )"
=======================================
--- /branches/devel/src/scalation/event/Entity.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/event/Entity.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Nov 15 15:05:06 EDT 2009
@@ -10,7 +11,8 @@

import scalation.util.Identity

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class represents a single simulation entity for event-scheduling
* simulation.
* @param creationTime the time at which the entity is created
@@ -23,7 +25,8 @@
setName (name)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the entity to a string
*/
override def toString = "Entity ( " + me + " created at " +
creationTime + " )"
=======================================
--- /branches/devel/src/scalation/event/Event.scala Fri Feb 4 05:56:27 2011
+++ /branches/devel/src/scalation/event/Event.scala Wed Feb 9 13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Nov 15 15:05:06 EDT 2009
@@ -14,7 +15,8 @@
import scalation.scala2d.Colors._
import scalation.util.PQItem

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class provides facilities for defining simulation events.
Subclasses of
* of Event provide event-logic in their implementation of the occur
method.
* Note: unique identification and the event/activation time (actTime) are
mixed
@@ -33,7 +35,8 @@
if (proto == null) display () // the prototype event does not
have a prototype
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Execute the event where the event-logic is specified as follows:
* (i) Each model will define causal links that connect events. One
event
* may schedule other events, depending upon whether the respective
@@ -52,7 +55,8 @@
} // for
} // occur

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this Event as a node.
*/
def display ()
@@ -60,7 +64,8 @@
director.animate (this, CreateNode, blue, Ellipse (), at)
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this node's outgoing
CausalLink's as edges.
* @param outLinks this nodes outgoing casual links
*/
@@ -69,7 +74,8 @@
for (l <- outLinks) l.display (this, l.causedEvent)
} // displayLinks

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert the event to a string.
*/
override def toString = "Event ( " + getClass.getSimpleName () + ", "
+ me + ", " + entity + " )"
=======================================
--- /branches/devel/src/scalation/event/Model.scala Fri Feb 4 05:56:27 2011
+++ /branches/devel/src/scalation/event/Model.scala Wed Feb 9 13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Nov 15 15:05:06 EDT 2009
@@ -16,7 +17,8 @@
import scalation.scala2d.Shapes._
import scalation.util.{Identity, Monitor, PQItem, PQueue}

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class schedules events and implements the time advance mechanism
for
* simulation model following the event-scheduling world view.
*/
@@ -48,7 +50,8 @@
*/
private val aniQ = dgAni.getCommandQueue

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Place an event on the Future Event List (FEL) for later execution,
thus
* scheduling the event to occur sometime in the future. Events are
ordered
* by their event/act time.
@@ -63,7 +66,8 @@
"ev" + event.id, false, black, null, _clock, event.proto.id)
} // schedule

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Remove an event from the Future Event List (FEL) before it occurs,
thus
* cancelling the event.
* @param event the event to cancel
@@ -73,7 +77,8 @@
if (! (eventList -= event)) flaw ("cancel", "unable to cancel
event " + event)
} // cancel

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Run the simulation by iteratively processing events in time order.
* @param startTime the time at which the simulation is to begin
* @param firstEvent the first event is used to prime the simulation
@@ -99,7 +104,8 @@

} // simulate

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Report on the statistical results of the simulation for a given
type of
* event.
* @param eventType the type of event (e.g., Arrival, Departure)
@@ -119,7 +125,8 @@
} // if
} // report

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Report on the statistical results of the simulation for the overall
model.
* @param vars the result/output variables for the simulation
*/
@@ -131,7 +138,8 @@
} // for
} // report

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Put a node/token command on the animation queue.
* @param who who is being animated
* @param what what animation command
@@ -150,7 +158,8 @@
} // if
} // animate

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Put a edge command on the animation queue.
* @param who who is being animated
* @param what what animation command
@@ -174,14 +183,16 @@

} // Model class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Model class.
*/
object ModelTest extends Application
{
new SimpleModel ("phone", Uniform (5000, 7000), 100, Uniform (4000,
6000))

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* This class models a simple phone simulation.
* @param name the name of the simulation model
* @param arrivalDist the inter-arrival time distribution
@@ -212,7 +223,8 @@

protoArrival.displayLinks (aLinks)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a subclass of Event for Arrival events.
* @param call the entity that arrives, in this case a phone call
*/
@@ -229,7 +241,8 @@

} // Arrival class

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a subclass of Event for Departure events.
* @param call the entity that departs, in this case a phone call
*/
=======================================
--- /branches/devel/src/scalation/optimization/RevisedSimplex.scala Fri
Feb 4 05:56:27 2011
+++ /branches/devel/src/scalation/optimization/RevisedSimplex.scala Wed
Feb 9 13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 0.1
* @date Sun Sep 26 15:20:15 EDT 2010
@@ -12,7 +13,8 @@
import scalation.advmath.Matrices._
import scalation.advmath.Vectors._

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class solves Linear Programming (LP) problems using the Revised
Simplex
* Algorithm. Given a constraint matrix a, constant vector b and cost
vector c,
* find values for the solution/decision vector x that maximize the
objective
@@ -30,7 +32,8 @@
*/
private val EPSILON = 1E-10

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Solve a Linear Programming (LP) problem using the Revised Simplex
Algorithm.
*/
def solve: Tuple2 [Double, VectorD] =
@@ -38,7 +41,8 @@
null // not implemented yet
} // solve

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert this object to a string containing the tableau.
*/
override def toString: String =
@@ -49,7 +53,8 @@
} // RevisedSimplex class


-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Test the Revised Simplex Algorithm class with the following
maximization problem:
* Maximize z = 2x_0 + 3x_1 + 4x_2
* Subject to 3x_0 + 2x_1 + 1x_2 + 1y_3 + 0y_4 = 10
=======================================
--- /branches/devel/src/scalation/optimization/Simplex.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/optimization/Simplex.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* Translated from Java code in Algorithms, 4th Edition, Robert Sedgewick
and Kevin Wayne
* @version 1.0
@@ -15,7 +16,8 @@
import scalation.advmath.Matrices._
import scalation.advmath.Vectors._

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class solves Linear Programming (LP) problems using the Simplex
Algorithm.
* Given an constraint matrix a, constant vector b and cost vector c, find
values
* for the solution/decision vector x that maximize the objective function
z,
@@ -65,7 +67,8 @@
private val basis = new VectorI (M, null)
for (i <- 0 until M) basis(i) = N + i // start with the slack
variables in the basis

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Run the simplex algorithm starting from the initial BFS and
iteratively
* find a non-basic variable to replace a variable in the current basis
* so long as the objective improves.
@@ -91,7 +94,8 @@
} // while
} // solve

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Find the leaving variable (row) p using Min-ratio rule (-1 if no
such row).
* @param q the entering variable (column)
*/
@@ -105,7 +109,8 @@
p
} // minRatioRule

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Pivot on entry (p, q) using Gauss-Jordan elimination.
* @param p the leaving variable (row)
* @param q the entering variable (column)
@@ -124,12 +129,14 @@
t(p, q) = 1.0
} // pivot

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the tableau (t).
*/
def tableau: MatrixD = t

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the primal solution vector (x).
*/
def primal: VectorD =
@@ -139,7 +146,8 @@
x
} // primal

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the dual solution vector (y).
*/
def dual: VectorD =
@@ -149,17 +157,20 @@
y
} // dual

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the optimal objective value (z).
*/
def value: Double = -t(M, M + N)

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check for feasibility and optimality.
*/
def check: Boolean = isPrimalFeasible && isDualFeasible && isOptimal

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Is the solution primal feasible?
*/
private def isPrimalFeasible: Boolean =
@@ -178,7 +189,8 @@
return false
} // isPrimalFeasible

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Is the solution dual feasible?
*/
private def isDualFeasible: Boolean =
@@ -197,7 +209,8 @@
false
} // isDualFeasible

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Check that the optimal value z = c x = y b.
*/
private def isOptimal: Boolean =
@@ -220,12 +233,14 @@
} // Simplex class


-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Simplex class.
*/
object SimplexTest extends Application
{
-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Test the Simplex Algorithm for solving Linear Programs:
* max { c x | a x <= b, x >= 0 }.
* @param a the constraint matrix
@@ -243,7 +258,8 @@
println ("objective value z = " + lp.value)
} // test

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Test case 1: solution x = (9, 9, 4), z = 22.
*/
def test1 ()
@@ -258,7 +274,8 @@
test (a, b, c)
} // test1

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Test case 2: solution x = (12, 28), z = 800.
*/
def test2 ()
@@ -271,7 +288,8 @@
test (a, b, c)
} // test2

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Test case 3: solution x = (1, 0, 1, 0), z = 1.
* Cycles if you choose most positive objective function coefficient.
*/
@@ -285,7 +303,8 @@
test (a, b, c)
} // test3

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Test case 4: no solution LP is unbounded.
*/
def test4 ()
=======================================
--- /branches/devel/src/scalation/process/Component.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/process/Component.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -11,7 +12,8 @@
import scalation.stat.{Statistic, TimeStatistic}
import scalation.util.Identity

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Component trait provides basic common feature for simulation
components.
*/
trait Component extends Identity
@@ -40,12 +42,14 @@
*/
val DIAM = 2. * RAD

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Director who controls the play.
*/
def director = _director

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the name of the director (controlling model).
* @param director the director of the play.
*/
@@ -58,12 +62,14 @@
} // if
} // setDirector

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Where the component is at.
*/
def at = _at

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the name of the director (controlling model).
* @param director the director of the play.
*/
@@ -78,25 +84,29 @@

def display (): Unit

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tally the duration (e.g., waiting time) of an activity or delay.
* @param duration the time duration
*/
def tally (duration: Double) { _durationStat.tally (duration) }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Accumulate the a value (e.g., number in queue) weighted by its
time duration.
* @param value the value to accumulate
* @param time the current time of the observation
*/
def accumulate (value: Double, time: Double) {
_persistentStat.accumulate (value, time) }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Sample statistics for durations for the component.
*/
def durationStat = _durationStat

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Persistent statistics for value for the component.
*/
def persistentStat = _persistentStat
=======================================
--- /branches/devel/src/scalation/process/Junction.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/process/Junction.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sat Nov 21 15:05:06 EDT 2009
@@ -16,7 +17,8 @@
import scalation.scala2d.Colors._
import scalation.util.Monitor

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Junction class provides a connector between two transports. Since
Lines
* and QCurves have limitation (e.g., hard to make a loop back), a
junction may
* be needed.
@@ -30,7 +32,8 @@
setName (name)
setAt (Array ())

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this Junction
*/
def display () // FIX
@@ -38,7 +41,8 @@
director.animate (this, CreateEdge, blue, Ellipse (), from, to)
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the entity (SimActor) from the incoming "from" transport to the
* outgoing "to" transport
*/
=======================================
--- /branches/devel/src/scalation/process/Model.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/process/Model.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -19,7 +20,8 @@
import scalation.scala2d.Shapes._
import scalation.util.{Identity, Monitor, PQueue}

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Model class maintains a list of components making up the model and
* controls the flow of entities (SimActors) through the model, following
the
* process-interaction world-view. It maintains a time-ordered priority
queue
@@ -67,7 +69,8 @@
*/
private val aniQ = dgAni.getCommandQueue

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Add the component parts to the model.
* @param _parts the component parts
*/
@@ -76,17 +79,20 @@
parts = _parts
} // addComponents

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Current value of the director's clock.
*/
def clock = _clock

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Current acting actor.
*/
def theActor = _theActor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compare the order of actors based on their actTime.
* @param actor1 the first actor in comparison
*/
@@ -96,7 +102,8 @@
{ def compare (actor2: SimActor) = actor1.actTime compare
actor2.actTime }
} // orderedActor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Start the simulation (includes scheduling all Sources).
*/
def startSim ()
@@ -112,13 +119,15 @@
start ()
} // startSim

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Schedule (first time) or reschedule (sunsequent times) an actor to
act.
* @param actor the actor to be scheduled
*/
def reschedule (actor: SimActor) { agenda += actor }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* The model itself is an Actor (not an ordinary SimActor) and may be
* thought of as the director. The director iteratively manages the
clock
* and the agenda of actors until the simulation flag becomes false
@@ -146,7 +155,8 @@
report
} // act

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Report on the statistical results of the simulation.
*/
def report
@@ -158,7 +168,8 @@
} // for
} // report

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Put the components on the animation engine's queue.
*/
def display ()
@@ -167,7 +178,8 @@
for (p <- parts) p.display ()
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Put a node/token command on the animation queue.
* @param who who is being animated
* @param what what animation command
@@ -185,7 +197,8 @@
} // if
} // animate

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Put a edge command on the animation queue.
* @param who who is being animated
* @param what what animation command
@@ -207,7 +220,8 @@

} // Model class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The ModelTest object is used to test the Model class.
*/
object ModelTest extends Application
=======================================
--- /branches/devel/src/scalation/process/Resource.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/process/Resource.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -16,7 +17,8 @@
import scalation.scala2d.Colors._
import scalation.util.Monitor

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Resource class provides services to entities (SimActors).
* It may or may not have an associated waiting queue.
* @param name the name of the resource
@@ -37,7 +39,8 @@
*/
private var inUse = 0

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this Resource.
*/
def display ()
@@ -45,12 +48,14 @@
director.animate (this, CreateNode, orange, Rectangle (), at)
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Determine whether the Resource is busy (no units available).
*/
def busy = inUse == units

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Utilize the Resource for a period of time (models an activity).
*/
def utilize ()
@@ -67,7 +72,8 @@
actor.yieldToDirector ()
} // utilize

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Release the Resource after service is finished (also check waiting
queue).
*/
def release ()
=======================================
--- /branches/devel/src/scalation/process/SimActor.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/process/SimActor.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -12,7 +13,8 @@

import scalation.util.{Monitor, PQItem}

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The SimActor abstract class represents entities that are active in the
model.
* The 'act' abstract method, which specifies entity behavior, must be
defined
* for each subclass. Each SimActor extends Scala's Actor class and
therefore
@@ -32,27 +34,32 @@
*/
private var _yetToAct = true

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* The abstract method, act, is defined in each subclass to provide
specific behavior.
*/
def act ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Whether this actor has yet to act.
*/
def yetToAct = _yetToAct

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the yetToAct flag to false once a SimActor has acted.
*/
def nowActing () { _yetToAct = false }

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Time on the director's clock
*/
def time = director.clock

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Schedule a reactivation of this SimActor delay time units in the
future.
* @param delay the time delay before reactivation
*/
@@ -62,7 +69,8 @@
director.reschedule (this)
} // schedule

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Yield control to the director so the director can take the next
action.
* @param quit the flag indicating whether this actor is done
*/
@@ -77,14 +85,16 @@
} // if
} // yieldToDirector

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compare SimActors based on their activation times, which used for
ordering
* in the director's agenda (a time-based priority queue).
* @param actor2 the other actor to compare with this
def compare (actor2: SimActor) = actTime compare actor2.actTime
*/

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Show the SimActor's full name and activation time.
*/
override def toString = "SimActor ( " + me + " at " + actTime + " ) "
=======================================
--- /branches/devel/src/scalation/process/Sink.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/process/Sink.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -14,7 +15,8 @@
import scalation.scala2d.Colors._
import scalation.util.Monitor

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Sink class is used to terminate entities (SimActors) when they are
finished.
* @param name the name of the sink
* @param at the location of the sink
@@ -27,7 +29,8 @@
setAt (at)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this Sink.
*/
def display ()
@@ -35,7 +38,8 @@
director.animate (this, CreateNode, red, Ellipse (), at)
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Leave the model, effectively terminating the entity (SimActor).
*/
def leave ()
=======================================
--- /branches/devel/src/scalation/process/Source.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/process/Source.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -18,7 +19,8 @@
import scalation.scala2d.Colors._
import scalation.util.Monitor

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Source class is used to periodically inject entities (SimActors)
into a
* running simulation model. May act as an arrival generator. Source is
both
* a simulation Component and special SimActor and therefore runs in own
thread.
@@ -37,7 +39,8 @@
setAt (at)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Display this source as a node on the animation canvas.
*/
def display ()
@@ -45,7 +48,8 @@
director.animate (this, CreateNode, green, Ellipse (), at)
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* The Sources as a special SimActor will act over time to make
entities
* (other SimActors).
*/
=======================================
--- /branches/devel/src/scalation/process/Transport.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/process/Transport.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -17,7 +18,8 @@
import scalation.scala2d.Colors._
import scalation.util.Monitor

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Transport class provides a pathway between two other components.
* The Components in a Model conceptually form a 'graph' in which
the 'edges'
* are Transport objects and the 'nodes' are other Component objects.
@@ -70,7 +72,8 @@
} // if
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation engine to display this Transport.
*/
def display ()
@@ -78,7 +81,8 @@
director.animate (this, CreateEdge, blue, QCurve (), from, to,
Array (bend))
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Give the location of the curve to be its starting point.
*/
override def at: Array [Double] =
@@ -87,7 +91,8 @@
Array (p1.x, p1.y)
} // at

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Jump the entity (SimActor) down this Transport. Place it in the
middle
* of the Transport/Edge/QCurve for the entire trip time.
*/
@@ -106,7 +111,8 @@
actor.yieldToDirector ()
} // jump

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move the entity (SimActor) smoothly down this Transport.
Repeatedely
* move it along the Transport/Edge/QCurve. Caveat: tokens coordinates
* are computed using a shadow QCurve (same coordinates as the one that
=======================================
--- /branches/devel/src/scalation/process/WaitQueue.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/process/WaitQueue.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 7 15:05:06 EDT 2009
@@ -16,7 +17,8 @@
import scalation.scala2d.Colors._
import scalation.util.Monitor

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The WaitQueue class simply a wrapper for monitoring scala's Queue class.
*/
class WaitQueue (name: String, at: Array [Double])
@@ -25,7 +27,8 @@
setName (name)
setAt (at)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tell the animation queue to display this WaitQueue.
*/
def display ()
@@ -33,7 +36,8 @@
director.animate (this, CreateNode, yellow, Rectangle (), at)
} // display

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Wait in the queue.
*/
def waitIn ()
=======================================
--- /branches/devel/src/scalation/scala2d/Arrow.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/Arrow.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Tue Jan 5 16:14:38 EST 2010
@@ -16,7 +17,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Arrow class uses Java's Path2D class to create a line with an
arrowhead
* on the far end. The main line is defined by points p1 and p2. Points
p3
* and p4 are the corners of the triangular arrowhead.
@@ -47,7 +49,8 @@
lineTo (p2.x, p2.y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the x-coordinate of the center of the main line.
*/
def getCenterX (): Double =
@@ -55,7 +58,8 @@
(p1.x + p2.x) / 2.
} // getCenterX

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the y-coordinate of the center of the main line.
*/
def getCenterY (): Double =
@@ -63,7 +67,8 @@
(p1.y + p2.y) / 2.
} // getCenterY

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the Arrow as a line.
* @param _p1 the starting point
* @param _p2 the ending point
@@ -88,7 +93,8 @@
lineTo (p2.x, p2.y)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the Arrow as a line. The bend
parameter
* is ignored for this class, since arrows are straight.
* @param _p1 the starting point
@@ -103,7 +109,8 @@

} // Arrow class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Arrow class.
*/
object ArrowTest extends Application
=======================================
--- /branches/devel/src/scalation/scala2d/Colors.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/Colors.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 21 15:05:06 EDT 2009
@@ -8,7 +9,8 @@

package scalation.scala2d

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* A convenience object defining numerous common colors.
* Source of colors: http://www.webmoments.com/colorchart.htm
*/
@@ -160,7 +162,8 @@
val yellow = new Color (0xFFFF00)
val yellowgreen = new Color (0x9ACD32)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Based upon an object's id, generate (somewhat randomly) a color.
* @param id identifier for some object
*/
=======================================
--- /branches/devel/src/scalation/scala2d/CurvilinearShape.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/scala2d/CurvilinearShape.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sat Jan 9 14:06:47 EST 2010
@@ -11,25 +12,29 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The CurvilinearShape trait provides a general type for line and curves.
* It is analogous to RectangularShape.
*/
trait CurvilinearShape extends Shape with Error
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the x-coordinate of the center of a line/curve. This method
must
* be implemented by all classes mixing in this trait.
*/
def getCenterX (): Double

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the y-coordinate of the center of a line/curve. This method
must
* be implemented by all classes mixing in this trait.
*/
def getCenterY (): Double

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for a straight line. This method must
* be implemented by all classes mixing in this trait.
* @param p1 the starting point
@@ -37,7 +42,8 @@
*/
def setLine (p1: R2, p2: R2)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for a line/curve using the bend
parameter
* to compute the control point. This method must be implemented by
all
* classes mixing in this trait.
@@ -47,7 +53,8 @@
*/
def setLine (p1: R2, pc: R2, bend: Double)

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for a line/curve using an explicitly
* given control point. This is an optional method.
* @param _p1 the starting point
@@ -59,7 +66,8 @@
flaw ("setFrame (p1, pc, p2)", "this method is not overridden by
mixin class")
} // setFrame

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the next point on the CurvilinearShape (one step beyond
current point)
* and adjust from top-left to center coordinates for the object
traversing
* the curve based on its width and height. Return null if past end
point.
=======================================
--- /branches/devel/src/scalation/scala2d/Line.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/Line.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Jan 10 16:17:54 EST 2010
@@ -16,7 +17,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Line class uses Java's Line2D class to create a line.
* @param p1 the starting point for the line
* @param p2 the ending point for the line
@@ -25,7 +27,8 @@
var p2: R2 = R2 (0., 0.))
extends java.awt.geom.Line2D.Double (p1, p2) with CurvilinearShape
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the x-coordinate of the center of the line.
*/
def getCenterX (): Double =
@@ -33,7 +36,8 @@
(p1.x + p2.x) / 2.
} // getCenterX

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the y-coordinate of the center of the line.
*/
def getCenterY (): Double =
@@ -41,7 +45,8 @@
(p1.y + p2.y) / 2.
} // getCenterY

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the frame/location for the Line as a line.
* @param _p1 the starting point
* @param _p2 the ending point
@@ -52,7 +57,8 @@
super.setLine (p1.x, p1.y, p2.x, p2.y)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the frame/location for the Line as a line. The bend
* parameter is ignored for this class, since arrows are straight.
* @param _p1 the starting point
@@ -67,7 +73,8 @@

} // Line class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Line class.
*/
object LineTest extends Application
=======================================
--- /branches/devel/src/scalation/scala2d/Polygon.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/Polygon.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Thu Oct 22 15:05:06 EDT 2009
@@ -15,7 +16,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Polygon class enhances the Path2D.Double class (from the
java.awt.geom
* package) by adding a constructor for building a polygon given its
vertices.
* @param vertex the n >= 3 corner points of the polygon
@@ -31,7 +33,8 @@
lineTo (vertex(0).x, vertex(0).y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the topLeft coordinates of the polygons bounding box.
*/
def getTopLeft: R2 =
@@ -42,7 +45,8 @@

} // Polygon class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Triangle class enhances the Path2D.Double class (from the
java.awt.geom
* package) by adding a constructor for building a triangle given its
vertices.
* @param vertex the three corner points of the triangle
@@ -58,7 +62,8 @@
lineTo (vertex(0).x, vertex(0).y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a Right Isosceles Triangle.
* @param topLeft the top left point for the triangle (min x and y
coordinates)
* @param side the length of the two sides emanating from topLeft
@@ -70,7 +75,8 @@
R2 (topLeft.x, topLeft.y + side)))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a Right Triangle.
* @param topLeft the top left point for the triangle (min x and y
coordinates)
* @param side1 the width of the triangle (change in x)
@@ -83,7 +89,8 @@
R2 (topLeft.x, topLeft.y + side2)))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the topLeft coordinates of the polygons bounding box.
*/
def getTopLeft: R2 =
@@ -94,7 +101,8 @@

} // Triangle class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Quad class enhances the Path2D.Double class (from the java.awt.geom
* package) by adding a constructor for building a quadrilateral given its
vertices.
* @param vertex the four corner points of the quadrilateral
@@ -110,7 +118,8 @@
lineTo (vertex(0).x, vertex(0).y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a Square.
* @param topLeft the top left point for the square (min x and y
coordinates)
* @param side the length of each side in the square
@@ -139,7 +148,8 @@
R2 (topLeft.x + shift, topLeft.y + side2)))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the topLeft coordinates of the polygons bounding box.
*/
def getTopLeft: R2 =
@@ -150,7 +160,8 @@

} // Quad class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Pentagon class enhances the Path2D.Double class (from the
java.awt.geom
* package) by adding a constructor for building a pentagon given its
vertices.
* @param vertex the five corner points of the pentagon
@@ -166,7 +177,8 @@
lineTo (vertex(0).x, vertex(0).y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a equalaterial Pentagon.
* @param topLeft the top left point for the pentagon (min x and y
coordinates)
* @param side the length of each side in the pentagon
@@ -180,7 +192,8 @@
R2 (topLeft.x, topLeft.y + sin72 * side)))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the topLeft coordinates of the polygons bounding box.
*/
def getTopLeft: R2 =
@@ -191,7 +204,8 @@

} // Pentagon class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Hexagon class enhances the Path2D.Double class (from the
java.awt.geom
* package) by adding a constructor for building a hexagon given its
vertices.
* @param vertex the six corner points of the hexagon
@@ -207,7 +221,8 @@
lineTo (vertex(0).x, vertex(0).y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a equalaterial Hexagon.
* @param topLeft the top left point for the hexagon (min x and y
coordinates)
* @param side the length of each side in the hexagon
@@ -222,7 +237,8 @@
R2 (topLeft.x - cos60 * side, topLeft.y + sin60
* side)))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the topLeft coordinates of the polygons bounding box.
*/
def getTopLeft: R2 =
@@ -233,7 +249,8 @@

} // Hexagon class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Octogon class enhances the Path2D.Double class (from the
java.awt.geom
* package) by adding a constructor for building a octogon given its
vertices.
* @param vertex the eight corner points of the octogon
@@ -249,7 +266,8 @@
lineTo (vertex(0).x, vertex(0).y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a equalaterial Hexagon.
* @param topLeft the top left point for the octogon (min x and y
coordinates)
* @param side the length of each side in the octogon
@@ -266,7 +284,8 @@
R2 (topLeft.x, topLeft.y + cos45 * side)))
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the topLeft coordinates of the polygons bounding box.
*/
def getTopLeft: R2 =
@@ -277,7 +296,8 @@

} // Octogon class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Useful constants.
*/
object Constants
@@ -289,7 +309,8 @@
val sin72 = sin (2. * Pi / 5.)
} // Constants object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The PolygonTest object tests the Polygon, Triangle, Quad and Hexagon
classes.
*/
object PolygonTest extends Application
=======================================
--- /branches/devel/src/scalation/scala2d/QArrow.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/QArrow.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Tue Jan 5 16:14:38 EST 2010
@@ -16,7 +17,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The QArrow class uses Java's Path2D class to create a quad curve with
an arrowhead
* on the far end. The main curve is defined by points p1 and p2 along
with a
* control point pc. Points p3 and p4 are the corners of the triangular
arrowhead.
@@ -49,7 +51,8 @@
lineTo (p2.x, p2.y)
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a QArrow (quad arc) where bend indicates the distance to
the control
* point.
* @param p1 the starting point for the curve/arc
@@ -61,7 +64,8 @@
this (p1, computeControlPoint (p1, p2, bend), p2)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the x-coordinate of the center of the main line/curve.
*/
def getCenterX (): Double =
@@ -70,7 +74,8 @@
else (p1.x + p2.x) / 2.
} // getCenterX

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the y-coordinate of the center of the main line/curve.
*/
def getCenterY (): Double =
@@ -79,7 +84,8 @@
else (p1.y + p2.y) / 2.
} // getCenterY

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the QArrow as a line.
* @param _p1 the starting point
* @param _p2 the ending point
@@ -91,7 +97,8 @@
setLine (p1, pc, p2)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the QArrow as a curve using bend
* to compute the control point.
* @param _p1 the starting point
@@ -105,7 +112,8 @@
setLine (p1, pc, p2)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the QArrow as a curve using an
explicitly
* given control point.
* @param _p1 the starting point
@@ -134,7 +142,8 @@

} // QArrow class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the QArrow class.
*/
object QArrowTest extends Application
=======================================
--- /branches/devel/src/scalation/scala2d/QCurve.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/QCurve.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Sep 21 15:05:06 EDT 2009
@@ -16,7 +17,8 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The QCurve class enhances the QuadCurve.Double class (from the
java.awt.geom
* package) by allowing entities to move along such quadratic curves as
well as
* lines. Although the curve could be developed as a quadratic function
where
@@ -42,7 +44,8 @@
*/
private var steps = 200

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a straight line (degenerate quad curve).
* @param p1 the starting point
* @param p2 the ending point
@@ -52,7 +55,8 @@
this (p1, computeControlPoint (p1, p2), p2, true)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a quad curve where bend indicates the distance to the
control
* point.
* @param p1 the starting point
@@ -64,7 +68,8 @@
this (p1, computeControlPoint (p1, p2, bend), p2, false)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a quad curve using an explicitly given control point.
* @param p1 the starting point
* @param pc the control point
@@ -75,7 +80,8 @@
this (p1, pc, p2, false)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the x-coordinate of the center of the line/curve.
*/
def getCenterX (): Double =
@@ -84,7 +90,8 @@
else (p1.x + p2.x) / 2.
} // getCenterX

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the y-coordinate of the center of the line/curve.
*/
def getCenterY (): Double =
@@ -93,7 +100,8 @@
else (p1.y + p2.y) / 2.
} // getCenterY

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the QCurve as a line.
* @param _p1 the starting point
* @param _p2 the ending point
@@ -105,7 +113,8 @@
super.setCurve (p1, pc, p2)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the QCurve as a curve using bend
* to compute the control point.
* @param _p1 the starting point
@@ -120,7 +129,8 @@
super.setCurve (p1, pc, p2)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set (or reset) the location for the QCurve as a curve using an
* explicitly given control point.
* @param _p1 the starting point
@@ -134,12 +144,14 @@
super.setCurve (p1, pc, p2)
} // setLine

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the first/start point of the quad curve.
*/
def getFirst: R2 = p1

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the first/start point of the quad curve, adjusted from top-left
to
* center coordinates.
* @param width the width of object traversing the curve
@@ -150,17 +162,20 @@
R2 (p1.x + width / 2., p1.y + height / 2.)
} // getFirst

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the control point of the quad curve.
*/
def getControl: R2 = pc

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the last/end point of the quad curve.
*/
def getLast: R2 = p2

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the last/end point of the quad curve, adjusted from top-left to
* center coordinates.
* @param width the width of object traversing the curve
@@ -171,7 +186,8 @@
R2 (p2.x + width / 2., p2.y + height / 2.)
} // getLast

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Are (x, y) and (xe, ye) essentially the same?
*/
def isSame (x: Double, y: Double, xe: Double, ye: Double, step:
Double): Boolean =
@@ -179,7 +195,8 @@
(xe - x) * (xe - x) + (ye - y) * (ye -y) < step * step
} // isSame

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Given a value for the trajectory parameter t (in [0., 1.]) calculate
* the point on the curve using the Quadratic Bezier equation.
* See http://en.wikipedia.org/wiki/Bézier_curve#Quadratic_curves
@@ -190,7 +207,8 @@
pow (1.-t, 2) * p1.y + 2. * (1.-t) * t * pc.y + pow (t, 2) *
p2.y)
} // eval

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the next point on the quad curve (one step beyond current
point).
* Return null if t > 1. (i.e., past end point).
*/
@@ -207,7 +225,8 @@
q
} // next

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Return the next point on the quad curve (one step beyond current
point)
* and adjust from top-left to center coordinates for the object
traversing
* the curve based on its width and height.
@@ -221,7 +240,8 @@
if (q != null) R2 (q.x - width / 2., q.y - height / 2.) else null
} // next

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Set the number of steps for tokens to take as move along the quad
curve.
* @param steps the number of steps to take along the quad curve
*/
@@ -230,7 +250,8 @@
steps = _steps
} // setSteps

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Show the start, control and end point of the the QCurve.
*/
override def toString: String =
@@ -240,7 +261,8 @@

} // QCurve class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object provides formulas used by the QCurve class.
*/
object QCurveCalc
@@ -249,7 +271,8 @@
*/
val EPSILON = 0.000001

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the slope of the line defined by points p1 and p2.
* Note: if deltaX is 0, the method returns infinity.
* @param p1 the starting point
@@ -260,7 +283,8 @@
(p2.y - p1.y) / (p2.x - p1.x)
} // slope

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the distance or the length of the line connecting points p1
* and p2.
* @param p1 the starting point
@@ -271,7 +295,8 @@
sqrt (pow (p2.x - p1.x, 2) + pow (p2.y - p1.y, 2))
} // slope

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the location (x, y) of the control point. It is positioned
* orthongonally to the mid point of the line connecting p1 and p2 at a
* distance dist, where dist = bend * || p2 - p1 ||. A bend of 0.
gives
@@ -298,7 +323,8 @@

} // QCurveCalc object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The QCurveTest object tests QCurve's (quad curves).
*/
object QCurveTest extends Application
@@ -351,7 +377,8 @@

} // QCurveTest object

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The QCurveTest2 object tests traversals of QCurve's (quad curves).
*/
object QCurveTest2 extends Application
=======================================
--- /branches/devel/src/scalation/scala2d/Shapes.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/scala2d/Shapes.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Jan 10 17:08:32 EST 2010
@@ -42,7 +43,8 @@

package scalation.scala2d

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Scala type aliases for basic Java2D types.
*/
object Shapes
@@ -54,33 +56,39 @@
type Shape = java.awt.Shape
} // Shapes

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience case class for Point2D.
*/
case class R2 (xx: Double, yy: Double) extends
java.awt.geom.Point2D.Double (xx, yy)

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience case class for Path2D. Its subtypes (case class Polygon,
etc.)
* are defined other files in the scala2d package.
*/
case class Path () extends java.awt.geom.Path2D.Double

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience case class for Arc2D (a subclass of RectangularShape).
*/
case class Arc () extends java.awt.geom.Arc2D.Double

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience case class for Ellipse2D (a subclass of RectangularShape).
*/
case class Ellipse () extends java.awt.geom.Ellipse2D.Double

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience case class for Rectangle2D (a subclass of RectangularShape).
*/
case class Rectangle () extends java.awt.geom.Rectangle2D.Double

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Convenience case class for RoundRectangle2D (a subclass of
RectangularShape).
*/
case class RoundRectangle () extends java.awt.geom.RoundRectangle2D.Double
=======================================
--- /branches/devel/src/scalation/scala2d/Transform.scala Fri Feb 4
05:56:27 2011
+++ /branches/devel/src/scalation/scala2d/Transform.scala Wed Feb 9
13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Jan 10 17:08:32 EST 2010
@@ -11,13 +12,15 @@
import scalation.scala2d.Shapes._
import scalation.util.Error

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Transform trait provides a simple technique for transforming
* (translation, scaling and rotation) rectangular shapes.
*/
trait Transform extends Error
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move/translate the shape to location (x, y).
* @param shape the shape/object to move
* @param x the x-coordinate
@@ -28,7 +31,8 @@
shape.setFrame (x, y, shape.getWidth, shape.getHeight)
} // move

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Move/translate the shape to location (x, y).
* @param shape the shape/object to move
* @param p the point (x, y)-coordinates
@@ -42,7 +46,8 @@
} // if
} // move

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Scale/resize the shape to the new width and height parameters.
* @param shape the shape/object to scale (change size)
* @param w the width
@@ -53,7 +58,8 @@
shape.setFrame (shape.getX, shape.getY, w, h)
} // scale

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Scale/resize the shape to the new width and height parameters.
* @param shape the shape/object to scale (change size)
* @param p the point (w, h) parameters
@@ -67,7 +73,8 @@
} // if
} // scale

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Rotate the shape by theta radians.
* @param shape the shape/object to rotate
* @param theta the rotation angle in radians
=======================================
--- /branches/devel/src/scalation/stat/Histogram.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/stat/Histogram.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Mon Nov 2 15:05:06 EDT 2009
@@ -18,7 +19,8 @@
import scalation.scala2d.Colors._
import scalation.scala2d.Shapes._

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Histogram class takes a vector of values, counts the number of
values
* in each of several intervals and displays the counts vertically in a
* histogram.
@@ -45,7 +47,8 @@
private val bar = Rectangle ()
private val axis = Line ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a canvas on which to draw the histogram.
*/
val canvas = new Panel
@@ -53,7 +56,8 @@
background = white
preferredSize = frameSize

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Paint the canvas by drawing the rectangles (vertical bars)
making up
* the histogram.
* @param g2d the high resolution 2D graphics context
@@ -110,7 +114,8 @@
visible = true
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert value to string and cut out the first four characters.
* @param x the value to convert and cut
*/
@@ -120,7 +125,8 @@
s.substring (0, min (s.length, 4))
} // clip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the counts for each interval in the histogram.
*/
def computeHistogram (): VectorN [Double] =
@@ -133,7 +139,8 @@
h
} // computeHistogram

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute coordinates (x, y, w, h) for each of bars used to draw the
histogram.
*/
def computeCoordinates (): MatrixN [Double] =
@@ -152,14 +159,16 @@
c
} // computeCoordinates

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert a Histogram to a string.
*/
override def toString = histogram.toString

} // Histogram class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Histogram class.
*/
object HistogramTest extends Application
=======================================
--- /branches/devel/src/scalation/stat/Plot.scala Fri Feb 4 05:56:27 2011
+++ /branches/devel/src/scalation/stat/Plot.scala Wed Feb 9 13:41:57 2011
@@ -1,5 +1,6 @@
-
-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Sun Nov 15 15:05:06 EDT 2009
@@ -17,7 +18,8 @@
import scalation.scala2d.Colors._
import scalation.scala2d.Shapes._

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Plot class takes x and y vectors of data values and plots the (x, y)
* data points.
* @param x the x vector of data values (horizontal)
@@ -46,7 +48,8 @@
private val dot = Ellipse ()
private val axis = Line ()

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Create a canvas on which to draw the histogram.
*/
val canvas = new Panel
@@ -54,7 +57,8 @@
background = white
preferredSize = frameSize

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Paint the canvas by plotting the data points.
* @param g2d the high resolution 2D Graphics context
*/
@@ -113,7 +117,8 @@
visible = true
} // primary constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert value to string and cut out the first four characters.
* @param x the value to convert and cut
*/
@@ -123,14 +128,16 @@
s.substring (0, min (s.length, 4))
} // clip

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Convert a Plot vectors to a string.
*/
override def toString = "Plot (y = " + y + " vs. x = " + x + ")"

} // Plot class

-/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Plot class.
*/
object PlotTest extends Application
=======================================
--- /branches/devel/src/scalation/stat/Quantile.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/stat/Quantile.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Sep 30 18:41:26 EDT 2009
@@ -12,7 +13,8 @@
import scalation.advmath._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object contains methods to compute inverse Cumulative Distribution
* Functions (iCDF's) for the popular sampling distributions:
* StandardNormal, StudentT, ChiSquare and Fisher.
@@ -20,7 +22,8 @@
*/
object Quantile extends Combinatorics with Error
{
-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the pth quantile for the "standard normal distribution"
function.
* This function returns an approximation of the "inverse" cumulative
* standard normal distribution function. I.e., given p, it returns
@@ -81,7 +84,8 @@
(((((b(0)*r + b(1))*r + b(2))*r + b(3))*r + b(4))*r + 1)
} // normalInv

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the pth quantile for "Student's t distribution" function.
* This function returns an approximation of the "inverse" cumulative
* Student's t distribution function. I.e., given p, it returns
@@ -114,7 +118,8 @@
if (p >= 0.5) z1 + x else -(z1 + x)
} // studentTInv

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the Cummulative Distribution Function (CDF) for the
ChiSquare
* distribution by numerically integrating the ChiSquare probability
* density function (pdf). See Variate.scala.
@@ -141,7 +146,8 @@
sum
} // chiSquareCDF

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the pth quantile for "ChiSquare distribution" function using
* bisection search of the CDF.
* @param p the pth quantile (e.g., 95 percent)
@@ -168,7 +174,8 @@
x
} // chiSquareInv

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the pth quantile for "Fisher distribution" function.
* @param p the pth quantile (e.g., 95 percent)
* @param df1 the degrees of freedom 1
@@ -184,7 +191,8 @@

} // Quantile object

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object test the the Quantile object.
*/
object QuantileTest extends Application
=======================================
--- /branches/devel/src/scalation/stat/Regression.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/stat/Regression.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Aug 26 18:41:26 EDT 2009
@@ -12,12 +13,14 @@
import scalation.advmath.Matrices._
import scalation.advmath.Vectors._

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The Regression object supports multiple linear regression.
*/
object Regression
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Evaluate the formula y = x * b.
* @param x the design matrix augmented with a first column of ones.
* @param b the parameter vector
@@ -27,7 +30,8 @@
x * b
} // eval

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Fit the parameter vector (b-vector) in the regression equation y =
x * b + e
* using the least squares method.
* @param x the design matrix augmented with a first column of ones.
@@ -46,7 +50,8 @@
} // Regression object


-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Object to test Regression object (y = x * b = b0 + b1*x1 + b2*x2).
*/
object RegressionTest extends Application
@@ -69,7 +74,8 @@

} // RegressionTest object

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Object to test Regression object (y = x * b = b0 + b1*x1 + b2*x2).
*/
object RegressionTest2 extends Application
=======================================
--- /branches/devel/src/scalation/stat/StatVector.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/stat/StatVector.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Aug 26 18:41:26 EDT 2009
@@ -11,14 +12,16 @@
import scala.math._
import scalation.advmath._

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* The StatVector class provides methods for computing common statistics on
* a data vector.
* @param dim the dimension/size of the vector
*/
class StatVector (dim: Int) extends VectorN [Double] (dim)
{
-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a StatVector from an Array.
* @param u the array to initialize StatVector
*/
@@ -28,7 +31,8 @@
setAll (u)
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Construct a StatVector from a VectorN.
* @param u the vector to initialize StatVector
*/
@@ -38,32 +42,38 @@
setAll (u())
} // constructor

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the number of samples.
*/
def num: Int = dim

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the mean of this vector.
*/
def mean: Double = sum / dim

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the variance of this vector.
*/
def variance: Double = (norm2 - pow (sum, 2) / dim) / dim

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the standard deviation of this vector.
*/
def stddev: Double = sqrt (variance)

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the root mean square.
*/
def rms: Double = sqrt (norm2 / dim.asInstanceOf [Double])

-
/**:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the confidence interval half-width for the given confidence
level.
* @param p the confidence level
*/
@@ -79,7 +89,8 @@

} // StatVector class

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* Object to test the StatVector class.
*/
object StatVectorTest extends Application
=======================================
--- /branches/devel/src/scalation/stat/Statistic.scala Fri Feb 4 05:56:27
2011
+++ /branches/devel/src/scalation/stat/Statistic.scala Wed Feb 9 13:41:57
2011
@@ -1,5 +1,6 @@
-
-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* @author John Miller
* @version 1.0
* @date Wed Aug 26 18:41:26 EDT 2009
@@ -12,7 +13,8 @@
import scalation.stat._
import scalation.util.Error

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to collect values and compute statistics on them.
*/
class Statistic extends Error
@@ -37,7 +39,8 @@
*/
protected var maxX = 0.

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Tally the next value and update accumulators.
* @param x the value to tally
*/
@@ -50,42 +53,50 @@
if (x > maxX) maxX = x
} // tally

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the number of samples.
*/
def num: Int = n

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the minimum value in sample.
*/
def min: Double = minX

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Get the maximum value in sample.
*/
def max: Double = maxX

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute/estimate the sample mean.
*/
def mean: Double = if (n == 0) 0.0 else sum / n.asInstanceOf [Double]

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute/estimate the sample variance.
*/
def variance: Double = if (n == 0) 0. else sumSq / n.asInstanceOf
[Double] - pow (mean, 2)

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute/estimate the sample standard deviation.
*/
def stddev: Double = sqrt (variance)

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute/estimate the root mean square.
*/
def rms: Double = sqrt (sumSq / n.asInstanceOf [Double])

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Compute the confidence interval half-width for the given confidence
level.
* @param p the confidence level
*/
@@ -98,7 +109,8 @@
t * stddev / sqrt (df)
} // interval

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Generate a header of statisical labels as a string.
*/
def labels (): String =
@@ -106,7 +118,8 @@
format ("| %4s | %9s | %9s | %9s | %9s | %9s
|", "num", "min", "max", "mean", "stdDev", "interval")
} // labels

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Generate a row of statistical results as a string.
*/
override def toString: String =
@@ -116,14 +129,16 @@

} // Statistic class

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This class is used to collect values and compute time persistent
statistics
* on them.
* @param lastTime the time of previous observation
*/
class TimeStatistic (var lastTime: Double = 0.) extends Statistic
{
-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Disable the tally method (it is for sample statistics, not time
persistent
* statistics.
* @param x the value to tally
@@ -133,7 +148,8 @@
flaw ("tally", "this method must not be called from TimeStatistic")
} // tally

-
/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+ /**
* Accumulate the next value weighted by its time duration and update
accumulators.
* @param x the value to accumulate
* @param t the time of the observation
@@ -152,7 +168,8 @@

} // TimeStatistic class

-/**::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/**
* This object is used to test the Statistic and TimeStatistic classes.
*/
object StatisticTest extends Application
=======================================
***Additional files exist in this changeset.***
Reply all
Reply to author
Forward
0 new messages