Re: matrixMultiply

2002-07-24 Thread Raymond E. Griffith

Gregory Lypny [EMAIL PROTECTED] asked...

 Hi Everyone,
 
 I'm  having trouble with matrixMultiply.  I've created two 1 x 20
 vectors (arrays) named Prob and V.  I want to compute the dot product
 (for example, the expected value of V in statistics), which is
 
 prob[1] x V[1] + prob[2] x V[2] + ... + prob[20] x V[20]
 
 but it's not clear whether MetaCard treats vectors as columns or
 rows by default.  All of the following result in error messages:
 
 matrixMultiply(prob,V) 
 
 matrixMultiply(transpose(prob),V)
 
 matrixMultiply(prob,transpose(V))
 
 Any help would be much appreciated.
 
 Regards,
 
 Greg
 

transpose does not work on single column vectors. Transpose takes the index
[i,j] and replaces it with [j,i].

In your case, you need to create your vectors as prob[i,j]. Transpose ought
to work then.

Or you could just do this (and it might be a bit faster even):

function dotp x,y
if keys(x) = keys(y) then
repeat for each line i in keys(x)
  add x[i]*y[i] to sum
end repeat
return sum
end dotp

 Gregory Lypny
 Concordia University
 ___
 Better for us if you don't understand.
 The Tragically Hip
 
 http://rubbersoul.concordia.ca
 

Raymond

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Upload

2002-07-24 Thread Simon Lord

Thank you VERY much Richard.  I love examples!


On Wednesday, July 24, 2002, at 01:14 AM, Richard Gaskin wrote:

 Simon Lord wrote:

 I have a great script that allows MetaCard to download a file
 from my server.  Now I need one to upload a file to the server.
 Does anyone have a stack with a sample script to do this?  Just
 a time saving question.

 LibURL makes it easy:

   put container into url ftpUrl

 e.g.:

  put ftp://; tUser:tPword@tHost/tFileName / 
 into tDestUrl
  put url (file:tLocalFile) into url tDestUrl


 --
  Richard Gaskin
  Fourth World Media Corporation
  Custom Software and Web Development for All Major Platforms
  Developer of WebMerge 2.0: Publish any Database on Any Site
  ___
  [EMAIL PROTECTED]   http://www.FourthWorld.com
  Tel: 323-225-3717   AIM: FourthWorldInc

 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard


Sincerely,
Simon

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Darwin question

2002-07-24 Thread Richard MacLemale

I'm drawing a HUGE blank tonight and I don't know why.

I'm trying to write a darwin mt script that will write info to a field in a
stack.  Only it's not working.  I can read info from a stack, but can't
write to it.  All permissions are fine.  I can write to a text file with no
problem.  To sum it up:
The script has permission to run as root.  (chmod a+s)
The script IS running as root (verified with whoami)
The script can read from field 1 of card 1 of the test stack.
The script cannot write to field 1 of card 1 of the test stack.
The stack itself is set to 775 and owned by root.
The script can write to a text file in the same directory as the stack.

Anyone see what I'm doing wrong?  I do this all the time with plain text
files with no problem, but have never used stacks in this way.


-- 
:)
Richard MacLemale
Network Administrator
J. W. Mitchell High School

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Darwin question

2002-07-24 Thread Richard MacLemale

Never mind.  Answered my own dumb question.  I was using

open stack thisStack
put duh into field 1 of card 1 of stack thisStackcClose stack thisStack
close stack thisStack

instead of

open stack thisStack
put duh into field 1 of card 1 of stack thisStack
save stack thisStack
close stack thisStack


It's the little things that count.

As stated in a previous post, MetaCard can read/write faster to 30 fields in
a single stack than 30 individual text files, so I'm trying to use stacks to
store data.  And so, apparently, when writing to a text file you can do
open/write/close, but when working with a stack, it's open/put/save/close.
I should have known it'd be something easy...


-- 
:)
Richard MacLemale
Network Administrator
J. W. Mitchell High School

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Darwin question

2002-07-24 Thread J. Landman Gay

On 7/24/02 8:28 PM, Richard MacLemale wrote:

 I'm trying to write a darwin mt script that will write info to a field in a
 stack.  Only it's not working.  I can read info from a stack, but can't
 write to it. 

I was trying to do something similar a while back -- use find to 
search stack fields -- but that wouldn't work either. Apparently you 
can't do any manipulation of stack objects when you aren't using the 
GUI. You can only read data. I had to rewrite my find routine to 
mechanically extract and examine the content of every field I wanted to 
search, since apparently the built-in find only works in the GUI.


-- 
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software   | http://www.hyperactivesw.com

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard