설명
메가 슬롯 라이브러리가 구축 가능한지 테스트하고 일단 구축되면
몇 가지 간단한 테스트를 통과했습니다.
기여자: 스티브
BUILDLIB가 설정되지 않은 경우 quality.gms에서 힌트를 얻으세요.
GHOST가 설정되지 않았습니다.
이 시점에서 BUILDLIB는 NO 또는 YES입니다.
소형 모델 유형 :메가 슬롯
카테고리 : 메가 슬롯 테스트 라이브러리
메인 파일 : cpplib00.gms
$title 메가 슬롯 라이브러리 테스트 빌드 (CPPLIB00,SEQ=657)
$onText
메가 슬롯 라이브러리가 빌드 가능한지 테스트하고 일단 빌드되면
몇 가지 간단한 테스트를 통과했습니다.
기여자: 스티브
$offText
$onDollar
$ifThen BUILDLIB를 설정하지 않음
* BUILDLIB가 설정되지 않은 경우 quality.gms에서 힌트를 얻으세요.
$ noComp를 설정한 경우 $set BUILDLIB NO
$endIf
$ifThen BUILDLIB를 설정하지 않음
$ 탈출 &
$ ifThen.xx %sysenv.GHOST% == %&sysenv.GHOST%&
* GHOST가 설정되지 않았습니다.
$ 세트 BUILDLIB NO
$ 다른.xx
$ 세트 BUILDLIB 예
$ endIf.xx
$ 탈출 %
$endIf
$%BUILDLIB%가 아닌 경우 == NO $set BUILDLIB YES
* 이 시점에서 BUILDLIB는 NO 또는 YES입니다.
$ifThen.bld %BUILDLIB% == 예
$ ifThen.unzip이 존재합니다. cppcclib.메가 슬롯
$ 로그 파일 cppcclib.메가 슬롯가 이미 존재합니다. cppsource.zip의 압축을 풀지 않습니다.
$ else.압축 해제
$ 전화 gmsunzip -o cppsource.zip
$ endIf.압축 해제
$ ifThen %system.buildcode% == DEG
$ rm -f libexample64.dylib 호출
$ log 플랫폼 DEG용 메가 슬롯 라이브러리 구축
$ 호출 g++ -fPIC -fvisibility=hidden -dynamiclib -shared -Wall -o libexample64.dylib cppcclib.메가 슬롯 cppcclibql.c -lm -ldl -lstdc++
$ ifThen.DEG가 존재하지 않습니다. libexample64.dylib
$ log 예제 공유 라이브러리 libexample64.dylib를 찾을 수 없음: 빌드가 실패했습니다.
$ abort DEG에 대한 예제 공유 라이브러리를 생성할 수 없습니다.
$ endIf.DEG
$ funcLibIn myLib ./libexample64.dylib
$ elseIf %system.buildcode% == DAC
$ rm -f libexample64.dylib 호출
$ log 플랫폼 DAC용 메가 슬롯 라이브러리 구축
$ 호출 clang++ -fPIC -fvisibility=hidden -dynamiclib -shared -Wall -Wno-deprecated -Wno-deprecated-declarations -o libexample64.dylib cppcclib.메가 슬롯 cppcclibql.c -lm -ldl
$ ifThen.DAC가 존재하지 않습니다. libexample64.dylib
$ log 예제 공유 라이브러리 libexample64.dylib를 찾을 수 없음: 빌드가 실패했습니다.
$ abort DAC용 예제 공유 라이브러리를 생성할 수 없습니다.
$ endIf.DAC
$ funcLibIn myLib ./libexample64.dylib
$ elseIf %system.buildcode% == LAG
$ 전화 rm -f libexample64.so
$ log 플랫폼 LAG용 메가 슬롯 라이브러리 구축
$ 호출 g++ -fPIC -nostartfiles -shared -Wl,-Bsymbolic -pthread -Wall -o libexample64.so cppcclib.메가 슬롯 cppcclibql.c -lm -ldl -lstdc++
$ ifThen.LAG가 존재하지 않습니다. libexample64.so
$ log 예시 공유 라이브러리 libexample64.so를 찾을 수 없음: 빌드가 실패했습니다.
$ abort LAG용 예시 공유 라이브러리를 생성할 수 없습니다.
$ endIf.LAG
$ funcLibIn myLib ./libexample64.so
$ elseIf %system.buildcode% == 다리
$ 전화 rm -f libexample64.so
$ log 플랫폼 LEG용 메가 슬롯 라이브러리 구축
$ 호출 g++ -fPIC -nostartfiles -shared -Wl,-Bsymbolic -pthread -Wall -o libexample64.so cppcclib.메가 슬롯 cppcclibql.c -m64 -lm -ldl -lstdc++
$ ifThen.LEG가 존재하지 않습니다. libexample64.so
$ log 예시 공유 라이브러리 libexample64.so를 찾을 수 없음: 빌드가 실패했습니다.
$ abort LEG에 대한 예제 공유 라이브러리를 생성할 수 없습니다.
$ endIf.LEG
$ funcLibIn myLib ./libexample64.so
$ elseIf %system.buildcode% == WEI
$ rm -f example64.dll 호출
$ log WEI 플랫폼용 메가 슬롯 라이브러리 구축
$ icl.exe 호출 -nologo -O3 -D_CRT_DISABLE_PERFCRIT_LOCKS -D_CRT_SECURE_NO_WARNINGS -LD -Feexample64.dll cppcclib.메가 슬롯 cppcclibql.c -link -nodefaultlib:libc.lib
$ ifThen.WEI가 존재하지 않습니다. example64.dll
$ log 예제 공유 라이브러리 example64.dll을 찾을 수 없음: 빌드가 실패했습니다.
$ abort WEI에 대한 예제 공유 라이브러리를 생성할 수 없습니다.
$ endIf.WEI
$ funcLibIn myLib ./example64.dll
$ 다른
$ log 분기가 수행되지 않음: 테스트 구현이 불완전함
$ abort %system.buildcode% 플랫폼에 대한 빌드 명령을 찾을 수 없습니다: 중단 중
$ endIf
$else.bld
$ if %system.platform% == DEX $funcLibIn myLib libcppcclib64.dylib
$ if %system.platform% == DAX $funcLibIn myLib libcppcclib64.dylib
$ if %system.platform% == LAX $funcLibIn myLib libcppcclib64.so
$ if %system.platform% == LEX $funcLibIn myLib libcppcclib64.so
$ if %system.platform% == WEX $funcLibIn myLib cppcclib64.dll
$endIf.bld
$if not errorfree $abort 외부 라이브러리 myLib 초기화 오류: 중단 중
function cdf1 '단변량 정규의 CDF' / myLib.cdfUVN /;
세트
나는 / i1 * i5 /
k / 원하고, 얻었습니다 /
;
매개변수
x(i) /
i1 -50
i2 -1
i3 EPS
i4 1
i5 50
/,
f_(i) /
i1eps
i2 .1586552539314570
i3 .5
i4 .8413447460685429
i5 1.0
/,
g_(i) /
i1eps
i2 .2419707245191433
i3 .3989422804014327
i4 .2419707245191433
i5 EPS
/,
h_(i) /
i1eps
i2 0.241970724519143
i3 0
i4 -0.241970724519143
i5 EPS
/,
v(i), d(i);
v(i) = cdf1(x(i)) + eps;
d(i) = 절대(v(i)-f_(i));
abort$[smaxi, d(i) > 1e-14] '잘못된 함수 값', d, v, f_;
v(i) = cdf1.grad(x(i)) + eps;
d(i) = 절대(v(i)-g_(i));
abort$[smaxi, d(i) > 1e-14] '잘못된 기울기 값', d, v, g_;
v(i) = cdf1.hess(x(i)) + eps;
d(i) = 절대(v(i)-h_(i));
abort$[smaxi, d(i) > 1e-13] '잘못된 헤시안 값', d, v, h_;
$log 메가 슬롯 라이브러리 테스트가 플랫폼 %system.buildcode%에 대해 통과되었습니다.