Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Apl > Re: Filling a m...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 923 of 1019
Post > Topic >>

Re: Filling a matrix with values

by admin9974@[EMAIL PROTECTED] Dec 25, 2007 at 12:34 PM

Great holiday puzzle!  My take on this is:

For every cell C, make a sum of the cell "just above C"
and the cell "just left diagonally above" C. Place the
sum in C"

So, I make the assumption "top left" here means "left diagonally
above",
and NOT M[1;1] in all cases.

As the problem is stated, the first row and the
first column becomes special cases: the first row
is left intact, and the first column (apart from
the first row) is just downshifted one step (I suppose...?).

The challenge (if any) may have been to correctly interpret
the requirements. Now, that would NEVER happen in
a real world situation, right?... :)

Anyway, here is my attempt, using basically the same mix of dropping
and catenating as others have suggested:

M (original matrix):

   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16
  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32
  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48
  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64
  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80
  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96
  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112
 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256


M[1;],[1](=AF1 drop M[;1]),0 =AF1 drop (=AF1 0 drop M)+(=AF1 1 drop M),0


   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16
   1   3   5   7   9  11  13  15  17  19  21  23  25  27  29  31
  17  35  37  39  41  43  45  47  49  51  53  55  57  59  61  63
  33  67  69  71  73  75  77  79  81  83  85  87  89  91  93  95
  49  99 101 103 105 107 109 111 113 115 117 119 121 123 125 127
  65 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159
  81 163 165 167 169 171 173 175 177 179 181 183 185 187 189 191
  97 195 197 199 201 203 205 207 209 211 213 215 217 219 221 223
 113 227 229 231 233 235 237 239 241 243 245 247 249 251 253 255
 129 259 261 263 265 267 269 271 273 275 277 279 281 283 285 287
 145 291 293 295 297 299 301 303 305 307 309 311 313 315 317 319
 161 323 325 327 329 331 333 335 337 339 341 343 345 347 349 351
 177 355 357 359 361 363 365 367 369 371 373 375 377 379 381 383
 193 387 389 391 393 395 397 399 401 403 405 407 409 411 413 415
 209 419 421 423 425 427 429 431 433 435 437 439 441 443 445 447
 225 451 453 455 457 459 461 463 465 467 469 471 473 475 477 479


Good luck using APL.  APL takes the interactive approach to the
level where it becomes an "immersive experience".




 6 Posts in Topic:
Filling a matrix with values
Jimmy Miller <CaptainT  2007-12-24 04:19:11 
Re: Filling a matrix with values
Lance <LanceMD@[EMAIL   2007-12-24 07:13:20 
Re: Filling a matrix with values
Phil Last <phil.last@[  2007-12-24 07:53:14 
Re: Filling a matrix with values
sethb@[EMAIL PROTECTED]   2007-12-24 16:09:26 
Re: Filling a matrix with values
aleph0 <apl68000@[EMAI  2007-12-24 10:10:37 
Re: Filling a matrix with values
admin9974@[EMAIL PROTECTE  2007-12-25 12:34:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 1:39:15 CDT 2008.