Skip to content

Commit

Permalink
missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
lehner committed Jul 12, 2024
1 parent 4921b80 commit bdf6778
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/gpt/ad/reverse/foundation/matrix/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# GPT - Grid Python Toolkit
# Copyright (C) 2023 Christoph Lehner ([email protected], https://github.com/lehner/gpt)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import gpt.ad.reverse.foundation.matrix.exp
43 changes: 43 additions & 0 deletions lib/gpt/ad/reverse/foundation/matrix/exp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# GPT - Grid Python Toolkit
# Copyright (C) 2023 Christoph Lehner ([email protected], https://github.com/lehner/gpt)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import gpt as g
import numpy as np


def function(x):
fac = 1.0
base = 128.0
nbase = 7
x = x / base
c = x
r = g.identity(x)
for i in range(1, 10):
fac /= float(i)
r = r + fac * c
c = c * x
for i in range(nbase):
r = r * r
return r


# gives 1e-14 / 1e-15 errors up to at least |x| < 10


def function_and_gradient(x, dx):
assert False

0 comments on commit bdf6778

Please sign in to comment.