Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Compile SparseArray help

  • To: mathgroup at
  • Subject: [mg61115] Compile SparseArray help
  • From: weloma <weloma at>
  • Date: Tue, 11 Oct 2005 03:20:07 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Hi to all group members, 
i am working with Sparse Matrices, but i can not
compile any equation with them. A normal Matrix can be
compiled as Compile[ {Matrix, _Real, 2}.... so i tried
to compile it as below where D and L are SparseArrays.

Compile[ {w, {D, _Real, 2}, {L, _Real, 2}... 

and it is fallowed by the error; 
CompiledFunction::cfta: Argument \<<1>> at position 2
should be a rank 2 tensor of machine-size real

Is anybody can help me, how can i compile the
P.S. I write below what i try to do;
(*w is a real number; D,U and L are SparseArrays,
P[i]is a vector*)
(*In detail,i have a big square matrix say A,
(50000*50000) with a few non-zero elements. So i
define it as a SparseArray, D is the diagonalmatrix of
A,U and L are the upperdiagonal and lowerdiagonal
matrices of A respectively*)
(*i am trying to compute P[40]*)
P[1] = Table[1/n, {i, n}];
test = Compile[ {w, {D, _Real, 2}, {L, _Real, 2}, {U,
_Real, 2}},
P[i + 1\2]=Inverse[(-D - w*L)].((1 - w)*-D +
P[i+1]=Inverse[(-D - w*U)].((1 - w)*-D +
test[1.4, D, L, U] // Timing

Ozgur Ozer
Bogazici University

Yahoo! Mail - PC Magazine Editors' Choice 2005

  • Prev by Date: Re: SameTest in Union
  • Next by Date: Re: SameTest in Union
  • Previous by thread: numerical differentiation
  • Next by thread: ListPlot3D Scatter Plot