SCM

SCM Repository

[matrix] Diff of /pkg/R/pMatrix.R
ViewVC logotype

Diff of /pkg/R/pMatrix.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1305, Sat Jul 1 16:18:39 2006 UTC revision 1407, Mon Aug 21 15:24:47 2006 UTC
# Line 1  Line 1 
1  #### Permutation Matrices -- Coercion and Methods  #### Permutation Matrices -- Coercion and Methods
2    
3    ## The typical   'constructor' : coerce from  'index'
4  setAs("integer", "pMatrix",  setAs("integer", "pMatrix",
5        function(from) {        function(from) {
6            n <- length(from)            n <- length(from)
# Line 8  Line 9 
9                perm = from)                perm = from)
10        })        })
11    
12    setAs("numeric", "pMatrix",
13          function(from)
14              if(all(from == (i <- as.integer(from)))) as(i, "pMatrix")
15              else stop("coercion to 'pMatrix' only works from integer numeric"))
16    
17  setAs("pMatrix", "matrix",  setAs("pMatrix", "matrix",
18        function(from) {        function(from) {
19            fp <- from@perm            fp <- from@perm

Legend:
Removed from v.1305  
changed lines
  Added in v.1407

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge