How about:

1
2
3
4
5
6
let swapRows (mat : 'a Matrix) r1 r2 =
    mat.PermuteRows (fun i -> if i = r1 then r2 elif i = r2 then r1 else i)


let m1 = matrix [[1.;2.;3.];[4.;5.;6.];[7.;8.;9.]]    
let m2 = swapRows m1 0 2

I tried this on 1.9.7.8. Apologies if it doesn't port to F# 2.0.

By on 5/31/2010 3:46 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper