MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Switch rows!

  • To: mathgroup at
  • Subject: [mg32378] Re: Switch rows!
  • From: Jens-Peer Kuska <kuska at>
  • Date: Thu, 17 Jan 2002 02:23:31 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <a23fhk$9le$>
  • Reply-to: kuska at
  • Sender: owner-wri-mathgroup at


a) pivoting work with a pivot array, that avoid the 
   explicit copy/exchange operation of rows ...
   the rows are accessed as matrix[[pivot[[i]]]] instead of
   matrix[[i]] and "exchanging" a row is an exchange
   of the two integers in pivot and not an exchange of 
   the m numbers in a row.

b) You have to use the HoldFirst attribute:


RowSwap[ matrix_, row1_Integer, row2_Integer ] :=
  Block[{tmp = matrix[[row1]]},  

> _____________
Rebeka Renko wrote:
> Hi!
> I have another question. While I was writting a
> program for partial pivoting, I used a program bellow
> for switching rows in a matrix. It works fine, when I
> use it separetly, but if I include it into a programm,
> it returns an error. I believe this is because of the
> BLOCK command, or am I wrong? How can it be changed,
> so that it would fit my programm?
> I am looking forward on your answer and am thanking
> you in advance!
> Regards,
> Rebeka
> Programm:
> RowSwop[ matrix_, row1_, row2_ ] :=
> Block[{temp = matrix}, temp[[row1]] = matrix[[row2]];
>     temp[[row2]] = matrix[[row1]]; temp ]
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!

  • Prev by Date: Comparison of Mathematica on Various Computers
  • Next by Date: RE: How To Change A Rule
  • Previous by thread: Switch rows!
  • Next by thread: Taylor Series Expansions