Naming Conventions

Scalar

Vector

Matrix

Any
rank

Non-
scalar

Boolean

BS

BV

BM

BA

BN

Integer

IS

IV

IM

IA

IN

Float

FS

FV

FM

FA

FN

Numeric

NS

NV

NM

NA

NN

Character

CS

CV

CM

CA

CN

Enclosed
vector

ES

EV

EM

EA

EN

enclosed
Text vector

TS

TV

TM

TA

TN

Simple

SS

SV

SM

SA

SN

Any

AS

AV

AM

AA

AN

phrase e.g.: .X...Y. ⍝ X←BS; Y←IV

combinations: use ISV for Integer scalarvector

B3, I4 &c. to specify higher ranks.

Open full technical reference

EnforceMatrix

If you want to make any array a rank-two-array:

      (¯2↑1 1,⍴SA)⍴SA

Examples

      ⎕FX ⍕2 1⍴'r←EnforceMatrix SA' 'r←(¯2↑1 1,⍴SA)⍴SA'    ⍝ This will work in any APL dialect
      ⍴EnforceMatrix 1 
1 1
      ⍴EnforceMatrix 1 2 3
1 3

Compatibility

Checked with:

Test Cases

Show test cases

Test
 ⎕IO←0      ⍝ You may change this; however, zero IS the default in the Phrasebook
⍝⎕ML←3      ⍝ Enable this line in Dyalog APL if appropriate
 ⎕FX'r←EnforceMatrix SA' 'r←(¯2↑1 1,⍴SA)⍴SA'
⍝ ---- Start Test cases (do not delete this!)
 1 1≡⍴EnforceMatrix 1
 1 1≡⍴EnforceMatrix ,1
 1 2≡⍴EnforceMatrix 1 2
 1 3≡⍴EnforceMatrix 1 2 3

For details see the PhraseBook/TestCasesGuidelines.

Test my code, both Examples and Test Cases.

See also: ...

Mentor: KaiJaeger

Tags:


CategoryPhrasesAll CategoryPhraseStructure

PhraseBook/EnforceMatrix (last edited 2011-12-26 19:18:50 by KaiJaeger)