Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Identity-matrix/FutureBasic/identity-matrix.basic
Normal file
24
Task/Identity-matrix/FutureBasic/identity-matrix.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn IdentityMatrix( n as NSInteger ) as CFStringRef
|
||||
NSInteger i, j
|
||||
CFMutableArrayRef tempArr = fn MutableArrayWithCapacity( n )
|
||||
CFMutableStringRef mutStr = fn MutableStringWithCapacity( 0 )
|
||||
|
||||
for i = 0 to n - 1
|
||||
MutableArrayRemoveAllObjects( tempArr )
|
||||
for j = 0 to n - 1
|
||||
MutableArrayInsertObjectAtIndex( tempArr, @"0", j )
|
||||
next
|
||||
MutableArrayReplaceObjectAtIndex( tempArr, @"1", i )
|
||||
MutableStringAppendString( mutStr, fn ArrayComponentsJoinedByString( tempArr, @" " ) )
|
||||
MutableStringAppendString( mutStr, @"\n" )
|
||||
next
|
||||
end fn = fn StringWithString( mutStr )
|
||||
|
||||
NSLog( @"3:\n%@", fn IdentityMatrix( 3 ) )
|
||||
NSLog( @"5:\n%@", fn IdentityMatrix( 5 ) )
|
||||
NSLog( @"7:\n%@", fn IdentityMatrix( 7 ) )
|
||||
NSLog( @"9:\n%@", fn IdentityMatrix( 9 ) )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue