SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1811.01255 · 2018

Adjoint method and inverse design for nonlinear nanophotonic devices

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1811.01255.json · badge: /api/ran/1811.01255.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
fancompute/angler canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
FunctionStatusWhere it lives
born_solve Ran
ran on a synthesized input
fancompute/angler/angler/nonlinear_solvers.py
code served (permissive licence) · get_code("858120866a57644b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from copy import deepcopy

class MockSimulation:
    def __init__(self):
        self.pol = 'z'
        self.fields = {
            'z': None
        }
        self.nl_state = None
    
    def solve_fields(self, include_nl=False):
        # Return three field components with shape (4, 3)
        Fx = np.random.randn(4, 3)
        Fy = np.random.randn(4, 3)
        Fz = np.random.randn(4, 3)
        return Fx, Fy, Fz
    
    def compute_nl(self, Fprev):
        # Store the nonlinear computation result
        self.nl_state = deepcopy(Fprev)

simulation = MockSimulation()

ARGS = {
    'simulation': simulation,
    'Estart': None,
    'conv_threshold': 1e-10,
    'max_num_iter': 50,
    'averaging': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dL Ran
ran on a synthesized input
fancompute/angler/angler/linalg.py
code served (permissive licence) · get_code("dc2c0c3d4d350bfa")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create valid xrange and yrange as 1D numpy arrays
xrange = np.array([0.0, 1.0, 2.0, 3.0])
yrange = np.array([0.0, 0.5, 1.0])

# Create N as an integer
N = 2

ARGS = {
    "N": N,
    "xrange": xrange,
    "yrange": yrange
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
dist Ran
ran on a synthesized input
fancompute/angler/angler/filter.py
code served (permissive licence) · get_code("1744298ad3e56411")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The function dist() takes two parameters: r1 and r2
# It computes the Euclidean distance between them
# Both should be numpy arrays or array-like objects

r1 = np.array([1.0, 2.0, 3.0, 4.0])
r2 = np.array([5.0, 6.0, 7.0, 8.0])

ARGS = {
    "r1": r1,
    "r2": r2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
grid_average Ran
ran on a synthesized input
fancompute/angler/angler/linalg.py
code served (permissive licence) · get_code("4c7f7884cc19ebaa")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a small 2D numpy array as center_array
# Using shape (4, 3) to have distinct dimensions for x and y axes
center_array = np.array([
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0],
    [10.0, 11.0, 12.0]
])

# w parameter should be either 'x' or 'y' based on the function's xy dict
w = 'x'

ARGS = {
    'center_array': center_array,
    'w': w
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_equal Ran
ran on a synthesized input
fancompute/angler/angler/linalg.py
code served (permissive licence) · get_code("6ef0316ccb7b56e1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import scipy.sparse

torch.manual_seed(0)

# The function calls .nnz on the result of (matrix1 != matrix2)
# This suggests sparse matrices (scipy sparse or torch sparse)
# Let's use scipy sparse matrices since they have .nnz attribute

matrix1 = scipy.sparse.csr_matrix(
    [[1, 0, 2, 0],
     [0, 3, 0, 4]]
)

matrix2 = scipy.sparse.csr_matrix(
    [[1, 0, 2, 0],
     [0, 3, 0, 4]]
)

ARGS = {
    "matrix1": matrix1,
    "matrix2": matrix2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sub2ind Ran
ran on a synthesized input
fancompute/angler/angler/filter.py
code served (permissive licence) · get_code("0ee590fb57528f3d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family int, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function sub2ind converts 2D array indices (rows, cols) to 1D linear indices
# It takes:
# - array_shape: a tuple/list with at least 2 elements (height, width)
# - rows: row indices (can be scalar, array, or tensor)
# - cols: column indices (can be scalar, array, or tensor)

array_shape = (5, 3)  # 5 rows, 3 columns
rows = np.array([0, 2, 4])
cols = np.array([1, 0, 2])

ARGS = {
    "array_shape": array_shape,
    "rows": rows,
    "cols": cols
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (3,) — shape (3,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
unpack_derivs Ran
ran on a synthesized input
fancompute/angler/angler/derivatives.py
code served (permissive licence) · get_code("0132cc60f8abaa57")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function unpacks a dictionary with keys 'Dyb', 'Dxb', 'Dxf', 'Dyf'
# Each key maps to a tensor (based on the naming convention for derivatives)

derivs = {
    'Dyb': torch.randn(2, 4),
    'Dxb': torch.randn(2, 3),
    'Dxf': torch.randn(2, 5),
    'Dyf': torch.randn(2, 6)
}

ARGS = {
    'derivs': derivs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
wrap Ran
ran on a synthesized input
fancompute/angler/angler/filter.py
code served (permissive licence) · get_code("ac5bb54e71bb72e1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# def wrap(i, N):
#     return i + (i >= N) * (i - N) + (i < 0) * (i + N)
#
# This function takes:
# - i: a value that can be compared with N and supports arithmetic operations
# - N: a value that defines the wrapping boundary
#
# The function appears to implement wrapping/modulo logic:
# - if i >= N: return i - N (wraps high values down)
# - if i < 0: return i + N (wraps negative values up)
# - otherwise: return i
#
# i and N should be integers or tensors that support comparison and arithmetic

# Test with simple integers
i = 5
N = 10

ARGS = {
    "i": i,
    "N": N
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
n2_from_chi3 Not yet run
unverified (harvested, no recorded run)
fancompute/angler/angler/constants.py
code served (permissive licence) · get_code("48aecec5cf1aeabd")
How it ran

no invocation recorded.

plt_base Not yet run
unverified (harvested, no recorded run)
fancompute/angler/angler/plot.py
code served (permissive licence) · get_code("70512aecf1fcccae")
How it ran

no invocation recorded.

plt_base_ani Not yet run
unverified (harvested, no recorded run)
fancompute/angler/angler/plot.py
code served (permissive licence) · get_code("5e50b8fea4fe1aa1")
How it ran

no invocation recorded.

plt_base_eps Not yet run
unverified (harvested, no recorded run)
fancompute/angler/angler/plot.py
code served (permissive licence) · get_code("584f88181a408f8f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 12 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The development of inverse design, where computational optimization techniques are used to design devices based on certain specifications, has led to the discovery of many compact, non-intuitive structures with superior performance. Among various methods, large-scale, gradient-based optimization techniques have been one of the most important ways to design a structure containing a vast number of degrees of freedom. These techniques are made possible by the adjoint method, in which the gradient of an objective function with respect to all design degrees of freedom can be computed using only two full-field simulations. However, this approach has so far mostly been applied to linear photonic devices. Here, we present an extension of this method to modeling nonlinear devices in the frequency domain, with the nonlinear response directly included in the gradient computation. As illustrations, we use the method to devise compact photonic switches in a Kerr nonlinear material, in which low-power and high-power pulses are routed in different directions. Our technique may lead to the development of novel compact nonlinear photonic devices.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1811.01255")
get_code_for_paper("1811.01255")
have("1811.01255")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1811.01255.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1811.01255.svg)](https://syntology.ai/paper/1811.01255)

Connect an agent — have() is free.