Search found 199 matches
- Feb 23, 2019 12:11
- Forum: Linux
- Topic: Improved autovectorization with pointers, 64 bit linux, gcc 8.20
- Replies: 1
- Views: 5521
Improved autovectorization with pointers, 64 bit linux, gcc 8.20
By using pointers for array operations you may get up to a 4 times speed improvement with Linux 64bit PC and GCC 8.2.0 You may have to experiment with reordering the code to get gcc to autovectorize. You must use the -O 3 compiler command line option:Eg fbc -O 3 test.bas sub multiply(result() as sin...
- Apr 06, 2017 23:34
- Forum: General
- Topic: Inline assembler
- Replies: 48
- Views: 11627
Re: Inline assembler
.align 16 You can also put static data in eg. lea rdi,[rdi+64] jnz flipAlp ret flipshift: .int 1,2,4,8,16,32,64,128 .int 256,512,1024,2048,4096,8192,16384,32768 flipmask: .int 0x80000000,0x80000000,0x80000000,0x80000000 rndphi: .quad 0x9E3779B97F4A7C15 rndsqr3: .quad 0xBB67AE8584CAA73B I forget if ...
- Feb 16, 2017 2:08
- Forum: Sources, Examples, Tips and Tricks
- Topic: Mini chaos
- Replies: 5
- Views: 1872
Re: Mini chaos
I tried the logistic chaos function as well.
Code: Select all
screenres 500,500,32
dim as const single c1=3.99,c2=3.999
dim as single x=.6!,y=.5!
for i as ulong=0 to 9999
x=c1*x*(1!-x)
y=c2*y*(1!-y)
pset (x*499,y*499)
next
getkey
- Feb 16, 2017 1:59
- Forum: Sources, Examples, Tips and Tricks
- Topic: Mini chaos
- Replies: 5
- Views: 1872
Mini chaos
function chaos(x as single,c as single) as single x*=c dim as ulong ptr px=cast(ulong ptr,@x) *px and=&h007fffff *px or=&h3f800000 return x-1! end function screenres 500,500,32 dim as single x=.6!,y=.3! for i as ulong=0 to 9999 x=chaos(x,.932!) y=chaos(y,.133111!) pset (x*499,y*499) next ge...
- Feb 13, 2017 14:16
- Forum: Beginners
- Topic: Memory coping with assembler.
- Replies: 11
- Views: 2854
Re: Memory coping with assembler.
That reminds me that capturing mouse events in Java is very unreliable. Sometimes you get them, sometimes you don't!
- Feb 09, 2017 0:09
- Forum: General
- Topic: Returning Arrays
- Replies: 21
- Views: 4418
Re: Returning Arrays
Are you looking for generic types? Have you tried using macros? Does the code need to be thread safe?
I guess some of the tools available are:
defines
macros
namespaces
pointers
types
scope
I guess some of the tools available are:
defines
macros
namespaces
pointers
types
scope
- Feb 08, 2017 16:00
- Forum: General
- Topic: Returning Arrays
- Replies: 21
- Views: 4418
Re: Returning Arrays
Yeh, I avoid arrays now for any kind of library code or code that I intend to reuse. I simply work with pointers. Often that means passing an extra length parameter to sub's and functions. The question is - do pointers generally increase or decrease the overall number of lines of code and the comple...
- Feb 06, 2017 23:55
- Forum: Sources, Examples, Tips and Tricks
- Topic: On FreeBASIC's random number generators.
- Replies: 35
- Views: 9125
Re: On FreeBASIC's random number generators.
You can tune a RNG to a test system's blind spots, and still (literally) see structure in RNG's output in practical applications. That happened to me with one of Vigna's earlier generators. With these short algorithms there is always structure in the output. It only really matters if it causes probl...
- Feb 05, 2017 4:09
- Forum: General
- Topic: xor neural net
- Replies: 11
- Views: 2386
- Feb 03, 2017 12:29
- Forum: Windows
- Topic: A fast CPRNG
- Replies: 85
- Views: 22226
Re: A fast CPRNG
I suppose you could try to control markets by correlation breaking, that's maybe one for the Simons institute and the extremely rich Mr. Simons.
- Feb 03, 2017 6:03
- Forum: Windows
- Topic: A fast CPRNG
- Replies: 85
- Views: 22226
Re: A fast CPRNG
Anyway the main use of pseudo-random number generators in most applications is correlation breaking, which fortunately isn't too difficult.
- Feb 03, 2017 5:58
- Forum: Windows
- Topic: A fast CPRNG
- Replies: 85
- Views: 22226
Re: A fast CPRNG
I think a better way or at least faster way to convent a 32/64 bit random integer is just to multiply by a floating point constant (here for 64 bit ULongInt): ' (0,1] function rndSingle() as single return rand()*5.4210107e-20! end function ' [-1,1] function rndSingleSym() as single return cast(longi...
- Feb 01, 2017 23:42
- Forum: General
- Topic: xor neural net
- Replies: 11
- Views: 2386
Re: xor neural net
I think you can just use mutation random hill climbing to train a neural net. https://groups.google.com/forum/#!topic/artificial-general-intelligence/TVvry50HEwI It is actually working out quite well. Just slightly alter the weights by some random process and see if that has improved the network. If...
- Feb 01, 2017 13:40
- Forum: Community Discussion
- Topic: Best Programming Language
- Replies: 34
- Views: 10168
Re: Best Programming Language
I suppose so. I think FB has a single pass compiler or something and that's why you need declares. I agree that it's not as big a problem as in C.
- Jan 31, 2017 22:34
- Forum: Community Discussion
- Topic: Best Programming Language
- Replies: 34
- Views: 10168
Re: Best Programming Language
Apparently you can run FreshIDE under Wine, and have it generate native Linux executables. That process is so convoluted, I'll wait. Anyway there would be no performance gains over FB. I'm just interested in reducing the amount of written code while maintaining readability. I'd like to be able to d...