-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
properties of vector,matrix,tensor functions
- Loading branch information
Showing
20 changed files
with
653 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SciLean.Data.DataArray.Operations.Trace | ||
import SciLean.Data.DataArray.Operations.Matmul | ||
|
||
namespace SciLean | ||
|
||
open DataArrayN | ||
|
||
def_fun_prop det in A | ||
with_transitive : Differentiable R by sorry_proof | ||
|
||
abbrev_fun_trans det in A [DecidableEq I] : fderiv R by | ||
-- Jacobi's formula: https://en.wikipedia.org/wiki/Jacobi%27s_formula | ||
equals (fun A => fun dA =>L[R] A.det * (A⁻¹ * dA).trace) => | ||
sorry_proof | ||
|
||
abbrev_fun_trans det in A [DecidableEq I] : fwdFDeriv R by unfold fwdFDeriv; autodiff | ||
|
||
abbrev_fun_trans det in A [DecidableEq I] : revFDeriv R by | ||
unfold revFDeriv | ||
fun_trans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import SciLean.Data.DataArray.Operations.Multiply | ||
import SciLean.Data.ArrayType.Properties | ||
import SciLean.Analysis.SpecialFunctions.Exp | ||
|
||
namespace SciLean.DataArrayN | ||
|
||
open Scalar | ||
|
||
variable | ||
{R : Type*} [RealScalar R] [PlainDataType R] | ||
{I : Type*} [IndexType I] | ||
|
||
set_default_scalar R | ||
|
||
|
||
def_fun_prop exp in x : Differentiable R by | ||
unfold exp; fun_prop | ||
|
||
abbrev_fun_trans DataArrayN.exp in x : fderiv R by | ||
equals (fun x => fun dx =>L[R] dx.multiply x.exp) => | ||
fun_trans[multiply,exp,Function.HasUncurry.uncurry] | ||
|
||
abbrev_fun_trans DataArrayN.exp in x : fwdFDeriv R by | ||
unfold fwdFDeriv | ||
autodiff | ||
|
||
abbrev_fun_trans DataArrayN.exp in x [DecidableEq I] : revFDeriv R by | ||
unfold revFDeriv | ||
autodiff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import SciLean.Data.DataArray.Operations.Multiply | ||
import SciLean.Data.ArrayType.Properties | ||
import SciLean.Analysis.SpecialFunctions.Log | ||
|
||
namespace SciLean.DataArrayN | ||
|
||
open Scalar | ||
|
||
variable | ||
{R : Type*} [RealScalar R] [PlainDataType R] | ||
{W} [NormedAddCommGroup W] [NormedSpace R W] | ||
{U} [NormedAddCommGroup U] [AdjointSpace R U] [CompleteSpace U] | ||
{I : Type*} [IndexType I] | ||
|
||
set_default_scalar R | ||
|
||
def_fun_prop (x : W → R^[I]) (hx : Differentiable R x) (hx' : ∀ w i, (x w)[i] ≠ 0) : | ||
Differentiable R (fun w => (x w).log) by | ||
unfold log | ||
intro x | ||
fun_prop (disch:=sorry_proof) | ||
|
||
-- abbrev_fun_trans DataArrayN.log in x : fderiv R by | ||
-- equals (fun x => fun dx =>L[R] dx.multiply x.exp) => | ||
-- fun_trans[multiply,exp,Function.HasUncurry.uncurry] | ||
|
||
-- abbrev_fun_trans DataArrayN.exp in x : fwdFDeriv R by | ||
-- unfold fwdFDeriv | ||
-- autodiff | ||
|
||
-- abbrev_fun_trans DataArrayN.exp in x [DecidableEq I] : revFDeriv R by | ||
-- unfold revFDeriv | ||
-- autodiff |
Oops, something went wrong.